diff --git a/src/install/browserFetcher.ts b/src/install/browserFetcher.ts index 67157c0997..dd38acb1f7 100644 --- a/src/install/browserFetcher.ts +++ b/src/install/browserFetcher.ts @@ -24,8 +24,8 @@ import { getProxyForUrl } from 'proxy-from-env'; import * as URL from 'url'; import * as util from 'util'; import { assert, getFromENV } from '../utils/utils'; -import * as browserPaths from './browserPaths'; -import { BrowserName, BrowserPlatform, BrowserDescriptor } from './browserPaths'; +import * as browserPaths from '../utils/browserPaths'; +import { BrowserName, BrowserPlatform, BrowserDescriptor } from '../utils/browserPaths'; // `https-proxy-agent` v5 is written in Typescript and exposes generated types. // However, as of June 2020, its types are generated with tsconfig that enables diff --git a/src/install/installer.ts b/src/install/installer.ts index 0440a9cf16..23031e566c 100644 --- a/src/install/installer.ts +++ b/src/install/installer.ts @@ -19,7 +19,7 @@ import * as fs from 'fs'; import * as path from 'path'; import * as util from 'util'; import * as removeFolder from 'rimraf'; -import * as browserPaths from './browserPaths'; +import * as browserPaths from '../utils/browserPaths'; import * as browserFetcher from './browserFetcher'; import { getFromENV } from '../utils/utils'; diff --git a/src/server/browserType.ts b/src/server/browserType.ts index a9b8c3edf8..88993a29dd 100644 --- a/src/server/browserType.ts +++ b/src/server/browserType.ts @@ -19,7 +19,7 @@ import * as os from 'os'; import * as path from 'path'; import * as util from 'util'; import { BrowserContext, verifyProxySettings, validateBrowserContextOptions } from '../browserContext'; -import * as browserPaths from '../install/browserPaths'; +import * as browserPaths from '../utils/browserPaths'; import { ConnectionTransport, WebSocketTransport } from '../transport'; import { BrowserOptions, Browser, BrowserProcess } from '../browser'; import { launchProcess, Env, waitForLine, envArrayToObject } from './processLauncher'; diff --git a/src/server/chromium/chromium.ts b/src/server/chromium/chromium.ts index 12289c70ac..b68c1e92ce 100644 --- a/src/server/chromium/chromium.ts +++ b/src/server/chromium/chromium.ts @@ -23,7 +23,7 @@ import { kBrowserCloseMessageId } from './crConnection'; import { rewriteErrorMessage } from '../../utils/stackTrace'; import { BrowserTypeBase } from '../browserType'; import { ConnectionTransport, ProtocolRequest } from '../../transport'; -import type { BrowserDescriptor } from '../../install/browserPaths'; +import type { BrowserDescriptor } from '../../utils/browserPaths'; import { CRDevTools } from './crDevTools'; import { BrowserOptions } from '../../browser'; import * as types from '../../types'; diff --git a/src/server/firefox.ts b/src/server/firefox.ts index 5f77dd8e57..4e4cb96d14 100644 --- a/src/server/firefox.ts +++ b/src/server/firefox.ts @@ -24,7 +24,7 @@ import { BrowserTypeBase } from './browserType'; import { Env } from './processLauncher'; import { ConnectionTransport } from '../transport'; import { BrowserOptions } from '../browser'; -import { BrowserDescriptor } from '../install/browserPaths'; +import { BrowserDescriptor } from '../utils/browserPaths'; import * as types from '../types'; export class Firefox extends BrowserTypeBase { diff --git a/src/server/playwright.ts b/src/server/playwright.ts index b2b52d3bbe..2aafdd7e95 100644 --- a/src/server/playwright.ts +++ b/src/server/playwright.ts @@ -18,7 +18,7 @@ import { Chromium } from './chromium/chromium'; import { WebKit } from './webkit'; import { Firefox } from './firefox'; import { selectors } from '../selectors'; -import * as browserPaths from '../install/browserPaths'; +import * as browserPaths from '../utils/browserPaths'; export class Playwright { readonly selectors = selectors; diff --git a/src/server/validateDependencies.ts b/src/server/validateDependencies.ts index fd46f45817..687f426b96 100644 --- a/src/server/validateDependencies.ts +++ b/src/server/validateDependencies.ts @@ -19,7 +19,7 @@ import * as path from 'path'; import * as os from 'os'; import { spawn } from 'child_process'; import { getUbuntuVersion } from '../utils/ubuntuVersion'; -import { linuxLddDirectories, windowsExeAndDllDirectories, BrowserDescriptor } from '../install/browserPaths.js'; +import { linuxLddDirectories, windowsExeAndDllDirectories, BrowserDescriptor } from '../utils/browserPaths.js'; const accessAsync = util.promisify(fs.access.bind(fs)); const checkExecutable = (filePath: string) => accessAsync(filePath, fs.constants.X_OK).then(() => true).catch(e => false); diff --git a/src/server/webkit.ts b/src/server/webkit.ts index 2353fa724f..7c3a27259c 100644 --- a/src/server/webkit.ts +++ b/src/server/webkit.ts @@ -22,7 +22,7 @@ import { kBrowserCloseMessageId } from '../webkit/wkConnection'; import { BrowserTypeBase } from './browserType'; import { ConnectionTransport } from '../transport'; import { BrowserOptions } from '../browser'; -import { BrowserDescriptor } from '../install/browserPaths'; +import { BrowserDescriptor } from '../utils/browserPaths'; import * as types from '../types'; export class WebKit extends BrowserTypeBase { diff --git a/src/install/browserPaths.ts b/src/utils/browserPaths.ts similarity index 98% rename from src/install/browserPaths.ts rename to src/utils/browserPaths.ts index 94b6dc49f8..c965bf3da1 100644 --- a/src/install/browserPaths.ts +++ b/src/utils/browserPaths.ts @@ -18,8 +18,8 @@ import { execSync } from 'child_process'; import * as os from 'os'; import * as path from 'path'; -import { getUbuntuVersionSync } from '../utils/ubuntuVersion'; -import { getFromENV } from '../utils/utils'; +import { getUbuntuVersionSync } from './ubuntuVersion'; +import { getFromENV } from './utils'; export type BrowserName = 'chromium'|'webkit'|'firefox'; export type BrowserPlatform = 'win32'|'win64'|'mac10.13'|'mac10.14'|'mac10.15'|'ubuntu18.04'|'ubuntu20.04'; diff --git a/utils/check_deps.js b/utils/check_deps.js index b75b2f6547..dd3e174d47 100644 --- a/utils/check_deps.js +++ b/utils/check_deps.js @@ -74,6 +74,7 @@ const DEPS = new Map([ ['src/common/', ['src/common/']], ['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/client/', ['src/client/', 'src/utils/', 'src/protocol/', 'src/server/chromium/protocol.ts']], ]); diff --git a/utils/linux-browser-dependencies/inside_docker/list_dependencies.js b/utils/linux-browser-dependencies/inside_docker/list_dependencies.js index 62ac57c6fd..d4e5438c5e 100644 --- a/utils/linux-browser-dependencies/inside_docker/list_dependencies.js +++ b/utils/linux-browser-dependencies/inside_docker/list_dependencies.js @@ -4,7 +4,7 @@ const fs = require('fs'); const util = require('util'); const path = require('path'); const {spawn} = require('child_process'); -const browserPaths = require('playwright/lib/install/browserPaths.js'); +const browserPaths = require('playwright/lib/utils/browserPaths.js'); const readdirAsync = util.promisify(fs.readdir.bind(fs)); const readFileAsync = util.promisify(fs.readFile.bind(fs)); diff --git a/utils/roll_browser.js b/utils/roll_browser.js index f8b0230b0a..4b09a04818 100755 --- a/utils/roll_browser.js +++ b/utils/roll_browser.js @@ -74,7 +74,7 @@ Example: // 4. Generate types. console.log('\nGenerating protocol types...'); const browser = { name: browserName, revision }; - const browserPaths = require('../lib/install/browserPaths'); + const browserPaths = require('../lib/utils/browserPaths'); const browserDir = browserPaths.browserDirectory(browserPaths.browsersPath(ROOT_PATH), browser); const executablePath = browserPaths.executablePath(browserDir, browser); await protocolGenerator.generateProtocol(browserName, executablePath).catch(console.warn);