@paulirish/trace_engine 0.0.26 → 0.0.28

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.
Files changed (92) hide show
  1. package/models/trace/LanternComputationData.d.ts +4 -4
  2. package/models/trace/LanternComputationData.js +4 -4
  3. package/models/trace/LanternComputationData.js.map +1 -1
  4. package/models/trace/lantern/core/LanternError.d.ts +3 -0
  5. package/models/trace/lantern/core/LanternError.js +7 -0
  6. package/models/trace/lantern/core/LanternError.js.map +1 -0
  7. package/models/trace/lantern/core/NetworkAnalyzer.d.ts +112 -0
  8. package/models/trace/lantern/core/NetworkAnalyzer.js +486 -0
  9. package/models/trace/lantern/core/NetworkAnalyzer.js.map +1 -0
  10. package/models/trace/lantern/core/bundle-tsconfig.json +1 -0
  11. package/models/trace/lantern/core/core-tsconfig.json +43 -0
  12. package/models/trace/lantern/core/core.d.ts +2 -0
  13. package/models/trace/lantern/core/core.js +6 -0
  14. package/models/trace/lantern/core/core.js.map +1 -0
  15. package/models/trace/lantern/core/devtools_entrypoint-bundle-typescript-tsconfig.json +42 -0
  16. package/models/trace/lantern/graph/BaseNode.d.ts +91 -0
  17. package/models/trace/lantern/graph/BaseNode.js +268 -0
  18. package/models/trace/lantern/graph/BaseNode.js.map +1 -0
  19. package/models/trace/lantern/graph/CPUNode.d.ts +24 -0
  20. package/models/trace/lantern/graph/CPUNode.js +64 -0
  21. package/models/trace/lantern/graph/CPUNode.js.map +1 -0
  22. package/models/trace/lantern/graph/NetworkNode.d.ts +22 -0
  23. package/models/trace/lantern/graph/NetworkNode.js +83 -0
  24. package/models/trace/lantern/graph/NetworkNode.js.map +1 -0
  25. package/models/trace/lantern/graph/PageDependencyGraph.d.ts +43 -0
  26. package/models/trace/lantern/graph/PageDependencyGraph.js +509 -0
  27. package/models/trace/lantern/graph/PageDependencyGraph.js.map +1 -0
  28. package/models/trace/lantern/graph/bundle-tsconfig.json +1 -0
  29. package/models/trace/lantern/graph/devtools_entrypoint-bundle-typescript-tsconfig.json +42 -0
  30. package/models/trace/lantern/graph/graph-tsconfig.json +48 -0
  31. package/models/trace/lantern/graph/graph.d.ts +4 -0
  32. package/models/trace/lantern/graph/graph.js +8 -0
  33. package/models/trace/lantern/graph/graph.js.map +1 -0
  34. package/models/trace/lantern/lantern-tsconfig.json +13 -24
  35. package/models/trace/lantern/lantern.d.ts +6 -29
  36. package/models/trace/lantern/lantern.js +6 -29
  37. package/models/trace/lantern/lantern.js.map +1 -1
  38. package/models/trace/lantern/metrics/FirstContentfulPaint.d.ts +10 -12
  39. package/models/trace/lantern/metrics/FirstContentfulPaint.js +3 -3
  40. package/models/trace/lantern/metrics/FirstContentfulPaint.js.map +1 -1
  41. package/models/trace/lantern/metrics/Interactive.d.ts +9 -9
  42. package/models/trace/lantern/metrics/Interactive.js +4 -5
  43. package/models/trace/lantern/metrics/Interactive.js.map +1 -1
  44. package/models/trace/lantern/metrics/LargestContentfulPaint.d.ts +10 -9
  45. package/models/trace/lantern/metrics/LargestContentfulPaint.js +4 -5
  46. package/models/trace/lantern/metrics/LargestContentfulPaint.js.map +1 -1
  47. package/models/trace/lantern/metrics/MaxPotentialFID.d.ts +9 -9
  48. package/models/trace/lantern/metrics/MaxPotentialFID.js +3 -4
  49. package/models/trace/lantern/metrics/MaxPotentialFID.js.map +1 -1
  50. package/models/trace/lantern/metrics/Metric.d.ts +31 -13
  51. package/models/trace/lantern/metrics/Metric.js +2 -3
  52. package/models/trace/lantern/metrics/Metric.js.map +1 -1
  53. package/models/trace/lantern/metrics/SpeedIndex.d.ts +10 -10
  54. package/models/trace/lantern/metrics/SpeedIndex.js +3 -4
  55. package/models/trace/lantern/metrics/SpeedIndex.js.map +1 -1
  56. package/models/trace/lantern/metrics/TotalBlockingTime.d.ts +9 -9
  57. package/models/trace/lantern/metrics/TotalBlockingTime.js +3 -4
  58. package/models/trace/lantern/metrics/TotalBlockingTime.js.map +1 -1
  59. package/models/trace/lantern/metrics/bundle-tsconfig.json +1 -0
  60. package/models/trace/lantern/metrics/devtools_entrypoint-bundle-typescript-tsconfig.json +42 -0
  61. package/models/trace/lantern/metrics/metrics-tsconfig.json +58 -0
  62. package/models/trace/lantern/metrics/metrics.d.ts +7 -14
  63. package/models/trace/lantern/metrics/metrics.js +7 -7
  64. package/models/trace/lantern/metrics/metrics.js.map +1 -1
  65. package/models/trace/lantern/simulation/ConnectionPool.d.ts +1 -1
  66. package/models/trace/lantern/simulation/ConnectionPool.js +3 -3
  67. package/models/trace/lantern/simulation/ConnectionPool.js.map +1 -1
  68. package/models/trace/lantern/simulation/DNSCache.d.ts +1 -1
  69. package/models/trace/lantern/simulation/DNSCache.js.map +1 -1
  70. package/models/trace/lantern/simulation/SimulationTimingMap.d.ts +15 -17
  71. package/models/trace/lantern/simulation/SimulationTimingMap.js +2 -2
  72. package/models/trace/lantern/simulation/SimulationTimingMap.js.map +1 -1
  73. package/models/trace/lantern/simulation/Simulator.d.ts +24 -22
  74. package/models/trace/lantern/simulation/Simulator.js +10 -10
  75. package/models/trace/lantern/simulation/Simulator.js.map +1 -1
  76. package/models/trace/lantern/simulation/bundle-tsconfig.json +1 -0
  77. package/models/trace/lantern/simulation/devtools_entrypoint-bundle-typescript-tsconfig.json +42 -0
  78. package/models/trace/lantern/simulation/simulation-tsconfig.json +50 -0
  79. package/models/trace/lantern/simulation/simulation.d.ts +6 -21
  80. package/models/trace/lantern/simulation/simulation.js +6 -7
  81. package/models/trace/lantern/simulation/simulation.js.map +1 -1
  82. package/models/trace/lantern/types/{lantern.d.ts → Lantern.d.ts} +21 -27
  83. package/models/trace/lantern/types/Lantern.js +24 -0
  84. package/models/trace/lantern/types/Lantern.js.map +1 -0
  85. package/models/trace/lantern/types/bundle-tsconfig.json +1 -0
  86. package/models/trace/lantern/types/devtools_entrypoint-bundle-typescript-tsconfig.json +42 -0
  87. package/models/trace/lantern/types/types-tsconfig.json +42 -0
  88. package/models/trace/lantern/types/types.d.ts +1 -0
  89. package/models/trace/lantern/types/{lantern.js → types.js} +2 -2
  90. package/models/trace/lantern/types/types.js.map +1 -0
  91. package/package.json +1 -1
  92. package/models/trace/lantern/types/lantern.js.map +0 -1
@@ -1,21 +1,6 @@
1
- /**
2
- * @license
3
- * Copyright 2024 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { type AnyNetworkObject, type Simulation } from '../types/lantern.js';
7
- export { ConnectionPool } from './ConnectionPool.js';
8
- export { Constants } from './Constants.js';
9
- export { DNSCache } from './DNSCache.js';
10
- export { NetworkAnalyzer } from './NetworkAnalyzer.js';
11
- export { SimulatorTimingMap, type CompleteNodeTiming } from './SimulationTimingMap.js';
12
- export { Simulator } from './Simulator.js';
13
- export { TCPConnection } from './TCPConnection.js';
14
- export type MetricCoefficients = Simulation.MetricCoefficients;
15
- export type MetricComputationDataInput = Simulation.MetricComputationDataInput;
16
- export type NodeTiming = Simulation.NodeTiming;
17
- export type Options = Simulation.Options;
18
- export type ProcessedNavigation = Simulation.ProcessedNavigation;
19
- export type Result<T = AnyNetworkObject> = Simulation.Result<T>;
20
- export type Settings = Simulation.Settings;
21
- export type URL = Simulation.URL;
1
+ export * from './ConnectionPool.js';
2
+ export * from './Constants.js';
3
+ export * from './DNSCache.js';
4
+ export * from './SimulationTimingMap.js';
5
+ export * from './Simulator.js';
6
+ export * from './TCPConnection.js';
@@ -1,11 +1,10 @@
1
1
  // Copyright 2024 The Chromium Authors. All rights reserved.
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
- export { ConnectionPool } from './ConnectionPool.js';
5
- export { Constants } from './Constants.js';
6
- export { DNSCache } from './DNSCache.js';
7
- export { NetworkAnalyzer } from './NetworkAnalyzer.js';
8
- export { SimulatorTimingMap } from './SimulationTimingMap.js';
9
- export { Simulator } from './Simulator.js';
10
- export { TCPConnection } from './TCPConnection.js';
4
+ export * from './ConnectionPool.js';
5
+ export * from './Constants.js';
6
+ export * from './DNSCache.js';
7
+ export * from './SimulationTimingMap.js';
8
+ export * from './Simulator.js';
9
+ export * from './TCPConnection.js';
11
10
  //# sourceMappingURL=simulation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"simulation.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/simulation/simulation.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAU7B,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AACvC,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAC,kBAAkB,EAA0B,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {type AnyNetworkObject, type Simulation} from '../types/lantern.js';\n\nexport {ConnectionPool} from './ConnectionPool.js';\nexport {Constants} from './Constants.js';\nexport {DNSCache} from './DNSCache.js';\nexport {NetworkAnalyzer} from './NetworkAnalyzer.js';\nexport {SimulatorTimingMap, type CompleteNodeTiming} from './SimulationTimingMap.js';\nexport {Simulator} from './Simulator.js';\nexport {TCPConnection} from './TCPConnection.js';\n\nexport type MetricCoefficients = Simulation.MetricCoefficients;\nexport type MetricComputationDataInput = Simulation.MetricComputationDataInput;\nexport type NodeTiming = Simulation.NodeTiming;\nexport type Options = Simulation.Options;\nexport type ProcessedNavigation = Simulation.ProcessedNavigation;\nexport type Result<T = AnyNetworkObject> = Simulation.Result<T>;\nexport type Settings = Simulation.Settings;\nexport type URL = Simulation.URL;\n"]}
1
+ {"version":3,"file":"simulation.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/simulation/simulation.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nexport * from './ConnectionPool.js';\nexport * from './Constants.js';\nexport * from './DNSCache.js';\nexport * from './SimulationTimingMap.js';\nexport * from './Simulator.js';\nexport * from './TCPConnection.js';\n"]}
@@ -1,6 +1,24 @@
1
1
  import type * as Protocol from '../../../../generated/protocol.js';
2
- import { type Node } from '../BaseNode.js';
3
- import { type Simulator } from '../simulation/Simulator.js';
2
+ export declare const NetworkRequestTypes: {
3
+ readonly XHR: "XHR";
4
+ readonly Fetch: "Fetch";
5
+ readonly EventSource: "EventSource";
6
+ readonly Script: "Script";
7
+ readonly Stylesheet: "Stylesheet";
8
+ readonly Image: "Image";
9
+ readonly Media: "Media";
10
+ readonly Font: "Font";
11
+ readonly Document: "Document";
12
+ readonly TextTrack: "TextTrack";
13
+ readonly WebSocket: "WebSocket";
14
+ readonly Other: "Other";
15
+ readonly Manifest: "Manifest";
16
+ readonly SignedExchange: "SignedExchange";
17
+ readonly Ping: "Ping";
18
+ readonly Preflight: "Preflight";
19
+ readonly CSPViolationReport: "CSPViolationReport";
20
+ readonly Prefetch: "Prefetch";
21
+ };
4
22
  export type TraceEvent = {
5
23
  name: string;
6
24
  args: {
@@ -24,7 +42,7 @@ export type Trace = {
24
42
  traceEvents: TraceEvent[];
25
43
  };
26
44
  export type ResourcePriority = ('VeryLow' | 'Low' | 'Medium' | 'High' | 'VeryHigh');
27
- export type ResourceType = ('Document' | 'Stylesheet' | 'Image' | 'Media' | 'Font' | 'Script' | 'TextTrack' | 'XHR' | 'Fetch' | 'Prefetch' | 'EventSource' | 'WebSocket' | 'Manifest' | 'SignedExchange' | 'Ping' | 'CSPViolationReport' | 'Preflight' | 'Other');
45
+ export type ResourceType = keyof typeof NetworkRequestTypes;
28
46
  type InitiatorType = ('parser' | 'script' | 'preload' | 'SignedExchange' | 'preflight' | 'other');
29
47
  export type ResourceTiming = Protocol.Network.ResourceTiming;
30
48
  type CallStack = {
@@ -172,34 +190,10 @@ export declare namespace Simulation {
172
190
  largestContentfulPaint?: number;
173
191
  };
174
192
  }
175
- interface MetricComputationDataInput {
176
- simulator: Simulator;
177
- graph: Node<unknown>;
178
- processedNavigation: ProcessedNavigation;
179
- }
180
- interface MetricCoefficients {
181
- intercept: number;
182
- optimistic: number;
183
- pessimistic: number;
184
- }
185
193
  interface NodeTiming {
186
194
  startTime: number;
187
195
  endTime: number;
188
196
  duration: number;
189
197
  }
190
- interface Result<T = AnyNetworkObject> {
191
- timeInMs: number;
192
- nodeTimings: Map<Node<T>, NodeTiming>;
193
- }
194
- }
195
- export declare namespace Metrics {
196
- interface Result<T = AnyNetworkObject> {
197
- timing: number;
198
- timestamp?: never;
199
- optimisticEstimate: Simulation.Result<T>;
200
- pessimisticEstimate: Simulation.Result<T>;
201
- optimisticGraph: Node<T>;
202
- pessimisticGraph: Node<T>;
203
- }
204
198
  }
205
199
  export {};
@@ -0,0 +1,24 @@
1
+ // Copyright 2024 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+ export const NetworkRequestTypes = {
5
+ XHR: 'XHR',
6
+ Fetch: 'Fetch',
7
+ EventSource: 'EventSource',
8
+ Script: 'Script',
9
+ Stylesheet: 'Stylesheet',
10
+ Image: 'Image',
11
+ Media: 'Media',
12
+ Font: 'Font',
13
+ Document: 'Document',
14
+ TextTrack: 'TextTrack',
15
+ WebSocket: 'WebSocket',
16
+ Other: 'Other',
17
+ Manifest: 'Manifest',
18
+ SignedExchange: 'SignedExchange',
19
+ Ping: 'Ping',
20
+ Preflight: 'Preflight',
21
+ CSPViolationReport: 'CSPViolationReport',
22
+ Prefetch: 'Prefetch',
23
+ };
24
+ //# sourceMappingURL=Lantern.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Lantern.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/types/Lantern.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAI7B,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;IAC1B,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,YAAY;IACxB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,cAAc,EAAE,gBAAgB;IAChC,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,WAAW;IACtB,kBAAkB,EAAE,oBAAoB;IACxC,QAAQ,EAAE,UAAU;CACZ,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport type * as Protocol from '../../../../generated/protocol.js';\n\nexport const NetworkRequestTypes = {\n XHR: 'XHR',\n Fetch: 'Fetch',\n EventSource: 'EventSource',\n Script: 'Script',\n Stylesheet: 'Stylesheet',\n Image: 'Image',\n Media: 'Media',\n Font: 'Font',\n Document: 'Document',\n TextTrack: 'TextTrack',\n WebSocket: 'WebSocket',\n Other: 'Other',\n Manifest: 'Manifest',\n SignedExchange: 'SignedExchange',\n Ping: 'Ping',\n Preflight: 'Preflight',\n CSPViolationReport: 'CSPViolationReport',\n Prefetch: 'Prefetch',\n} as const;\n\nexport type TraceEvent = {\n name: string,\n args: {\n name?: string,\n data?: {\n frame?: string,\n readyState?: number,\n stackTrace?: {\n url: string,\n }[],\n url?: string,\n },\n },\n pid: number,\n tid: number,\n /** Timestamp of the event in microseconds. */\n ts: number,\n dur: number,\n};\nexport type Trace = {\n traceEvents: TraceEvent[],\n};\nexport type ResourcePriority = ('VeryLow'|'Low'|'Medium'|'High'|'VeryHigh');\nexport type ResourceType = keyof typeof NetworkRequestTypes;\ntype InitiatorType = ('parser'|'script'|'preload'|'SignedExchange'|'preflight'|'other');\nexport type ResourceTiming = Protocol.Network.ResourceTiming;\ntype CallStack = {\n callFrames: Array<{\n scriptId: string,\n url: string,\n lineNumber: number,\n columnNumber: number,\n functionName: string,\n }>,\n parent?: CallStack,\n};\n\nexport type ParsedURL = {\n /**\n * Equivalent to a `new URL(url).protocol` BUT w/o the trailing colon (:)\n */\n scheme: string,\n /**\n * Equivalent to a `new URL(url).hostname`\n */\n host: string,\n securityOrigin: string,\n};\n\n// When Lantern NetworkRequests are constructed, the source-of-truth of the network record is given as `rawRequest`.\n// Internally Lantern doesn't care about the type of this field, so a default type is given to simplify internal code\n// by avoiding unnecessary typescript overhead.\n// If callers want to access the underlying network record, they are expected to make use of this generic on top-level\n// interfaces like Simulator.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyNetworkObject = any;\n\nexport type NetworkRequest<T = AnyNetworkObject> = {\n requestId: string,\n connectionId: number,\n connectionReused: boolean,\n url: string,\n protocol: string,\n parsedURL: ParsedURL,\n documentURL: string,\n /** When the renderer process initially discovers a network request, in milliseconds. */\n rendererStartTime: number,\n /**\n * When the network service is about to handle a request, ie. just before going to the\n * HTTP cache or going to the network for DNS/connection setup, in milliseconds.\n */\n networkRequestTime: number,\n /**\n * When the last byte of the response headers is received, in milliseconds.\n * Equal to networkRequestTime if no data is recieved over the\n * network (ex: cached requests or data urls).\n */\n responseHeadersEndTime: number,\n /** When the last byte of the response body is received, in milliseconds. */\n networkEndTime: number,\n transferSize: number,\n resourceSize: number,\n fromDiskCache: boolean,\n fromMemoryCache: boolean,\n isLinkPreload: boolean,\n finished: boolean,\n failed: boolean,\n statusCode: number,\n /** The network request that redirected to this one */\n redirectSource: NetworkRequest<T>|undefined,\n /** The network request that this one redirected to */\n redirectDestination: NetworkRequest<T>|undefined,\n // TODO: can't use Protocol.Network.Initiator because of type mismatch in Lighthouse initiator.\n initiator: {\n type: InitiatorType,\n url?: string,\n stack?: CallStack,\n },\n initiatorRequest: NetworkRequest<T>|undefined,\n /** The chain of network requests that redirected to this one */\n redirects: NetworkRequest[]|undefined,\n timing: Protocol.Network.ResourceTiming|undefined,\n resourceType: ResourceType|undefined,\n mimeType: string,\n priority: ResourcePriority,\n frameId: string|undefined,\n fromWorker: boolean,\n /**\n * Optional value for how long the server took to respond to this request.\n * When not provided, the server response time is derived from the timing object.\n */\n serverResponseTime?: number,\n /**\n * Implementation-specific canoncial data structure that this Lantern NetworkRequest\n * was derived from.\n * Users of Lantern create a NetworkRequest matching this interface,\n * but can store the source-of-truth for their network model in this property.\n * This is then accessible as a read-only property on NetworkNode.\n */\n rawRequest?: T,\n};\n\nexport namespace Simulation {\n export interface URL {\n /** URL of the initially requested URL */\n requestedUrl?: string;\n /** URL of the last document request */\n mainDocumentUrl?: string;\n }\n\n /** Simulation settings that control the amount of network & cpu throttling in the run. */\n export interface ThrottlingSettings {\n /** The round trip time in milliseconds. */\n rttMs?: number;\n /** The network throughput in kilobits per second. */\n throughputKbps?: number;\n // devtools settings\n /** The network request latency in milliseconds. */\n requestLatencyMs?: number;\n /** The network download throughput in kilobits per second. */\n downloadThroughputKbps?: number;\n /** The network upload throughput in kilobits per second. */\n uploadThroughputKbps?: number;\n // used by both\n /** The amount of slowdown applied to the cpu (1/<cpuSlowdownMultiplier>). */\n cpuSlowdownMultiplier?: number;\n }\n\n export interface PrecomputedLanternData {\n additionalRttByOrigin: {[origin: string]: number};\n serverResponseTimeByOrigin: {[origin: string]: number};\n }\n\n export interface Settings {\n networkAnalysis: {\n rtt: number,\n additionalRttByOrigin: Map<string, number>,\n serverResponseTimeByOrigin: Map<string, number>,\n throughput: number,\n };\n /** The method used to throttle the network. */\n throttlingMethod: 'devtools'|'simulate'|'provided';\n /** The throttling config settings. */\n throttling: Required<ThrottlingSettings>;\n /** Precomputed lantern estimates to use instead of observed analysis. */\n precomputedLanternData?: PrecomputedLanternData|null;\n }\n\n export interface Options {\n rtt?: number;\n throughput?: number;\n observedThroughput: number;\n maximumConcurrentRequests?: number;\n cpuSlowdownMultiplier?: number;\n layoutTaskMultiplier?: number;\n additionalRttByOrigin?: Map<string, number>;\n serverResponseTimeByOrigin?: Map<string, number>;\n }\n\n export interface ProcessedNavigation {\n timestamps: {\n firstContentfulPaint: number,\n largestContentfulPaint?: number,\n };\n }\n\n export interface NodeTiming {\n startTime: number;\n endTime: number;\n duration: number;\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"compilerOptions":{"composite":true,"outDir":".","baseUrl":".","rootDir":"../../../../../../../../front_end/models/trace/lantern/types"},"files":["../../../../../../../../front_end/models/trace/lantern/types/types.ts"],"references":[{"path":"./types-tsconfig.json"}]}
@@ -0,0 +1,42 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": true,
4
+ "checkJs": true,
5
+ "composite": true,
6
+ "declaration": true,
7
+ "experimentalDecorators": true,
8
+ "forceConsistentCasingInFileNames": true,
9
+ "inlineSources": true,
10
+ "lib": [
11
+ "esnext",
12
+ "dom",
13
+ "dom.iterable"
14
+ ],
15
+ "module": "esnext",
16
+ "noEmitOnError": true,
17
+ "noFallthroughCasesInSwitch": true,
18
+ "noImplicitOverride": true,
19
+ "noImplicitReturns": true,
20
+ "noUnusedLocals": false,
21
+ "outDir": ".",
22
+ "rootDir": "../../../../../../../../front_end/models/trace/lantern/types",
23
+ "skipLibCheck": true,
24
+ "sourceMap": true,
25
+ "strict": true,
26
+ "target": "esnext",
27
+ "tsBuildInfoFile": "devtools_entrypoint-bundle-typescript-tsconfig.json.tsbuildinfo",
28
+ "typeRoots": [],
29
+ "useUnknownInCatchVariables": false
30
+ },
31
+ "files": [
32
+ "../../../../../../../../front_end/models/trace/lantern/types/types.ts",
33
+ "../../../../../../../../front_end/legacy/legacy-defs.d.ts",
34
+ "../../../../../../../../front_end/global_typings/global_defs.d.ts",
35
+ "../../../../../../../../node_modules/@types/filesystem/index.d.ts"
36
+ ],
37
+ "references": [
38
+ {
39
+ "path": "./types-tsconfig.json"
40
+ }
41
+ ]
42
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": true,
4
+ "checkJs": true,
5
+ "composite": true,
6
+ "declaration": true,
7
+ "experimentalDecorators": true,
8
+ "forceConsistentCasingInFileNames": true,
9
+ "inlineSources": true,
10
+ "lib": [
11
+ "esnext",
12
+ "dom",
13
+ "dom.iterable"
14
+ ],
15
+ "module": "esnext",
16
+ "noEmitOnError": true,
17
+ "noFallthroughCasesInSwitch": true,
18
+ "noImplicitOverride": true,
19
+ "noImplicitReturns": true,
20
+ "noUnusedLocals": false,
21
+ "outDir": ".",
22
+ "rootDir": "../../../../../../../../front_end/models/trace/lantern/types",
23
+ "skipLibCheck": true,
24
+ "sourceMap": true,
25
+ "strict": true,
26
+ "target": "esnext",
27
+ "tsBuildInfoFile": "types-tsconfig.json.tsbuildinfo",
28
+ "typeRoots": [],
29
+ "useUnknownInCatchVariables": false
30
+ },
31
+ "files": [
32
+ "../../../../../../../../front_end/models/trace/lantern/types/Lantern.ts",
33
+ "../../../../../../../../front_end/legacy/legacy-defs.d.ts",
34
+ "../../../../../../../../front_end/global_typings/global_defs.d.ts",
35
+ "../../../../../../../../node_modules/@types/filesystem/index.d.ts"
36
+ ],
37
+ "references": [
38
+ {
39
+ "path": "../../types/bundle-tsconfig.json"
40
+ }
41
+ ]
42
+ }
@@ -0,0 +1 @@
1
+ export * from './Lantern.js';
@@ -1,5 +1,5 @@
1
1
  // Copyright 2024 The Chromium Authors. All rights reserved.
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
- export {};
5
- //# sourceMappingURL=lantern.js.map
4
+ export * from './Lantern.js';
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/types/types.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,cAAc,cAAc,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nexport * from './Lantern.js';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paulirish/trace_engine",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "description": "",
5
5
  "main": "models/trace/trace.js",
6
6
  "scripts": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"lantern.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/types/lantern.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport type * as Protocol from '../../../../generated/protocol.js';\nimport {type Node} from '../BaseNode.js';\nimport {type Simulator} from '../simulation/Simulator.js';\n\nexport type TraceEvent = {\n name: string,\n args: {\n name?: string,\n data?: {\n frame?: string,\n readyState?: number,\n stackTrace?: {\n url: string,\n }[],\n url?: string,\n },\n },\n pid: number,\n tid: number,\n /** Timestamp of the event in microseconds. */\n ts: number,\n dur: number,\n};\nexport type Trace = {\n traceEvents: TraceEvent[],\n};\nexport type ResourcePriority = ('VeryLow'|'Low'|'Medium'|'High'|'VeryHigh');\nexport type ResourceType =\n ('Document'|'Stylesheet'|'Image'|'Media'|'Font'|'Script'|'TextTrack'|'XHR'|'Fetch'|'Prefetch'|'EventSource'|\n 'WebSocket'|'Manifest'|'SignedExchange'|'Ping'|'CSPViolationReport'|'Preflight'|'Other');\ntype InitiatorType = ('parser'|'script'|'preload'|'SignedExchange'|'preflight'|'other');\nexport type ResourceTiming = Protocol.Network.ResourceTiming;\ntype CallStack = {\n callFrames: Array<{\n scriptId: string,\n url: string,\n lineNumber: number,\n columnNumber: number,\n functionName: string,\n }>,\n parent?: CallStack,\n};\n\nexport type ParsedURL = {\n /**\n * Equivalent to a `new URL(url).protocol` BUT w/o the trailing colon (:)\n */\n scheme: string,\n /**\n * Equivalent to a `new URL(url).hostname`\n */\n host: string,\n securityOrigin: string,\n};\n\n// When Lantern NetworkRequests are constructed, the source-of-truth of the network record is given as `rawRequest`.\n// Internally Lantern doesn't care about the type of this field, so a default type is given to simplify internal code\n// by avoiding unnecessary typescript overhead.\n// If callers want to access the underlying network record, they are expected to make use of this generic on top-level\n// interfaces like Simulator.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyNetworkObject = any;\n\nexport type NetworkRequest<T = AnyNetworkObject> = {\n requestId: string,\n connectionId: number,\n connectionReused: boolean,\n url: string,\n protocol: string,\n parsedURL: ParsedURL,\n documentURL: string,\n /** When the renderer process initially discovers a network request, in milliseconds. */\n rendererStartTime: number,\n /**\n * When the network service is about to handle a request, ie. just before going to the\n * HTTP cache or going to the network for DNS/connection setup, in milliseconds.\n */\n networkRequestTime: number,\n /**\n * When the last byte of the response headers is received, in milliseconds.\n * Equal to networkRequestTime if no data is recieved over the\n * network (ex: cached requests or data urls).\n */\n responseHeadersEndTime: number,\n /** When the last byte of the response body is received, in milliseconds. */\n networkEndTime: number,\n transferSize: number,\n resourceSize: number,\n fromDiskCache: boolean,\n fromMemoryCache: boolean,\n isLinkPreload: boolean,\n finished: boolean,\n failed: boolean,\n statusCode: number,\n /** The network request that redirected to this one */\n redirectSource: NetworkRequest<T>|undefined,\n /** The network request that this one redirected to */\n redirectDestination: NetworkRequest<T>|undefined,\n // TODO: can't use Protocol.Network.Initiator because of type mismatch in Lighthouse initiator.\n initiator: {\n type: InitiatorType,\n url?: string,\n stack?: CallStack,\n },\n initiatorRequest: NetworkRequest<T>|undefined,\n /** The chain of network requests that redirected to this one */\n redirects: NetworkRequest[]|undefined,\n timing: Protocol.Network.ResourceTiming|undefined,\n resourceType: ResourceType|undefined,\n mimeType: string,\n priority: ResourcePriority,\n frameId: string|undefined,\n fromWorker: boolean,\n /**\n * Optional value for how long the server took to respond to this request.\n * When not provided, the server response time is derived from the timing object.\n */\n serverResponseTime?: number,\n /**\n * Implementation-specific canoncial data structure that this Lantern NetworkRequest\n * was derived from.\n * Users of Lantern create a NetworkRequest matching this interface,\n * but can store the source-of-truth for their network model in this property.\n * This is then accessible as a read-only property on NetworkNode.\n */\n rawRequest?: T,\n};\n\nexport namespace Simulation {\n export interface URL {\n /** URL of the initially requested URL */\n requestedUrl?: string;\n /** URL of the last document request */\n mainDocumentUrl?: string;\n }\n\n /** Simulation settings that control the amount of network & cpu throttling in the run. */\n export interface ThrottlingSettings {\n /** The round trip time in milliseconds. */\n rttMs?: number;\n /** The network throughput in kilobits per second. */\n throughputKbps?: number;\n // devtools settings\n /** The network request latency in milliseconds. */\n requestLatencyMs?: number;\n /** The network download throughput in kilobits per second. */\n downloadThroughputKbps?: number;\n /** The network upload throughput in kilobits per second. */\n uploadThroughputKbps?: number;\n // used by both\n /** The amount of slowdown applied to the cpu (1/<cpuSlowdownMultiplier>). */\n cpuSlowdownMultiplier?: number;\n }\n\n export interface PrecomputedLanternData {\n additionalRttByOrigin: {[origin: string]: number};\n serverResponseTimeByOrigin: {[origin: string]: number};\n }\n\n export interface Settings {\n networkAnalysis: {\n rtt: number,\n additionalRttByOrigin: Map<string, number>,\n serverResponseTimeByOrigin: Map<string, number>,\n throughput: number,\n };\n /** The method used to throttle the network. */\n throttlingMethod: 'devtools'|'simulate'|'provided';\n /** The throttling config settings. */\n throttling: Required<ThrottlingSettings>;\n /** Precomputed lantern estimates to use instead of observed analysis. */\n precomputedLanternData?: PrecomputedLanternData|null;\n }\n\n export interface Options {\n rtt?: number;\n throughput?: number;\n observedThroughput: number;\n maximumConcurrentRequests?: number;\n cpuSlowdownMultiplier?: number;\n layoutTaskMultiplier?: number;\n additionalRttByOrigin?: Map<string, number>;\n serverResponseTimeByOrigin?: Map<string, number>;\n }\n\n export interface ProcessedNavigation {\n timestamps: {\n firstContentfulPaint: number,\n largestContentfulPaint?: number,\n };\n }\n\n export interface MetricComputationDataInput {\n simulator: Simulator;\n graph: Node<unknown>;\n processedNavigation: ProcessedNavigation;\n }\n\n export interface MetricCoefficients {\n intercept: number;\n optimistic: number;\n pessimistic: number;\n }\n\n export interface NodeTiming {\n startTime: number;\n endTime: number;\n duration: number;\n }\n\n export interface Result<T = AnyNetworkObject> {\n timeInMs: number;\n nodeTimings: Map<Node<T>, NodeTiming>;\n }\n}\n\nexport namespace Metrics {\n export interface Result<T = AnyNetworkObject> {\n timing: number;\n timestamp?: never;\n optimisticEstimate: Simulation.Result<T>;\n pessimisticEstimate: Simulation.Result<T>;\n optimisticGraph: Node<T>;\n pessimisticGraph: Node<T>;\n }\n}\n"]}