Skip to content

Commit 9a99e0c

Browse files
authored
chore: build coreBundle (#40074)
1 parent d02d38d commit 9a99e0c

134 files changed

Lines changed: 698 additions & 319 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ test-results
3939
.eslintcache
4040
playwright.env
4141
/firefox/
42+
.playwright/

eslint.config.mjs

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ const ignores = [
6060
"test-results/",
6161
"tests/assets/",
6262
"tests/components/",
63+
"tests/config/ghaMarkdownReporter.ts",
6364
"tests/installation/fixture-scripts/",
6465
"tests/third_party/",
6566
"utils/",
@@ -357,17 +358,65 @@ export default [
357358
},
358359
},
359360
{
360-
files: ["packages/playwright-core/src/tools/**/*.ts"],
361+
files: ["packages/playwright-core/src/**/*.ts"],
362+
ignores: [
363+
"packages/playwright-core/src/entry/**",
364+
],
361365
rules: {
362366
"no-restricted-imports": [
363367
"error",
364368
{
365369
patterns: [{
366-
group: ["**/client", "**/client/**"],
367-
message: "tools/ must not import from client/",
370+
group: ["**/coreBundle"],
371+
message: "coreBundle can only be imported from entry/ files. Use direct imports instead.",
368372
}],
369373
},
370374
],
375+
},
376+
},
377+
{
378+
files: ["packages/playwright-core/src/**/*.ts"],
379+
ignores: [
380+
"packages/playwright-core/src/package.ts",
381+
"packages/playwright-core/src/cli/programWithTestStub.ts",
382+
],
383+
rules: {
384+
"no-restricted-properties": [
385+
"error",
386+
{
387+
object: "process",
388+
property: "exit",
389+
message:
390+
"Please use gracefullyProcessExitDoNotHang function to exit the process.",
391+
},
392+
{ object: "process", property: "stdout" },
393+
{ object: "process", property: "stderr" },
394+
{
395+
object: "require",
396+
property: "resolve",
397+
message: "Use libPath() from package.ts instead of require.resolve.",
398+
},
399+
],
400+
},
401+
},
402+
{
403+
files: ["packages/playwright-core/src/tools/**/*.ts"],
404+
rules: {
405+
"no-restricted-imports": [
406+
"error",
407+
{
408+
patterns: [
409+
{
410+
group: ["**/client", "**/client/**"],
411+
message: "tools/ must not import from client/",
412+
},
413+
{
414+
group: ["**/coreBundle"],
415+
message: "coreBundle can only be imported from entry/ files. Use direct imports instead.",
416+
},
417+
],
418+
},
419+
],
371420
"no-restricted-syntax": [
372421
"error",
373422
{

packages/playwright-browser-chromium/install.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ let install;
1818

1919
try {
2020
if (!require('playwright-core/lib/coreBundle').serverUtils.isLikelyNpxGlobal())
21-
install = require('playwright-core/lib/coreBundle').sever.installBrowsersForNpmInstall;
21+
install = require('playwright-core/lib/coreBundle').registry.installBrowsersForNpmInstall;
2222
} catch (e) {
2323
// Dev build, don't install browsers by default.
2424
}

packages/playwright-browser-firefox/install.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ let install;
1818

1919
try {
2020
if (!require('playwright-core/lib/coreBundle').serverUtils.isLikelyNpxGlobal())
21-
install = require('playwright-core/lib/coreBundle').sever.installBrowsersForNpmInstall;
21+
install = require('playwright-core/lib/coreBundle').registry.installBrowsersForNpmInstall;
2222
} catch (e) {
2323
// Dev build, don't install browsers by default.
2424
}

packages/playwright-browser-webkit/install.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ let install;
1818

1919
try {
2020
if (!require('playwright-core/lib/coreBundle').serverUtils.isLikelyNpxGlobal())
21-
install = require('playwright-core/lib/coreBundle').sever.installBrowsersForNpmInstall;
21+
install = require('playwright-core/lib/coreBundle').registry.installBrowsersForNpmInstall;
2222
} catch (e) {
2323
// Dev build, don't install browsers by default.
2424
}

packages/playwright-chromium/install.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ let install;
1818

1919
try {
2020
if (!require('playwright-core/lib/coreBundle').serverUtils.isLikelyNpxGlobal())
21-
install = require('playwright-core/lib/coreBundle').sever.installBrowsersForNpmInstall;
21+
install = require('playwright-core/lib/coreBundle').registry.installBrowsersForNpmInstall;
2222
} catch (e) {
2323
// Dev build, don't install browsers by default.
2424
}

packages/playwright-core/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"./lib/mcpBundle": "./lib/mcpBundle.js",
2828
"./lib/utilsBundle": "./lib/utilsBundle.js",
2929
"./lib/zipBundle": "./lib/zipBundle.js",
30-
"./lib/zodBundle": "./lib/zodBundle.js"
30+
"./lib/zodBundle": "./lib/zodBundle.js",
31+
"./lib/tools/cli-client/program": "./lib/tools/cli-client/program.js"
3132
},
3233
"bin": {
3334
"playwright-core": "cli.js"

packages/playwright-core/src/DEPS.list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ utilsBundle.ts
2222

2323
[outofprocess.ts]
2424
client/
25+
package.ts
2526
protocol/
2627
utils/
2728
utils/isomorphic

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[*]
22
../inprocess.ts
3+
../package.ts
34
../server/
5+
../server/registry/
46
../server/utils/
57
../remote/
68
../utils/

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import path from 'path';
2222

2323
import { playwright } from '../inprocess';
2424
import { gracefullyProcessExitDoNotHang, ManualPromise } from '../utils';
25-
import { dotenv, program } from '../utilsBundle';
25+
import { debug, dotenv, program } from '../utilsBundle';
2626

2727
import type { Browser } from '../client/browser';
2828
import type { BrowserContext } from '../client/browserContext';
@@ -267,7 +267,7 @@ async function maybeSetupTestHooks(browser: Browser, closeBrowser: () => Promise
267267

268268
// Make sure we exit abnormally when browser crashes.
269269
const logs: string[] = [];
270-
require('playwright-core/lib/utilsBundle').debug.log = (...args: any[]) => {
270+
debug.log = (...args: any[]) => {
271271
const line = require('util').format(...args) + '\n';
272272
logs.push(line);
273273
// eslint-disable-next-line no-restricted-properties

0 commit comments

Comments
 (0)