Skip to content

Commit a3c0222

Browse files
authored
chore: use utils via index export (4) (#13404)
1 parent 40d5e3a commit a3c0222

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+244
-219
lines changed

packages/playwright-core/index.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,20 @@
1414
* limitations under the License.
1515
*/
1616

17-
require('./lib/utils/verifyNodeJsVersion');
17+
const currentNodeVersion = process.versions.node;
18+
const semver = currentNodeVersion.split('.');
19+
const [major] = [+semver[0]];
20+
21+
if (major < 12) {
22+
// eslint-disable-next-line no-console
23+
console.error(
24+
'You are running Node.js ' +
25+
currentNodeVersion +
26+
'.\n' +
27+
'Playwright requires Node.js 12 or higher. \n' +
28+
'Please update your version of Node.js.'
29+
);
30+
process.exit(1);
31+
}
32+
1833
module.exports = require('./lib/inprocess');

packages/playwright-core/src/cli/DEPS.list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[*]
22
../../
33
../client
4+
../common
45
../debug/injected
56
../generated/
67
../grid

packages/playwright-core/src/cli/cli.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ import type { Page } from '../client/page';
3232
import type { BrowserType } from '../client/browserType';
3333
import type { BrowserContextOptions, LaunchOptions } from '../client/types';
3434
import { spawn } from 'child_process';
35-
import { spawnAsync, getPlaywrightVersion, wrapInASCIIBox } from '../utils';
35+
import { getPlaywrightVersion } from '../common/userAgent';
36+
import { spawnAsync, wrapInASCIIBox } from '../utils';
3637
import { launchGridAgent } from '../grid/gridAgent';
3738
import type { GridFactory } from '../grid/gridServer';
3839
import { GridServer } from '../grid/gridServer';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[*]
2+
../common/
23
../protocol/
34
../utils/

packages/playwright-core/src/client/android.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { ChannelOwner } from './channelOwner';
2323
import type * as api from '../../types/types';
2424
import type * as types from './types';
2525
import type { Page } from './page';
26-
import { TimeoutSettings } from '../utils/timeoutSettings';
26+
import { TimeoutSettings } from '../common/timeoutSettings';
2727
import { Waiter } from './waiter';
2828
import { EventEmitter } from 'events';
2929

packages/playwright-core/src/client/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export { Locator, FrameLocator } from './locator';
2929
export { ElementHandle } from './elementHandle';
3030
export { FileChooser } from './fileChooser';
3131
export type { Logger } from './types';
32-
export { TimeoutError } from '../utils/errors';
32+
export { TimeoutError } from '../common/errors';
3333
export { Frame } from './frame';
3434
export { Keyboard, Mouse, Touchscreen } from './input';
3535
export { JSHandle } from './jsHandle';

packages/playwright-core/src/client/browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import type { Page } from './page';
2020
import { ChannelOwner } from './channelOwner';
2121
import { Events } from './events';
2222
import type { BrowserContextOptions } from './types';
23-
import { isSafeCloseError, kBrowserClosedError } from '../utils/errors';
23+
import { isSafeCloseError, kBrowserClosedError } from '../common/errors';
2424
import type * as api from '../../types/types';
2525
import { CDPSession } from './cdpSession';
2626
import type { BrowserType } from './browserType';

packages/playwright-core/src/client/browserContext.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ import { evaluationScript } from './clientHelper';
2525
import { Browser } from './browser';
2626
import { Worker } from './worker';
2727
import { Events } from './events';
28-
import { TimeoutSettings } from '../utils/timeoutSettings';
28+
import { TimeoutSettings } from '../common/timeoutSettings';
2929
import { Waiter } from './waiter';
3030
import type { URLMatch, Headers, WaitForEventOptions, BrowserContextOptions, StorageState, LaunchOptions } from './types';
3131
import { headersObjectToArray, mkdirIfNeeded } from '../utils';
32-
import { isSafeCloseError } from '../utils/errors';
32+
import { isSafeCloseError } from '../common/errors';
3333
import type * as api from '../../types/types';
3434
import type * as structs from '../../types/structs';
3535
import { CDPSession } from './cdpSession';

packages/playwright-core/src/client/browserType.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import type { ChildProcess } from 'child_process';
2525
import { envObjectToArray } from './clientHelper';
2626
import { assert, headersObjectToArray, monotonicTime } from '../utils';
2727
import type * as api from '../../types/types';
28-
import { kBrowserClosedError } from '../utils/errors';
28+
import { kBrowserClosedError } from '../common/errors';
2929
import { raceAgainstTimeout } from '../utils';
3030
import type { Playwright } from './playwright';
3131

packages/playwright-core/src/client/channelOwner.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ import { EventEmitter } from 'events';
1818
import type * as channels from '../protocol/channels';
1919
import type { Validator } from '../protocol/validator';
2020
import { createScheme, ValidationError } from '../protocol/validator';
21-
import { debugLogger } from '../utils/debugLogger';
21+
import { debugLogger } from '../common/debugLogger';
2222
import type { ParsedStackTrace } from '../utils/stackTrace';
2323
import { captureRawStack, captureStackTrace } from '../utils/stackTrace';
24-
import { isUnderTest } from '../utils';
25-
import { zones } from '../utils/zones';
24+
import { isUnderTest, zones } from '../utils';
2625
import type { ClientInstrumentation } from './clientInstrumentation';
2726
import type { Connection } from './connection';
2827
import type { Logger } from './types';

0 commit comments

Comments
 (0)