chore: update playwright patch to work on windows

This commit is contained in:
Alessio Gravili
2024-03-12 15:47:04 -04:00
parent 935044d2da
commit c05ffb0c6b
2 changed files with 11 additions and 7 deletions

View File

@@ -11,7 +11,7 @@ index c736e9d13ad09e54ee6f1fe000a9c8d8aa853f40..92ca367464c3d582b7496fd57d59d2ff
+export function createElement() {} // https://github.com/microsoft/playwright/issues/26824 TODO: Maybe create proxy which returns this from react instead? It should be React.createElement +export function createElement() {} // https://github.com/microsoft/playwright/issues/26824 TODO: Maybe create proxy which returns this from react instead? It should be React.createElement
\ No newline at end of file \ No newline at end of file
diff --git a/lib/transform/esmLoader.js b/lib/transform/esmLoader.js diff --git a/lib/transform/esmLoader.js b/lib/transform/esmLoader.js
index 80073de7dfc269c6f838e685850b9f32ea0c1f9a..2f940c267e5982c9582d2fa5d3b777b0bf852830 100644 index 80073de7dfc269c6f838e685850b9f32ea0c1f9a..be536bc0dd0969d692c58e4ca0b99f424bdc88a1 100644
--- a/lib/transform/esmLoader.js --- a/lib/transform/esmLoader.js
+++ b/lib/transform/esmLoader.js +++ b/lib/transform/esmLoader.js
@@ -5,7 +5,17 @@ var _url = _interopRequireDefault(require("url")); @@ -5,7 +5,17 @@ var _url = _interopRequireDefault(require("url"));
@@ -32,7 +32,7 @@ index 80073de7dfc269c6f838e685850b9f32ea0c1f9a..2f940c267e5982c9582d2fa5d3b777b0
/** /**
* Copyright (c) Microsoft Corporation. * Copyright (c) Microsoft Corporation.
* *
@@ -25,6 +35,23 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de @@ -25,6 +35,27 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
// Node < 18.6: defaultResolve takes 3 arguments. // Node < 18.6: defaultResolve takes 3 arguments.
// Node >= 18.6: nextResolve from the chain takes 2 arguments. // Node >= 18.6: nextResolve from the chain takes 2 arguments.
async function resolve(specifier, context, defaultResolve) { async function resolve(specifier, context, defaultResolve) {
@@ -41,6 +41,10 @@ index 80073de7dfc269c6f838e685850b9f32ea0c1f9a..2f940c267e5982c9582d2fa5d3b777b0
+ specifier = specifier.replace('/node_modules/playwright', '/node_modules/playwright/index.mjs') + specifier = specifier.replace('/node_modules/playwright', '/node_modules/playwright/index.mjs')
+ } + }
+ +
+ if(specifier?.endsWith('\\node_modules\\playwright')) {
+ specifier = specifier.replace('\\node_modules\\playwright', '\\node_modules\\playwright\\index.mjs')
+ }
+
+ // Continue as usual if the format is not scss, svg, or png. + // Continue as usual if the format is not scss, svg, or png.
+ if (specifier && endsWith.some((e) => specifier.endsWith(e))) { + if (specifier && endsWith.some((e) => specifier.endsWith(e))) {
+ // If the format is scss, svg, or png, load the file as scss + // If the format is scss, svg, or png, load the file as scss
@@ -56,7 +60,7 @@ index 80073de7dfc269c6f838e685850b9f32ea0c1f9a..2f940c267e5982c9582d2fa5d3b777b0
var _currentFileDepsColle; var _currentFileDepsColle;
if (context.parentURL && context.parentURL.startsWith('file://')) { if (context.parentURL && context.parentURL.startsWith('file://')) {
const filename = _url.default.fileURLToPath(context.parentURL); const filename = _url.default.fileURLToPath(context.parentURL);
@@ -41,6 +68,20 @@ async function resolve(specifier, context, defaultResolve) { @@ -41,6 +72,20 @@ async function resolve(specifier, context, defaultResolve) {
// Node < 18.6: defaultLoad takes 3 arguments. // Node < 18.6: defaultLoad takes 3 arguments.
// Node >= 18.6: nextLoad from the chain takes 2 arguments. // Node >= 18.6: nextLoad from the chain takes 2 arguments.
async function load(moduleUrl, context, defaultLoad) { async function load(moduleUrl, context, defaultLoad) {

8
pnpm-lock.yaml generated
View File

@@ -16,7 +16,7 @@ overrides:
patchedDependencies: patchedDependencies:
playwright@1.42.1: playwright@1.42.1:
hash: im3bk6xpo2wosx5xxzkmgc6cma hash: snj23idnz6qktfxfcravfxvpgu
path: patches/playwright@1.42.1.patch path: patches/playwright@1.42.1.patch
importers: importers:
@@ -206,7 +206,7 @@ importers:
version: 10.2.0 version: 10.2.0
playwright: playwright:
specifier: ^1.42.1 specifier: ^1.42.1
version: 1.42.1(patch_hash=im3bk6xpo2wosx5xxzkmgc6cma) version: 1.42.1(patch_hash=snj23idnz6qktfxfcravfxvpgu)
playwright-core: playwright-core:
specifier: ^1.42.1 specifier: ^1.42.1
version: 1.42.1 version: 1.42.1
@@ -4737,7 +4737,7 @@ packages:
engines: {node: '>=16'} engines: {node: '>=16'}
hasBin: true hasBin: true
dependencies: dependencies:
playwright: 1.42.1(patch_hash=im3bk6xpo2wosx5xxzkmgc6cma) playwright: 1.42.1(patch_hash=snj23idnz6qktfxfcravfxvpgu)
dev: true dev: true
/@pnpm/config.env-replace@1.1.0: /@pnpm/config.env-replace@1.1.0:
@@ -13976,7 +13976,7 @@ packages:
hasBin: true hasBin: true
dev: true dev: true
/playwright@1.42.1(patch_hash=im3bk6xpo2wosx5xxzkmgc6cma): /playwright@1.42.1(patch_hash=snj23idnz6qktfxfcravfxvpgu):
resolution: {integrity: sha512-PgwB03s2DZBcNRoW+1w9E+VkLBxweib6KTXM0M3tkiT4jVxKSi6PmVJ591J+0u10LUrgxB7dLRbiJqO5s2QPMg==} resolution: {integrity: sha512-PgwB03s2DZBcNRoW+1w9E+VkLBxweib6KTXM0M3tkiT4jVxKSi6PmVJ591J+0u10LUrgxB7dLRbiJqO5s2QPMg==}
engines: {node: '>=16'} engines: {node: '>=16'}
hasBin: true hasBin: true