From d8f637c239552e4319cdb7c086075eb006f3424e Mon Sep 17 00:00:00 2001 From: Joel Einbinder Date: Thu, 11 Feb 2021 06:36:15 -0800 Subject: [PATCH] chore(typescript): enable esModuleInterop (#5409) --- src/browserServerImpl.ts | 2 +- src/cli/cli.ts | 8 ++++---- src/cli/driver.ts | 4 ++-- src/cli/traceViewer/screenshotGenerator.ts | 4 ++-- src/cli/traceViewer/snapshotServer.ts | 4 ++-- src/cli/traceViewer/traceServer.ts | 4 ++-- src/cli/traceViewer/traceViewer.ts | 4 ++-- src/client/android.ts | 2 +- src/client/browserContext.ts | 2 +- src/client/browserType.ts | 6 +++--- src/client/clientHelper.ts | 2 +- src/client/download.ts | 2 +- src/client/elementHandle.ts | 4 ++-- src/client/frame.ts | 2 +- src/client/network.ts | 2 +- src/client/page.ts | 4 ++-- src/client/video.ts | 2 +- src/dispatchers/downloadDispatcher.ts | 2 +- src/install/browserFetcher.ts | 10 +++++----- src/install/installer.ts | 10 +++++----- src/remote/playwrightClient.ts | 2 +- src/remote/playwrightServer.ts | 4 ++-- src/server/android/android.ts | 4 ++-- src/server/android/backendAdb.ts | 4 ++-- src/server/browserContext.ts | 2 +- src/server/browserType.ts | 4 ++-- src/server/chromium/chromium.ts | 2 +- src/server/chromium/crDevTools.ts | 2 +- src/server/chromium/crPage.ts | 2 +- src/server/chromium/crProtocolHelper.ts | 2 +- src/server/download.ts | 4 ++-- src/server/firefox/firefox.ts | 4 ++-- src/server/helper.ts | 4 ++-- src/server/playwright.ts | 2 +- src/server/supplements/har/harTracer.ts | 2 +- src/server/supplements/recorder/outputs.ts | 2 +- src/server/supplements/recorder/recorderApp.ts | 4 ++-- src/server/transport.ts | 2 +- src/server/validateDependencies.ts | 4 ++-- src/server/webkit/webkit.ts | 2 +- src/server/webkit/wkPage.ts | 2 +- src/trace/tracer.ts | 4 ++-- src/utils/binaryPaths.ts | 4 ++-- src/utils/debugLogger.ts | 4 ++-- src/utils/registry.ts | 4 ++-- src/utils/stackTrace.ts | 4 ++-- src/utils/ubuntuVersion.ts | 2 +- src/utils/utils.ts | 4 ++-- test/android/device.spec.ts | 2 +- test/browsercontext-storage-state.spec.ts | 2 +- test/browsertype-connect.spec.ts | 2 +- test/cli/cli-codegen-csharp.spec.ts | 4 ++-- test/cli/cli-codegen-javascript.spec.ts | 4 ++-- test/cli/cli-codegen-python-async.spec.ts | 4 ++-- test/cli/cli-codegen-python.spec.ts | 4 ++-- test/cli/cli.fixtures.ts | 2 +- test/har.spec.ts | 2 +- test/trace.spec.ts | 6 +++--- tsconfig.json | 1 + 59 files changed, 100 insertions(+), 99 deletions(-) diff --git a/src/browserServerImpl.ts b/src/browserServerImpl.ts index aefbe3da40..23ff0be8ed 100644 --- a/src/browserServerImpl.ts +++ b/src/browserServerImpl.ts @@ -17,7 +17,7 @@ import { LaunchServerOptions, Logger } from './client/types'; import { BrowserType } from './server/browserType'; import * as ws from 'ws'; -import * as fs from 'fs'; +import fs from 'fs'; import { Browser } from './server/browser'; import { ChildProcess } from 'child_process'; import { EventEmitter } from 'ws'; diff --git a/src/cli/cli.ts b/src/cli/cli.ts index a80cda797b..ec37c76239 100755 --- a/src/cli/cli.ts +++ b/src/cli/cli.ts @@ -18,10 +18,10 @@ /* eslint-disable no-console */ -import * as path from 'path'; -import * as program from 'commander'; -import * as os from 'os'; -import * as fs from 'fs'; +import path from 'path'; +import program from 'commander'; +import os from 'os'; +import fs from 'fs'; import { runServer, printApiJson, installBrowsers } from './driver'; import { showTraceViewer } from './traceViewer/traceViewer'; import * as playwright from '../..'; diff --git a/src/cli/driver.ts b/src/cli/driver.ts index c623497bea..c3d051dd77 100644 --- a/src/cli/driver.ts +++ b/src/cli/driver.ts @@ -16,8 +16,8 @@ /* eslint-disable no-console */ -import * as fs from 'fs'; -import * as path from 'path'; +import fs from 'fs'; +import path from 'path'; import { DispatcherConnection } from '../dispatchers/dispatcher'; import { PlaywrightDispatcher } from '../dispatchers/playwrightDispatcher'; import { installBrowsersWithProgressBar } from '../install/installer'; diff --git a/src/cli/traceViewer/screenshotGenerator.ts b/src/cli/traceViewer/screenshotGenerator.ts index e5c1857cf3..c940e449ec 100644 --- a/src/cli/traceViewer/screenshotGenerator.ts +++ b/src/cli/traceViewer/screenshotGenerator.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import * as fs from 'fs'; -import * as path from 'path'; +import fs from 'fs'; +import path from 'path'; import * as playwright from '../../..'; import * as util from 'util'; import { actionById, ActionEntry, ContextEntry, TraceModel } from './traceModel'; diff --git a/src/cli/traceViewer/snapshotServer.ts b/src/cli/traceViewer/snapshotServer.ts index a6a5d5dd11..74dc8d0955 100644 --- a/src/cli/traceViewer/snapshotServer.ts +++ b/src/cli/traceViewer/snapshotServer.ts @@ -15,8 +15,8 @@ */ import * as http from 'http'; -import * as fs from 'fs'; -import * as path from 'path'; +import fs from 'fs'; +import path from 'path'; import type { TraceModel, trace, ContextEntry } from './traceModel'; import { TraceServer } from './traceServer'; import { NodeSnapshot } from '../../trace/traceTypes'; diff --git a/src/cli/traceViewer/traceServer.ts b/src/cli/traceViewer/traceServer.ts index bf6715a563..33fd25b67b 100644 --- a/src/cli/traceViewer/traceServer.ts +++ b/src/cli/traceViewer/traceServer.ts @@ -15,8 +15,8 @@ */ import * as http from 'http'; -import * as fs from 'fs'; -import * as path from 'path'; +import fs from 'fs'; +import path from 'path'; import type { TraceModel } from './traceModel'; export type ServerRouteHandler = (request: http.IncomingMessage, response: http.ServerResponse) => boolean; diff --git a/src/cli/traceViewer/traceViewer.ts b/src/cli/traceViewer/traceViewer.ts index 8bde51d5aa..dbd62d0ff5 100644 --- a/src/cli/traceViewer/traceViewer.ts +++ b/src/cli/traceViewer/traceViewer.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import * as fs from 'fs'; -import * as path from 'path'; +import fs from 'fs'; +import path from 'path'; import * as playwright from '../../..'; import * as util from 'util'; import { ScreenshotGenerator } from './screenshotGenerator'; diff --git a/src/client/android.ts b/src/client/android.ts index 26f784dde8..6b15a19584 100644 --- a/src/client/android.ts +++ b/src/client/android.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as fs from 'fs'; +import fs from 'fs'; import * as util from 'util'; import { isString } from '../utils/utils'; import * as channels from '../protocol/channels'; diff --git a/src/client/browserContext.ts b/src/client/browserContext.ts index 91a3ac44e9..429c45a778 100644 --- a/src/client/browserContext.ts +++ b/src/client/browserContext.ts @@ -19,7 +19,7 @@ import { Page, BindingCall } from './page'; import * as network from './network'; import * as channels from '../protocol/channels'; import * as util from 'util'; -import * as fs from 'fs'; +import fs from 'fs'; import { ChannelOwner } from './channelOwner'; import { deprecate, evaluationScript, urlMatches } from './clientHelper'; import { Browser } from './browser'; diff --git a/src/client/browserType.ts b/src/client/browserType.ts index 33eb6bc4fa..7db2ccc799 100644 --- a/src/client/browserType.ts +++ b/src/client/browserType.ts @@ -19,9 +19,9 @@ import { Browser } from './browser'; import { BrowserContext, prepareBrowserContextOptions } from './browserContext'; import { ChannelOwner } from './channelOwner'; import { LaunchOptions, LaunchServerOptions, ConnectOptions, LaunchPersistentContextOptions } from './types'; -import * as WebSocket from 'ws'; -import * as path from 'path'; -import * as fs from 'fs'; +import WebSocket from 'ws'; +import path from 'path'; +import fs from 'fs'; import { Connection } from './connection'; import { serializeError } from '../protocol/serializers'; import { Events } from './events'; diff --git a/src/client/clientHelper.ts b/src/client/clientHelper.ts index f4e464eef4..48e80a72f4 100644 --- a/src/client/clientHelper.ts +++ b/src/client/clientHelper.ts @@ -16,7 +16,7 @@ */ import * as types from './types'; -import * as fs from 'fs'; +import fs from 'fs'; import * as util from 'util'; import { isString, isRegExp } from '../utils/utils'; diff --git a/src/client/download.ts b/src/client/download.ts index 896fd1369f..ed9f9995a1 100644 --- a/src/client/download.ts +++ b/src/client/download.ts @@ -20,7 +20,7 @@ import { Readable } from 'stream'; import { Stream } from './stream'; import { Browser } from './browser'; import { BrowserContext } from './browserContext'; -import * as fs from 'fs'; +import fs from 'fs'; import { mkdirIfNeeded } from '../utils/utils'; import * as api from '../../types/types'; diff --git a/src/client/elementHandle.ts b/src/client/elementHandle.ts index 31f2cccdf4..5d82b6b5ad 100644 --- a/src/client/elementHandle.ts +++ b/src/client/elementHandle.ts @@ -19,9 +19,9 @@ import { Frame } from './frame'; import { JSHandle, serializeArgument, parseResult } from './jsHandle'; import { ChannelOwner } from './channelOwner'; import { SelectOption, FilePayload, Rect, SelectOptionOptions } from './types'; -import * as fs from 'fs'; +import fs from 'fs'; import * as mime from 'mime'; -import * as path from 'path'; +import path from 'path'; import * as util from 'util'; import { assert, isString, mkdirIfNeeded } from '../utils/utils'; import * as api from '../../types/types'; diff --git a/src/client/frame.ts b/src/client/frame.ts index 156e4e7537..5b74d593a7 100644 --- a/src/client/frame.ts +++ b/src/client/frame.ts @@ -20,7 +20,7 @@ import * as channels from '../protocol/channels'; import { ChannelOwner } from './channelOwner'; import { ElementHandle, convertSelectOptionValues, convertInputFiles } from './elementHandle'; import { assertMaxArguments, JSHandle, serializeArgument, parseResult } from './jsHandle'; -import * as fs from 'fs'; +import fs from 'fs'; import * as network from './network'; import * as util from 'util'; import { Page } from './page'; diff --git a/src/client/network.ts b/src/client/network.ts index 7152326332..c1378d7913 100644 --- a/src/client/network.ts +++ b/src/client/network.ts @@ -19,7 +19,7 @@ import * as channels from '../protocol/channels'; import { ChannelOwner } from './channelOwner'; import { Frame } from './frame'; import { Headers, WaitForEventOptions } from './types'; -import * as fs from 'fs'; +import fs from 'fs'; import * as mime from 'mime'; import * as util from 'util'; import { isString, headersObjectToArray, headersArrayToObject } from '../utils/utils'; diff --git a/src/client/page.ts b/src/client/page.ts index 97d9ec4724..948a8da3e2 100644 --- a/src/client/page.ts +++ b/src/client/page.ts @@ -38,8 +38,8 @@ import { ChromiumCoverage } from './chromiumCoverage'; import { Waiter } from './waiter'; import * as api from '../../types/types'; import * as structs from '../../types/structs'; -import * as fs from 'fs'; -import * as path from 'path'; +import fs from 'fs'; +import path from 'path'; import * as util from 'util'; import { Size, URLMatch, Headers, LifecycleEvent, WaitForEventOptions, SelectOption, SelectOptionOptions, FilePayload, WaitForFunctionOptions } from './types'; import { evaluationScript, urlMatches } from './clientHelper'; diff --git a/src/client/video.ts b/src/client/video.ts index 4ac2826b6a..a80800ef21 100644 --- a/src/client/video.ts +++ b/src/client/video.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as path from 'path'; +import path from 'path'; import { Page } from './page'; import * as api from '../../types/types'; diff --git a/src/dispatchers/downloadDispatcher.ts b/src/dispatchers/downloadDispatcher.ts index 4e0e0d5e9f..1e7ba787a8 100644 --- a/src/dispatchers/downloadDispatcher.ts +++ b/src/dispatchers/downloadDispatcher.ts @@ -18,7 +18,7 @@ import { Download } from '../server/download'; import * as channels from '../protocol/channels'; import { Dispatcher, DispatcherScope } from './dispatcher'; import { StreamDispatcher } from './streamDispatcher'; -import * as fs from 'fs'; +import fs from 'fs'; import * as util from 'util'; import { mkdirIfNeeded } from '../utils/utils'; diff --git a/src/install/browserFetcher.ts b/src/install/browserFetcher.ts index c6e2d2ab99..84dd279265 100644 --- a/src/install/browserFetcher.ts +++ b/src/install/browserFetcher.ts @@ -15,11 +15,11 @@ * limitations under the License. */ -import * as extract from 'extract-zip'; -import * as fs from 'fs'; -import * as os from 'os'; -import * as path from 'path'; -import * as ProgressBar from 'progress'; +import extract from 'extract-zip'; +import fs from 'fs'; +import os from 'os'; +import path from 'path'; +import ProgressBar from 'progress'; import { getProxyForUrl } from 'proxy-from-env'; import * as URL from 'url'; import * as util from 'util'; diff --git a/src/install/installer.ts b/src/install/installer.ts index 6dbdcc4aa9..1f3b5bc924 100644 --- a/src/install/installer.ts +++ b/src/install/installer.ts @@ -14,11 +14,11 @@ * limitations under the License. */ -import * as fs from 'fs'; -import * as path from 'path'; -import * as util from 'util'; -import * as removeFolder from 'rimraf'; -import * as lockfile from 'proper-lockfile'; +import fs from 'fs'; +import path from 'path'; +import util from 'util'; +import removeFolder from 'rimraf'; +import lockfile from 'proper-lockfile'; import {Registry, allBrowserNames, isBrowserDirectory, BrowserName, registryDirectory} from '../utils/registry'; import * as browserFetcher from './browserFetcher'; import { getAsBooleanFromENV, calculateSha1 } from '../utils/utils'; diff --git a/src/remote/playwrightClient.ts b/src/remote/playwrightClient.ts index 6a380f5d35..e56d7a6227 100644 --- a/src/remote/playwrightClient.ts +++ b/src/remote/playwrightClient.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as WebSocket from 'ws'; +import WebSocket from 'ws'; import { Connection } from '../client/connection'; import { Playwright } from '../client/playwright'; diff --git a/src/remote/playwrightServer.ts b/src/remote/playwrightServer.ts index fc0a3d93b6..f0b44c289b 100644 --- a/src/remote/playwrightServer.ts +++ b/src/remote/playwrightServer.ts @@ -14,9 +14,9 @@ * limitations under the License. */ -import * as debug from 'debug'; +import debug from 'debug'; import * as http from 'http'; -import * as WebSocket from 'ws'; +import WebSocket from 'ws'; import { DispatcherConnection } from '../dispatchers/dispatcher'; import { PlaywrightDispatcher } from '../dispatchers/playwrightDispatcher'; import { createPlaywright } from '../server/playwright'; diff --git a/src/server/android/android.ts b/src/server/android/android.ts index 3306a5a170..d3402edeeb 100644 --- a/src/server/android/android.ts +++ b/src/server/android/android.ts @@ -14,10 +14,10 @@ * limitations under the License. */ -import * as debug from 'debug'; +import debug from 'debug'; import * as types from '../types'; import { EventEmitter } from 'events'; -import * as fs from 'fs'; +import fs from 'fs'; import * as stream from 'stream'; import * as util from 'util'; import * as ws from 'ws'; diff --git a/src/server/android/backendAdb.ts b/src/server/android/backendAdb.ts index 4e7f3b8a52..2ce9915af0 100644 --- a/src/server/android/backendAdb.ts +++ b/src/server/android/backendAdb.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import * as assert from 'assert'; -import * as debug from 'debug'; +import assert from 'assert'; +import debug from 'debug'; import * as net from 'net'; import { EventEmitter } from 'events'; import { Backend, DeviceBackend, SocketBackend } from './android'; diff --git a/src/server/browserContext.ts b/src/server/browserContext.ts index 26b184050c..62dc2edbd7 100644 --- a/src/server/browserContext.ts +++ b/src/server/browserContext.ts @@ -26,7 +26,7 @@ import { Page, PageBinding, PageDelegate } from './page'; import { Progress } from './progress'; import { Selectors, serverSelectors } from './selectors'; import * as types from './types'; -import * as path from 'path'; +import path from 'path'; import { CallMetadata, SdkObject } from './instrumentation'; export class Video { diff --git a/src/server/browserType.ts b/src/server/browserType.ts index 52caba7582..83502d2fa4 100644 --- a/src/server/browserType.ts +++ b/src/server/browserType.ts @@ -14,9 +14,9 @@ * limitations under the License. */ -import * as fs from 'fs'; +import fs from 'fs'; import * as os from 'os'; -import * as path from 'path'; +import path from 'path'; import * as util from 'util'; import { BrowserContext, normalizeProxySettings, validateBrowserContextOptions } from './browserContext'; import * as registry from '../utils/registry'; diff --git a/src/server/chromium/chromium.ts b/src/server/chromium/chromium.ts index 49dddfa991..e2c388d4fc 100644 --- a/src/server/chromium/chromium.ts +++ b/src/server/chromium/chromium.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import * as path from 'path'; +import path from 'path'; import { CRBrowser } from './crBrowser'; import { Env } from '../processLauncher'; import { kBrowserCloseMessageId } from './crConnection'; diff --git a/src/server/chromium/crDevTools.ts b/src/server/chromium/crDevTools.ts index 6e9445cd88..cec6124160 100644 --- a/src/server/chromium/crDevTools.ts +++ b/src/server/chromium/crDevTools.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as fs from 'fs'; +import fs from 'fs'; import * as util from 'util'; import { CRSession } from './crConnection'; diff --git a/src/server/chromium/crPage.ts b/src/server/chromium/crPage.ts index e3a342c4ac..3cd841bb82 100644 --- a/src/server/chromium/crPage.ts +++ b/src/server/chromium/crPage.ts @@ -27,7 +27,7 @@ import { Protocol } from './protocol'; import { toConsoleMessageLocation, exceptionToError, releaseObject } from './crProtocolHelper'; import * as dialog from '../dialog'; import { PageDelegate } from '../page'; -import * as path from 'path'; +import path from 'path'; import { RawMouseImpl, RawKeyboardImpl, RawTouchscreenImpl } from './crInput'; import { getAccessibilityTree } from './crAccessibility'; import { CRCoverage } from './crCoverage'; diff --git a/src/server/chromium/crProtocolHelper.ts b/src/server/chromium/crProtocolHelper.ts index 66fed49638..2f544b5910 100644 --- a/src/server/chromium/crProtocolHelper.ts +++ b/src/server/chromium/crProtocolHelper.ts @@ -17,7 +17,7 @@ import { CRSession } from './crConnection'; import { Protocol } from './protocol'; -import * as fs from 'fs'; +import fs from 'fs'; import * as util from 'util'; import * as types from '../types'; import { mkdirIfNeeded } from '../../utils/utils'; diff --git a/src/server/download.ts b/src/server/download.ts index 687283bce1..98c8257215 100644 --- a/src/server/download.ts +++ b/src/server/download.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import * as path from 'path'; -import * as fs from 'fs'; +import path from 'path'; +import fs from 'fs'; import * as util from 'util'; import { Page } from './page'; import { assert } from '../utils/utils'; diff --git a/src/server/firefox/firefox.ts b/src/server/firefox/firefox.ts index 37b8801fa8..dc6b5b583a 100644 --- a/src/server/firefox/firefox.ts +++ b/src/server/firefox/firefox.ts @@ -16,8 +16,8 @@ */ import * as os from 'os'; -import * as fs from 'fs'; -import * as path from 'path'; +import fs from 'fs'; +import path from 'path'; import { FFBrowser } from './ffBrowser'; import { kBrowserCloseMessageId } from './ffConnection'; import { BrowserType } from '../browserType'; diff --git a/src/server/helper.ts b/src/server/helper.ts index c34e147724..4012a759d5 100644 --- a/src/server/helper.ts +++ b/src/server/helper.ts @@ -16,8 +16,8 @@ */ import { EventEmitter } from 'events'; -import * as removeFolder from 'rimraf'; -import * as util from 'util'; +import removeFolder from 'rimraf'; +import util from 'util'; import * as types from './types'; import { Progress } from './progress'; import { debugLogger } from '../utils/debugLogger'; diff --git a/src/server/playwright.ts b/src/server/playwright.ts index 33a7d633f9..436a55b1d0 100644 --- a/src/server/playwright.ts +++ b/src/server/playwright.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as path from 'path'; +import path from 'path'; import { Tracer } from '../trace/tracer'; import { Android } from './android/android'; import { AdbBackend } from './android/backendAdb'; diff --git a/src/server/supplements/har/harTracer.ts b/src/server/supplements/har/harTracer.ts index 40f5671a4c..5a5391ee4d 100644 --- a/src/server/supplements/har/harTracer.ts +++ b/src/server/supplements/har/harTracer.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as fs from 'fs'; +import fs from 'fs'; import * as util from 'util'; import { BrowserContext } from '../../browserContext'; import { helper } from '../../helper'; diff --git a/src/server/supplements/recorder/outputs.ts b/src/server/supplements/recorder/outputs.ts index 93acb2c878..0250d738b9 100644 --- a/src/server/supplements/recorder/outputs.ts +++ b/src/server/supplements/recorder/outputs.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as fs from 'fs'; +import fs from 'fs'; import * as querystring from 'querystring'; import * as hljs from '../../../third_party/highlightjs/highlightjs'; diff --git a/src/server/supplements/recorder/recorderApp.ts b/src/server/supplements/recorder/recorderApp.ts index 363a653b16..e9d3b828ff 100644 --- a/src/server/supplements/recorder/recorderApp.ts +++ b/src/server/supplements/recorder/recorderApp.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import * as fs from 'fs'; -import * as path from 'path'; +import fs from 'fs'; +import path from 'path'; import * as util from 'util'; import { CRPage } from '../../chromium/crPage'; import { Page } from '../../page'; diff --git a/src/server/transport.ts b/src/server/transport.ts index de35f73863..4ff282feec 100644 --- a/src/server/transport.ts +++ b/src/server/transport.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import * as WebSocket from 'ws'; +import WebSocket from 'ws'; import { Progress } from './progress'; import { makeWaitForNextTask } from '../utils/utils'; diff --git a/src/server/validateDependencies.ts b/src/server/validateDependencies.ts index 8e6017c810..b48e32305f 100644 --- a/src/server/validateDependencies.ts +++ b/src/server/validateDependencies.ts @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import * as fs from 'fs'; +import fs from 'fs'; import * as util from 'util'; -import * as path from 'path'; +import path from 'path'; import * as os from 'os'; import { spawn } from 'child_process'; import { getUbuntuVersion } from '../utils/ubuntuVersion'; diff --git a/src/server/webkit/webkit.ts b/src/server/webkit/webkit.ts index d192038e3e..689edf911b 100644 --- a/src/server/webkit/webkit.ts +++ b/src/server/webkit/webkit.ts @@ -17,7 +17,7 @@ import { WKBrowser } from '../webkit/wkBrowser'; import { Env } from '../processLauncher'; -import * as path from 'path'; +import path from 'path'; import { kBrowserCloseMessageId } from './wkConnection'; import { BrowserType } from '../browserType'; import { ConnectionTransport } from '../transport'; diff --git a/src/server/webkit/wkPage.ts b/src/server/webkit/wkPage.ts index fccab1846b..b269a5b609 100644 --- a/src/server/webkit/wkPage.ts +++ b/src/server/webkit/wkPage.ts @@ -16,7 +16,7 @@ */ import * as jpeg from 'jpeg-js'; -import * as path from 'path'; +import path from 'path'; import * as png from 'pngjs'; import { assert, createGuid, debugAssert, headersArrayToObject, headersObjectToArray } from '../../utils/utils'; import * as accessibility from '../accessibility'; diff --git a/src/trace/tracer.ts b/src/trace/tracer.ts index 0c6600756b..e267f6f6ce 100644 --- a/src/trace/tracer.ts +++ b/src/trace/tracer.ts @@ -17,9 +17,9 @@ import { BrowserContext, Video } from '../server/browserContext'; import type { SnapshotterResource as SnapshotterResource, SnapshotterBlob, SnapshotterDelegate } from './snapshotter'; import * as trace from './traceTypes'; -import * as path from 'path'; +import path from 'path'; import * as util from 'util'; -import * as fs from 'fs'; +import fs from 'fs'; import { createGuid, getFromENV, mkdirIfNeeded, monotonicTime } from '../utils/utils'; import { Page } from '../server/page'; import { Snapshotter } from './snapshotter'; diff --git a/src/utils/binaryPaths.ts b/src/utils/binaryPaths.ts index e4c7acf035..8f4f88582e 100644 --- a/src/utils/binaryPaths.ts +++ b/src/utils/binaryPaths.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import * as fs from 'fs'; -import * as path from 'path'; +import fs from 'fs'; +import path from 'path'; export function printDepsWindowsExecutable(): string | undefined { return pathToExecutable(['bin', 'PrintDeps.exe']); diff --git a/src/utils/debugLogger.ts b/src/utils/debugLogger.ts index 2579df63d1..a2485c982a 100644 --- a/src/utils/debugLogger.ts +++ b/src/utils/debugLogger.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import * as debug from 'debug'; -import * as fs from 'fs'; +import debug from 'debug'; +import fs from 'fs'; const debugLoggerColorMap = { 'api': 45, // cyan diff --git a/src/utils/registry.ts b/src/utils/registry.ts index b638af7138..86203e235e 100644 --- a/src/utils/registry.ts +++ b/src/utils/registry.ts @@ -16,9 +16,9 @@ */ import { execSync } from 'child_process'; -import * as fs from 'fs'; +import fs from 'fs'; import * as os from 'os'; -import * as path from 'path'; +import path from 'path'; import * as util from 'util'; import { getUbuntuVersionSync } from './ubuntuVersion'; import { assert, getFromENV } from './utils'; diff --git a/src/utils/stackTrace.ts b/src/utils/stackTrace.ts index 58757dc983..adcb539b4a 100644 --- a/src/utils/stackTrace.ts +++ b/src/utils/stackTrace.ts @@ -14,9 +14,9 @@ * limitations under the License. */ -import * as path from 'path'; +import path from 'path'; import { StackFrame } from '../common/types'; -const StackUtils = require('stack-utils'); +import StackUtils from 'stack-utils'; const stackUtils = new StackUtils(); diff --git a/src/utils/ubuntuVersion.ts b/src/utils/ubuntuVersion.ts index 967e912b41..4220f314cb 100644 --- a/src/utils/ubuntuVersion.ts +++ b/src/utils/ubuntuVersion.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import * as fs from 'fs'; +import fs from 'fs'; import * as os from 'os'; import * as util from 'util'; diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 160e55acf1..d268981d02 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import * as path from 'path'; -import * as fs from 'fs'; +import path from 'path'; +import fs from 'fs'; import * as util from 'util'; import * as crypto from 'crypto'; diff --git a/test/android/device.spec.ts b/test/android/device.spec.ts index 4b633923e9..27846a26e4 100644 --- a/test/android/device.spec.ts +++ b/test/android/device.spec.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as fs from 'fs'; +import fs from 'fs'; import { PNG } from 'pngjs'; import { folio } from './android.fixtures'; diff --git a/test/browsercontext-storage-state.spec.ts b/test/browsercontext-storage-state.spec.ts index 1d862184f1..735b4392df 100644 --- a/test/browsercontext-storage-state.spec.ts +++ b/test/browsercontext-storage-state.spec.ts @@ -16,7 +16,7 @@ */ import { it, expect } from './fixtures'; -import * as fs from 'fs'; +import fs from 'fs'; it('should capture local storage', async ({ context }) => { const page1 = await context.newPage(); diff --git a/test/browsertype-connect.spec.ts b/test/browsertype-connect.spec.ts index 04535f2bc5..ee8c07dfc4 100644 --- a/test/browsertype-connect.spec.ts +++ b/test/browsertype-connect.spec.ts @@ -16,7 +16,7 @@ */ import { folio } from './remoteServer.fixture'; -import * as fs from 'fs'; +import fs from 'fs'; const { it, expect, describe } = folio; describe('connect', (suite, { mode }) => { diff --git a/test/cli/cli-codegen-csharp.spec.ts b/test/cli/cli-codegen-csharp.spec.ts index a30d7fdcb2..b553652aec 100644 --- a/test/cli/cli-codegen-csharp.spec.ts +++ b/test/cli/cli-codegen-csharp.spec.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import * as path from 'path'; -import * as fs from 'fs'; +import path from 'path'; +import fs from 'fs'; import { folio } from './cli.fixtures'; const { it, expect } = folio; diff --git a/test/cli/cli-codegen-javascript.spec.ts b/test/cli/cli-codegen-javascript.spec.ts index e281f885d1..bef9c16bc1 100644 --- a/test/cli/cli-codegen-javascript.spec.ts +++ b/test/cli/cli-codegen-javascript.spec.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import * as fs from 'fs'; -import * as path from 'path'; +import fs from 'fs'; +import path from 'path'; import { folio } from './cli.fixtures'; const { it, expect } = folio; diff --git a/test/cli/cli-codegen-python-async.spec.ts b/test/cli/cli-codegen-python-async.spec.ts index c1eac595f0..a13d8beca7 100644 --- a/test/cli/cli-codegen-python-async.spec.ts +++ b/test/cli/cli-codegen-python-async.spec.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import * as fs from 'fs'; -import * as path from 'path'; +import fs from 'fs'; +import path from 'path'; import { folio } from './cli.fixtures'; const { it, expect } = folio; diff --git a/test/cli/cli-codegen-python.spec.ts b/test/cli/cli-codegen-python.spec.ts index 29dae3bea7..d7e0366af7 100644 --- a/test/cli/cli-codegen-python.spec.ts +++ b/test/cli/cli-codegen-python.spec.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import * as fs from 'fs'; -import * as path from 'path'; +import fs from 'fs'; +import path from 'path'; import { folio } from './cli.fixtures'; const { it, expect } = folio; diff --git a/test/cli/cli.fixtures.ts b/test/cli/cli.fixtures.ts index f87220543f..11f8fff53f 100644 --- a/test/cli/cli.fixtures.ts +++ b/test/cli/cli.fixtures.ts @@ -15,7 +15,7 @@ */ import * as http from 'http'; -import * as path from 'path'; +import path from 'path'; import { ChildProcess, spawn } from 'child_process'; import { folio as baseFolio } from '../fixtures'; import type { Page, BrowserType, Browser, BrowserContext } from '../..'; diff --git a/test/har.spec.ts b/test/har.spec.ts index b64fb3cd6b..1e807d7694 100644 --- a/test/har.spec.ts +++ b/test/har.spec.ts @@ -16,7 +16,7 @@ */ import { folio as baseFolio } from './fixtures'; -import * as fs from 'fs'; +import fs from 'fs'; import type * as har from '../src/server/supplements/har/har'; import type { BrowserContext, Page } from '../index'; diff --git a/test/trace.spec.ts b/test/trace.spec.ts index bde8973036..2eb6e08323 100644 --- a/test/trace.spec.ts +++ b/test/trace.spec.ts @@ -16,8 +16,8 @@ import { it, expect } from './fixtures'; import type * as trace from '../src/trace/traceTypes'; -import * as path from 'path'; -import * as fs from 'fs'; +import path from 'path'; +import fs from 'fs'; it('should record trace', (test, { browserName, platform }) => { test.fixme(); @@ -128,4 +128,4 @@ it('should record trace with a debugName', (test, { browserName, platform }) => const contextEvent = traceEvents.find(event => event.type === 'context-created') as trace.ContextCreatedTraceEvent; expect(contextEvent).toBeTruthy(); expect(contextEvent.debugName).toBe(debugName); -}); \ No newline at end of file +}); diff --git a/tsconfig.json b/tsconfig.json index 5f593d648c..d68748a701 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,6 +4,7 @@ "module": "commonjs", "lib": ["esnext", "dom", "DOM.Iterable"], "sourceMap": true, + "esModuleInterop": true, "rootDir": "./src", "outDir": "./lib", "strict": true,