@paulirish/trace_engine 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,17 +5,18 @@ This folder contains the new trace engine that was first implemented for the Per
5
5
  ## API quickstart
6
6
 
7
7
  ```js
8
- loadBrowserPolyfills();
9
- const TraceModel = await import('@paulirish/trace_engine');
8
+ import * as TraceModel from '@paulirish/trace_engine';
9
+
10
+ polyfillDOMRect();
10
11
  const processor = TraceModel.Processor.TraceProcessor.createWithAllHandlers();
11
12
 
12
13
  await processor.parse(traceEvents);
13
14
  console.log(processor.data)
14
15
  ```
15
16
 
16
- **Note:** in reality to run in Node, you'll need to polyfill `window.location`, `window.navigator`, and `window.DOMRect`. 😜
17
+ **Note:** in reality to run in Node, you'll need to polyfill `window.DOMRect`. 😜
17
18
 
18
- See the included `analyze-trace.mjs` a runnable invocation and quick polyfills.
19
+ See the included `analyze-trace.mjs` a runnable invocation.
19
20
 
20
21
  ## Building standalone
21
22
 
@@ -28,7 +29,8 @@ front_end/models/trace/build-trace-engine-lib.sh
28
29
 
29
30
  front_end/models/trace/copy-build-trace-engine-for-publish.sh
30
31
 
31
- madge front_end/models/trace/trace.ts --image tracearch.png --layout dot --exclude="(localized-string-set\/)|(stack-packs\/packs)"
32
+ node out/Typed/../../third_party/typescript/../../node_modules/typescript/bin/tsc -p out/Typed/gen/front_end/models/trace/trace-tsconfig.json # this then has js/map/d.ts. should be able to use for typs
33
+
32
34
  ```
33
35
 
34
36
  ## High level architecture
package/analyze-trace.mjs CHANGED
@@ -7,10 +7,10 @@
7
7
 
8
8
  import fs from 'fs';
9
9
  import zlib from 'zlib';
10
+ // eslint-disable-next-line rulesdir/es_modules_import
11
+ import * as TraceModel from './trace.mjs';
10
12
 
11
- loadBrowserPolyfills(); // Must precede the import (for `location` and `navigator`)
12
-
13
- export const TraceModel = await import('./trace.mjs');
13
+ polyfillDOMRect();
14
14
 
15
15
  // If run as CLI, parse the argv trace (or a fallback)
16
16
  if (import.meta.url.endsWith(process.argv[1])) {
@@ -57,13 +57,9 @@ function isGzip(ab) {
57
57
  return buf[0] === 0x1F && buf[1] === 0x8B && buf[2] === 0x08;
58
58
  }
59
59
 
60
- function loadBrowserPolyfills() {
60
+ function polyfillDOMRect() {
61
61
 
62
62
  // devtools assumes clientside :(
63
- globalThis.location = new URL('devtools://devtools/bundled/devtools_app.html');
64
- globalThis.navigator = {
65
- language: 'en-US'
66
- };
67
63
 
68
64
  // Everything else in here is the DOMRect polyfill
69
65
  // https://raw.githubusercontent.com/JakeChampion/polyfill-library/master/polyfills/DOMRect/polyfill.js
package/meta.json CHANGED
@@ -130,7 +130,7 @@
130
130
  ]
131
131
  },
132
132
  "front_end/models/trace/types/Configuration.ts": {
133
- "bytes": 379,
133
+ "bytes": 1797,
134
134
  "imports": []
135
135
  },
136
136
  "front_end/models/trace/types/File.ts": {
@@ -138,11 +138,11 @@
138
138
  "imports": []
139
139
  },
140
140
  "front_end/models/trace/types/Timing.ts": {
141
- "bytes": 1065,
141
+ "bytes": 1176,
142
142
  "imports": []
143
143
  },
144
144
  "front_end/models/trace/types/TraceEvents.ts": {
145
- "bytes": 47061,
145
+ "bytes": 47820,
146
146
  "imports": []
147
147
  },
148
148
  "front_end/models/trace/types/types.ts": {
@@ -187,8 +187,17 @@
187
187
  }
188
188
  ]
189
189
  },
190
+ "front_end/models/trace/handlers/AuctionWorkletsHandler.ts": {
191
+ "bytes": 7012,
192
+ "imports": [
193
+ {
194
+ "path": "front_end/models/trace/types/types.ts",
195
+ "kind": "import-statement"
196
+ }
197
+ ]
198
+ },
190
199
  "front_end/models/trace/handlers/MetaHandler.ts": {
191
- "bytes": 15712,
200
+ "bytes": 16355,
192
201
  "imports": [
193
202
  {
194
203
  "path": "front_end/core/platform/platform.ts",
@@ -204,27 +213,13 @@
204
213
  }
205
214
  ]
206
215
  },
207
- "front_end/core/root/Runtime.ts": {
208
- "bytes": 10427,
209
- "imports": [
210
- {
211
- "path": "front_end/core/platform/platform.ts",
212
- "kind": "import-statement"
213
- }
214
- ]
215
- },
216
- "front_end/core/root/root.ts": {
217
- "bytes": 225,
216
+ "front_end/models/trace/helpers/Trace.ts": {
217
+ "bytes": 5489,
218
218
  "imports": [
219
219
  {
220
- "path": "front_end/core/root/Runtime.ts",
220
+ "path": "front_end/models/trace/types/types.ts",
221
221
  "kind": "import-statement"
222
- }
223
- ]
224
- },
225
- "front_end/models/trace/helpers/Trace.ts": {
226
- "bytes": 4859,
227
- "imports": [
222
+ },
228
223
  {
229
224
  "path": "front_end/core/platform/platform.ts",
230
225
  "kind": "import-statement"
@@ -232,7 +227,7 @@
232
227
  ]
233
228
  },
234
229
  "front_end/models/trace/helpers/Timing.ts": {
235
- "bytes": 7545,
230
+ "bytes": 8686,
236
231
  "imports": [
237
232
  {
238
233
  "path": "front_end/core/platform/platform.ts",
@@ -249,12 +244,8 @@
249
244
  ]
250
245
  },
251
246
  "front_end/models/trace/helpers/SamplesIntegrator.ts": {
252
- "bytes": 19670,
247
+ "bytes": 18690,
253
248
  "imports": [
254
- {
255
- "path": "front_end/core/root/root.ts",
256
- "kind": "import-statement"
257
- },
258
249
  {
259
250
  "path": "front_end/models/trace/types/types.ts",
260
251
  "kind": "import-statement"
@@ -269,8 +260,17 @@
269
260
  }
270
261
  ]
271
262
  },
263
+ "front_end/models/trace/helpers/TreeHelpers.ts": {
264
+ "bytes": 8436,
265
+ "imports": [
266
+ {
267
+ "path": "front_end/models/trace/types/types.ts",
268
+ "kind": "import-statement"
269
+ }
270
+ ]
271
+ },
272
272
  "front_end/models/trace/helpers/helpers.ts": {
273
- "bytes": 303,
273
+ "bytes": 352,
274
274
  "imports": [
275
275
  {
276
276
  "path": "front_end/models/trace/helpers/SamplesIntegrator.ts",
@@ -283,6 +283,10 @@
283
283
  {
284
284
  "path": "front_end/models/trace/helpers/Trace.ts",
285
285
  "kind": "import-statement"
286
+ },
287
+ {
288
+ "path": "front_end/models/trace/helpers/TreeHelpers.ts",
289
+ "kind": "import-statement"
286
290
  }
287
291
  ]
288
292
  },
@@ -308,7 +312,7 @@
308
312
  ]
309
313
  },
310
314
  "front_end/models/trace/handlers/PageLoadMetricsHandler.ts": {
311
- "bytes": 19990,
315
+ "bytes": 19538,
312
316
  "imports": [
313
317
  {
314
318
  "path": "front_end/core/platform/platform.ts",
@@ -329,18 +333,14 @@
329
333
  ]
330
334
  },
331
335
  "front_end/models/trace/handlers/ScreenshotsHandler.ts": {
332
- "bytes": 1531,
336
+ "bytes": 1480,
333
337
  "imports": [
334
- {
335
- "path": "front_end/models/trace/handlers/MetaHandler.ts",
336
- "kind": "import-statement"
337
- },
338
338
  {
339
339
  "path": "front_end/models/trace/helpers/helpers.ts",
340
340
  "kind": "import-statement"
341
341
  },
342
342
  {
343
- "path": "front_end/models/trace/types/types.ts",
343
+ "path": "front_end/models/trace/handlers/MetaHandler.ts",
344
344
  "kind": "import-statement"
345
345
  }
346
346
  ]
@@ -485,12 +485,16 @@
485
485
  ]
486
486
  },
487
487
  "front_end/models/trace/handlers/Migration.ts": {
488
- "bytes": 1983,
488
+ "bytes": 2065,
489
489
  "imports": [
490
490
  {
491
491
  "path": "front_end/models/trace/handlers/AnimationHandler.ts",
492
492
  "kind": "import-statement"
493
493
  },
494
+ {
495
+ "path": "front_end/models/trace/handlers/AuctionWorkletsHandler.ts",
496
+ "kind": "import-statement"
497
+ },
494
498
  {
495
499
  "path": "front_end/models/trace/handlers/GPUHandler.ts",
496
500
  "kind": "import-statement"
@@ -533,15 +537,6 @@
533
537
  }
534
538
  ]
535
539
  },
536
- "front_end/models/trace/handlers/AuctionWorkletsHandler.ts": {
537
- "bytes": 7012,
538
- "imports": [
539
- {
540
- "path": "front_end/models/trace/types/types.ts",
541
- "kind": "import-statement"
542
- }
543
- ]
544
- },
545
540
  "front_end/models/trace/handlers/LargestImagePaintHandler.ts": {
546
541
  "bytes": 1736,
547
542
  "imports": [
@@ -565,7 +560,7 @@
565
560
  "imports": []
566
561
  },
567
562
  "front_end/models/cpu_profile/CPUProfileDataModel.ts": {
568
- "bytes": 21496,
563
+ "bytes": 21031,
569
564
  "imports": [
570
565
  {
571
566
  "path": "front_end/core/platform/platform.ts",
@@ -591,32 +586,32 @@
591
586
  ]
592
587
  },
593
588
  "front_end/models/trace/handlers/SamplesHandler.ts": {
594
- "bytes": 8878,
589
+ "bytes": 12071,
595
590
  "imports": [
596
591
  {
597
592
  "path": "front_end/core/platform/platform.ts",
598
593
  "kind": "import-statement"
599
594
  },
600
595
  {
601
- "path": "front_end/models/trace/types/types.ts",
596
+ "path": "front_end/models/cpu_profile/cpu_profile.ts",
602
597
  "kind": "import-statement"
603
598
  },
604
599
  {
605
- "path": "front_end/models/trace/handlers/types.ts",
600
+ "path": "front_end/models/trace/helpers/helpers.ts",
606
601
  "kind": "import-statement"
607
602
  },
608
603
  {
609
- "path": "front_end/models/cpu_profile/cpu_profile.ts",
604
+ "path": "front_end/models/trace/types/types.ts",
610
605
  "kind": "import-statement"
611
606
  },
612
607
  {
613
- "path": "front_end/models/trace/helpers/helpers.ts",
608
+ "path": "front_end/models/trace/handlers/types.ts",
614
609
  "kind": "import-statement"
615
610
  }
616
611
  ]
617
612
  },
618
613
  "front_end/models/trace/handlers/RendererHandler.ts": {
619
- "bytes": 20741,
614
+ "bytes": 16021,
620
615
  "imports": [
621
616
  {
622
617
  "path": "front_end/core/platform/platform.ts",
@@ -630,6 +625,10 @@
630
625
  "path": "front_end/models/trace/types/types.ts",
631
626
  "kind": "import-statement"
632
627
  },
628
+ {
629
+ "path": "front_end/models/trace/handlers/AuctionWorkletsHandler.ts",
630
+ "kind": "import-statement"
631
+ },
633
632
  {
634
633
  "path": "front_end/models/trace/handlers/MetaHandler.ts",
635
634
  "kind": "import-statement"
@@ -717,8 +716,12 @@
717
716
  }
718
717
  ]
719
718
  },
719
+ "front_end/models/trace/handlers/Threads.ts": {
720
+ "bytes": 3880,
721
+ "imports": []
722
+ },
720
723
  "front_end/models/trace/handlers/handlers.ts": {
721
- "bytes": 301,
724
+ "bytes": 342,
722
725
  "imports": [
723
726
  {
724
727
  "path": "front_end/models/trace/handlers/Migration.ts",
@@ -728,6 +731,10 @@
728
731
  "path": "front_end/models/trace/handlers/ModelHandlers.ts",
729
732
  "kind": "import-statement"
730
733
  },
734
+ {
735
+ "path": "front_end/models/trace/handlers/Threads.ts",
736
+ "kind": "import-statement"
737
+ },
731
738
  {
732
739
  "path": "front_end/models/trace/handlers/types.ts",
733
740
  "kind": "import-statement"
@@ -748,7 +755,7 @@
748
755
  ]
749
756
  },
750
757
  "front_end/models/trace/Processor.ts": {
751
- "bytes": 9785,
758
+ "bytes": 9649,
752
759
  "imports": [
753
760
  {
754
761
  "path": "front_end/models/trace/handlers/handlers.ts",
@@ -761,7 +768,7 @@
761
768
  ]
762
769
  },
763
770
  "front_end/models/trace/ModelImpl.ts": {
764
- "bytes": 9591,
771
+ "bytes": 9587,
765
772
  "imports": [
766
773
  {
767
774
  "path": "front_end/core/platform/platform.ts",
@@ -786,7 +793,7 @@
786
793
  ]
787
794
  },
788
795
  "front_end/models/trace/TreeManipulator.ts": {
789
- "bytes": 7648,
796
+ "bytes": 7382,
790
797
  "imports": [
791
798
  {
792
799
  "path": "front_end/core/platform/platform.ts",
@@ -833,7 +840,7 @@
833
840
  "imports": [],
834
841
  "exports": [],
835
842
  "inputs": {},
836
- "bytes": 455547
843
+ "bytes": 452118
837
844
  },
838
845
  "out/Default/gen/trace_engine/trace.mjs": {
839
846
  "imports": [],
@@ -854,10 +861,10 @@
854
861
  "bytesInOutput": 101
855
862
  },
856
863
  "front_end/models/trace/handlers/handlers.ts": {
857
- "bytesInOutput": 174
864
+ "bytesInOutput": 208
858
865
  },
859
866
  "front_end/models/trace/handlers/Migration.ts": {
860
- "bytesInOutput": 608
867
+ "bytesInOutput": 659
861
868
  },
862
869
  "front_end/models/trace/handlers/AnimationHandler.ts": {
863
870
  "bytesInOutput": 2735
@@ -865,9 +872,6 @@
865
872
  "front_end/core/platform/array-utilities.ts": {
866
873
  "bytesInOutput": 5200
867
874
  },
868
- "front_end/core/platform/DevToolsPath.ts": {
869
- "bytesInOutput": 298
870
- },
871
875
  "front_end/core/platform/map-utilities.ts": {
872
876
  "bytesInOutput": 1553
873
877
  },
@@ -878,13 +882,13 @@
878
882
  "bytesInOutput": 68
879
883
  },
880
884
  "front_end/core/platform/platform.ts": {
881
- "bytesInOutput": 133
885
+ "bytesInOutput": 0
882
886
  },
883
887
  "front_end/models/trace/types/types.ts": {
884
888
  "bytesInOutput": 202
885
889
  },
886
890
  "front_end/models/trace/types/Configuration.ts": {
887
- "bytesInOutput": 174
891
+ "bytesInOutput": 581
888
892
  },
889
893
  "front_end/models/trace/types/File.ts": {
890
894
  "bytesInOutput": 270
@@ -893,11 +897,14 @@
893
897
  "bytesInOutput": 638
894
898
  },
895
899
  "front_end/models/trace/types/TraceEvents.ts": {
896
- "bytesInOutput": 23387
900
+ "bytesInOutput": 23714
897
901
  },
898
902
  "front_end/models/trace/handlers/types.ts": {
899
903
  "bytesInOutput": 397
900
904
  },
905
+ "front_end/models/trace/handlers/AuctionWorkletsHandler.ts": {
906
+ "bytesInOutput": 3319
907
+ },
901
908
  "front_end/models/trace/handlers/GPUHandler.ts": {
902
909
  "bytesInOutput": 1623
903
910
  },
@@ -905,28 +912,28 @@
905
912
  "bytesInOutput": 9054
906
913
  },
907
914
  "front_end/models/trace/helpers/helpers.ts": {
908
- "bytesInOutput": 174
915
+ "bytesInOutput": 216
909
916
  },
910
917
  "front_end/models/trace/helpers/SamplesIntegrator.ts": {
911
- "bytesInOutput": 9518
912
- },
913
- "front_end/core/root/Runtime.ts": {
914
- "bytesInOutput": 9442
918
+ "bytesInOutput": 8756
915
919
  },
916
920
  "front_end/models/trace/helpers/Timing.ts": {
917
- "bytesInOutput": 6092
921
+ "bytesInOutput": 6819
918
922
  },
919
923
  "front_end/models/trace/helpers/Trace.ts": {
920
- "bytesInOutput": 3224
924
+ "bytesInOutput": 3593
925
+ },
926
+ "front_end/models/trace/helpers/TreeHelpers.ts": {
927
+ "bytesInOutput": 3478
921
928
  },
922
929
  "front_end/models/trace/handlers/LayoutShiftsHandler.ts": {
923
930
  "bytesInOutput": 10663
924
931
  },
925
932
  "front_end/models/trace/handlers/PageLoadMetricsHandler.ts": {
926
- "bytesInOutput": 15090
933
+ "bytesInOutput": 14866
927
934
  },
928
935
  "front_end/models/trace/handlers/ScreenshotsHandler.ts": {
929
- "bytesInOutput": 951
936
+ "bytesInOutput": 893
930
937
  },
931
938
  "front_end/models/trace/handlers/MemoryHandler.ts": {
932
939
  "bytesInOutput": 670
@@ -935,10 +942,10 @@
935
942
  "bytesInOutput": 11039
936
943
  },
937
944
  "front_end/models/trace/handlers/UserInteractionsHandler.ts": {
938
- "bytesInOutput": 4867
945
+ "bytesInOutput": 4873
939
946
  },
940
947
  "front_end/models/trace/handlers/UserTimingsHandler.ts": {
941
- "bytesInOutput": 4077
948
+ "bytesInOutput": 4079
942
949
  },
943
950
  "front_end/models/trace/handlers/WarningsHandler.ts": {
944
951
  "bytesInOutput": 2301
@@ -949,9 +956,6 @@
949
956
  "front_end/models/trace/handlers/ModelHandlers.ts": {
950
957
  "bytesInOutput": 889
951
958
  },
952
- "front_end/models/trace/handlers/AuctionWorkletsHandler.ts": {
953
- "bytesInOutput": 3327
954
- },
955
959
  "front_end/models/trace/handlers/LargestImagePaintHandler.ts": {
956
960
  "bytesInOutput": 558
957
961
  },
@@ -959,31 +963,34 @@
959
963
  "bytesInOutput": 571
960
964
  },
961
965
  "front_end/models/trace/handlers/RendererHandler.ts": {
962
- "bytesInOutput": 10383
966
+ "bytesInOutput": 8247
963
967
  },
964
968
  "front_end/models/trace/handlers/SamplesHandler.ts": {
965
- "bytesInOutput": 5994
969
+ "bytesInOutput": 7339
966
970
  },
967
971
  "front_end/models/cpu_profile/CPUProfileDataModel.ts": {
968
- "bytesInOutput": 13716
972
+ "bytesInOutput": 13325
969
973
  },
970
974
  "front_end/models/cpu_profile/ProfileTreeModel.ts": {
971
975
  "bytesInOutput": 2035
972
976
  },
977
+ "front_end/models/trace/handlers/Threads.ts": {
978
+ "bytesInOutput": 2318
979
+ },
973
980
  "front_end/models/trace/LegacyTracingModel.ts": {
974
981
  "bytesInOutput": 21338
975
982
  },
976
983
  "front_end/models/trace/ModelImpl.ts": {
977
- "bytesInOutput": 4038
984
+ "bytesInOutput": 4050
978
985
  },
979
986
  "front_end/models/trace/Processor.ts": {
980
- "bytesInOutput": 6189
987
+ "bytesInOutput": 6084
981
988
  },
982
989
  "front_end/models/trace/TreeManipulator.ts": {
983
- "bytesInOutput": 2786
990
+ "bytesInOutput": 2678
984
991
  }
985
992
  },
986
- "bytes": 203836
993
+ "bytes": 199267
987
994
  }
988
995
  }
989
996
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paulirish/trace_engine",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "",
5
5
  "main": "trace.mjs",
6
6
  "scripts": {