chore: move src files to server (#3593)

This commit is contained in:
Dmitry Gozman 2020-08-24 06:51:51 -07:00 committed by GitHub
parent 43893cc0f8
commit cd220daa83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
81 changed files with 198 additions and 192 deletions

View File

@ -74,7 +74,7 @@ This object can be used to launch or connect to Chromium, returning instances of
#### playwright.devices
- returns: <[Object]>
Returns a list of devices to be used with [`browser.newContext([options])`](#browsernewcontextoptions) or [`browser.newPage([options])`](#browsernewpageoptions). Actual list of devices can be found in [src/deviceDescriptors.ts](https://github.com/Microsoft/playwright/blob/master/src/deviceDescriptors.ts).
Returns a list of devices to be used with [`browser.newContext([options])`](#browsernewcontextoptions) or [`browser.newPage([options])`](#browsernewpageoptions). Actual list of devices can be found in [src/server/deviceDescriptors.ts](https://github.com/Microsoft/playwright/blob/master/src/server/deviceDescriptors.ts).
```js
const { webkit, devices } = require('playwright');

View File

@ -17,8 +17,8 @@
import { LaunchServerOptions } from '../client/types';
import { BrowserTypeBase } from '../server/browserType';
import * as ws from 'ws';
import { helper } from '../helper';
import { Browser } from '../browser';
import { helper } from '../server/helper';
import { Browser } from '../server/browser';
import { ChildProcess } from 'child_process';
import { EventEmitter } from 'ws';
import { DispatcherScope, DispatcherConnection } from './server/dispatcher';

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import { BrowserContext } from '../../browserContext';
import { BrowserContext } from '../../server/browserContext';
import { Dispatcher, DispatcherScope, lookupDispatcher } from './dispatcher';
import { PageDispatcher, BindingCallDispatcher, WorkerDispatcher } from './pageDispatcher';
import * as channels from '../../protocol/channels';

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import { Browser } from '../../browser';
import { Browser } from '../../server/browser';
import * as channels from '../../protocol/channels';
import { BrowserContextDispatcher } from './browserContextDispatcher';
import { CDPSessionDispatcher } from './cdpSessionDispatcher';

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import { ConsoleMessage } from '../../console';
import { ConsoleMessage } from '../../server/console';
import * as channels from '../../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
import { createHandle } from './elementHandlerDispatcher';

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import { Dialog } from '../../dialog';
import { Dialog } from '../../server/dialog';
import * as channels from '../../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';

View File

@ -15,7 +15,7 @@
*/
import { EventEmitter } from 'events';
import { helper } from '../../helper';
import { helper } from '../../server/helper';
import * as channels from '../../protocol/channels';
import { serializeError } from '../../protocol/serializers';
import { createScheme, Validator, ValidationError } from '../../protocol/validator';

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import { Download } from '../../download';
import { Download } from '../../server/download';
import * as channels from '../../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
import { StreamDispatcher } from './streamDispatcher';

View File

@ -14,8 +14,8 @@
* limitations under the License.
*/
import { ElementHandle } from '../../dom';
import * as js from '../../javascript';
import { ElementHandle } from '../../server/dom';
import * as js from '../../server/javascript';
import * as channels from '../../protocol/channels';
import { DispatcherScope, lookupNullableDispatcher } from './dispatcher';
import { JSHandleDispatcher, serializeResult, parseArgument } from './jsHandleDispatcher';

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import { Frame, NavigationEvent } from '../../frames';
import { Frame, NavigationEvent } from '../../server/frames';
import * as channels from '../../protocol/channels';
import { Dispatcher, DispatcherScope, lookupNullableDispatcher, existingDispatcher } from './dispatcher';
import { ElementHandleDispatcher, createHandle } from './elementHandlerDispatcher';

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import * as js from '../../javascript';
import * as js from '../../server/javascript';
import * as channels from '../../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
import { createHandle } from './elementHandlerDispatcher';

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import { Request, Response, Route } from '../../network';
import { Request, Response, Route } from '../../server/network';
import * as channels from '../../protocol/channels';
import { Dispatcher, DispatcherScope, lookupNullableDispatcher, existingDispatcher } from './dispatcher';
import { FrameDispatcher } from './frameDispatcher';

View File

@ -14,10 +14,10 @@
* limitations under the License.
*/
import { BrowserContext } from '../../browserContext';
import { Frame } from '../../frames';
import { Request } from '../../network';
import { Page, Worker } from '../../page';
import { BrowserContext } from '../../server/browserContext';
import { Frame } from '../../server/frames';
import { Request } from '../../server/network';
import { Page, Worker } from '../../server/page';
import * as channels from '../../protocol/channels';
import { Dispatcher, DispatcherScope, lookupDispatcher, lookupNullableDispatcher } from './dispatcher';
import { parseError, serializeError } from '../../protocol/serializers';
@ -28,7 +28,7 @@ import { FrameDispatcher } from './frameDispatcher';
import { RequestDispatcher, ResponseDispatcher, RouteDispatcher } from './networkDispatchers';
import { serializeResult, parseArgument } from './jsHandleDispatcher';
import { ElementHandleDispatcher, createHandle } from './elementHandlerDispatcher';
import { FileChooser } from '../../fileChooser';
import { FileChooser } from '../../server/fileChooser';
import { CRCoverage } from '../../server/chromium/crCoverage';
export class PageDispatcher extends Dispatcher<Page, channels.PageInitializer> implements channels.PageChannel {

View File

@ -21,7 +21,7 @@ import { Dispatcher, DispatcherScope } from './dispatcher';
import { SelectorsDispatcher } from './selectorsDispatcher';
import { Electron } from '../../server/electron/electron';
import { ElectronDispatcher } from './electronDispatcher';
import { DeviceDescriptors } from '../../deviceDescriptors';
import { DeviceDescriptors } from '../../server/deviceDescriptors';
export class PlaywrightDispatcher extends Dispatcher<Playwright, channels.PlaywrightInitializer> implements channels.PlaywrightChannel {
constructor(scope: DispatcherScope, playwright: Playwright) {

View File

@ -16,9 +16,9 @@
import { Dispatcher, DispatcherScope } from './dispatcher';
import * as channels from '../../protocol/channels';
import { Selectors } from '../../selectors';
import { Selectors } from '../../server/selectors';
import { ElementHandleDispatcher } from './elementHandlerDispatcher';
import * as dom from '../../dom';
import * as dom from '../../server/dom';
export class SelectorsDispatcher extends Dispatcher<Selectors, channels.SelectorsInitializer> implements channels.SelectorsChannel {
constructor(scope: DispatcherScope, selectors: Selectors) {

View File

@ -20,15 +20,15 @@ import { helper } from './helper';
import * as network from './network';
import * as path from 'path';
import { Page, PageBinding } from './page';
import { TimeoutSettings } from './utils/timeoutSettings';
import { TimeoutSettings } from '../utils/timeoutSettings';
import * as frames from './frames';
import * as types from './types';
import { Download } from './download';
import { Browser } from './browser';
import { EventEmitter } from 'events';
import { Progress } from './progress';
import { DebugController } from './server/debug/debugController';
import { isDebugMode } from './utils/utils';
import { DebugController } from './debug/debugController';
import { isDebugMode } from '../utils/utils';
export class Screencast {
readonly path: string;

View File

@ -18,14 +18,14 @@ import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import * as util from 'util';
import { BrowserContext, verifyProxySettings, validateBrowserContextOptions } from '../browserContext';
import { BrowserContext, verifyProxySettings, validateBrowserContextOptions } from './browserContext';
import * as browserPaths from '../utils/browserPaths';
import { ConnectionTransport, WebSocketTransport } from '../transport';
import { BrowserOptions, Browser, BrowserProcess } from '../browser';
import { ConnectionTransport, WebSocketTransport } from './transport';
import { BrowserOptions, Browser, BrowserProcess } from './browser';
import { launchProcess, Env, waitForLine, envArrayToObject } from './processLauncher';
import { PipeTransport } from './pipeTransport';
import { Progress, runAbortableTask } from '../progress';
import * as types from '../types';
import { Progress, runAbortableTask } from './progress';
import * as types from './types';
import { TimeoutSettings } from '../utils/timeoutSettings';
import { validateHostRequirements } from './validateDependencies';
import { assert, isDebugMode } from '../utils/utils';

View File

@ -22,11 +22,11 @@ import { Env } from '../processLauncher';
import { kBrowserCloseMessageId } from './crConnection';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { BrowserTypeBase } from '../browserType';
import { ConnectionTransport, ProtocolRequest } from '../../transport';
import { ConnectionTransport, ProtocolRequest } from '../transport';
import type { BrowserDescriptor } from '../../utils/browserPaths';
import { CRDevTools } from './crDevTools';
import { BrowserOptions } from '../../browser';
import * as types from '../../types';
import { BrowserOptions } from '../browser';
import * as types from '../types';
import { isDebugMode, getFromENV } from '../../utils/utils';
export class Chromium extends BrowserTypeBase {

View File

@ -17,9 +17,9 @@
import { CRSession } from './crConnection';
import { Protocol } from './protocol';
import * as dom from '../../dom';
import * as accessibility from '../../accessibility';
import * as types from '../../types';
import * as dom from '../dom';
import * as accessibility from '../accessibility';
import * as types from '../types';
export async function getAccessibilityTree(client: CRSession, needle?: dom.ElementHandle): Promise<{tree: accessibility.AXNode, needle: accessibility.AXNode | null}> {
const {nodes} = await client.send('Accessibility.getFullAXTree');

View File

@ -15,13 +15,13 @@
* limitations under the License.
*/
import { Browser, BrowserOptions } from '../../browser';
import { assertBrowserContextIsNotOwned, BrowserContext, validateBrowserContextOptions, verifyGeolocation } from '../../browserContext';
import { Browser, BrowserOptions } from '../browser';
import { assertBrowserContextIsNotOwned, BrowserContext, validateBrowserContextOptions, verifyGeolocation } from '../browserContext';
import { assert } from '../../utils/utils';
import * as network from '../../network';
import { Page, PageBinding, Worker } from '../../page';
import { ConnectionTransport } from '../../transport';
import * as types from '../../types';
import * as network from '../network';
import { Page, PageBinding, Worker } from '../page';
import { ConnectionTransport } from '../transport';
import * as types from '../types';
import { ConnectionEvents, CRConnection, CRSession } from './crConnection';
import { CRPage } from './crPage';
import { readProtocolStream } from './crProtocolHelper';

View File

@ -16,7 +16,7 @@
*/
import { assert } from '../../utils/utils';
import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../../transport';
import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
import { Protocol } from './protocol';
import { EventEmitter } from 'events';
import { rewriteErrorMessage } from '../../utils/stackTrace';

View File

@ -16,9 +16,9 @@
*/
import { CRSession } from './crConnection';
import { helper, RegisteredListener } from '../../helper';
import { helper, RegisteredListener } from '../helper';
import { Protocol } from './protocol';
import * as types from '../../types';
import * as types from '../types';
import * as sourceMap from '../../utils/sourceMap';
import { assert } from '../../utils/utils';

View File

@ -18,10 +18,10 @@
import { CRSession } from './crConnection';
import { getExceptionMessage, releaseObject } from './crProtocolHelper';
import { Protocol } from './protocol';
import * as js from '../../javascript';
import * as js from '../javascript';
import * as sourceMap from '../../utils/sourceMap';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { parseEvaluationResultValue } from '../../common/utilityScriptSerializers';
import { parseEvaluationResultValue } from '../common/utilityScriptSerializers';
export class CRExecutionContext implements js.ExecutionContextDelegate {
_client: CRSession;

View File

@ -15,10 +15,10 @@
* limitations under the License.
*/
import * as input from '../../input';
import * as types from '../../types';
import * as input from '../input';
import * as types from '../types';
import { CRSession } from './crConnection';
import { macEditingCommands } from '../../macEditingCommands';
import { macEditingCommands } from '../macEditingCommands';
import { isString } from '../../utils/utils';
function toModifiersMask(modifiers: Set<types.KeyboardModifier>): number {

View File

@ -16,12 +16,12 @@
*/
import { CRSession } from './crConnection';
import { Page } from '../../page';
import { helper, RegisteredListener } from '../../helper';
import { Page } from '../page';
import { helper, RegisteredListener } from '../helper';
import { Protocol } from './protocol';
import * as network from '../../network';
import * as frames from '../../frames';
import * as types from '../../types';
import * as network from '../network';
import * as frames from '../frames';
import * as types from '../types';
import { CRPage } from './crPage';
import { assert, headersObjectToArray } from '../../utils/utils';

View File

@ -15,25 +15,25 @@
* limitations under the License.
*/
import * as dom from '../../dom';
import * as frames from '../../frames';
import { helper, RegisteredListener } from '../../helper';
import * as network from '../../network';
import * as dom from '../dom';
import * as frames from '../frames';
import { helper, RegisteredListener } from '../helper';
import * as network from '../network';
import { CRSession, CRConnection, CRSessionEvents } from './crConnection';
import { CRExecutionContext } from './crExecutionContext';
import { CRNetworkManager } from './crNetworkManager';
import { Page, Worker, PageBinding } from '../../page';
import { Page, Worker, PageBinding } from '../page';
import { Protocol } from './protocol';
import { toConsoleMessageLocation, exceptionToError, releaseObject } from './crProtocolHelper';
import * as dialog from '../../dialog';
import { PageDelegate } from '../../page';
import * as dialog from '../dialog';
import { PageDelegate } from '../page';
import { RawMouseImpl, RawKeyboardImpl } from './crInput';
import { getAccessibilityTree } from './crAccessibility';
import { CRCoverage } from './crCoverage';
import { CRPDF } from './crPdf';
import { CRBrowserContext } from './crBrowser';
import * as types from '../../types';
import { ConsoleMessage } from '../../console';
import * as types from '../types';
import { ConsoleMessage } from '../console';
import * as sourceMap from '../../utils/sourceMap';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { assert, headersArrayToObject } from '../../utils/utils';

View File

@ -16,7 +16,7 @@
*/
import { assert } from '../../utils/utils';
import * as types from '../../types';
import * as types from '../types';
import { CRSession } from './crConnection';
import { readProtocolStream } from './crProtocolHelper';

View File

@ -19,7 +19,7 @@ import { CRSession } from './crConnection';
import { Protocol } from './protocol';
import * as fs from 'fs';
import * as util from 'util';
import * as types from '../../types';
import * as types from '../types';
import { mkdirIfNeeded } from '../../utils/utils';
export function getExceptionMessage(exceptionDetails: Protocol.Runtime.ExceptionDetails): string {

View File

@ -14,10 +14,10 @@
* limitations under the License.
*/
import { BrowserContext } from '../../browserContext';
import * as frames from '../../frames';
import * as js from '../../javascript';
import { Page } from '../../page';
import { BrowserContext } from '../browserContext';
import * as frames from '../frames';
import * as js from '../javascript';
import { Page } from '../page';
import type DebugScript from './injected/debugScript';
export class DebugController {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import { ParsedSelector, parseSelector } from '../../../common/selectorParser';
import { ParsedSelector, parseSelector } from '../../common/selectorParser';
import type InjectedScript from '../../injected/injectedScript';
import { html } from './html';

View File

@ -15,8 +15,8 @@
* limitations under the License.
*/
import { assert } from './utils/utils';
import { debugLogger } from './utils/debugLogger';
import { assert } from '../utils/utils';
import { debugLogger } from '../utils/debugLogger';
type OnHandle = (accept: boolean, promptText?: string) => Promise<void>;

View File

@ -15,16 +15,16 @@
*/
import * as frames from './frames';
import { assert } from './utils/utils';
import type InjectedScript from './server/injected/injectedScript';
import * as injectedScriptSource from './generated/injectedScriptSource';
import * as debugScriptSource from './generated/debugScriptSource';
import { assert } from '../utils/utils';
import type InjectedScript from './injected/injectedScript';
import * as injectedScriptSource from '../generated/injectedScriptSource';
import * as debugScriptSource from '../generated/debugScriptSource';
import * as js from './javascript';
import { Page } from './page';
import { selectors, SelectorInfo } from './selectors';
import * as types from './types';
import { Progress } from './progress';
import type DebugScript from './server/debug/injected/debugScript';
import type DebugScript from './debug/injected/debugScript';
import { FatalDOMError, RetargetableDOMError } from './common/domErrors';
export class FrameExecutionContext extends js.ExecutionContext {

View File

@ -19,7 +19,7 @@ import * as fs from 'fs';
import * as util from 'util';
import { Page } from './page';
import { Readable } from 'stream';
import { assert, mkdirIfNeeded } from './utils/utils';
import { assert, mkdirIfNeeded } from '../utils/utils';
export class Download {
private _downloadsPath: string;

View File

@ -18,18 +18,18 @@ import * as path from 'path';
import { CRBrowser, CRBrowserContext } from '../chromium/crBrowser';
import { CRConnection, CRSession } from '../chromium/crConnection';
import { CRExecutionContext } from '../chromium/crExecutionContext';
import * as js from '../../javascript';
import { Page } from '../../page';
import * as js from '../javascript';
import { Page } from '../page';
import { TimeoutSettings } from '../../utils/timeoutSettings';
import { WebSocketTransport } from '../../transport';
import * as types from '../../types';
import { WebSocketTransport } from '../transport';
import * as types from '../types';
import { launchProcess, waitForLine, envArrayToObject } from '../processLauncher';
import { BrowserContext } from '../../browserContext';
import { BrowserContext } from '../browserContext';
import type {BrowserWindow} from 'electron';
import { runAbortableTask, ProgressController } from '../../progress';
import { runAbortableTask, ProgressController } from '../progress';
import { EventEmitter } from 'events';
import { helper } from '../../helper';
import { BrowserProcess } from '../../browser';
import { helper } from '../helper';
import { BrowserProcess } from '../browser';
export type ElectronLaunchOptionsBase = {
args?: string[],

View File

@ -15,11 +15,11 @@
* limitations under the License.
*/
import * as accessibility from '../../accessibility';
import * as accessibility from '../accessibility';
import { FFSession } from './ffConnection';
import { Protocol } from './protocol';
import * as dom from '../../dom';
import * as types from '../../types';
import * as dom from '../dom';
import * as types from '../types';
export async function getAccessibilityTree(session: FFSession, needle?: dom.ElementHandle): Promise<{tree: accessibility.AXNode, needle: accessibility.AXNode | null}> {
const objectId = needle ? needle._objectId : undefined;

View File

@ -15,14 +15,14 @@
* limitations under the License.
*/
import { Browser, BrowserOptions } from '../../browser';
import { assertBrowserContextIsNotOwned, BrowserContext, validateBrowserContextOptions, verifyGeolocation } from '../../browserContext';
import { helper, RegisteredListener } from '../../helper';
import { Browser, BrowserOptions } from '../browser';
import { assertBrowserContextIsNotOwned, BrowserContext, validateBrowserContextOptions, verifyGeolocation } from '../browserContext';
import { helper, RegisteredListener } from '../helper';
import { assert } from '../../utils/utils';
import * as network from '../../network';
import { Page, PageBinding } from '../../page';
import { ConnectionTransport } from '../../transport';
import * as types from '../../types';
import * as network from '../network';
import { Page, PageBinding } from '../page';
import { ConnectionTransport } from '../transport';
import * as types from '../types';
import { ConnectionEvents, FFConnection } from './ffConnection';
import { FFPage } from './ffPage';
import { Protocol } from './protocol';

View File

@ -17,7 +17,7 @@
import { EventEmitter } from 'events';
import { assert } from '../../utils/utils';
import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../../transport';
import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
import { Protocol } from './protocol';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { debugLogger } from '../../utils/debugLogger';

View File

@ -15,12 +15,12 @@
* limitations under the License.
*/
import * as js from '../../javascript';
import * as js from '../javascript';
import { FFSession } from './ffConnection';
import { Protocol } from './protocol';
import * as sourceMap from '../../utils/sourceMap';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { parseEvaluationResultValue } from '../../common/utilityScriptSerializers';
import { parseEvaluationResultValue } from '../common/utilityScriptSerializers';
export class FFExecutionContext implements js.ExecutionContextDelegate {
_session: FFSession;

View File

@ -15,8 +15,8 @@
* limitations under the License.
*/
import * as input from '../../input';
import * as types from '../../types';
import * as input from '../input';
import * as types from '../types';
import { FFSession } from './ffConnection';
function toModifiersMask(modifiers: Set<types.KeyboardModifier>): number {

View File

@ -15,12 +15,12 @@
* limitations under the License.
*/
import { helper, RegisteredListener } from '../../helper';
import { helper, RegisteredListener } from '../helper';
import { FFSession } from './ffConnection';
import { Page } from '../../page';
import * as network from '../../network';
import * as frames from '../../frames';
import * as types from '../../types';
import { Page } from '../page';
import * as network from '../network';
import * as frames from '../frames';
import * as types from '../types';
import { Protocol } from './protocol';
export class FFNetworkManager {

View File

@ -15,14 +15,14 @@
* limitations under the License.
*/
import * as dialog from '../../dialog';
import * as dom from '../../dom';
import * as frames from '../../frames';
import { helper, RegisteredListener } from '../../helper';
import * as dialog from '../dialog';
import * as dom from '../dom';
import * as frames from '../frames';
import { helper, RegisteredListener } from '../helper';
import { assert } from '../../utils/utils';
import { Page, PageBinding, PageDelegate, Worker } from '../../page';
import { kScreenshotDuringNavigationError } from '../../screenshotter';
import * as types from '../../types';
import { Page, PageBinding, PageDelegate, Worker } from '../page';
import { kScreenshotDuringNavigationError } from '../screenshotter';
import * as types from '../types';
import { getAccessibilityTree } from './ffAccessibility';
import { FFBrowserContext } from './ffBrowser';
import { FFSession, FFSessionEvents } from './ffConnection';
@ -30,9 +30,9 @@ import { FFExecutionContext } from './ffExecutionContext';
import { RawKeyboardImpl, RawMouseImpl } from './ffInput';
import { FFNetworkManager } from './ffNetworkManager';
import { Protocol } from './protocol';
import { selectors } from '../../selectors';
import { selectors } from '../selectors';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { Screencast, BrowserContext } from '../../browserContext';
import { Screencast, BrowserContext } from '../browserContext';
const UTILITY_WORLD_NAME = '__playwright_utility_world__';

View File

@ -22,10 +22,10 @@ import { FFBrowser } from './ffBrowser';
import { kBrowserCloseMessageId } from './ffConnection';
import { BrowserTypeBase } from '../browserType';
import { Env } from '../processLauncher';
import { ConnectionTransport } from '../../transport';
import { BrowserOptions } from '../../browser';
import { ConnectionTransport } from '../transport';
import { BrowserOptions } from '../browser';
import { BrowserDescriptor } from '../../utils/browserPaths';
import * as types from '../../types';
import * as types from '../types';
export class Firefox extends BrowserTypeBase {
constructor(packagePath: string, browser: BrowserDescriptor) {

View File

@ -26,8 +26,8 @@ import * as types from './types';
import { BrowserContext } from './browserContext';
import { Progress, ProgressController } from './progress';
import { EventEmitter } from 'events';
import { assert, makeWaitForNextTask } from './utils/utils';
import { debugLogger } from './utils/debugLogger';
import { assert, makeWaitForNextTask } from '../utils/utils';
import { debugLogger } from '../utils/debugLogger';
type ContextData = {
contextPromise: Promise<dom.FrameExecutionContext>;

View File

@ -14,14 +14,14 @@
* limitations under the License.
*/
import type * as types from '../../types';
import type * as types from '../types';
import { createAttributeEngine } from './attributeSelectorEngine';
import { createCSSEngine } from './cssSelectorEngine';
import { SelectorEngine, SelectorRoot } from './selectorEngine';
import { createTextSelector } from './textSelectorEngine';
import { XPathEngine } from './xpathSelectorEngine';
import { ParsedSelector } from '../../common/selectorParser';
import { FatalDOMError } from '../../common/domErrors';
import { ParsedSelector } from '../common/selectorParser';
import { FatalDOMError } from '../common/domErrors';
type Predicate<T> = (progress: types.InjectedScriptProgress, continuePolling: symbol) => T | symbol;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import { serializeAsCallArgument, parseEvaluationResultValue } from '../../common/utilityScriptSerializers';
import { serializeAsCallArgument, parseEvaluationResultValue } from '../common/utilityScriptSerializers';
export default class UtilityScript {
evaluate(returnByValue: boolean, expression: string) {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import { assert } from './utils/utils';
import { assert } from '../utils/utils';
import * as keyboardLayout from './usKeyboardLayout';
import * as types from './types';
import type { Page } from './page';

View File

@ -15,10 +15,10 @@
*/
import * as dom from './dom';
import * as utilityScriptSource from './generated/utilityScriptSource';
import * as sourceMap from './utils/sourceMap';
import * as utilityScriptSource from '../generated/utilityScriptSource';
import * as sourceMap from '../utils/sourceMap';
import { serializeAsCallArgument } from './common/utilityScriptSerializers';
import type UtilityScript from './server/injected/utilityScript';
import type UtilityScript from './injected/utilityScript';
type ObjectId = string;
export type RemoteObject = {

View File

@ -16,7 +16,7 @@
import * as frames from './frames';
import * as types from './types';
import { assert } from './utils/utils';
import { assert } from '../utils/utils';
export function filterCookies(cookies: types.NetworkCookie[], urls: string[]): types.NetworkCookie[] {
const parsedURLs = urls.map(s => new URL(s));

View File

@ -21,7 +21,7 @@ import * as input from './input';
import * as js from './javascript';
import * as network from './network';
import { Screenshotter } from './screenshotter';
import { TimeoutSettings } from './utils/timeoutSettings';
import { TimeoutSettings } from '../utils/timeoutSettings';
import * as types from './types';
import { BrowserContext } from './browserContext';
import { ConsoleMessage } from './console';
@ -29,8 +29,8 @@ import * as accessibility from './accessibility';
import { EventEmitter } from 'events';
import { FileChooser } from './fileChooser';
import { Progress, runAbortableTask } from './progress';
import { assert, isError } from './utils/utils';
import { debugLogger } from './utils/debugLogger';
import { assert, isError } from '../utils/utils';
import { debugLogger } from '../utils/debugLogger';
export interface PageDelegate {
readonly rawMouse: input.RawMouse;

View File

@ -15,8 +15,8 @@
* limitations under the License.
*/
import { helper, RegisteredListener } from '../helper';
import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
import { helper, RegisteredListener } from './helper';
import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from './transport';
import { makeWaitForNextTask } from '../utils/utils';
import { debugLogger } from '../utils/debugLogger';

View File

@ -17,7 +17,7 @@
import { Chromium } from './chromium/chromium';
import { WebKit } from './webkit/webkit';
import { Firefox } from './firefox/firefox';
import { selectors } from '../selectors';
import { selectors } from './selectors';
import * as browserPaths from '../utils/browserPaths';
export class Playwright {

View File

@ -19,9 +19,9 @@ import * as childProcess from 'child_process';
import * as readline from 'readline';
import * as removeFolder from 'rimraf';
import * as stream from 'stream';
import { helper } from '../helper';
import { Progress } from '../progress';
import * as types from '../types';
import { helper } from './helper';
import { Progress } from './progress';
import * as types from './types';
import { isUnderTest } from '../utils/utils';
export type Env = {[key: string]: string | number | boolean | undefined};

View File

@ -14,10 +14,10 @@
* limitations under the License.
*/
import { TimeoutError } from './utils/errors';
import { assert } from './utils/utils';
import { rewriteErrorMessage } from './utils/stackTrace';
import { debugLogger, LogName } from './utils/debugLogger';
import { TimeoutError } from '../utils/errors';
import { assert } from '../utils/utils';
import { rewriteErrorMessage } from '../utils/stackTrace';
import { debugLogger, LogName } from '../utils/debugLogger';
export interface Progress {
readonly aborted: Promise<void>;

View File

@ -19,9 +19,9 @@ import * as dom from './dom';
import { helper } from './helper';
import { Page } from './page';
import * as types from './types';
import { rewriteErrorMessage } from './utils/stackTrace';
import { rewriteErrorMessage } from '../utils/stackTrace';
import { Progress } from './progress';
import { assert } from './utils/utils';
import { assert } from '../utils/utils';
export class Screenshotter {
private _queue = new TaskQueue();

View File

@ -17,7 +17,7 @@
import * as WebSocket from 'ws';
import { Progress } from './progress';
import { makeWaitForNextTask } from './utils/utils';
import { makeWaitForNextTask } from '../utils/utils';
export type ProtocolRequest = {
id: number;

View File

@ -20,10 +20,10 @@ import { Env } from '../processLauncher';
import * as path from 'path';
import { kBrowserCloseMessageId } from './wkConnection';
import { BrowserTypeBase } from '../browserType';
import { ConnectionTransport } from '../../transport';
import { BrowserOptions } from '../../browser';
import { ConnectionTransport } from '../transport';
import { BrowserOptions } from '../browser';
import { BrowserDescriptor } from '../../utils/browserPaths';
import * as types from '../../types';
import * as types from '../types';
export class WebKit extends BrowserTypeBase {
constructor(packagePath: string, browser: BrowserDescriptor) {

View File

@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as accessibility from '../../accessibility';
import * as accessibility from '../accessibility';
import { WKSession } from './wkConnection';
import { Protocol } from './protocol';
import * as dom from '../../dom';
import * as types from '../../types';
import * as dom from '../dom';
import * as types from '../types';
export async function getAccessibilityTree(session: WKSession, needle?: dom.ElementHandle) {
const objectId = needle ? needle._objectId : undefined;

View File

@ -15,15 +15,15 @@
* limitations under the License.
*/
import { Browser, BrowserOptions } from '../../browser';
import { assertBrowserContextIsNotOwned, BrowserContext, validateBrowserContextOptions, verifyGeolocation } from '../../browserContext';
import { helper, RegisteredListener } from '../../helper';
import { Browser, BrowserOptions } from '../browser';
import { assertBrowserContextIsNotOwned, BrowserContext, validateBrowserContextOptions, verifyGeolocation } from '../browserContext';
import { helper, RegisteredListener } from '../helper';
import { assert } from '../../utils/utils';
import * as network from '../../network';
import { Page, PageBinding } from '../../page';
import * as network from '../network';
import { Page, PageBinding } from '../page';
import * as path from 'path';
import { ConnectionTransport } from '../../transport';
import * as types from '../../types';
import { ConnectionTransport } from '../transport';
import * as types from '../types';
import { Protocol } from './protocol';
import { kPageProxyMessageReceived, PageProxyMessageReceivedPayload, WKConnection, WKSession } from './wkConnection';
import { WKPage } from './wkPage';

View File

@ -17,7 +17,7 @@
import { EventEmitter } from 'events';
import { assert } from '../../utils/utils';
import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../../transport';
import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
import { Protocol } from './protocol';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { debugLogger } from '../../utils/debugLogger';

View File

@ -17,8 +17,8 @@
import { WKSession, isSwappedOutError } from './wkConnection';
import { Protocol } from './protocol';
import * as js from '../../javascript';
import { parseEvaluationResultValue } from '../../common/utilityScriptSerializers';
import * as js from '../javascript';
import { parseEvaluationResultValue } from '../common/utilityScriptSerializers';
import * as sourceMap from '../../utils/sourceMap';
export class WKExecutionContext implements js.ExecutionContextDelegate {

View File

@ -15,9 +15,9 @@
* limitations under the License.
*/
import * as input from '../../input';
import * as types from '../../types';
import { macEditingCommands } from '../../macEditingCommands';
import * as input from '../input';
import * as types from '../types';
import { macEditingCommands } from '../macEditingCommands';
import { WKSession } from './wkConnection';
import { isString } from '../../utils/utils';

View File

@ -15,9 +15,9 @@
* limitations under the License.
*/
import * as frames from '../../frames';
import * as network from '../../network';
import * as types from '../../types';
import * as frames from '../frames';
import * as network from '../network';
import * as types from '../types';
import { Protocol } from './protocol';
import { WKSession } from './wkConnection';
import { assert, headersObjectToArray, headersArrayToObject } from '../../utils/utils';

View File

@ -15,28 +15,28 @@
* limitations under the License.
*/
import { Screencast, BrowserContext } from '../../browserContext';
import * as frames from '../../frames';
import { helper, RegisteredListener } from '../../helper';
import * as dom from '../../dom';
import * as network from '../../network';
import { Screencast, BrowserContext } from '../browserContext';
import * as frames from '../frames';
import { helper, RegisteredListener } from '../helper';
import * as dom from '../dom';
import * as network from '../network';
import { WKSession } from './wkConnection';
import { WKExecutionContext } from './wkExecutionContext';
import { WKInterceptableRequest } from './wkInterceptableRequest';
import { WKWorkers } from './wkWorkers';
import { Page, PageDelegate, PageBinding } from '../../page';
import { Page, PageDelegate, PageBinding } from '../page';
import { Protocol } from './protocol';
import * as dialog from '../../dialog';
import * as dialog from '../dialog';
import { RawMouseImpl, RawKeyboardImpl } from './wkInput';
import * as types from '../../types';
import * as accessibility from '../../accessibility';
import * as types from '../types';
import * as accessibility from '../accessibility';
import { getAccessibilityTree } from './wkAccessibility';
import { WKProvisionalPage } from './wkProvisionalPage';
import { WKBrowserContext } from './wkBrowser';
import { selectors } from '../../selectors';
import { selectors } from '../selectors';
import * as jpeg from 'jpeg-js';
import * as png from 'pngjs';
import { JSHandle } from '../../javascript';
import { JSHandle } from '../javascript';
import { assert, debugAssert, headersArrayToObject } from '../../utils/utils';
const UTILITY_WORLD_NAME = '__playwright_utility_world__';

View File

@ -16,7 +16,7 @@
import { WKSession } from './wkConnection';
import { WKPage } from './wkPage';
import { RegisteredListener, helper } from '../../helper';
import { RegisteredListener, helper } from '../helper';
import { Protocol } from './protocol';
import { assert } from '../../utils/utils';

View File

@ -14,12 +14,12 @@
* limitations under the License.
*/
import { helper, RegisteredListener } from '../../helper';
import { Page, Worker } from '../../page';
import { helper, RegisteredListener } from '../helper';
import { Page, Worker } from '../page';
import { Protocol } from './protocol';
import { WKSession } from './wkConnection';
import { WKExecutionContext } from './wkExecutionContext';
import * as types from '../../types';
import * as types from '../types';
export class WKWorkers {
private _sessionListeners: RegisteredListener[] = [];

View File

@ -25,7 +25,7 @@ it('should require top-level Errors', async({}) => {
});
it('should require top-level DeviceDescriptors', async({playwright}) => {
const Devices = require(path.join(utils.projectRoot(), '/lib/deviceDescriptors.js')).DeviceDescriptors;
const Devices = require(path.join(utils.projectRoot(), '/lib/server/deviceDescriptors.js')).DeviceDescriptors;
expect(Devices['iPhone 6']).toBeTruthy();
expect(Devices['iPhone 6']).toEqual(playwright.devices['iPhone 6']);
});

View File

@ -57,9 +57,7 @@ async function checkDeps() {
if (fromDirectory === toDirectory)
return true;
if (['src/', 'src/rpc/server/', 'src/rpc/'].includes(fromDirectory))
return true; // Temporary.
if (toDirectory === 'src/')
if (['src/rpc/server/', 'src/rpc/'].includes(fromDirectory))
return true; // Temporary.
while (!DEPS[from]) {
@ -87,20 +85,28 @@ async function checkDeps() {
const DEPS = {};
// No deps for code shared between node and page.
DEPS['src/common/'] = [];
DEPS['src/server/common/'] = [];
DEPS['src/protocol/'] = ['src/utils/'];
DEPS['src/install/'] = ['src/utils/'];
// Client depends on chromium protocol for types.
DEPS['src/client/'] = ['src/utils/', 'src/protocol/', 'src/server/chromium/protocol.ts'];
DEPS['src/server/'] = ['src/utils/', 'src/common/', 'src/server/injected/'];
DEPS['src/server/'] = [
'src/utils/',
'src/server/common/',
'src/server/injected/',
'src/generated/',
// TODO: remove the server->debug dependency.
'src/server/debug/**',
];
// Strict deps for injected code.
// TODO: reverse the injected->types dependency.
DEPS['src/server/injected/'] = ['src/common/', 'src/types.ts'];
// TODO: remove the injected->types dependency.
DEPS['src/server/injected/'] = ['src/server/common/', 'src/server/types.ts'];
DEPS['src/server/debug/'] = [...DEPS['src/server/'], 'src/server/debug/**'];
DEPS['src/server/debug/'] = [...DEPS['src/server/'], 'src/server/', 'src/server/debug/**'];
DEPS['src/server/chromium/'] = [...DEPS['src/server/'], 'src/server/'];
DEPS['src/server/electron/'] = [...DEPS['src/server/'], 'src/server/', 'src/server/chromium/'];