@player-ui/metrics-plugin 0.0.1-next.2 → 0.0.1-next.22
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.js +13 -38
- package/dist/index.d.ts +12 -12
- package/dist/index.esm.js +13 -38
- package/package.json +45 -5
- package/src/metrics.ts +25 -46
package/dist/index.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var tapableTs = require('tapable-ts');
|
|
6
6
|
var beaconPlugin = require('@player-ui/beacon-plugin');
|
|
7
7
|
|
|
8
8
|
const MetricsCorePluginSymbol = Symbol.for("MetricsCorePlugin");
|
|
@@ -126,42 +126,17 @@ class MetricsCorePlugin {
|
|
|
126
126
|
this.name = "metrics";
|
|
127
127
|
this.symbol = MetricsCorePluginSymbol;
|
|
128
128
|
this.hooks = {
|
|
129
|
-
resolveRequestTime: new
|
|
130
|
-
onFlowBegin: new
|
|
131
|
-
onFlowEnd: new
|
|
132
|
-
onInteractive: new
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
onNodeEnd: new tapable.SyncHook([
|
|
141
|
-
"nodeMetrics",
|
|
142
|
-
"update"
|
|
143
|
-
]),
|
|
144
|
-
onRenderStart: new tapable.SyncHook([
|
|
145
|
-
"timing",
|
|
146
|
-
"nodeMetrics",
|
|
147
|
-
"update"
|
|
148
|
-
]),
|
|
149
|
-
onRenderEnd: new tapable.SyncHook([
|
|
150
|
-
"timing",
|
|
151
|
-
"nodeMetrics",
|
|
152
|
-
"update"
|
|
153
|
-
]),
|
|
154
|
-
onUpdateStart: new tapable.SyncHook([
|
|
155
|
-
"timing",
|
|
156
|
-
"nodeMetrics",
|
|
157
|
-
"update"
|
|
158
|
-
]),
|
|
159
|
-
onUpdateEnd: new tapable.SyncHook([
|
|
160
|
-
"timing",
|
|
161
|
-
"nodeMetrics",
|
|
162
|
-
"update"
|
|
163
|
-
]),
|
|
164
|
-
onUpdate: new tapable.SyncHook(["update"])
|
|
129
|
+
resolveRequestTime: new tapableTs.SyncBailHook(),
|
|
130
|
+
onFlowBegin: new tapableTs.SyncHook(),
|
|
131
|
+
onFlowEnd: new tapableTs.SyncHook(),
|
|
132
|
+
onInteractive: new tapableTs.SyncHook(),
|
|
133
|
+
onNodeStart: new tapableTs.SyncHook(),
|
|
134
|
+
onNodeEnd: new tapableTs.SyncHook(),
|
|
135
|
+
onRenderStart: new tapableTs.SyncHook(),
|
|
136
|
+
onRenderEnd: new tapableTs.SyncHook(),
|
|
137
|
+
onUpdateStart: new tapableTs.SyncHook(),
|
|
138
|
+
onUpdateEnd: new tapableTs.SyncHook(),
|
|
139
|
+
onUpdate: new tapableTs.SyncHook()
|
|
165
140
|
};
|
|
166
141
|
this.metrics = {};
|
|
167
142
|
var _a, _b, _c;
|
|
@@ -280,7 +255,7 @@ class MetricsCorePlugin {
|
|
|
280
255
|
this.metrics = {
|
|
281
256
|
flow: {
|
|
282
257
|
id: flow.id,
|
|
283
|
-
requestTime,
|
|
258
|
+
requestTime: requestTime != null ? requestTime : void 0,
|
|
284
259
|
timeline: [],
|
|
285
260
|
startTime,
|
|
286
261
|
completed: false,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PlayerPlugin, Player } from '@player-ui/player';
|
|
2
|
-
import { SyncBailHook, SyncHook } from 'tapable';
|
|
2
|
+
import { SyncBailHook, SyncHook } from 'tapable-ts';
|
|
3
3
|
import { BeaconPluginPlugin, BeaconPlugin } from '@player-ui/beacon-plugin';
|
|
4
4
|
|
|
5
5
|
declare const defaultGetTime: () => number;
|
|
@@ -115,17 +115,17 @@ declare class MetricsCorePlugin implements PlayerPlugin {
|
|
|
115
115
|
protected trackUpdate: boolean;
|
|
116
116
|
protected getTime: () => number;
|
|
117
117
|
readonly hooks: {
|
|
118
|
-
resolveRequestTime: SyncBailHook<
|
|
119
|
-
onFlowBegin: SyncHook<PlayerFlowMetrics,
|
|
120
|
-
onFlowEnd: SyncHook<PlayerFlowMetrics,
|
|
121
|
-
onInteractive: SyncHook<Timing, PlayerFlowMetrics, any
|
|
122
|
-
onNodeStart: SyncHook<NodeMetrics | NodeRenderMetrics,
|
|
123
|
-
onNodeEnd: SyncHook<NodeMetrics | NodeRenderMetrics,
|
|
124
|
-
onRenderStart: SyncHook<Timing, NodeRenderMetrics, PlayerFlowMetrics
|
|
125
|
-
onRenderEnd: SyncHook<Timing, NodeRenderMetrics, PlayerFlowMetrics
|
|
126
|
-
onUpdateStart: SyncHook<Timing, NodeRenderMetrics, PlayerFlowMetrics
|
|
127
|
-
onUpdateEnd: SyncHook<Timing, NodeRenderMetrics, PlayerFlowMetrics
|
|
128
|
-
onUpdate: SyncHook<PlayerFlowMetrics,
|
|
118
|
+
resolveRequestTime: SyncBailHook<[], number, Record<string, any>>;
|
|
119
|
+
onFlowBegin: SyncHook<[PlayerFlowMetrics], Record<string, any>>;
|
|
120
|
+
onFlowEnd: SyncHook<[PlayerFlowMetrics], Record<string, any>>;
|
|
121
|
+
onInteractive: SyncHook<[Timing, PlayerFlowMetrics], Record<string, any>>;
|
|
122
|
+
onNodeStart: SyncHook<[NodeMetrics | NodeRenderMetrics], Record<string, any>>;
|
|
123
|
+
onNodeEnd: SyncHook<[NodeMetrics | NodeRenderMetrics], Record<string, any>>;
|
|
124
|
+
onRenderStart: SyncHook<[Timing, NodeRenderMetrics, PlayerFlowMetrics], Record<string, any>>;
|
|
125
|
+
onRenderEnd: SyncHook<[Timing, NodeRenderMetrics, PlayerFlowMetrics], Record<string, any>>;
|
|
126
|
+
onUpdateStart: SyncHook<[Timing, NodeRenderMetrics, PlayerFlowMetrics], Record<string, any>>;
|
|
127
|
+
onUpdateEnd: SyncHook<[Timing, NodeRenderMetrics, PlayerFlowMetrics], Record<string, any>>;
|
|
128
|
+
onUpdate: SyncHook<[PlayerFlowMetrics], Record<string, any>>;
|
|
129
129
|
};
|
|
130
130
|
private metrics;
|
|
131
131
|
constructor(options?: MetricsWebPluginOptions);
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SyncBailHook, SyncHook } from 'tapable';
|
|
1
|
+
import { SyncBailHook, SyncHook } from 'tapable-ts';
|
|
2
2
|
import { BeaconPlugin } from '@player-ui/beacon-plugin';
|
|
3
3
|
|
|
4
4
|
const MetricsCorePluginSymbol = Symbol.for("MetricsCorePlugin");
|
|
@@ -122,42 +122,17 @@ class MetricsCorePlugin {
|
|
|
122
122
|
this.name = "metrics";
|
|
123
123
|
this.symbol = MetricsCorePluginSymbol;
|
|
124
124
|
this.hooks = {
|
|
125
|
-
resolveRequestTime: new SyncBailHook(
|
|
126
|
-
onFlowBegin: new SyncHook(
|
|
127
|
-
onFlowEnd: new SyncHook(
|
|
128
|
-
onInteractive: new SyncHook(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
onNodeEnd: new SyncHook([
|
|
137
|
-
"nodeMetrics",
|
|
138
|
-
"update"
|
|
139
|
-
]),
|
|
140
|
-
onRenderStart: new SyncHook([
|
|
141
|
-
"timing",
|
|
142
|
-
"nodeMetrics",
|
|
143
|
-
"update"
|
|
144
|
-
]),
|
|
145
|
-
onRenderEnd: new SyncHook([
|
|
146
|
-
"timing",
|
|
147
|
-
"nodeMetrics",
|
|
148
|
-
"update"
|
|
149
|
-
]),
|
|
150
|
-
onUpdateStart: new SyncHook([
|
|
151
|
-
"timing",
|
|
152
|
-
"nodeMetrics",
|
|
153
|
-
"update"
|
|
154
|
-
]),
|
|
155
|
-
onUpdateEnd: new SyncHook([
|
|
156
|
-
"timing",
|
|
157
|
-
"nodeMetrics",
|
|
158
|
-
"update"
|
|
159
|
-
]),
|
|
160
|
-
onUpdate: new SyncHook(["update"])
|
|
125
|
+
resolveRequestTime: new SyncBailHook(),
|
|
126
|
+
onFlowBegin: new SyncHook(),
|
|
127
|
+
onFlowEnd: new SyncHook(),
|
|
128
|
+
onInteractive: new SyncHook(),
|
|
129
|
+
onNodeStart: new SyncHook(),
|
|
130
|
+
onNodeEnd: new SyncHook(),
|
|
131
|
+
onRenderStart: new SyncHook(),
|
|
132
|
+
onRenderEnd: new SyncHook(),
|
|
133
|
+
onUpdateStart: new SyncHook(),
|
|
134
|
+
onUpdateEnd: new SyncHook(),
|
|
135
|
+
onUpdate: new SyncHook()
|
|
161
136
|
};
|
|
162
137
|
this.metrics = {};
|
|
163
138
|
var _a, _b, _c;
|
|
@@ -276,7 +251,7 @@ class MetricsCorePlugin {
|
|
|
276
251
|
this.metrics = {
|
|
277
252
|
flow: {
|
|
278
253
|
id: flow.id,
|
|
279
|
-
requestTime,
|
|
254
|
+
requestTime: requestTime != null ? requestTime : void 0,
|
|
280
255
|
timeline: [],
|
|
281
256
|
startTime,
|
|
282
257
|
completed: false,
|
package/package.json
CHANGED
|
@@ -1,19 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@player-ui/metrics-plugin",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.22",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
7
7
|
},
|
|
8
8
|
"peerDependencies": {
|
|
9
|
-
"@player-ui/
|
|
9
|
+
"@player-ui/player": "0.0.1-next.22"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"
|
|
13
|
-
"
|
|
12
|
+
"@player-ui/beacon-plugin": "0.0.1-next.22",
|
|
13
|
+
"tapable-ts": "^0.1.0",
|
|
14
14
|
"@babel/runtime": "7.15.4"
|
|
15
15
|
},
|
|
16
16
|
"main": "dist/index.cjs.js",
|
|
17
17
|
"module": "dist/index.esm.js",
|
|
18
|
-
"typings": "dist/index.d.ts"
|
|
18
|
+
"typings": "dist/index.d.ts",
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/player-ui/player-ui"
|
|
24
|
+
},
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/player-ui/player-ui/issues"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://player-ui.github.io",
|
|
29
|
+
"contributors": [
|
|
30
|
+
{
|
|
31
|
+
"name": "Adam Dierkens",
|
|
32
|
+
"url": "https://github.com/adierkens"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "Spencer Hamm",
|
|
36
|
+
"url": "https://github.com/spentacular"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "Harris Borawski",
|
|
40
|
+
"url": "https://github.com/hborawski"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "Jeremiah Zucker",
|
|
44
|
+
"url": "https://github.com/sugarmanz"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "Ketan Reddy",
|
|
48
|
+
"url": "https://github.com/KetanReddy"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "Brocollie08",
|
|
52
|
+
"url": "https://github.com/brocollie08"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "Kelly Harrop",
|
|
56
|
+
"url": "https://github.com/kharrop"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
19
59
|
}
|
package/src/metrics.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Player, PlayerPlugin } from '@player-ui/player';
|
|
2
|
-
import { SyncHook, SyncBailHook } from 'tapable';
|
|
2
|
+
import { SyncHook, SyncBailHook } from 'tapable-ts';
|
|
3
3
|
import type { BeaconPluginPlugin, BeaconArgs } from '@player-ui/beacon-plugin';
|
|
4
4
|
import { BeaconPlugin } from '@player-ui/beacon-plugin';
|
|
5
5
|
import {
|
|
@@ -112,7 +112,7 @@ export class MetricsViewBeaconPlugin implements BeaconPluginPlugin {
|
|
|
112
112
|
apply(beaconPlugin: BeaconPlugin) {
|
|
113
113
|
beaconPlugin.hooks.buildBeacon.intercept({
|
|
114
114
|
context: true,
|
|
115
|
-
call: (context, beacon) => {
|
|
115
|
+
call: (context: any, beacon) => {
|
|
116
116
|
if (context && (beacon as BeaconArgs).action === 'viewed') {
|
|
117
117
|
context[this.symbol] = this.buildContext();
|
|
118
118
|
}
|
|
@@ -251,48 +251,27 @@ export class MetricsCorePlugin implements PlayerPlugin {
|
|
|
251
251
|
protected getTime: () => number;
|
|
252
252
|
|
|
253
253
|
public readonly hooks = {
|
|
254
|
-
resolveRequestTime: new SyncBailHook<number>(
|
|
255
|
-
|
|
256
|
-
onFlowBegin: new SyncHook<PlayerFlowMetrics>(
|
|
257
|
-
onFlowEnd: new SyncHook<PlayerFlowMetrics>(
|
|
258
|
-
|
|
259
|
-
onInteractive: new SyncHook<Timing, PlayerFlowMetrics>(
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
]),
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
]),
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
'nodeMetrics',
|
|
276
|
-
'update',
|
|
277
|
-
]),
|
|
278
|
-
onRenderEnd: new SyncHook<Timing, NodeRenderMetrics, PlayerFlowMetrics>([
|
|
279
|
-
'timing',
|
|
280
|
-
'nodeMetrics',
|
|
281
|
-
'update',
|
|
282
|
-
]),
|
|
283
|
-
|
|
284
|
-
onUpdateStart: new SyncHook<Timing, NodeRenderMetrics, PlayerFlowMetrics>([
|
|
285
|
-
'timing',
|
|
286
|
-
'nodeMetrics',
|
|
287
|
-
'update',
|
|
288
|
-
]),
|
|
289
|
-
onUpdateEnd: new SyncHook<Timing, NodeRenderMetrics, PlayerFlowMetrics>([
|
|
290
|
-
'timing',
|
|
291
|
-
'nodeMetrics',
|
|
292
|
-
'update',
|
|
293
|
-
]),
|
|
294
|
-
|
|
295
|
-
onUpdate: new SyncHook<PlayerFlowMetrics>(['update']),
|
|
254
|
+
resolveRequestTime: new SyncBailHook<[], number>(),
|
|
255
|
+
|
|
256
|
+
onFlowBegin: new SyncHook<[PlayerFlowMetrics]>(),
|
|
257
|
+
onFlowEnd: new SyncHook<[PlayerFlowMetrics]>(),
|
|
258
|
+
|
|
259
|
+
onInteractive: new SyncHook<[Timing, PlayerFlowMetrics]>(),
|
|
260
|
+
|
|
261
|
+
onNodeStart: new SyncHook<[NodeMetrics | NodeRenderMetrics]>(),
|
|
262
|
+
onNodeEnd: new SyncHook<[NodeMetrics | NodeRenderMetrics]>(),
|
|
263
|
+
|
|
264
|
+
onRenderStart: new SyncHook<
|
|
265
|
+
[Timing, NodeRenderMetrics, PlayerFlowMetrics]
|
|
266
|
+
>(),
|
|
267
|
+
onRenderEnd: new SyncHook<[Timing, NodeRenderMetrics, PlayerFlowMetrics]>(),
|
|
268
|
+
|
|
269
|
+
onUpdateStart: new SyncHook<
|
|
270
|
+
[Timing, NodeRenderMetrics, PlayerFlowMetrics]
|
|
271
|
+
>(),
|
|
272
|
+
onUpdateEnd: new SyncHook<[Timing, NodeRenderMetrics, PlayerFlowMetrics]>(),
|
|
273
|
+
|
|
274
|
+
onUpdate: new SyncHook<[PlayerFlowMetrics]>(),
|
|
296
275
|
};
|
|
297
276
|
|
|
298
277
|
private metrics: PlayerFlowMetrics = {};
|
|
@@ -321,7 +300,7 @@ export class MetricsCorePlugin implements PlayerPlugin {
|
|
|
321
300
|
|
|
322
301
|
callbacks.forEach((hookName) => {
|
|
323
302
|
if (options?.[hookName] !== undefined) {
|
|
324
|
-
this.hooks[hookName].tap('options', options?.[hookName]
|
|
303
|
+
(this.hooks[hookName] as any).tap('options', options?.[hookName]);
|
|
325
304
|
}
|
|
326
305
|
});
|
|
327
306
|
}
|
|
@@ -472,7 +451,7 @@ export class MetricsCorePlugin implements PlayerPlugin {
|
|
|
472
451
|
this.metrics = {
|
|
473
452
|
flow: {
|
|
474
453
|
id: flow.id,
|
|
475
|
-
requestTime,
|
|
454
|
+
requestTime: requestTime ?? undefined,
|
|
476
455
|
timeline: [],
|
|
477
456
|
startTime,
|
|
478
457
|
completed: false,
|