@flareapp/electron 2.11.0 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.cjs CHANGED
@@ -34,7 +34,7 @@ let node_fs_promises = require("node:fs/promises");
34
34
  let node_url = require("node:url");
35
35
 
36
36
  //#region src/env.ts
37
- const CLIENT_VERSION = typeof process !== "undefined" && true ? "2.11.0" : "?";
37
+ const CLIENT_VERSION = typeof process !== "undefined" && true ? "2.12.0" : "?";
38
38
 
39
39
  //#endregion
40
40
  //#region src/types.ts
@@ -50,7 +50,6 @@ const DEFAULT_ELECTRON_OPTIONS = {
50
50
 
51
51
  //#endregion
52
52
  //#region src/main/deviceInfo.ts
53
- /** Electron main os + runtime as normalised device info. */
54
53
  var ElectronDeviceInfoProvider = class {
55
54
  collect() {
56
55
  const versions = process.versions;
@@ -70,11 +69,6 @@ const electronDeviceInfoProvider = new ElectronDeviceInfoProvider();
70
69
 
71
70
  //#endregion
72
71
  //#region src/main/collectElectron.ts
73
- /**
74
- * App + runtime attributes safe to overlay onto any report regardless of origin. Reused by both
75
- * the collector (main errors) and the IPC receiver (forwarded renderer reports). Excludes per-process
76
- * fields like `flare.entry_point.type` / `process.type` so forwarded renderer reports keep their own.
77
- */
78
72
  function collectElectronAppAttributes(app) {
79
73
  const versions = process.versions;
80
74
  const attrs = {
@@ -92,7 +86,6 @@ function collectElectronAppAttributes(app) {
92
86
  } catch {}
93
87
  return attrs;
94
88
  }
95
- /** Build the ContextCollector core calls on every main-process report. */
96
89
  function makeElectronContextCollector(app) {
97
90
  return (_config) => ({
98
91
  "flare.entry_point.type": "web",
@@ -103,7 +96,6 @@ function makeElectronContextCollector(app) {
103
96
 
104
97
  //#endregion
105
98
  //#region src/main/ElectronDiskFileReader.ts
106
- /** Reads source snippets for main-process stack frames from disk. Mirrors @flareapp/node's DiskFileReader. */
107
99
  var ElectronDiskFileReader = class {
108
100
  async read(url) {
109
101
  if (!isLocalFileUrl(url)) return null;
@@ -120,7 +112,6 @@ function isLocalFileUrl(url) {
120
112
 
121
113
  //#endregion
122
114
  //#region src/main/ElectronFlushScheduler.ts
123
- /** Flushes pending logs/reports when the Electron app is quitting. App is injectable for tests. */
124
115
  var ElectronFlushScheduler = class {
125
116
  listener = null;
126
117
  constructor(app) {
@@ -133,7 +124,6 @@ var ElectronFlushScheduler = class {
133
124
  };
134
125
  this.app.on("before-quit", this.listener);
135
126
  }
136
- /** Detach the before-quit listener so a disposed ElectronFlare leaves no flush handler on the shared app. */
137
127
  dispose() {
138
128
  if (this.listener) {
139
129
  this.app.off("before-quit", this.listener);
@@ -151,9 +141,7 @@ const FLARE_BRIDGE_KEY = "__flare";
151
141
 
152
142
  //#endregion
153
143
  //#region src/main/ipcReceiver.ts
154
- /** Module-level ownership token for the single flare:report channel. */
155
144
  let currentOwner = null;
156
- /** Default sender-trust check: accept file: and localhost/127.0.0.1 only, plus configured custom protocols. */
157
145
  function defaultTrustPolicy(frame, opts) {
158
146
  let parsed;
159
147
  try {
@@ -173,11 +161,6 @@ function isTrusted(frame, opts) {
173
161
  if (opts.trustSender) return opts.trustSender(frame);
174
162
  return defaultTrustPolicy(frame, opts);
175
163
  }
176
- /**
177
- * Minimal top-level structural guard for a parsed report, not an exhaustive StackFrame/SpanEvent
178
- * validator: a compromised renderer could forge any valid-looking shape anyway. The security boundary
179
- * is the sender-trust check plus the byte-size cap; this only rejects obviously-wrong payloads.
180
- */
181
164
  function isReportShape(value) {
182
165
  if (typeof value !== "object" || value === null) return false;
183
166
  const r = value;
@@ -210,11 +193,6 @@ function disposeIpcReceiver(ipcMain, owner) {
210
193
 
211
194
  //#endregion
212
195
  //#region src/main/processHandlers.ts
213
- /**
214
- * Fatal callbacks for Electron main. Mirrors @flareapp/node's buildFatalCallbacks but exits via the
215
- * injected `exit` (app.exit at the call site), which is immediate and skips before-quit/will-quit,
216
- * correct after an uncaught exception.
217
- */
218
196
  function buildFatalCallbacks(flare, getOpts, exit) {
219
197
  return {
220
198
  async onUncaught(err, origin) {
@@ -243,15 +221,6 @@ function buildFatalCallbacks(flare, getOpts, exit) {
243
221
  }
244
222
  };
245
223
  }
246
- /**
247
- * Owns the lifecycle of the two process-level error listeners for the Electron main process,
248
- * reconciling attach/detach against the desired modes. Mirrors node's ProcessHandlerManager.
249
- *
250
- * Deliberately a copy, not a shared module. @flareapp/electron does not depend on @flareapp/node, and
251
- * the only package both import is @flareapp/core, which ships in every browser bundle and touches
252
- * `process` only behind a typeof guard. A shared manager belongs in a new package, not in core, and
253
- * one method does not pay for one.
254
- */
255
224
  var ProcessHandlerManager = class {
256
225
  uncaughtHandler = null;
257
226
  rejectionHandler = null;
@@ -293,7 +262,6 @@ var ProcessHandlerManager = class {
293
262
  //#endregion
294
263
  //#region src/main/ElectronFlare.ts
295
264
  const SDK_NAME = "@flareapp/electron";
296
- /** Write `value` under `key` when non-empty, otherwise remove any renderer-supplied value. */
297
265
  function overlayOrDelete(attributes, key, value) {
298
266
  if (value) attributes[key] = value;
299
267
  else delete attributes[key];
@@ -364,7 +332,6 @@ var ElectronFlare = class extends _flareapp_core.Flare {
364
332
  disposeIpcReceiver(this.ipcMain, this);
365
333
  this.flushScheduler.dispose();
366
334
  }
367
- /** Attach/detach the process-gone listeners to match options.captureRenderProcessGone. Idempotent. */
368
335
  reconcileCrashListeners() {
369
336
  const want = Boolean(this.options.captureRenderProcessGone);
370
337
  if (want === (this.renderGoneHandler !== null)) return;
@@ -409,9 +376,8 @@ var ElectronFlare = class extends _flareapp_core.Flare {
409
376
  return this.report(error, attrs);
410
377
  }
411
378
  /**
412
- * Wait for both core's tracked reports AND forwarded renderer reports (which bypass core's
413
- * private track()), bounded by timeoutMs. The timeout is cleared when all reports settle
414
- * first, so the event loop is not kept alive unnecessarily.
379
+ * Waits for core's tracked reports and forwarded renderer reports (which bypass track()), bounded by
380
+ * timeoutMs. Clears the timer once everything settles, so the event loop isn't held open needlessly.
415
381
  */
416
382
  flush(timeoutMs = 2e3) {
417
383
  const settled = Promise.allSettled([super.flush(timeoutMs), ...this.forwardedInFlight]);
@@ -423,7 +389,6 @@ var ElectronFlare = class extends _flareapp_core.Flare {
423
389
  });
424
390
  });
425
391
  }
426
- /** Overlay main-authoritative config + Electron metadata + user identity (from the main scope) onto a forwarded report, then send. */
427
392
  receiveRendererReport(report) {
428
393
  for (const key of _flareapp_core.USER_IDENTITY_KEYS) delete report.attributes[key];
429
394
  Object.assign(report.attributes, collectElectronAppAttributes(this.app), (0, _flareapp_core.userIdentityAttributes)(this.mainScope.active()));
package/dist/main.d.cts CHANGED
@@ -44,18 +44,15 @@ declare class ElectronFlare extends Flare {
44
44
  light(key?: string, debug?: boolean): this;
45
45
  configureElectron(partial: ElectronOptions): this;
46
46
  dispose(): void;
47
- /** Attach/detach the process-gone listeners to match options.captureRenderProcessGone. Idempotent. */
48
47
  private reconcileCrashListeners;
49
48
  private attachCrashListeners;
50
49
  private detachCrashListeners;
51
50
  private reportProcessGone;
52
51
  /**
53
- * Wait for both core's tracked reports AND forwarded renderer reports (which bypass core's
54
- * private track()), bounded by timeoutMs. The timeout is cleared when all reports settle
55
- * first, so the event loop is not kept alive unnecessarily.
52
+ * Waits for core's tracked reports and forwarded renderer reports (which bypass track()), bounded by
53
+ * timeoutMs. Clears the timer once everything settles, so the event loop isn't held open needlessly.
56
54
  */
57
55
  flush(timeoutMs?: number): Promise<void>;
58
- /** Overlay main-authoritative config + Electron metadata + user identity (from the main scope) onto a forwarded report, then send. */
59
56
  private receiveRendererReport;
60
57
  }
61
58
  //#endregion
package/dist/main.d.mts CHANGED
@@ -44,18 +44,15 @@ declare class ElectronFlare extends Flare {
44
44
  light(key?: string, debug?: boolean): this;
45
45
  configureElectron(partial: ElectronOptions): this;
46
46
  dispose(): void;
47
- /** Attach/detach the process-gone listeners to match options.captureRenderProcessGone. Idempotent. */
48
47
  private reconcileCrashListeners;
49
48
  private attachCrashListeners;
50
49
  private detachCrashListeners;
51
50
  private reportProcessGone;
52
51
  /**
53
- * Wait for both core's tracked reports AND forwarded renderer reports (which bypass core's
54
- * private track()), bounded by timeoutMs. The timeout is cleared when all reports settle
55
- * first, so the event loop is not kept alive unnecessarily.
52
+ * Waits for core's tracked reports and forwarded renderer reports (which bypass track()), bounded by
53
+ * timeoutMs. Clears the timer once everything settles, so the event loop isn't held open needlessly.
56
54
  */
57
55
  flush(timeoutMs?: number): Promise<void>;
58
- /** Overlay main-authoritative config + Electron metadata + user identity (from the main scope) onto a forwarded report, then send. */
59
56
  private receiveRendererReport;
60
57
  }
61
58
  //#endregion
package/dist/main.mjs CHANGED
@@ -5,7 +5,7 @@ import { readFile } from "node:fs/promises";
5
5
  import { fileURLToPath } from "node:url";
6
6
 
7
7
  //#region src/env.ts
8
- const CLIENT_VERSION = typeof process !== "undefined" && true ? "2.11.0" : "?";
8
+ const CLIENT_VERSION = typeof process !== "undefined" && true ? "2.12.0" : "?";
9
9
 
10
10
  //#endregion
11
11
  //#region src/types.ts
@@ -21,7 +21,6 @@ const DEFAULT_ELECTRON_OPTIONS = {
21
21
 
22
22
  //#endregion
23
23
  //#region src/main/deviceInfo.ts
24
- /** Electron main os + runtime as normalised device info. */
25
24
  var ElectronDeviceInfoProvider = class {
26
25
  collect() {
27
26
  const versions = process.versions;
@@ -41,11 +40,6 @@ const electronDeviceInfoProvider = new ElectronDeviceInfoProvider();
41
40
 
42
41
  //#endregion
43
42
  //#region src/main/collectElectron.ts
44
- /**
45
- * App + runtime attributes safe to overlay onto any report regardless of origin. Reused by both
46
- * the collector (main errors) and the IPC receiver (forwarded renderer reports). Excludes per-process
47
- * fields like `flare.entry_point.type` / `process.type` so forwarded renderer reports keep their own.
48
- */
49
43
  function collectElectronAppAttributes(app) {
50
44
  const versions = process.versions;
51
45
  const attrs = {
@@ -63,7 +57,6 @@ function collectElectronAppAttributes(app) {
63
57
  } catch {}
64
58
  return attrs;
65
59
  }
66
- /** Build the ContextCollector core calls on every main-process report. */
67
60
  function makeElectronContextCollector(app) {
68
61
  return (_config) => ({
69
62
  "flare.entry_point.type": "web",
@@ -74,7 +67,6 @@ function makeElectronContextCollector(app) {
74
67
 
75
68
  //#endregion
76
69
  //#region src/main/ElectronDiskFileReader.ts
77
- /** Reads source snippets for main-process stack frames from disk. Mirrors @flareapp/node's DiskFileReader. */
78
70
  var ElectronDiskFileReader = class {
79
71
  async read(url) {
80
72
  if (!isLocalFileUrl(url)) return null;
@@ -91,7 +83,6 @@ function isLocalFileUrl(url) {
91
83
 
92
84
  //#endregion
93
85
  //#region src/main/ElectronFlushScheduler.ts
94
- /** Flushes pending logs/reports when the Electron app is quitting. App is injectable for tests. */
95
86
  var ElectronFlushScheduler = class {
96
87
  listener = null;
97
88
  constructor(app) {
@@ -104,7 +95,6 @@ var ElectronFlushScheduler = class {
104
95
  };
105
96
  this.app.on("before-quit", this.listener);
106
97
  }
107
- /** Detach the before-quit listener so a disposed ElectronFlare leaves no flush handler on the shared app. */
108
98
  dispose() {
109
99
  if (this.listener) {
110
100
  this.app.off("before-quit", this.listener);
@@ -122,9 +112,7 @@ const FLARE_BRIDGE_KEY = "__flare";
122
112
 
123
113
  //#endregion
124
114
  //#region src/main/ipcReceiver.ts
125
- /** Module-level ownership token for the single flare:report channel. */
126
115
  let currentOwner = null;
127
- /** Default sender-trust check: accept file: and localhost/127.0.0.1 only, plus configured custom protocols. */
128
116
  function defaultTrustPolicy(frame, opts) {
129
117
  let parsed;
130
118
  try {
@@ -144,11 +132,6 @@ function isTrusted(frame, opts) {
144
132
  if (opts.trustSender) return opts.trustSender(frame);
145
133
  return defaultTrustPolicy(frame, opts);
146
134
  }
147
- /**
148
- * Minimal top-level structural guard for a parsed report, not an exhaustive StackFrame/SpanEvent
149
- * validator: a compromised renderer could forge any valid-looking shape anyway. The security boundary
150
- * is the sender-trust check plus the byte-size cap; this only rejects obviously-wrong payloads.
151
- */
152
135
  function isReportShape(value) {
153
136
  if (typeof value !== "object" || value === null) return false;
154
137
  const r = value;
@@ -181,11 +164,6 @@ function disposeIpcReceiver(ipcMain, owner) {
181
164
 
182
165
  //#endregion
183
166
  //#region src/main/processHandlers.ts
184
- /**
185
- * Fatal callbacks for Electron main. Mirrors @flareapp/node's buildFatalCallbacks but exits via the
186
- * injected `exit` (app.exit at the call site), which is immediate and skips before-quit/will-quit,
187
- * correct after an uncaught exception.
188
- */
189
167
  function buildFatalCallbacks(flare, getOpts, exit) {
190
168
  return {
191
169
  async onUncaught(err, origin) {
@@ -214,15 +192,6 @@ function buildFatalCallbacks(flare, getOpts, exit) {
214
192
  }
215
193
  };
216
194
  }
217
- /**
218
- * Owns the lifecycle of the two process-level error listeners for the Electron main process,
219
- * reconciling attach/detach against the desired modes. Mirrors node's ProcessHandlerManager.
220
- *
221
- * Deliberately a copy, not a shared module. @flareapp/electron does not depend on @flareapp/node, and
222
- * the only package both import is @flareapp/core, which ships in every browser bundle and touches
223
- * `process` only behind a typeof guard. A shared manager belongs in a new package, not in core, and
224
- * one method does not pay for one.
225
- */
226
195
  var ProcessHandlerManager = class {
227
196
  uncaughtHandler = null;
228
197
  rejectionHandler = null;
@@ -264,7 +233,6 @@ var ProcessHandlerManager = class {
264
233
  //#endregion
265
234
  //#region src/main/ElectronFlare.ts
266
235
  const SDK_NAME = "@flareapp/electron";
267
- /** Write `value` under `key` when non-empty, otherwise remove any renderer-supplied value. */
268
236
  function overlayOrDelete(attributes, key, value) {
269
237
  if (value) attributes[key] = value;
270
238
  else delete attributes[key];
@@ -335,7 +303,6 @@ var ElectronFlare = class extends Flare {
335
303
  disposeIpcReceiver(this.ipcMain, this);
336
304
  this.flushScheduler.dispose();
337
305
  }
338
- /** Attach/detach the process-gone listeners to match options.captureRenderProcessGone. Idempotent. */
339
306
  reconcileCrashListeners() {
340
307
  const want = Boolean(this.options.captureRenderProcessGone);
341
308
  if (want === (this.renderGoneHandler !== null)) return;
@@ -380,9 +347,8 @@ var ElectronFlare = class extends Flare {
380
347
  return this.report(error, attrs);
381
348
  }
382
349
  /**
383
- * Wait for both core's tracked reports AND forwarded renderer reports (which bypass core's
384
- * private track()), bounded by timeoutMs. The timeout is cleared when all reports settle
385
- * first, so the event loop is not kept alive unnecessarily.
350
+ * Waits for core's tracked reports and forwarded renderer reports (which bypass track()), bounded by
351
+ * timeoutMs. Clears the timer once everything settles, so the event loop isn't held open needlessly.
386
352
  */
387
353
  flush(timeoutMs = 2e3) {
388
354
  const settled = Promise.allSettled([super.flush(timeoutMs), ...this.forwardedInFlight]);
@@ -394,7 +360,6 @@ var ElectronFlare = class extends Flare {
394
360
  });
395
361
  });
396
362
  }
397
- /** Overlay main-authoritative config + Electron metadata + user identity (from the main scope) onto a forwarded report, then send. */
398
363
  receiveRendererReport(report) {
399
364
  for (const key of USER_IDENTITY_KEYS) delete report.attributes[key];
400
365
  Object.assign(report.attributes, collectElectronAppAttributes(this.app), userIdentityAttributes(this.mainScope.active()));
package/dist/renderer.cjs CHANGED
@@ -8,7 +8,7 @@ const FLARE_BRIDGE_KEY = "__flare";
8
8
 
9
9
  //#endregion
10
10
  //#region src/env.ts
11
- const CLIENT_VERSION = typeof process !== "undefined" && true ? "2.11.0" : "?";
11
+ const CLIENT_VERSION = typeof process !== "undefined" && true ? "2.12.0" : "?";
12
12
 
13
13
  //#endregion
14
14
  //#region src/renderer/RendererFlare.ts
package/dist/renderer.mjs CHANGED
@@ -7,7 +7,7 @@ const FLARE_BRIDGE_KEY = "__flare";
7
7
 
8
8
  //#endregion
9
9
  //#region src/env.ts
10
- const CLIENT_VERSION = typeof process !== "undefined" && true ? "2.11.0" : "?";
10
+ const CLIENT_VERSION = typeof process !== "undefined" && true ? "2.12.0" : "?";
11
11
 
12
12
  //#endregion
13
13
  //#region src/renderer/RendererFlare.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flareapp/electron",
3
- "version": "2.11.0",
3
+ "version": "2.12.0",
4
4
  "description": "Electron SDK for flareapp.io",
5
5
  "homepage": "https://flareapp.io",
6
6
  "bugs": {
@@ -65,8 +65,8 @@
65
65
  "release": "release-it"
66
66
  },
67
67
  "dependencies": {
68
- "@flareapp/core": "2.11.0",
69
- "@flareapp/js": "2.11.0"
68
+ "@flareapp/core": "2.12.0",
69
+ "@flareapp/js": "2.12.0"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "electron": ">=35"