Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: move registry & dispatchers to under server (#13370)
Pavel Feldmanbde7bf4ea9a7
diff --git a/packages/playwright-chromium/install.js b/packages/playwright-chromium/install.jsindex 917aa2d5f8..de1e9455d3 100644--- a/packages/playwright-chromium/install.js+++ b/packages/playwright-chromium/install.js@@ -17,7 +17,7 @@let install;try {- install = require('playwright-core/lib/utils/registry').installBrowsersForNpmInstall;+ install = require('playwright-core/lib/server').registry.installBrowsersForNpmInstall;} catch (e) {// Dev build, don't install browsers by default.}diff --git a/packages/playwright-core/package.json b/packages/playwright-core/package.jsonindex 5e89947eb5..aa934e5334 100644--- a/packages/playwright-core/package.json+++ b/packages/playwright-core/package.json@@ -27,11 +27,11 @@"./lib/utils/httpServer": "./lib/utils/httpServer.js","./lib/utils/multimap": "./lib/utils/multimap.js","./lib/utils/processLauncher": "./lib/utils/processLauncher.js",- "./lib/utils/registry": "./lib/utils/registry.js","./lib/utils/utils": "./lib/utils/utils.js","./lib/utils/stackTrace": "./lib/utils/stackTrace.js","./lib/remote/playwrightServer": "./lib/remote/playwrightServer.js",- "./lib/remote/playwrightClient": "./lib/remote/playwrightClient.js"+ "./lib/remote/playwrightClient": "./lib/remote/playwrightClient.js",+ "./lib/server": "./lib/server/index.js"},"types": "types/types.d.ts","bin": {diff --git a/packages/playwright-core/src/cli/DEPS.list b/packages/playwright-core/src/cli/DEPS.listindex 895b967f15..ecb310f898 100644--- a/packages/playwright-core/src/cli/DEPS.list+++ b/packages/playwright-core/src/cli/DEPS.list@@ -10,6 +10,7 @@[cli.ts]../server/trace/viewer/traceViewer.ts+../server/[driver.ts]../**diff --git a/packages/playwright-core/src/cli/cli.ts b/packages/playwright-core/src/cli/cli.tsindex 247eedeec7..489c73e881 100755--- a/packages/playwright-core/src/cli/cli.ts+++ b/packages/playwright-core/src/cli/cli.ts@@ -32,13 +32,12 @@ import type { Page } from '../client/page';import type { BrowserType } from '../client/browserType';import type { BrowserContextOptions, LaunchOptions } from '../client/types';import { spawn } from 'child_process';-import type { Executable } from '../utils/registry';-import { registry } from '../utils/registry';import { spawnAsync, getPlaywrightVersion, wrapInASCIIBox } from '../utils/utils';-import { writeDockerVersion } from '../utils/dependencies';import { launchGridAgent } from '../grid/gridAgent';import type { GridFactory } from '../grid/gridServer';import { GridServer } from '../grid/gridServer';+import type { Executable } from '../server';+import { registry, writeDockerVersion } from '../server';const packageJSON = require('../../package.json');diff --git a/packages/playwright-core/src/cli/driver.ts b/packages/playwright-core/src/cli/driver.tsindex 50a5df46a0..31145ad00d 100644--- a/packages/playwright-core/src/cli/driver.ts+++ b/packages/playwright-core/src/cli/driver.ts@@ -20,11 +20,9 @@ import fs from 'fs';import * as playwright from '../..';import type { BrowserType } from '../client/browserType';import type { LaunchServerOptions } from '../client/types';-import { DispatcherConnection, Root } from '../dispatchers/dispatcher';-import { PlaywrightDispatcher } from '../dispatchers/playwrightDispatcher';+import { createPlaywright, DispatcherConnection, Root, PlaywrightDispatcher } from '../server';import { IpcTransport, PipeTransport } from '../protocol/transport';import { PlaywrightServer } from '../remote/playwrightServer';-import { createPlaywright } from '../server/playwright';import { gracefullyCloseAll } from '../utils/processLauncher';export function printApiJson() {diff --git a/packages/playwright-core/src/dispatchers/DEPS.list b/packages/playwright-core/src/dispatchers/DEPS.listdeleted file mode 100644index bfe76021c0..0000000000--- a/packages/playwright-core/src/dispatchers/DEPS.list+++ /dev/null@@ -1,4 +0,0 @@-[*]-../protocol/-../server/**-../utils/diff --git a/packages/playwright-core/src/grid/gridWorker.ts b/packages/playwright-core/src/grid/gridWorker.tsindex 5e1e6b9f6f..351f694a90 100644--- a/packages/playwright-core/src/grid/gridWorker.ts+++ b/packages/playwright-core/src/grid/gridWorker.ts@@ -16,9 +16,7 @@import WebSocket from 'ws';import debug from 'debug';-import { DispatcherConnection, Root } from '../dispatchers/dispatcher';-import { PlaywrightDispatcher } from '../dispatchers/playwrightDispatcher';-import { createPlaywright } from '../server/playwright';+import { createPlaywright, PlaywrightDispatcher, DispatcherConnection, Root } from '../server';import { gracefullyCloseAll } from '../utils/processLauncher';import { SocksProxy } from '../utils/socksProxy';diff --git a/packages/playwright-core/src/inProcessFactory.ts b/packages/playwright-core/src/inProcessFactory.tsindex 4ef876fb8d..2abf2e6fac 100644--- a/packages/playwright-core/src/inProcessFactory.ts+++ b/packages/playwright-core/src/inProcessFactory.ts@@ -14,10 +14,8 @@* limitations under the License.*/-import { DispatcherConnection, Root } from './dispatchers/dispatcher';-import { createPlaywright } from './server/playwright';import type { Playwright as PlaywrightAPI } from './client/playwright';-import { PlaywrightDispatcher } from './dispatchers/playwrightDispatcher';+import { createPlaywright, DispatcherConnection, Root, PlaywrightDispatcher } from './server';import { Connection } from './client/connection';import { BrowserServerLauncherImpl } from './browserServerImpl';diff --git a/packages/playwright-core/src/remote/playwrightConnection.ts b/packages/playwright-core/src/remote/playwrightConnection.tsindex 0a4cb56170..001d9dbaef 100644--- a/packages/playwright-core/src/remote/playwrightConnection.ts+++ b/packages/playwright-core/src/remote/playwrightConnection.ts@@ -15,15 +15,12 @@*/import type WebSocket from 'ws';-import type { DispatcherScope } from '../dispatchers/dispatcher';-import { DispatcherConnection, Root } from '../dispatchers/dispatcher';-import { PlaywrightDispatcher } from '../dispatchers/playwrightDispatcher';+import type { Playwright, DispatcherScope } from '../server';+import { createPlaywright, DispatcherConnection, Root, PlaywrightDispatcher } from '../server';import { Browser } from '../server/browser';import { serverSideCallMetadata } from '../server/instrumentation';-import type { Playwright } from '../server/playwright';-import { createPlaywright } from '../server/playwright';import { gracefullyCloseAll } from '../utils/processLauncher';-import { registry } from '../utils/registry';+import { registry } from '../server';import { SocksProxy } from '../utils/socksProxy';export class PlaywrightConnection {diff --git a/packages/playwright-core/src/server/browserType.ts b/packages/playwright-core/src/server/browserType.tsindex e0e4b31388..70417bf3e2 100644--- a/packages/playwright-core/src/server/browserType.ts+++ b/packages/playwright-core/src/server/browserType.ts@@ -19,8 +19,8 @@ import * as os from 'os';import path from 'path';import type { BrowserContext } from './browserContext';import { normalizeProxySettings, validateBrowserContextOptions } from './browserContext';-import type { BrowserName } from '../utils/registry';-import { registry } from '../utils/registry';+import type { BrowserName } from './registry';+import { registry } from './registry';import type { ConnectionTransport } from './transport';import { WebSocketTransport } from './transport';import type { BrowserOptions, Browser, BrowserProcess, PlaywrightOptions } from './browser';diff --git a/packages/playwright-core/src/server/chromium/chromium.ts b/packages/playwright-core/src/server/chromium/chromium.tsindex 2f39ec9efc..7dc95ad6c2 100644--- a/packages/playwright-core/src/server/chromium/chromium.ts+++ b/packages/playwright-core/src/server/chromium/chromium.ts@@ -40,7 +40,7 @@ import { helper } from '../helper';import type { CallMetadata } from '../instrumentation';import http from 'http';import https from 'https';-import { registry } from '../../utils/registry';+import { registry } from '../registry';import { ManualPromise } from '../../utils/async';const ARTIFACTS_FOLDER = path.join(os.tmpdir(), 'playwright-artifacts-');diff --git a/packages/playwright-core/src/server/chromium/crPage.ts b/packages/playwright-core/src/server/chromium/crPage.tsindex 20f63c6d12..6c917229a5 100644--- a/packages/playwright-core/src/server/chromium/crPage.ts+++ b/packages/playwright-core/src/server/chromium/crPage.ts@@ -18,7 +18,7 @@import path from 'path';import type { RegisteredListener } from '../../utils/eventsHelper';import { eventsHelper } from '../../utils/eventsHelper';-import { registry } from '../../utils/registry';+import { registry } from '../registry';import { rewriteErrorMessage } from '../../utils/stackTrace';import { assert, createGuid, headersArrayToObject } from '../../utils/utils';import * as dialog from '../dialog';diff --git a/packages/playwright-core/src/server/dispatchers/DEPS.list b/packages/playwright-core/src/server/dispatchers/DEPS.listnew file mode 100644index 0000000000..67b5329151--- /dev/null+++ b/packages/playwright-core/src/server/dispatchers/DEPS.list@@ -0,0 +1,4 @@+[*]+../../protocol/+../../utils/+../**diff --git a/packages/playwright-core/src/dispatchers/androidDispatcher.ts b/packages/playwright-core/src/server/dispatchers/androidDispatcher.tssimilarity index 97%rename from packages/playwright-core/src/dispatchers/androidDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/androidDispatcher.tsindex caad182506..2fd3624650 100644--- a/packages/playwright-core/src/dispatchers/androidDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/androidDispatcher.ts@@ -16,11 +16,11 @@import type { DispatcherScope } from './dispatcher';import { Dispatcher, existingDispatcher } from './dispatcher';-import type { Android, SocketBackend } from '../server/android/android';-import { AndroidDevice } from '../server/android/android';-import type * as channels from '../protocol/channels';+import type { Android, SocketBackend } from '../android/android';+import { AndroidDevice } from '../android/android';+import type * as channels from '../../protocol/channels';import { BrowserContextDispatcher } from './browserContextDispatcher';-import type { CallMetadata } from '../server/instrumentation';+import type { CallMetadata } from '../instrumentation';export class AndroidDispatcher extends Dispatcher<Android, channels.AndroidChannel> implements channels.AndroidChannel {_type_Android = true;diff --git a/packages/playwright-core/src/dispatchers/artifactDispatcher.ts b/packages/playwright-core/src/server/dispatchers/artifactDispatcher.tssimilarity index 95%rename from packages/playwright-core/src/dispatchers/artifactDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/artifactDispatcher.tsindex 3c3e19bddd..f855558484 100644--- a/packages/playwright-core/src/dispatchers/artifactDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/artifactDispatcher.ts@@ -14,13 +14,13 @@* limitations under the License.*/-import type * as channels from '../protocol/channels';+import type * as channels from '../../protocol/channels';import type { DispatcherScope } from './dispatcher';import { Dispatcher } from './dispatcher';import { StreamDispatcher } from './streamDispatcher';import fs from 'fs';-import { mkdirIfNeeded } from '../utils/utils';-import type { Artifact } from '../server/artifact';+import { mkdirIfNeeded } from '../../utils/utils';+import type { Artifact } from '../artifact';export class ArtifactDispatcher extends Dispatcher<Artifact, channels.ArtifactChannel> implements channels.ArtifactChannel {_type_Artifact = true;diff --git a/packages/playwright-core/src/dispatchers/browserContextDispatcher.ts b/packages/playwright-core/src/server/dispatchers/browserContextDispatcher.tssimilarity index 95%rename from packages/playwright-core/src/dispatchers/browserContextDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/browserContextDispatcher.tsindex 13e2ae2d93..9b0fa52be8 100644--- a/packages/playwright-core/src/dispatchers/browserContextDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/browserContextDispatcher.ts@@ -14,24 +14,24 @@* limitations under the License.*/-import { BrowserContext } from '../server/browserContext';+import { BrowserContext } from '../browserContext';import type { DispatcherScope } from './dispatcher';import { Dispatcher, lookupDispatcher } from './dispatcher';import { PageDispatcher, BindingCallDispatcher, WorkerDispatcher } from './pageDispatcher';import type { FrameDispatcher } from './frameDispatcher';-import type * as channels from '../protocol/channels';+import type * as channels from '../../protocol/channels';import { RouteDispatcher, RequestDispatcher, ResponseDispatcher, APIRequestContextDispatcher } from './networkDispatchers';-import { CRBrowserContext } from '../server/chromium/crBrowser';+import { CRBrowserContext } from '../chromium/crBrowser';import { CDPSessionDispatcher } from './cdpSessionDispatcher';-import { RecorderSupplement } from '../server/supplements/recorderSupplement';-import type { CallMetadata } from '../server/instrumentation';+import { RecorderSupplement } from '../supplements/recorderSupplement';+import type { CallMetadata } from '../instrumentation';import { ArtifactDispatcher } from './artifactDispatcher';-import type { Artifact } from '../server/artifact';-import type { Request, Response } from '../server/network';+import type { Artifact } from '../artifact';+import type { Request, Response } from '../network';import { TracingDispatcher } from './tracingDispatcher';import * as fs from 'fs';import * as path from 'path';-import { createGuid } from '../utils/utils';+import { createGuid } from '../../utils/utils';import { WritableStreamDispatcher } from './writableStreamDispatcher';export class BrowserContextDispatcher extends Dispatcher<BrowserContext, channels.BrowserContextChannel> implements channels.BrowserContextChannel {diff --git a/packages/playwright-core/src/dispatchers/browserDispatcher.ts b/packages/playwright-core/src/server/dispatchers/browserDispatcher.tssimilarity index 93%rename from packages/playwright-core/src/dispatchers/browserDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/browserDispatcher.tsindex e252e0b746..353e233f0e 100644--- a/packages/playwright-core/src/dispatchers/browserDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/browserDispatcher.ts@@ -14,18 +14,18 @@* limitations under the License.*/-import { Browser } from '../server/browser';-import type * as channels from '../protocol/channels';+import { Browser } from '../browser';+import type * as channels from '../../protocol/channels';import { BrowserContextDispatcher } from './browserContextDispatcher';import { CDPSessionDispatcher } from './cdpSessionDispatcher';import type { DispatcherScope } from './dispatcher';import { Dispatcher } from './dispatcher';-import type { CRBrowser } from '../server/chromium/crBrowser';+import type { CRBrowser } from '../chromium/crBrowser';import type { PageDispatcher } from './pageDispatcher';-import type { CallMetadata } from '../server/instrumentation';-import { serverSideCallMetadata } from '../server/instrumentation';-import { BrowserContext } from '../server/browserContext';-import { Selectors } from '../server/selectors';+import type { CallMetadata } from '../instrumentation';+import { serverSideCallMetadata } from '../instrumentation';+import { BrowserContext } from '../browserContext';+import { Selectors } from '../selectors';export class BrowserDispatcher extends Dispatcher<Browser, channels.BrowserChannel> implements channels.BrowserChannel {_type_Browser = true;diff --git a/packages/playwright-core/src/dispatchers/browserTypeDispatcher.ts b/packages/playwright-core/src/server/dispatchers/browserTypeDispatcher.tssimilarity index 94%rename from packages/playwright-core/src/dispatchers/browserTypeDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/browserTypeDispatcher.tsindex 5dd252a25e..cc45328c08 100644--- a/packages/playwright-core/src/dispatchers/browserTypeDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/browserTypeDispatcher.ts@@ -14,19 +14,19 @@* limitations under the License.*/-import type { BrowserType } from '../server/browserType';+import type { BrowserType } from '../browserType';import { BrowserDispatcher } from './browserDispatcher';-import type * as channels from '../protocol/channels';+import type * as channels from '../../protocol/channels';import type { DispatcherScope } from './dispatcher';import { Dispatcher } from './dispatcher';import { BrowserContextDispatcher } from './browserContextDispatcher';-import type { CallMetadata } from '../server/instrumentation';+import type { CallMetadata } from '../instrumentation';import { JsonPipeDispatcher } from '../dispatchers/jsonPipeDispatcher';-import { getUserAgent } from '../utils/utils';-import * as socks from '../utils/socksProxy';+import { getUserAgent } from '../../utils/utils';+import * as socks from '../../utils/socksProxy';import EventEmitter from 'events';-import { ProgressController } from '../server/progress';-import { WebSocketTransport } from '../server/transport';+import { ProgressController } from '../progress';+import { WebSocketTransport } from '../transport';export class BrowserTypeDispatcher extends Dispatcher<BrowserType, channels.BrowserTypeChannel> implements channels.BrowserTypeChannel {_type_BrowserType = true;diff --git a/packages/playwright-core/src/dispatchers/cdpSessionDispatcher.ts b/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.tssimilarity index 88%rename from packages/playwright-core/src/dispatchers/cdpSessionDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.tsindex d23ccd15ea..29007ceac0 100644--- a/packages/playwright-core/src/dispatchers/cdpSessionDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts@@ -14,9 +14,9 @@* limitations under the License.*/-import type { CRSession } from '../server/chromium/crConnection';-import { CRSessionEvents } from '../server/chromium/crConnection';-import type * as channels from '../protocol/channels';+import type { CRSession } from '../chromium/crConnection';+import { CRSessionEvents } from '../chromium/crConnection';+import type * as channels from '../../protocol/channels';import type { DispatcherScope } from './dispatcher';import { Dispatcher } from './dispatcher';diff --git a/packages/playwright-core/src/dispatchers/consoleMessageDispatcher.ts b/packages/playwright-core/src/server/dispatchers/consoleMessageDispatcher.tssimilarity index 91%rename from packages/playwright-core/src/dispatchers/consoleMessageDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/consoleMessageDispatcher.tsindex f6af34d654..48e46fcbd8 100644--- a/packages/playwright-core/src/dispatchers/consoleMessageDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/consoleMessageDispatcher.ts@@ -14,8 +14,8 @@* limitations under the License.*/-import type { ConsoleMessage } from '../server/console';-import type * as channels from '../protocol/channels';+import type { ConsoleMessage } from '../console';+import type * as channels from '../../protocol/channels';import type { DispatcherScope } from './dispatcher';import { Dispatcher } from './dispatcher';import { ElementHandleDispatcher } from './elementHandlerDispatcher';diff --git a/packages/playwright-core/src/dispatchers/dialogDispatcher.ts b/packages/playwright-core/src/server/dispatchers/dialogDispatcher.tssimilarity index 92%rename from packages/playwright-core/src/dispatchers/dialogDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/dialogDispatcher.tsindex eebb15aa27..1e5c791c8e 100644--- a/packages/playwright-core/src/dispatchers/dialogDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/dialogDispatcher.ts@@ -14,8 +14,8 @@* limitations under the License.*/-import type { Dialog } from '../server/dialog';-import type * as channels from '../protocol/channels';+import type { Dialog } from '../dialog';+import type * as channels from '../../protocol/channels';import type { DispatcherScope } from './dispatcher';import { Dispatcher } from './dispatcher';diff --git a/packages/playwright-core/src/dispatchers/dispatcher.ts b/packages/playwright-core/src/server/dispatchers/dispatcher.tssimilarity index 95%rename from packages/playwright-core/src/dispatchers/dispatcher.tsrename to packages/playwright-core/src/server/dispatchers/dispatcher.tsindex a7c806c35d..ca7943dc7b 100644--- a/packages/playwright-core/src/dispatchers/dispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/dispatcher.ts@@ -15,16 +15,16 @@*/import { EventEmitter } from 'events';-import type * as channels from '../protocol/channels';-import { serializeError } from '../protocol/serializers';-import type { Validator } from '../protocol/validator';-import { createScheme, ValidationError } from '../protocol/validator';-import { assert, debugAssert, isUnderTest, monotonicTime } from '../utils/utils';-import { tOptional } from '../protocol/validatorPrimitives';-import { kBrowserOrContextClosedError } from '../utils/errors';-import type { CallMetadata } from '../server/instrumentation';-import { SdkObject } from '../server/instrumentation';-import { rewriteErrorMessage } from '../utils/stackTrace';+import type * as channels from '../../protocol/channels';+import { serializeError } from '../../protocol/serializers';+import type { Validator } from '../../protocol/validator';+import { createScheme, ValidationError } from '../../protocol/validator';+import { assert, debugAssert, isUnderTest, monotonicTime } from '../../utils/utils';+import { tOptional } from '../../protocol/validatorPrimitives';+import { kBrowserOrContextClosedError } from '../../utils/errors';+import type { CallMetadata } from '../instrumentation';+import { SdkObject } from '../instrumentation';+import { rewriteErrorMessage } from '../../utils/stackTrace';import type { PlaywrightDispatcher } from './playwrightDispatcher';export const dispatcherSymbol = Symbol('dispatcher');diff --git a/packages/playwright-core/src/dispatchers/electronDispatcher.ts b/packages/playwright-core/src/server/dispatchers/electronDispatcher.tssimilarity index 94%rename from packages/playwright-core/src/dispatchers/electronDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/electronDispatcher.tsindex ba23edcf1a..a90bc6a0f9 100644--- a/packages/playwright-core/src/dispatchers/electronDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/electronDispatcher.ts@@ -16,9 +16,9 @@import type { DispatcherScope } from './dispatcher';import { Dispatcher } from './dispatcher';-import type { Electron } from '../server/electron/electron';-import { ElectronApplication } from '../server/electron/electron';-import type * as channels from '../protocol/channels';+import type { Electron } from '../electron/electron';+import { ElectronApplication } from '../electron/electron';+import type * as channels from '../../protocol/channels';import { BrowserContextDispatcher } from './browserContextDispatcher';import type { PageDispatcher } from './pageDispatcher';import { parseArgument, serializeResult } from './jsHandleDispatcher';diff --git a/packages/playwright-core/src/dispatchers/elementHandlerDispatcher.ts b/packages/playwright-core/src/server/dispatchers/elementHandlerDispatcher.tssimilarity index 97%rename from packages/playwright-core/src/dispatchers/elementHandlerDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/elementHandlerDispatcher.tsindex c422d1d099..2b87644ba8 100644--- a/packages/playwright-core/src/dispatchers/elementHandlerDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/elementHandlerDispatcher.ts@@ -14,15 +14,15 @@* limitations under the License.*/-import type { ElementHandle } from '../server/dom';-import type { Frame } from '../server/frames';-import type * as js from '../server/javascript';-import type * as channels from '../protocol/channels';+import type { ElementHandle } from '../dom';+import type { Frame } from '../frames';+import type * as js from '../javascript';+import type * as channels from '../../protocol/channels';import type { DispatcherScope } from './dispatcher';import { existingDispatcher, lookupNullableDispatcher } from './dispatcher';import { JSHandleDispatcher, serializeResult, parseArgument } from './jsHandleDispatcher';import type { FrameDispatcher } from './frameDispatcher';-import type { CallMetadata } from '../server/instrumentation';+import type { CallMetadata } from '../instrumentation';import type { WritableStreamDispatcher } from './writableStreamDispatcher';export class ElementHandleDispatcher extends JSHandleDispatcher implements channels.ElementHandleChannel {diff --git a/packages/playwright-core/src/dispatchers/frameDispatcher.ts b/packages/playwright-core/src/server/dispatchers/frameDispatcher.tssimilarity index 98%rename from packages/playwright-core/src/dispatchers/frameDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/frameDispatcher.tsindex 0064d6943f..1fef3a3c73 100644--- a/packages/playwright-core/src/dispatchers/frameDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/frameDispatcher.ts@@ -14,16 +14,16 @@* limitations under the License.*/-import type { NavigationEvent } from '../server/frames';-import { Frame } from '../server/frames';-import type * as channels from '../protocol/channels';+import type { NavigationEvent } from '../frames';+import { Frame } from '../frames';+import type * as channels from '../../protocol/channels';import type { DispatcherScope } from './dispatcher';import { Dispatcher, lookupNullableDispatcher, existingDispatcher } from './dispatcher';import { ElementHandleDispatcher } from './elementHandlerDispatcher';import { parseArgument, serializeResult } from './jsHandleDispatcher';import type { ResponseDispatcher } from './networkDispatchers';import { RequestDispatcher } from './networkDispatchers';-import type { CallMetadata } from '../server/instrumentation';+import type { CallMetadata } from '../instrumentation';import type { WritableStreamDispatcher } from './writableStreamDispatcher';export class FrameDispatcher extends Dispatcher<Frame, channels.FrameChannel> implements channels.FrameChannel {diff --git a/packages/playwright-core/src/dispatchers/jsHandleDispatcher.ts b/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.tssimilarity index 94%rename from packages/playwright-core/src/dispatchers/jsHandleDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.tsindex 45dd36d0d0..5364b71e8a 100644--- a/packages/playwright-core/src/dispatchers/jsHandleDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts@@ -14,12 +14,12 @@* limitations under the License.*/-import type * as js from '../server/javascript';-import type * as channels from '../protocol/channels';+import type * as js from '../javascript';+import type * as channels from '../../protocol/channels';import type { DispatcherScope } from './dispatcher';import { Dispatcher } from './dispatcher';import { ElementHandleDispatcher } from './elementHandlerDispatcher';-import { parseSerializedValue, serializeValue } from '../protocol/serializers';+import { parseSerializedValue, serializeValue } from '../../protocol/serializers';export class JSHandleDispatcher extends Dispatcher<js.JSHandle, channels.JSHandleChannel> implements channels.JSHandleChannel {_type_JSHandle = true;diff --git a/packages/playwright-core/src/dispatchers/jsonPipeDispatcher.ts b/packages/playwright-core/src/server/dispatchers/jsonPipeDispatcher.tssimilarity index 90%rename from packages/playwright-core/src/dispatchers/jsonPipeDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/jsonPipeDispatcher.tsindex 0b4c19309b..57fee7896b 100644--- a/packages/playwright-core/src/dispatchers/jsonPipeDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/jsonPipeDispatcher.ts@@ -14,11 +14,11 @@* limitations under the License.*/-import type * as channels from '../protocol/channels';+import type * as channels from '../../protocol/channels';import type { DispatcherScope } from './dispatcher';import { Dispatcher } from './dispatcher';-import { createGuid } from '../utils/utils';-import { serializeError } from '../protocol/serializers';+import { createGuid } from '../../utils/utils';+import { serializeError } from '../../protocol/serializers';export class JsonPipeDispatcher extends Dispatcher<{ guid: string }, channels.JsonPipeChannel> implements channels.JsonPipeChannel {_type_JsonPipe = true;diff --git a/packages/playwright-core/src/dispatchers/localUtilsDispatcher.ts b/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.tssimilarity index 94%rename from packages/playwright-core/src/dispatchers/localUtilsDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.tsindex 6af8f72d13..48919b846b 100644--- a/packages/playwright-core/src/dispatchers/localUtilsDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.ts@@ -19,9 +19,9 @@ import fs from 'fs';import path from 'path';import yauzl from 'yauzl';import yazl from 'yazl';-import type * as channels from '../protocol/channels';-import { ManualPromise } from '../utils/async';-import { assert, createGuid } from '../utils/utils';+import type * as channels from '../../protocol/channels';+import { ManualPromise } from '../../utils/async';+import { assert, createGuid } from '../../utils/utils';import type { DispatcherScope } from './dispatcher';import { Dispatcher } from './dispatcher';diff --git a/packages/playwright-core/src/dispatchers/networkDispatchers.ts b/packages/playwright-core/src/server/dispatchers/networkDispatchers.tssimilarity index 96%rename from packages/playwright-core/src/dispatchers/networkDispatchers.tsrename to packages/playwright-core/src/server/dispatchers/networkDispatchers.tsindex e527a6bdf7..92def4f431 100644--- a/packages/playwright-core/src/dispatchers/networkDispatchers.ts+++ b/packages/playwright-core/src/server/dispatchers/networkDispatchers.ts@@ -14,11 +14,11 @@* limitations under the License.*/-import type * as channels from '../protocol/channels';-import { APIRequestContext } from '../server/fetch';-import type { CallMetadata } from '../server/instrumentation';-import type { Request, Response, Route } from '../server/network';-import { WebSocket } from '../server/network';+import type * as channels from '../../protocol/channels';+import { APIRequestContext } from '../fetch';+import type { CallMetadata } from '../instrumentation';+import type { Request, Response, Route } from '../network';+import { WebSocket } from '../network';import type { DispatcherScope } from './dispatcher';import { Dispatcher, existingDispatcher, lookupNullableDispatcher } from './dispatcher';import { FrameDispatcher } from './frameDispatcher';diff --git a/packages/playwright-core/src/dispatchers/pageDispatcher.ts b/packages/playwright-core/src/server/dispatchers/pageDispatcher.tssimilarity index 95%rename from packages/playwright-core/src/dispatchers/pageDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/pageDispatcher.tsindex 5508a1b35a..41430cedf2 100644--- a/packages/playwright-core/src/dispatchers/pageDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts@@ -14,13 +14,13 @@* limitations under the License.*/-import type { BrowserContext } from '../server/browserContext';-import type { Frame } from '../server/frames';-import { Page, Worker } from '../server/page';-import type * as channels from '../protocol/channels';+import type { BrowserContext } from '../browserContext';+import type { Frame } from '../frames';+import { Page, Worker } from '../page';+import type * as channels from '../../protocol/channels';import type { DispatcherScope } from './dispatcher';import { Dispatcher, existingDispatcher, lookupDispatcher, lookupNullableDispatcher } from './dispatcher';-import { parseError, serializeError } from '../protocol/serializers';+import { parseError, serializeError } from '../../protocol/serializers';import { ConsoleMessageDispatcher } from './consoleMessageDispatcher';import { DialogDispatcher } from './dialogDispatcher';import { FrameDispatcher } from './frameDispatcher';@@ -28,14 +28,14 @@ import type { ResponseDispatcher } from './networkDispatchers';import { RequestDispatcher, RouteDispatcher, WebSocketDispatcher } from './networkDispatchers';import { serializeResult, parseArgument } from './jsHandleDispatcher';import { ElementHandleDispatcher } from './elementHandlerDispatcher';-import type { FileChooser } from '../server/fileChooser';-import type { CRCoverage } from '../server/chromium/crCoverage';-import type { JSHandle } from '../server/javascript';-import type { CallMetadata } from '../server/instrumentation';-import type { Artifact } from '../server/artifact';+import type { FileChooser } from '../fileChooser';+import type { CRCoverage } from '../chromium/crCoverage';+import type { JSHandle } from '../javascript';+import type { CallMetadata } from '../instrumentation';+import type { Artifact } from '../artifact';import { ArtifactDispatcher } from './artifactDispatcher';-import type { Download } from '../server/download';-import { createGuid } from '../utils/utils';+import type { Download } from '../download';+import { createGuid } from '../../utils/utils';export class PageDispatcher extends Dispatcher<Page, channels.PageChannel> implements channels.PageChannel {_type_EventTarget = true;diff --git a/packages/playwright-core/src/dispatchers/playwrightDispatcher.ts b/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.tssimilarity index 90%rename from packages/playwright-core/src/dispatchers/playwrightDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/playwrightDispatcher.tsindex 9b2f671978..2e64c6bbe5 100644--- a/packages/playwright-core/src/dispatchers/playwrightDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts@@ -14,13 +14,13 @@* limitations under the License.*/-import type * as channels from '../protocol/channels';-import type { Browser } from '../server/browser';-import { GlobalAPIRequestContext } from '../server/fetch';-import type { Playwright } from '../server/playwright';-import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../utils/socksProxy';-import { SocksProxy } from '../utils/socksProxy';-import type * as types from '../server/types';+import type * as channels from '../../protocol/channels';+import type { Browser } from '../browser';+import { GlobalAPIRequestContext } from '../fetch';+import type { Playwright } from '../playwright';+import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../../utils/socksProxy';+import { SocksProxy } from '../../utils/socksProxy';+import type * as types from '../types';import { AndroidDispatcher } from './androidDispatcher';import { BrowserTypeDispatcher } from './browserTypeDispatcher';import type { DispatcherScope } from './dispatcher';@@ -30,14 +30,14 @@ import { LocalUtilsDispatcher } from './localUtilsDispatcher';import { APIRequestContextDispatcher } from './networkDispatchers';import { SelectorsDispatcher } from './selectorsDispatcher';import { ConnectedBrowserDispatcher } from './browserDispatcher';-import { createGuid } from '../utils/utils';+import { createGuid } from '../../utils/utils';export class PlaywrightDispatcher extends Dispatcher<Playwright, channels.PlaywrightChannel> implements channels.PlaywrightChannel {_type_Playwright;private _browserDispatcher: ConnectedBrowserDispatcher | undefined;constructor(scope: DispatcherScope, playwright: Playwright, socksProxy?: SocksProxy, preLaunchedBrowser?: Browser) {- const descriptors = require('../server/deviceDescriptors') as types.Devices;+ const descriptors = require('../deviceDescriptors') as types.Devices;const deviceDescriptors = Object.entries(descriptors).map(([name, descriptor]) => ({ name, descriptor }));const browserDispatcher = preLaunchedBrowser ? new ConnectedBrowserDispatcher(scope, preLaunchedBrowser) : undefined;diff --git a/packages/playwright-core/src/dispatchers/selectorsDispatcher.ts b/packages/playwright-core/src/server/dispatchers/selectorsDispatcher.tssimilarity index 91%rename from packages/playwright-core/src/dispatchers/selectorsDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/selectorsDispatcher.tsindex d137ee24fc..8aaa381445 100644--- a/packages/playwright-core/src/dispatchers/selectorsDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/selectorsDispatcher.ts@@ -16,8 +16,8 @@import type { DispatcherScope } from './dispatcher';import { Dispatcher } from './dispatcher';-import type * as channels from '../protocol/channels';-import type { Selectors } from '../server/selectors';+import type * as channels from '../../protocol/channels';+import type { Selectors } from '../selectors';export class SelectorsDispatcher extends Dispatcher<Selectors, channels.SelectorsChannel> implements channels.SelectorsChannel {_type_Selectors = true;diff --git a/packages/playwright-core/src/dispatchers/streamDispatcher.ts b/packages/playwright-core/src/server/dispatchers/streamDispatcher.tssimilarity index 94%rename from packages/playwright-core/src/dispatchers/streamDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/streamDispatcher.tsindex 5bc15f6e8f..4ceeba8bbc 100644--- a/packages/playwright-core/src/dispatchers/streamDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/streamDispatcher.ts@@ -14,11 +14,11 @@* limitations under the License.*/-import type * as channels from '../protocol/channels';+import type * as channels from '../../protocol/channels';import type { DispatcherScope } from './dispatcher';import { Dispatcher } from './dispatcher';import type * as stream from 'stream';-import { createGuid } from '../utils/utils';+import { createGuid } from '../../utils/utils';export class StreamDispatcher extends Dispatcher<{ guid: string, stream: stream.Readable }, channels.StreamChannel> implements channels.StreamChannel {_type_Stream = true;diff --git a/packages/playwright-core/src/dispatchers/tracingDispatcher.ts b/packages/playwright-core/src/server/dispatchers/tracingDispatcher.tssimilarity index 94%rename from packages/playwright-core/src/dispatchers/tracingDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/tracingDispatcher.tsindex afc743086c..3b7059df64 100644--- a/packages/playwright-core/src/dispatchers/tracingDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts@@ -14,8 +14,8 @@* limitations under the License.*/-import type * as channels from '../protocol/channels';-import { Tracing } from '../server/trace/recorder/tracing';+import type * as channels from '../../protocol/channels';+import { Tracing } from '../trace/recorder/tracing';import { ArtifactDispatcher } from './artifactDispatcher';import type { DispatcherScope } from './dispatcher';import { Dispatcher, existingDispatcher } from './dispatcher';diff --git a/packages/playwright-core/src/dispatchers/writableStreamDispatcher.ts b/packages/playwright-core/src/server/dispatchers/writableStreamDispatcher.tssimilarity index 93%rename from packages/playwright-core/src/dispatchers/writableStreamDispatcher.tsrename to packages/playwright-core/src/server/dispatchers/writableStreamDispatcher.tsindex e98c38f32a..e1b281fb52 100644--- a/packages/playwright-core/src/dispatchers/writableStreamDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/writableStreamDispatcher.ts@@ -14,11 +14,11 @@* limitations under the License.*/-import type * as channels from '../protocol/channels';+import type * as channels from '../../protocol/channels';import type { DispatcherScope } from './dispatcher';import { Dispatcher } from './dispatcher';import type * as fs from 'fs';-import { createGuid } from '../utils/utils';+import { createGuid } from '../../utils/utils';export class WritableStreamDispatcher extends Dispatcher<{ guid: string, stream: fs.WriteStream }, channels.WritableStreamChannel> implements channels.WritableStreamChannel {_type_WritableStream = true;diff --git a/packages/playwright-core/src/server/index.ts b/packages/playwright-core/src/server/index.tsnew file mode 100644index 0000000000..bc44948094--- /dev/null+++ b/packages/playwright-core/src/server/index.ts@@ -0,0 +1,25 @@+/**+ * 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 type { Executable } from './registry';+export { registry, writeDockerVersion, Registry, registryDirectory } from './registry';++export { DispatcherConnection, Root } from './dispatchers/dispatcher';+export { PlaywrightDispatcher } from './dispatchers/playwrightDispatcher';+export { createPlaywright } from './playwright';++export type { DispatcherScope } from './dispatchers/dispatcher';+export type { Playwright } from './playwright';diff --git a/packages/playwright-core/src/utils/browserFetcher.ts b/packages/playwright-core/src/server/registry/browserFetcher.tssimilarity index 94%rename from packages/playwright-core/src/utils/browserFetcher.tsrename to packages/playwright-core/src/server/registry/browserFetcher.tsindex 5089a4debe..06674aa8d1 100644--- a/packages/playwright-core/src/utils/browserFetcher.ts+++ b/packages/playwright-core/src/server/registry/browserFetcher.ts@@ -19,8 +19,8 @@ import extract from 'extract-zip';import fs from 'fs';import os from 'os';import path from 'path';-import { existsAsync, download, getUserAgent } from './utils';-import { debugLogger } from './debugLogger';+import { existsAsync, download, getUserAgent } from '../../utils/utils';+import { debugLogger } from '../../utils/debugLogger';export async function downloadBrowserWithProgressBar(title: string, browserDirectory: string, executablePath: string, downloadURL: string, downloadFileName: string): Promise<boolean> {const progressBarName = `Playwright build of ${title}`;diff --git a/packages/playwright-core/src/utils/dependencies.ts b/packages/playwright-core/src/server/registry/dependencies.tssimilarity index 97%rename from packages/playwright-core/src/utils/dependencies.tsrename to packages/playwright-core/src/server/registry/dependencies.tsindex b05d0ee738..3ccaa79077 100644--- a/packages/playwright-core/src/utils/dependencies.ts+++ b/packages/playwright-core/src/server/registry/dependencies.ts@@ -18,13 +18,13 @@ import fs from 'fs';import path from 'path';import * as os from 'os';import childProcess from 'child_process';-import * as utils from './utils';-import { buildPlaywrightCLICommand } from './registry';+import * as utils from '../../utils/utils';+import { buildPlaywrightCLICommand } from '.';import { deps } from './nativeDeps';-import { getUbuntuVersion } from './ubuntuVersion';+import { getUbuntuVersion } from '../../utils/ubuntuVersion';-const BIN_DIRECTORY = path.join(__dirname, '..', '..', 'bin');-const packageJSON = require('../../package.json');+const BIN_DIRECTORY = path.join(__dirname, '..', '..', '..', 'bin');+const packageJSON = require('../../../package.json');const dockerVersionFilePath = '/ms-playwright/.docker-info';export async function writeDockerVersion(dockerImageNameTemplate: string) {@@ -284,7 +284,7 @@ async function executablesOrSharedLibraries(directoryPath: string): Promise<stri}async function missingFileDependenciesWindows(filePath: string): Promise<Array<string>> {- const executable = path.join(__dirname, '..', '..', 'bin', 'PrintDeps.exe');+ const executable = path.join(__dirname, '..', '..', '..', 'bin', 'PrintDeps.exe');const dirname = path.dirname(filePath);const { stdout, code } = await utils.spawnAsync(executable, [filePath], {cwd: dirname,diff --git a/packages/playwright-core/src/utils/registry.ts b/packages/playwright-core/src/server/registry/index.tssimilarity index 98%rename from packages/playwright-core/src/utils/registry.tsrename to packages/playwright-core/src/server/registry/index.tsindex 5912ccebaa..9aa93643a4 100644--- a/packages/playwright-core/src/utils/registry.ts+++ b/packages/playwright-core/src/server/registry/index.ts@@ -20,14 +20,15 @@ import path from 'path';import * as util from 'util';import * as fs from 'fs';import lockfile from 'proper-lockfile';-import { getUbuntuVersion } from './ubuntuVersion';-import { getFromENV, getAsBooleanFromENV, getClientLanguage, calculateSha1, removeFolders, existsAsync, hostPlatform, canAccessFile, spawnAsync, fetchData, wrapInASCIIBox, transformCommandsForRoot } from './utils';+import { getUbuntuVersion } from '../../utils/ubuntuVersion';+import { getFromENV, getAsBooleanFromENV, getClientLanguage, calculateSha1, removeFolders, existsAsync, hostPlatform, canAccessFile, spawnAsync, fetchData, wrapInASCIIBox, transformCommandsForRoot } from '../../utils/utils';import type { DependencyGroup } from './dependencies';import { installDependenciesLinux, installDependenciesWindows, validateDependenciesLinux, validateDependenciesWindows } from './dependencies';import { downloadBrowserWithProgressBar, logPolitely } from './browserFetcher';+export { writeDockerVersion } from './dependencies';-const PACKAGE_PATH = path.join(__dirname, '..', '..');-const BIN_PATH = path.join(__dirname, '..', '..', 'bin');+const PACKAGE_PATH = path.join(__dirname, '..', '..', '..');+const BIN_PATH = path.join(__dirname, '..', '..', '..', 'bin');const EXECUTABLE_PATHS = {'chromium': {@@ -162,7 +163,7 @@ export const registryDirectory = (() => {const envDefined = getFromENV('PLAYWRIGHT_BROWSERS_PATH');if (envDefined === '0') {- result = path.join(__dirname, '..', '..', '.local-browsers');+ result = path.join(__dirname, '..', '..', '..', '.local-browsers');} else if (envDefined) {result = envDefined;} else {@@ -820,4 +821,4 @@ export function findChromiumChannel(sdkLanguage: string): string | undefined {return channel;}-export const registry = new Registry(require('../../browsers.json'));+export const registry = new Registry(require('../../../browsers.json'));diff --git a/packages/playwright-core/src/utils/nativeDeps.ts b/packages/playwright-core/src/server/registry/nativeDeps.tssimilarity index 100%rename from packages/playwright-core/src/utils/nativeDeps.tsrename to packages/playwright-core/src/server/registry/nativeDeps.tsdiff --git a/packages/playwright-core/src/server/supplements/recorder/recorderApp.ts b/packages/playwright-core/src/server/supplements/recorder/recorderApp.tsindex e851cdff2c..41c70e3d60 100644--- a/packages/playwright-core/src/server/supplements/recorder/recorderApp.ts+++ b/packages/playwright-core/src/server/supplements/recorder/recorderApp.ts@@ -24,7 +24,7 @@ import type { CallLog, EventData, Mode, Source } from './recorderTypes';import { isUnderTest } from '../../../utils/utils';import * as mime from 'mime';import { installAppIcon } from '../../chromium/crApp';-import { findChromiumChannel } from '../../../utils/registry';+import { findChromiumChannel } from '../../registry';declare global {interface Window {diff --git a/packages/playwright-core/src/server/trace/viewer/traceViewer.ts b/packages/playwright-core/src/server/trace/viewer/traceViewer.tsindex 530d124146..1c28d5e6e4 100644--- a/packages/playwright-core/src/server/trace/viewer/traceViewer.ts+++ b/packages/playwright-core/src/server/trace/viewer/traceViewer.ts@@ -18,7 +18,7 @@ import path from 'path';import fs from 'fs';import * as consoleApiSource from '../../../generated/consoleApiSource';import { HttpServer } from '../../../utils/httpServer';-import { findChromiumChannel } from '../../../utils/registry';+import { findChromiumChannel } from '../../registry';import { isUnderTest } from '../../../utils/utils';import type { BrowserContext } from '../../browserContext';import { installAppIcon } from '../../chromium/crApp';diff --git a/packages/playwright-core/src/utils/httpServer.ts b/packages/playwright-core/src/utils/httpServer.tsindex 60bf243ab2..fe6ffdee93 100644--- a/packages/playwright-core/src/utils/httpServer.ts+++ b/packages/playwright-core/src/utils/httpServer.ts@@ -20,7 +20,6 @@ import path from 'path';import { Server as WebSocketServer } from 'ws';import * as mime from 'mime';import { assert } from './utils';-import type { VirtualFileSystem } from './vfs';export type ServerRouteHandler = (request: http.IncomingMessage, response: http.ServerResponse) => boolean;@@ -151,22 +150,6 @@ export class HttpServer {readable.pipe(response);}- async serveVirtualFile(response: http.ServerResponse, vfs: VirtualFileSystem, entry: string, headers?: { [name: string]: string }) {- try {- const content = await vfs.read(entry);- response.statusCode = 200;- const contentType = mime.getType(path.extname(entry)) || 'application/octet-stream';- response.setHeader('Content-Type', contentType);- response.setHeader('Content-Length', content.byteLength);- for (const [name, value] of Object.entries(headers || {}))- response.setHeader(name, value);- response.end(content);- return true;- } catch (e) {- return false;- }- }-private _onRequest(request: http.IncomingMessage, response: http.ServerResponse) {response.setHeader('Access-Control-Allow-Origin', '*');response.setHeader('Access-Control-Request-Method', '*');diff --git a/packages/playwright-firefox/install.js b/packages/playwright-firefox/install.jsindex 007009ac2f..0f177bd440 100644--- a/packages/playwright-firefox/install.js+++ b/packages/playwright-firefox/install.js@@ -17,7 +17,7 @@let install;try {- install = require('playwright-core/lib/utils/registry').installBrowsersForNpmInstall;+ install = require('playwright-core/lib/server').registry.installBrowsersForNpmInstall;} catch (e) {// Dev build, don't install browsers by default.}diff --git a/packages/playwright-webkit/install.js b/packages/playwright-webkit/install.jsindex e1bc2d41b0..3d2cf82c1b 100644--- a/packages/playwright-webkit/install.js+++ b/packages/playwright-webkit/install.js@@ -17,7 +17,7 @@let install;try {- install = require('playwright-core/lib/utils/registry').installBrowsersForNpmInstall;+ install = require('playwright-core/lib/server').registry.installBrowsersForNpmInstall;} catch (e) {// Dev build, don't install browsers by default.}diff --git a/packages/playwright/install.js b/packages/playwright/install.jsindex 6439e553ad..8828f3da66 100644--- a/packages/playwright/install.js+++ b/packages/playwright/install.js@@ -17,7 +17,7 @@let install;try {- install = require('playwright-core/lib/utils/registry').installDefaultBrowsersForNpmInstall;+ install = require('playwright-core/lib/server').registry.installDefaultBrowsersForNpmInstall;} catch (e) {// Dev build, don't install browsers by default.}diff --git a/tests/config/utils.ts b/tests/config/utils.tsindex 56e732d8ab..f175e3d7fe 100644--- a/tests/config/utils.ts+++ b/tests/config/utils.ts@@ -16,7 +16,7 @@import { expect } from '@playwright/test';import type { Frame, Page } from 'playwright-core';-import { ZipFileSystem } from '../../packages/playwright-core/lib/utils/vfs';+import { ZipFileSystem } from './vfs';export async function attachFrame(page: Page, frameId: string, url: string): Promise<Frame> {const handle = await page.evaluateHandle(async ({ frameId, url }) => {diff --git a/packages/playwright-core/src/utils/vfs.ts b/tests/config/vfs.tssimilarity index 100%rename from packages/playwright-core/src/utils/vfs.tsrename to tests/config/vfs.tsdiff --git a/tests/library/video.spec.ts b/tests/library/video.spec.tsindex 3fedd36b22..a5548fc193 100644--- a/tests/library/video.spec.ts+++ b/tests/library/video.spec.ts@@ -19,7 +19,7 @@ import fs from 'fs';import path from 'path';import { spawnSync } from 'child_process';import { PNG } from 'pngjs';-import { registry } from '../../packages/playwright-core/lib/utils/registry';+import { registry } from '../../packages/playwright-core/lib/server';const ffmpeg = registry.findExecutable('ffmpeg')!.executablePath('javascript');diff --git a/tests/playwright-test/playwright.spec.ts b/tests/playwright-test/playwright.spec.tsindex 5a76b53997..84d2e45f53 100644--- a/tests/playwright-test/playwright.spec.ts+++ b/tests/playwright-test/playwright.spec.ts@@ -18,7 +18,7 @@ import { test, expect, stripAnsi } from './playwright-test-fixtures';import fs from 'fs';import path from 'path';import { spawnSync } from 'child_process';-import { registry } from '../../packages/playwright-core/lib/utils/registry';+import { registry } from '../../packages/playwright-core/lib/server';const ffmpeg = registry.findExecutable('ffmpeg')!.executablePath();diff --git a/tests/playwright-test/playwright.trace.spec.ts b/tests/playwright-test/playwright.trace.spec.tsindex 92457ff167..d74eee0e2e 100644--- a/tests/playwright-test/playwright.trace.spec.ts+++ b/tests/playwright-test/playwright.trace.spec.ts@@ -15,7 +15,7 @@*/import { test, expect } from './playwright-test-fixtures';-import { ZipFileSystem } from '../../packages/playwright-core/lib/utils/vfs';+import { ZipFileSystem } from '../config/vfs';import fs from 'fs';test('should stop tracing with trace: on-first-retry, when not retrying', async ({ runInlineTest }, testInfo) => {diff --git a/utils/linux-browser-dependencies/inside_docker/list_dependencies.js b/utils/linux-browser-dependencies/inside_docker/list_dependencies.jsindex e903cdf7ee..bf7603034c 100644--- a/utils/linux-browser-dependencies/inside_docker/list_dependencies.js+++ b/utils/linux-browser-dependencies/inside_docker/list_dependencies.js@@ -4,7 +4,7 @@ const fs = require('fs');const util = require('util');const path = require('path');const {spawn} = require('child_process');-const {registryDirectory} = require('playwright-core/lib/utils/registry');+const {registryDirectory} = require('playwright-core/lib/server');const readdirAsync = util.promisify(fs.readdir.bind(fs));const readFileAsync = util.promisify(fs.readFile.bind(fs));diff --git a/utils/roll_browser.js b/utils/roll_browser.jsindex 135fa5feea..abb9ea238e 100755--- a/utils/roll_browser.js+++ b/utils/roll_browser.js@@ -17,7 +17,7 @@*/const path = require('path');-const {Registry} = require('../packages/playwright-core/lib/utils/registry');+const { Registry } = require('../packages/playwright-core/lib/server');const fs = require('fs');const protocolGenerator = require('./protocol-types-generator');const {execSync} = require('child_process');