Skip to content

Commit

Permalink
chore: move last rpc files to their place (#3604)
Browse files Browse the repository at this point in the history
Also update check-deps to be more user-friendly.
  • Loading branch information
dgozman authored Aug 24, 2020
1 parent 59a439e commit a099e94
Show file tree
Hide file tree
Showing 26 changed files with 99 additions and 95 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

const { Playwright } = require('./lib/server/playwright');
const { Electron } = require('./lib/server/electron/electron');
const { setupInProcess } = require('./lib/rpc/inprocess');
const { setupInProcess } = require('./lib/inprocess');
const path = require('path');

const playwright = new Playwright(__dirname, require(path.join(__dirname, 'browsers.json'))['browsers']);
Expand Down
2 changes: 1 addition & 1 deletion packages/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
*/

const { Playwright } = require('./lib/server/playwright');
const { setupInProcess } = require('./lib/rpc/inprocess');
const { setupInProcess } = require('./lib/inprocess');

module.exports = setupInProcess(new Playwright(__dirname, require('./browsers.json')['browsers']));
2 changes: 1 addition & 1 deletion packages/playwright-driver/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ const util = require('util');
return;
}

require('../../lib/rpc/server');
require('../../lib/server');
})();
2 changes: 1 addition & 1 deletion packages/playwright-electron/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

const { Playwright } = require('./lib/server/playwright');
const { Electron } = require('./lib/server/electron/electron');
const { setupInProcess } = require('./lib/rpc/inprocess');
const { setupInProcess } = require('./lib/inprocess');

const playwright = new Playwright(__dirname, require('./browsers.json')['browsers']);
playwright.electron = new Electron();
Expand Down
22 changes: 11 additions & 11 deletions src/rpc/browserServerImpl.ts → src/browserServerImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
* limitations under the License.
*/

import { LaunchServerOptions } from '../client/types';
import { BrowserTypeBase } from '../server/browserType';
import { LaunchServerOptions } from './client/types';
import { BrowserTypeBase } from './server/browserType';
import * as ws from 'ws';
import { helper } from '../server/helper';
import { Browser } from '../server/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';
import { BrowserTypeDispatcher } from './server/browserTypeDispatcher';
import { BrowserDispatcher } from './server/browserDispatcher';
import { BrowserContextDispatcher } from './server/browserContextDispatcher';
import { BrowserNewContextParams, BrowserContextChannel } from '../protocol/channels';
import { BrowserServerLauncher, BrowserServer } from '../client/browserType';
import { envObjectToArray } from '../client/clientHelper';
import { DispatcherScope, DispatcherConnection } from './dispatchers/dispatcher';
import { BrowserTypeDispatcher } from './dispatchers/browserTypeDispatcher';
import { BrowserDispatcher } from './dispatchers/browserDispatcher';
import { BrowserContextDispatcher } from './dispatchers/browserContextDispatcher';
import { BrowserNewContextParams, BrowserContextChannel } from './protocol/channels';
import { BrowserServerLauncher, BrowserServer } from './client/browserType';
import { envObjectToArray } from './client/clientHelper';

export class BrowserServerLauncherImpl implements BrowserServerLauncher {
private _browserType: BrowserTypeBase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* limitations under the License.
*/

import { BrowserContext } from '../../server/browserContext';
import { BrowserContext } from '../server/browserContext';
import { Dispatcher, DispatcherScope, lookupDispatcher } from './dispatcher';
import { PageDispatcher, BindingCallDispatcher, WorkerDispatcher } from './pageDispatcher';
import * as channels from '../../protocol/channels';
import * as channels from '../protocol/channels';
import { RouteDispatcher, RequestDispatcher } from './networkDispatchers';
import { CRBrowserContext } from '../../server/chromium/crBrowser';
import { CRBrowserContext } from '../server/chromium/crBrowser';
import { CDPSessionDispatcher } from './cdpSessionDispatcher';

export class BrowserContextDispatcher extends Dispatcher<BrowserContext, channels.BrowserContextInitializer> implements channels.BrowserContextChannel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* limitations under the License.
*/

import { Browser } from '../../server/browser';
import * as channels from '../../protocol/channels';
import { Browser } from '../server/browser';
import * as channels from '../protocol/channels';
import { BrowserContextDispatcher } from './browserContextDispatcher';
import { CDPSessionDispatcher } from './cdpSessionDispatcher';
import { Dispatcher, DispatcherScope } from './dispatcher';
import { CRBrowser } from '../../server/chromium/crBrowser';
import { CRBrowser } from '../server/chromium/crBrowser';
import { PageDispatcher } from './pageDispatcher';

export class BrowserDispatcher extends Dispatcher<Browser, channels.BrowserInitializer> implements channels.BrowserChannel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

import { BrowserTypeBase, BrowserType } from '../../server/browserType';
import { BrowserTypeBase, BrowserType } from '../server/browserType';
import { BrowserDispatcher } from './browserDispatcher';
import * as channels from '../../protocol/channels';
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
import { BrowserContextDispatcher } from './browserContextDispatcher';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import { CRSession, CRSessionEvents } from '../../server/chromium/crConnection';
import * as channels from '../../protocol/channels';
import { CRSession, CRSessionEvents } from '../server/chromium/crConnection';
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';

export class CDPSessionDispatcher extends Dispatcher<CRSession, channels.CDPSessionInitializer> implements channels.CDPSessionChannel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import { ConsoleMessage } from '../../server/console';
import * as channels from '../../protocol/channels';
import { ConsoleMessage } from '../server/console';
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
import { createHandle } from './elementHandlerDispatcher';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import { Dialog } from '../../server/dialog';
import * as channels from '../../protocol/channels';
import { Dialog } from '../server/dialog';
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';

export class DialogDispatcher extends Dispatcher<Dialog, channels.DialogInitializer> implements channels.DialogChannel {
Expand Down
10 changes: 5 additions & 5 deletions src/rpc/server/dispatcher.ts → src/dispatchers/dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/

import { EventEmitter } from 'events';
import { helper } from '../../server/helper';
import * as channels from '../../protocol/channels';
import { serializeError } from '../../protocol/serializers';
import { createScheme, Validator, ValidationError } from '../../protocol/validator';
import { assert, debugAssert } from '../../utils/utils';
import { helper } from '../server/helper';
import * as channels from '../protocol/channels';
import { serializeError } from '../protocol/serializers';
import { createScheme, Validator, ValidationError } from '../protocol/validator';
import { assert, debugAssert } from '../utils/utils';

export const dispatcherSymbol = Symbol('dispatcher');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import { Download } from '../../server/download';
import * as channels from '../../protocol/channels';
import { Download } from '../server/download';
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
import { StreamDispatcher } from './streamDispatcher';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

import { Dispatcher, DispatcherScope, lookupDispatcher } from './dispatcher';
import { Electron, ElectronApplication, ElectronPage } from '../../server/electron/electron';
import * as channels from '../../protocol/channels';
import { Electron, ElectronApplication, ElectronPage } from '../server/electron/electron';
import * as channels from '../protocol/channels';
import { BrowserContextDispatcher } from './browserContextDispatcher';
import { PageDispatcher } from './pageDispatcher';
import { parseArgument, serializeResult } from './jsHandleDispatcher';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

import { ElementHandle } from '../../server/dom';
import * as js from '../../server/javascript';
import * as channels from '../../protocol/channels';
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';
import { FrameDispatcher } from './frameDispatcher';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import { Frame, NavigationEvent } from '../../server/frames';
import * as channels from '../../protocol/channels';
import { Frame, NavigationEvent } from '../server/frames';
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope, lookupNullableDispatcher, existingDispatcher } from './dispatcher';
import { ElementHandleDispatcher, createHandle } from './elementHandlerDispatcher';
import { parseArgument, serializeResult } from './jsHandleDispatcher';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

import * as js from '../../server/javascript';
import * as channels from '../../protocol/channels';
import * as js from '../server/javascript';
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
import { createHandle } from './elementHandlerDispatcher';
import { parseSerializedValue, serializeValue } from '../../protocol/serializers';
import { parseSerializedValue, serializeValue } from '../protocol/serializers';

export class JSHandleDispatcher extends Dispatcher<js.JSHandle, channels.JSHandleInitializer> implements channels.JSHandleChannel {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import { Request, Response, Route } from '../../server/network';
import * as channels from '../../protocol/channels';
import { Request, Response, Route } from '../server/network';
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope, lookupNullableDispatcher, existingDispatcher } from './dispatcher';
import { FrameDispatcher } from './frameDispatcher';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@
* limitations under the License.
*/

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 { 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';
import { parseError, serializeError } from '../protocol/serializers';
import { ConsoleMessageDispatcher } from './consoleMessageDispatcher';
import { DialogDispatcher } from './dialogDispatcher';
import { DownloadDispatcher } from './downloadDispatcher';
import { FrameDispatcher } from './frameDispatcher';
import { RequestDispatcher, ResponseDispatcher, RouteDispatcher } from './networkDispatchers';
import { serializeResult, parseArgument } from './jsHandleDispatcher';
import { ElementHandleDispatcher, createHandle } from './elementHandlerDispatcher';
import { FileChooser } from '../../server/fileChooser';
import { CRCoverage } from '../../server/chromium/crCoverage';
import { FileChooser } from '../server/fileChooser';
import { CRCoverage } from '../server/chromium/crCoverage';

export class PageDispatcher extends Dispatcher<Page, channels.PageInitializer> implements channels.PageChannel {
private _page: Page;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
* limitations under the License.
*/

import { Playwright } from '../../server/playwright';
import * as channels from '../../protocol/channels';
import { Playwright } from '../server/playwright';
import * as channels from '../protocol/channels';
import { BrowserTypeDispatcher } from './browserTypeDispatcher';
import { Dispatcher, DispatcherScope } from './dispatcher';
import { SelectorsDispatcher } from './selectorsDispatcher';
import { Electron } from '../../server/electron/electron';
import { Electron } from '../server/electron/electron';
import { ElectronDispatcher } from './electronDispatcher';
import { DeviceDescriptors } from '../../server/deviceDescriptors';
import { DeviceDescriptors } from '../server/deviceDescriptors';

export class PlaywrightDispatcher extends Dispatcher<Playwright, channels.PlaywrightInitializer> implements channels.PlaywrightChannel {
constructor(scope: DispatcherScope, playwright: Playwright) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
*/

import { Dispatcher, DispatcherScope } from './dispatcher';
import * as channels from '../../protocol/channels';
import { Selectors } from '../../server/selectors';
import * as channels from '../protocol/channels';
import { Selectors } from '../server/selectors';
import { ElementHandleDispatcher } from './elementHandlerDispatcher';
import * as dom from '../../server/dom';
import * as dom from '../server/dom';

export class SelectorsDispatcher extends Dispatcher<Selectors, channels.SelectorsInitializer> implements channels.SelectorsChannel {
constructor(scope: DispatcherScope, selectors: Selectors) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import * as channels from '../../protocol/channels';
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
import * as stream from 'stream';

Expand Down
12 changes: 6 additions & 6 deletions src/rpc/inprocess.ts → src/inprocess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* limitations under the License.
*/

import { DispatcherConnection } from './server/dispatcher';
import type { Playwright as PlaywrightImpl } from '../server/playwright';
import type { Playwright as PlaywrightAPI } from '../client/playwright';
import { PlaywrightDispatcher } from './server/playwrightDispatcher';
import { Connection } from '../client/connection';
import { DispatcherConnection } from './dispatchers/dispatcher';
import type { Playwright as PlaywrightImpl } from './server/playwright';
import type { Playwright as PlaywrightAPI } from './client/playwright';
import { PlaywrightDispatcher } from './dispatchers/playwrightDispatcher';
import { Connection } from './client/connection';
import { BrowserServerLauncherImpl } from './browserServerImpl';
import { isUnderTest } from '../utils/utils';
import { isUnderTest } from './utils/utils';

export function setupInProcess(playwright: PlaywrightImpl): PlaywrightAPI {
const clientConnection = new Connection();
Expand Down
12 changes: 6 additions & 6 deletions src/rpc/server.ts → src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* limitations under the License.
*/

import { Transport } from '../protocol/transport';
import { DispatcherConnection } from './server/dispatcher';
import { Playwright } from '../server/playwright';
import { PlaywrightDispatcher } from './server/playwrightDispatcher';
import { Electron } from '../server/electron/electron';
import { gracefullyCloseAll } from '../server/processLauncher';
import { Transport } from './protocol/transport';
import { DispatcherConnection } from './dispatchers/dispatcher';
import { Playwright } from './server/playwright';
import { PlaywrightDispatcher } from './dispatchers/playwrightDispatcher';
import { Electron } from './server/electron/electron';
import { gracefullyCloseAll } from './server/processLauncher';

const dispatcherConnection = new DispatcherConnection();
const transport = new Transport(process.stdout, process.stdin);
Expand Down
2 changes: 1 addition & 1 deletion test/playwright.fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ registerWorkerFixture('playwright', async({browserName}, test) => {
const {coverage, uninstall} = installCoverageHooks(browserName);
if (options.WIRE) {
const connection = new Connection();
const spawnedProcess = childProcess.fork(path.join(__dirname, '..', 'lib', 'rpc', 'server'), [], {
const spawnedProcess = childProcess.fork(path.join(__dirname, '..', 'lib', 'server'), [], {
stdio: 'pipe',
detached: true,
});
Expand Down
Loading

0 comments on commit a099e94

Please sign in to comment.