From 5c6933252b8cab6f9bd155827c329bab83757c72 Mon Sep 17 00:00:00 2001 From: Peter Petrov Date: Mon, 29 Jul 2024 13:20:28 +0300 Subject: [PATCH] Add a separate entry point for playwright interface --- projects/js-packages/critical-css-gen/package.json | 12 ++++++++++++ .../js-packages/critical-css-gen/src/back-end.ts | 1 - projects/js-packages/critical-css-gen/tsconfig.json | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/projects/js-packages/critical-css-gen/package.json b/projects/js-packages/critical-css-gen/package.json index 0f338b9bbdf57..9f8f918940216 100644 --- a/projects/js-packages/critical-css-gen/package.json +++ b/projects/js-packages/critical-css-gen/package.json @@ -58,12 +58,24 @@ "import": "./build-node/back-end.js", "require": "./build-node/back-end.js", "default": "./build-node/back-end.js" + }, + "./playwright": { + "types": "./build-node/browser-interface-playwright.d.ts", + "import": "./build-node/browser-interface-playwright.js" } }, "dependencies": { "clean-css": "^5.3.1", "css-tree": "^2.3.1" }, + "peerDependencies": { + "playwright-core": "^1.45.1" + }, + "peerDependenciesMeta": { + "playwright-core": { + "optional": true + } + }, "engines": { "node": ">=18.0.0" } diff --git a/projects/js-packages/critical-css-gen/src/back-end.ts b/projects/js-packages/critical-css-gen/src/back-end.ts index 485c0bc0d57d8..3aec50088d942 100644 --- a/projects/js-packages/critical-css-gen/src/back-end.ts +++ b/projects/js-packages/critical-css-gen/src/back-end.ts @@ -1,4 +1,3 @@ -export { BrowserInterfacePlaywright } from './browser-interface-playwright.js'; export { BrowserInterfaceIframe } from './browser-interface-iframe.js'; export { BrowserInterface } from './browser-interface.js'; export { generateCriticalCSS } from './generate-critical-css.js'; diff --git a/projects/js-packages/critical-css-gen/tsconfig.json b/projects/js-packages/critical-css-gen/tsconfig.json index ede4c5a15a682..fbee93e9c20ec 100644 --- a/projects/js-packages/critical-css-gen/tsconfig.json +++ b/projects/js-packages/critical-css-gen/tsconfig.json @@ -1,6 +1,6 @@ { "extends": "jetpack-js-tools/tsconfig.tsc.json", - "include": [ "src/back-end.ts" ], + "include": [ "src/back-end.ts", "src/browser-interface-playwright.ts" ], "exclude": [ "node_modules/**/*" ], "compilerOptions": { "outDir": "./build-node",