chore: move protocol files to src/protocol (#3571)

This commit is contained in:
Dmitry Gozman 2020-08-21 18:46:11 -07:00 committed by GitHub
parent 398bd477ac
commit 6fe1cd9812
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
65 changed files with 74 additions and 74 deletions

View File

@ -120,7 +120,7 @@ if (!args.some(arg => arg === '--no-cleanup')) {
await copyToPackage(path.join(ROOT_PATH, file), path.join(packagePath, file)); await copyToPackage(path.join(ROOT_PATH, file), path.join(packagePath, file));
await copyToPackage(path.join(ROOT_PATH, 'docs/api.md'), path.join(packagePath, 'api.md')); await copyToPackage(path.join(ROOT_PATH, 'docs/api.md'), path.join(packagePath, 'api.md'));
await copyToPackage(path.join(ROOT_PATH, 'src/rpc/protocol.yml'), path.join(packagePath, 'protocol.yml')); await copyToPackage(path.join(ROOT_PATH, 'src/protocol/protocol.yml'), path.join(packagePath, 'protocol.yml'));
// 4. Generate package.json // 4. Generate package.json
const pwInternalJSON = require(path.join(ROOT_PATH, 'package.json')); const pwInternalJSON = require(path.join(ROOT_PATH, 'package.json'));

View File

@ -16,7 +16,7 @@
import { chromium, firefox, webkit, selectors, devices, errors } from 'playwright-chromium'; import { chromium, firefox, webkit, selectors, devices, errors } from 'playwright-chromium';
import playwright from 'playwright-chromium'; import playwright from 'playwright-chromium';
import errorsFile from 'playwright-chromium/lib/errors.js'; import errorsFile from 'playwright-chromium/lib/utils/errors.js';
import testESM from './esm.mjs'; import testESM from './esm.mjs';
testESM({ chromium, firefox, webkit, selectors, devices, errors, playwright, errorsFile }, [chromium]); testESM({ chromium, firefox, webkit, selectors, devices, errors, playwright, errorsFile }, [chromium]);

View File

@ -16,7 +16,7 @@
import { chromium, firefox, webkit, selectors, devices, errors } from 'playwright-firefox'; import { chromium, firefox, webkit, selectors, devices, errors } from 'playwright-firefox';
import playwright from 'playwright-firefox'; import playwright from 'playwright-firefox';
import errorsFile from 'playwright-firefox/lib/errors.js'; import errorsFile from 'playwright-firefox/lib/utils/errors.js';
import testESM from './esm.mjs'; import testESM from './esm.mjs';
testESM({ chromium, firefox, webkit, selectors, devices, errors, playwright, errorsFile }, [firefox]); testESM({ chromium, firefox, webkit, selectors, devices, errors, playwright, errorsFile }, [firefox]);

View File

@ -16,7 +16,7 @@
import { chromium, firefox, webkit, selectors, devices, errors } from 'playwright-webkit'; import { chromium, firefox, webkit, selectors, devices, errors } from 'playwright-webkit';
import playwright from 'playwright-webkit'; import playwright from 'playwright-webkit';
import errorsFile from 'playwright-webkit/lib/errors.js'; import errorsFile from 'playwright-webkit/lib/utils/errors.js';
import testESM from './esm.mjs'; import testESM from './esm.mjs';
testESM({ chromium, firefox, webkit, selectors, devices, errors, playwright, errorsFile }, [webkit]); testESM({ chromium, firefox, webkit, selectors, devices, errors, playwright, errorsFile }, [webkit]);

View File

@ -16,7 +16,7 @@
import { chromium, firefox, webkit, selectors, devices, errors } from 'playwright'; import { chromium, firefox, webkit, selectors, devices, errors } from 'playwright';
import playwright from 'playwright'; import playwright from 'playwright';
import errorsFile from 'playwright/lib/errors.js'; import errorsFile from 'playwright/lib/utils/errors.js';
import testESM from './esm.mjs'; import testESM from './esm.mjs';
testESM({ chromium, firefox, webkit, selectors, devices, errors, playwright, errorsFile }, [chromium, firefox, webkit]); testESM({ chromium, firefox, webkit, selectors, devices, errors, playwright, errorsFile }, [chromium, firefox, webkit]);

View File

@ -29,7 +29,7 @@ if (process.argv[3] === 'all')
const playwright = require(requireName); const playwright = require(requireName);
// Requiring internals should work. // Requiring internals should work.
const errors = require(requireName + '/lib/errors'); const errors = require(requireName + '/lib/utils/errors');
const installer = require(requireName + '/lib/install/installer'); const installer = require(requireName + '/lib/install/installer');
(async () => { (async () => {

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { TimeoutError } from './errors'; import { TimeoutError } from './utils/errors';
import { assert, debugLogger, LogName } from './helper'; import { assert, debugLogger, LogName } from './helper';
import { rewriteErrorMessage } from './utils/stackTrace'; import { rewriteErrorMessage } from './utils/stackTrace';

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { TimeoutError } from '../errors'; import { TimeoutError } from '../utils/errors';
import { helper } from '../helper'; import { helper } from '../helper';
import { SerializedError, SerializedValue } from './channels'; import { SerializedError, SerializedValue } from './channels';

View File

@ -25,7 +25,7 @@ import { DispatcherScope, DispatcherConnection } from './server/dispatcher';
import { BrowserTypeDispatcher } from './server/browserTypeDispatcher'; import { BrowserTypeDispatcher } from './server/browserTypeDispatcher';
import { BrowserDispatcher } from './server/browserDispatcher'; import { BrowserDispatcher } from './server/browserDispatcher';
import { BrowserContextDispatcher } from './server/browserContextDispatcher'; import { BrowserContextDispatcher } from './server/browserContextDispatcher';
import { BrowserNewContextParams, BrowserContextChannel } from './channels'; import { BrowserNewContextParams, BrowserContextChannel } from '../protocol/channels';
import { BrowserServerLauncher, BrowserServer } from './client/browserType'; import { BrowserServerLauncher, BrowserServer } from './client/browserType';
import { envObjectToArray } from './client/clientHelper'; import { envObjectToArray } from './client/clientHelper';

View File

@ -17,7 +17,7 @@
import * as childProcess from 'child_process'; import * as childProcess from 'child_process';
import * as path from 'path'; import * as path from 'path';
import { Connection } from './client/connection'; import { Connection } from './client/connection';
import { Transport } from './transport'; import { Transport } from '../protocol/transport';
(async () => { (async () => {
const spawnedProcess = childProcess.fork(path.join(__dirname, 'server'), [], { stdio: 'pipe' }); const spawnedProcess = childProcess.fork(path.join(__dirname, 'server'), [], { stdio: 'pipe' });

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { PageChannel, AXNode } from '../channels'; import { PageChannel, AXNode } from '../../protocol/channels';
import { ElementHandle } from './elementHandle'; import { ElementHandle } from './elementHandle';
type SerializedAXNode = Omit<AXNode, 'valueString' | 'valueNumber' | 'children' | 'checked' | 'pressed'> & { type SerializedAXNode = Omit<AXNode, 'valueString' | 'valueNumber' | 'children' | 'checked' | 'pressed'> & {

View File

@ -25,7 +25,7 @@ export { Download } from './download';
export { ElementHandle } from './elementHandle'; export { ElementHandle } from './elementHandle';
export { FileChooser } from './fileChooser'; export { FileChooser } from './fileChooser';
export { Logger } from './types'; export { Logger } from './types';
export { TimeoutError } from '../../errors'; export { TimeoutError } from '../../utils/errors';
export { Frame } from './frame'; export { Frame } from './frame';
export { Keyboard, Mouse } from './input'; export { Keyboard, Mouse } from './input';
export { JSHandle } from './jsHandle'; export { JSHandle } from './jsHandle';

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { BrowserChannel, BrowserInitializer, BrowserNewContextParams } from '../channels'; import { BrowserChannel, BrowserInitializer, BrowserNewContextParams } from '../../protocol/channels';
import { BrowserContext } from './browserContext'; import { BrowserContext } from './browserContext';
import { Page } from './page'; import { Page } from './page';
import { ChannelOwner } from './channelOwner'; import { ChannelOwner } from './channelOwner';

View File

@ -18,7 +18,7 @@
import * as frames from './frame'; import * as frames from './frame';
import { Page, BindingCall } from './page'; import { Page, BindingCall } from './page';
import * as network from './network'; import * as network from './network';
import { BrowserContextChannel, BrowserContextInitializer } from '../channels'; import { BrowserContextChannel, BrowserContextInitializer } from '../../protocol/channels';
import { ChannelOwner } from './channelOwner'; import { ChannelOwner } from './channelOwner';
import { isUnderTest, deprecate, evaluationScript, urlMatches } from './clientHelper'; import { isUnderTest, deprecate, evaluationScript, urlMatches } from './clientHelper';
import { Browser } from './browser'; import { Browser } from './browser';

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { BrowserTypeChannel, BrowserTypeInitializer, BrowserTypeLaunchParams, BrowserTypeLaunchPersistentContextParams } from '../channels'; import { BrowserTypeChannel, BrowserTypeInitializer, BrowserTypeLaunchParams, BrowserTypeLaunchPersistentContextParams } from '../../protocol/channels';
import { Browser } from './browser'; import { Browser } from './browser';
import { BrowserContext } from './browserContext'; import { BrowserContext } from './browserContext';
import { ChannelOwner } from './channelOwner'; import { ChannelOwner } from './channelOwner';
@ -23,7 +23,7 @@ import { assert, helper } from '../../helper';
import { LaunchOptions, LaunchServerOptions, ConnectOptions, LaunchPersistentContextOptions } from './types'; import { LaunchOptions, LaunchServerOptions, ConnectOptions, LaunchPersistentContextOptions } from './types';
import * as WebSocket from 'ws'; import * as WebSocket from 'ws';
import { Connection } from './connection'; import { Connection } from './connection';
import { serializeError } from '../serializers'; import { serializeError } from '../../protocol/serializers';
import { Events } from './events'; import { Events } from './events';
import { TimeoutSettings } from '../../timeoutSettings'; import { TimeoutSettings } from '../../timeoutSettings';
import { ChildProcess } from 'child_process'; import { ChildProcess } from 'child_process';

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { CDPSessionChannel, CDPSessionInitializer } from '../channels'; import { CDPSessionChannel, CDPSessionInitializer } from '../../protocol/channels';
import { ChannelOwner } from './channelOwner'; import { ChannelOwner } from './channelOwner';
import { Protocol } from '../../chromium/protocol'; import { Protocol } from '../../chromium/protocol';

View File

@ -15,7 +15,7 @@
*/ */
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
import type { Channel } from '../channels'; import type { Channel } from '../../protocol/channels';
import type { Connection } from './connection'; import type { Connection } from './connection';
import type { LoggerSink } from './types'; import type { LoggerSink } from './types';
import { debugLogger } from '../../helper'; import { debugLogger } from '../../helper';

View File

@ -16,7 +16,7 @@
*/ */
import { Page } from './page'; import { Page } from './page';
import { BrowserContextInitializer } from '../channels'; import { BrowserContextInitializer } from '../../protocol/channels';
import { ChannelOwner } from './channelOwner'; import { ChannelOwner } from './channelOwner';
import { CDPSession } from './cdpSession'; import { CDPSession } from './cdpSession';
import { Events } from './events'; import { Events } from './events';

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { PageChannel, PageCrStartJSCoverageOptions, PageCrStopJSCoverageResult, PageCrStartCSSCoverageOptions, PageCrStopCSSCoverageResult } from '../channels'; import { PageChannel, PageCrStartJSCoverageOptions, PageCrStopJSCoverageResult, PageCrStartCSSCoverageOptions, PageCrStopCSSCoverageResult } from '../../protocol/channels';
let __dummyJSResult: PageCrStopJSCoverageResult; let __dummyJSResult: PageCrStopJSCoverageResult;
type PageCrStopJSCoverageResultEntries = typeof __dummyJSResult.entries; type PageCrStopJSCoverageResultEntries = typeof __dummyJSResult.entries;

View File

@ -27,16 +27,16 @@ import { Worker } from './worker';
import { ConsoleMessage } from './consoleMessage'; import { ConsoleMessage } from './consoleMessage';
import { Dialog } from './dialog'; import { Dialog } from './dialog';
import { Download } from './download'; import { Download } from './download';
import { parseError } from '../serializers'; import { parseError } from '../../protocol/serializers';
import { CDPSession } from './cdpSession'; import { CDPSession } from './cdpSession';
import { Playwright } from './playwright'; import { Playwright } from './playwright';
import { Electron, ElectronApplication } from './electron'; import { Electron, ElectronApplication } from './electron';
import { Channel } from '../channels'; import { Channel } from '../../protocol/channels';
import { ChromiumBrowser } from './chromiumBrowser'; import { ChromiumBrowser } from './chromiumBrowser';
import { ChromiumBrowserContext } from './chromiumBrowserContext'; import { ChromiumBrowserContext } from './chromiumBrowserContext';
import { Selectors } from './selectors'; import { Selectors } from './selectors';
import { Stream } from './stream'; import { Stream } from './stream';
import { createScheme, Validator, ValidationError } from '../validator'; import { createScheme, Validator, ValidationError } from '../../protocol/validator';
import { WebKitBrowser } from './webkitBrowser'; import { WebKitBrowser } from './webkitBrowser';
import { FirefoxBrowser } from './firefoxBrowser'; import { FirefoxBrowser } from './firefoxBrowser';
import { debugLogger } from '../../helper'; import { debugLogger } from '../../helper';

View File

@ -16,7 +16,7 @@
import * as util from 'util'; import * as util from 'util';
import { JSHandle } from './jsHandle'; import { JSHandle } from './jsHandle';
import { ConsoleMessageChannel, ConsoleMessageInitializer } from '../channels'; import { ConsoleMessageChannel, ConsoleMessageInitializer } from '../../protocol/channels';
import { ChannelOwner } from './channelOwner'; import { ChannelOwner } from './channelOwner';
type ConsoleMessageLocation = ConsoleMessageInitializer['location']; type ConsoleMessageLocation = ConsoleMessageInitializer['location'];

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { DialogChannel, DialogInitializer } from '../channels'; import { DialogChannel, DialogInitializer } from '../../protocol/channels';
import { ChannelOwner } from './channelOwner'; import { ChannelOwner } from './channelOwner';
export class Dialog extends ChannelOwner<DialogChannel, DialogInitializer> { export class Dialog extends ChannelOwner<DialogChannel, DialogInitializer> {

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { DownloadChannel, DownloadInitializer } from '../channels'; import { DownloadChannel, DownloadInitializer } from '../../protocol/channels';
import { ChannelOwner } from './channelOwner'; import { ChannelOwner } from './channelOwner';
import { Readable } from 'stream'; import { Readable } from 'stream';
import { Stream } from './stream'; import { Stream } from './stream';

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { ElectronChannel, ElectronInitializer, ElectronApplicationChannel, ElectronApplicationInitializer, ElectronLaunchParams, ElectronLaunchOptions } from '../channels'; import { ElectronChannel, ElectronInitializer, ElectronApplicationChannel, ElectronApplicationInitializer, ElectronLaunchParams, ElectronLaunchOptions } from '../../protocol/channels';
import { BrowserContext } from './browserContext'; import { BrowserContext } from './browserContext';
import { ChannelOwner } from './channelOwner'; import { ChannelOwner } from './channelOwner';
import { Page } from './page'; import { Page } from './page';

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { ElementHandleChannel, JSHandleInitializer, ElementHandleScrollIntoViewIfNeededOptions, ElementHandleHoverOptions, ElementHandleClickOptions, ElementHandleDblclickOptions, ElementHandleFillOptions, ElementHandleSetInputFilesOptions, ElementHandlePressOptions, ElementHandleCheckOptions, ElementHandleUncheckOptions, ElementHandleScreenshotOptions, ElementHandleTypeOptions, ElementHandleSelectTextOptions, ElementHandleWaitForSelectorOptions, ElementHandleWaitForElementStateOptions, ElementHandleSetInputFilesParams } from '../channels'; import { ElementHandleChannel, JSHandleInitializer, ElementHandleScrollIntoViewIfNeededOptions, ElementHandleHoverOptions, ElementHandleClickOptions, ElementHandleDblclickOptions, ElementHandleFillOptions, ElementHandleSetInputFilesOptions, ElementHandlePressOptions, ElementHandleCheckOptions, ElementHandleUncheckOptions, ElementHandleScreenshotOptions, ElementHandleTypeOptions, ElementHandleSelectTextOptions, ElementHandleWaitForSelectorOptions, ElementHandleWaitForElementStateOptions, ElementHandleSetInputFilesParams } from '../../protocol/channels';
import { Frame } from './frame'; import { Frame } from './frame';
import { FuncOn, JSHandle, serializeArgument, parseResult } from './jsHandle'; import { FuncOn, JSHandle, serializeArgument, parseResult } from './jsHandle';
import { ChannelOwner } from './channelOwner'; import { ChannelOwner } from './channelOwner';

View File

@ -17,7 +17,7 @@
import { ElementHandle } from './elementHandle'; import { ElementHandle } from './elementHandle';
import { Page } from './page'; import { Page } from './page';
import { FilePayload } from './types'; import { FilePayload } from './types';
import { ElementHandleSetInputFilesOptions } from '../channels'; import { ElementHandleSetInputFilesOptions } from '../../protocol/channels';
export class FileChooser { export class FileChooser {
private _page: Page; private _page: Page;

View File

@ -16,7 +16,7 @@
*/ */
import { assert } from '../../helper'; import { assert } from '../../helper';
import { FrameChannel, FrameInitializer, FrameNavigatedEvent, FrameGotoOptions, FrameWaitForSelectorOptions, FrameDispatchEventOptions, FrameSetContentOptions, FrameClickOptions, FrameDblclickOptions, FrameFillOptions, FrameFocusOptions, FrameTextContentOptions, FrameInnerTextOptions, FrameInnerHTMLOptions, FrameGetAttributeOptions, FrameHoverOptions, FrameSetInputFilesOptions, FrameTypeOptions, FramePressOptions, FrameCheckOptions, FrameUncheckOptions } from '../channels'; import { FrameChannel, FrameInitializer, FrameNavigatedEvent, FrameGotoOptions, FrameWaitForSelectorOptions, FrameDispatchEventOptions, FrameSetContentOptions, FrameClickOptions, FrameDblclickOptions, FrameFillOptions, FrameFocusOptions, FrameTextContentOptions, FrameInnerTextOptions, FrameInnerHTMLOptions, FrameGetAttributeOptions, FrameHoverOptions, FrameSetInputFilesOptions, FrameTypeOptions, FramePressOptions, FrameCheckOptions, FrameUncheckOptions } from '../../protocol/channels';
import { BrowserContext } from './browserContext'; import { BrowserContext } from './browserContext';
import { ChannelOwner } from './channelOwner'; import { ChannelOwner } from './channelOwner';
import { ElementHandle, convertSelectOptionValues, convertInputFiles } from './elementHandle'; import { ElementHandle, convertSelectOptionValues, convertInputFiles } from './elementHandle';

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { PageChannel, PageKeyboardTypeOptions, PageKeyboardPressOptions, PageMouseDownOptions, PageMouseUpOptions, PageMouseClickOptions } from '../channels'; import { PageChannel, PageKeyboardTypeOptions, PageKeyboardPressOptions, PageMouseDownOptions, PageMouseUpOptions, PageMouseClickOptions } from '../../protocol/channels';
export class Keyboard { export class Keyboard {
private _channel: PageChannel; private _channel: PageChannel;

View File

@ -14,10 +14,10 @@
* limitations under the License. * limitations under the License.
*/ */
import { JSHandleChannel, JSHandleInitializer, SerializedArgument, SerializedValue, Channel } from '../channels'; import { JSHandleChannel, JSHandleInitializer, SerializedArgument, SerializedValue, Channel } from '../../protocol/channels';
import { ElementHandle } from './elementHandle'; import { ElementHandle } from './elementHandle';
import { ChannelOwner } from './channelOwner'; import { ChannelOwner } from './channelOwner';
import { parseSerializedValue, serializeValue } from '../serializers'; import { parseSerializedValue, serializeValue } from '../../protocol/serializers';
type NoHandles<Arg> = Arg extends JSHandle ? never : (Arg extends object ? { [Key in keyof Arg]: NoHandles<Arg[Key]> } : Arg); type NoHandles<Arg> = Arg extends JSHandle ? never : (Arg extends object ? { [Key in keyof Arg]: NoHandles<Arg[Key]> } : Arg);
type Unboxed<Arg> = type Unboxed<Arg> =

View File

@ -15,7 +15,7 @@
*/ */
import { URLSearchParams } from 'url'; import { URLSearchParams } from 'url';
import { RequestChannel, ResponseChannel, RouteChannel, RequestInitializer, ResponseInitializer, RouteInitializer } from '../channels'; import { RequestChannel, ResponseChannel, RouteChannel, RequestInitializer, ResponseInitializer, RouteInitializer } from '../../protocol/channels';
import { ChannelOwner } from './channelOwner'; import { ChannelOwner } from './channelOwner';
import { Frame } from './frame'; import { Frame } from './frame';
import { headersArrayToObject, headersObjectToArray } from '../../converters'; import { headersArrayToObject, headersObjectToArray } from '../../converters';

View File

@ -18,8 +18,8 @@
import { Events } from './events'; import { Events } from './events';
import { assert, helper, Listener, mkdirIfNeeded } from '../../helper'; import { assert, helper, Listener, mkdirIfNeeded } from '../../helper';
import { TimeoutSettings } from '../../timeoutSettings'; import { TimeoutSettings } from '../../timeoutSettings';
import { BindingCallChannel, BindingCallInitializer, PageChannel, PageInitializer, PagePdfParams, FrameWaitForSelectorOptions, FrameDispatchEventOptions, FrameSetContentOptions, FrameGotoOptions, PageReloadOptions, PageGoBackOptions, PageGoForwardOptions, PageScreenshotOptions, FrameClickOptions, FrameDblclickOptions, FrameFillOptions, FrameFocusOptions, FrameTextContentOptions, FrameInnerTextOptions, FrameInnerHTMLOptions, FrameGetAttributeOptions, FrameHoverOptions, FrameSetInputFilesOptions, FrameTypeOptions, FramePressOptions, FrameCheckOptions, FrameUncheckOptions } from '../channels'; import { BindingCallChannel, BindingCallInitializer, PageChannel, PageInitializer, PagePdfParams, FrameWaitForSelectorOptions, FrameDispatchEventOptions, FrameSetContentOptions, FrameGotoOptions, PageReloadOptions, PageGoBackOptions, PageGoForwardOptions, PageScreenshotOptions, FrameClickOptions, FrameDblclickOptions, FrameFillOptions, FrameFocusOptions, FrameTextContentOptions, FrameInnerTextOptions, FrameInnerHTMLOptions, FrameGetAttributeOptions, FrameHoverOptions, FrameSetInputFilesOptions, FrameTypeOptions, FramePressOptions, FrameCheckOptions, FrameUncheckOptions } from '../../protocol/channels';
import { parseError, serializeError } from '../serializers'; import { parseError, serializeError } from '../../protocol/serializers';
import { headersObjectToArray } from '../../converters'; import { headersObjectToArray } from '../../converters';
import { Accessibility } from './accessibility'; import { Accessibility } from './accessibility';
import { BrowserContext } from './browserContext'; import { BrowserContext } from './browserContext';

View File

@ -14,12 +14,12 @@
* limitations under the License. * limitations under the License.
*/ */
import { PlaywrightChannel, PlaywrightInitializer } from '../channels'; import { PlaywrightChannel, PlaywrightInitializer } from '../../protocol/channels';
import { BrowserType } from './browserType'; import { BrowserType } from './browserType';
import { ChannelOwner } from './channelOwner'; import { ChannelOwner } from './channelOwner';
import { Selectors } from './selectors'; import { Selectors } from './selectors';
import { Electron } from './electron'; import { Electron } from './electron';
import { TimeoutError } from '../../errors'; import { TimeoutError } from '../../utils/errors';
import { Size } from './types'; import { Size } from './types';
type DeviceDescriptor = { type DeviceDescriptor = {

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { SelectorsChannel, SelectorsInitializer } from '../channels'; import { SelectorsChannel, SelectorsInitializer } from '../../protocol/channels';
import { ChannelOwner } from './channelOwner'; import { ChannelOwner } from './channelOwner';
import { ElementHandle } from './elementHandle'; import { ElementHandle } from './elementHandle';
import { evaluationScript } from './clientHelper'; import { evaluationScript } from './clientHelper';

View File

@ -15,7 +15,7 @@
*/ */
import { Readable } from 'stream'; import { Readable } from 'stream';
import { StreamChannel, StreamInitializer } from '../channels'; import { StreamChannel, StreamInitializer } from '../../protocol/channels';
import { ChannelOwner } from './channelOwner'; import { ChannelOwner } from './channelOwner';
export class Stream extends ChannelOwner<StreamChannel, StreamInitializer> { export class Stream extends ChannelOwner<StreamChannel, StreamInitializer> {

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { BrowserNewContextOptions, BrowserTypeLaunchOptions } from '../channels'; import { BrowserNewContextOptions, BrowserTypeLaunchOptions } from '../../protocol/channels';
type LoggerSeverity = 'verbose' | 'info' | 'warning' | 'error'; type LoggerSeverity = 'verbose' | 'info' | 'warning' | 'error';
export interface LoggerSink { export interface LoggerSink {

View File

@ -16,7 +16,7 @@
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
import { rewriteErrorMessage } from '../../utils/stackTrace'; import { rewriteErrorMessage } from '../../utils/stackTrace';
import { TimeoutError } from '../../errors'; import { TimeoutError } from '../../utils/errors';
export class Waiter { export class Waiter {
private _dispose: (() => void)[] = []; private _dispose: (() => void)[] = [];

View File

@ -15,7 +15,7 @@
*/ */
import { Events } from './events'; import { Events } from './events';
import { WorkerChannel, WorkerInitializer } from '../channels'; import { WorkerChannel, WorkerInitializer } from '../../protocol/channels';
import { ChannelOwner } from './channelOwner'; import { ChannelOwner } from './channelOwner';
import { assertMaxArguments, Func1, JSHandle, parseResult, serializeArgument, SmartHandle } from './jsHandle'; import { assertMaxArguments, Func1, JSHandle, parseResult, serializeArgument, SmartHandle } from './jsHandle';
import { Page } from './page'; import { Page } from './page';

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { Transport } from './transport'; import { Transport } from '../protocol/transport';
import { DispatcherConnection } from './server/dispatcher'; import { DispatcherConnection } from './server/dispatcher';
import { Playwright } from '../server/playwright'; import { Playwright } from '../server/playwright';
import { PlaywrightDispatcher } from './server/playwrightDispatcher'; import { PlaywrightDispatcher } from './server/playwrightDispatcher';

View File

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

View File

@ -15,7 +15,7 @@
*/ */
import { Browser } from '../../browser'; import { Browser } from '../../browser';
import * as channels from '../channels'; import * as channels from '../../protocol/channels';
import { BrowserContextDispatcher } from './browserContextDispatcher'; import { BrowserContextDispatcher } from './browserContextDispatcher';
import { CDPSessionDispatcher } from './cdpSessionDispatcher'; import { CDPSessionDispatcher } from './cdpSessionDispatcher';
import { Dispatcher, DispatcherScope } from './dispatcher'; import { Dispatcher, DispatcherScope } from './dispatcher';

View File

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

View File

@ -15,7 +15,7 @@
*/ */
import { CRSession, CRSessionEvents } from '../../chromium/crConnection'; import { CRSession, CRSessionEvents } from '../../chromium/crConnection';
import * as channels from '../channels'; import * as channels from '../../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher'; import { Dispatcher, DispatcherScope } from './dispatcher';
export class CDPSessionDispatcher extends Dispatcher<CRSession, channels.CDPSessionInitializer> implements channels.CDPSessionChannel { export class CDPSessionDispatcher extends Dispatcher<CRSession, channels.CDPSessionInitializer> implements channels.CDPSessionChannel {

View File

@ -15,7 +15,7 @@
*/ */
import { ConsoleMessage } from '../../console'; import { ConsoleMessage } from '../../console';
import * as channels from '../channels'; import * as channels from '../../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher'; import { Dispatcher, DispatcherScope } from './dispatcher';
import { createHandle } from './elementHandlerDispatcher'; import { createHandle } from './elementHandlerDispatcher';

View File

@ -15,7 +15,7 @@
*/ */
import { Dialog } from '../../dialog'; import { Dialog } from '../../dialog';
import * as channels from '../channels'; import * as channels from '../../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher'; import { Dispatcher, DispatcherScope } from './dispatcher';
export class DialogDispatcher extends Dispatcher<Dialog, channels.DialogInitializer> implements channels.DialogChannel { export class DialogDispatcher extends Dispatcher<Dialog, channels.DialogInitializer> implements channels.DialogChannel {

View File

@ -16,9 +16,9 @@
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
import { helper, debugAssert, assert } from '../../helper'; import { helper, debugAssert, assert } from '../../helper';
import * as channels from '../channels'; import * as channels from '../../protocol/channels';
import { serializeError } from '../serializers'; import { serializeError } from '../../protocol/serializers';
import { createScheme, Validator, ValidationError } from '../validator'; import { createScheme, Validator, ValidationError } from '../../protocol/validator';
export const dispatcherSymbol = Symbol('dispatcher'); export const dispatcherSymbol = Symbol('dispatcher');

View File

@ -15,7 +15,7 @@
*/ */
import { Download } from '../../download'; import { Download } from '../../download';
import * as channels from '../channels'; import * as channels from '../../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher'; import { Dispatcher, DispatcherScope } from './dispatcher';
import { StreamDispatcher } from './streamDispatcher'; import { StreamDispatcher } from './streamDispatcher';

View File

@ -16,7 +16,7 @@
import { Dispatcher, DispatcherScope, lookupDispatcher } from './dispatcher'; import { Dispatcher, DispatcherScope, lookupDispatcher } from './dispatcher';
import { Electron, ElectronApplication, ElectronPage } from '../../server/electron'; import { Electron, ElectronApplication, ElectronPage } from '../../server/electron';
import * as channels from '../channels'; import * as channels from '../../protocol/channels';
import { BrowserContextDispatcher } from './browserContextDispatcher'; import { BrowserContextDispatcher } from './browserContextDispatcher';
import { PageDispatcher } from './pageDispatcher'; import { PageDispatcher } from './pageDispatcher';
import { parseArgument, serializeResult } from './jsHandleDispatcher'; import { parseArgument, serializeResult } from './jsHandleDispatcher';

View File

@ -16,7 +16,7 @@
import { ElementHandle } from '../../dom'; import { ElementHandle } from '../../dom';
import * as js from '../../javascript'; import * as js from '../../javascript';
import * as channels from '../channels'; import * as channels from '../../protocol/channels';
import { DispatcherScope, lookupNullableDispatcher } from './dispatcher'; import { DispatcherScope, lookupNullableDispatcher } from './dispatcher';
import { JSHandleDispatcher, serializeResult, parseArgument } from './jsHandleDispatcher'; import { JSHandleDispatcher, serializeResult, parseArgument } from './jsHandleDispatcher';
import { FrameDispatcher } from './frameDispatcher'; import { FrameDispatcher } from './frameDispatcher';

View File

@ -16,7 +16,7 @@
import { Frame, NavigationEvent } from '../../frames'; import { Frame, NavigationEvent } from '../../frames';
import * as types from '../../types'; import * as types from '../../types';
import * as channels from '../channels'; import * as channels from '../../protocol/channels';
import { Dispatcher, DispatcherScope, lookupNullableDispatcher, existingDispatcher } from './dispatcher'; import { Dispatcher, DispatcherScope, lookupNullableDispatcher, existingDispatcher } from './dispatcher';
import { ElementHandleDispatcher, createHandle } from './elementHandlerDispatcher'; import { ElementHandleDispatcher, createHandle } from './elementHandlerDispatcher';
import { parseArgument, serializeResult } from './jsHandleDispatcher'; import { parseArgument, serializeResult } from './jsHandleDispatcher';

View File

@ -15,10 +15,10 @@
*/ */
import * as js from '../../javascript'; import * as js from '../../javascript';
import * as channels from '../channels'; import * as channels from '../../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher'; import { Dispatcher, DispatcherScope } from './dispatcher';
import { createHandle } from './elementHandlerDispatcher'; import { createHandle } from './elementHandlerDispatcher';
import { parseSerializedValue, serializeValue } from '../serializers'; import { parseSerializedValue, serializeValue } from '../../protocol/serializers';
export class JSHandleDispatcher extends Dispatcher<js.JSHandle, channels.JSHandleInitializer> implements channels.JSHandleChannel { export class JSHandleDispatcher extends Dispatcher<js.JSHandle, channels.JSHandleInitializer> implements channels.JSHandleChannel {

View File

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

View File

@ -18,9 +18,9 @@ import { BrowserContext } from '../../browserContext';
import { Frame } from '../../frames'; import { Frame } from '../../frames';
import { Request } from '../../network'; import { Request } from '../../network';
import { Page, Worker } from '../../page'; import { Page, Worker } from '../../page';
import * as channels from '../channels'; import * as channels from '../../protocol/channels';
import { Dispatcher, DispatcherScope, lookupDispatcher, lookupNullableDispatcher } from './dispatcher'; import { Dispatcher, DispatcherScope, lookupDispatcher, lookupNullableDispatcher } from './dispatcher';
import { parseError, serializeError } from '../serializers'; import { parseError, serializeError } from '../../protocol/serializers';
import { ConsoleMessageDispatcher } from './consoleMessageDispatcher'; import { ConsoleMessageDispatcher } from './consoleMessageDispatcher';
import { DialogDispatcher } from './dialogDispatcher'; import { DialogDispatcher } from './dialogDispatcher';
import { DownloadDispatcher } from './downloadDispatcher'; import { DownloadDispatcher } from './downloadDispatcher';

View File

@ -15,7 +15,7 @@
*/ */
import { Playwright } from '../../server/playwright'; import { Playwright } from '../../server/playwright';
import * as channels from '../channels'; import * as channels from '../../protocol/channels';
import { BrowserTypeDispatcher } from './browserTypeDispatcher'; import { BrowserTypeDispatcher } from './browserTypeDispatcher';
import { Dispatcher, DispatcherScope } from './dispatcher'; import { Dispatcher, DispatcherScope } from './dispatcher';
import { SelectorsDispatcher } from './selectorsDispatcher'; import { SelectorsDispatcher } from './selectorsDispatcher';

View File

@ -15,7 +15,7 @@
*/ */
import { Dispatcher, DispatcherScope } from './dispatcher'; import { Dispatcher, DispatcherScope } from './dispatcher';
import * as channels from '../channels'; import * as channels from '../../protocol/channels';
import { Selectors } from '../../selectors'; import { Selectors } from '../../selectors';
import { ElementHandleDispatcher } from './elementHandlerDispatcher'; import { ElementHandleDispatcher } from './elementHandlerDispatcher';
import * as dom from '../../dom'; import * as dom from '../../dom';

View File

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

View File

@ -20,7 +20,7 @@ import path from 'path';
import utils from './utils'; import utils from './utils';
it('should require top-level Errors', async({}) => { it('should require top-level Errors', async({}) => {
const Errors = require(path.join(utils.projectRoot(), '/lib/errors.js')); const Errors = require(path.join(utils.projectRoot(), '/lib/utils/errors.js'));
expect(String(Errors.TimeoutError)).toContain('TimeoutError'); expect(String(Errors.TimeoutError)).toContain('TimeoutError');
}); });

View File

@ -21,7 +21,7 @@ import childProcess from 'child_process';
import { LaunchOptions, BrowserType, Browser, BrowserContext, Page, BrowserServer } from '../index'; import { LaunchOptions, BrowserType, Browser, BrowserContext, Page, BrowserServer } from '../index';
import { TestServer } from '../utils/testserver'; import { TestServer } from '../utils/testserver';
import { Connection } from '../lib/rpc/client/connection'; import { Connection } from '../lib/rpc/client/connection';
import { Transport } from '../lib/rpc/transport'; import { Transport } from '../lib/protocol/transport';
import { setUnderTest } from '../lib/helper'; import { setUnderTest } from '../lib/helper';
import { installCoverageHooks } from './coverage'; import { installCoverageHooks } from './coverage';
import { parameters, registerFixture, registerWorkerFixture } from '../test-runner'; import { parameters, registerFixture, registerWorkerFixture } from '../test-runner';

View File

@ -157,7 +157,7 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
}; };
`]; `];
const yml = fs.readFileSync(path.join(__dirname, '..', 'src', 'rpc', 'protocol.yml'), 'utf-8'); const yml = fs.readFileSync(path.join(__dirname, '..', 'src', 'protocol', 'protocol.yml'), 'utf-8');
const protocol = yaml.parse(yml); const protocol = yaml.parse(yml);
function addScheme(name, s) { function addScheme(name, s) {
@ -243,6 +243,6 @@ function writeFile(filePath, content) {
fs.writeFileSync(filePath, content, 'utf8'); fs.writeFileSync(filePath, content, 'utf8');
} }
writeFile(path.join(__dirname, '..', 'src', 'rpc', 'channels.ts'), channels_ts.join('\n')); writeFile(path.join(__dirname, '..', 'src', 'protocol', 'channels.ts'), channels_ts.join('\n'));
writeFile(path.join(__dirname, '..', 'src', 'rpc', 'validator.ts'), validator_ts.join('\n')); writeFile(path.join(__dirname, '..', 'src', 'protocol', 'validator.ts'), validator_ts.join('\n'));
process.exit(hasChanges ? 1 : 0); process.exit(hasChanges ? 1 : 0);

View File

@ -25,11 +25,11 @@ const spawns = [
]; ];
process.on('exit', () => spawns.forEach(s => s.kill())); process.on('exit', () => spawns.forEach(s => s.kill()));
runOnChanges(['src/rpc/protocol.yml'], 'utils/generate_channels.js'); runOnChanges(['src/protocol/protocol.yml'], 'utils/generate_channels.js');
runOnChanges(['docs/api.md', 'utils/generate_types/overrides.d.ts', 'utils/generate_types/exported.json'], 'utils/generate_types/index.js'); runOnChanges(['docs/api.md', 'utils/generate_types/overrides.d.ts', 'utils/generate_types/exported.json'], 'utils/generate_types/index.js');
/** /**
* @param {string[][]} paths * @param {string[][]} paths
* @param {string} nodeFile * @param {string} nodeFile
*/ */
function runOnChanges(paths, nodeFile) { function runOnChanges(paths, nodeFile) {
@ -41,9 +41,9 @@ function runOnChanges(paths, nodeFile) {
} }
fs.watchFile(filePath, callback); fs.watchFile(filePath, callback);
} }
callback(); callback();
function callback() { function callback() {
child_process.spawnSync('node', [path.join(__dirname, '..', ...nodeFile.split('/'))]); child_process.spawnSync('node', [path.join(__dirname, '..', ...nodeFile.split('/'))]);
} }