chore: always import type (#13365)

This commit is contained in:
Pavel Feldman 2022-04-06 13:57:14 -08:00 committed by GitHub
parent c01269e68c
commit 5ae2017a5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
248 changed files with 896 additions and 726 deletions

View File

@ -1,12 +1,12 @@
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'notice'],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "notice"],
parserOptions: {
ecmaVersion: 9,
sourceType: 'module',
sourceType: "module",
},
extends: [
'plugin:react-hooks/recommended'
"plugin:react-hooks/recommended"
],
/**
@ -18,8 +18,9 @@ module.exports = {
* "rule-name", [severity, { opts }]
* Severity: 2 == error, 1 == warning, 0 == off.
*/
"rules": {
'@typescript-eslint/no-unused-vars': [2, {args: 'none'}],
rules: {
"@typescript-eslint/no-unused-vars": [2, {args: "none"}],
"@typescript-eslint/consistent-type-imports": [2, {disallowTypeAnnotations: false}],
/**
* Enforced rules
*/

View File

@ -15,7 +15,7 @@
*/
import { test, expect } from '@playwright/test';
import { Reporter, TestCase } from '@playwright/test/reporter';
import type { Reporter, TestCase } from '@playwright/test/reporter';
test.use({ locale: 'en-US' });

View File

@ -14,7 +14,8 @@
* limitations under the License.
*/
import { PlaywrightTestConfig, devices } from '@playwright/test';
import type { PlaywrightTestConfig } from '@playwright/test';
import { devices } from '@playwright/test';
const config: PlaywrightTestConfig = {
testDir: 'src',

View File

@ -16,7 +16,8 @@
import React from 'react';
import { test, expect } from '@playwright/experimental-ct-react/test';
import { ImageDiff, ImageDiffView } from './imageDiffView';
import type { ImageDiff } from './imageDiffView';
import { ImageDiffView } from './imageDiffView';
test.use({ viewport: { width: 1000, height: 800 } });

View File

@ -17,7 +17,8 @@
import type { TestAttachment } from '@playwright-test/reporters/html';
import * as React from 'react';
import { AttachmentLink } from './links';
import { TabbedPane, TabbedPaneTab } from './tabbedPane';
import type { TabbedPaneTab } from './tabbedPane';
import { TabbedPane } from './tabbedPane';
import './imageDiffView.css';
import './tabbedPane.css';

View File

@ -21,7 +21,7 @@ import zipImport from '@zip.js/zip.js/dist/zip-no-worker-inflate.min.js';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import './colors.css';
import { LoadedReport } from './loadedReport';
import type { LoadedReport } from './loadedReport';
import { ReportView } from './reportView';
// @ts-ignore
const zipjs = zipImport as typeof zip;

View File

@ -14,8 +14,8 @@
* limitations under the License.
*/
import { HTMLReport } from '@playwright-test/reporters/html';
import { Metadata } from './index';
import type { HTMLReport } from '@playwright-test/reporters/html';
import type { Metadata } from './index';
export interface LoadedReport {
json(): HTMLReport & { metadata?: Metadata };

View File

@ -18,7 +18,7 @@ import * as React from 'react';
import './colors.css';
import './common.css';
import * as icons from './icons';
import { Metadata } from './index';
import type { Metadata } from './index';
import { AutoChip } from './chip';
import './reportView.css';
import './theme.css';

View File

@ -21,7 +21,7 @@ import './common.css';
import { Filter } from './filter';
import { HeaderView } from './headerView';
import { Route } from './links';
import { LoadedReport } from './loadedReport';
import type { LoadedReport } from './loadedReport';
import './reportView.css';
import { MetadataView } from './metadataView';
import { TestCaseView } from './testCaseView';

View File

@ -18,7 +18,7 @@ import type { HTMLReport, TestFileSummary } from '@playwright-test/reporters/htm
import * as React from 'react';
import { msToString } from './uiUtils';
import { Chip } from './chip';
import { Filter } from './filter';
import type { Filter } from './filter';
import { Link, ProjectLink } from './links';
import { statusIcon } from './statusIcon';
import './testFileView.css';

View File

@ -16,7 +16,7 @@
import type { HTMLReport, TestFileSummary } from '@playwright-test/reporters/html';
import * as React from 'react';
import { Filter } from './filter';
import type { Filter } from './filter';
import { TestFileView } from './testFileView';
import './testFileView.css';

View File

@ -23,7 +23,8 @@ import { AutoChip } from './chip';
import { traceImage } from './images';
import { AttachmentLink } from './links';
import { statusIcon } from './statusIcon';
import { ImageDiff, ImageDiffView } from './imageDiffView';
import type { ImageDiff } from './imageDiffView';
import { ImageDiffView } from './imageDiffView';
import './testResultView.css';
function groupImageDiffs(screenshots: Set<TestAttachment>): ImageDiff[] {

View File

@ -14,12 +14,12 @@
* limitations under the License.
*/
import { LaunchServerOptions, Logger } from './client/types';
import type { LaunchServerOptions, Logger } from './client/types';
import { EventEmitter } from 'ws';
import { BrowserServerLauncher, BrowserServer } from './client/browserType';
import type { BrowserServerLauncher, BrowserServer } from './client/browserType';
import { envObjectToArray } from './client/clientHelper';
import { createGuid } from './utils/utils';
import { ProtocolLogger } from './server/types';
import type { ProtocolLogger } from './server/types';
import { serverSideCallMetadata } from './server/instrumentation';
import { createPlaywright } from './server/playwright';
import { PlaywrightServer } from './remote/playwrightServer';

View File

@ -21,21 +21,24 @@
import fs from 'fs';
import os from 'os';
import path from 'path';
import { program, Command } from 'commander';
import type { Command } from 'commander';
import { program } from 'commander';
import { runDriver, runServer, printApiJson, launchBrowserServer } from './driver';
import { showTraceViewer } from '../server/trace/viewer/traceViewer';
import * as playwright from '../..';
import { BrowserContext } from '../client/browserContext';
import { Browser } from '../client/browser';
import { Page } from '../client/page';
import { BrowserType } from '../client/browserType';
import { BrowserContextOptions, LaunchOptions } from '../client/types';
import type { BrowserContext } from '../client/browserContext';
import type { Browser } from '../client/browser';
import type { Page } from '../client/page';
import type { BrowserType } from '../client/browserType';
import type { BrowserContextOptions, LaunchOptions } from '../client/types';
import { spawn } from 'child_process';
import { registry, Executable } from '../utils/registry';
import type { Executable } from '../utils/registry';
import { registry } from '../utils/registry';
import { spawnAsync, getPlaywrightVersion, wrapInASCIIBox } from '../utils/utils';
import { writeDockerVersion } from '../utils/dependencies';
import { launchGridAgent } from '../grid/gridAgent';
import { GridServer, GridFactory } from '../grid/gridServer';
import type { GridFactory } from '../grid/gridServer';
import { GridServer } from '../grid/gridServer';
const packageJSON = require('../../package.json');

View File

@ -18,8 +18,8 @@
import fs from 'fs';
import * as playwright from '../..';
import { BrowserType } from '../client/browserType';
import { LaunchServerOptions } from '../client/types';
import type { BrowserType } from '../client/browserType';
import type { LaunchServerOptions } from '../client/types';
import { DispatcherConnection, Root } from '../dispatchers/dispatcher';
import { PlaywrightDispatcher } from '../dispatchers/playwrightDispatcher';
import { IpcTransport, PipeTransport } from '../protocol/transport';

View File

@ -15,9 +15,9 @@
* limitations under the License.
*/
import * as channels from '../protocol/channels';
import { ElementHandle } from './elementHandle';
import * as api from '../../types/types';
import type * as channels from '../protocol/channels';
import type { ElementHandle } from './elementHandle';
import type * as api from '../../types/types';
type SerializedAXNode = Omit<channels.AXNode, 'valueString' | 'valueNumber' | 'children' | 'checked' | 'pressed'> & {
value?: string|number,

View File

@ -16,13 +16,13 @@
import fs from 'fs';
import { isString, isRegExp } from '../utils/utils';
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import { Events } from './events';
import { BrowserContext, prepareBrowserContextParams } from './browserContext';
import { ChannelOwner } from './channelOwner';
import * as api from '../../types/types';
import * as types from './types';
import { Page } from './page';
import type * as api from '../../types/types';
import type * as types from './types';
import type { Page } from './page';
import { TimeoutSettings } from '../utils/timeoutSettings';
import { Waiter } from './waiter';
import { EventEmitter } from 'events';

View File

@ -14,12 +14,12 @@
* limitations under the License.
*/
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import * as fs from 'fs';
import { Stream } from './stream';
import { mkdirIfNeeded } from '../utils/utils';
import { ChannelOwner } from './channelOwner';
import { Readable } from 'stream';
import type { Readable } from 'stream';
export class Artifact extends ChannelOwner<channels.ArtifactChannel> {
static from(channel: channels.ArtifactChannel): Artifact {

View File

@ -14,17 +14,17 @@
* limitations under the License.
*/
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import { BrowserContext, prepareBrowserContextParams } from './browserContext';
import { Page } from './page';
import type { Page } from './page';
import { ChannelOwner } from './channelOwner';
import { Events } from './events';
import { BrowserContextOptions } from './types';
import type { BrowserContextOptions } from './types';
import { isSafeCloseError, kBrowserClosedError } from '../utils/errors';
import * as api from '../../types/types';
import type * as api from '../../types/types';
import { CDPSession } from './cdpSession';
import type { BrowserType } from './browserType';
import { LocalUtils } from './localUtils';
import type { LocalUtils } from './localUtils';
export class Browser extends ChannelOwner<channels.BrowserChannel> implements api.Browser {
readonly _contexts = new Set<BrowserContext>();

View File

@ -18,7 +18,7 @@
import { Page, BindingCall } from './page';
import { Frame } from './frame';
import * as network from './network';
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import fs from 'fs';
import { ChannelOwner } from './channelOwner';
import { evaluationScript } from './clientHelper';
@ -27,11 +27,11 @@ import { Worker } from './worker';
import { Events } from './events';
import { TimeoutSettings } from '../utils/timeoutSettings';
import { Waiter } from './waiter';
import { URLMatch, Headers, WaitForEventOptions, BrowserContextOptions, StorageState, LaunchOptions } from './types';
import type { URLMatch, Headers, WaitForEventOptions, BrowserContextOptions, StorageState, LaunchOptions } from './types';
import { headersObjectToArray, mkdirIfNeeded } from '../utils/utils';
import { isSafeCloseError } from '../utils/errors';
import * as api from '../../types/types';
import * as structs from '../../types/structs';
import type * as api from '../../types/types';
import type * as structs from '../../types/structs';
import { CDPSession } from './cdpSession';
import { Tracing } from './tracing';
import type { BrowserType } from './browserType';

View File

@ -14,17 +14,17 @@
* limitations under the License.
*/
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import { Browser } from './browser';
import { BrowserContext, prepareBrowserContextParams } from './browserContext';
import { ChannelOwner } from './channelOwner';
import { LaunchOptions, LaunchServerOptions, ConnectOptions, LaunchPersistentContextOptions, BrowserContextOptions } from './types';
import type { LaunchOptions, LaunchServerOptions, ConnectOptions, LaunchPersistentContextOptions, BrowserContextOptions } from './types';
import { Connection } from './connection';
import { Events } from './events';
import { ChildProcess } from 'child_process';
import type { ChildProcess } from 'child_process';
import { envObjectToArray } from './clientHelper';
import { assert, headersObjectToArray, monotonicTime } from '../utils/utils';
import * as api from '../../types/types';
import type * as api from '../../types/types';
import { kBrowserClosedError } from '../utils/errors';
import { raceAgainstTimeout } from '../utils/async';
import type { Playwright } from './playwright';

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
import type { Protocol } from '../server/chromium/protocol';
import type * as api from '../../types/types';

View File

@ -15,13 +15,15 @@
*/
import { EventEmitter } from 'events';
import * as channels from '../protocol/channels';
import { createScheme, ValidationError, Validator } from '../protocol/validator';
import type * as channels from '../protocol/channels';
import type { Validator } from '../protocol/validator';
import { createScheme, ValidationError } from '../protocol/validator';
import { debugLogger } from '../utils/debugLogger';
import { captureRawStack, captureStackTrace, ParsedStackTrace } from '../utils/stackTrace';
import type { ParsedStackTrace } from '../utils/stackTrace';
import { captureRawStack, captureStackTrace } from '../utils/stackTrace';
import { isUnderTest } from '../utils/utils';
import { zones } from '../utils/zones';
import { ClientInstrumentation } from './clientInstrumentation';
import type { ClientInstrumentation } from './clientInstrumentation';
import type { Connection } from './connection';
import type { Logger } from './types';

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import * as types from './types';
import type * as types from './types';
import fs from 'fs';
import { isString, isRegExp, constructURLBasedOnBaseURL } from '../utils/utils';

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import { ParsedStackTrace } from '../utils/stackTrace';
import type { ParsedStackTrace } from '../utils/stackTrace';
export interface ClientInstrumentation {
addListener(listener: ClientInstrumentationListener): void;

View File

@ -30,13 +30,13 @@ import { parseError } from '../protocol/serializers';
import { CDPSession } from './cdpSession';
import { Playwright } from './playwright';
import { Electron, ElectronApplication } from './electron';
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import { Stream } from './stream';
import { WritableStream } from './writableStream';
import { debugLogger } from '../utils/debugLogger';
import { SelectorsOwner } from './selectors';
import { Android, AndroidSocket, AndroidDevice } from './android';
import { ParsedStackTrace } from '../utils/stackTrace';
import type { ParsedStackTrace } from '../utils/stackTrace';
import { Artifact } from './artifact';
import { EventEmitter } from 'events';
import { JsonPipe } from './jsonPipe';

View File

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

View File

@ -14,8 +14,8 @@
* limitations under the License.
*/
import * as channels from '../protocol/channels';
import * as api from '../../types/types';
import type * as channels from '../protocol/channels';
import type * as api from '../../types/types';
export class Coverage implements api.Coverage {
private _channel: channels.PageChannel;

View File

@ -14,9 +14,9 @@
* limitations under the License.
*/
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
import * as api from '../../types/types';
import type * as api from '../../types/types';
export class Dialog extends ChannelOwner<channels.DialogChannel> implements api.Dialog {
static from(dialog: channels.DialogChannel): Dialog {

View File

@ -14,10 +14,10 @@
* limitations under the License.
*/
import { Readable } from 'stream';
import * as api from '../../types/types';
import { Artifact } from './artifact';
import { Page } from './page';
import type { Readable } from 'stream';
import type * as api from '../../types/types';
import type { Artifact } from './artifact';
import type { Page } from './page';
export class Download implements api.Download {
private _page: Page;

View File

@ -15,10 +15,10 @@
*/
import type { BrowserWindow } from 'electron';
import * as childProcess from 'child_process';
import * as structs from '../../types/structs';
import * as api from '../../types/types';
import * as channels from '../protocol/channels';
import type * as childProcess from 'child_process';
import type * as structs from '../../types/structs';
import type * as api from '../../types/types';
import type * as channels from '../protocol/channels';
import { TimeoutSettings } from '../utils/timeoutSettings';
import { headersObjectToArray } from '../utils/utils';
import { BrowserContext } from './browserContext';
@ -26,8 +26,8 @@ import { ChannelOwner } from './channelOwner';
import { envObjectToArray } from './clientHelper';
import { Events } from './events';
import { JSHandle, parseResult, serializeArgument } from './jsHandle';
import { Page } from './page';
import { Env, WaitForEventOptions, Headers } from './types';
import type { Page } from './page';
import type { Env, WaitForEventOptions, Headers } from './types';
import { Waiter } from './waiter';
type ElectronOptions = Omit<channels.ElectronLaunchOptions, 'env'|'extraHTTPHeaders'> & {

View File

@ -14,19 +14,19 @@
* limitations under the License.
*/
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import { Frame } from './frame';
import { Locator } from './locator';
import type { Locator } from './locator';
import { JSHandle, serializeArgument, parseResult } from './jsHandle';
import { ChannelOwner } from './channelOwner';
import { SelectOption, FilePayload, Rect, SelectOptionOptions } from './types';
import type { ChannelOwner } from './channelOwner';
import type { SelectOption, FilePayload, Rect, SelectOptionOptions } from './types';
import fs from 'fs';
import * as mime from 'mime';
import path from 'path';
import { assert, isString, mkdirIfNeeded } from '../utils/utils';
import * as api from '../../types/types';
import * as structs from '../../types/structs';
import { BrowserContext } from './browserContext';
import type * as api from '../../types/types';
import type * as structs from '../../types/structs';
import type { BrowserContext } from './browserContext';
import { WritableStream } from './writableStream';
import { pipeline } from 'stream';
import { promisify } from 'util';

View File

@ -17,17 +17,17 @@
import fs from 'fs';
import path from 'path';
import * as util from 'util';
import { Serializable } from '../../types/structs';
import * as api from '../../types/types';
import { HeadersArray } from '../common/types';
import * as channels from '../protocol/channels';
import type { Serializable } from '../../types/structs';
import type * as api from '../../types/types';
import type { HeadersArray } from '../common/types';
import type * as channels from '../protocol/channels';
import { kBrowserOrContextClosedError } from '../utils/errors';
import { assert, headersObjectToArray, isFilePayload, isString, mkdirIfNeeded, objectToArray } from '../utils/utils';
import { ChannelOwner } from './channelOwner';
import * as network from './network';
import { RawHeaders } from './network';
import { FilePayload, Headers, StorageState } from './types';
import { Playwright } from './playwright';
import type { FilePayload, Headers, StorageState } from './types';
import type { Playwright } from './playwright';
import { createInstrumentation } from './clientInstrumentation';
import { Tracing } from './tracing';

View File

@ -14,11 +14,11 @@
* limitations under the License.
*/
import { ElementHandle } from './elementHandle';
import { Page } from './page';
import { FilePayload } from './types';
import * as channels from '../protocol/channels';
import * as api from '../../types/types';
import type { ElementHandle } from './elementHandle';
import type { Page } from './page';
import type { FilePayload } from './types';
import type * as channels from '../protocol/channels';
import type * as api from '../../types/types';
export class FileChooser implements api.FileChooser {
private _page: Page;

View File

@ -16,21 +16,22 @@
*/
import { assert } from '../utils/utils';
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
import { FrameLocator, Locator } from './locator';
import { ElementHandle, convertSelectOptionValues, convertInputFiles } from './elementHandle';
import { assertMaxArguments, JSHandle, serializeArgument, parseResult } from './jsHandle';
import fs from 'fs';
import * as network from './network';
import { Page } from './page';
import type { Page } from './page';
import { EventEmitter } from 'events';
import { Waiter } from './waiter';
import { Events } from './events';
import { LifecycleEvent, URLMatch, SelectOption, SelectOptionOptions, FilePayload, WaitForFunctionOptions, StrictOptions, kLifecycleEvents } from './types';
import type { LifecycleEvent, URLMatch, SelectOption, SelectOptionOptions, FilePayload, WaitForFunctionOptions, StrictOptions } from './types';
import { kLifecycleEvents } from './types';
import { urlMatches } from './clientHelper';
import * as api from '../../types/types';
import * as structs from '../../types/structs';
import type * as api from '../../types/types';
import type * as structs from '../../types/structs';
import { debugLogger } from '../utils/debugLogger';
export type WaitForNavigationOptions = {

View File

@ -15,8 +15,8 @@
* limitations under the License.
*/
import * as channels from '../protocol/channels';
import * as api from '../../types/types';
import type * as channels from '../protocol/channels';
import type * as api from '../../types/types';
import type { Page } from './page';
export class Keyboard implements api.Keyboard {

View File

@ -14,11 +14,11 @@
* limitations under the License.
*/
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
import { parseSerializedValue, serializeValue } from '../protocol/serializers';
import * as api from '../../types/types';
import * as structs from '../../types/structs';
import type * as api from '../../types/types';
import type * as structs from '../../types/structs';
export class JSHandle<T = any> extends ChannelOwner<channels.JSHandleChannel> implements api.JSHandle {
private _preview: string;

View File

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

View File

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

View File

@ -14,15 +14,15 @@
* limitations under the License.
*/
import * as structs from '../../types/structs';
import * as api from '../../types/types';
import * as channels from '../protocol/channels';
import type * as structs from '../../types/structs';
import type * as api from '../../types/types';
import type * as channels from '../protocol/channels';
import type { ParsedStackTrace } from '../utils/stackTrace';
import * as util from 'util';
import { isRegExp, monotonicTime } from '../utils/utils';
import { ElementHandle } from './elementHandle';
import { Frame } from './frame';
import { FilePayload, FrameExpectOptions, Rect, SelectOption, SelectOptionOptions, TimeoutOptions } from './types';
import type { Frame } from './frame';
import type { FilePayload, FrameExpectOptions, Rect, SelectOption, SelectOptionOptions, TimeoutOptions } from './types';
import { parseResult, serializeArgument } from './jsHandle';
import { escapeWithQuotes } from '../utils/stringUtils';

View File

@ -15,19 +15,19 @@
*/
import { URLSearchParams } from 'url';
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
import { Frame } from './frame';
import { Headers, RemoteAddr, SecurityDetails, WaitForEventOptions } from './types';
import type { Headers, RemoteAddr, SecurityDetails, WaitForEventOptions } from './types';
import fs from 'fs';
import * as mime from 'mime';
import { isString, headersObjectToArray } from '../utils/utils';
import { ManualPromise } from '../utils/async';
import { Events } from './events';
import { Page } from './page';
import type { Page } from './page';
import { Waiter } from './waiter';
import * as api from '../../types/types';
import { HeadersArray, URLMatch } from '../common/types';
import type * as api from '../../types/types';
import type { HeadersArray, URLMatch } from '../common/types';
import { urlMatches } from './clientHelper';
import { MultiMap } from '../utils/multimap';
import { APIResponse } from './fetch';

View File

@ -19,36 +19,38 @@ import { Events } from './events';
import { assert } from '../utils/utils';
import { TimeoutSettings } from '../utils/timeoutSettings';
import type { ParsedStackTrace } from '../utils/stackTrace';
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import { parseError, serializeError } from '../protocol/serializers';
import { Accessibility } from './accessibility';
import { BrowserContext } from './browserContext';
import type { BrowserContext } from './browserContext';
import { ChannelOwner } from './channelOwner';
import { ConsoleMessage } from './consoleMessage';
import { Dialog } from './dialog';
import { Download } from './download';
import { ElementHandle, determineScreenshotType } from './elementHandle';
import { Locator, FrameLocator } from './locator';
import type { Locator, FrameLocator } from './locator';
import { Worker } from './worker';
import { Frame, verifyLoadState, WaitForNavigationOptions } from './frame';
import type { WaitForNavigationOptions } from './frame';
import { Frame, verifyLoadState } from './frame';
import { Keyboard, Mouse, Touchscreen } from './input';
import { assertMaxArguments, serializeArgument, parseResult, JSHandle } from './jsHandle';
import { Request, Response, Route, RouteHandlerCallback, WebSocket, validateHeaders, RouteHandler } from './network';
import type { RouteHandlerCallback } from './network';
import { Request, Response, Route, WebSocket, validateHeaders, RouteHandler } from './network';
import { FileChooser } from './fileChooser';
import { Buffer } from 'buffer';
import { Coverage } from './coverage';
import { Waiter } from './waiter';
import * as api from '../../types/types';
import * as structs from '../../types/structs';
import type * as api from '../../types/types';
import type * as structs from '../../types/structs';
import fs from 'fs';
import path from 'path';
import { Size, URLMatch, Headers, LifecycleEvent, WaitForEventOptions, SelectOption, SelectOptionOptions, FilePayload, WaitForFunctionOptions } from './types';
import type { Size, URLMatch, Headers, LifecycleEvent, WaitForEventOptions, SelectOption, SelectOptionOptions, FilePayload, WaitForFunctionOptions } from './types';
import { evaluationScript, urlMatches } from './clientHelper';
import { isString, isRegExp, isObject, mkdirIfNeeded, headersObjectToArray } from '../utils/utils';
import { isSafeCloseError } from '../utils/errors';
import { Video } from './video';
import { Artifact } from './artifact';
import { APIRequestContext } from './fetch';
import type { APIRequestContext } from './fetch';
type PDFOptions = Omit<channels.PagePdfParams, 'width' | 'height' | 'margin'> & {
width?: string | number,

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import { TimeoutError } from '../utils/errors';
import * as socks from '../utils/socksProxy';
import { Android } from './android';
@ -24,7 +24,7 @@ import { Electron } from './electron';
import { APIRequest } from './fetch';
import { LocalUtils } from './localUtils';
import { Selectors, SelectorsOwner } from './selectors';
import { Size } from './types';
import type { Size } from './types';
type DeviceDescriptor = {
userAgent: string,

View File

@ -15,10 +15,10 @@
*/
import { evaluationScript } from './clientHelper';
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
import { SelectorEngine } from './types';
import * as api from '../../types/types';
import type { SelectorEngine } from './types';
import type * as api from '../../types/types';
export class Selectors implements api.Selectors {
private _channels = new Set<SelectorsOwner>();

View File

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

View File

@ -14,11 +14,11 @@
* limitations under the License.
*/
import * as api from '../../types/types';
import * as channels from '../protocol/channels';
import type * as api from '../../types/types';
import type * as channels from '../protocol/channels';
import { Artifact } from './artifact';
import { ChannelOwner } from './channelOwner';
import { LocalUtils } from './localUtils';
import type { LocalUtils } from './localUtils';
export class Tracing extends ChannelOwner<channels.TracingChannel> implements api.Tracing {
_localUtils!: LocalUtils;

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import type { Size } from '../common/types';
export type { Size, Point, Rect, Quad, URLMatch, TimeoutOptions, HeadersArray } from '../common/types';

View File

@ -14,10 +14,10 @@
* limitations under the License.
*/
import { Page } from './page';
import * as api from '../../types/types';
import { Artifact } from './artifact';
import { Connection } from './connection';
import type { Page } from './page';
import type * as api from '../../types/types';
import type { Artifact } from './artifact';
import type { Connection } from './connection';
export class Video implements api.Video {
private _artifact: Promise<Artifact | null> | null = null;

View File

@ -14,12 +14,12 @@
* limitations under the License.
*/
import { EventEmitter } from 'events';
import type { EventEmitter } from 'events';
import { rewriteErrorMessage } from '../utils/stackTrace';
import { TimeoutError } from '../utils/errors';
import { createGuid } from '../utils/utils';
import * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
import type * as channels from '../protocol/channels';
import type { ChannelOwner } from './channelOwner';
export class Waiter {
private _dispose: (() => void)[];

View File

@ -15,13 +15,13 @@
*/
import { Events } from './events';
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
import { assertMaxArguments, JSHandle, parseResult, serializeArgument } from './jsHandle';
import { Page } from './page';
import { BrowserContext } from './browserContext';
import * as api from '../../types/types';
import * as structs from '../../types/structs';
import type { Page } from './page';
import type { BrowserContext } from './browserContext';
import type * as api from '../../types/types';
import type * as structs from '../../types/structs';
export class Worker extends ChannelOwner<channels.WorkerChannel> implements api.Worker {
_page: Page | undefined; // Set for web workers.

View File

@ -15,7 +15,7 @@
*/
import { Writable } from 'stream';
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner';
export class WritableStream extends ChannelOwner<channels.WritableStreamChannel> {

View File

@ -14,11 +14,13 @@
* limitations under the License.
*/
import { Dispatcher, DispatcherScope, existingDispatcher } from './dispatcher';
import { Android, AndroidDevice, SocketBackend } from '../server/android/android';
import * as channels from '../protocol/channels';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher, existingDispatcher } from './dispatcher';
import type { Android, SocketBackend } from '../server/android/android';
import { AndroidDevice } from '../server/android/android';
import type * as channels from '../protocol/channels';
import { BrowserContextDispatcher } from './browserContextDispatcher';
import { CallMetadata } from '../server/instrumentation';
import type { CallMetadata } from '../server/instrumentation';
export class AndroidDispatcher extends Dispatcher<Android, channels.AndroidChannel> implements channels.AndroidChannel {
_type_Android = true;

View File

@ -14,12 +14,13 @@
* limitations under the License.
*/
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
import type * as channels from '../protocol/channels';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher } from './dispatcher';
import { StreamDispatcher } from './streamDispatcher';
import fs from 'fs';
import { mkdirIfNeeded } from '../utils/utils';
import { Artifact } from '../server/artifact';
import type { Artifact } from '../server/artifact';
export class ArtifactDispatcher extends Dispatcher<Artifact, channels.ArtifactChannel> implements channels.ArtifactChannel {
_type_Artifact = true;

View File

@ -15,18 +15,19 @@
*/
import { BrowserContext } from '../server/browserContext';
import { Dispatcher, DispatcherScope, lookupDispatcher } from './dispatcher';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher, lookupDispatcher } from './dispatcher';
import { PageDispatcher, BindingCallDispatcher, WorkerDispatcher } from './pageDispatcher';
import { FrameDispatcher } from './frameDispatcher';
import * as channels from '../protocol/channels';
import type { FrameDispatcher } from './frameDispatcher';
import type * as channels from '../protocol/channels';
import { RouteDispatcher, RequestDispatcher, ResponseDispatcher, APIRequestContextDispatcher } from './networkDispatchers';
import { CRBrowserContext } from '../server/chromium/crBrowser';
import { CDPSessionDispatcher } from './cdpSessionDispatcher';
import { RecorderSupplement } from '../server/supplements/recorderSupplement';
import { CallMetadata } from '../server/instrumentation';
import type { CallMetadata } from '../server/instrumentation';
import { ArtifactDispatcher } from './artifactDispatcher';
import { Artifact } from '../server/artifact';
import { Request, Response } from '../server/network';
import type { Artifact } from '../server/artifact';
import type { Request, Response } from '../server/network';
import { TracingDispatcher } from './tracingDispatcher';
import * as fs from 'fs';
import * as path from 'path';

View File

@ -15,13 +15,15 @@
*/
import { Browser } from '../server/browser';
import * as channels from '../protocol/channels';
import type * 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 { PageDispatcher } from './pageDispatcher';
import { CallMetadata, serverSideCallMetadata } from '../server/instrumentation';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher } from './dispatcher';
import type { CRBrowser } from '../server/chromium/crBrowser';
import type { PageDispatcher } from './pageDispatcher';
import type { CallMetadata } from '../server/instrumentation';
import { serverSideCallMetadata } from '../server/instrumentation';
import { BrowserContext } from '../server/browserContext';
import { Selectors } from '../server/selectors';

View File

@ -14,12 +14,13 @@
* limitations under the License.
*/
import { BrowserType } from '../server/browserType';
import type { BrowserType } from '../server/browserType';
import { BrowserDispatcher } from './browserDispatcher';
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
import type * as channels from '../protocol/channels';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher } from './dispatcher';
import { BrowserContextDispatcher } from './browserContextDispatcher';
import { CallMetadata } from '../server/instrumentation';
import type { CallMetadata } from '../server/instrumentation';
import { JsonPipeDispatcher } from '../dispatchers/jsonPipeDispatcher';
import { getUserAgent } from '../utils/utils';
import * as socks from '../utils/socksProxy';

View File

@ -14,9 +14,11 @@
* limitations under the License.
*/
import { CRSession, CRSessionEvents } from '../server/chromium/crConnection';
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
import type { CRSession } from '../server/chromium/crConnection';
import { CRSessionEvents } from '../server/chromium/crConnection';
import type * as channels from '../protocol/channels';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher } from './dispatcher';
export class CDPSessionDispatcher extends Dispatcher<CRSession, channels.CDPSessionChannel> implements channels.CDPSessionChannel {
_type_CDPSession = true;

View File

@ -14,9 +14,10 @@
* limitations under the License.
*/
import { ConsoleMessage } from '../server/console';
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
import type { ConsoleMessage } from '../server/console';
import type * as channels from '../protocol/channels';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher } from './dispatcher';
import { ElementHandleDispatcher } from './elementHandlerDispatcher';
export class ConsoleMessageDispatcher extends Dispatcher<ConsoleMessage, channels.ConsoleMessageChannel> implements channels.ConsoleMessageChannel {

View File

@ -14,9 +14,10 @@
* limitations under the License.
*/
import { Dialog } from '../server/dialog';
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
import type { Dialog } from '../server/dialog';
import type * as channels from '../protocol/channels';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher } from './dispatcher';
export class DialogDispatcher extends Dispatcher<Dialog, channels.DialogChannel> implements channels.DialogChannel {
_type_Dialog = true;

View File

@ -15,13 +15,15 @@
*/
import { EventEmitter } from 'events';
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import { serializeError } from '../protocol/serializers';
import { createScheme, Validator, ValidationError } from '../protocol/validator';
import type { Validator } from '../protocol/validator';
import { createScheme, ValidationError } from '../protocol/validator';
import { assert, debugAssert, isUnderTest, monotonicTime } from '../utils/utils';
import { tOptional } from '../protocol/validatorPrimitives';
import { kBrowserOrContextClosedError } from '../utils/errors';
import { CallMetadata, SdkObject } from '../server/instrumentation';
import type { CallMetadata } from '../server/instrumentation';
import { SdkObject } from '../server/instrumentation';
import { rewriteErrorMessage } from '../utils/stackTrace';
import type { PlaywrightDispatcher } from './playwrightDispatcher';

View File

@ -14,11 +14,13 @@
* limitations under the License.
*/
import { Dispatcher, DispatcherScope } from './dispatcher';
import { Electron, ElectronApplication } from '../server/electron/electron';
import * as channels from '../protocol/channels';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher } from './dispatcher';
import type { Electron } from '../server/electron/electron';
import { ElectronApplication } from '../server/electron/electron';
import type * as channels from '../protocol/channels';
import { BrowserContextDispatcher } from './browserContextDispatcher';
import { PageDispatcher } from './pageDispatcher';
import type { PageDispatcher } from './pageDispatcher';
import { parseArgument, serializeResult } from './jsHandleDispatcher';
import { ElementHandleDispatcher } from './elementHandlerDispatcher';

View File

@ -14,15 +14,16 @@
* limitations under the License.
*/
import { ElementHandle } from '../server/dom';
import { Frame } from '../server/frames';
import * as js from '../server/javascript';
import * as channels from '../protocol/channels';
import { DispatcherScope, existingDispatcher, lookupNullableDispatcher } from './dispatcher';
import type { ElementHandle } from '../server/dom';
import type { Frame } from '../server/frames';
import type * as js from '../server/javascript';
import type * as channels from '../protocol/channels';
import type { DispatcherScope } from './dispatcher';
import { existingDispatcher, lookupNullableDispatcher } from './dispatcher';
import { JSHandleDispatcher, serializeResult, parseArgument } from './jsHandleDispatcher';
import { FrameDispatcher } from './frameDispatcher';
import { CallMetadata } from '../server/instrumentation';
import { WritableStreamDispatcher } from './writableStreamDispatcher';
import type { FrameDispatcher } from './frameDispatcher';
import type { CallMetadata } from '../server/instrumentation';
import type { WritableStreamDispatcher } from './writableStreamDispatcher';
export class ElementHandleDispatcher extends JSHandleDispatcher implements channels.ElementHandleChannel {
_type_ElementHandle = true;

View File

@ -14,14 +14,17 @@
* limitations under the License.
*/
import { Frame, NavigationEvent } from '../server/frames';
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope, lookupNullableDispatcher, existingDispatcher } from './dispatcher';
import type { NavigationEvent } from '../server/frames';
import { Frame } from '../server/frames';
import type * as channels from '../protocol/channels';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher, lookupNullableDispatcher, existingDispatcher } from './dispatcher';
import { ElementHandleDispatcher } from './elementHandlerDispatcher';
import { parseArgument, serializeResult } from './jsHandleDispatcher';
import { ResponseDispatcher, RequestDispatcher } from './networkDispatchers';
import { CallMetadata } from '../server/instrumentation';
import { WritableStreamDispatcher } from './writableStreamDispatcher';
import type { ResponseDispatcher } from './networkDispatchers';
import { RequestDispatcher } from './networkDispatchers';
import type { CallMetadata } from '../server/instrumentation';
import type { WritableStreamDispatcher } from './writableStreamDispatcher';
export class FrameDispatcher extends Dispatcher<Frame, channels.FrameChannel> implements channels.FrameChannel {
_type_Frame = true;

View File

@ -14,9 +14,10 @@
* limitations under the License.
*/
import * as js from '../server/javascript';
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
import type * as js from '../server/javascript';
import type * as channels from '../protocol/channels';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher } from './dispatcher';
import { ElementHandleDispatcher } from './elementHandlerDispatcher';
import { parseSerializedValue, serializeValue } from '../protocol/serializers';

View File

@ -14,8 +14,9 @@
* limitations under the License.
*/
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
import type * as channels from '../protocol/channels';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher } from './dispatcher';
import { createGuid } from '../utils/utils';
import { serializeError } from '../protocol/serializers';

View File

@ -14,15 +14,16 @@
* limitations under the License.
*/
import EventEmitter from 'events';
import type EventEmitter from 'events';
import fs from 'fs';
import path from 'path';
import yauzl from 'yauzl';
import yazl from 'yazl';
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import { ManualPromise } from '../utils/async';
import { assert, createGuid } from '../utils/utils';
import { Dispatcher, DispatcherScope } from './dispatcher';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher } from './dispatcher';
export class LocalUtilsDispatcher extends Dispatcher<{ guid: string }, channels.LocalUtilsChannel> implements channels.LocalUtilsChannel {
_type_LocalUtils: boolean;

View File

@ -14,11 +14,13 @@
* limitations under the License.
*/
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import { APIRequestContext } from '../server/fetch';
import { CallMetadata } from '../server/instrumentation';
import { Request, Response, Route, WebSocket } from '../server/network';
import { Dispatcher, DispatcherScope, existingDispatcher, lookupNullableDispatcher } from './dispatcher';
import type { CallMetadata } from '../server/instrumentation';
import type { Request, Response, Route } from '../server/network';
import { WebSocket } from '../server/network';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher, existingDispatcher, lookupNullableDispatcher } from './dispatcher';
import { FrameDispatcher } from './frameDispatcher';
import { TracingDispatcher } from './tracingDispatcher';

View File

@ -14,25 +14,27 @@
* limitations under the License.
*/
import { BrowserContext } from '../server/browserContext';
import { Frame } from '../server/frames';
import type { BrowserContext } from '../server/browserContext';
import type { Frame } from '../server/frames';
import { Page, Worker } from '../server/page';
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope, existingDispatcher, lookupDispatcher, lookupNullableDispatcher } from './dispatcher';
import type * as channels from '../protocol/channels';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher, existingDispatcher, lookupDispatcher, lookupNullableDispatcher } from './dispatcher';
import { parseError, serializeError } from '../protocol/serializers';
import { ConsoleMessageDispatcher } from './consoleMessageDispatcher';
import { DialogDispatcher } from './dialogDispatcher';
import { FrameDispatcher } from './frameDispatcher';
import { RequestDispatcher, ResponseDispatcher, RouteDispatcher, WebSocketDispatcher } from './networkDispatchers';
import type { ResponseDispatcher } from './networkDispatchers';
import { RequestDispatcher, RouteDispatcher, WebSocketDispatcher } from './networkDispatchers';
import { serializeResult, parseArgument } from './jsHandleDispatcher';
import { ElementHandleDispatcher } from './elementHandlerDispatcher';
import { FileChooser } from '../server/fileChooser';
import { CRCoverage } from '../server/chromium/crCoverage';
import { JSHandle } from '../server/javascript';
import { CallMetadata } from '../server/instrumentation';
import { Artifact } from '../server/artifact';
import type { FileChooser } from '../server/fileChooser';
import type { CRCoverage } from '../server/chromium/crCoverage';
import type { JSHandle } from '../server/javascript';
import type { CallMetadata } from '../server/instrumentation';
import type { Artifact } from '../server/artifact';
import { ArtifactDispatcher } from './artifactDispatcher';
import { Download } from '../server/download';
import type { Download } from '../server/download';
import { createGuid } from '../utils/utils';
export class PageDispatcher extends Dispatcher<Page, channels.PageChannel> implements channels.PageChannel {

View File

@ -14,15 +14,17 @@
* limitations under the License.
*/
import * as channels from '../protocol/channels';
import { Browser } from '../server/browser';
import type * as channels from '../protocol/channels';
import type { Browser } from '../server/browser';
import { GlobalAPIRequestContext } from '../server/fetch';
import { Playwright } from '../server/playwright';
import { SocksProxy, SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../utils/socksProxy';
import * as types from '../server/types';
import type { Playwright } from '../server/playwright';
import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../utils/socksProxy';
import { SocksProxy } from '../utils/socksProxy';
import type * as types from '../server/types';
import { AndroidDispatcher } from './androidDispatcher';
import { BrowserTypeDispatcher } from './browserTypeDispatcher';
import { Dispatcher, DispatcherScope } from './dispatcher';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher } from './dispatcher';
import { ElectronDispatcher } from './electronDispatcher';
import { LocalUtilsDispatcher } from './localUtilsDispatcher';
import { APIRequestContextDispatcher } from './networkDispatchers';

View File

@ -14,9 +14,10 @@
* limitations under the License.
*/
import { Dispatcher, DispatcherScope } from './dispatcher';
import * as channels from '../protocol/channels';
import { Selectors } from '../server/selectors';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher } from './dispatcher';
import type * as channels from '../protocol/channels';
import type { Selectors } from '../server/selectors';
export class SelectorsDispatcher extends Dispatcher<Selectors, channels.SelectorsChannel> implements channels.SelectorsChannel {
_type_Selectors = true;

View File

@ -14,9 +14,10 @@
* limitations under the License.
*/
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
import * as stream from 'stream';
import type * as channels from '../protocol/channels';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher } from './dispatcher';
import type * as stream from 'stream';
import { createGuid } from '../utils/utils';
export class StreamDispatcher extends Dispatcher<{ guid: string, stream: stream.Readable }, channels.StreamChannel> implements channels.StreamChannel {

View File

@ -14,10 +14,11 @@
* limitations under the License.
*/
import * as channels from '../protocol/channels';
import type * as channels from '../protocol/channels';
import { Tracing } from '../server/trace/recorder/tracing';
import { ArtifactDispatcher } from './artifactDispatcher';
import { Dispatcher, DispatcherScope, existingDispatcher } from './dispatcher';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher, existingDispatcher } from './dispatcher';
export class TracingDispatcher extends Dispatcher<Tracing, channels.TracingChannel> implements channels.TracingChannel {
_type_Tracing = true;

View File

@ -14,9 +14,10 @@
* limitations under the License.
*/
import * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher';
import * as fs from 'fs';
import type * as channels from '../protocol/channels';
import type { DispatcherScope } from './dispatcher';
import { Dispatcher } from './dispatcher';
import type * as fs from 'fs';
import { createGuid } from '../utils/utils';
export class WritableStreamDispatcher extends Dispatcher<{ guid: string, stream: fs.WriteStream }, channels.WritableStreamChannel> implements channels.WritableStreamChannel {

View File

@ -16,7 +16,7 @@
import http from 'http';
import os from 'os';
import { GridAgentLaunchOptions, GridFactory } from './gridServer';
import type { GridAgentLaunchOptions, GridFactory } from './gridServer';
import * as utils from '../utils/utils';
const dockerFactory: GridFactory = {

View File

@ -16,7 +16,7 @@
import WebSocket from 'ws';
import { Connection } from '../client/connection';
import { Playwright } from '../client/playwright';
import type { Playwright } from '../client/playwright';
import { getPlaywrightVersion } from '../utils/utils';
export class GridClient {

View File

@ -18,7 +18,8 @@ import debug from 'debug';
import assert from 'assert';
import { EventEmitter } from 'events';
import { URL } from 'url';
import WebSocket, { Server as WebSocketServer } from 'ws';
import type { Server as WebSocketServer } from 'ws';
import type WebSocket from 'ws';
import { HttpServer } from '../utils/httpServer';
import { createGuid, getPlaywrightVersion } from '../utils/utils';

View File

@ -15,7 +15,7 @@
*/
import child_process from 'child_process';
import { GridAgentLaunchOptions, GridFactory } from './gridServer';
import type { GridAgentLaunchOptions, GridFactory } from './gridServer';
import path from 'path';
const simpleFactory: GridFactory = {

View File

@ -16,7 +16,7 @@
import { Connection } from './client/connection';
import { IpcTransport } from './protocol/transport';
import { Playwright } from './client/playwright';
import type { Playwright } from './client/playwright';
import * as childProcess from 'child_process';
import * as path from 'path';
import { ManualPromise } from './utils/async';

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import { Point, StackFrame, SerializedError } from './channels';
import type { Point, StackFrame, SerializedError } from './channels';
export type CallMetadata = {
id: string;

View File

@ -15,7 +15,7 @@
*/
import { TimeoutError } from '../utils/errors';
import { SerializedError, SerializedValue } from './channels';
import type { SerializedError, SerializedValue } from './channels';
export function serializeError(e: any): SerializedError {
if (isError(e))

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import { ChildProcess } from 'child_process';
import type { ChildProcess } from 'child_process';
import { makeWaitForNextTask } from '../utils/utils';
export interface WritableStream {

View File

@ -16,7 +16,8 @@
// This file is generated by generate_channels.js, do not edit manually.
import { Validator, ValidationError, tOptional, tObject, tBoolean, tNumber, tString, tAny, tEnum, tArray, tBinary } from './validatorPrimitives';
import type { Validator } from './validatorPrimitives';
import { ValidationError, tOptional, tObject, tBoolean, tNumber, tString, tAny, tEnum, tArray, tBinary } from './validatorPrimitives';
export type { Validator } from './validatorPrimitives';
export { ValidationError } from './validatorPrimitives';

View File

@ -16,7 +16,7 @@
import WebSocket from 'ws';
import { Connection } from '../client/connection';
import { Playwright } from '../client/playwright';
import type { Playwright } from '../client/playwright';
import { makeWaitForNextTask } from '../utils/utils';
// TODO: this file should be removed because it uses the old protocol.

View File

@ -14,12 +14,14 @@
* limitations under the License.
*/
import WebSocket from 'ws';
import { DispatcherConnection, DispatcherScope, Root } from '../dispatchers/dispatcher';
import type WebSocket from 'ws';
import type { DispatcherScope } from '../dispatchers/dispatcher';
import { DispatcherConnection, Root } from '../dispatchers/dispatcher';
import { PlaywrightDispatcher } from '../dispatchers/playwrightDispatcher';
import { Browser } from '../server/browser';
import { serverSideCallMetadata } from '../server/instrumentation';
import { createPlaywright, Playwright } from '../server/playwright';
import type { Playwright } from '../server/playwright';
import { createPlaywright } from '../server/playwright';
import { gracefullyCloseAll } from '../utils/processLauncher';
import { registry } from '../utils/registry';
import { SocksProxy } from '../utils/socksProxy';

View File

@ -17,7 +17,7 @@
import debug from 'debug';
import * as http from 'http';
import WebSocket from 'ws';
import { Browser } from '../server/browser';
import type { Browser } from '../server/browser';
import { PlaywrightConnection } from './playwrightConnection';
const debugLog = debug('pw:server');

View File

@ -15,8 +15,8 @@
* limitations under the License.
*/
import * as dom from './dom';
import * as types from './types';
import type * as dom from './dom';
import type * as types from './types';
export interface AXNode {
isInteresting(insideControl: boolean): boolean;

View File

@ -15,16 +15,17 @@
*/
import debug from 'debug';
import * as types from '../types';
import type * as types from '../types';
import { EventEmitter } from 'events';
import fs from 'fs';
import os from 'os';
import path from 'path';
import * as stream from 'stream';
import type * as stream from 'stream';
import * as ws from 'ws';
import { createGuid, makeWaitForNextTask, removeFolders } from '../../utils/utils';
import { BrowserOptions, BrowserProcess, PlaywrightOptions } from '../browser';
import { BrowserContext, validateBrowserContextOptions } from '../browserContext';
import type { BrowserOptions, BrowserProcess, PlaywrightOptions } from '../browser';
import type { BrowserContext } from '../browserContext';
import { validateBrowserContextOptions } from '../browserContext';
import { ProgressController } from '../progress';
import { CRBrowser } from '../chromium/crBrowser';
import { helper } from '../helper';
@ -32,7 +33,7 @@ import { PipeTransport } from '../../protocol/transport';
import { RecentLogsCollector } from '../../utils/debugLogger';
import { gracefullyCloseSet } from '../../utils/processLauncher';
import { TimeoutSettings } from '../../utils/timeoutSettings';
import { AndroidWebView } from '../../protocol/channels';
import type { AndroidWebView } from '../../protocol/channels';
import { SdkObject, serverSideCallMetadata } from '../instrumentation';
const ARTIFACTS_FOLDER = path.join(os.tmpdir(), 'playwright-artifacts-');

View File

@ -16,10 +16,10 @@
import assert from 'assert';
import debug from 'debug';
import * as types from '../types';
import type * as types from '../types';
import * as net from 'net';
import { EventEmitter } from 'events';
import { Backend, DeviceBackend, SocketBackend } from './android';
import type { Backend, DeviceBackend, SocketBackend } from './android';
import { createGuid } from '../../utils/utils';
export class AdbBackend implements Backend {

View File

@ -14,16 +14,17 @@
* limitations under the License.
*/
import * as types from './types';
import type * as types from './types';
import { BrowserContext, validateBrowserContextOptions } from './browserContext';
import { Page } from './page';
import { Download } from './download';
import { ProxySettings } from './types';
import { ChildProcess } from 'child_process';
import { RecentLogsCollector } from '../utils/debugLogger';
import { CallMetadata, SdkObject } from './instrumentation';
import type { ProxySettings } from './types';
import type { ChildProcess } from 'child_process';
import type { RecentLogsCollector } from '../utils/debugLogger';
import type { CallMetadata } from './instrumentation';
import { SdkObject } from './instrumentation';
import { Artifact } from './artifact';
import { Selectors } from './selectors';
import type { Selectors } from './selectors';
export interface BrowserProcess {
onclose?: ((exitCode: number | null, signal: string | null) => void);

View File

@ -18,18 +18,20 @@
import * as os from 'os';
import { TimeoutSettings } from '../utils/timeoutSettings';
import { debugMode, mkdirIfNeeded, createGuid } from '../utils/utils';
import { Browser, BrowserOptions } from './browser';
import { Download } from './download';
import * as frames from './frames';
import type { Browser, BrowserOptions } from './browser';
import type { Download } from './download';
import type * as frames from './frames';
import { helper } from './helper';
import * as network from './network';
import { Page, PageBinding, PageDelegate } from './page';
import { Progress } from './progress';
import { Selectors } from './selectors';
import * as types from './types';
import type { PageDelegate } from './page';
import { Page, PageBinding } from './page';
import type { Progress } from './progress';
import type { Selectors } from './selectors';
import type * as types from './types';
import path from 'path';
import fs from 'fs';
import { CallMetadata, serverSideCallMetadata, SdkObject } from './instrumentation';
import type { CallMetadata } from './instrumentation';
import { serverSideCallMetadata, SdkObject } from './instrumentation';
import { Debugger } from './supplements/debugger';
import { Tracing } from './trace/recorder/tracing';
import { HarRecorder } from './supplements/har/harRecorder';

View File

@ -17,19 +17,25 @@
import fs from 'fs';
import * as os from 'os';
import path from 'path';
import { BrowserContext, normalizeProxySettings, validateBrowserContextOptions } from './browserContext';
import { registry, BrowserName } from '../utils/registry';
import { ConnectionTransport, WebSocketTransport } from './transport';
import { BrowserOptions, Browser, BrowserProcess, PlaywrightOptions } from './browser';
import { launchProcess, Env, envArrayToObject } from '../utils/processLauncher';
import type { BrowserContext } from './browserContext';
import { normalizeProxySettings, validateBrowserContextOptions } from './browserContext';
import type { BrowserName } from '../utils/registry';
import { registry } from '../utils/registry';
import type { ConnectionTransport } from './transport';
import { WebSocketTransport } from './transport';
import type { BrowserOptions, Browser, BrowserProcess, PlaywrightOptions } from './browser';
import type { Env } from '../utils/processLauncher';
import { launchProcess, envArrayToObject } from '../utils/processLauncher';
import { PipeTransport } from './pipeTransport';
import { Progress, ProgressController } from './progress';
import * as types from './types';
import type { Progress } from './progress';
import { ProgressController } from './progress';
import type * as types from './types';
import { DEFAULT_TIMEOUT, TimeoutSettings } from '../utils/timeoutSettings';
import { debugMode, existsAsync } from '../utils/utils';
import { helper } from './helper';
import { RecentLogsCollector } from '../utils/debugLogger';
import { CallMetadata, SdkObject } from './instrumentation';
import type { CallMetadata } from './instrumentation';
import { SdkObject } from './instrumentation';
export const kNoXServerRunningError = 'Looks like you launched a headed browser without having a XServer running.\n' +
'Set either \'headless: false\' or use \'xvfb-run <your-playwright-app>\' before running Playwright.\n\n<3 Playwright Team';

View File

@ -19,20 +19,25 @@ import fs from 'fs';
import os from 'os';
import path from 'path';
import { CRBrowser } from './crBrowser';
import { Env, gracefullyCloseSet } from '../../utils/processLauncher';
import type { Env } from '../../utils/processLauncher';
import { gracefullyCloseSet } from '../../utils/processLauncher';
import { kBrowserCloseMessageId } from './crConnection';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { BrowserType, kNoXServerRunningError } from '../browserType';
import { ConnectionTransport, ProtocolRequest, WebSocketTransport } from '../transport';
import type { ConnectionTransport, ProtocolRequest } from '../transport';
import { WebSocketTransport } from '../transport';
import { CRDevTools } from './crDevTools';
import { Browser, BrowserOptions, BrowserProcess, PlaywrightOptions } from '../browser';
import * as types from '../types';
import { debugMode, fetchData, getUserAgent, headersArrayToObject, HTTPRequestParams, removeFolders, streamToString, wrapInASCIIBox } from '../../utils/utils';
import type { BrowserOptions, BrowserProcess, PlaywrightOptions } from '../browser';
import { Browser } from '../browser';
import type * as types from '../types';
import type { HTTPRequestParams } from '../../utils/utils';
import { debugMode, fetchData, getUserAgent, headersArrayToObject, removeFolders, streamToString, wrapInASCIIBox } from '../../utils/utils';
import { RecentLogsCollector } from '../../utils/debugLogger';
import { Progress, ProgressController } from '../progress';
import type { Progress } from '../progress';
import { ProgressController } from '../progress';
import { TimeoutSettings } from '../../utils/timeoutSettings';
import { helper } from '../helper';
import { CallMetadata } from '../instrumentation';
import type { CallMetadata } from '../instrumentation';
import http from 'http';
import https from 'https';
import { registry } from '../../utils/registry';

View File

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

View File

@ -15,8 +15,8 @@
*/
import fs from 'fs';
import { Page } from '../page';
import { CRPage } from './crPage';
import type { Page } from '../page';
import type { CRPage } from './crPage';
export async function installAppIcon(page: Page) {
const icon = await fs.promises.readFile(require.resolve('./appIcon.png'));

View File

@ -15,21 +15,24 @@
* limitations under the License.
*/
import { Browser, BrowserOptions } from '../browser';
import type { BrowserOptions } from '../browser';
import { Browser } from '../browser';
import { assertBrowserContextIsNotOwned, BrowserContext, verifyGeolocation } from '../browserContext';
import { assert } from '../../utils/utils';
import * as network from '../network';
import { Page, PageBinding, PageDelegate, Worker } from '../page';
import type { PageBinding, PageDelegate } from '../page';
import { Page, Worker } from '../page';
import { Frame } from '../frames';
import { Dialog } from '../dialog';
import { ConnectionTransport } from '../transport';
import * as types from '../types';
import { ConnectionEvents, CRConnection, CRSession } from './crConnection';
import type { Dialog } from '../dialog';
import type { ConnectionTransport } from '../transport';
import type * as types from '../types';
import type { CRSession } from './crConnection';
import { ConnectionEvents, CRConnection } from './crConnection';
import { CRPage } from './crPage';
import { readProtocolStream } from './crProtocolHelper';
import { Protocol } from './protocol';
import type { Protocol } from './protocol';
import { CRExecutionContext } from './crExecutionContext';
import { CRDevTools } from './crDevTools';
import type { CRDevTools } from './crDevTools';
export class CRBrowser extends Browser {
readonly _connection: CRConnection;

View File

@ -16,12 +16,13 @@
*/
import { assert } from '../../utils/utils';
import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
import { Protocol } from './protocol';
import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
import type { Protocol } from './protocol';
import { EventEmitter } from 'events';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { debugLogger, RecentLogsCollector } from '../../utils/debugLogger';
import { ProtocolLogger } from '../types';
import type { RecentLogsCollector } from '../../utils/debugLogger';
import { debugLogger } from '../../utils/debugLogger';
import type { ProtocolLogger } from '../types';
import { helper } from '../helper';
import { ProtocolError } from '../protocolError';

View File

@ -15,10 +15,11 @@
* limitations under the License.
*/
import { CRSession } from './crConnection';
import { eventsHelper, RegisteredListener } from '../../utils/eventsHelper';
import { Protocol } from './protocol';
import * as types from '../types';
import type { CRSession } from './crConnection';
import type { RegisteredListener } from '../../utils/eventsHelper';
import { eventsHelper } from '../../utils/eventsHelper';
import type { Protocol } from './protocol';
import type * as types from '../types';
import { assert } from '../../utils/utils';
export class CRCoverage {

View File

@ -15,7 +15,7 @@
*/
import fs from 'fs';
import { CRSession } from './crConnection';
import type { CRSession } from './crConnection';
const kBindingName = '__pw_devtools__';

View File

@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { CRPage } from './crPage';
import * as types from '../types';
import type { CRPage } from './crPage';
import type * as types from '../types';
import { assert } from '../../utils/utils';
import { Protocol } from './protocol';
import type { Protocol } from './protocol';
import { toModifiersMask } from './crProtocolHelper';
declare global {

View File

@ -15,9 +15,9 @@
* limitations under the License.
*/
import { CRSession } from './crConnection';
import type { CRSession } from './crConnection';
import { getExceptionMessage, releaseObject } from './crProtocolHelper';
import { Protocol } from './protocol';
import type { Protocol } from './protocol';
import * as js from '../javascript';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { parseEvaluationResultValue } from '../common/utilityScriptSerializers';

Some files were not shown because too many files have changed in this diff Show More