Skip to content

Commit 4c8ba3e

Browse files
authored
chore: remove cli (#2976)
It will be a separate package instead.
1 parent 513899a commit 4c8ba3e

15 files changed

+7
-1143
lines changed

package-lock.json

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
"engines": {
99
"node": ">=10.15.0"
1010
},
11-
"bin": {
12-
"playwright": "lib/cli/index.js"
13-
},
1411
"scripts": {
1512
"ctest": "cross-env BROWSER=chromium node --unhandled-rejections=strict test/test.js",
1613
"ftest": "cross-env BROWSER=firefox node --unhandled-rejections=strict test/test.js",
@@ -42,7 +39,6 @@
4239
},
4340
"license": "Apache-2.0",
4441
"dependencies": {
45-
"commander": "^5.1.0",
4642
"debug": "^4.1.1",
4743
"extract-zip": "^2.0.0",
4844
"https-proxy-agent": "^5.0.0",

src/browserContext.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { Writable } from 'stream';
1918
import { isUnderTest, helper, deprecate} from './helper';
2019
import * as network from './network';
2120
import { Page, PageBinding } from './page';
@@ -69,7 +68,6 @@ export abstract class BrowserContextBase extends EventEmitter implements Browser
6968
readonly _downloads = new Set<Download>();
7069
readonly _browserBase: BrowserBase;
7170
readonly _apiLogger: Logger;
72-
private _debugController: DebugController | undefined;
7371

7472
constructor(browserBase: BrowserBase, options: BrowserContextOptions, isPersistentContext: boolean) {
7573
super();
@@ -82,16 +80,8 @@ export abstract class BrowserContextBase extends EventEmitter implements Browser
8280
}
8381

8482
async _initialize() {
85-
if (helper.isDebugMode() || helper.isRecordMode()) {
86-
this._debugController = new DebugController(this, {
87-
recorderOutput: helper.isRecordMode() ? process.stdout : undefined
88-
});
89-
}
90-
}
91-
92-
_initDebugModeForTest(options: { recorderOutput: Writable }): DebugController {
93-
this._debugController = new DebugController(this, options);
94-
return this._debugController;
83+
if (helper.isDebugMode())
84+
new DebugController(this);
9585
}
9686

9787
async waitForEvent(event: string, optionsOrPredicate: types.WaitForEventOptions = {}): Promise<any> {

src/cli/index.ts

Lines changed: 0 additions & 120 deletions
This file was deleted.

src/debug/debugController.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,15 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Writable } from 'stream';
1817
import { BrowserContextBase } from '../browserContext';
1918
import { Events } from '../events';
2019
import * as frames from '../frames';
2120
import * as js from '../javascript';
2221
import { Page } from '../page';
23-
import { RecorderController } from './recorderController';
2422
import DebugScript from './injected/debugScript';
2523

2624
export class DebugController {
27-
private _options: { recorderOutput?: Writable | undefined };
28-
29-
constructor(context: BrowserContextBase, options: { recorderOutput?: Writable | undefined }) {
30-
this._options = options;
31-
32-
if (options.recorderOutput)
33-
new RecorderController(context, options.recorderOutput);
34-
25+
constructor(context: BrowserContextBase) {
3526
context.on(Events.BrowserContext.Page, (page: Page) => {
3627
for (const frame of page.frames())
3728
this.ensureInstalledInFrame(frame);
@@ -42,13 +33,8 @@ export class DebugController {
4233
private async ensureInstalledInFrame(frame: frames.Frame): Promise<js.JSHandle<DebugScript> | undefined> {
4334
try {
4435
const mainContext = await frame._mainContext();
45-
return await mainContext.createDebugScript({ console: true, record: !!this._options.recorderOutput });
36+
return await mainContext.createDebugScript({ console: true });
4637
} catch (e) {
4738
}
4839
}
49-
50-
async ensureInstalledInFrameForTest(frame: frames.Frame): Promise<void> {
51-
const handle = await this.ensureInstalledInFrame(frame);
52-
await handle!.evaluate(debugScript => debugScript.recorder!.refreshListeners());
53-
}
5440
}

src/debug/injected/debugScript.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,13 @@
1515
*/
1616

1717
import { ConsoleAPI } from './consoleApi';
18-
import { Recorder } from './recorder';
1918
import InjectedScript from '../../injected/injectedScript';
2019

2120
export default class DebugScript {
2221
consoleAPI: ConsoleAPI | undefined;
23-
recorder: Recorder | undefined;
2422

25-
initialize(injectedScript: InjectedScript, options: { console?: boolean, record?: boolean }) {
23+
initialize(injectedScript: InjectedScript, options: { console?: boolean }) {
2624
if (options.console)
2725
this.consoleAPI = new ConsoleAPI(injectedScript);
28-
if (options.record)
29-
this.recorder = new Recorder(injectedScript);
3026
}
3127
}

0 commit comments

Comments
 (0)