chore: move protocol files to src/protocol (#3571)
This commit is contained in:
		
							parent
							
								
									398bd477ac
								
							
						
					
					
						commit
						6fe1cd9812
					
				|  | @ -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, '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
 | ||||
|   const pwInternalJSON = require(path.join(ROOT_PATH, 'package.json')); | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ | |||
| 
 | ||||
| import { chromium, firefox, webkit, selectors, devices, errors } 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'; | ||||
| testESM({ chromium, firefox, webkit, selectors, devices, errors, playwright, errorsFile }, [chromium]); | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ | |||
| 
 | ||||
| import { chromium, firefox, webkit, selectors, devices, errors } 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'; | ||||
| testESM({ chromium, firefox, webkit, selectors, devices, errors, playwright, errorsFile }, [firefox]); | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ | |||
| 
 | ||||
| import { chromium, firefox, webkit, selectors, devices, errors } 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'; | ||||
| testESM({ chromium, firefox, webkit, selectors, devices, errors, playwright, errorsFile }, [webkit]); | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ | |||
| 
 | ||||
| import { chromium, firefox, webkit, selectors, devices, errors } 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'; | ||||
| testESM({ chromium, firefox, webkit, selectors, devices, errors, playwright, errorsFile }, [chromium, firefox, webkit]); | ||||
|  |  | |||
|  | @ -29,7 +29,7 @@ if (process.argv[3] === 'all') | |||
| const playwright = require(requireName); | ||||
| 
 | ||||
| // Requiring internals should work.
 | ||||
| const errors = require(requireName + '/lib/errors'); | ||||
| const errors = require(requireName + '/lib/utils/errors'); | ||||
| const installer = require(requireName + '/lib/install/installer'); | ||||
| 
 | ||||
| (async () => { | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
|  * limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| import { TimeoutError } from './errors'; | ||||
| import { TimeoutError } from './utils/errors'; | ||||
| import { assert, debugLogger, LogName } from './helper'; | ||||
| import { rewriteErrorMessage } from './utils/stackTrace'; | ||||
| 
 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
|  * limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| import { TimeoutError } from '../errors'; | ||||
| import { TimeoutError } from '../utils/errors'; | ||||
| import { helper } from '../helper'; | ||||
| import { SerializedError, SerializedValue } from './channels'; | ||||
| 
 | ||||
|  | @ -25,7 +25,7 @@ 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 './channels'; | ||||
| import { BrowserNewContextParams, BrowserContextChannel } from '../protocol/channels'; | ||||
| import { BrowserServerLauncher, BrowserServer } from './client/browserType'; | ||||
| import { envObjectToArray } from './client/clientHelper'; | ||||
| 
 | ||||
|  |  | |||
|  | @ -17,7 +17,7 @@ | |||
| import * as childProcess from 'child_process'; | ||||
| import * as path from 'path'; | ||||
| import { Connection } from './client/connection'; | ||||
| import { Transport } from './transport'; | ||||
| import { Transport } from '../protocol/transport'; | ||||
| 
 | ||||
| (async () => { | ||||
|   const spawnedProcess = childProcess.fork(path.join(__dirname, 'server'), [], { stdio: 'pipe' }); | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
|  * limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| import { PageChannel, AXNode } from '../channels'; | ||||
| import { PageChannel, AXNode } from '../../protocol/channels'; | ||||
| import { ElementHandle } from './elementHandle'; | ||||
| 
 | ||||
| type SerializedAXNode = Omit<AXNode, 'valueString' | 'valueNumber' | 'children' | 'checked' | 'pressed'> & { | ||||
|  |  | |||
|  | @ -25,7 +25,7 @@ export { Download } from './download'; | |||
| export { ElementHandle } from './elementHandle'; | ||||
| export { FileChooser } from './fileChooser'; | ||||
| export { Logger } from './types'; | ||||
| export { TimeoutError } from '../../errors'; | ||||
| export { TimeoutError } from '../../utils/errors'; | ||||
| export { Frame } from './frame'; | ||||
| export { Keyboard, Mouse } from './input'; | ||||
| export { JSHandle } from './jsHandle'; | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
|  * limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| import { BrowserChannel, BrowserInitializer, BrowserNewContextParams } from '../channels'; | ||||
| import { BrowserChannel, BrowserInitializer, BrowserNewContextParams } from '../../protocol/channels'; | ||||
| import { BrowserContext } from './browserContext'; | ||||
| import { Page } from './page'; | ||||
| import { ChannelOwner } from './channelOwner'; | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ | |||
| import * as frames from './frame'; | ||||
| import { Page, BindingCall } from './page'; | ||||
| import * as network from './network'; | ||||
| import { BrowserContextChannel, BrowserContextInitializer } from '../channels'; | ||||
| import { BrowserContextChannel, BrowserContextInitializer } from '../../protocol/channels'; | ||||
| import { ChannelOwner } from './channelOwner'; | ||||
| import { isUnderTest, deprecate, evaluationScript, urlMatches } from './clientHelper'; | ||||
| import { Browser } from './browser'; | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
|  * limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| import { BrowserTypeChannel, BrowserTypeInitializer, BrowserTypeLaunchParams, BrowserTypeLaunchPersistentContextParams } from '../channels'; | ||||
| import { BrowserTypeChannel, BrowserTypeInitializer, BrowserTypeLaunchParams, BrowserTypeLaunchPersistentContextParams } from '../../protocol/channels'; | ||||
| import { Browser } from './browser'; | ||||
| import { BrowserContext } from './browserContext'; | ||||
| import { ChannelOwner } from './channelOwner'; | ||||
|  | @ -23,7 +23,7 @@ import { assert, helper } from '../../helper'; | |||
| import { LaunchOptions, LaunchServerOptions, ConnectOptions, LaunchPersistentContextOptions } from './types'; | ||||
| import * as WebSocket from 'ws'; | ||||
| import { Connection } from './connection'; | ||||
| import { serializeError } from '../serializers'; | ||||
| import { serializeError } from '../../protocol/serializers'; | ||||
| import { Events } from './events'; | ||||
| import { TimeoutSettings } from '../../timeoutSettings'; | ||||
| import { ChildProcess } from 'child_process'; | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
|  * limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| import { CDPSessionChannel, CDPSessionInitializer } from '../channels'; | ||||
| import { CDPSessionChannel, CDPSessionInitializer } from '../../protocol/channels'; | ||||
| import { ChannelOwner } from './channelOwner'; | ||||
| import { Protocol } from '../../chromium/protocol'; | ||||
| 
 | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
|  */ | ||||
| 
 | ||||
| import { EventEmitter } from 'events'; | ||||
| import type { Channel } from '../channels'; | ||||
| import type { Channel } from '../../protocol/channels'; | ||||
| import type { Connection } from './connection'; | ||||
| import type { LoggerSink } from './types'; | ||||
| import { debugLogger } from '../../helper'; | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ | |||
|  */ | ||||
| 
 | ||||
| import { Page } from './page'; | ||||
| import { BrowserContextInitializer } from '../channels'; | ||||
| import { BrowserContextInitializer } from '../../protocol/channels'; | ||||
| import { ChannelOwner } from './channelOwner'; | ||||
| import { CDPSession } from './cdpSession'; | ||||
| import { Events } from './events'; | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
|  * limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| import { PageChannel, PageCrStartJSCoverageOptions, PageCrStopJSCoverageResult, PageCrStartCSSCoverageOptions, PageCrStopCSSCoverageResult } from '../channels'; | ||||
| import { PageChannel, PageCrStartJSCoverageOptions, PageCrStopJSCoverageResult, PageCrStartCSSCoverageOptions, PageCrStopCSSCoverageResult } from '../../protocol/channels'; | ||||
| 
 | ||||
| let __dummyJSResult: PageCrStopJSCoverageResult; | ||||
| type PageCrStopJSCoverageResultEntries = typeof __dummyJSResult.entries; | ||||
|  |  | |||
|  | @ -27,16 +27,16 @@ import { Worker } from './worker'; | |||
| import { ConsoleMessage } from './consoleMessage'; | ||||
| import { Dialog } from './dialog'; | ||||
| import { Download } from './download'; | ||||
| import { parseError } from '../serializers'; | ||||
| import { parseError } from '../../protocol/serializers'; | ||||
| import { CDPSession } from './cdpSession'; | ||||
| import { Playwright } from './playwright'; | ||||
| import { Electron, ElectronApplication } from './electron'; | ||||
| import { Channel } from '../channels'; | ||||
| import { Channel } from '../../protocol/channels'; | ||||
| import { ChromiumBrowser } from './chromiumBrowser'; | ||||
| import { ChromiumBrowserContext } from './chromiumBrowserContext'; | ||||
| import { Selectors } from './selectors'; | ||||
| import { Stream } from './stream'; | ||||
| import { createScheme, Validator, ValidationError } from '../validator'; | ||||
| import { createScheme, Validator, ValidationError } from '../../protocol/validator'; | ||||
| import { WebKitBrowser } from './webkitBrowser'; | ||||
| import { FirefoxBrowser } from './firefoxBrowser'; | ||||
| import { debugLogger } from '../../helper'; | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ | |||
| 
 | ||||
| import * as util from 'util'; | ||||
| import { JSHandle } from './jsHandle'; | ||||
| import { ConsoleMessageChannel, ConsoleMessageInitializer } from '../channels'; | ||||
| import { ConsoleMessageChannel, ConsoleMessageInitializer } from '../../protocol/channels'; | ||||
| import { ChannelOwner } from './channelOwner'; | ||||
| 
 | ||||
| type ConsoleMessageLocation = ConsoleMessageInitializer['location']; | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
|  * limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| import { DialogChannel, DialogInitializer } from '../channels'; | ||||
| import { DialogChannel, DialogInitializer } from '../../protocol/channels'; | ||||
| import { ChannelOwner } from './channelOwner'; | ||||
| 
 | ||||
| export class Dialog extends ChannelOwner<DialogChannel, DialogInitializer> { | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
|  * limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| import { DownloadChannel, DownloadInitializer } from '../channels'; | ||||
| import { DownloadChannel, DownloadInitializer } from '../../protocol/channels'; | ||||
| import { ChannelOwner } from './channelOwner'; | ||||
| import { Readable } from 'stream'; | ||||
| import { Stream } from './stream'; | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
|  * 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 { ChannelOwner } from './channelOwner'; | ||||
| import { Page } from './page'; | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
|  * 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 { FuncOn, JSHandle, serializeArgument, parseResult } from './jsHandle'; | ||||
| import { ChannelOwner } from './channelOwner'; | ||||
|  |  | |||
|  | @ -17,7 +17,7 @@ | |||
| import { ElementHandle } from './elementHandle'; | ||||
| import { Page } from './page'; | ||||
| import { FilePayload } from './types'; | ||||
| import { ElementHandleSetInputFilesOptions } from '../channels'; | ||||
| import { ElementHandleSetInputFilesOptions } from '../../protocol/channels'; | ||||
| 
 | ||||
| export class FileChooser { | ||||
|   private _page: Page; | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ | |||
|  */ | ||||
| 
 | ||||
| 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 { ChannelOwner } from './channelOwner'; | ||||
| import { ElementHandle, convertSelectOptionValues, convertInputFiles } from './elementHandle'; | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
|  * 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 { | ||||
|   private _channel: PageChannel; | ||||
|  |  | |||
|  | @ -14,10 +14,10 @@ | |||
|  * 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 { 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 Unboxed<Arg> = | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
|  */ | ||||
| 
 | ||||
| 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 { Frame } from './frame'; | ||||
| import { headersArrayToObject, headersObjectToArray } from '../../converters'; | ||||
|  |  | |||
|  | @ -18,8 +18,8 @@ | |||
| import { Events } from './events'; | ||||
| import { assert, helper, Listener, mkdirIfNeeded } from '../../helper'; | ||||
| 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 { parseError, serializeError } from '../serializers'; | ||||
| 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 '../../protocol/serializers'; | ||||
| import { headersObjectToArray } from '../../converters'; | ||||
| import { Accessibility } from './accessibility'; | ||||
| import { BrowserContext } from './browserContext'; | ||||
|  |  | |||
|  | @ -14,12 +14,12 @@ | |||
|  * limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| import { PlaywrightChannel, PlaywrightInitializer } from '../channels'; | ||||
| import { PlaywrightChannel, PlaywrightInitializer } from '../../protocol/channels'; | ||||
| import { BrowserType } from './browserType'; | ||||
| import { ChannelOwner } from './channelOwner'; | ||||
| import { Selectors } from './selectors'; | ||||
| import { Electron } from './electron'; | ||||
| import { TimeoutError } from '../../errors'; | ||||
| import { TimeoutError } from '../../utils/errors'; | ||||
| import { Size } from './types'; | ||||
| 
 | ||||
| type DeviceDescriptor = { | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
|  * limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| import { SelectorsChannel, SelectorsInitializer } from '../channels'; | ||||
| import { SelectorsChannel, SelectorsInitializer } from '../../protocol/channels'; | ||||
| import { ChannelOwner } from './channelOwner'; | ||||
| import { ElementHandle } from './elementHandle'; | ||||
| import { evaluationScript } from './clientHelper'; | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
|  */ | ||||
| 
 | ||||
| import { Readable } from 'stream'; | ||||
| import { StreamChannel, StreamInitializer } from '../channels'; | ||||
| import { StreamChannel, StreamInitializer } from '../../protocol/channels'; | ||||
| import { ChannelOwner } from './channelOwner'; | ||||
| 
 | ||||
| export class Stream extends ChannelOwner<StreamChannel, StreamInitializer> { | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
|  * limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| import { BrowserNewContextOptions, BrowserTypeLaunchOptions } from '../channels'; | ||||
| import { BrowserNewContextOptions, BrowserTypeLaunchOptions } from '../../protocol/channels'; | ||||
| 
 | ||||
| type LoggerSeverity = 'verbose' | 'info' | 'warning' | 'error'; | ||||
| export interface LoggerSink { | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ | |||
| 
 | ||||
| import { EventEmitter } from 'events'; | ||||
| import { rewriteErrorMessage } from '../../utils/stackTrace'; | ||||
| import { TimeoutError } from '../../errors'; | ||||
| import { TimeoutError } from '../../utils/errors'; | ||||
| 
 | ||||
| export class Waiter { | ||||
|   private _dispose: (() => void)[] = []; | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
|  */ | ||||
| 
 | ||||
| import { Events } from './events'; | ||||
| import { WorkerChannel, WorkerInitializer } from '../channels'; | ||||
| import { WorkerChannel, WorkerInitializer } from '../../protocol/channels'; | ||||
| import { ChannelOwner } from './channelOwner'; | ||||
| import { assertMaxArguments, Func1, JSHandle, parseResult, serializeArgument, SmartHandle } from './jsHandle'; | ||||
| import { Page } from './page'; | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
|  * limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| import { Transport } from './transport'; | ||||
| import { Transport } from '../protocol/transport'; | ||||
| import { DispatcherConnection } from './server/dispatcher'; | ||||
| import { Playwright } from '../server/playwright'; | ||||
| import { PlaywrightDispatcher } from './server/playwrightDispatcher'; | ||||
|  |  | |||
|  | @ -17,7 +17,7 @@ | |||
| import { BrowserContext } from '../../browserContext'; | ||||
| import { Dispatcher, DispatcherScope, lookupDispatcher } from './dispatcher'; | ||||
| import { PageDispatcher, BindingCallDispatcher, WorkerDispatcher } from './pageDispatcher'; | ||||
| import * as channels from '../channels'; | ||||
| import * as channels from '../../protocol/channels'; | ||||
| import { RouteDispatcher, RequestDispatcher } from './networkDispatchers'; | ||||
| import { CRBrowserContext } from '../../chromium/crBrowser'; | ||||
| import { CDPSessionDispatcher } from './cdpSessionDispatcher'; | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
|  */ | ||||
| 
 | ||||
| import { Browser } from '../../browser'; | ||||
| import * as channels from '../channels'; | ||||
| import * as channels from '../../protocol/channels'; | ||||
| import { BrowserContextDispatcher } from './browserContextDispatcher'; | ||||
| import { CDPSessionDispatcher } from './cdpSessionDispatcher'; | ||||
| import { Dispatcher, DispatcherScope } from './dispatcher'; | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ | |||
| 
 | ||||
| import { BrowserTypeBase, BrowserType } from '../../server/browserType'; | ||||
| import { BrowserDispatcher } from './browserDispatcher'; | ||||
| import * as channels from '../channels'; | ||||
| import * as channels from '../../protocol/channels'; | ||||
| import { Dispatcher, DispatcherScope } from './dispatcher'; | ||||
| import { BrowserContextDispatcher } from './browserContextDispatcher'; | ||||
| 
 | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
|  */ | ||||
| 
 | ||||
| import { CRSession, CRSessionEvents } from '../../chromium/crConnection'; | ||||
| import * as channels from '../channels'; | ||||
| import * as channels from '../../protocol/channels'; | ||||
| import { Dispatcher, DispatcherScope } from './dispatcher'; | ||||
| 
 | ||||
| export class CDPSessionDispatcher extends Dispatcher<CRSession, channels.CDPSessionInitializer> implements channels.CDPSessionChannel { | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
|  */ | ||||
| 
 | ||||
| import { ConsoleMessage } from '../../console'; | ||||
| import * as channels from '../channels'; | ||||
| import * as channels from '../../protocol/channels'; | ||||
| import { Dispatcher, DispatcherScope } from './dispatcher'; | ||||
| import { createHandle } from './elementHandlerDispatcher'; | ||||
| 
 | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
|  */ | ||||
| 
 | ||||
| import { Dialog } from '../../dialog'; | ||||
| import * as channels from '../channels'; | ||||
| import * as channels from '../../protocol/channels'; | ||||
| import { Dispatcher, DispatcherScope } from './dispatcher'; | ||||
| 
 | ||||
| export class DialogDispatcher extends Dispatcher<Dialog, channels.DialogInitializer> implements channels.DialogChannel { | ||||
|  |  | |||
|  | @ -16,9 +16,9 @@ | |||
| 
 | ||||
| import { EventEmitter } from 'events'; | ||||
| import { helper, debugAssert, assert } from '../../helper'; | ||||
| import * as channels from '../channels'; | ||||
| import { serializeError } from '../serializers'; | ||||
| import { createScheme, Validator, ValidationError } from '../validator'; | ||||
| import * as channels from '../../protocol/channels'; | ||||
| import { serializeError } from '../../protocol/serializers'; | ||||
| import { createScheme, Validator, ValidationError } from '../../protocol/validator'; | ||||
| 
 | ||||
| export const dispatcherSymbol = Symbol('dispatcher'); | ||||
| 
 | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
|  */ | ||||
| 
 | ||||
| import { Download } from '../../download'; | ||||
| import * as channels from '../channels'; | ||||
| import * as channels from '../../protocol/channels'; | ||||
| import { Dispatcher, DispatcherScope } from './dispatcher'; | ||||
| import { StreamDispatcher } from './streamDispatcher'; | ||||
| 
 | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ | |||
| 
 | ||||
| import { Dispatcher, DispatcherScope, lookupDispatcher } from './dispatcher'; | ||||
| import { Electron, ElectronApplication, ElectronPage } from '../../server/electron'; | ||||
| import * as channels from '../channels'; | ||||
| import * as channels from '../../protocol/channels'; | ||||
| import { BrowserContextDispatcher } from './browserContextDispatcher'; | ||||
| import { PageDispatcher } from './pageDispatcher'; | ||||
| import { parseArgument, serializeResult } from './jsHandleDispatcher'; | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ | |||
| 
 | ||||
| import { ElementHandle } from '../../dom'; | ||||
| import * as js from '../../javascript'; | ||||
| import * as channels from '../channels'; | ||||
| import * as channels from '../../protocol/channels'; | ||||
| import { DispatcherScope, lookupNullableDispatcher } from './dispatcher'; | ||||
| import { JSHandleDispatcher, serializeResult, parseArgument } from './jsHandleDispatcher'; | ||||
| import { FrameDispatcher } from './frameDispatcher'; | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ | |||
| 
 | ||||
| import { Frame, NavigationEvent } from '../../frames'; | ||||
| import * as types from '../../types'; | ||||
| import * as channels from '../channels'; | ||||
| import * as channels from '../../protocol/channels'; | ||||
| import { Dispatcher, DispatcherScope, lookupNullableDispatcher, existingDispatcher } from './dispatcher'; | ||||
| import { ElementHandleDispatcher, createHandle } from './elementHandlerDispatcher'; | ||||
| import { parseArgument, serializeResult } from './jsHandleDispatcher'; | ||||
|  |  | |||
|  | @ -15,10 +15,10 @@ | |||
|  */ | ||||
| 
 | ||||
| import * as js from '../../javascript'; | ||||
| import * as channels from '../channels'; | ||||
| import * as channels from '../../protocol/channels'; | ||||
| import { Dispatcher, DispatcherScope } from './dispatcher'; | ||||
| 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 { | ||||
| 
 | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
|  */ | ||||
| 
 | ||||
| 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 { FrameDispatcher } from './frameDispatcher'; | ||||
| 
 | ||||
|  |  | |||
|  | @ -18,9 +18,9 @@ import { BrowserContext } from '../../browserContext'; | |||
| import { Frame } from '../../frames'; | ||||
| import { Request } from '../../network'; | ||||
| import { Page, Worker } from '../../page'; | ||||
| import * as channels from '../channels'; | ||||
| import * as channels from '../../protocol/channels'; | ||||
| import { Dispatcher, DispatcherScope, lookupDispatcher, lookupNullableDispatcher } from './dispatcher'; | ||||
| import { parseError, serializeError } from '../serializers'; | ||||
| import { parseError, serializeError } from '../../protocol/serializers'; | ||||
| import { ConsoleMessageDispatcher } from './consoleMessageDispatcher'; | ||||
| import { DialogDispatcher } from './dialogDispatcher'; | ||||
| import { DownloadDispatcher } from './downloadDispatcher'; | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
|  */ | ||||
| 
 | ||||
| import { Playwright } from '../../server/playwright'; | ||||
| import * as channels from '../channels'; | ||||
| import * as channels from '../../protocol/channels'; | ||||
| import { BrowserTypeDispatcher } from './browserTypeDispatcher'; | ||||
| import { Dispatcher, DispatcherScope } from './dispatcher'; | ||||
| import { SelectorsDispatcher } from './selectorsDispatcher'; | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
|  */ | ||||
| 
 | ||||
| import { Dispatcher, DispatcherScope } from './dispatcher'; | ||||
| import * as channels from '../channels'; | ||||
| import * as channels from '../../protocol/channels'; | ||||
| import { Selectors } from '../../selectors'; | ||||
| import { ElementHandleDispatcher } from './elementHandlerDispatcher'; | ||||
| import * as dom from '../../dom'; | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
|  * limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| import * as channels from '../channels'; | ||||
| import * as channels from '../../protocol/channels'; | ||||
| import { Dispatcher, DispatcherScope } from './dispatcher'; | ||||
| import * as stream from 'stream'; | ||||
| 
 | ||||
|  |  | |||
|  | @ -20,7 +20,7 @@ import path from 'path'; | |||
| import utils from './utils'; | ||||
| 
 | ||||
| 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'); | ||||
| }); | ||||
| 
 | ||||
|  |  | |||
|  | @ -21,7 +21,7 @@ import childProcess from 'child_process'; | |||
| import { LaunchOptions, BrowserType, Browser, BrowserContext, Page, BrowserServer } from '../index'; | ||||
| import { TestServer } from '../utils/testserver'; | ||||
| 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 { installCoverageHooks } from './coverage'; | ||||
| import { parameters, registerFixture, registerWorkerFixture } from '../test-runner'; | ||||
|  |  | |||
|  | @ -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); | ||||
| 
 | ||||
| function addScheme(name, s) { | ||||
|  | @ -243,6 +243,6 @@ function writeFile(filePath, content) { | |||
|   fs.writeFileSync(filePath, content, 'utf8'); | ||||
| } | ||||
| 
 | ||||
| writeFile(path.join(__dirname, '..', 'src', 'rpc', 'channels.ts'), channels_ts.join('\n')); | ||||
| writeFile(path.join(__dirname, '..', 'src', 'rpc', 'validator.ts'), validator_ts.join('\n')); | ||||
| writeFile(path.join(__dirname, '..', 'src', 'protocol', 'channels.ts'), channels_ts.join('\n')); | ||||
| writeFile(path.join(__dirname, '..', 'src', 'protocol', 'validator.ts'), validator_ts.join('\n')); | ||||
| process.exit(hasChanges ? 1 : 0); | ||||
|  |  | |||
|  | @ -25,11 +25,11 @@ const spawns = [ | |||
| ]; | ||||
| 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'); | ||||
| 
 | ||||
| /** | ||||
|  * @param {string[][]} paths  | ||||
|  * @param {string[][]} paths | ||||
|  * @param {string} nodeFile | ||||
|  */ | ||||
| function runOnChanges(paths, nodeFile) { | ||||
|  | @ -41,9 +41,9 @@ function runOnChanges(paths, nodeFile) { | |||
|     } | ||||
|     fs.watchFile(filePath, callback); | ||||
|   } | ||||
|    | ||||
| 
 | ||||
|   callback(); | ||||
|    | ||||
| 
 | ||||
|   function callback() { | ||||
|     child_process.spawnSync('node', [path.join(__dirname, '..', ...nodeFile.split('/'))]); | ||||
|   } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue