@flareapp/js 2.11.0 → 2.12.1

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/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_catchWindowErrors = require('./catchWindowErrors-BgmDgTlR.cjs');
2
+ const require_catchWindowErrors = require('./catchWindowErrors-BSJfXoWb.cjs');
3
3
  const require_browser = require('./browser.cjs');
4
4
  let _flareapp_core = require("@flareapp/core");
5
5
 
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { E as createFlareResolver } from "./spanTypes-TMgJEZ7G.cjs";
1
+ import { E as createFlareResolver } from "./spanTypes-Cdgtuu6-.cjs";
2
2
  import { Flare } from "./browser.cjs";
3
3
  import { AttributeValue, Attributes, Config, ContextCollector, DEFAULT_URL_DENYLIST, EntryPointHandler, FileReader, FlushFn, FlushScheduler, Framework, FrameworkName, GlobalScopeProvider, Glow, Logger, MessageLevel, NullFileReader, OverriddenGrouping, Report, Scope, ScopeProvider, SdkInfo, SpanEvent, StackFrame, User, convertToError, redactObjectValues, redactUrlQuery, redactUrlQuery as redactFullPath, resolveDenylist, toCustomContext } from "@flareapp/core";
4
4
 
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { E as createFlareResolver } from "./spanTypes-7-nEycOc.mjs";
1
+ import { E as createFlareResolver } from "./spanTypes-RYeFN_pN.mjs";
2
2
  import { Flare } from "./browser.mjs";
3
3
  import { AttributeValue, Attributes, Config, ContextCollector, DEFAULT_URL_DENYLIST, EntryPointHandler, FileReader, FlushFn, FlushScheduler, Framework, FrameworkName, GlobalScopeProvider, Glow, Logger, MessageLevel, NullFileReader, OverriddenGrouping, Report, Scope, ScopeProvider, SdkInfo, SpanEvent, StackFrame, User, convertToError, redactObjectValues, redactUrlQuery, redactUrlQuery as redactFullPath, resolveDenylist, toCustomContext } from "@flareapp/core";
4
4
 
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as createFlareResolver, t as catchWindowErrors } from "./catchWindowErrors-I_8ksYoj.mjs";
1
+ import { n as createFlareResolver, t as catchWindowErrors } from "./catchWindowErrors-C9vXZjft.mjs";
2
2
  import { Flare } from "./browser.mjs";
3
3
  import { DEFAULT_URL_DENYLIST, FrameworkName, GlobalScopeProvider, Logger, NullFileReader, Scope, convertToError, redactObjectValues, redactUrlQuery, redactUrlQuery as redactFullPath, resolveDenylist, toCustomContext } from "@flareapp/core";
4
4
 
@@ -3,11 +3,10 @@ import { Attributes, BrowserSpanType, Config, ContextCollector, FileReader, Flus
3
3
 
4
4
  //#region src/createFlareResolver.d.ts
5
5
  /**
6
- * Builds a per-package Flare resolver: `registerDefaultFlare` (wired once by the web entry) and
7
- * `resolveFlare` (called at wiring time). Each call holds its own default-provider state. The check
8
- * that warns about the Electron `__flare` bridge uses `packageName` in its message;
9
- * `injectInstruction` replaces the closing hint for packages whose advice differs (for example
10
- * svelte, which points at the preprocessor's importSource).
6
+ * Builds a per-package Flare resolver: `registerDefaultFlare` (set once by the web entry) and
7
+ * `resolveFlare` (called at wiring time). Each call keeps its own default-provider state.
8
+ * `packageName` names the package in the Electron-bridge warning; `injectInstruction` overrides the
9
+ * closing hint for packages with different advice (for example Svelte's preprocessor importSource).
11
10
  */
12
11
  declare function createFlareResolver(config: {
13
12
  packageName: string;
@@ -45,9 +44,7 @@ declare class BrowserFlushScheduler implements FlushScheduler {
45
44
  //#region src/instrumentation/navigation/types.d.ts
46
45
  type RouteName = {
47
46
  name: string;
48
- source: 'route' | 'url';
49
- /** Where the navigation ends. Set on a redirect so the final url is reported; leave out to keep
50
- * the url the root opened with. */
47
+ source: 'route' | 'url'; /** Where the navigation ends. Set on a redirect so the report uses the final url, not the url the root opened with. */
51
48
  url?: string;
52
49
  };
53
50
  type NavigationSource = {
@@ -63,12 +60,17 @@ type NavigationSource = {
63
60
  //#endregion
64
61
  //#region src/instrumentation/navigation/utils.d.ts
65
62
  declare function currentPath(): string;
63
+ /** The whole address, query string included. */
66
64
  declare function currentHref(): string;
65
+ /**
66
+ * Prefers the router's route template (`/product/:id`) over the raw path, so all urls of one route
67
+ * group together. If `derive` throws, the fallback path is used instead of breaking the app.
68
+ */
67
69
  declare function routeName(derive: () => string | undefined, fallbackPath: string, url?: string): RouteName;
68
70
  /**
69
- * `build` is the router's own href builder (vue-router `resolve`, React Router `createHref`). It puts
70
- * the app's base path and hash prefix back. Without it, an app served from `/app/` reports
71
- * `/product/p01` instead of `/app/product/p01`. If `build` throws, we use `fallback`.
71
+ * `build` is the router's own href builder (vue-router `resolve`, React Router `createHref`). It restores
72
+ * the app's base path and hash prefix, so an app served from `/app/` reports `/app/product/p01` instead
73
+ * of `/product/p01`. Falls back to `fallbackHref` if `build` throws.
72
74
  */
73
75
  declare function resolveHref(build: () => string | null | undefined, fallbackHref: string): string | undefined;
74
76
  //#endregion
@@ -82,16 +84,17 @@ declare function registerNavigationSource(): NavigationSource;
82
84
  //#endregion
83
85
  //#region src/tracing/utils/absoluteHref.d.ts
84
86
  /**
85
- * Resolve a router-reported href against the page we are on. Returns the `URL`, so a caller that
86
- * wants the pathname as well as the href does not parse it a second time.
87
+ * Resolves a router-reported href against the current page. Returns the `URL`, so a caller that also
88
+ * wants the pathname does not have to parse it again.
87
89
  *
88
- * Undefined outside a browser or for an unparseable href, so the caller can leave its attribute alone.
90
+ * Returns undefined outside a browser or for an unparseable href, so the caller can leave its
91
+ * attribute alone.
89
92
  */
90
93
  declare function absoluteUrl(href: string | null | undefined): URL | undefined;
91
94
  /**
92
- * The href form of `absoluteUrl`. Pass one built by the router's own `createHref`/`resolve` (see
93
- * `resolveHref`), not a bare path: routers strip the app's base path, so `origin + path` yields an
94
- * address the server does not have.
95
+ * The href form of `absoluteUrl`. Pass a value built by the router's own `createHref`/`resolve`, not
96
+ * a bare path routers strip the app's base path, so `origin + path` gives an address the server
97
+ * does not have.
95
98
  */
96
99
  declare function absoluteHref(href: string | null | undefined): string | undefined;
97
100
  //#endregion
@@ -103,16 +106,16 @@ declare function safeInvoke(fn: (() => void) | null | undefined): void;
103
106
  /** Hands one teardown to `instrumentOnce`. Accepts nothing, for a listener an install chose to skip. */
104
107
  type TrackTeardown = (teardown: (() => void) | null | undefined) => void;
105
108
  /**
106
- * Instrument `target` at most once at a time, tearing down any prior instrumentation of the same object
107
- * first. Vite HMR re-runs boot code against a router that survives the reload, so without this every
108
- * cycle appends another listener set that is never removed. Keyed on the object, so a genuinely new
109
+ * Instruments `target` at most once at a time, tearing down any prior instrumentation of the same
110
+ * object first. Vite HMR re-runs boot code against a router that survives the reload, so without this
111
+ * every cycle would add another listener set that is never removed. Keyed on the object, so a new
109
112
  * router is unaffected.
110
113
  *
111
- * `install` hands each teardown to `track` as it produces it. A router's own `subscribe` / `on` / guard
112
- * registration can throw, and `install` runs during the host's bootstrap, so a throw part-way through
113
- * unwinds what already succeeded (newest first) and stops here rather than reaching the host.
114
+ * `install` hands each teardown to `track` as it produces it. A router's `subscribe`/`on`/guard call
115
+ * can throw during the host's bootstrap, so a throw part-way through unwinds what already succeeded
116
+ * (newest first) instead of reaching the host.
114
117
  *
115
- * @returns the cleanup, or a no-op when the install failed and already unwound itself.
118
+ * @returns The cleanup function, or a no-op if install failed and already unwound itself.
116
119
  */
117
120
  declare function instrumentOnce<T extends object>(target: T, install: (track: TrackTeardown) => void): () => void;
118
121
  //#endregion
@@ -124,16 +127,16 @@ type ComponentTraceContext = {
124
127
  /** Unix nanos on the same clock the tracer uses for span timestamps. */
125
128
  declare const nowNano: typeof defaultNowNano;
126
129
  /**
127
- * Reserved up front so descendants can point at a span before it is recorded. Null when the trace is at
128
- * its span cap: descendants record before this span does, so an id the cap will refuse orphans them.
130
+ * Reserved up front so descendants can point at a span before it is recorded. Null when the trace
131
+ * is at its span cap, since descendants record before this span does and would be orphaned.
129
132
  */
130
133
  declare function reserveSpanId(traceId?: string): string | null;
131
134
  /** The root a top-level component nests under. Null when tracing is off or no root is recording. */
132
135
  declare function activeComponentRoot(): ComponentTraceContext | null;
133
136
  /**
134
- * An ancestor's context is only usable while it still belongs to the live trace. A profiled component
135
- * that survives a navigation (a layout around a swapped page body) froze its context under the pageload
136
- * trace, and `recordComponentSpan` would drop anything pointing at that closed root.
137
+ * An ancestor's context is only usable while it still belongs to the live trace. A component that
138
+ * survives a navigation (a layout around a swapped page body) froze its context under the old
139
+ * pageload trace, and `recordComponentSpan` would drop anything pointing at that closed root.
137
140
  */
138
141
  declare function resolveComponentParent(inherited: ComponentTraceContext | null | undefined, live: ComponentTraceContext | null): ComponentTraceContext | null;
139
142
  /** What a profiler hands back for one component mount. */
@@ -146,9 +149,9 @@ type ComponentSpanRecord = {
146
149
  attributes?: Attributes;
147
150
  };
148
151
  /**
149
- * Records only while the reserved root is still the live recording root, and drops the span otherwise.
150
- * Dropping avoids starting a fresh TraceState for a dead trace, which would re-run the sampler, and
151
- * avoids adding a child to a root that already shipped.
152
+ * Records only while the reserved root is still the live recording root, and drops the span
153
+ * otherwise. Dropping avoids re-running the sampler for a dead trace and avoids adding a child to
154
+ * a root that already shipped.
152
155
  */
153
156
  declare function recordComponentSpan(record: ComponentSpanRecord): void;
154
157
  //#endregion
@@ -3,11 +3,10 @@ import { Attributes, BrowserSpanType as BrowserSpanType$1, Config, ContextCollec
3
3
 
4
4
  //#region src/createFlareResolver.d.ts
5
5
  /**
6
- * Builds a per-package Flare resolver: `registerDefaultFlare` (wired once by the web entry) and
7
- * `resolveFlare` (called at wiring time). Each call holds its own default-provider state. The check
8
- * that warns about the Electron `__flare` bridge uses `packageName` in its message;
9
- * `injectInstruction` replaces the closing hint for packages whose advice differs (for example
10
- * svelte, which points at the preprocessor's importSource).
6
+ * Builds a per-package Flare resolver: `registerDefaultFlare` (set once by the web entry) and
7
+ * `resolveFlare` (called at wiring time). Each call keeps its own default-provider state.
8
+ * `packageName` names the package in the Electron-bridge warning; `injectInstruction` overrides the
9
+ * closing hint for packages with different advice (for example Svelte's preprocessor importSource).
11
10
  */
12
11
  declare function createFlareResolver(config: {
13
12
  packageName: string;
@@ -45,9 +44,7 @@ declare class BrowserFlushScheduler implements FlushScheduler {
45
44
  //#region src/instrumentation/navigation/types.d.ts
46
45
  type RouteName = {
47
46
  name: string;
48
- source: 'route' | 'url';
49
- /** Where the navigation ends. Set on a redirect so the final url is reported; leave out to keep
50
- * the url the root opened with. */
47
+ source: 'route' | 'url'; /** Where the navigation ends. Set on a redirect so the report uses the final url, not the url the root opened with. */
51
48
  url?: string;
52
49
  };
53
50
  type NavigationSource = {
@@ -63,12 +60,17 @@ type NavigationSource = {
63
60
  //#endregion
64
61
  //#region src/instrumentation/navigation/utils.d.ts
65
62
  declare function currentPath(): string;
63
+ /** The whole address, query string included. */
66
64
  declare function currentHref(): string;
65
+ /**
66
+ * Prefers the router's route template (`/product/:id`) over the raw path, so all urls of one route
67
+ * group together. If `derive` throws, the fallback path is used instead of breaking the app.
68
+ */
67
69
  declare function routeName(derive: () => string | undefined, fallbackPath: string, url?: string): RouteName;
68
70
  /**
69
- * `build` is the router's own href builder (vue-router `resolve`, React Router `createHref`). It puts
70
- * the app's base path and hash prefix back. Without it, an app served from `/app/` reports
71
- * `/product/p01` instead of `/app/product/p01`. If `build` throws, we use `fallback`.
71
+ * `build` is the router's own href builder (vue-router `resolve`, React Router `createHref`). It restores
72
+ * the app's base path and hash prefix, so an app served from `/app/` reports `/app/product/p01` instead
73
+ * of `/product/p01`. Falls back to `fallbackHref` if `build` throws.
72
74
  */
73
75
  declare function resolveHref(build: () => string | null | undefined, fallbackHref: string): string | undefined;
74
76
  //#endregion
@@ -82,16 +84,17 @@ declare function registerNavigationSource(): NavigationSource;
82
84
  //#endregion
83
85
  //#region src/tracing/utils/absoluteHref.d.ts
84
86
  /**
85
- * Resolve a router-reported href against the page we are on. Returns the `URL`, so a caller that
86
- * wants the pathname as well as the href does not parse it a second time.
87
+ * Resolves a router-reported href against the current page. Returns the `URL`, so a caller that also
88
+ * wants the pathname does not have to parse it again.
87
89
  *
88
- * Undefined outside a browser or for an unparseable href, so the caller can leave its attribute alone.
90
+ * Returns undefined outside a browser or for an unparseable href, so the caller can leave its
91
+ * attribute alone.
89
92
  */
90
93
  declare function absoluteUrl(href: string | null | undefined): URL | undefined;
91
94
  /**
92
- * The href form of `absoluteUrl`. Pass one built by the router's own `createHref`/`resolve` (see
93
- * `resolveHref`), not a bare path: routers strip the app's base path, so `origin + path` yields an
94
- * address the server does not have.
95
+ * The href form of `absoluteUrl`. Pass a value built by the router's own `createHref`/`resolve`, not
96
+ * a bare path routers strip the app's base path, so `origin + path` gives an address the server
97
+ * does not have.
95
98
  */
96
99
  declare function absoluteHref(href: string | null | undefined): string | undefined;
97
100
  //#endregion
@@ -103,16 +106,16 @@ declare function safeInvoke(fn: (() => void) | null | undefined): void;
103
106
  /** Hands one teardown to `instrumentOnce`. Accepts nothing, for a listener an install chose to skip. */
104
107
  type TrackTeardown = (teardown: (() => void) | null | undefined) => void;
105
108
  /**
106
- * Instrument `target` at most once at a time, tearing down any prior instrumentation of the same object
107
- * first. Vite HMR re-runs boot code against a router that survives the reload, so without this every
108
- * cycle appends another listener set that is never removed. Keyed on the object, so a genuinely new
109
+ * Instruments `target` at most once at a time, tearing down any prior instrumentation of the same
110
+ * object first. Vite HMR re-runs boot code against a router that survives the reload, so without this
111
+ * every cycle would add another listener set that is never removed. Keyed on the object, so a new
109
112
  * router is unaffected.
110
113
  *
111
- * `install` hands each teardown to `track` as it produces it. A router's own `subscribe` / `on` / guard
112
- * registration can throw, and `install` runs during the host's bootstrap, so a throw part-way through
113
- * unwinds what already succeeded (newest first) and stops here rather than reaching the host.
114
+ * `install` hands each teardown to `track` as it produces it. A router's `subscribe`/`on`/guard call
115
+ * can throw during the host's bootstrap, so a throw part-way through unwinds what already succeeded
116
+ * (newest first) instead of reaching the host.
114
117
  *
115
- * @returns the cleanup, or a no-op when the install failed and already unwound itself.
118
+ * @returns The cleanup function, or a no-op if install failed and already unwound itself.
116
119
  */
117
120
  declare function instrumentOnce<T extends object>(target: T, install: (track: TrackTeardown) => void): () => void;
118
121
  //#endregion
@@ -124,16 +127,16 @@ type ComponentTraceContext = {
124
127
  /** Unix nanos on the same clock the tracer uses for span timestamps. */
125
128
  declare const nowNano: typeof defaultNowNano;
126
129
  /**
127
- * Reserved up front so descendants can point at a span before it is recorded. Null when the trace is at
128
- * its span cap: descendants record before this span does, so an id the cap will refuse orphans them.
130
+ * Reserved up front so descendants can point at a span before it is recorded. Null when the trace
131
+ * is at its span cap, since descendants record before this span does and would be orphaned.
129
132
  */
130
133
  declare function reserveSpanId(traceId?: string): string | null;
131
134
  /** The root a top-level component nests under. Null when tracing is off or no root is recording. */
132
135
  declare function activeComponentRoot(): ComponentTraceContext | null;
133
136
  /**
134
- * An ancestor's context is only usable while it still belongs to the live trace. A profiled component
135
- * that survives a navigation (a layout around a swapped page body) froze its context under the pageload
136
- * trace, and `recordComponentSpan` would drop anything pointing at that closed root.
137
+ * An ancestor's context is only usable while it still belongs to the live trace. A component that
138
+ * survives a navigation (a layout around a swapped page body) froze its context under the old
139
+ * pageload trace, and `recordComponentSpan` would drop anything pointing at that closed root.
137
140
  */
138
141
  declare function resolveComponentParent(inherited: ComponentTraceContext | null | undefined, live: ComponentTraceContext | null): ComponentTraceContext | null;
139
142
  /** What a profiler hands back for one component mount. */
@@ -146,9 +149,9 @@ type ComponentSpanRecord = {
146
149
  attributes?: Attributes;
147
150
  };
148
151
  /**
149
- * Records only while the reserved root is still the live recording root, and drops the span otherwise.
150
- * Dropping avoids starting a fresh TraceState for a dead trace, which would re-run the sampler, and
151
- * avoids adding a child to a root that already shipped.
152
+ * Records only while the reserved root is still the live recording root, and drops the span
153
+ * otherwise. Dropping avoids re-running the sampler for a dead trace and avoids adding a child to
154
+ * a root that already shipped.
152
155
  */
153
156
  declare function recordComponentSpan(record: ComponentSpanRecord): void;
154
157
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flareapp/js",
3
- "version": "2.11.0",
3
+ "version": "2.12.1",
4
4
  "description": "JavaScript client for flareapp.io",
5
5
  "homepage": "https://flareapp.io",
6
6
  "bugs": {
@@ -59,7 +59,7 @@
59
59
  "release": "release-it"
60
60
  },
61
61
  "dependencies": {
62
- "@flareapp/core": "2.11.0"
62
+ "@flareapp/core": "2.12.1"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@flareapp/test-helpers": "*",