@paulirish/trace_engine 0.0.67-beta.0 → 0.0.67-beta.1

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.
@@ -1,4 +1,6 @@
1
- // Generated by scripts/build.ts
1
+ // Copyright 2026 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.
2
4
  import {DevTools} from 'chrome-devtools-mcp/build/src/third_party/index.js';
3
5
 
4
6
  // Initialize DevTools 'en-US' locale if not already initialized so Insight models format strings cleanly in Node.
@@ -16,9 +18,24 @@ try {
16
18
  DevTools.I18n.i18n.registerLocaleDataForTest('en-US', {});
17
19
  }
18
20
 
19
- // Wrap LocalizedStringSet.prototype.getLocalizedString for models/trace/ so i18nString() returns
20
- // {i18nId, values, formattedDefault} objects (used by Lighthouse's i18n pipeline) while also
21
- // providing formattedDefault and toString() for direct consumers.
21
+ // Temporary workaround for Lighthouse i18n (TASTE.md:77).
22
+ //
23
+ // Why this exists:
24
+ // Lighthouse's multi-locale reporting pipeline needs structured message descriptors
25
+ // {i18nId, values, formattedDefault} so that audit results transferred from worker
26
+ // threads can be re-localized into any target locale (e.g., es, ja) using Lighthouse's
27
+ // translation dictionaries. By default, DevTools formats strings eagerly to primitive strings.
28
+ //
29
+ // Clean upstream solution:
30
+ // Add first-class support in devtools-frontend (front_end/core/i18n/DevToolsLocale.ts)
31
+ // for returning structured message descriptors—either via a configurable mode on
32
+ // DevToolsLocale (e.g., DevToolsLocale.setStructuredMessageMode(true)) or by having
33
+ // LocalizedStringSet expose a getMessageDescriptor(id, values) API that returns
34
+ // {i18nId, values, formattedDefault} with a .toString() fallback.
35
+ //
36
+ // Sunset criteria:
37
+ // Once that upstream DevTools change lands and rolls into chrome-devtools-mcp,
38
+ // delete this monkey-patch and use the native DevTools API.
22
39
  {
23
40
  const dummySet = DevTools.I18n.i18n.registerUIStrings('', {}).getLocalizedStringSetFor('en-US');
24
41
  const proto = Object.getPrototypeOf(dummySet);
package/package.json CHANGED
@@ -1,12 +1,18 @@
1
1
  {
2
2
  "name": "@paulirish/trace_engine",
3
- "version": "0.0.67-beta.0",
3
+ "version": "0.0.67-beta.1",
4
4
  "description": "Typed wrapper around DevTools TraceEngine powered by chrome-devtools-mcp",
5
5
  "main": "index.js",
6
- "types": "models/trace/trace.d.ts",
6
+ "types": "index.d.ts",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/paulirish/trace_engine.git"
10
+ },
11
+ "homepage": "https://github.com/paulirish/trace_engine#readme",
12
+ "bugs": "https://github.com/paulirish/trace_engine/issues",
7
13
  "exports": {
8
14
  ".": {
9
- "types": "./models/trace/trace.d.ts",
15
+ "types": "./index.d.ts",
10
16
  "default": "./index.js"
11
17
  },
12
18
  "./analyze-trace": "./analyze-trace.mjs",
@@ -14,6 +20,7 @@
14
20
  },
15
21
  "files": [
16
22
  "index.js",
23
+ "index.d.ts",
17
24
  "core",
18
25
  "entrypoints",
19
26
  "generated",
@@ -1,8 +0,0 @@
1
- // Copyright 2026 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
-
5
- import * as Trace from '../trace.js';
6
-
7
- export const {Core, Graph, Metrics, Simulation, Types} = Trace.Lantern;
8
- export default Trace.Lantern;
@@ -1,8 +0,0 @@
1
- // Copyright 2026 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
-
5
- import * as Trace from '../trace.js';
6
-
7
- export const {Micro, Milli, Seconds} = Trace.Types.Timing;
8
- export default Trace.Types.Timing;
@@ -1,189 +0,0 @@
1
- // Copyright 2026 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
-
5
- import * as Trace from "../trace.js";
6
-
7
- export const {
8
- AuctionWorkletType,
9
- CallFrameID,
10
- Categories,
11
- DefaultCategories,
12
- InvalidationEventType,
13
- LayoutInvalidationReason,
14
- MarkerName,
15
- NO_NAVIGATION,
16
- Name,
17
- OptionalCategories,
18
- Phase,
19
- ProcessID,
20
- ProfileID,
21
- SampleIndex,
22
- Scope,
23
- SelectorTimingsKey,
24
- StyleRecalcInvalidationReason,
25
- ThreadID,
26
- VALID_PROFILE_SOURCES,
27
- WorkerId,
28
- eventIsPageLoadEvent,
29
- isAbortPostTaskCallback,
30
- isActivateLayerTree,
31
- isAnimation,
32
- isAnimationFrameAsyncEnd,
33
- isAnimationFrameAsyncStart,
34
- isAnimationFramePresentation,
35
- isAnyFirstContentfulPaint,
36
- isAnyLargestContentfulPaintCandidate,
37
- isAnyScriptSourceEvent,
38
- isAuctionWorkletDoneWithProcess,
39
- isAuctionWorkletRunningInProcess,
40
- isBegin,
41
- isBeginCommitCompositorFrame,
42
- isBeginFrame,
43
- isBeginMainThreadFrame,
44
- isBeginRemoteFontLoad,
45
- isCommit,
46
- isCommitLoad,
47
- isComplete,
48
- isCompositeLayers,
49
- isConsoleRunTask,
50
- isConsoleTime,
51
- isConsoleTimeStamp,
52
- isDOMStats,
53
- isDebuggerAsyncTaskRun,
54
- isDebuggerAsyncTaskScheduled,
55
- isDecodeImage,
56
- isDecodeLazyPixelRef,
57
- isDidCommitSameDocumentNavigation,
58
- isDispatch,
59
- isDisplayListItemListSnapshot,
60
- isDomLoading,
61
- isDrawFrame,
62
- isDrawLazyPixelRef,
63
- isDroppedFrame,
64
- isEnd,
65
- isEventTiming,
66
- isEventTimingEnd,
67
- isEventTimingStart,
68
- isFireAnimationFrame,
69
- isFireIdleCallback,
70
- isFirstContentfulPaint,
71
- isFirstPaint,
72
- isFlowPhase,
73
- isFlowPhaseEvent,
74
- isFrameCommittedInBrowser,
75
- isFunctionCall,
76
- isGPUTask,
77
- isHandlePostMessage,
78
- isInstant,
79
- isInteractiveTime,
80
- isInvalidateLayout,
81
- isInvalidationTracking,
82
- isJSInvocationEvent,
83
- isJSSample,
84
- isLargestImagePaintCandidate,
85
- isLargestTextPaintCandidate,
86
- isLayerTreeHostImplSnapshot,
87
- isLayout,
88
- isLayoutImageUnsized,
89
- isLayoutInvalidationTracking,
90
- isLayoutShift,
91
- isLegacyScreenshot,
92
- isLegacySyntheticScreenshot,
93
- isLegacyTimelineFrame,
94
- isLinkPreconnect,
95
- isMainFrameViewport,
96
- isMarkDOMContent,
97
- isMarkLoad,
98
- isMarkerEvent,
99
- isMetaCharsetCheck,
100
- isNavigationStart,
101
- isNeedsBeginFrameChanged,
102
- isNestableAsyncPhase,
103
- isNetworkTrackEntry,
104
- isPaint,
105
- isPaintImage,
106
- isPairableAsyncBegin,
107
- isPairableAsyncEnd,
108
- isPairableAsyncInstant,
109
- isParseAuthorStyleSheetEvent,
110
- isParseHTML,
111
- isParseMetaViewport,
112
- isPerformanceMark,
113
- isPerformanceMeasure,
114
- isPerformanceMeasureBegin,
115
- isPhaseAsync,
116
- isPipelineReporter,
117
- isPrePaint,
118
- isPreloadRenderBlockingStatusChangeEvent,
119
- isProcessName,
120
- isProfile,
121
- isProfileCall,
122
- isProfileChunk,
123
- isRasterTask,
124
- isRecalcStyle,
125
- isReceivedDataEvent,
126
- isRemoteFontLoaded,
127
- isRenderFrameImplCreateChildFrame,
128
- isRendererEvent,
129
- isRequestIdleCallback,
130
- isRequestMainThreadFrame,
131
- isResourceChangePriority,
132
- isResourceFinish,
133
- isResourceMarkAsCached,
134
- isResourceReceiveResponse,
135
- isResourceReceivedData,
136
- isResourceSendRequest,
137
- isResourceWillSendRequest,
138
- isRunPostTaskCallback,
139
- isRunTask,
140
- isRundownScript,
141
- isRundownScriptCompiled,
142
- isRundownScriptSource,
143
- isRundownScriptSourceLarge,
144
- isSchedulePostMessage,
145
- isSchedulePostTaskCallback,
146
- isScheduleStyleInvalidationTracking,
147
- isScheduleStyleRecalculation,
148
- isScreenshot,
149
- isScrollLayer,
150
- isSelectorStats,
151
- isSetLayerId,
152
- isSoftFirstContentfulPaint,
153
- isSoftLargestContentfulPaintCandidate,
154
- isSoftNavigationStart,
155
- isStyleInvalidatorInvalidationTracking,
156
- isStyleRecalcInvalidationTracking,
157
- isSyntheticAnimation,
158
- isSyntheticBased,
159
- isSyntheticConsoleTiming,
160
- isSyntheticCpuProfile,
161
- isSyntheticInteraction,
162
- isSyntheticLayoutShift,
163
- isSyntheticLayoutShiftCluster,
164
- isSyntheticNetworkRequest,
165
- isSyntheticUserTiming,
166
- isSyntheticWebSocketConnection,
167
- isThreadName,
168
- isTimerFire,
169
- isTimerInstall,
170
- isTracingSessionIdForWorker,
171
- isTracingStartedInBrowser,
172
- isUpdateCounters,
173
- isUpdateLayer,
174
- isUserTiming,
175
- isUserTimingMeasure,
176
- isV8Compile,
177
- isWebSocketCreate,
178
- isWebSocketDestroy,
179
- isWebSocketEvent,
180
- isWebSocketInfo,
181
- isWebSocketReceiveHandshakeResponse,
182
- isWebSocketSendHandshakeRequest,
183
- isWebSocketTraceEvent,
184
- isWebSocketTransfer,
185
- objectIsCallFrame,
186
- objectIsEvent,
187
- } = Trace.Types.Events;
188
-
189
- export default Trace.Types.Events;
@@ -1,8 +0,0 @@
1
- // Copyright 2026 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
-
5
- import * as Trace from '../trace.js';
6
-
7
- export const {Configuration, Extensions, File, Overlays, Timing, TraceEvents} = Trace.Types;
8
- export default Trace.Types;