@tracelane/core 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 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/README.md CHANGED
@@ -1,15 +1,27 @@
1
+ <img src="https://raw.githubusercontent.com/Cubenest/rrweb-stack/main/assets/brand/sub-tracelane.svg" height="40" alt="tracelane">
2
+
1
3
  # @tracelane/core
2
4
 
3
- Framework-agnostic recording engine for [`tracelane`](https://github.com/Cubenest/rrweb-stack/tree/main/packages/tracelane-core). Wraps a per-framework `browser` object behind a common `BrowserExecutor` interface, injects the rrweb capture bundle, drains in-page events to Node, and builds the buffer that the report packages render.
5
+ > The reporter for your WebdriverIO tests Playwright and Cypress on the roadmap. Self-contained HTML for every run — replay failures, audit successes, attach to any bug tracker. No SaaS, no dashboard, no signup.
6
+
7
+ Framework-agnostic recording engine for `tracelane`. Wraps a per-framework `browser` object behind a common `BrowserExecutor` interface, injects the rrweb capture bundle, drains in-page events to Node, and builds the buffer that the report packages render.
8
+
9
+ **Not intended for direct consumption** — depend on a product package instead:
10
+
11
+ ```sh
12
+ npm install --save-dev @tracelane/wdio # WebdriverIO Service
13
+ # @tracelane/playwright — planned Q3 2026
14
+ # @tracelane/cypress — planned Q4 2026
15
+ ```
4
16
 
5
- Not intended for direct consumption — depend on a product package (`@tracelane/wdio`, `@tracelane/playwright`, `@tracelane/cypress`) instead.
17
+ See the [`@tracelane/wdio` README](https://github.com/Cubenest/rrweb-stack/tree/main/packages/tracelane-wdio) for the integration guide.
6
18
 
7
19
  ## What's in here
8
20
 
9
- - `BrowserExecutor` — the framework-agnostic surface that adapters implement (see [ADR-0004](https://github.com/Cubenest/rrweb-stack/blob/main/prds/adrs/0004-p1-wdio-service-not-reporter.md)).
10
- - Recorder controller — in-page buffer install + Node-polled drain (see [ADR-0006](https://github.com/Cubenest/rrweb-stack/blob/main/prds/adrs/0006-p1-in-page-buffer-node-polled.md)).
21
+ - `BrowserExecutor` — the framework-agnostic surface that adapters implement.
22
+ - Recorder controller — in-page buffer install + Node-polled drain.
11
23
  - Navigation re-injection with a 250ms cooldown + `tracelane.nav` boundary events.
12
- - Mode switch (`'failed' | 'all'`) and a 25 MB FullSnapshot-preserving report-size guard (see [ADR-0005](https://github.com/Cubenest/rrweb-stack/blob/main/prds/adrs/0005-p1-failed-only-self-contained-html.md)).
24
+ - Mode switch (`'failed' | 'all'`) and a 25 MB FullSnapshot-preserving report-size guard.
13
25
 
14
26
  Built on [`@cubenest/rrweb-core`](https://github.com/Cubenest/rrweb-stack/tree/main/packages/rrweb-core).
15
27
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  export type { BrowserExecutor } from './browser-executor.js';
2
+ export { __internal, attachNetworkCapture } from './network-capture.js';
3
+ export { loadRrwebBundle } from './load-rrweb-bundle.js';
2
4
  export { createRecorder, DEFAULT_COOLDOWN_MS, DEFAULT_DRAIN_INTERVAL_MS } from './recorder.js';
3
5
  export type { FinalizeResult, Recorder, RecorderOptions, TestOutcome } from './recorder.js';
4
- export type { ConsolePluginOptions } from './page-script.js';
6
+ export type { ConsolePluginOptions, NetworkPluginOptions } from './page-script.js';
5
7
  export { DEFAULT_MODE, resolveMode } from './mode.js';
6
8
  export type { Mode } from './mode.js';
7
9
  export { MAX_REPORT_BYTES, PRUNE_EVENT_TAG, pruneToSizeBudget, serializedSize, } from './size-guard.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC/F,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5F,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACtD,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAO7D,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAIxE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC/F,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5F,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGnF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACtD,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,13 @@
1
1
  // Public API surface for @tracelane/core.
2
+ // CDP network capture (Task 2.16 / P1 PRD §E.2) — framework-agnostic, shared by
3
+ // the WDIO and Playwright adapters via the BrowserExecutor surface. `__internal`
4
+ // exposes the pure page-side logger + method resolver so @tracelane/report's
5
+ // cross-package contract test can exercise core's real output (the test must
6
+ // live in report — which depends on core — to keep the dep edge one-directional).
7
+ export { __internal, attachNetworkCapture } from './network-capture.js';
8
+ // In-page rrweb bundle loader — reads the adapter's built dist/rrweb-bundle.js
9
+ // off disk (pass the adapter's import.meta.url). Shared across adapters.
10
+ export { loadRrwebBundle } from './load-rrweb-bundle.js';
2
11
  // Recorder controller — in-page buffer install + Node-polled drain (ADR-0006).
3
12
  export { createRecorder, DEFAULT_COOLDOWN_MS, DEFAULT_DRAIN_INTERVAL_MS } from './recorder.js';
4
13
  // Capture mode switch (ADR-0005).
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAK1C,+EAA+E;AAC/E,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAI/F,kCAAkC;AAClC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGtD,yEAAyE;AACzE,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,cAAc,GACf,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAK1C,gFAAgF;AAChF,iFAAiF;AACjF,6EAA6E;AAC7E,6EAA6E;AAC7E,kFAAkF;AAClF,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAExE,+EAA+E;AAC/E,yEAAyE;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,+EAA+E;AAC/E,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAI/F,kCAAkC;AAClC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGtD,yEAAyE;AACzE,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,cAAc,GACf,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Read the rrweb in-page bundle source (defines `window.rrweb`) off disk.
3
+ *
4
+ * @param moduleUrl the calling adapter's `import.meta.url`; candidate
5
+ * paths resolve relative to this module.
6
+ * @param candidatePaths optional explicit candidate paths (overrides the
7
+ * defaults). The first that exists is read.
8
+ * @returns the bundle source string.
9
+ * @throws if no candidate exists — that means the package was used without its
10
+ * build step having run.
11
+ */
12
+ export declare function loadRrwebBundle(moduleUrl: string, candidatePaths?: string[]): string;
13
+ //# sourceMappingURL=load-rrweb-bundle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-rrweb-bundle.d.ts","sourceRoot":"","sources":["../src/load-rrweb-bundle.ts"],"names":[],"mappings":"AA8BA;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAUpF"}
@@ -0,0 +1,47 @@
1
+ // Loads the in-page rrweb bundle source string (framework-agnostic).
2
+ //
3
+ // Each adapter (WDIO, Playwright) ships its own `dist/rrweb-bundle.js` — an
4
+ // esbuild IIFE that defines `window.rrweb` with `record` +
5
+ // `getRecordConsolePlugin` (+ `getRecordNetworkPlugin`). The recorder is
6
+ // bundle-source-agnostic (ADR-0006) and expects this source as a plain string,
7
+ // which it `window.eval`s in the page on every (re-)injection.
8
+ //
9
+ // This loader lives in @tracelane/core so every adapter shares one
10
+ // implementation. The adapter passes its own `import.meta.url` so the candidate
11
+ // paths resolve relative to the ADAPTER's module (where its bundle sits), not to
12
+ // core. We derive the module directory from `fileURLToPath(moduleUrl)` directly
13
+ // (not via `new URL(rel, moduleUrl)`) because under the jsdom test env the
14
+ // global `URL` resolves relative inputs against the page origin, not the file.
15
+ import { existsSync, readFileSync } from 'node:fs';
16
+ import { dirname, join } from 'node:path';
17
+ import { fileURLToPath } from 'node:url';
18
+ /**
19
+ * Default candidate locations for the built bundle relative to `moduleUrl`, in
20
+ * priority order. Mirrors the historical wdio layout:
21
+ * - Published: `dist/<loader>.js` sits next to `dist/rrweb-bundle.js`.
22
+ * - Source/test: `src/<loader>.ts` → `../dist/rrweb-bundle.js`.
23
+ */
24
+ function defaultCandidatePaths(moduleUrl) {
25
+ const moduleDir = dirname(fileURLToPath(moduleUrl));
26
+ return [join(moduleDir, 'rrweb-bundle.js'), join(moduleDir, '..', 'dist', 'rrweb-bundle.js')];
27
+ }
28
+ /**
29
+ * Read the rrweb in-page bundle source (defines `window.rrweb`) off disk.
30
+ *
31
+ * @param moduleUrl the calling adapter's `import.meta.url`; candidate
32
+ * paths resolve relative to this module.
33
+ * @param candidatePaths optional explicit candidate paths (overrides the
34
+ * defaults). The first that exists is read.
35
+ * @returns the bundle source string.
36
+ * @throws if no candidate exists — that means the package was used without its
37
+ * build step having run.
38
+ */
39
+ export function loadRrwebBundle(moduleUrl, candidatePaths) {
40
+ const candidates = candidatePaths && candidatePaths.length > 0 ? candidatePaths : defaultCandidatePaths(moduleUrl);
41
+ const found = candidates.find((p) => existsSync(p));
42
+ if (found === undefined) {
43
+ throw new Error(`tracelane: in-page rrweb bundle not found (looked in ${candidates.join(', ')}). Run the package build to generate dist/rrweb-bundle.js.`);
44
+ }
45
+ return readFileSync(found, 'utf8');
46
+ }
47
+ //# sourceMappingURL=load-rrweb-bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-rrweb-bundle.js","sourceRoot":"","sources":["../src/load-rrweb-bundle.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,4EAA4E;AAC5E,2DAA2D;AAC3D,yEAAyE;AACzE,+EAA+E;AAC/E,+DAA+D;AAC/D,EAAE;AACF,mEAAmE;AACnE,gFAAgF;AAChF,iFAAiF;AACjF,gFAAgF;AAChF,2EAA2E;AAC3E,+EAA+E;AAE/E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;;GAKG;AACH,SAAS,qBAAqB,CAAC,SAAiB;IAC9C,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IACpD,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAChG,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,SAAiB,EAAE,cAAyB;IAC1E,MAAM,UAAU,GACd,cAAc,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAClG,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CACb,wDAAwD,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,4DAA4D,CAC1I,CAAC;IACJ,CAAC;IACD,OAAO,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { BrowserExecutor } from './browser-executor.js';
2
+ /**
3
+ * Page-side logger. Self-contained (no Node closures) so it can be
4
+ * `.toString()`-serialized by `execute` (PRD §A.4). The console plugin captures
5
+ * this `console.error`; the `[tracelane.net]` prefix lets the report's network
6
+ * panel scrape it back out (PRD §E.2).
7
+ *
8
+ * The status is zero-padded to 3 digits so it satisfies panels.ts's
9
+ * `parseNetConsoleLine` regex (`(\d{3})`); `Number('000')` parses back to a
10
+ * genuine `0`, which — paired with the always-present method — panels.ts treats
11
+ * as a true network failure.
12
+ */
13
+ declare function logNetworkErrorInPage(url: string, status: number, method: string): void;
14
+ /** Pull the request method out of CDP request headers, defaulting to GET. */
15
+ declare function methodOf(headers: Record<string, string> | undefined): string;
16
+ /**
17
+ * Attach CDP network capture to a BrowserExecutor (P1 PRD §E.2).
18
+ *
19
+ * Enables the Network domain and registers subscribers that forward both HTTP
20
+ * error responses (`Network.responseReceived`, `status >= 400`) and no-response
21
+ * failures (`Network.loadingFailed` — CORS/DNS/offline/abort, audit A-6) into
22
+ * `console.error`. Resolves once `Network.enable` has been sent. The
23
+ * subscribers' own `execute` calls are fire-and-forget (their failures must not
24
+ * break the test).
25
+ *
26
+ * To give the methodless `loadingFailed` events a method (required by panels.ts
27
+ * to classify the row as failed), we keep a small `requestId → { method, url }`
28
+ * map populated from `Network.requestWillBeSent`, and evict an entry once it has
29
+ * either succeeded (`responseReceived`) or failed (`loadingFailed`) so the map
30
+ * can't grow unbounded over a long session.
31
+ */
32
+ export declare function attachNetworkCapture(executor: BrowserExecutor): Promise<void>;
33
+ export declare const __internal: {
34
+ logNetworkErrorInPage: typeof logNetworkErrorInPage;
35
+ methodOf: typeof methodOf;
36
+ };
37
+ export {};
38
+ //# sourceMappingURL=network-capture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"network-capture.d.ts","sourceRoot":"","sources":["../src/network-capture.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAoC7D;;;;;;;;;;GAUG;AACH,iBAAS,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAMhF;AAED,6EAA6E;AAC7E,iBAAS,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,CAKrE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAoDnF;AAGD,eAAO,MAAM,UAAU;;;CAAsC,CAAC"}
@@ -0,0 +1,125 @@
1
+ // CDP network capture wiring (Task 2.16 / P1 PRD §E.2).
2
+ //
3
+ // Enable the CDP Network domain and route failures into the page's
4
+ // `console.error` via `executor.execute`. Two failure classes are surfaced:
5
+ //
6
+ // 1. `Network.responseReceived` with `status >= 400` — a response arrived
7
+ // but the server reported an HTTP error (4xx/5xx).
8
+ // 2. `Network.loadingFailed` — the request produced NO response at all
9
+ // (CORS failure, DNS/connection failure, offline, abort). CDP's
10
+ // `responseReceived` never fires for these, and the in-page status-0
11
+ // wrapper is off by default, so without this branch a genuine failed
12
+ // request would be invisible (audit A-6). We surface it with an explicit
13
+ // status `000` (= a real 0 once parsed) so it reads as a true failure.
14
+ //
15
+ // The rrweb console plugin (installed by the recorder) then captures the
16
+ // console line, so failures show up in the report's network panel "for free" —
17
+ // no dedicated network transport in v1. Framework-agnostic: it talks only to a
18
+ // BrowserExecutor, so the WDIO and Playwright adapters share this one path.
19
+ //
20
+ // The console line is prefixed `[tracelane.net]` so @tracelane/report's network
21
+ // panel can scrape it back out (NETWORK_CONSOLE_PREFIX in panels.ts). The line
22
+ // ALWAYS carries a METHOD: panels.ts classifies a `status === 0` scrape row as
23
+ // a true failure only when a method is present (its "true error path" rule —
24
+ // see `isTrueErrorPath`), so a methodless `loadingFailed` line would be
25
+ // silently dropped from the panel.
26
+ /** Status sentinel for a request that produced no response (a true 0 once parsed). */
27
+ const NO_RESPONSE_STATUS = 0;
28
+ /**
29
+ * Page-side logger. Self-contained (no Node closures) so it can be
30
+ * `.toString()`-serialized by `execute` (PRD §A.4). The console plugin captures
31
+ * this `console.error`; the `[tracelane.net]` prefix lets the report's network
32
+ * panel scrape it back out (PRD §E.2).
33
+ *
34
+ * The status is zero-padded to 3 digits so it satisfies panels.ts's
35
+ * `parseNetConsoleLine` regex (`(\d{3})`); `Number('000')` parses back to a
36
+ * genuine `0`, which — paired with the always-present method — panels.ts treats
37
+ * as a true network failure.
38
+ */
39
+ function logNetworkErrorInPage(url, status, method) {
40
+ // Zero-pad to 3 digits without String.padStart so the .toString()-serialized
41
+ // form runs on older in-page engines too.
42
+ let code = String(status);
43
+ while (code.length < 3)
44
+ code = `0${code}`;
45
+ console.error(`[tracelane.net] ${method} ${code} ${url}`);
46
+ }
47
+ /** Pull the request method out of CDP request headers, defaulting to GET. */
48
+ function methodOf(headers) {
49
+ if (!headers)
50
+ return 'GET';
51
+ // CDP exposes the pseudo-header `:method` for HTTP/2/3; fall back to a plain
52
+ // `method` header, then GET.
53
+ return headers[':method'] ?? headers.method ?? 'GET';
54
+ }
55
+ /**
56
+ * Attach CDP network capture to a BrowserExecutor (P1 PRD §E.2).
57
+ *
58
+ * Enables the Network domain and registers subscribers that forward both HTTP
59
+ * error responses (`Network.responseReceived`, `status >= 400`) and no-response
60
+ * failures (`Network.loadingFailed` — CORS/DNS/offline/abort, audit A-6) into
61
+ * `console.error`. Resolves once `Network.enable` has been sent. The
62
+ * subscribers' own `execute` calls are fire-and-forget (their failures must not
63
+ * break the test).
64
+ *
65
+ * To give the methodless `loadingFailed` events a method (required by panels.ts
66
+ * to classify the row as failed), we keep a small `requestId → { method, url }`
67
+ * map populated from `Network.requestWillBeSent`, and evict an entry once it has
68
+ * either succeeded (`responseReceived`) or failed (`loadingFailed`) so the map
69
+ * can't grow unbounded over a long session.
70
+ */
71
+ export async function attachNetworkCapture(executor) {
72
+ await executor.cdp('Network', 'enable');
73
+ // Correlation map: a `loadingFailed` carries only a requestId, so remember the
74
+ // method + url from `requestWillBeSent` to reconstruct a method-bearing line.
75
+ const inflight = new Map();
76
+ const emit = (url, status, method) => {
77
+ // Fire-and-forget: a logging failure (e.g. page mid-navigation) must not
78
+ // surface as a test error.
79
+ void executor
80
+ .execute(logNetworkErrorInPage, url, status, method)
81
+ .catch(() => {
82
+ /* page may be navigating; drop this one line */
83
+ });
84
+ };
85
+ executor.on('Network.requestWillBeSent', (params) => {
86
+ const e = params;
87
+ const id = e?.requestId;
88
+ const url = e?.request?.url;
89
+ if (typeof id !== 'string' || typeof url !== 'string')
90
+ return;
91
+ const method = typeof e.request?.method === 'string' ? e.request.method : 'GET';
92
+ inflight.set(id, { method, url });
93
+ });
94
+ executor.on('Network.responseReceived', (params) => {
95
+ const e = params;
96
+ const response = e?.response;
97
+ // A response arrived — this request will not surface via loadingFailed, so
98
+ // drop it from the inflight map regardless of status.
99
+ if (typeof e?.requestId === 'string')
100
+ inflight.delete(e.requestId);
101
+ const status = response?.status;
102
+ if (typeof status !== 'number' || status < 400)
103
+ return;
104
+ const url = response?.url ?? '';
105
+ const method = methodOf(response?.requestHeaders);
106
+ emit(url, status, method);
107
+ });
108
+ executor.on('Network.loadingFailed', (params) => {
109
+ const e = params;
110
+ const id = e?.requestId;
111
+ // Correlate back to the request's method + url; CORS/DNS/offline/abort
112
+ // failures produce NO response, so this is the only place they surface.
113
+ const tracked = typeof id === 'string' ? inflight.get(id) : undefined;
114
+ if (typeof id === 'string')
115
+ inflight.delete(id);
116
+ const url = tracked?.url ?? '';
117
+ // Method is required for panels.ts to treat the status-0 row as a failure;
118
+ // default to GET if the requestWillBeSent was missed (e.g. attach mid-flight).
119
+ const method = tracked?.method ?? 'GET';
120
+ emit(url, NO_RESPONSE_STATUS, method);
121
+ });
122
+ }
123
+ // Exposed for unit tests: the page-side logger + method resolver are pure.
124
+ export const __internal = { logNetworkErrorInPage, methodOf };
125
+ //# sourceMappingURL=network-capture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"network-capture.js","sourceRoot":"","sources":["../src/network-capture.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,mEAAmE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AAQ,EAAE,GAAG,IAAI,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;QAClD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,EAAE,CAAC,uBAAuB,EAAE,CAAC,MAAe,EAAE,EAAE;QACvD,MAAM,CAAC,GAAG,MAA4B,CAAC;QACvC,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,CAAC;QACxB,uEAAuE;QACvE,wEAAwE;QACxE,MAAM,OAAO,GAAG,OAAO,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACtE,IAAI,OAAO,EAAE,KAAK,QAAQ;YAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAChD,MAAM,GAAG,GAAG,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC;QAC/B,2EAA2E;QAC3E,+EAA+E;QAC/E,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,KAAK,CAAC;QACxC,IAAI,CAAC,GAAG,EAAE,kBAAkB,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,2EAA2E;AAC3E,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,qBAAqB,EAAE,QAAQ,EAAE,CAAC"}
@@ -19,6 +19,16 @@ export interface ConsolePluginOptions {
19
19
  }
20
20
  /** Console-plugin defaults from PRD §D.3. */
21
21
  export declare const DEFAULT_CONSOLE_PLUGIN_OPTIONS: ConsolePluginOptions;
22
+ /**
23
+ * Network-plugin options forwarded into the in-page rrweb network plugin.
24
+ *
25
+ * Typed as `unknown`-shaped here so `@tracelane/core` doesn't have to mirror
26
+ * the substrate's full type surface (those types live in `@cubenest/rrweb-core`
27
+ * and the adapter — `@tracelane/wdio` — is what types the user-facing
28
+ * passthrough). The init script forwards the value verbatim to
29
+ * `window.rrweb.getRecordNetworkPlugin(options)`.
30
+ */
31
+ export type NetworkPluginOptions = Record<string, unknown>;
22
32
  /**
23
33
  * The in-page init routine (PRD §D.3 + ADR-0006). Idempotent across calls via a
24
34
  * monotonic `__tracelane__sessionId` stamp and a cooldown guard so hash-only /
@@ -28,8 +38,14 @@ export declare const DEFAULT_CONSOLE_PLUGIN_OPTIONS: ConsolePluginOptions;
28
38
  * Assumes `window.rrweb` is already defined (the recorder injects the rrweb
29
39
  * bundle string first). Returns the active session id so the Node side can
30
40
  * confirm whether a (re-)init actually took effect.
41
+ *
42
+ * `networkOptions === undefined` keeps the network plugin OFF (the legacy
43
+ * CDP-based path still applies). `networkOptions === {}` opts in with the
44
+ * plugin's defaults; any other object is forwarded verbatim. The plugin is
45
+ * only registered when `window.rrweb.getRecordNetworkPlugin` is present — so
46
+ * older bundles that pre-date the network-plugin export silently skip it.
31
47
  */
32
- export declare function tracelaneInitScript(cooldownMs: number, consoleOptions: ConsolePluginOptions): number;
48
+ export declare function tracelaneInitScript(cooldownMs: number, consoleOptions: ConsolePluginOptions, networkOptions?: NetworkPluginOptions): number;
33
49
  /**
34
50
  * Read-and-clear drain (PRD §A.4 / §D.3). Returns the buffered events and resets
35
51
  * the page buffer so the next drain doesn't double-count.
@@ -1 +1 @@
1
- {"version":3,"file":"page-script.d.ts","sourceRoot":"","sources":["../src/page-script.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,0EAA0E;AAC1E,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE;QACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED,6CAA6C;AAC7C,eAAO,MAAM,8BAA8B,EAAE,oBAI5C,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,oBAAoB,GACnC,MAAM,CA8CR;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,EAAE,CAKhD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAKhE"}
1
+ {"version":3,"file":"page-script.d.ts","sourceRoot":"","sources":["../src/page-script.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,0EAA0E;AAC1E,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE;QACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED,6CAA6C;AAC7C,eAAO,MAAM,8BAA8B,EAAE,oBAI5C,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE3D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,oBAAoB,EACpC,cAAc,CAAC,EAAE,oBAAoB,GACpC,MAAM,CAsDR;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,EAAE,CAKhD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAKhE"}
@@ -22,8 +22,14 @@ export const DEFAULT_CONSOLE_PLUGIN_OPTIONS = {
22
22
  * Assumes `window.rrweb` is already defined (the recorder injects the rrweb
23
23
  * bundle string first). Returns the active session id so the Node side can
24
24
  * confirm whether a (re-)init actually took effect.
25
+ *
26
+ * `networkOptions === undefined` keeps the network plugin OFF (the legacy
27
+ * CDP-based path still applies). `networkOptions === {}` opts in with the
28
+ * plugin's defaults; any other object is forwarded verbatim. The plugin is
29
+ * only registered when `window.rrweb.getRecordNetworkPlugin` is present — so
30
+ * older bundles that pre-date the network-plugin export silently skip it.
25
31
  */
26
- export function tracelaneInitScript(cooldownMs, consoleOptions) {
32
+ export function tracelaneInitScript(cooldownMs, consoleOptions, networkOptions) {
27
33
  const w = window;
28
34
  const now = Date.now();
29
35
  // Cooldown: a very recent init means this is a hash/HMR re-render, not a real
@@ -44,13 +50,20 @@ export function tracelaneInitScript(cooldownMs, consoleOptions) {
44
50
  // ignore teardown errors from a destroyed page context
45
51
  }
46
52
  }
53
+ const plugins = [w.rrweb.getRecordConsolePlugin(consoleOptions)];
54
+ if (networkOptions !== undefined && typeof w.rrweb.getRecordNetworkPlugin === 'function') {
55
+ // Framework-agnostic network capture (replaces the CDP path for users on
56
+ // the in-page recorder). Emits EventType.Plugin events with
57
+ // `data.plugin === 'rrweb/network@1'`.
58
+ plugins.push(w.rrweb.getRecordNetworkPlugin(networkOptions));
59
+ }
47
60
  const stop = w.rrweb.record({
48
61
  emit(event) {
49
62
  // Never call console.* here — the console plugin patches console and
50
63
  // guards recursion (PRD §D.4).
51
64
  w.__tracelane__events.push(event);
52
65
  },
53
- plugins: [w.rrweb.getRecordConsolePlugin(consoleOptions)],
66
+ plugins,
54
67
  });
55
68
  w.__tracelane__stop = typeof stop === 'function' ? stop : undefined;
56
69
  }
@@ -1 +1 @@
1
- {"version":3,"file":"page-script.js","sourceRoot":"","sources":["../src/page-script.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAaH,6CAA6C;AAC7C,MAAM,CAAC,MAAM,8BAA8B,GAAyB;IAClE,KAAK,EAAE,CAAC,MAA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QACH,CAAC,CAAC,iBAAiB,GAAG,OAAO,IAAI,KAAK,UAAU,CAAC,CAAC,CAAE,IAAmB,CAAC,CAAC,CAAC,SAAS,CAAC;IACtF,CAAC;IAED,OAAO,CAAC,CAAC,sBAAsB,CAAC;AAClC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,CAAC,GAAG,MAAwD,CAAC;IACnE,MAAM,GAAG,GAAG,CAAC,CAAC,mBAAmB,IAAI,EAAE,CAAC;IACxC,CAAC,CAAC,mBAAmB,GAAG,EAAE,CAAC;IAC3B,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAW,EAAE,EAAU;IACxD,MAAM,CAAC,GAAG,MAET,CAAC;IACF,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,eAAe,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;AAClE,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import type { eventWithTime } from '@cubenest/rrweb-core';
2
2
  import type { BrowserExecutor } from './browser-executor.js';
3
3
  import { type Mode } from './mode.js';
4
- import { type ConsolePluginOptions } from './page-script.js';
4
+ import { type ConsolePluginOptions, type NetworkPluginOptions } from './page-script.js';
5
5
  /** Default re-injection cooldown in ms (ADR-0006). */
6
6
  export declare const DEFAULT_COOLDOWN_MS = 250;
7
7
  /** Default Node-side poll interval in ms (ADR-0006). */
@@ -21,6 +21,16 @@ export interface RecorderOptions {
21
21
  cooldownMs?: number;
22
22
  /** Options forwarded to the in-page console plugin. */
23
23
  consolePluginOptions?: ConsolePluginOptions;
24
+ /**
25
+ * Options forwarded to the in-page rrweb network plugin (`rrweb/network@1`).
26
+ *
27
+ * `undefined` (default) keeps the plugin OFF — the legacy CDP-based capture
28
+ * path stays in charge. Pass an object (even `{}` for plugin defaults) to
29
+ * register the plugin in the in-page recorder. Adapters wire this through
30
+ * from their user-facing options (e.g. `@tracelane/wdio`'s
31
+ * `capture.networkOptions`).
32
+ */
33
+ networkPluginOptions?: NetworkPluginOptions;
24
34
  /**
25
35
  * Capture mode (ADR-0005). Default `'failed'`. The `TRACELANE_MODE` env var
26
36
  * overrides this at {@link Recorder.finalize} time.
@@ -1 +1 @@
1
- {"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../src/recorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,KAAK,IAAI,EAAe,MAAM,WAAW,CAAC;AACnD,OAAO,EACL,KAAK,oBAAoB,EAK1B,MAAM,kBAAkB,CAAC;AAE1B,sDAAsD;AACtD,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,wDAAwD;AACxD,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C,MAAM,WAAW,eAAe;IAC9B,gDAAgD;IAChD,QAAQ,EAAE,eAAe,CAAC;IAC1B;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;CACb;AAED,mDAAmD;AACnD,MAAM,WAAW,WAAW;IAC1B,+BAA+B;IAC/B,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,sDAAsD;AACtD,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kEAAkE;IAClE,MAAM,EAAE,aAAa,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,QAAQ;IACvB,8EAA8E;IAC9E,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC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I,CAAC,EAAE,IAAI,CAAC;CACb;AAED,mDAAmD;AACnD,MAAM,WAAW,WAAW;IAC1B,+BAA+B;IAC/B,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,sDAAsD;AACtD,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kEAAkE;IAClE,MAAM,EAAE,aAAa,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,QAAQ;IACvB,8EAA8E;IAC9E,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACxC,gFAAgF;IAChF,KAAK,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAClC,8CAA8C;IAC9C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACxD,0DAA0D;IAC1D,SAAS,IAAI,aAAa,EAAE,CAAC;CAC9B;AASD,wBAAgB,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,CAiGjE"}
package/dist/recorder.js CHANGED
@@ -11,7 +11,7 @@ function injectBundleScript(bundle) {
11
11
  window.eval(bundle);
12
12
  }
13
13
  export function createRecorder(options) {
14
- const { executor, rrwebBundle, drainIntervalMs = DEFAULT_DRAIN_INTERVAL_MS, cooldownMs = DEFAULT_COOLDOWN_MS, consolePluginOptions = DEFAULT_CONSOLE_PLUGIN_OPTIONS, mode: configMode, } = options;
14
+ const { executor, rrwebBundle, drainIntervalMs = DEFAULT_DRAIN_INTERVAL_MS, cooldownMs = DEFAULT_COOLDOWN_MS, consolePluginOptions = DEFAULT_CONSOLE_PLUGIN_OPTIONS, networkPluginOptions, mode: configMode, } = options;
15
15
  const buffer = [];
16
16
  let pollTimer;
17
17
  let started = false;
@@ -20,7 +20,7 @@ export function createRecorder(options) {
20
20
  let lastSessionId = 0;
21
21
  /** Run the init script in-page and return the active session id. */
22
22
  async function runInit() {
23
- return executor.execute(tracelaneInitScript, cooldownMs, consolePluginOptions);
23
+ return executor.execute(tracelaneInitScript, cooldownMs, consolePluginOptions, networkPluginOptions);
24
24
  }
25
25
  async function inject() {
26
26
  await executor.execute(injectBundleScript, rrwebBundle);
@@ -1 +1 @@
1
- {"version":3,"file":"recorder.js","sourceRoot":"","sources":["../src/recorder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAEL,8BAA8B,EAC9B,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,sDAAsD;AACtD,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AACvC,wDAAwD;AACxD,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAgE9C,kFAAkF;AAClF,SAAS,kBAAkB,CAAC,MAAc;IACxC,8EAA8E;IAC9E,gFAAgF;IAC/E,MAAsD,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAwB;IACrD,MAAM,EACJ,QAAQ,EACR,WAAW,EACX,eAAe,GAAG,yBAAyB,EAC3C,UAAU,GAAG,mBAAmB,EAChC,oBAAoB,GAAG,8BAA8B,EACrD,IAAI,EAAE,UAAU,GACjB,GAAG,OAAO,CAAC;IAEZ,MAAM,MAAM,GAAoB,EAAE,CAAC;IACnC,IAAI,SAAqD,CAAC;IAC1D,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,2EAA2E;IAC3E,wEAAwE;IACxE,IAAI,aAAa,GAAG,CAAC,CAAC;IAEtB,oEAAoE;IACpE,KAAK,UAAU,OAAO;QACpB,OAAO,QAAQ,CAAC,OAAO,CACrB,mBAAqD,EACrD,UAA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EAAE,GAAG,EAAE,CAAC,MAAM;KACxB,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "name": "@tracelane/core",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.11",
4
4
  "description": "Framework-agnostic rrweb recording engine for tracelane. Wraps a per-framework browser object behind a common BrowserExecutor interface.",
5
+ "keywords": [
6
+ "tracelane",
7
+ "testing",
8
+ "rrweb",
9
+ "session-replay",
10
+ "browser-automation",
11
+ "e2e",
12
+ "capture-engine"
13
+ ],
5
14
  "license": "Apache-2.0",
15
+ "funding": {
16
+ "type": "github",
17
+ "url": "https://github.com/sponsors/harry-harish"
18
+ },
6
19
  "type": "module",
7
20
  "main": "./dist/index.js",
8
21
  "types": "./dist/index.d.ts",
@@ -12,14 +25,13 @@
12
25
  "import": "./dist/index.js"
13
26
  }
14
27
  },
15
- "files": ["dist", "NOTICE", "README.md"],
16
- "scripts": {
17
- "build": "tsc -p tsconfig.json",
18
- "typecheck": "tsc -p tsconfig.json --noEmit",
19
- "test": "vitest run --passWithNoTests"
20
- },
28
+ "files": [
29
+ "dist",
30
+ "NOTICE",
31
+ "README.md"
32
+ ],
21
33
  "dependencies": {
22
- "@cubenest/rrweb-core": "workspace:*"
34
+ "@cubenest/rrweb-core": "0.1.0-alpha.5"
23
35
  },
24
36
  "devDependencies": {
25
37
  "jsdom": "^25.0.1"
@@ -30,8 +42,19 @@
30
42
  },
31
43
  "repository": {
32
44
  "type": "git",
33
- "url": "git+https://github.com/Cubenest/rrweb-stack.git",
45
+ "url": "https://github.com/Cubenest/rrweb-stack",
34
46
  "directory": "packages/tracelane-core"
35
47
  },
36
- "homepage": "https://github.com/Cubenest/rrweb-stack/tree/main/packages/tracelane-core#readme"
37
- }
48
+ "bugs": {
49
+ "url": "https://github.com/Cubenest/rrweb-stack/issues"
50
+ },
51
+ "homepage": "https://github.com/Cubenest/rrweb-stack/tree/main/packages/tracelane-core#readme",
52
+ "engines": {
53
+ "node": ">=20.18.0"
54
+ },
55
+ "scripts": {
56
+ "build": "tsc -p tsconfig.json",
57
+ "typecheck": "tsc -p tsconfig.json --noEmit",
58
+ "test": "vitest run --passWithNoTests"
59
+ }
60
+ }