chore: migrate @trace to @playwright/trace

This commit is contained in:
Max Schmitt 2024-12-13 16:57:20 -08:00
parent 91d4b82dfb
commit 2653bb26a6
40 changed files with 47 additions and 45 deletions

7
package-lock.json generated
View file

@ -1507,6 +1507,10 @@
"resolved": "packages/playwright-test",
"link": true
},
"node_modules/@playwright/trace": {
"resolved": "packages/trace",
"link": true
},
"node_modules/@rollup/rollup-android-arm-eabi": {
"version": "4.22.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.4.tgz",
@ -7963,6 +7967,9 @@
"yaml": "^2.6.0"
}
},
"packages/trace": {
"name": "@playwright/trace"
},
"packages/trace-viewer": {
"version": "0.0.0"
},

View file

@ -25,7 +25,7 @@ import type { RootDispatcher } from './dispatcher';
import { Dispatcher } from './dispatcher';
import { yazl, yauzl } from '../../zipBundle';
import { ZipFile } from '../../utils/zipFile';
import type * as har from '@trace/har';
import type * as har from '@playwright/trace/src/har';
import type { HeadersArray } from '../types';
import { JsonPipeDispatcher } from '../dispatchers/jsonPipeDispatcher';
import { WebSocketTransport } from '../transport';

View file

@ -39,7 +39,7 @@ import { Tracing } from './trace/recorder/tracing';
import type * as types from './types';
import type { HeadersArray, ProxySettings } from './types';
import { getMatchingTLSOptionsForOrigin, rewriteOpenSSLErrorIfNeeded } from './socksClientCertificatesInterceptor';
import type * as har from '@trace/har';
import type * as har from '@playwright/trace/src/har';
import { TLSSocket } from 'tls';
type FetchRequestOptions = {

View file

@ -18,7 +18,7 @@ import fs from 'fs';
import path from 'path';
import { Artifact } from '../artifact';
import type { BrowserContext } from '../browserContext';
import type * as har from '@trace/har';
import type * as har from '@playwright/trace/src/har';
import { HarTracer } from './harTracer';
import type { HarTracerDelegate } from './harTracer';
import type * as channels from '@protocol/channels';

View file

@ -21,7 +21,7 @@ import { helper } from '../helper';
import * as network from '../network';
import type { Worker } from '../page';
import type { Page } from '../page';
import type * as har from '@trace/har';
import type * as har from '@playwright/trace/src/har';
import { assert, calculateSha1, monotonicTime } from '../../utils';
import type { RegisteredListener } from '../../utils/eventsHelper';
import { eventsHelper } from '../../utils/eventsHelper';

View file

@ -23,7 +23,7 @@ import type { Frame } from '../../frames';
import type { SnapshotData } from './snapshotterInjected';
import { frameSnapshotStreamer } from './snapshotterInjected';
import { calculateSha1, createGuid, monotonicTime } from '../../../utils';
import type { FrameSnapshot } from '@trace/snapshot';
import type { FrameSnapshot } from '@playwright/trace/src/snapshot';
import { mime } from '../../../utilsBundle';
export type SnapshotterBlob = {

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
import type { NodeSnapshot } from '@trace/snapshot';
import type { NodeSnapshot } from '@playwright/trace/src/snapshot';
export type SnapshotData = {
doctype?: string,

View file

@ -27,11 +27,11 @@ import type { APIRequestContext } from '../../fetch';
import type { CallMetadata, InstrumentationListener } from '../../instrumentation';
import { SdkObject } from '../../instrumentation';
import { Page } from '../../page';
import type * as har from '@trace/har';
import type * as har from '@playwright/trace/src/har';
import type { HarTracerDelegate } from '../../har/harTracer';
import { HarTracer } from '../../har/harTracer';
import type { FrameSnapshot } from '@trace/snapshot';
import type * as trace from '@trace/trace';
import type { FrameSnapshot } from '@playwright/trace/src/snapshot';
import type * as trace from '@playwright/trace/src/trace';
import type { SnapshotterBlob, SnapshotterDelegate } from './snapshotter';
import { Snapshotter } from './snapshotter';
import type { ConsoleMessage } from '../../console';

View file

@ -16,14 +16,14 @@
import type { BrowserContext } from '../../browserContext';
import type { Page } from '../../page';
import type { FrameSnapshot } from '@trace/snapshot';
import type { FrameSnapshot } from '@playwright/trace/src/snapshot';
import type { SnapshotRenderer } from '../../../../../trace-viewer/src/sw/snapshotRenderer';
import { SnapshotStorage } from '../../../../../trace-viewer/src/sw/snapshotStorage';
import type { SnapshotterBlob, SnapshotterDelegate } from '../recorder/snapshotter';
import { Snapshotter } from '../recorder/snapshotter';
import type { HarTracerDelegate } from '../../har/harTracer';
import { HarTracer } from '../../har/harTracer';
import type * as har from '@trace/har';
import type * as har from '@playwright/trace/src/har';
import { ManualPromise } from '../../../utils';
export class InMemorySnapshotter implements SnapshotterDelegate, HarTracerDelegate {

View file

@ -15,7 +15,7 @@
*/
import type { SerializedError, StackFrame } from '@protocol/channels';
import type * as trace from '@trace/trace';
import type * as trace from '@playwright/trace/src/trace';
import type EventEmitter from 'events';
import fs from 'fs';
import path from 'path';

View file

@ -1,6 +1,5 @@
[*]
@isomorphic/**
@trace/**
@web/**
ui/

View file

@ -15,7 +15,7 @@
*/
import { escapeHTMLAttribute, escapeHTML } from '@isomorphic/stringUtils';
import type { FrameSnapshot, NodeNameAttributesChildNodesSnapshot, NodeSnapshot, RenderedFrameSnapshot, ResourceSnapshot, SubtreeReferenceSnapshot } from '@trace/snapshot';
import type { FrameSnapshot, NodeNameAttributesChildNodesSnapshot, NodeSnapshot, RenderedFrameSnapshot, ResourceSnapshot, SubtreeReferenceSnapshot } from '@playwright/trace/src/snapshot';
import type { PageEntry } from '../types/entries';
import type { LRUCache } from './lruCache';

View file

@ -17,7 +17,7 @@
import type { URLSearchParams } from 'url';
import type { SnapshotRenderer } from './snapshotRenderer';
import type { SnapshotStorage } from './snapshotStorage';
import type { ResourceSnapshot } from '@trace/snapshot';
import type { ResourceSnapshot } from '@playwright/trace/src/snapshot';
type Point = { x: number, y: number };

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
import type { FrameSnapshot, ResourceSnapshot } from '@trace/snapshot';
import type { FrameSnapshot, ResourceSnapshot } from '@playwright/trace/src/snapshot';
import { rewriteURLForCustomProtocol, SnapshotRenderer } from './snapshotRenderer';
import type { PageEntry } from '../types/entries';
import { LRUCache } from './lruCache';

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
import type * as trace from '@trace/trace';
import type * as trace from '@playwright/trace/src/trace';
import type * as traceV3 from './versions/traceV3';
import type * as traceV4 from './versions/traceV4';
import type * as traceV5 from './versions/traceV5';

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
import type { Entry as ResourceSnapshot } from '@trace/har';
import type { Entry as ResourceSnapshot } from '@playwright/trace/src/har';
type SerializedValue = {
n?: number,

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
import type { Entry as ResourceSnapshot } from '@trace/har';
import type { Entry as ResourceSnapshot } from '@playwright/trace/src/har';
type Language = 'javascript' | 'python' | 'java' | 'csharp' | 'jsonl';
type Point = { x: number, y: number };

View file

@ -15,7 +15,7 @@
*/
import type { Entry as ResourceSnapshot } from '@trace/har';
import type { Entry as ResourceSnapshot } from '@playwright/trace/src/har';
type Language = 'javascript' | 'python' | 'java' | 'csharp' | 'jsonl';
type Point = { x: number, y: number };

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
import type { Entry as ResourceSnapshot } from '@trace/har';
import type { Entry as ResourceSnapshot } from '@playwright/trace/src/har';
type Language = 'javascript' | 'python' | 'java' | 'csharp' | 'jsonl';
type Point = { x: number, y: number };

View file

@ -57,7 +57,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import type { Entry } from '@trace/har';
import type { Entry } from '@playwright/trace/src/har';
// The following function is derived from Chromium's source code
// https://github.com/ChromeDevTools/devtools-frontend/blob/83cbe41b4107e188a1f66fdf6ea3a9cca42587c6/front_end/panels/network/NetworkLogView.ts#L2363

View file

@ -15,8 +15,8 @@
*/
import type { Language } from 'playwright-core/src/utils/isomorphic/locatorGenerators';
import type { ResourceSnapshot } from '@trace/snapshot';
import type * as trace from '@trace/trace';
import type { ResourceSnapshot } from '@playwright/trace/src/snapshot';
import type * as trace from '@playwright/trace/src/trace';
// *Entry structures are used to pass the trace between the sw and the page.

View file

@ -1,7 +1,6 @@
[*]
@injected/**
@isomorphic/**
@trace/**
@web/**
../entries.ts
../geometry.ts

View file

@ -14,7 +14,7 @@
limitations under the License.
*/
import type { ActionTraceEvent, AfterActionTraceEventAttachment } from '@trace/trace';
import type { ActionTraceEvent, AfterActionTraceEventAttachment } from '@playwright/trace/src/trace';
import { msToString } from '@web/uiUtils';
import * as React from 'react';
import './actionList.css';

View file

@ -19,7 +19,7 @@ import './attachmentsTab.css';
import { ImageDiffView } from '@web/shared/imageDiffView';
import type { ActionTraceEventInContext, MultiTraceModel } from './modelUtil';
import { PlaceholderPanel } from './placeholderPanel';
import type { AfterActionTraceEventAttachment } from '@trace/trace';
import type { AfterActionTraceEventAttachment } from '@playwright/trace/src/trace';
import { CodeMirrorWrapper, lineHeight } from '@web/components/codeMirrorWrapper';
import { isTextualMimeType } from '@isomorphic/mimeType';
import { Expandable } from '@web/components/expandable';

View file

@ -15,7 +15,7 @@
*/
import type { SerializedValue } from '@protocol/channels';
import type { ActionTraceEvent } from '@trace/trace';
import type { ActionTraceEvent } from '@playwright/trace/src/trace';
import { clsx, msToString } from '@web/uiUtils';
import * as React from 'react';
import './callTab.css';

View file

@ -15,7 +15,7 @@
*/
import type { Language } from '@isomorphic/locatorGenerators';
import type * as har from '@trace/har';
import type * as har from '@playwright/trace/src/har';
interface APIRequestCodegen {
generatePlaywrightRequestCall(request: har.Request, body: string | undefined): string;

View file

@ -15,9 +15,9 @@
*/
import type { Language } from '@isomorphic/locatorGenerators';
import type { ResourceSnapshot } from '@trace/snapshot';
import type * as trace from '@trace/trace';
import type { ActionTraceEvent } from '@trace/trace';
import type { ResourceSnapshot } from '@playwright/trace/src/snapshot';
import type * as trace from '@playwright/trace/src/trace';
import type { ActionTraceEvent } from '@playwright/trace/src/trace';
import type { ActionEntry, ContextEntry, PageEntry } from '../types/entries';
import type { StackFrame } from '@protocol/channels';

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
import type { ResourceSnapshot } from '@trace/snapshot';
import type { ResourceSnapshot } from '@playwright/trace/src/snapshot';
import * as React from 'react';
import './networkResourceDetails.css';
import { TabbedPane } from '@web/components/tabbedPane';

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
import type { Entry } from '@trace/har';
import type { Entry } from '@playwright/trace/src/har';
import * as React from 'react';
import type { Boundaries } from './geometry';
import './networkTab.css';

View file

@ -1,5 +1,4 @@
[*]
@isomorphic/**
@trace/**
@web/**
../**

View file

@ -16,7 +16,7 @@
import './snapshotTab.css';
import * as React from 'react';
import type { ActionTraceEvent } from '@trace/trace';
import type { ActionTraceEvent } from '@playwright/trace/src/trace';
import { context, type MultiTraceModel, prevInList } from './modelUtil';
import { Toolbar } from '@web/components/toolbar';
import { ToolbarButton } from '@web/components/toolbarButton';

View file

@ -23,7 +23,7 @@ import type { FilmStripPreviewPoint } from './filmStrip';
import type { ActionTraceEventInContext, MultiTraceModel } from './modelUtil';
import './timeline.css';
import type { Language } from '@isomorphic/locatorGenerators';
import type { Entry } from '@trace/har';
import type { Entry } from '@playwright/trace/src/har';
import type { ConsoleEntry } from './consoleTab';
type TimelineBar = {

View file

@ -37,11 +37,11 @@ import type { Boundaries } from './geometry';
import { InspectorTab } from './inspectorTab';
import { ToolbarButton } from '@web/components/toolbarButton';
import { useSetting, msToString, clsx } from '@web/uiUtils';
import type { Entry } from '@trace/har';
import type { Entry } from '@playwright/trace/src/har';
import './workbench.css';
import { testStatusIcon, testStatusText } from './testUtils';
import type { UITestStatus } from './testUtils';
import type { AfterActionTraceEventAttachment } from '@trace/trace';
import type { AfterActionTraceEventAttachment } from '@playwright/trace/src/trace';
export const Workbench: React.FunctionComponent<{
model?: modelUtil.MultiTraceModel,

View file

@ -21,7 +21,6 @@
"@protocol/*": ["../protocol/src/*"],
"@recorder/*": ["../recorder/src/*"],
"@testIsomorphic/*": ["../playwright/src/isomorphic/*"],
"@trace/*": ["../trace/src/*"],
"@web/*": ["../web/src/*"],
// Resolving type dependencies will start processing types in @playwright/test
// which in turn will start parsing the files and hence stumble upon the core

View file

@ -35,7 +35,6 @@ export default defineConfig({
'@isomorphic': path.resolve(__dirname, '../playwright-core/src/utils/isomorphic'),
'@protocol': path.resolve(__dirname, '../protocol/src'),
'@testIsomorphic': path.resolve(__dirname, '../playwright/src/isomorphic'),
'@trace': path.resolve(__dirname, '../trace/src'),
'@web': path.resolve(__dirname, '../web/src'),
},
},

View file

@ -31,7 +31,6 @@ export default defineConfig({
'@isomorphic': path.resolve(__dirname, '../playwright-core/src/utils/isomorphic'),
'@protocol': path.resolve(__dirname, '../protocol/src'),
'@testIsomorphic': path.resolve(__dirname, '../playwright-core/src/utils/testIsomorphic'),
'@trace': path.resolve(__dirname, '../trace/src'),
'@web': path.resolve(__dirname, '../web/src'),
},
},

View file

@ -0,0 +1,3 @@
{
"name": "@playwright/trace"
}

View file

@ -22,7 +22,7 @@ import { parseClientSideCallMetadata } from '../../packages/playwright-core/lib/
import { TraceModel } from '../../packages/trace-viewer/src/sw/traceModel';
import type { ActionTreeItem } from '../../packages/trace-viewer/src/ui/modelUtil';
import { buildActionTree, MultiTraceModel } from '../../packages/trace-viewer/src/ui/modelUtil';
import type { ActionTraceEvent, ConsoleMessageTraceEvent, EventTraceEvent, TraceEvent } from '@trace/trace';
import type { ActionTraceEvent, ConsoleMessageTraceEvent, EventTraceEvent, TraceEvent } from '@playwright/trace/src/trace';
import style from 'ansi-styles';
export async function attachFrame(page: Page, frameId: string, url: string): Promise<Frame> {

View file

@ -14,7 +14,6 @@
"@isomorphic/*": ["packages/playwright-core/src/utils/isomorphic/*"],
"@protocol/*": ["packages/protocol/src/*"],
"@recorder/*": ["packages/recorder/src/*"],
"@trace/*": ["packages/trace/src/*"],
"@web/*": ["packages/web/src/*"],
},
},

View file

@ -16,7 +16,6 @@
"@protocol/*": ["./packages/protocol/src/*"],
"@recorder/*": ["./packages/recorder/src/*"],
"@testIsomorphic/*": ["./packages/playwright/src/isomorphic/*"],
"@trace/*": ["./packages/trace/src/*"],
"@web/*": ["./packages/web/src/*"],
"playwright-core/lib/*": ["./packages/playwright-core/src/*"],
"playwright/lib/*": ["./packages/playwright/src/*"],