@usereelay/browser 0.1.0 → 0.1.2
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/README.md +11 -19
- package/bin/reelay-sourcemaps.mjs +12 -15
- package/dist/index.cjs +0 -2
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +0 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,8 +28,6 @@ import * as Reelay from '@usereelay/browser';
|
|
|
28
28
|
Reelay.init({
|
|
29
29
|
endpoint: 'https://api.usereelay.com', // your Reelay ingest base URL
|
|
30
30
|
token: 'rlyt_live_…', // node API key for this frontend
|
|
31
|
-
release: 'web@' + import.meta.env.VITE_GIT_SHA,
|
|
32
|
-
environment: 'production',
|
|
33
31
|
// Origins that receive trace headers so backend errors link to this session:
|
|
34
32
|
tracePropagationTargets: ['https://api.acme.com'],
|
|
35
33
|
});
|
|
@@ -65,9 +63,7 @@ also works without a bundler:
|
|
|
65
63
|
Reelay.init({
|
|
66
64
|
endpoint: 'https://api.usereelay.com', // required: ingest base URL
|
|
67
65
|
token: 'rlyt_live_…', // required: node API key
|
|
68
|
-
|
|
69
|
-
environment: 'production', // optional
|
|
70
|
-
sampleRate: 1, // 0–1 probability an event is sent
|
|
66
|
+
sampleRate: 1, // optional: fraction of errors to send (default 1 = all)
|
|
71
67
|
beforeSend: (event) => event, // mutate or return null to drop
|
|
72
68
|
scrubPatterns: [/order-\d{6}/g], // extra PII regexes (additive)
|
|
73
69
|
maxQueueSize: 30, // offline/retry buffer (drop-oldest)
|
|
@@ -110,29 +106,25 @@ bundled `reelay-sourcemaps` CLI.
|
|
|
110
106
|
# maps are emitted but not referenced from shipped JS).
|
|
111
107
|
npm run build
|
|
112
108
|
|
|
113
|
-
# 2. Inject debug ids into the built JS + maps (the
|
|
114
|
-
#
|
|
109
|
+
# 2. Inject debug ids into the built JS + maps (the match key), then upload the
|
|
110
|
+
# maps to Reelay.
|
|
115
111
|
npx reelay-sourcemaps inject-and-upload ./dist \
|
|
116
112
|
--url https://api.reelay.app \
|
|
117
113
|
--token "$REELAY_TOKEN" \
|
|
118
|
-
--release "web@$(git rev-parse --short HEAD)" \
|
|
119
114
|
--delete # remove .map files after upload so they never reach your CDN
|
|
120
115
|
```
|
|
121
116
|
|
|
122
|
-
`--url
|
|
123
|
-
and `REELAY_RELEASE`. Set the **same `release`** in `Reelay.init({ release })`
|
|
124
|
-
so release-based matching works even for bundles without debug ids.
|
|
117
|
+
`--url` and `--token` also read from `REELAY_URL` and `REELAY_TOKEN`.
|
|
125
118
|
|
|
126
119
|
How it works:
|
|
127
120
|
|
|
128
|
-
- **Debug ids (
|
|
129
|
-
id, recorded both in the JS (a tiny runtime snippet) and in
|
|
130
|
-
reads that registry at capture time and tags each frame with
|
|
131
|
-
debug id, so the backend resolves the exact map regardless of
|
|
132
|
-
|
|
133
|
-
adds, so positions stay exact.
|
|
134
|
-
|
|
135
|
-
matches on the event's `release` and the minified file's basename.
|
|
121
|
+
- **Debug ids (the only match key).** `inject` stamps each chunk with a
|
|
122
|
+
content-derived id, recorded both in the JS (a tiny runtime snippet) and in
|
|
123
|
+
the map. The SDK reads that registry at capture time and tags each frame with
|
|
124
|
+
its bundle's debug id, so the backend resolves the exact map regardless of
|
|
125
|
+
CDN hashing. The injector offsets the map's `mappings` for the one line it
|
|
126
|
+
adds, so positions stay exact. Always run `inject` before `upload` — maps
|
|
127
|
+
without a debug id cannot be matched and are skipped at upload.
|
|
136
128
|
- Already using a Sentry bundler plugin? The SDK also reads `_sentryDebugIds`,
|
|
137
129
|
so existing debug ids are picked up with no extra tooling.
|
|
138
130
|
|
|
@@ -7,16 +7,16 @@
|
|
|
7
7
|
* reelay-sourcemaps upload <dir> [opts] Upload maps to Reelay
|
|
8
8
|
* reelay-sourcemaps inject-and-upload <dir> Both, in order
|
|
9
9
|
*
|
|
10
|
-
* Options (or env: REELAY_URL, REELAY_TOKEN
|
|
10
|
+
* Options (or env: REELAY_URL, REELAY_TOKEN):
|
|
11
11
|
* --url <endpoint> Reelay ingestion base URL [REELAY_URL]
|
|
12
12
|
* --token <token> Node API key (rlyt_live_…) [REELAY_TOKEN]
|
|
13
|
-
* --release <release> Release tag matching your SDK init [REELAY_RELEASE]
|
|
14
13
|
* --delete Delete .map files after a successful upload
|
|
15
14
|
*
|
|
16
|
-
* Debug ids are the
|
|
17
|
-
*
|
|
18
|
-
* reads) and in the map. `
|
|
19
|
-
*
|
|
15
|
+
* Debug ids are the sole match key: each bundle is stamped with a
|
|
16
|
+
* content-derived id recorded both in the JS (a tiny runtime snippet the SDK
|
|
17
|
+
* reads) and in the map. Run `inject` (or `inject-and-upload`) so every map
|
|
18
|
+
* carries a debug id before upload — maps without one cannot be matched and are
|
|
19
|
+
* skipped.
|
|
20
20
|
*
|
|
21
21
|
* Source maps expose original source — keep them private. Prefer `hidden-source-map`
|
|
22
22
|
* (no sourceMappingURL comment in shipped JS) and pass --delete so maps never
|
|
@@ -170,17 +170,16 @@ async function uploadMap(opts, mapFile) {
|
|
|
170
170
|
}
|
|
171
171
|
const debugId = map.debugId || map.debug_id || '';
|
|
172
172
|
// Minified file the map belongs to: prefer the map's own `file`, else strip
|
|
173
|
-
// the .map suffix.
|
|
173
|
+
// the .map suffix. Retained for display/diagnostics on the artifact.
|
|
174
174
|
const file = basename(map.file || mapFile.replace(/\.map$/, ''));
|
|
175
175
|
|
|
176
|
-
if (!debugId
|
|
177
|
-
warn(`skipping ${basename(mapFile)}: no debug id
|
|
176
|
+
if (!debugId) {
|
|
177
|
+
warn(`skipping ${basename(mapFile)}: no debug id (run 'inject' first)`);
|
|
178
178
|
return false;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
const body = JSON.stringify({
|
|
182
|
-
|
|
183
|
-
debug_id: debugId || undefined,
|
|
182
|
+
debug_id: debugId,
|
|
184
183
|
file,
|
|
185
184
|
sourcemap: readFileSync(mapFile, 'utf8'),
|
|
186
185
|
});
|
|
@@ -220,7 +219,6 @@ function parseArgs(argv) {
|
|
|
220
219
|
const opts = {
|
|
221
220
|
url: process.env.REELAY_URL || process.env.REELAY_ENDPOINT || '',
|
|
222
221
|
token: process.env.REELAY_TOKEN || '',
|
|
223
|
-
release: process.env.REELAY_RELEASE || '',
|
|
224
222
|
delete: false,
|
|
225
223
|
_: [],
|
|
226
224
|
};
|
|
@@ -229,7 +227,6 @@ function parseArgs(argv) {
|
|
|
229
227
|
switch (a) {
|
|
230
228
|
case '--url': opts.url = argv[++i]; break;
|
|
231
229
|
case '--token': opts.token = argv[++i]; break;
|
|
232
|
-
case '--release': opts.release = argv[++i]; break;
|
|
233
230
|
case '--delete': opts.delete = true; break;
|
|
234
231
|
default: opts._.push(a);
|
|
235
232
|
}
|
|
@@ -246,8 +243,8 @@ async function main() {
|
|
|
246
243
|
process.stdout.write(
|
|
247
244
|
'Usage:\n' +
|
|
248
245
|
' reelay-sourcemaps inject <dir>\n' +
|
|
249
|
-
' reelay-sourcemaps upload <dir> --url <u> --token <t> [--
|
|
250
|
-
' reelay-sourcemaps inject-and-upload <dir> --url <u> --token <t> [--
|
|
246
|
+
' reelay-sourcemaps upload <dir> --url <u> --token <t> [--delete]\n' +
|
|
247
|
+
' reelay-sourcemaps inject-and-upload <dir> --url <u> --token <t> [--delete]\n',
|
|
251
248
|
);
|
|
252
249
|
return;
|
|
253
250
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -360,8 +360,6 @@ var BaseClient = class {
|
|
|
360
360
|
kind: this.kind,
|
|
361
361
|
platform: this.platform,
|
|
362
362
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
363
|
-
release: this.options.release,
|
|
364
|
-
environment: this.options.environment,
|
|
365
363
|
trace: ctx.trace,
|
|
366
364
|
session_id: ctx.sessionId,
|
|
367
365
|
exception: {
|
package/dist/index.d.cts
CHANGED
|
@@ -61,8 +61,6 @@ interface ErrorEventPayload {
|
|
|
61
61
|
kind: 'backend' | 'frontend';
|
|
62
62
|
platform: string;
|
|
63
63
|
timestamp: string;
|
|
64
|
-
release?: string;
|
|
65
|
-
environment?: string;
|
|
66
64
|
trace?: TraceContext;
|
|
67
65
|
session_id?: string;
|
|
68
66
|
exception: ExceptionPayload;
|
|
@@ -76,9 +74,11 @@ interface CoreOptions {
|
|
|
76
74
|
endpoint: string;
|
|
77
75
|
/** The node's API key (rlyt_live_…). Never a ReelayID. */
|
|
78
76
|
token: string;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Fraction of error events to send, 0–1. Defaults to 1 (every error is
|
|
79
|
+
* sent). A cost/volume lever for very high-throughput apps; leave at 1
|
|
80
|
+
* unless you have a volume problem.
|
|
81
|
+
*/
|
|
82
82
|
sampleRate?: number;
|
|
83
83
|
/** Mutate or veto an event just before send. Return null to drop. */
|
|
84
84
|
beforeSend?: (event: ErrorEventPayload) => ErrorEventPayload | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -61,8 +61,6 @@ interface ErrorEventPayload {
|
|
|
61
61
|
kind: 'backend' | 'frontend';
|
|
62
62
|
platform: string;
|
|
63
63
|
timestamp: string;
|
|
64
|
-
release?: string;
|
|
65
|
-
environment?: string;
|
|
66
64
|
trace?: TraceContext;
|
|
67
65
|
session_id?: string;
|
|
68
66
|
exception: ExceptionPayload;
|
|
@@ -76,9 +74,11 @@ interface CoreOptions {
|
|
|
76
74
|
endpoint: string;
|
|
77
75
|
/** The node's API key (rlyt_live_…). Never a ReelayID. */
|
|
78
76
|
token: string;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Fraction of error events to send, 0–1. Defaults to 1 (every error is
|
|
79
|
+
* sent). A cost/volume lever for very high-throughput apps; leave at 1
|
|
80
|
+
* unless you have a volume problem.
|
|
81
|
+
*/
|
|
82
82
|
sampleRate?: number;
|
|
83
83
|
/** Mutate or veto an event just before send. Return null to drop. */
|
|
84
84
|
beforeSend?: (event: ErrorEventPayload) => ErrorEventPayload | null;
|
package/dist/index.js
CHANGED
|
@@ -358,8 +358,6 @@ var BaseClient = class {
|
|
|
358
358
|
kind: this.kind,
|
|
359
359
|
platform: this.platform,
|
|
360
360
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
361
|
-
release: this.options.release,
|
|
362
|
-
environment: this.options.environment,
|
|
363
361
|
trace: ctx.trace,
|
|
364
362
|
session_id: ctx.sessionId,
|
|
365
363
|
exception: {
|
package/package.json
CHANGED