chore: move webkit to src/server/webkit (#3589)

This commit is contained in:
Dmitry Gozman 2020-08-23 15:39:03 -07:00 committed by GitHub
parent 77f803140a
commit 6a53b205e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 55 additions and 53 deletions

View File

@ -8,7 +8,7 @@ lib/
src/generated/*
src/server/chromium/protocol.ts
src/firefox/protocol.ts
src/webkit/protocol.ts
src/server/webkit/protocol.ts
/types/*
/index.d.ts
/electron-types.d.ts

View File

@ -15,7 +15,7 @@
*/
import { Chromium } from './chromium/chromium';
import { WebKit } from './webkit';
import { WebKit } from './webkit/webkit';
import { Firefox } from './firefox';
import { selectors } from '../selectors';
import * as browserPaths from '../utils/browserPaths';

View File

@ -16,14 +16,14 @@
*/
import { WKBrowser } from '../webkit/wkBrowser';
import { Env } from './processLauncher';
import { Env } from '../processLauncher';
import * as path from 'path';
import { kBrowserCloseMessageId } from '../webkit/wkConnection';
import { BrowserTypeBase } from './browserType';
import { ConnectionTransport } from '../transport';
import { BrowserOptions } from '../browser';
import { BrowserDescriptor } from '../utils/browserPaths';
import * as types from '../types';
import { kBrowserCloseMessageId } from './wkConnection';
import { BrowserTypeBase } from '../browserType';
import { ConnectionTransport } from '../../transport';
import { BrowserOptions } from '../../browser';
import { BrowserDescriptor } from '../../utils/browserPaths';
import * as types from '../../types';
export class WebKit extends BrowserTypeBase {
constructor(packagePath: string, browser: BrowserDescriptor) {

View File

@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as accessibility from '../accessibility';
import * as accessibility from '../../accessibility';
import { WKSession } from './wkConnection';
import { Protocol } from './protocol';
import * as dom from '../dom';
import * as types from '../types';
import * as dom from '../../dom';
import * as types from '../../types';
export async function getAccessibilityTree(session: WKSession, needle?: dom.ElementHandle) {
const objectId = needle ? needle._objectId : undefined;

View File

@ -15,15 +15,15 @@
* limitations under the License.
*/
import { Browser, BrowserOptions } from '../browser';
import { assertBrowserContextIsNotOwned, BrowserContext, validateBrowserContextOptions, verifyGeolocation } from '../browserContext';
import { helper, RegisteredListener } from '../helper';
import { assert } from '../utils/utils';
import * as network from '../network';
import { Page, PageBinding } from '../page';
import { Browser, BrowserOptions } from '../../browser';
import { assertBrowserContextIsNotOwned, BrowserContext, validateBrowserContextOptions, verifyGeolocation } from '../../browserContext';
import { helper, RegisteredListener } from '../../helper';
import { assert } from '../../utils/utils';
import * as network from '../../network';
import { Page, PageBinding } from '../../page';
import * as path from 'path';
import { ConnectionTransport } from '../transport';
import * as types from '../types';
import { ConnectionTransport } from '../../transport';
import * as types from '../../types';
import { Protocol } from './protocol';
import { kPageProxyMessageReceived, PageProxyMessageReceivedPayload, WKConnection, WKSession } from './wkConnection';
import { WKPage } from './wkPage';

View File

@ -16,11 +16,11 @@
*/
import { EventEmitter } from 'events';
import { assert } from '../utils/utils';
import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
import { assert } from '../../utils/utils';
import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../../transport';
import { Protocol } from './protocol';
import { rewriteErrorMessage } from '../utils/stackTrace';
import { debugLogger } from '../utils/debugLogger';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { debugLogger } from '../../utils/debugLogger';
// WKPlaywright uses this special id to issue Browser.close command which we
// should ignore.

View File

@ -17,9 +17,9 @@
import { WKSession, isSwappedOutError } from './wkConnection';
import { Protocol } from './protocol';
import * as js from '../javascript';
import { parseEvaluationResultValue } from '../common/utilityScriptSerializers';
import * as sourceMap from '../utils/sourceMap';
import * as js from '../../javascript';
import { parseEvaluationResultValue } from '../../common/utilityScriptSerializers';
import * as sourceMap from '../../utils/sourceMap';
export class WKExecutionContext implements js.ExecutionContextDelegate {
private readonly _session: WKSession;

View File

@ -15,11 +15,11 @@
* limitations under the License.
*/
import * as input from '../input';
import * as types from '../types';
import { macEditingCommands } from '../macEditingCommands';
import * as input from '../../input';
import * as types from '../../types';
import { macEditingCommands } from '../../macEditingCommands';
import { WKSession } from './wkConnection';
import { isString } from '../utils/utils';
import { isString } from '../../utils/utils';
function toModifiersMask(modifiers: Set<types.KeyboardModifier>): number {
// From Source/WebKit/Shared/WebEvent.h

View File

@ -15,12 +15,12 @@
* limitations under the License.
*/
import * as frames from '../frames';
import * as network from '../network';
import * as types from '../types';
import * as frames from '../../frames';
import * as network from '../../network';
import * as types from '../../types';
import { Protocol } from './protocol';
import { WKSession } from './wkConnection';
import { assert, headersObjectToArray, headersArrayToObject } from '../utils/utils';
import { assert, headersObjectToArray, headersArrayToObject } from '../../utils/utils';
const errorReasons: { [reason: string]: Protocol.Network.ResourceErrorType } = {
'aborted': 'Cancellation',

View File

@ -15,29 +15,29 @@
* limitations under the License.
*/
import { Screencast, BrowserContext } from '../browserContext';
import * as frames from '../frames';
import { helper, RegisteredListener } from '../helper';
import * as dom from '../dom';
import * as network from '../network';
import { Screencast, BrowserContext } from '../../browserContext';
import * as frames from '../../frames';
import { helper, RegisteredListener } from '../../helper';
import * as dom from '../../dom';
import * as network from '../../network';
import { WKSession } from './wkConnection';
import { WKExecutionContext } from './wkExecutionContext';
import { WKInterceptableRequest } from './wkInterceptableRequest';
import { WKWorkers } from './wkWorkers';
import { Page, PageDelegate, PageBinding } from '../page';
import { Page, PageDelegate, PageBinding } from '../../page';
import { Protocol } from './protocol';
import * as dialog from '../dialog';
import * as dialog from '../../dialog';
import { RawMouseImpl, RawKeyboardImpl } from './wkInput';
import * as types from '../types';
import * as accessibility from '../accessibility';
import * as types from '../../types';
import * as accessibility from '../../accessibility';
import { getAccessibilityTree } from './wkAccessibility';
import { WKProvisionalPage } from './wkProvisionalPage';
import { WKBrowserContext } from './wkBrowser';
import { selectors } from '../selectors';
import { selectors } from '../../selectors';
import * as jpeg from 'jpeg-js';
import * as png from 'pngjs';
import { JSHandle } from '../javascript';
import { assert, debugAssert, headersArrayToObject } from '../utils/utils';
import { JSHandle } from '../../javascript';
import { assert, debugAssert, headersArrayToObject } from '../../utils/utils';
const UTILITY_WORLD_NAME = '__playwright_utility_world__';
const BINDING_CALL_MESSAGE = '__playwright_binding_call__';

View File

@ -16,9 +16,9 @@
import { WKSession } from './wkConnection';
import { WKPage } from './wkPage';
import { RegisteredListener, helper } from '../helper';
import { RegisteredListener, helper } from '../../helper';
import { Protocol } from './protocol';
import { assert } from '../utils/utils';
import { assert } from '../../utils/utils';
export class WKProvisionalPage {
readonly _session: WKSession;

View File

@ -14,12 +14,12 @@
* limitations under the License.
*/
import { helper, RegisteredListener } from '../helper';
import { Page, Worker } from '../page';
import { helper, RegisteredListener } from '../../helper';
import { Page, Worker } from '../../page';
import { Protocol } from './protocol';
import { WKSession } from './wkConnection';
import { WKExecutionContext } from './wkExecutionContext';
import * as types from '../types';
import * as types from '../../types';
export class WKWorkers {
private _sessionListeners: RegisteredListener[] = [];

View File

@ -75,6 +75,8 @@ const DEPS = new Map([
['src/protocol/', ['src/protocol/', 'src/utils/']],
['src/install/', ['src/install/', 'src/utils/']],
['src/server/chromium/', ['src/server/chromium/', 'src/utils/', 'src/', 'src/common/', 'src/server/']],
['src/server/electron/', ['src/server/electron/', 'src/server/chromium/', 'src/utils/', 'src/', 'src/server/']],
['src/server/webkit/', ['src/server/webkit/', 'src/utils/', 'src/', 'src/common/', 'src/server/']],
['src/client/', ['src/client/', 'src/utils/', 'src/protocol/', 'src/server/chromium/protocol.ts']],
]);

View File

@ -29,7 +29,7 @@ async function generateChromiumProtocol(executablePath) {
}
async function generateWebKitProtocol(folderPath) {
const outputPath = path.join(__dirname, '..', '..', 'src', 'webkit', 'protocol.ts');
const outputPath = path.join(__dirname, '..', '..', 'src', 'server', 'webkit', 'protocol.ts');
const json = JSON.parse(await fs.promises.readFile(path.join(folderPath, '..', 'protocol.json'), 'utf8'));
await fs.promises.writeFile(outputPath, jsonToTS({domains: json}));
console.log(`Wrote protocol.ts for WebKit to ${path.relative(process.cwd(), outputPath)}`);