@grafana/faro-react 2.9.0 → 2.11.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/bundle/faro-react.iife.js +11 -8
- package/dist/bundle/faro-react.iife.js.map +1 -0
- package/dist/cjs/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/defineProperty.js +13 -0
- package/dist/cjs/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/objectSpread2.js +26 -0
- package/dist/cjs/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/toPrimitive.js +15 -0
- package/dist/cjs/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/toPropertyKey.js +10 -0
- package/dist/cjs/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/typeof.js +17 -0
- package/dist/cjs/_virtual/_rolldown/runtime.js +24 -0
- package/dist/cjs/dependencies.js +20 -4
- package/dist/cjs/dependencies.js.map +1 -1
- package/dist/cjs/errorBoundary/FaroErrorBoundary.js +62 -67
- package/dist/cjs/errorBoundary/FaroErrorBoundary.js.map +1 -1
- package/dist/cjs/errorBoundary/const.js +7 -4
- package/dist/cjs/errorBoundary/const.js.map +1 -1
- package/dist/cjs/errorBoundary/index.js +6 -8
- package/dist/cjs/errorBoundary/types.js +0 -1
- package/dist/cjs/errorBoundary/withFaroErrorBoundary.js +17 -15
- package/dist/cjs/errorBoundary/withFaroErrorBoundary.js.map +1 -1
- package/dist/cjs/index.js +480 -109
- package/dist/cjs/instrumentation.js +19 -16
- package/dist/cjs/instrumentation.js.map +1 -1
- package/dist/cjs/profiler/FaroProfiler.js +75 -97
- package/dist/cjs/profiler/FaroProfiler.js.map +1 -1
- package/dist/cjs/profiler/index.js +4 -6
- package/dist/cjs/profiler/withFaroProfiler.js +20 -15
- package/dist/cjs/profiler/withFaroProfiler.js.map +1 -1
- package/dist/cjs/router/index.js +26 -21
- package/dist/cjs/router/initialize.js +30 -26
- package/dist/cjs/router/initialize.js.map +1 -1
- package/dist/cjs/router/types.js +20 -16
- package/dist/cjs/router/types.js.map +1 -1
- package/dist/cjs/router/v4v5/FaroRoute.js +12 -12
- package/dist/cjs/router/v4v5/FaroRoute.js.map +1 -1
- package/dist/cjs/router/v4v5/activeEvent.js +23 -17
- package/dist/cjs/router/v4v5/activeEvent.js.map +1 -1
- package/dist/cjs/router/v4v5/index.js +8 -10
- package/dist/cjs/router/v4v5/initialize.js +36 -34
- package/dist/cjs/router/v4v5/initialize.js.map +1 -1
- package/dist/cjs/router/v4v5/routerDependencies.js +30 -8
- package/dist/cjs/router/v4v5/routerDependencies.js.map +1 -1
- package/dist/cjs/router/v4v5/types.js +0 -1
- package/dist/cjs/router/v6v7/FaroRoutes.js +42 -59
- package/dist/cjs/router/v6v7/FaroRoutes.js.map +1 -1
- package/dist/cjs/router/v6v7/index.js +14 -16
- package/dist/cjs/router/v6v7/initialize.js +34 -32
- package/dist/cjs/router/v6v7/initialize.js.map +1 -1
- package/dist/cjs/router/v6v7/routerDependencies.js +59 -16
- package/dist/cjs/router/v6v7/routerDependencies.js.map +1 -1
- package/dist/cjs/router/v6v7/types.js +0 -1
- package/dist/cjs/router/v6v7/utils.js +27 -32
- package/dist/cjs/router/v6v7/utils.js.map +1 -1
- package/dist/cjs/router/v6v7/withFaroRouterInstrumentation.js +32 -25
- package/dist/cjs/router/v6v7/withFaroRouterInstrumentation.js.map +1 -1
- package/dist/cjs/types.js +0 -1
- package/dist/cjs/utils/index.js +9 -11
- package/dist/cjs/utils/reactVersion.js +24 -18
- package/dist/cjs/utils/reactVersion.js.map +1 -1
- package/dist/esm/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/defineProperty.js +12 -0
- package/dist/esm/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/objectSpread2.js +25 -0
- package/dist/esm/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/toPrimitive.js +14 -0
- package/dist/esm/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/toPropertyKey.js +9 -0
- package/dist/esm/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/typeof.js +11 -0
- package/dist/esm/dependencies.js +9 -5
- package/dist/esm/dependencies.js.map +1 -1
- package/dist/esm/errorBoundary/FaroErrorBoundary.js +61 -66
- package/dist/esm/errorBoundary/FaroErrorBoundary.js.map +1 -1
- package/dist/esm/errorBoundary/const.js +7 -3
- package/dist/esm/errorBoundary/const.js.map +1 -1
- package/dist/esm/errorBoundary/index.js +4 -4
- package/dist/esm/errorBoundary/types.js +0 -2
- package/dist/esm/errorBoundary/withFaroErrorBoundary.js +15 -12
- package/dist/esm/errorBoundary/withFaroErrorBoundary.js.map +1 -1
- package/dist/esm/index.js +21 -7
- package/dist/esm/instrumentation.js +20 -15
- package/dist/esm/instrumentation.js.map +1 -1
- package/dist/esm/profiler/FaroProfiler.js +74 -96
- package/dist/esm/profiler/FaroProfiler.js.map +1 -1
- package/dist/esm/profiler/index.js +3 -3
- package/dist/esm/profiler/withFaroProfiler.js +18 -12
- package/dist/esm/profiler/withFaroProfiler.js.map +1 -1
- package/dist/esm/router/index.js +12 -5
- package/dist/esm/router/initialize.js +31 -26
- package/dist/esm/router/initialize.js.map +1 -1
- package/dist/esm/router/types.js +19 -15
- package/dist/esm/router/types.js.map +1 -1
- package/dist/esm/router/v4v5/FaroRoute.js +11 -9
- package/dist/esm/router/v4v5/FaroRoute.js.map +1 -1
- package/dist/esm/router/v4v5/activeEvent.js +18 -16
- package/dist/esm/router/v4v5/activeEvent.js.map +1 -1
- package/dist/esm/router/v4v5/index.js +4 -4
- package/dist/esm/router/v4v5/initialize.js +35 -31
- package/dist/esm/router/v4v5/initialize.js.map +1 -1
- package/dist/esm/router/v4v5/routerDependencies.js +13 -9
- package/dist/esm/router/v4v5/routerDependencies.js.map +1 -1
- package/dist/esm/router/v4v5/types.js +0 -2
- package/dist/esm/router/v6v7/FaroRoutes.js +41 -26
- package/dist/esm/router/v6v7/FaroRoutes.js.map +1 -1
- package/dist/esm/router/v6v7/index.js +5 -5
- package/dist/esm/router/v6v7/initialize.js +33 -29
- package/dist/esm/router/v6v7/initialize.js.map +1 -1
- package/dist/esm/router/v6v7/routerDependencies.js +24 -20
- package/dist/esm/router/v6v7/routerDependencies.js.map +1 -1
- package/dist/esm/router/v6v7/types.js +0 -2
- package/dist/esm/router/v6v7/utils.js +28 -32
- package/dist/esm/router/v6v7/utils.js.map +1 -1
- package/dist/esm/router/v6v7/withFaroRouterInstrumentation.js +33 -25
- package/dist/esm/router/v6v7/withFaroRouterInstrumentation.js.map +1 -1
- package/dist/esm/types.js +0 -2
- package/dist/esm/utils/index.js +2 -2
- package/dist/esm/utils/reactVersion.js +20 -17
- package/dist/esm/utils/reactVersion.js.map +1 -1
- package/dist/types/dependencies.d.ts +7 -4
- package/dist/types/errorBoundary/FaroErrorBoundary.d.ts +15 -13
- package/dist/types/errorBoundary/const.d.ts +5 -2
- package/dist/types/errorBoundary/index.d.ts +5 -4
- package/dist/types/errorBoundary/types.d.ts +20 -17
- package/dist/types/errorBoundary/withFaroErrorBoundary.d.ts +6 -3
- package/dist/types/index.d.ts +24 -11
- package/dist/types/instrumentation.d.ts +11 -8
- package/dist/types/profiler/FaroProfiler.d.ts +24 -22
- package/dist/types/profiler/index.d.ts +3 -3
- package/dist/types/profiler/withFaroProfiler.d.ts +6 -3
- package/dist/types/router/index.d.ts +14 -7
- package/dist/types/router/initialize.d.ts +5 -2
- package/dist/types/router/types.d.ts +23 -20
- package/dist/types/router/v4v5/FaroRoute.d.ts +6 -3
- package/dist/types/router/v4v5/activeEvent.d.ts +8 -5
- package/dist/types/router/v4v5/index.d.ts +5 -4
- package/dist/types/router/v4v5/initialize.d.ts +8 -5
- package/dist/types/router/v4v5/routerDependencies.d.ts +10 -7
- package/dist/types/router/v4v5/types.d.ts +16 -13
- package/dist/types/router/v6v7/FaroRoutes.d.ts +6 -3
- package/dist/types/router/v6v7/index.d.ts +6 -5
- package/dist/types/router/v6v7/initialize.d.ts +11 -8
- package/dist/types/router/v6v7/routerDependencies.d.ts +14 -11
- package/dist/types/router/v6v7/types.d.ts +57 -58
- package/dist/types/router/v6v7/utils.d.ts +7 -4
- package/dist/types/router/v6v7/withFaroRouterInstrumentation.d.ts +11 -10
- package/dist/types/types.d.ts +24 -18
- package/dist/types/utils/index.d.ts +2 -1
- package/dist/types/utils/reactVersion.d.ts +11 -8
- package/package.json +17 -21
- package/dist/bundle/types/dependencies.d.ts +0 -4
- package/dist/bundle/types/errorBoundary/FaroErrorBoundary.d.ts +0 -14
- package/dist/bundle/types/errorBoundary/const.d.ts +0 -2
- package/dist/bundle/types/errorBoundary/index.d.ts +0 -4
- package/dist/bundle/types/errorBoundary/types.d.ts +0 -19
- package/dist/bundle/types/errorBoundary/withFaroErrorBoundary.d.ts +0 -3
- package/dist/bundle/types/index.d.ts +0 -11
- package/dist/bundle/types/instrumentation.d.ts +0 -9
- package/dist/bundle/types/profiler/FaroProfiler.d.ts +0 -24
- package/dist/bundle/types/profiler/FaroProfiler.test.d.ts +0 -1
- package/dist/bundle/types/profiler/index.d.ts +0 -3
- package/dist/bundle/types/profiler/withFaroProfiler.d.ts +0 -3
- package/dist/bundle/types/router/index.d.ts +0 -7
- package/dist/bundle/types/router/initialize.d.ts +0 -2
- package/dist/bundle/types/router/types.d.ts +0 -24
- package/dist/bundle/types/router/v4v5/FaroRoute.d.ts +0 -3
- package/dist/bundle/types/router/v4v5/activeEvent.d.ts +0 -5
- package/dist/bundle/types/router/v4v5/index.d.ts +0 -4
- package/dist/bundle/types/router/v4v5/initialize.d.ts +0 -5
- package/dist/bundle/types/router/v4v5/routerDependencies.d.ts +0 -7
- package/dist/bundle/types/router/v4v5/types.d.ts +0 -16
- package/dist/bundle/types/router/v6v7/FaroRoutes.d.ts +0 -3
- package/dist/bundle/types/router/v6v7/index.d.ts +0 -5
- package/dist/bundle/types/router/v6v7/initialize.d.ts +0 -8
- package/dist/bundle/types/router/v6v7/routerDependencies.d.ts +0 -11
- package/dist/bundle/types/router/v6v7/types.d.ts +0 -69
- package/dist/bundle/types/router/v6v7/utils.d.ts +0 -4
- package/dist/bundle/types/router/v6v7/withFaroRouterInstrumentation.d.ts +0 -17
- package/dist/bundle/types/types.d.ts +0 -24
- package/dist/bundle/types/utils/index.d.ts +0 -1
- package/dist/bundle/types/utils/reactVersion.d.ts +0 -8
- package/dist/cjs/errorBoundary/index.js.map +0 -1
- package/dist/cjs/errorBoundary/types.js.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/profiler/FaroProfiler.test.js +0 -75
- package/dist/cjs/profiler/FaroProfiler.test.js.map +0 -1
- package/dist/cjs/profiler/index.js.map +0 -1
- package/dist/cjs/router/index.js.map +0 -1
- package/dist/cjs/router/v4v5/index.js.map +0 -1
- package/dist/cjs/router/v4v5/types.js.map +0 -1
- package/dist/cjs/router/v6v7/index.js.map +0 -1
- package/dist/cjs/router/v6v7/types.js.map +0 -1
- package/dist/cjs/types.js.map +0 -1
- package/dist/cjs/utils/index.js.map +0 -1
- package/dist/esm/errorBoundary/index.js.map +0 -1
- package/dist/esm/errorBoundary/types.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/profiler/FaroProfiler.test.js +0 -73
- package/dist/esm/profiler/FaroProfiler.test.js.map +0 -1
- package/dist/esm/profiler/index.js.map +0 -1
- package/dist/esm/router/index.js.map +0 -1
- package/dist/esm/router/v4v5/index.js.map +0 -1
- package/dist/esm/router/v4v5/types.js.map +0 -1
- package/dist/esm/router/v6v7/index.js.map +0 -1
- package/dist/esm/router/v6v7/types.js.map +0 -1
- package/dist/esm/types.js.map +0 -1
- package/dist/esm/utils/index.js.map +0 -1
- package/dist/types/profiler/FaroProfiler.test.d.ts +0 -1
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
3
|
+
const require_dependencies = require("./dependencies.js");
|
|
4
|
+
const require_router_initialize = require("./router/initialize.js");
|
|
5
|
+
require("./router/index.js");
|
|
6
|
+
let _grafana_faro_web_sdk = require("@grafana/faro-web-sdk");
|
|
7
|
+
//#region src/instrumentation.ts
|
|
8
|
+
var ReactIntegration = class extends _grafana_faro_web_sdk.BaseInstrumentation {
|
|
9
|
+
constructor(options = {}) {
|
|
10
|
+
super();
|
|
11
|
+
this.options = options;
|
|
12
|
+
this.name = "@grafana/faro-react";
|
|
13
|
+
this.version = _grafana_faro_web_sdk.VERSION;
|
|
14
|
+
}
|
|
15
|
+
initialize() {
|
|
16
|
+
require_dependencies.setDependencies(this.internalLogger, this.api);
|
|
17
|
+
require_router_initialize.initializeReactRouterInstrumentation(this.options);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
19
21
|
exports.ReactIntegration = ReactIntegration;
|
|
22
|
+
|
|
20
23
|
//# sourceMappingURL=instrumentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","
|
|
1
|
+
{"version":3,"file":"instrumentation.js","names":["BaseInstrumentation","VERSION"],"sources":["../../src/instrumentation.ts"],"sourcesContent":["import { BaseInstrumentation, VERSION } from '@grafana/faro-web-sdk';\n\nimport { setDependencies } from './dependencies';\nimport { initializeReactRouterInstrumentation } from './router';\nimport type { ReactIntegrationConfig } from './types';\n\nexport class ReactIntegration extends BaseInstrumentation {\n name = '@grafana/faro-react';\n version: string = VERSION;\n\n constructor(private options: ReactIntegrationConfig = {}) {\n super();\n }\n\n initialize(): void {\n setDependencies(this.internalLogger, this.api);\n initializeReactRouterInstrumentation(this.options);\n }\n}\n"],"mappings":";;;;;;;AAMA,IAAa,mBAAb,cAAsCA,sBAAAA,oBAAoB;CAIxD,YAAY,UAA0C,CAAC,GAAG;EACxD,MAAM;EADY,KAAA,UAAA;EAHpB,KAAA,OAAO;EACP,KAAA,UAAkBC,sBAAAA;CAIlB;CAEA,aAAmB;EACjB,qBAAA,gBAAgB,KAAK,gBAAgB,KAAK,GAAG;EAC7C,0BAAA,qCAAqC,KAAK,OAAO;CACnD;AACF"}
|
|
@@ -1,101 +1,79 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
componentDidUpdate() {
|
|
84
|
-
if (this.isOtelInitialized && this.updateSpan) {
|
|
85
|
-
this.updateSpan.end();
|
|
86
|
-
this.updateSpan = undefined;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
componentWillUnmount() {
|
|
90
|
-
if (this.isOtelInitialized && this.renderSpan) {
|
|
91
|
-
// End via OTel hrTime (monotonic). See `componentDidMount` for rationale.
|
|
92
|
-
this.renderSpan.end();
|
|
93
|
-
this.renderSpan = undefined;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
render() {
|
|
97
|
-
return this.props.children;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
3
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.js");
|
|
4
|
+
const require_dependencies = require("../dependencies.js");
|
|
5
|
+
const require_objectSpread2 = require("../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/objectSpread2.js");
|
|
6
|
+
let react = require("react");
|
|
7
|
+
react = require_runtime.__toESM(react);
|
|
8
|
+
let _grafana_faro_web_sdk = require("@grafana/faro-web-sdk");
|
|
9
|
+
//#region src/profiler/FaroProfiler.tsx
|
|
10
|
+
var FaroProfiler = class extends react.Component {
|
|
11
|
+
get isOtelInitialized() {
|
|
12
|
+
return !!(require_dependencies.api === null || require_dependencies.api === void 0 ? void 0 : require_dependencies.api.isOTELInitialized());
|
|
13
|
+
}
|
|
14
|
+
get otel() {
|
|
15
|
+
return require_dependencies.api === null || require_dependencies.api === void 0 ? void 0 : require_dependencies.api.getOTEL();
|
|
16
|
+
}
|
|
17
|
+
get tracer() {
|
|
18
|
+
var _this$otel;
|
|
19
|
+
return (_this$otel = this.otel) === null || _this$otel === void 0 ? void 0 : _this$otel.trace.getTracer("@grafana/faro-react", _grafana_faro_web_sdk.VERSION);
|
|
20
|
+
}
|
|
21
|
+
createSpan(spanName, options) {
|
|
22
|
+
var _options$attributes, _this$otel2;
|
|
23
|
+
const span = this.tracer.startSpan(spanName, {
|
|
24
|
+
startTime: options === null || options === void 0 ? void 0 : options.startTime,
|
|
25
|
+
attributes: require_objectSpread2.default({ "react.component.name": this.props.name }, (_options$attributes = options === null || options === void 0 ? void 0 : options.attributes) !== null && _options$attributes !== void 0 ? _options$attributes : {})
|
|
26
|
+
});
|
|
27
|
+
(_this$otel2 = this.otel) === null || _this$otel2 === void 0 || _this$otel2.trace.setSpan(this.otel.context.active(), span);
|
|
28
|
+
if (options === null || options === void 0 ? void 0 : options.endTime) span.end(options.endTime);
|
|
29
|
+
return span;
|
|
30
|
+
}
|
|
31
|
+
createChildSpan(spanName, parent, options) {
|
|
32
|
+
var _this$otel3;
|
|
33
|
+
let span;
|
|
34
|
+
(_this$otel3 = this.otel) === null || _this$otel3 === void 0 || _this$otel3.context.with(this.otel.trace.setSpan(this.otel.context.active(), parent), () => {
|
|
35
|
+
span = this.createSpan(spanName, options);
|
|
36
|
+
});
|
|
37
|
+
return span;
|
|
38
|
+
}
|
|
39
|
+
constructor(props) {
|
|
40
|
+
super(props);
|
|
41
|
+
this.mountSpan = void 0;
|
|
42
|
+
this.renderSpan = void 0;
|
|
43
|
+
this.updateSpan = void 0;
|
|
44
|
+
if (this.isOtelInitialized) this.mountSpan = this.createSpan("componentMount");
|
|
45
|
+
else require_dependencies.internalLogger === null || require_dependencies.internalLogger === void 0 || require_dependencies.internalLogger.error("The Faro React Profiler requires tracing instrumentation. Please enable it in the \"instrumentations\" section of your config.");
|
|
46
|
+
}
|
|
47
|
+
componentDidMount() {
|
|
48
|
+
if (this.isOtelInitialized && this.mountSpan) {
|
|
49
|
+
this.mountSpan.end();
|
|
50
|
+
this.renderSpan = this.createChildSpan("componentRender", this.mountSpan);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
shouldComponentUpdate({ updateProps }) {
|
|
54
|
+
if (this.isOtelInitialized && this.mountSpan && updateProps !== this.props.updateProps) {
|
|
55
|
+
const changedProps = Object.keys(updateProps).filter((key) => updateProps[key] !== this.props.updateProps[key]);
|
|
56
|
+
if (changedProps.length > 0) this.updateSpan = this.createChildSpan("componentUpdate", this.mountSpan, { attributes: { "react.component.changed_props": changedProps } });
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
componentDidUpdate() {
|
|
61
|
+
if (this.isOtelInitialized && this.updateSpan) {
|
|
62
|
+
this.updateSpan.end();
|
|
63
|
+
this.updateSpan = void 0;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
componentWillUnmount() {
|
|
67
|
+
if (this.isOtelInitialized && this.renderSpan) {
|
|
68
|
+
this.renderSpan.end();
|
|
69
|
+
this.renderSpan = void 0;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
render() {
|
|
73
|
+
return this.props.children;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
//#endregion
|
|
100
77
|
exports.FaroProfiler = FaroProfiler;
|
|
78
|
+
|
|
101
79
|
//# sourceMappingURL=FaroProfiler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FaroProfiler.js","
|
|
1
|
+
{"version":3,"file":"FaroProfiler.js","names":["Component","api","VERSION"],"sources":["../../../src/profiler/FaroProfiler.tsx"],"sourcesContent":["import type { Attributes, Span, Tracer } from '@opentelemetry/api';\n// React is required in scope for JSX transformation with the classic transform\n// @ts-expect-error - TS6133: React appears unused but is required for JSX\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport React, { Component } from 'react';\nimport type { ReactNode } from 'react';\n\nimport { VERSION } from '@grafana/faro-web-sdk';\nimport type { OTELApi } from '@grafana/faro-web-sdk';\n\nimport { api, internalLogger } from '../dependencies';\n\nexport interface FaroProfilerProps {\n children: ReactNode;\n name: string;\n updateProps: Record<string, unknown>;\n}\n\nexport class FaroProfiler extends Component<FaroProfilerProps> {\n protected mountSpan: Span | undefined = undefined;\n protected renderSpan: Span | undefined = undefined;\n protected updateSpan: Span | undefined = undefined;\n\n private get isOtelInitialized(): boolean {\n return !!api?.isOTELInitialized();\n }\n\n private get otel(): OTELApi | undefined {\n return api?.getOTEL()!;\n }\n\n private get tracer(): Tracer {\n return this.otel?.trace.getTracer('@grafana/faro-react', VERSION)!;\n }\n\n private createSpan(\n spanName: string,\n options?: { startTime?: number; endTime?: number; attributes?: Attributes }\n ): Span {\n const span = this.tracer.startSpan(spanName, {\n startTime: options?.startTime,\n attributes: {\n 'react.component.name': this.props.name,\n ...(options?.attributes ?? {}),\n },\n });\n\n this.otel?.trace.setSpan(this.otel.context.active(), span);\n\n if (options?.endTime) {\n span.end(options.endTime);\n }\n\n return span;\n }\n\n private createChildSpan(\n spanName: string,\n parent: Span,\n options?: { startTime?: number; endTime?: number; attributes?: Attributes }\n ): Span {\n let span: Span;\n\n this.otel?.context.with(this.otel.trace.setSpan(this.otel.context.active(), parent), () => {\n span = this.createSpan(spanName, options);\n });\n\n return span!;\n }\n\n constructor(props: FaroProfilerProps) {\n super(props);\n\n if (this.isOtelInitialized) {\n this.mountSpan = this.createSpan('componentMount');\n } else {\n internalLogger?.error(\n 'The Faro React Profiler requires tracing instrumentation. Please enable it in the \"instrumentations\" section of your config.'\n );\n }\n }\n\n override componentDidMount(): void {\n if (this.isOtelInitialized && this.mountSpan) {\n // Let OTel stamp the end via its hrTime helper (`performance.timeOrigin +\n // performance.now()`), which is monotonic. Passing `Date.now()` here would mix the\n // wall clock with the mount span's start time (auto-stamped by OTel from hrTime),\n // making `endTime - startTime` drift with NTP / DST / manual clock changes.\n this.mountSpan.end();\n\n // Start the `componentRender` span immediately. It covers the live, mounted lifetime\n // of the component and is ended in `componentWillUnmount`. By starting and ending it\n // without explicit timestamps, both boundaries are stamped from OTel hrTime\n // (monotonic). This avoids the wall-clock issues of the previous implementation\n // which captured `Date.now()` here and subtracted it from another `Date.now()` at\n // unmount — a problem that compounded over a long-lived component (router/app\n // shells can live for the entire session).\n this.renderSpan = this.createChildSpan('componentRender', this.mountSpan);\n }\n }\n\n override shouldComponentUpdate({ updateProps }: FaroProfilerProps): boolean {\n if (this.isOtelInitialized && this.mountSpan && updateProps !== this.props.updateProps) {\n const changedProps = Object.keys(updateProps).filter((key) => updateProps[key] !== this.props.updateProps[key]);\n\n if (changedProps.length > 0) {\n this.updateSpan = this.createChildSpan('componentUpdate', this.mountSpan, {\n attributes: {\n 'react.component.changed_props': changedProps,\n },\n });\n }\n }\n\n return true;\n }\n\n override componentDidUpdate(): void {\n if (this.isOtelInitialized && this.updateSpan) {\n this.updateSpan.end();\n this.updateSpan = undefined;\n }\n }\n\n override componentWillUnmount(): void {\n if (this.isOtelInitialized && this.renderSpan) {\n // End via OTel hrTime (monotonic). See `componentDidMount` for rationale.\n this.renderSpan.end();\n this.renderSpan = undefined;\n }\n }\n\n override render(): ReactNode {\n return this.props.children;\n }\n}\n"],"mappings":";;;;;;;;;AAkBA,IAAa,eAAb,cAAkCA,MAAAA,UAA6B;CAK7D,IAAY,oBAA6B;EACvC,OAAO,CAAC,EAAA,qBAAA,QAAA,QAAA,qBAAA,QAAA,KAAA,IAAA,KAAA,IAACC,qBAAAA,IAAK,kBAAkB;CAClC;CAEA,IAAY,OAA4B;EACtC,OAAA,qBAAA,QAAA,QAAA,qBAAA,QAAA,KAAA,IAAA,KAAA,IAAOA,qBAAAA,IAAK,QAAQ;CACtB;CAEA,IAAY,SAAiB;;EAC3B,QAAA,aAAO,KAAK,UAAA,QAAA,eAAA,KAAA,IAAA,KAAA,IAAA,WAAM,MAAM,UAAU,uBAAuBC,sBAAAA,OAAO;CAClE;CAEA,WACE,UACA,SACM;;EACN,MAAM,OAAO,KAAK,OAAO,UAAU,UAAU;GAC3C,WAAA,YAAA,QAAA,YAAA,KAAA,IAAA,KAAA,IAAW,QAAS;GACpB,YAAA,sBAAA,QAAA,EACE,wBAAwB,KAAK,MAAM,KAAA,IAAA,sBAAA,YAAA,QAAA,YAAA,KAAA,IAAA,KAAA,IAC/B,QAAS,gBAAA,QAAA,wBAAA,KAAA,IAAA,sBAAc,CAAC,CAC9B;EACF,CAAC;EAED,CAAA,cAAA,KAAK,UAAA,QAAA,gBAAA,KAAA,KAAA,YAAM,MAAM,QAAQ,KAAK,KAAK,QAAQ,OAAO,GAAG,IAAI;EAEzD,IAAA,YAAA,QAAA,YAAA,KAAA,IAAA,KAAA,IAAI,QAAS,SACX,KAAK,IAAI,QAAQ,OAAO;EAG1B,OAAO;CACT;CAEA,gBACE,UACA,QACA,SACM;;EACN,IAAI;EAEJ,CAAA,cAAA,KAAK,UAAA,QAAA,gBAAA,KAAA,KAAA,YAAM,QAAQ,KAAK,KAAK,KAAK,MAAM,QAAQ,KAAK,KAAK,QAAQ,OAAO,GAAG,MAAM,SAAS;GACzF,OAAO,KAAK,WAAW,UAAU,OAAO;EAC1C,CAAC;EAED,OAAO;CACT;CAEA,YAAY,OAA0B;EACpC,MAAM,KAAK;EApDb,KAAU,YAA8B,KAAA;EACxC,KAAU,aAA+B,KAAA;EACzC,KAAU,aAA+B,KAAA;EAoDvC,IAAI,KAAK,mBACP,KAAK,YAAY,KAAK,WAAW,gBAAgB;OAEjD,qBAAA,mBAAA,QAAA,qBAAA,mBAAA,KAAA,KAAA,qBAAA,eAAgB,MACd,gIACF;CAEJ;CAEA,oBAAmC;EACjC,IAAI,KAAK,qBAAqB,KAAK,WAAW;GAK5C,KAAK,UAAU,IAAI;GASnB,KAAK,aAAa,KAAK,gBAAgB,mBAAmB,KAAK,SAAS;EAC1E;CACF;CAEA,sBAA+B,EAAE,eAA2C;EAC1E,IAAI,KAAK,qBAAqB,KAAK,aAAa,gBAAgB,KAAK,MAAM,aAAa;GACtF,MAAM,eAAe,OAAO,KAAK,WAAW,CAAC,CAAC,QAAQ,QAAQ,YAAY,SAAS,KAAK,MAAM,YAAY,IAAI;GAE9G,IAAI,aAAa,SAAS,GACxB,KAAK,aAAa,KAAK,gBAAgB,mBAAmB,KAAK,WAAW,EACxE,YAAY,EACV,iCAAiC,aACnC,EACF,CAAC;EAEL;EAEA,OAAO;CACT;CAEA,qBAAoC;EAClC,IAAI,KAAK,qBAAqB,KAAK,YAAY;GAC7C,KAAK,WAAW,IAAI;GACpB,KAAK,aAAa,KAAA;EACpB;CACF;CAEA,uBAAsC;EACpC,IAAI,KAAK,qBAAqB,KAAK,YAAY;GAE7C,KAAK,WAAW,IAAI;GACpB,KAAK,aAAa,KAAA;EACpB;CACF;CAEA,SAA6B;EAC3B,OAAO,KAAK,MAAM;CACpB;AACF"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "withFaroProfiler", { enumerable: true, get: function () { return withFaroProfiler_1.withFaroProfiler; } });
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
3
|
+
const require_profiler_FaroProfiler = require("./FaroProfiler.js");
|
|
4
|
+
const require_profiler_withFaroProfiler = require("./withFaroProfiler.js");
|
|
5
|
+
exports.FaroProfiler = require_profiler_FaroProfiler.FaroProfiler;
|
|
6
|
+
exports.withFaroProfiler = require_profiler_withFaroProfiler.withFaroProfiler;
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.js");
|
|
4
|
+
const require_profiler_FaroProfiler = require("./FaroProfiler.js");
|
|
5
|
+
let react = require("react");
|
|
6
|
+
react = require_runtime.__toESM(react);
|
|
7
|
+
let _grafana_faro_web_sdk = require("@grafana/faro-web-sdk");
|
|
8
|
+
let hoist_non_react_statics = require("hoist-non-react-statics");
|
|
9
|
+
hoist_non_react_statics = require_runtime.__toESM(hoist_non_react_statics);
|
|
10
|
+
//#region src/profiler/withFaroProfiler.tsx
|
|
11
11
|
function withFaroProfiler(WrappedComponent, options) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
var _ref, _ref2, _options$name;
|
|
13
|
+
const componentDisplayName = (_ref = (_ref2 = (_options$name = options === null || options === void 0 ? void 0 : options.name) !== null && _options$name !== void 0 ? _options$name : WrappedComponent.displayName) !== null && _ref2 !== void 0 ? _ref2 : WrappedComponent.name) !== null && _ref !== void 0 ? _ref : _grafana_faro_web_sdk.unknownString;
|
|
14
|
+
const Component = (props) => /* @__PURE__ */ react.default.createElement(require_profiler_FaroProfiler.FaroProfiler, {
|
|
15
|
+
name: componentDisplayName,
|
|
16
|
+
updateProps: props
|
|
17
|
+
}, /* @__PURE__ */ react.default.createElement(WrappedComponent, props));
|
|
18
|
+
Component.displayName = `faroProfiler(${componentDisplayName})`;
|
|
19
|
+
(0, hoist_non_react_statics.default)(Component, WrappedComponent);
|
|
20
|
+
return Component;
|
|
19
21
|
}
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.withFaroProfiler = withFaroProfiler;
|
|
24
|
+
|
|
20
25
|
//# sourceMappingURL=withFaroProfiler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withFaroProfiler.js","
|
|
1
|
+
{"version":3,"file":"withFaroProfiler.js","names":["unknownString","FaroProfiler"],"sources":["../../../src/profiler/withFaroProfiler.tsx"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport React from 'react';\nimport type { ComponentType, FC } from 'react';\n\nimport { unknownString } from '@grafana/faro-web-sdk';\n\nimport { FaroProfiler } from './FaroProfiler';\nimport type { FaroProfilerProps } from './FaroProfiler';\n\nexport function withFaroProfiler<P extends Record<string, any>>(\n WrappedComponent: ComponentType<P>,\n options?: Omit<FaroProfilerProps, 'updateProps'>\n): FC<P> {\n const componentDisplayName = options?.name ?? WrappedComponent.displayName ?? WrappedComponent.name ?? unknownString;\n\n const Component: FC<P> = (props: P) => (\n <FaroProfiler name={componentDisplayName} updateProps={props}>\n <WrappedComponent {...props} />\n </FaroProfiler>\n );\n\n Component.displayName = `faroProfiler(${componentDisplayName})`;\n\n hoistNonReactStatics(Component, WrappedComponent);\n\n return Component;\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,iBACd,kBACA,SACO;;CACP,MAAM,wBAAA,QAAA,SAAA,gBAAA,YAAA,QAAA,YAAA,KAAA,IAAA,KAAA,IAAuB,QAAS,UAAA,QAAA,kBAAA,KAAA,IAAA,gBAAQ,iBAAiB,iBAAA,QAAA,UAAA,KAAA,IAAA,QAAe,iBAAiB,UAAA,QAAA,SAAA,KAAA,IAAA,OAAQA,sBAAAA;CAEvG,MAAM,aAAoB,UACxB,sBAAA,QAAA,cAACC,8BAAAA,cAAD;EAAc,MAAM;EAAsB,aAAa;CAEzC,GADZ,sBAAA,QAAA,cAAC,kBAAqB,KAAQ,CAClB;CAGhB,UAAU,cAAc,gBAAgB,qBAAqB;CAE7D,CAAA,GAAA,wBAAA,QAAA,CAAqB,WAAW,gBAAgB;CAEhD,OAAO;AACT"}
|
package/dist/cjs/router/index.js
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
3
|
+
const require_router_types = require("./types.js");
|
|
4
|
+
const require_router_v4v5_routerDependencies = require("./v4v5/routerDependencies.js");
|
|
5
|
+
const require_router_v4v5_FaroRoute = require("./v4v5/FaroRoute.js");
|
|
6
|
+
const require_router_v4v5_initialize = require("./v4v5/initialize.js");
|
|
7
|
+
require("./v4v5/index.js");
|
|
8
|
+
const require_router_v6v7_routerDependencies = require("./v6v7/routerDependencies.js");
|
|
9
|
+
const require_router_v6v7_FaroRoutes = require("./v6v7/FaroRoutes.js");
|
|
10
|
+
const require_router_v6v7_initialize = require("./v6v7/initialize.js");
|
|
11
|
+
const require_router_v6v7_withFaroRouterInstrumentation = require("./v6v7/withFaroRouterInstrumentation.js");
|
|
12
|
+
require("./v6v7/index.js");
|
|
13
|
+
const require_router_initialize = require("./initialize.js");
|
|
14
|
+
exports.FaroRoute = require_router_v4v5_FaroRoute.FaroRoute;
|
|
15
|
+
exports.FaroRoutes = require_router_v6v7_FaroRoutes.FaroRoutes;
|
|
16
|
+
exports.NavigationType = require_router_types.NavigationType;
|
|
17
|
+
exports.ReactRouterVersion = require_router_types.ReactRouterVersion;
|
|
18
|
+
exports.createReactRouterV4Options = require_router_v4v5_initialize.createReactRouterV4Options;
|
|
19
|
+
exports.createReactRouterV5Options = require_router_v4v5_initialize.createReactRouterV5Options;
|
|
20
|
+
exports.createReactRouterV6DataOptions = require_router_v6v7_initialize.createReactRouterV6DataOptions;
|
|
21
|
+
exports.createReactRouterV6Options = require_router_v6v7_initialize.createReactRouterV6Options;
|
|
22
|
+
exports.createReactRouterV7DataOptions = require_router_v6v7_initialize.createReactRouterV7DataOptions;
|
|
23
|
+
exports.createReactRouterV7Options = require_router_v6v7_initialize.createReactRouterV7Options;
|
|
24
|
+
exports.initializeReactRouterInstrumentation = require_router_initialize.initializeReactRouterInstrumentation;
|
|
25
|
+
exports.setReactRouterV4V5SSRDependencies = require_router_v4v5_routerDependencies.setReactRouterV4V5SSRDependencies;
|
|
26
|
+
exports.setReactRouterV6SSRDependencies = require_router_v6v7_routerDependencies.setReactRouterV6SSRDependencies;
|
|
27
|
+
exports.setReactRouterV7SSRDependencies = require_router_v6v7_routerDependencies.setReactRouterV7SSRDependencies;
|
|
28
|
+
exports.withFaroRouterInstrumentation = require_router_v6v7_withFaroRouterInstrumentation.withFaroRouterInstrumentation;
|
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const
|
|
3
|
+
const require_dependencies = require("../dependencies.js");
|
|
4
|
+
require("./types.js");
|
|
5
|
+
const require_router_v4v5_initialize = require("./v4v5/initialize.js");
|
|
6
|
+
require("./v4v5/index.js");
|
|
7
|
+
const require_router_v6v7_initialize = require("./v6v7/initialize.js");
|
|
8
|
+
require("./v6v7/index.js");
|
|
9
|
+
//#region src/router/initialize.ts
|
|
8
10
|
function initializeReactRouterInstrumentation(options) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
11
|
+
var _options$router;
|
|
12
|
+
const initMessage = "Initializing React Router";
|
|
13
|
+
switch ((_options$router = options.router) === null || _options$router === void 0 ? void 0 : _options$router.version) {
|
|
14
|
+
case "v7":
|
|
15
|
+
case "v6":
|
|
16
|
+
require_dependencies.internalLogger.debug(`${initMessage} ${options.router.version} instrumentation`);
|
|
17
|
+
require_router_v6v7_initialize.initializeReactRouterV6Instrumentation(options.router.dependencies);
|
|
18
|
+
break;
|
|
19
|
+
case "v7_data_router":
|
|
20
|
+
case "v6_data_router":
|
|
21
|
+
require_dependencies.internalLogger.debug(`${initMessage} ${options.router.version} data router instrumentation`);
|
|
22
|
+
require_router_v6v7_initialize.initializeReactRouterV6DataRouterInstrumentation(options.router.dependencies);
|
|
23
|
+
break;
|
|
24
|
+
case "v5":
|
|
25
|
+
case "v4":
|
|
26
|
+
require_dependencies.internalLogger.debug(`${initMessage} ${options.router.version} instrumentation`);
|
|
27
|
+
require_router_v4v5_initialize.initializeReactRouterV4V5Instrumentation(options.router.dependencies);
|
|
28
|
+
break;
|
|
29
|
+
default: require_dependencies.internalLogger.debug("Skipping initialization of React Router instrumentation");
|
|
30
|
+
}
|
|
30
31
|
}
|
|
32
|
+
//#endregion
|
|
33
|
+
exports.initializeReactRouterInstrumentation = initializeReactRouterInstrumentation;
|
|
34
|
+
|
|
31
35
|
//# sourceMappingURL=initialize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","
|
|
1
|
+
{"version":3,"file":"initialize.js","names":[],"sources":["../../../src/router/initialize.ts"],"sourcesContent":["import { internalLogger } from '../dependencies';\nimport type { ReactIntegrationConfig } from '../types';\n\nimport { ReactRouterVersion } from './types';\nimport { initializeReactRouterV4V5Instrumentation } from './v4v5';\nimport { initializeReactRouterV6DataRouterInstrumentation, initializeReactRouterV6Instrumentation } from './v6v7';\n\nexport function initializeReactRouterInstrumentation(options: ReactIntegrationConfig): void {\n const initMessage = 'Initializing React Router';\n\n switch (options.router?.version) {\n case ReactRouterVersion.V7:\n case ReactRouterVersion.V6:\n internalLogger.debug(`${initMessage} ${options.router.version} instrumentation`);\n initializeReactRouterV6Instrumentation(options.router.dependencies);\n break;\n\n case ReactRouterVersion.V7_data_router:\n case ReactRouterVersion.V6_data_router:\n internalLogger.debug(`${initMessage} ${options.router.version} data router instrumentation`);\n initializeReactRouterV6DataRouterInstrumentation(options.router.dependencies);\n break;\n\n case ReactRouterVersion.V5:\n case ReactRouterVersion.V4:\n internalLogger.debug(`${initMessage} ${options.router.version} instrumentation`);\n initializeReactRouterV4V5Instrumentation(options.router.dependencies);\n break;\n\n default:\n internalLogger.debug('Skipping initialization of React Router instrumentation');\n }\n}\n"],"mappings":";;;;;;;;;AAOA,SAAgB,qCAAqC,SAAuC;;CAC1F,MAAM,cAAc;CAEpB,SAAA,kBAAQ,QAAQ,YAAA,QAAA,oBAAA,KAAA,IAAA,KAAA,IAAA,gBAAQ,SAAxB;EACE,KAAA;EACA,KAAA;GACE,qBAAA,eAAe,MAAM,GAAG,YAAY,GAAG,QAAQ,OAAO,QAAQ,iBAAiB;GAC/E,+BAAA,uCAAuC,QAAQ,OAAO,YAAY;GAClE;EAEF,KAAA;EACA,KAAA;GACE,qBAAA,eAAe,MAAM,GAAG,YAAY,GAAG,QAAQ,OAAO,QAAQ,6BAA6B;GAC3F,+BAAA,iDAAiD,QAAQ,OAAO,YAAY;GAC5E;EAEF,KAAA;EACA,KAAA;GACE,qBAAA,eAAe,MAAM,GAAG,YAAY,GAAG,QAAQ,OAAO,QAAQ,iBAAiB;GAC/E,+BAAA,yCAAyC,QAAQ,OAAO,YAAY;GACpE;EAEF,SACE,qBAAA,eAAe,MAAM,yDAAyD;CAClF;AACF"}
|
package/dist/cjs/router/types.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
3
|
+
//#region src/router/types.ts
|
|
4
|
+
let ReactRouterVersion = /* @__PURE__ */ function(ReactRouterVersion) {
|
|
5
|
+
ReactRouterVersion["V4"] = "v4";
|
|
6
|
+
ReactRouterVersion["V5"] = "v5";
|
|
7
|
+
ReactRouterVersion["V6"] = "v6";
|
|
8
|
+
ReactRouterVersion["V6_data_router"] = "v6_data_router";
|
|
9
|
+
ReactRouterVersion["V7"] = "v7";
|
|
10
|
+
ReactRouterVersion["V7_data_router"] = "v7_data_router";
|
|
11
|
+
return ReactRouterVersion;
|
|
12
|
+
}({});
|
|
13
|
+
let NavigationType = /* @__PURE__ */ function(NavigationType) {
|
|
14
|
+
NavigationType["Pop"] = "POP";
|
|
15
|
+
NavigationType["Push"] = "PUSH";
|
|
16
|
+
NavigationType["Replace"] = "REPLACE";
|
|
17
|
+
return NavigationType;
|
|
18
|
+
}({});
|
|
19
|
+
//#endregion
|
|
20
|
+
exports.NavigationType = NavigationType;
|
|
21
|
+
exports.ReactRouterVersion = ReactRouterVersion;
|
|
22
|
+
|
|
19
23
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/router/types.ts"],"sourcesContent":["export interface ReactRouterLocation<S extends any = unknown> {\n hash: string;\n key: string;\n pathname: string;\n search: string;\n state: S;\n}\n\nexport interface ReactRouterHistory extends Record<string, any> {\n listen?: (cb: (location: ReactRouterLocation, action: NavigationType) => void) => void;\n location?: ReactRouterLocation;\n}\n\nexport enum ReactRouterVersion {\n V4 = 'v4',\n V5 = 'v5',\n V6 = 'v6',\n V6_data_router = 'v6_data_router',\n V7 = 'v7',\n V7_data_router = 'v7_data_router',\n}\n\nexport enum NavigationType {\n Pop = 'POP',\n Push = 'PUSH',\n Replace = 'REPLACE',\n}\n"],"mappings":";;;AAaA,IAAY,qBAAL,yBAAA,oBAAA;CACL,mBAAA,QAAA;CACA,mBAAA,QAAA;CACA,mBAAA,QAAA;CACA,mBAAA,oBAAA;CACA,mBAAA,QAAA;CACA,mBAAA,oBAAA;;AACF,EAAA,CAAA,CAAA;AAEA,IAAY,iBAAL,yBAAA,gBAAA;CACL,eAAA,SAAA;CACA,eAAA,UAAA;CACA,eAAA,aAAA;;AACF,EAAA,CAAA,CAAA"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
3
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.js");
|
|
4
|
+
const require_router_v4v5_activeEvent = require("./activeEvent.js");
|
|
5
|
+
const require_router_v4v5_routerDependencies = require("./routerDependencies.js");
|
|
6
|
+
let react = require("react");
|
|
7
|
+
react = require_runtime.__toESM(react);
|
|
8
|
+
//#region src/router/v4v5/FaroRoute.tsx
|
|
10
9
|
function FaroRoute(props) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
return react_1.default.createElement(routerDependencies_1.Route, Object.assign({}, props));
|
|
10
|
+
var _props$computedMatch;
|
|
11
|
+
if (props === null || props === void 0 || (_props$computedMatch = props.computedMatch) === null || _props$computedMatch === void 0 ? void 0 : _props$computedMatch.isExact) require_router_v4v5_activeEvent.setActiveEventRoute(props.computedMatch.path);
|
|
12
|
+
return /* @__PURE__ */ react.default.createElement(require_router_v4v5_routerDependencies.Route, props);
|
|
16
13
|
}
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.FaroRoute = FaroRoute;
|
|
16
|
+
|
|
17
17
|
//# sourceMappingURL=FaroRoute.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FaroRoute.js","
|
|
1
|
+
{"version":3,"file":"FaroRoute.js","names":["Route"],"sources":["../../../../src/router/v4v5/FaroRoute.tsx"],"sourcesContent":["import React from 'react';\n\nimport { setActiveEventRoute } from './activeEvent';\nimport { Route } from './routerDependencies';\nimport type { ReactRouterV4V5RouteProps } from './types';\n\nexport function FaroRoute(props: ReactRouterV4V5RouteProps): React.JSX.Element {\n if (props?.computedMatch?.isExact) {\n setActiveEventRoute(props.computedMatch.path);\n }\n\n return <Route {...props} />;\n}\n"],"mappings":";;;;;;;;AAMA,SAAgB,UAAU,OAAqD;;CAC7E,IAAA,UAAA,QAAA,UAAA,KAAA,MAAA,uBAAI,MAAO,mBAAA,QAAA,yBAAA,KAAA,IAAA,KAAA,IAAA,qBAAe,SACxB,gCAAA,oBAAoB,MAAM,cAAc,IAAI;CAG9C,OAAO,sBAAA,QAAA,cAACA,uCAAAA,OAAU,KAAQ;AAC5B"}
|