playwright 1.41.0 → 1.41.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/jsx-runtime.js CHANGED
@@ -16,6 +16,7 @@
16
16
 
17
17
  function jsx(type, props) {
18
18
  return {
19
+ __pw_type: 'jsx',
19
20
  type,
20
21
  props,
21
22
  };
@@ -23,6 +24,7 @@ function jsx(type, props) {
23
24
 
24
25
  function jsxs(type, props) {
25
26
  return {
27
+ __pw_type: 'jsx',
26
28
  type,
27
29
  props,
28
30
  };
@@ -2095,4 +2095,4 @@ If you are using Webpack or Rollup and thus don't want
2095
2095
  Babel to transpile your imports and exports, you can use
2096
2096
  the @babel/plugin-syntax-dynamic-import plugin and let your
2097
2097
  bundler handle dynamic imports.
2098
- `,eAe=(0,zPe.declare)(e=>(e.assertVersion(7),{name:"transform-dynamic-import",inherits:T3().default,pre(){this.file.set("@babel/plugin-proposal-dynamic-import","7.22.11")},visitor:{Program(){let t=this.file.get("@babel/plugin-transform-modules-*");if(!QPe.includes(t))throw new Error(ZPe)}}}));Bp.default=eAe});var x3=g(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});Fp.default=void 0;var tAe=Je(),rAe=(0,tAe.declare)(e=>(e.assertVersion(7),{name:"syntax-import-assertions",manipulateOptions(t,r){r.plugins.push("importAssertions")}}));Fp.default=rAe});var aAe={};L3(aAe,{babelTransform:()=>iAe,codeFrameColumns:()=>w3.codeFrameColumns,declare:()=>D3.declare,parse:()=>O3.parse,traverse:()=>nAe,types:()=>I3.types});module.exports=M3(aAe);var P3=Vn(require("path")),A3=Vn(ft()),w3=Vn(vi()),D3=Vn(Je()),I3=Vn(ft()),O3=Vn(Ii()),C3=Vn(Ur()),nAe=C3.default;function sAe(e,t,r,n){let s=[];return e&&s.push([WN(),{version:"2023-05"}],[GN()],[YN()],[zN()],[e3()],[r3()],[s3()],[l3()],[c3()],[f3()],[p3()],[d3()],[h3()],[y3()],[({template:i})=>({name:"replace-ts-export-assignment",visitor:{TSExportAssignment(a){a.replaceWith(i("module.exports = ASSIGNMENT;")({ASSIGNMENT:a.node.expression}))}}})]),s.push([v3(),{runtime:"automatic",importSource:P3.default.dirname(require.resolve("playwright"))}]),t?s.push([x3()]):(s.push([CE()]),s.push([S3()]),s.push([()=>({name:"css-to-identity-obj-proxy",visitor:{ImportDeclaration(i){i.node.source.value.match(/\.(css|less|scss)$/)&&i.remove()}}})])),{browserslistConfigFile:!1,babelrc:!1,configFile:!1,assumptions:{setPublicClassFields:!0},presets:e?[[DE(),{onlyRemoveTypeImports:!1}]]:[],plugins:[...r.map(([i,a])=>[require(i),a]),...s,...n.map(([i,a])=>[require(i),a])],compact:!1,sourceMaps:"both"}}var cv=!1;function iAe(e,t,r,n,s,i){if(cv)return{};cv=!0;try{let a=sAe(r,n,s,i);return A3.transform(e,{filename:t,...a})}finally{cv=!1}}0&&(module.exports={babelTransform,codeFrameColumns,declare,parse,traverse,types});
2098
+ `,eAe=(0,zPe.declare)(e=>(e.assertVersion(7),{name:"transform-dynamic-import",inherits:T3().default,pre(){this.file.set("@babel/plugin-proposal-dynamic-import","7.22.11")},visitor:{Program(){let t=this.file.get("@babel/plugin-transform-modules-*");if(!QPe.includes(t))throw new Error(ZPe)}}}));Bp.default=eAe});var x3=g(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});Fp.default=void 0;var tAe=Je(),rAe=(0,tAe.declare)(e=>(e.assertVersion(7),{name:"syntax-import-assertions",manipulateOptions(t,r){r.plugins.push("importAssertions")}}));Fp.default=rAe});var aAe={};L3(aAe,{babelTransform:()=>iAe,codeFrameColumns:()=>w3.codeFrameColumns,declare:()=>D3.declare,parse:()=>O3.parse,traverse:()=>nAe,types:()=>I3.types});module.exports=M3(aAe);var P3=Vn(require("path")),A3=Vn(ft()),w3=Vn(vi()),D3=Vn(Je()),I3=Vn(ft()),O3=Vn(Ii()),C3=Vn(Ur()),nAe=C3.default;function sAe(e,t,r,n){let s=[];return e&&s.push([WN(),{version:"2023-05"}],[GN()],[YN()],[zN()],[e3()],[r3()],[s3()],[l3()],[c3()],[f3()],[p3()],[d3()],[h3()],[y3()],[({template:i})=>({name:"replace-ts-export-assignment",visitor:{TSExportAssignment(a){a.replaceWith(i("module.exports = ASSIGNMENT;")({ASSIGNMENT:a.node.expression}))}}})]),s.push([v3(),{throwIfNamespace:!1,runtime:"automatic",importSource:P3.default.dirname(require.resolve("playwright"))}]),t?s.push([x3()]):(s.push([CE()]),s.push([S3()]),s.push([()=>({name:"css-to-identity-obj-proxy",visitor:{ImportDeclaration(i){i.node.source.value.match(/\.(css|less|scss)$/)&&i.remove()}}})])),{browserslistConfigFile:!1,babelrc:!1,configFile:!1,assumptions:{setPublicClassFields:!0},presets:e?[[DE(),{onlyRemoveTypeImports:!1}]]:[],plugins:[...r.map(([i,a])=>[require(i),a]),...s,...n.map(([i,a])=>[require(i),a])],compact:!1,sourceMaps:"both"}}var cv=!1;function iAe(e,t,r,n,s,i){if(cv)return{};cv=!0;try{let a=sAe(r,n,s,i);return A3.transform(e,{filename:t,...a})}finally{cv=!1}}0&&(module.exports={babelTransform,codeFrameColumns,declare,parse,traverse,types});
@@ -11,7 +11,9 @@ exports.currentFileDepsCollector = currentFileDepsCollector;
11
11
  exports.dependenciesForTestFile = dependenciesForTestFile;
12
12
  exports.fileDependenciesForTest = fileDependenciesForTest;
13
13
  exports.getFromCompilationCache = getFromCompilationCache;
14
+ exports.getUserData = getUserData;
14
15
  exports.installSourceMapSupportIfNeeded = installSourceMapSupportIfNeeded;
16
+ exports.internalDependenciesForTestFile = internalDependenciesForTestFile;
15
17
  exports.serializeCompilationCache = serializeCompilationCache;
16
18
  exports.setExternalDependencies = setExternalDependencies;
17
19
  exports.startCollectingFileDeps = startCollectingFileDeps;
@@ -86,9 +88,9 @@ function installSourceMapSupportIfNeeded() {
86
88
  }
87
89
  });
88
90
  }
89
- function _innerAddToCompilationCache(filename, options) {
90
- sourceMaps.set(options.moduleUrl || filename, options.sourceMapPath);
91
- memoryCache.set(filename, options);
91
+ function _innerAddToCompilationCache(filename, entry) {
92
+ sourceMaps.set(entry.moduleUrl || filename, entry.sourceMapPath);
93
+ memoryCache.set(filename, entry);
92
94
  }
93
95
  function getFromCompilationCache(filename, hash, moduleUrl) {
94
96
  // First check the memory cache by filename, this cache will always work in the worker,
@@ -108,11 +110,13 @@ function getFromCompilationCache(filename, hash, moduleUrl) {
108
110
  const cachePath = calculateCachePath(filename, hash);
109
111
  const codePath = cachePath + '.js';
110
112
  const sourceMapPath = cachePath + '.map';
113
+ const dataPath = cachePath + '.data';
111
114
  try {
112
115
  const cachedCode = _fs.default.readFileSync(codePath, 'utf8');
113
116
  _innerAddToCompilationCache(filename, {
114
117
  codePath,
115
118
  sourceMapPath,
119
+ dataPath,
116
120
  moduleUrl
117
121
  });
118
122
  return {
@@ -120,16 +124,18 @@ function getFromCompilationCache(filename, hash, moduleUrl) {
120
124
  };
121
125
  } catch {}
122
126
  return {
123
- addToCache: (code, map) => {
127
+ addToCache: (code, map, data) => {
124
128
  if ((0, _globals.isWorkerProcess)()) return;
125
129
  _fs.default.mkdirSync(_path.default.dirname(cachePath), {
126
130
  recursive: true
127
131
  });
128
132
  if (map) _fs.default.writeFileSync(sourceMapPath, JSON.stringify(map), 'utf8');
133
+ if (data.size) _fs.default.writeFileSync(dataPath, JSON.stringify(Object.fromEntries(data.entries()), undefined, 2), 'utf8');
129
134
  _fs.default.writeFileSync(codePath, code, 'utf8');
130
135
  _innerAddToCompilationCache(filename, {
131
136
  codePath,
132
137
  sourceMapPath,
138
+ dataPath,
133
139
  moduleUrl
134
140
  });
135
141
  }
@@ -192,6 +198,9 @@ function collectAffectedTestFiles(dependency, testFileCollector) {
192
198
  if (deps.has(dependency)) testFileCollector.add(testFile);
193
199
  }
194
200
  }
201
+ function internalDependenciesForTestFile(filename) {
202
+ return fileDependencies.get(filename);
203
+ }
195
204
  function dependenciesForTestFile(filename) {
196
205
  const result = new Set();
197
206
  for (const dep of fileDependencies.get(filename) || []) result.add(dep);
@@ -209,4 +218,14 @@ function belongsToNodeModules(file) {
209
218
  if (file.startsWith(kPlaywrightInternalPrefix) && file.endsWith('.js')) return true;
210
219
  if (file.startsWith(kPlaywrightCoveragePrefix) && file.endsWith('.js')) return true;
211
220
  return false;
221
+ }
222
+ async function getUserData(pluginName) {
223
+ const result = new Map();
224
+ for (const [fileName, cache] of memoryCache) {
225
+ if (!cache.dataPath) continue;
226
+ if (!_fs.default.existsSync(cache.dataPath)) continue;
227
+ const data = JSON.parse(await _fs.default.promises.readFile(cache.dataPath, 'utf8'));
228
+ if (data[pluginName]) result.set(fileName, data[pluginName]);
229
+ }
230
+ return result;
212
231
  }
@@ -6,14 +6,15 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.requireOrImport = requireOrImport;
7
7
  exports.resolveHook = resolveHook;
8
8
  exports.setTransformConfig = setTransformConfig;
9
+ exports.setTransformData = setTransformData;
9
10
  exports.shouldTransform = shouldTransform;
10
11
  exports.transformConfig = transformConfig;
11
12
  exports.transformHook = transformHook;
12
13
  exports.wrapFunctionWithLocation = wrapFunctionWithLocation;
13
14
  var _crypto = _interopRequireDefault(require("crypto"));
14
15
  var _path = _interopRequireDefault(require("path"));
15
- var _utilsBundle = require("../utilsBundle");
16
16
  var _url = _interopRequireDefault(require("url"));
17
+ var _utilsBundle = require("../utilsBundle");
17
18
  var _tsconfigLoader = require("../third_party/tsconfig-loader");
18
19
  var _module = _interopRequireDefault(require("module"));
19
20
  var _util = require("../util");
@@ -138,6 +139,10 @@ function shouldTransform(filename) {
138
139
  if (_externalMatcher(filename)) return false;
139
140
  return !(0, _compilationCache.belongsToNodeModules)(filename);
140
141
  }
142
+ let transformData;
143
+ function setTransformData(pluginName, value) {
144
+ transformData.set(pluginName, value);
145
+ }
141
146
  function transformHook(originalCode, filename, moduleUrl) {
142
147
  const isTypeScript = filename.endsWith('.ts') || filename.endsWith('.tsx') || filename.endsWith('.mts') || filename.endsWith('.cts');
143
148
  const hasPreprocessor = process.env.PW_TEST_SOURCE_TRANSFORM && process.env.PW_TEST_SOURCE_TRANSFORM_SCOPE && process.env.PW_TEST_SOURCE_TRANSFORM_SCOPE.split(pathSeparator).some(f => filename.startsWith(f));
@@ -156,11 +161,12 @@ function transformHook(originalCode, filename, moduleUrl) {
156
161
  const {
157
162
  babelTransform
158
163
  } = require('./babelBundle');
164
+ transformData = new Map();
159
165
  const {
160
166
  code,
161
167
  map
162
168
  } = babelTransform(originalCode, filename, isTypeScript, !!moduleUrl, pluginsPrologue, pluginsEpilogue);
163
- if (code) addToCache(code, map);
169
+ if (code) addToCache(code, map, transformData);
164
170
  return code || '';
165
171
  }
166
172
  function calculateHash(content, filePath, isModule, pluginsPrologue, pluginsEpilogue) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright",
3
- "version": "1.41.0",
3
+ "version": "1.41.1",
4
4
  "description": "A high-level API to automate web browsers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,6 +24,7 @@
24
24
  "./lib/transform/babelBundle": "./lib/transform/babelBundle.js",
25
25
  "./lib/transform/compilationCache": "./lib/transform/compilationCache.js",
26
26
  "./lib/transform/esmLoader": "./lib/transform/esmLoader.js",
27
+ "./lib/transform/transform": "./lib/transform/transform.js",
27
28
  "./lib/internalsForTest": "./lib/internalsForTest.js",
28
29
  "./lib/plugins": "./lib/plugins/index.js",
29
30
  "./jsx-runtime": {
@@ -54,7 +55,7 @@
54
55
  },
55
56
  "license": "Apache-2.0",
56
57
  "dependencies": {
57
- "playwright-core": "1.41.0"
58
+ "playwright-core": "1.41.1"
58
59
  },
59
60
  "optionalDependencies": {
60
61
  "fsevents": "2.3.2"