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

View file

@ -15,7 +15,7 @@
*/ */
import { test, expect } from '@playwright/test'; 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' }); test.use({ locale: 'en-US' });

View file

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

View file

@ -16,7 +16,8 @@
import React from 'react'; import React from 'react';
import { test, expect } from '@playwright/experimental-ct-react/test'; 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 } }); test.use({ viewport: { width: 1000, height: 800 } });

View file

@ -17,7 +17,8 @@
import type { TestAttachment } from '@playwright-test/reporters/html'; import type { TestAttachment } from '@playwright-test/reporters/html';
import * as React from 'react'; import * as React from 'react';
import { AttachmentLink } from './links'; import { AttachmentLink } from './links';
import { TabbedPane, TabbedPaneTab } from './tabbedPane'; import type { TabbedPaneTab } from './tabbedPane';
import { TabbedPane } from './tabbedPane';
import './imageDiffView.css'; import './imageDiffView.css';
import './tabbedPane.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 React from 'react';
import * as ReactDOM from 'react-dom'; import * as ReactDOM from 'react-dom';
import './colors.css'; import './colors.css';
import { LoadedReport } from './loadedReport'; import type { LoadedReport } from './loadedReport';
import { ReportView } from './reportView'; import { ReportView } from './reportView';
// @ts-ignore // @ts-ignore
const zipjs = zipImport as typeof zip; const zipjs = zipImport as typeof zip;

View file

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

View file

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

View file

@ -21,7 +21,7 @@ import './common.css';
import { Filter } from './filter'; import { Filter } from './filter';
import { HeaderView } from './headerView'; import { HeaderView } from './headerView';
import { Route } from './links'; import { Route } from './links';
import { LoadedReport } from './loadedReport'; import type { LoadedReport } from './loadedReport';
import './reportView.css'; import './reportView.css';
import { MetadataView } from './metadataView'; import { MetadataView } from './metadataView';
import { TestCaseView } from './testCaseView'; 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 * as React from 'react';
import { msToString } from './uiUtils'; import { msToString } from './uiUtils';
import { Chip } from './chip'; import { Chip } from './chip';
import { Filter } from './filter'; import type { Filter } from './filter';
import { Link, ProjectLink } from './links'; import { Link, ProjectLink } from './links';
import { statusIcon } from './statusIcon'; import { statusIcon } from './statusIcon';
import './testFileView.css'; import './testFileView.css';

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,17 +14,17 @@
* limitations under the License. * limitations under the License.
*/ */
import * as channels from '../protocol/channels'; import type * as channels from '../protocol/channels';
import { Browser } from './browser'; import { Browser } from './browser';
import { BrowserContext, prepareBrowserContextParams } from './browserContext'; import { BrowserContext, prepareBrowserContextParams } from './browserContext';
import { ChannelOwner } from './channelOwner'; 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 { Connection } from './connection';
import { Events } from './events'; import { Events } from './events';
import { ChildProcess } from 'child_process'; import type { ChildProcess } from 'child_process';
import { envObjectToArray } from './clientHelper'; import { envObjectToArray } from './clientHelper';
import { assert, headersObjectToArray, monotonicTime } from '../utils/utils'; 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 { kBrowserClosedError } from '../utils/errors';
import { raceAgainstTimeout } from '../utils/async'; import { raceAgainstTimeout } from '../utils/async';
import type { Playwright } from './playwright'; import type { Playwright } from './playwright';

View file

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

View file

@ -15,13 +15,15 @@
*/ */
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
import * as channels from '../protocol/channels'; import type * as channels from '../protocol/channels';
import { createScheme, ValidationError, Validator } from '../protocol/validator'; import type { Validator } from '../protocol/validator';
import { createScheme, ValidationError } from '../protocol/validator';
import { debugLogger } from '../utils/debugLogger'; 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 { isUnderTest } from '../utils/utils';
import { zones } from '../utils/zones'; import { zones } from '../utils/zones';
import { ClientInstrumentation } from './clientInstrumentation'; import type { ClientInstrumentation } from './clientInstrumentation';
import type { Connection } from './connection'; import type { Connection } from './connection';
import type { Logger } from './types'; import type { Logger } from './types';

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -16,21 +16,22 @@
*/ */
import { assert } from '../utils/utils'; import { assert } from '../utils/utils';
import * as channels from '../protocol/channels'; import type * as channels from '../protocol/channels';
import { ChannelOwner } from './channelOwner'; import { ChannelOwner } from './channelOwner';
import { FrameLocator, Locator } from './locator'; import { FrameLocator, Locator } from './locator';
import { ElementHandle, convertSelectOptionValues, convertInputFiles } from './elementHandle'; import { ElementHandle, convertSelectOptionValues, convertInputFiles } from './elementHandle';
import { assertMaxArguments, JSHandle, serializeArgument, parseResult } from './jsHandle'; import { assertMaxArguments, JSHandle, serializeArgument, parseResult } from './jsHandle';
import fs from 'fs'; import fs from 'fs';
import * as network from './network'; import * as network from './network';
import { Page } from './page'; import type { Page } from './page';
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
import { Waiter } from './waiter'; import { Waiter } from './waiter';
import { Events } from './events'; 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 { urlMatches } from './clientHelper';
import * as api from '../../types/types'; import type * as api from '../../types/types';
import * as structs from '../../types/structs'; import type * as structs from '../../types/structs';
import { debugLogger } from '../utils/debugLogger'; import { debugLogger } from '../utils/debugLogger';
export type WaitForNavigationOptions = { export type WaitForNavigationOptions = {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import * as channels from '../protocol/channels'; import type * as channels from '../protocol/channels';
import type { Size } from '../common/types'; import type { Size } from '../common/types';
export type { Size, Point, Rect, Quad, URLMatch, TimeoutOptions, HeadersArray } 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. * limitations under the License.
*/ */
import { Page } from './page'; import type { Page } from './page';
import * as api from '../../types/types'; import type * as api from '../../types/types';
import { Artifact } from './artifact'; import type { Artifact } from './artifact';
import { Connection } from './connection'; import type { Connection } from './connection';
export class Video implements api.Video { export class Video implements api.Video {
private _artifact: Promise<Artifact | null> | null = null; private _artifact: Promise<Artifact | null> | null = null;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -15,13 +15,15 @@
*/ */
import { Browser } from '../server/browser'; import { Browser } from '../server/browser';
import * as channels from '../protocol/channels'; import type * as channels from '../protocol/channels';
import { BrowserContextDispatcher } from './browserContextDispatcher'; import { BrowserContextDispatcher } from './browserContextDispatcher';
import { CDPSessionDispatcher } from './cdpSessionDispatcher'; import { CDPSessionDispatcher } from './cdpSessionDispatcher';
import { Dispatcher, DispatcherScope } from './dispatcher'; import type { DispatcherScope } from './dispatcher';
import { CRBrowser } from '../server/chromium/crBrowser'; import { Dispatcher } from './dispatcher';
import { PageDispatcher } from './pageDispatcher'; import type { CRBrowser } from '../server/chromium/crBrowser';
import { CallMetadata, serverSideCallMetadata } from '../server/instrumentation'; import type { PageDispatcher } from './pageDispatcher';
import type { CallMetadata } from '../server/instrumentation';
import { serverSideCallMetadata } from '../server/instrumentation';
import { BrowserContext } from '../server/browserContext'; import { BrowserContext } from '../server/browserContext';
import { Selectors } from '../server/selectors'; import { Selectors } from '../server/selectors';

View file

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

View file

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

View file

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

View file

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

View file

@ -15,13 +15,15 @@
*/ */
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
import * as channels from '../protocol/channels'; import type * as channels from '../protocol/channels';
import { serializeError } from '../protocol/serializers'; 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 { assert, debugAssert, isUnderTest, monotonicTime } from '../utils/utils';
import { tOptional } from '../protocol/validatorPrimitives'; import { tOptional } from '../protocol/validatorPrimitives';
import { kBrowserOrContextClosedError } from '../utils/errors'; 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 { rewriteErrorMessage } from '../utils/stackTrace';
import type { PlaywrightDispatcher } from './playwrightDispatcher'; import type { PlaywrightDispatcher } from './playwrightDispatcher';

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,9 +14,10 @@
* limitations under the License. * limitations under the License.
*/ */
import * as channels from '../protocol/channels'; import type * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher'; import type { DispatcherScope } from './dispatcher';
import * as stream from 'stream'; import { Dispatcher } from './dispatcher';
import type * as stream from 'stream';
import { createGuid } from '../utils/utils'; import { createGuid } from '../utils/utils';
export class StreamDispatcher extends Dispatcher<{ guid: string, stream: stream.Readable }, channels.StreamChannel> implements channels.StreamChannel { 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. * 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 { Tracing } from '../server/trace/recorder/tracing';
import { ArtifactDispatcher } from './artifactDispatcher'; 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 { export class TracingDispatcher extends Dispatcher<Tracing, channels.TracingChannel> implements channels.TracingChannel {
_type_Tracing = true; _type_Tracing = true;

View file

@ -14,9 +14,10 @@
* limitations under the License. * limitations under the License.
*/ */
import * as channels from '../protocol/channels'; import type * as channels from '../protocol/channels';
import { Dispatcher, DispatcherScope } from './dispatcher'; import type { DispatcherScope } from './dispatcher';
import * as fs from 'fs'; import { Dispatcher } from './dispatcher';
import type * as fs from 'fs';
import { createGuid } from '../utils/utils'; import { createGuid } from '../utils/utils';
export class WritableStreamDispatcher extends Dispatcher<{ guid: string, stream: fs.WriteStream }, channels.WritableStreamChannel> implements channels.WritableStreamChannel { 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 http from 'http';
import os from 'os'; import os from 'os';
import { GridAgentLaunchOptions, GridFactory } from './gridServer'; import type { GridAgentLaunchOptions, GridFactory } from './gridServer';
import * as utils from '../utils/utils'; import * as utils from '../utils/utils';
const dockerFactory: GridFactory = { const dockerFactory: GridFactory = {

View file

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

View file

@ -18,7 +18,8 @@ import debug from 'debug';
import assert from 'assert'; import assert from 'assert';
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
import { URL } from 'url'; 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 { HttpServer } from '../utils/httpServer';
import { createGuid, getPlaywrightVersion } from '../utils/utils'; import { createGuid, getPlaywrightVersion } from '../utils/utils';

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -16,7 +16,8 @@
// This file is generated by generate_channels.js, do not edit manually. // 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 type { Validator } from './validatorPrimitives';
export { ValidationError } from './validatorPrimitives'; export { ValidationError } from './validatorPrimitives';

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -17,19 +17,25 @@
import fs from 'fs'; import fs from 'fs';
import * as os from 'os'; import * as os from 'os';
import path from 'path'; import path from 'path';
import { BrowserContext, normalizeProxySettings, validateBrowserContextOptions } from './browserContext'; import type { BrowserContext } from './browserContext';
import { registry, BrowserName } from '../utils/registry'; import { normalizeProxySettings, validateBrowserContextOptions } from './browserContext';
import { ConnectionTransport, WebSocketTransport } from './transport'; import type { BrowserName } from '../utils/registry';
import { BrowserOptions, Browser, BrowserProcess, PlaywrightOptions } from './browser'; import { registry } from '../utils/registry';
import { launchProcess, Env, envArrayToObject } from '../utils/processLauncher'; 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 { PipeTransport } from './pipeTransport';
import { Progress, ProgressController } from './progress'; import type { Progress } from './progress';
import * as types from './types'; import { ProgressController } from './progress';
import type * as types from './types';
import { DEFAULT_TIMEOUT, TimeoutSettings } from '../utils/timeoutSettings'; import { DEFAULT_TIMEOUT, TimeoutSettings } from '../utils/timeoutSettings';
import { debugMode, existsAsync } from '../utils/utils'; import { debugMode, existsAsync } from '../utils/utils';
import { helper } from './helper'; import { helper } from './helper';
import { RecentLogsCollector } from '../utils/debugLogger'; 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' + 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'; '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 os from 'os';
import path from 'path'; import path from 'path';
import { CRBrowser } from './crBrowser'; 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 { kBrowserCloseMessageId } from './crConnection';
import { rewriteErrorMessage } from '../../utils/stackTrace'; import { rewriteErrorMessage } from '../../utils/stackTrace';
import { BrowserType, kNoXServerRunningError } from '../browserType'; 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 { CRDevTools } from './crDevTools';
import { Browser, BrowserOptions, BrowserProcess, PlaywrightOptions } from '../browser'; import type { BrowserOptions, BrowserProcess, PlaywrightOptions } from '../browser';
import * as types from '../types'; import { Browser } from '../browser';
import { debugMode, fetchData, getUserAgent, headersArrayToObject, HTTPRequestParams, removeFolders, streamToString, wrapInASCIIBox } from '../../utils/utils'; 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 { RecentLogsCollector } from '../../utils/debugLogger';
import { Progress, ProgressController } from '../progress'; import type { Progress } from '../progress';
import { ProgressController } from '../progress';
import { TimeoutSettings } from '../../utils/timeoutSettings'; import { TimeoutSettings } from '../../utils/timeoutSettings';
import { helper } from '../helper'; import { helper } from '../helper';
import { CallMetadata } from '../instrumentation'; import type { CallMetadata } from '../instrumentation';
import http from 'http'; import http from 'http';
import https from 'https'; import https from 'https';
import { registry } from '../../utils/registry'; import { registry } from '../../utils/registry';

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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