@paulirish/trace_engine 0.0.3 → 0.0.4

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
 
@@ -27,8 +28,6 @@ See the included `analyze-trace.mjs` a runnable invocation and quick polyfills.
27
28
  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
- madge front_end/models/trace/trace.ts --image tracearch.png --layout dot --exclude="(localized-string-set\/)|(stack-packs\/packs)"
32
31
  ```
33
32
 
34
33
  ## 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": 1066,
134
134
  "imports": []
135
135
  },
136
136
  "front_end/models/trace/types/File.ts": {
@@ -142,7 +142,7 @@
142
142
  "imports": []
143
143
  },
144
144
  "front_end/models/trace/types/TraceEvents.ts": {
145
- "bytes": 47061,
145
+ "bytes": 47296,
146
146
  "imports": []
147
147
  },
148
148
  "front_end/models/trace/types/types.ts": {
@@ -204,26 +204,8 @@
204
204
  }
205
205
  ]
206
206
  },
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,
218
- "imports": [
219
- {
220
- "path": "front_end/core/root/Runtime.ts",
221
- "kind": "import-statement"
222
- }
223
- ]
224
- },
225
207
  "front_end/models/trace/helpers/Trace.ts": {
226
- "bytes": 4859,
208
+ "bytes": 4913,
227
209
  "imports": [
228
210
  {
229
211
  "path": "front_end/core/platform/platform.ts",
@@ -232,7 +214,7 @@
232
214
  ]
233
215
  },
234
216
  "front_end/models/trace/helpers/Timing.ts": {
235
- "bytes": 7545,
217
+ "bytes": 8073,
236
218
  "imports": [
237
219
  {
238
220
  "path": "front_end/core/platform/platform.ts",
@@ -249,12 +231,8 @@
249
231
  ]
250
232
  },
251
233
  "front_end/models/trace/helpers/SamplesIntegrator.ts": {
252
- "bytes": 19670,
234
+ "bytes": 17885,
253
235
  "imports": [
254
- {
255
- "path": "front_end/core/root/root.ts",
256
- "kind": "import-statement"
257
- },
258
236
  {
259
237
  "path": "front_end/models/trace/types/types.ts",
260
238
  "kind": "import-statement"
@@ -565,7 +543,7 @@
565
543
  "imports": []
566
544
  },
567
545
  "front_end/models/cpu_profile/CPUProfileDataModel.ts": {
568
- "bytes": 21496,
546
+ "bytes": 21031,
569
547
  "imports": [
570
548
  {
571
549
  "path": "front_end/core/platform/platform.ts",
@@ -591,32 +569,32 @@
591
569
  ]
592
570
  },
593
571
  "front_end/models/trace/handlers/SamplesHandler.ts": {
594
- "bytes": 8878,
572
+ "bytes": 8996,
595
573
  "imports": [
596
574
  {
597
575
  "path": "front_end/core/platform/platform.ts",
598
576
  "kind": "import-statement"
599
577
  },
600
578
  {
601
- "path": "front_end/models/trace/types/types.ts",
579
+ "path": "front_end/models/cpu_profile/cpu_profile.ts",
602
580
  "kind": "import-statement"
603
581
  },
604
582
  {
605
- "path": "front_end/models/trace/handlers/types.ts",
583
+ "path": "front_end/models/trace/helpers/helpers.ts",
606
584
  "kind": "import-statement"
607
585
  },
608
586
  {
609
- "path": "front_end/models/cpu_profile/cpu_profile.ts",
587
+ "path": "front_end/models/trace/types/types.ts",
610
588
  "kind": "import-statement"
611
589
  },
612
590
  {
613
- "path": "front_end/models/trace/helpers/helpers.ts",
591
+ "path": "front_end/models/trace/handlers/types.ts",
614
592
  "kind": "import-statement"
615
593
  }
616
594
  ]
617
595
  },
618
596
  "front_end/models/trace/handlers/RendererHandler.ts": {
619
- "bytes": 20741,
597
+ "bytes": 20659,
620
598
  "imports": [
621
599
  {
622
600
  "path": "front_end/core/platform/platform.ts",
@@ -748,7 +726,7 @@
748
726
  ]
749
727
  },
750
728
  "front_end/models/trace/Processor.ts": {
751
- "bytes": 9785,
729
+ "bytes": 9649,
752
730
  "imports": [
753
731
  {
754
732
  "path": "front_end/models/trace/handlers/handlers.ts",
@@ -761,7 +739,7 @@
761
739
  ]
762
740
  },
763
741
  "front_end/models/trace/ModelImpl.ts": {
764
- "bytes": 9591,
742
+ "bytes": 9537,
765
743
  "imports": [
766
744
  {
767
745
  "path": "front_end/core/platform/platform.ts",
@@ -786,7 +764,7 @@
786
764
  ]
787
765
  },
788
766
  "front_end/models/trace/TreeManipulator.ts": {
789
- "bytes": 7648,
767
+ "bytes": 7398,
790
768
  "imports": [
791
769
  {
792
770
  "path": "front_end/core/platform/platform.ts",
@@ -833,7 +811,7 @@
833
811
  "imports": [],
834
812
  "exports": [],
835
813
  "inputs": {},
836
- "bytes": 455547
814
+ "bytes": 434352
837
815
  },
838
816
  "out/Default/gen/trace_engine/trace.mjs": {
839
817
  "imports": [],
@@ -865,9 +843,6 @@
865
843
  "front_end/core/platform/array-utilities.ts": {
866
844
  "bytesInOutput": 5200
867
845
  },
868
- "front_end/core/platform/DevToolsPath.ts": {
869
- "bytesInOutput": 298
870
- },
871
846
  "front_end/core/platform/map-utilities.ts": {
872
847
  "bytesInOutput": 1553
873
848
  },
@@ -878,13 +853,13 @@
878
853
  "bytesInOutput": 68
879
854
  },
880
855
  "front_end/core/platform/platform.ts": {
881
- "bytesInOutput": 133
856
+ "bytesInOutput": 0
882
857
  },
883
858
  "front_end/models/trace/types/types.ts": {
884
859
  "bytesInOutput": 202
885
860
  },
886
861
  "front_end/models/trace/types/Configuration.ts": {
887
- "bytesInOutput": 174
862
+ "bytesInOutput": 291
888
863
  },
889
864
  "front_end/models/trace/types/File.ts": {
890
865
  "bytesInOutput": 270
@@ -893,7 +868,7 @@
893
868
  "bytesInOutput": 638
894
869
  },
895
870
  "front_end/models/trace/types/TraceEvents.ts": {
896
- "bytesInOutput": 23387
871
+ "bytesInOutput": 23532
897
872
  },
898
873
  "front_end/models/trace/handlers/types.ts": {
899
874
  "bytesInOutput": 397
@@ -908,13 +883,10 @@
908
883
  "bytesInOutput": 174
909
884
  },
910
885
  "front_end/models/trace/helpers/SamplesIntegrator.ts": {
911
- "bytesInOutput": 9518
912
- },
913
- "front_end/core/root/Runtime.ts": {
914
- "bytesInOutput": 9442
886
+ "bytesInOutput": 8645
915
887
  },
916
888
  "front_end/models/trace/helpers/Timing.ts": {
917
- "bytesInOutput": 6092
889
+ "bytesInOutput": 6177
918
890
  },
919
891
  "front_end/models/trace/helpers/Trace.ts": {
920
892
  "bytesInOutput": 3224
@@ -959,13 +931,13 @@
959
931
  "bytesInOutput": 571
960
932
  },
961
933
  "front_end/models/trace/handlers/RendererHandler.ts": {
962
- "bytesInOutput": 10383
934
+ "bytesInOutput": 10283
963
935
  },
964
936
  "front_end/models/trace/handlers/SamplesHandler.ts": {
965
- "bytesInOutput": 5994
937
+ "bytesInOutput": 6110
966
938
  },
967
939
  "front_end/models/cpu_profile/CPUProfileDataModel.ts": {
968
- "bytesInOutput": 13716
940
+ "bytesInOutput": 13325
969
941
  },
970
942
  "front_end/models/cpu_profile/ProfileTreeModel.ts": {
971
943
  "bytesInOutput": 2035
@@ -974,16 +946,16 @@
974
946
  "bytesInOutput": 21338
975
947
  },
976
948
  "front_end/models/trace/ModelImpl.ts": {
977
- "bytesInOutput": 4038
949
+ "bytesInOutput": 4034
978
950
  },
979
951
  "front_end/models/trace/Processor.ts": {
980
- "bytesInOutput": 6189
952
+ "bytesInOutput": 6084
981
953
  },
982
954
  "front_end/models/trace/TreeManipulator.ts": {
983
- "bytesInOutput": 2786
955
+ "bytesInOutput": 2678
984
956
  }
985
957
  },
986
- "bytes": 203836
958
+ "bytes": 192726
987
959
  }
988
960
  }
989
961
  }
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.4",
4
4
  "description": "",
5
5
  "main": "trace.mjs",
6
6
  "scripts": {