Skip to content

Commit

Permalink
chore: move event utils to server (#34761)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelfeldman authored Feb 12, 2025
1 parent 0eeba38 commit c31ce78
Show file tree
Hide file tree
Showing 24 changed files with 41 additions and 41 deletions.
4 changes: 2 additions & 2 deletions packages/playwright-core/src/server/bidi/bidiBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { eventsHelper } from '../../utils/eventsHelper';
import { eventsHelper } from '../utils/eventsHelper';
import { Browser } from '../browser';
import { BrowserContext, assertBrowserContextIsNotOwned } from '../browserContext';
import * as network from '../network';
Expand All @@ -23,7 +23,7 @@ import { bidiBytesValueToString } from './bidiNetworkManager';
import { BidiPage } from './bidiPage';
import * as bidi from './third_party/bidiProtocol';

import type { RegisteredListener } from '../../utils/eventsHelper';
import type { RegisteredListener } from '../utils/eventsHelper';
import type { BrowserOptions } from '../browser';
import type { SdkObject } from '../instrumentation';
import type { InitScript, Page } from '../page';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* limitations under the License.
*/

import { eventsHelper } from '../../utils/eventsHelper';
import { eventsHelper } from '../utils/eventsHelper';
import { parseRawCookie } from '../cookieStore';
import * as network from '../network';
import * as bidi from './third_party/bidiProtocol';

import type { RegisteredListener } from '../../utils/eventsHelper';
import type { RegisteredListener } from '../utils/eventsHelper';
import type * as frames from '../frames';
import type { Page } from '../page';
import type * as types from '../types';
Expand Down
4 changes: 2 additions & 2 deletions packages/playwright-core/src/server/bidi/bidiPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import { assert } from '../../utils';
import { eventsHelper } from '../../utils/eventsHelper';
import { eventsHelper } from '../utils/eventsHelper';
import { BrowserContext } from '../browserContext';
import * as dialog from '../dialog';
import * as dom from '../dom';
Expand All @@ -26,7 +26,7 @@ import { BidiNetworkManager } from './bidiNetworkManager';
import { BidiPDF } from './bidiPdf';
import * as bidi from './third_party/bidiProtocol';

import type { RegisteredListener } from '../../utils/eventsHelper';
import type { RegisteredListener } from '../utils/eventsHelper';
import type * as accessibility from '../accessibility';
import type * as frames from '../frames';
import type { InitScript, PageDelegate } from '../page';
Expand Down
4 changes: 2 additions & 2 deletions packages/playwright-core/src/server/chromium/crCoverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
*/

import { assert } from '../../utils';
import { eventsHelper } from '../../utils/eventsHelper';
import { eventsHelper } from '../utils/eventsHelper';

import type { CRSession } from './crConnection';
import type { Protocol } from './protocol';
import type { RegisteredListener } from '../../utils/eventsHelper';
import type { RegisteredListener } from '../utils/eventsHelper';
import type * as channels from '@protocol/channels';


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
*/

import { assert, headersArrayToObject, headersObjectToArray } from '../../utils';
import { eventsHelper } from '../../utils/eventsHelper';
import { eventsHelper } from '../utils/eventsHelper';
import { helper } from '../helper';
import * as network from '../network';
import { isProtocolError, isSessionClosedError } from '../protocolError';

import type { CRSession } from './crConnection';
import type { Protocol } from './protocol';
import type { RegisteredListener } from '../../utils/eventsHelper';
import type { RegisteredListener } from '../utils/eventsHelper';
import type * as contexts from '../browserContext';
import type * as frames from '../frames';
import type { Page } from '../page';
Expand Down
4 changes: 2 additions & 2 deletions packages/playwright-core/src/server/chromium/crPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import * as path from 'path';

import { assert } from '../../utils/debug';
import { createGuid } from '../utils/crypto';
import { eventsHelper } from '../../utils/eventsHelper';
import { eventsHelper } from '../utils/eventsHelper';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import * as dialog from '../dialog';
import * as dom from '../dom';
Expand All @@ -46,7 +46,7 @@ import { isSessionClosedError } from '../protocolError';

import type { CRSession } from './crConnection';
import type { Protocol } from './protocol';
import type { RegisteredListener } from '../../utils/eventsHelper';
import type { RegisteredListener } from '../utils/eventsHelper';
import type { InitScript, PageDelegate } from '../page';
import type { Progress } from '../progress';
import type * as types from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { DebugController } from '../debugController';
import { Dispatcher } from './dispatcher';

import type { DispatcherConnection, RootDispatcher } from './dispatcher';
import type { RegisteredListener } from '../../utils/eventsHelper';
import type { RegisteredListener } from '../utils/eventsHelper';
import type * as channels from '@protocol/channels';


Expand Down
4 changes: 2 additions & 2 deletions packages/playwright-core/src/server/dispatchers/dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { EventEmitter } from 'events';

import { eventsHelper } from '../..//utils/eventsHelper';
import { eventsHelper } from '../utils/eventsHelper';
import { ValidationError, createMetadataValidator, findValidator } from '../../protocol/validator';
import { LongStandingScope, assert, compressCallLog, isUnderTest, monotonicTime, rewriteErrorMessage } from '../../utils';
import { TargetClosedError, isTargetClosedError, serializeError } from '../errors';
Expand All @@ -25,7 +25,7 @@ import { isProtocolError } from '../protocolError';

import type { CallMetadata } from '../instrumentation';
import type { PlaywrightDispatcher } from './playwrightDispatcher';
import type { RegisteredListener } from '../..//utils/eventsHelper';
import type { RegisteredListener } from '../utils/eventsHelper';
import type { ValidatorContext } from '../../protocol/validator';
import type * as channels from '@protocol/channels';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ import { LocalUtilsDispatcher } from './localUtilsDispatcher';
import { APIRequestContextDispatcher } from './networkDispatchers';
import { SelectorsDispatcher } from './selectorsDispatcher';
import { createGuid } from '../utils/crypto';
import { eventsHelper } from '../../utils/eventsHelper';
import { eventsHelper } from '../utils/eventsHelper';

import type { RootDispatcher } from './dispatcher';
import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../utils/socksProxy';
import type { RegisteredListener } from '../../utils/eventsHelper';
import type { RegisteredListener } from '../utils/eventsHelper';
import type { AndroidDevice } from '../android/android';
import type { Browser } from '../browser';
import type { Playwright } from '../playwright';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { PageDispatcher } from './pageDispatcher';
import * as webSocketMockSource from '../../generated/webSocketMockSource';
import { createGuid } from '../utils/crypto';
import { urlMatches } from '../../utils/isomorphic/urlMatch';
import { eventsHelper } from '../../utils/eventsHelper';
import { eventsHelper } from '../utils/eventsHelper';

import type { BrowserContextDispatcher } from './browserContextDispatcher';
import type { BrowserContext } from '../browserContext';
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/server/electron/electron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { TimeoutSettings } from '../../common/timeoutSettings';
import { ManualPromise } from '../../utils';
import { wrapInASCIIBox } from '../utils/ascii';
import { RecentLogsCollector } from '../../utils/debugLogger';
import { eventsHelper } from '../../utils/eventsHelper';
import { eventsHelper } from '../utils/eventsHelper';
import { validateBrowserContextOptions } from '../browserContext';
import { CRBrowser } from '../chromium/crBrowser';
import { CRConnection } from '../chromium/crConnection';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
* limitations under the License.
*/

import { eventsHelper } from '../../utils/eventsHelper';
import { eventsHelper } from '../utils/eventsHelper';
import * as network from '../network';

import type { FFSession } from './ffConnection';
import type { HeadersArray } from '../../server/types';
import type { RegisteredListener } from '../../utils/eventsHelper';
import type { RegisteredListener } from '../utils/eventsHelper';
import type * as frames from '../frames';
import type { Page } from '../page';
import type * as types from '../types';
Expand Down
4 changes: 2 additions & 2 deletions packages/playwright-core/src/server/firefox/ffPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import { eventsHelper } from '../../utils/eventsHelper';
import { eventsHelper } from '../utils/eventsHelper';
import * as dialog from '../dialog';
import * as dom from '../dom';
import { InitScript } from '../page';
Expand All @@ -33,7 +33,7 @@ import { TargetClosedError } from '../errors';
import type { Progress } from '../progress';
import type { FFBrowserContext } from './ffBrowser';
import type { Protocol } from './protocol';
import type { RegisteredListener } from '../../utils/eventsHelper';
import type { RegisteredListener } from '../utils/eventsHelper';
import type * as frames from '../frames';
import type { PageDelegate } from '../page';
import type * as types from '../types';
Expand Down
4 changes: 2 additions & 2 deletions packages/playwright-core/src/server/frames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import * as types from './types';
import { LongStandingScope, asLocator, assert, compressCallLog, constructURLBasedOnBaseURL, makeWaitForNextTask, monotonicTime } from '../utils';
import { isSessionClosedError } from './protocolError';
import { debugLogger } from '../utils/debugLogger';
import { eventsHelper } from '../utils/eventsHelper';
import { eventsHelper } from './utils/eventsHelper';
import { isInvalidSelectorError } from '../utils/isomorphic/selectorParser';
import { ManualPromise } from '../utils/isomorphic/manualPromise';

Expand All @@ -40,7 +40,7 @@ import type { ElementStateWithoutStable, FrameExpectParams, InjectedScript } fro
import type { CallMetadata } from './instrumentation';
import type { Progress } from './progress';
import type { ScreenshotOptions } from './screenshotter';
import type { RegisteredListener } from '../utils/eventsHelper';
import type { RegisteredListener } from './utils/eventsHelper';
import type { ParsedSelector } from '../utils/isomorphic/selectorParser';
import type * as channels from '@protocol/channels';

Expand Down
4 changes: 2 additions & 2 deletions packages/playwright-core/src/server/har/harTracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { assert, calculateSha1, monotonicTime } from '../../utils';
import { getPlaywrightVersion, isTextualMimeType, urlMatches } from '../../utils';
import { eventsHelper } from '../../utils/eventsHelper';
import { eventsHelper } from '../utils/eventsHelper';
import { ManualPromise } from '../../utils/isomorphic/manualPromise';
import { mime } from '../../utilsBundle';
import { BrowserContext } from '../browserContext';
Expand All @@ -25,7 +25,7 @@ import { Frame } from '../frames';
import { helper } from '../helper';
import * as network from '../network';

import type { RegisteredListener } from '../../utils/eventsHelper';
import type { RegisteredListener } from '../utils/eventsHelper';
import type { APIRequestEvent, APIRequestFinishedEvent } from '../fetch';
import type { Page } from '../page';
import type { Worker } from '../page';
Expand Down
4 changes: 2 additions & 2 deletions packages/playwright-core/src/server/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
*/

import { debugLogger } from '../utils/debugLogger';
import { eventsHelper } from '../utils/eventsHelper';
import { eventsHelper } from './utils/eventsHelper';

import type { Progress } from './progress';
import type * as types from './types';
import type { RegisteredListener } from '../utils/eventsHelper';
import type { RegisteredListener } from './utils/eventsHelper';
import type { EventEmitter } from 'events';


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import { frameSnapshotStreamer } from './snapshotterInjected';
import { monotonicTime } from '../../../utils/isomorphic/time';
import { calculateSha1, createGuid } from '../../utils/crypto';
import { debugLogger } from '../../../utils/debugLogger';
import { eventsHelper } from '../../../utils/eventsHelper';
import { eventsHelper } from '../../utils/eventsHelper';
import { mime } from '../../../utilsBundle';
import { BrowserContext } from '../../browserContext';
import { Page } from '../../page';

import type { SnapshotData } from './snapshotterInjected';
import type { RegisteredListener } from '../../../utils/eventsHelper';
import type { RegisteredListener } from '../../utils/eventsHelper';
import type { Frame } from '../../frames';
import type { FrameSnapshot } from '@trace/snapshot';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Snapshotter } from './snapshotter';
import { commandsWithTracingSnapshots } from '../../../protocol/debug';
import { assert } from '../../../utils/debug';
import { monotonicTime } from '../../../utils/isomorphic/time';
import { eventsHelper } from '../../../utils/eventsHelper';
import { eventsHelper } from '../../utils/eventsHelper';
import { createGuid } from '../../utils/crypto';
import { Artifact } from '../../artifact';
import { BrowserContext } from '../../browserContext';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { isRegExp, isString } from './isomorphic/rtti';
import { isRegExp, isString } from '../../utils/isomorphic/rtti';

import type { ExpectedTextValue } from '@protocol/channels';

Expand Down
4 changes: 2 additions & 2 deletions packages/playwright-core/src/server/webkit/wkPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import * as path from 'path';
import { assert, debugAssert } from '../../utils';
import { headersArrayToObject } from '../../utils/isomorphic/headers';
import { createGuid } from '../utils/crypto';
import { eventsHelper } from '../../utils/eventsHelper';
import { eventsHelper } from '../utils/eventsHelper';
import { hostPlatform } from '../../utils/hostPlatform';
import { splitErrorMessage } from '../../utils/stackTrace';
import { PNG, jpegjs } from '../../utilsBundle';
Expand All @@ -43,7 +43,7 @@ import { debugLogger } from '../../utils/debugLogger';

import type { Protocol } from './protocol';
import type { WKBrowserContext } from './wkBrowser';
import type { RegisteredListener } from '../../utils/eventsHelper';
import type { RegisteredListener } from '../utils/eventsHelper';
import type * as accessibility from '../accessibility';
import type * as frames from '../frames';
import type { JSHandle } from '../javascript';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
*/

import { assert } from '../../utils';
import { eventsHelper } from '../../utils/eventsHelper';
import { eventsHelper } from '../utils/eventsHelper';

import type { Protocol } from './protocol';
import type { WKSession } from './wkConnection';
import type { WKPage } from './wkPage';
import type { RegisteredListener } from '../../utils/eventsHelper';
import type { RegisteredListener } from '../utils/eventsHelper';
import type * as network from '../network';

export class WKProvisionalPage {
Expand Down
4 changes: 2 additions & 2 deletions packages/playwright-core/src/server/webkit/wkWorkers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* limitations under the License.
*/

import { eventsHelper } from '../../utils/eventsHelper';
import { eventsHelper } from '../utils/eventsHelper';
import { Worker } from '../page';
import { WKSession } from './wkConnection';
import { WKExecutionContext } from './wkExecutionContext';

import type { Protocol } from './protocol';
import type { RegisteredListener } from '../../utils/eventsHelper';
import type { RegisteredListener } from '../utils/eventsHelper';
import type { Page } from '../page';
import type * as types from '../types';

Expand Down
4 changes: 2 additions & 2 deletions packages/playwright-core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ export * from './utils/isomorphic/urlMatch';
export * from './utils/debug';
export * from './utils/debugLogger';
export * from './utils/env';
export * from './utils/eventsHelper';
export * from './utils/expectUtils';
export * from './utils/hostPlatform';
export * from './utils/isomorphic/headers';
export * from './utils/isomorphic/semaphore';
Expand All @@ -42,6 +40,8 @@ export * from './utils/zones';
export * from './server/utils/ascii';
export * from './server/utils/comparators';
export * from './server/utils/crypto';
export * from './server/utils/eventsHelper';
export * from './server/utils/expectUtils';
export * from './server/utils/fileUtils';
export * from './server/utils/httpServer';
export * from './server/utils/network';
Expand Down

0 comments on commit c31ce78

Please sign in to comment.