chore: move sw files into the sw/ folder (#32837)
This commit is contained in:
parent
e8d08e8d1e
commit
9bff4d7eab
|
|
@ -17,8 +17,8 @@
|
|||
import type { BrowserContext } from '../../browserContext';
|
||||
import type { Page } from '../../page';
|
||||
import type { FrameSnapshot } from '@trace/snapshot';
|
||||
import type { SnapshotRenderer } from '../../../../../trace-viewer/src/snapshotRenderer';
|
||||
import { SnapshotStorage } from '../../../../../trace-viewer/src/snapshotStorage';
|
||||
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 { ElementHandle } from '../../dom';
|
||||
|
|
|
|||
|
|
@ -3,3 +3,6 @@
|
|||
@trace/**
|
||||
@web/**
|
||||
ui/
|
||||
|
||||
[sw-main.ts]
|
||||
sw/**
|
||||
|
|
|
|||
|
|
@ -1,82 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export class MultiMap<K, V> {
|
||||
private _map: Map<K, V[]>;
|
||||
|
||||
constructor() {
|
||||
this._map = new Map<K, V[]>();
|
||||
}
|
||||
|
||||
set(key: K, value: V) {
|
||||
let values = this._map.get(key);
|
||||
if (!values) {
|
||||
values = [];
|
||||
this._map.set(key, values);
|
||||
}
|
||||
values.push(value);
|
||||
}
|
||||
|
||||
get(key: K): V[] {
|
||||
return this._map.get(key) || [];
|
||||
}
|
||||
|
||||
has(key: K): boolean {
|
||||
return this._map.has(key);
|
||||
}
|
||||
|
||||
delete(key: K, value: V) {
|
||||
const values = this._map.get(key);
|
||||
if (!values)
|
||||
return;
|
||||
if (values.includes(value))
|
||||
this._map.set(key, values.filter(v => value !== v));
|
||||
}
|
||||
|
||||
deleteAll(key: K) {
|
||||
this._map.delete(key);
|
||||
}
|
||||
|
||||
hasValue(key: K, value: V): boolean {
|
||||
const values = this._map.get(key);
|
||||
if (!values)
|
||||
return false;
|
||||
return values.includes(value);
|
||||
}
|
||||
|
||||
get size(): number {
|
||||
return this._map.size;
|
||||
}
|
||||
|
||||
[Symbol.iterator](): Iterator<[K, V[]]> {
|
||||
return this._map[Symbol.iterator]();
|
||||
}
|
||||
|
||||
keys(): IterableIterator<K> {
|
||||
return this._map.keys();
|
||||
}
|
||||
|
||||
values(): Iterable<V> {
|
||||
const result: V[] = [];
|
||||
for (const key of this.keys())
|
||||
result.push(...this.get(key));
|
||||
return result;
|
||||
}
|
||||
|
||||
clear() {
|
||||
this._map.clear();
|
||||
}
|
||||
}
|
||||
17
packages/trace-viewer/src/sw-main.ts
Normal file
17
packages/trace-viewer/src/sw-main.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import './sw/main';
|
||||
2
packages/trace-viewer/src/sw/DEPS.list
Normal file
2
packages/trace-viewer/src/sw/DEPS.list
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[*]
|
||||
@isomorphic/**
|
||||
|
|
@ -14,9 +14,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { parseClientSideCallMetadata } from '../../../packages/playwright-core/src/utils/isomorphic/traceUtils';
|
||||
import type { ActionEntry, ContextEntry } from './entries';
|
||||
import { createEmptyContext } from './entries';
|
||||
import { parseClientSideCallMetadata } from '@isomorphic/traceUtils';
|
||||
import type { ActionEntry, ContextEntry } from '../types/entries';
|
||||
import { SnapshotStorage } from './snapshotStorage';
|
||||
import { TraceModernizer } from './traceModernizer';
|
||||
|
||||
|
|
@ -150,3 +149,26 @@ function collapseActionsForRecorder(actions: ActionEntry[]): ActionEntry[] {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function createEmptyContext(): ContextEntry {
|
||||
return {
|
||||
origin: 'testRunner',
|
||||
traceUrl: '',
|
||||
startTime: Number.MAX_SAFE_INTEGER,
|
||||
wallTime: Number.MAX_SAFE_INTEGER,
|
||||
endTime: 0,
|
||||
browserName: '',
|
||||
options: {
|
||||
deviceScaleFactor: 1,
|
||||
isMobile: false,
|
||||
viewport: { width: 1280, height: 800 },
|
||||
},
|
||||
pages: [],
|
||||
resources: [],
|
||||
actions: [],
|
||||
events: [],
|
||||
errors: [],
|
||||
stdio: [],
|
||||
hasSource: false,
|
||||
};
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ import type * as traceV3 from './versions/traceV3';
|
|||
import type * as traceV4 from './versions/traceV4';
|
||||
import type * as traceV5 from './versions/traceV5';
|
||||
import type * as traceV6 from './versions/traceV6';
|
||||
import type { ActionEntry, ContextEntry, PageEntry } from './entries';
|
||||
import type { ActionEntry, ContextEntry, PageEntry } from '../types/entries';
|
||||
import type { SnapshotStorage } from './snapshotStorage';
|
||||
|
||||
export class TraceVersionError extends Error {
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Entry as ResourceSnapshot } from '../../../trace/src/har';
|
||||
import type { Entry as ResourceSnapshot } from '@trace/har';
|
||||
|
||||
type SerializedValue = {
|
||||
n?: number,
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Entry as ResourceSnapshot } from '../../../trace/src/har';
|
||||
import type { Entry as ResourceSnapshot } from '@trace/har';
|
||||
|
||||
type Language = 'javascript' | 'python' | 'java' | 'csharp' | 'jsonl';
|
||||
type Point = { x: number, y: number };
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
|
||||
import type { Entry as ResourceSnapshot } from '../../../trace/src/har';
|
||||
import type { Entry as ResourceSnapshot } from '@trace/har';
|
||||
|
||||
type Language = 'javascript' | 'python' | 'java' | 'csharp' | 'jsonl';
|
||||
type Point = { x: number, y: number };
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Entry as ResourceSnapshot } from '../../../trace/src/har';
|
||||
import type { Entry as ResourceSnapshot } from '@trace/har';
|
||||
|
||||
type Language = 'javascript' | 'python' | 'java' | 'csharp' | 'jsonl';
|
||||
type Point = { x: number, y: number };
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Language } from '../../playwright-core/src/utils/isomorphic/locatorGenerators';
|
||||
import type { Language } from 'playwright-core/src/utils/isomorphic/locatorGenerators';
|
||||
import type { ResourceSnapshot } from '@trace/snapshot';
|
||||
import type * as trace from '@trace/trace';
|
||||
|
||||
|
|
@ -54,26 +54,3 @@ export type PageEntry = {
|
|||
export type ActionEntry = trace.ActionTraceEvent & {
|
||||
log: { time: number, message: string }[];
|
||||
};
|
||||
|
||||
export function createEmptyContext(): ContextEntry {
|
||||
return {
|
||||
origin: 'testRunner',
|
||||
traceUrl: '',
|
||||
startTime: Number.MAX_SAFE_INTEGER,
|
||||
wallTime: Number.MAX_SAFE_INTEGER,
|
||||
endTime: 0,
|
||||
browserName: '',
|
||||
options: {
|
||||
deviceScaleFactor: 1,
|
||||
isMobile: false,
|
||||
viewport: { width: 1280, height: 800 },
|
||||
},
|
||||
pages: [],
|
||||
resources: [],
|
||||
actions: [],
|
||||
events: [],
|
||||
errors: [],
|
||||
stdio: [],
|
||||
hasSource: false,
|
||||
};
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ import type { Language } from '@isomorphic/locatorGenerators';
|
|||
import type { TreeState } from '@web/components/treeView';
|
||||
import { TreeView } from '@web/components/treeView';
|
||||
import type { ActionTraceEventInContext, ActionTreeItem } from './modelUtil';
|
||||
import type { Boundaries } from '../geometry';
|
||||
import type { Boundaries } from './geometry';
|
||||
|
||||
export interface ActionListProps {
|
||||
actions: ActionTraceEventInContext[],
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import * as React from 'react';
|
|||
import './consoleTab.css';
|
||||
import type * as modelUtil from './modelUtil';
|
||||
import { ListView } from '@web/components/listView';
|
||||
import type { Boundaries } from '../geometry';
|
||||
import type { Boundaries } from './geometry';
|
||||
import { clsx, msToString } from '@web/uiUtils';
|
||||
import { ansi2html } from '@web/ansi2html';
|
||||
import { PlaceholderPanel } from './placeholderPanel';
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import * as React from 'react';
|
||||
import type { ContextEntry } from '../entries';
|
||||
import type { ContextEntry } from '../types/entries';
|
||||
import { MultiTraceModel } from './modelUtil';
|
||||
import './embeddedWorkbenchLoader.css';
|
||||
import { Workbench } from './workbench';
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@
|
|||
*/
|
||||
|
||||
import './filmStrip.css';
|
||||
import type { Boundaries, Size } from '../geometry';
|
||||
import type { Boundaries, Size } from './geometry';
|
||||
import * as React from 'react';
|
||||
import { useMeasure, upperBound } from '@web/uiUtils';
|
||||
import type { PageEntry } from '../entries';
|
||||
import type { PageEntry } from '../types/entries';
|
||||
import type { ActionTraceEventInContext, MultiTraceModel } from './modelUtil';
|
||||
import { renderAction } from './actionList';
|
||||
import type { Language } from '@isomorphic/locatorGenerators';
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ 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 { ContextEntry, PageEntry } from '../entries';
|
||||
import type { ContextEntry, PageEntry } from '../types/entries';
|
||||
import type { StackFrame } from '@protocol/channels';
|
||||
|
||||
const contextSymbol = Symbol('context');
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
import type { Entry } from '@trace/har';
|
||||
import * as React from 'react';
|
||||
import type { Boundaries } from '../geometry';
|
||||
import type { Boundaries } from './geometry';
|
||||
import './networkTab.css';
|
||||
import { NetworkResourceDetails } from './networkResourceDetails';
|
||||
import { bytesToString, msToString } from '@web/uiUtils';
|
||||
|
|
@ -24,7 +24,7 @@ import { PlaceholderPanel } from './placeholderPanel';
|
|||
import { context, type MultiTraceModel } from './modelUtil';
|
||||
import { GridView, type RenderedGridCell } from '@web/components/gridView';
|
||||
import { SplitView } from '@web/components/splitView';
|
||||
import type { ContextEntry } from '../entries';
|
||||
import type { ContextEntry } from '../types/entries';
|
||||
import { NetworkFilters, defaultFilterState, type FilterState, type ResourceType } from './networkFilters';
|
||||
|
||||
type NetworkTabModel = {
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ import type { TabbedPaneTabModel } from '@web/components/tabbedPane';
|
|||
import { TabbedPane } from '@web/components/tabbedPane';
|
||||
import { sha1, useSetting } from '@web/uiUtils';
|
||||
import * as React from 'react';
|
||||
import type { ContextEntry } from '../entries';
|
||||
import type { Boundaries } from '../geometry';
|
||||
import type { ContextEntry } from '../types/entries';
|
||||
import type { Boundaries } from './geometry';
|
||||
import { ActionList } from './actionList';
|
||||
import { ConsoleTab, useConsoleTabModel } from './consoleTab';
|
||||
import { InspectorTab } from './inspectorTab';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
import { clsx, msToString, useMeasure } from '@web/uiUtils';
|
||||
import { GlassPane } from '@web/shared/glassPane';
|
||||
import * as React from 'react';
|
||||
import type { Boundaries } from '../geometry';
|
||||
import type { Boundaries } from './geometry';
|
||||
import { FilmStrip } from './filmStrip';
|
||||
import type { FilmStripPreviewPoint } from './filmStrip';
|
||||
import type { ActionTraceEventInContext, MultiTraceModel } from './modelUtil';
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import '@web/common.css';
|
|||
import '@web/third_party/vscode/codicon.css';
|
||||
import type * as reporterTypes from 'playwright/types/testReporter';
|
||||
import React from 'react';
|
||||
import type { ContextEntry } from '../entries';
|
||||
import type { ContextEntry } from '../types/entries';
|
||||
import type { SourceLocation } from './modelUtil';
|
||||
import { MultiTraceModel } from './modelUtil';
|
||||
import { Workbench } from './workbench';
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import { Timeline } from './timeline';
|
|||
import { MetadataView } from './metadataView';
|
||||
import { AttachmentsTab } from './attachmentsTab';
|
||||
import { AnnotationsTab } from './annotationsTab';
|
||||
import type { Boundaries } from '../geometry';
|
||||
import type { Boundaries } from './geometry';
|
||||
import { InspectorTab } from './inspectorTab';
|
||||
import { ToolbarButton } from '@web/components/toolbarButton';
|
||||
import { useSetting, msToString, clsx } from '@web/uiUtils';
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
import { ToolbarButton } from '@web/components/toolbarButton';
|
||||
import * as React from 'react';
|
||||
import type { ContextEntry } from '../entries';
|
||||
import type { ContextEntry } from '../types/entries';
|
||||
import { MultiTraceModel } from './modelUtil';
|
||||
import './workbenchLoader.css';
|
||||
import { toggleTheme } from '@web/theme';
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@ export default defineConfig({
|
|||
emptyOutDir: false,
|
||||
rollupOptions: {
|
||||
input: {
|
||||
sw: path.resolve(__dirname, 'src/sw.ts'),
|
||||
sw: path.resolve(__dirname, 'src/sw-main.ts'),
|
||||
},
|
||||
output: {
|
||||
entryFileNames: info => '[name].bundle.js',
|
||||
assetFileNames: () => '[name].[hash][extname]',
|
||||
entryFileNames: info => 'sw.bundle.js',
|
||||
assetFileNames: () => 'sw.[hash][extname]',
|
||||
manualChunks: undefined,
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
|
||||
import type { Frame, Page } from 'playwright-core';
|
||||
import { ZipFile } from '../../packages/playwright-core/lib/utils/zipFile';
|
||||
import type { TraceModelBackend } from '../../packages/trace-viewer/src/traceModel';
|
||||
import type { TraceModelBackend } from '../../packages/trace-viewer/src/sw/traceModel';
|
||||
import type { StackFrame } from '../../packages/protocol/src/channels';
|
||||
import { parseClientSideCallMetadata } from '../../packages/playwright-core/lib/utils/isomorphic/traceUtils';
|
||||
import { TraceModel } from '../../packages/trace-viewer/src/traceModel';
|
||||
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';
|
||||
|
|
|
|||
Loading…
Reference in a new issue