@paulirish/trace_engine 0.0.7 → 0.0.8

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/analyze-trace.mjs CHANGED
@@ -9,16 +9,21 @@
9
9
  import fs from 'node:fs';
10
10
  import zlib from 'node:zlib';
11
11
 
12
- /** @type {import('../front_end/models/trace/trace.ts').TraceModel} */
13
- import * as TraceModel from './trace.mjs';
12
+ /** @typedef {import('../front_end/models/trace/trace.ts')} TraceEngine */
13
+
14
+ /** @type {TraceEngine} */
15
+ import * as TraceEngine from './trace.mjs';
14
16
 
15
17
  polyfillDOMRect();
16
18
 
19
+ /**
20
+ * @param {string} filename
21
+ * @returns {Promise<TraceEngine.TraceModel>}
22
+ */
17
23
  export async function analyzeTrace(filename) {
18
24
  const traceEvents = loadTraceEventsFromFile(filename);
19
25
 
20
- /** @type {import('../front_end/models/trace/trace.ts').Processor.TraceProcessor} */
21
- const processor = TraceModel.Processor.TraceProcessor.createWithAllHandlers(); // aka `fullTraceEngine`
26
+ const processor = TraceEngine.Processor.TraceProcessor.createWithAllHandlers(TraceEngine.Types.Configuration.DEFAULT); // aka `fullTraceEngine`
22
27
  await processor.parse(traceEvents);
23
28
  return processor.data;
24
29
  }
@@ -30,8 +35,8 @@ if (import.meta.url.endsWith(process?.argv[1])) {
30
35
 
31
36
  async function cli() {
32
37
  const filename = process.argv.at(2);
33
- const traceModel = await analyzeTrace(filename);
34
- console.log(traceModel);
38
+ const TraceEngine = await analyzeTrace(filename);
39
+ console.log(TraceEngine);
35
40
  }
36
41
 
37
42
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paulirish/trace_engine",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "",
5
5
  "main": "trace.mjs",
6
6
  "scripts": {
@@ -5,12 +5,9 @@
5
5
  import test from 'node:test';
6
6
  import {strict as assert} from 'assert';
7
7
 
8
- /** @typedef {import('../../front_end/models/trace/Processor.js').TraceProcessor['data'] } TraceModel */
9
-
10
8
  import {analyzeTrace} from '../analyze-trace.mjs';
11
9
 
12
10
  const filename = './test/invalid-animation-events.json.gz';
13
- /** @type {TraceModel} */
14
11
  const data = await analyzeTrace(filename);
15
12
 
16
13
  test('key values are populated', t => {