@playwright/experimental-ct-core 1.47.0 → 1.48.0-alpha-2024-09-07

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/index.js CHANGED
@@ -16,7 +16,6 @@
16
16
 
17
17
  const { test: baseTest, expect, devices, defineConfig: originalDefineConfig } = require('playwright/test');
18
18
  const { fixtures } = require('./lib/mount');
19
- const { clearCacheCommand, findRelatedTestFilesCommand } = require('./lib/cliOverrides');
20
19
  const { createPlugin } = require('./lib/vitePlugin');
21
20
 
22
21
  const defineConfig = (...configs) => {
@@ -29,10 +28,6 @@ const defineConfig = (...configs) => {
29
28
  babelPlugins: [
30
29
  [require.resolve('./lib/tsxTransform')]
31
30
  ],
32
- cli: {
33
- 'clear-cache': clearCacheCommand,
34
- 'find-related-test-files': findRelatedTestFilesCommand,
35
- },
36
31
  }
37
32
  };
38
33
  };
package/lib/vitePlugin.js CHANGED
@@ -15,6 +15,7 @@ var _indexSource = require("./generated/indexSource");
15
15
  var _viteUtils = require("./viteUtils");
16
16
  var _transform = require("playwright/lib/transform/transform");
17
17
  var _devServer = require("./devServer");
18
+ var _util = require("playwright/lib/util");
18
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
20
  /**
20
21
  * Copyright (c) Microsoft Corporation.
@@ -70,6 +71,11 @@ function createPlugin() {
70
71
  },
71
72
  startDevServer: async () => {
72
73
  return await (0, _devServer.runDevServer)(config);
74
+ },
75
+ clearCache: async () => {
76
+ const configDir = config.configFile ? _path.default.dirname(config.configFile) : config.rootDir;
77
+ const dirs = await (0, _viteUtils.resolveDirs)(configDir, config);
78
+ if (dirs) await (0, _util.removeDirAndLogToConsole)(dirs.outDir);
73
79
  }
74
80
  };
75
81
  }
@@ -222,7 +228,7 @@ function vitePlugin(registerSource, templateDir, buildInfo, importInfos, depsCol
222
228
  },
223
229
  async writeBundle() {
224
230
  for (const importInfo of importInfos.values()) {
225
- const importPath = (0, _transform.resolveHook)(importInfo.filename, importInfo.importSource, true);
231
+ const importPath = (0, _transform.resolveHook)(importInfo.filename, importInfo.importSource);
226
232
  if (!importPath) continue;
227
233
  const deps = new Set();
228
234
  const id = await moduleResolver(importPath);
package/lib/viteUtils.js CHANGED
@@ -137,12 +137,12 @@ async function populateComponentsFromTests(componentRegistry, componentsByImport
137
137
  const importInfos = await (0, _compilationCache.getUserData)('playwright-ct-core');
138
138
  for (const [file, importList] of importInfos) {
139
139
  for (const importInfo of importList) componentRegistry.set(importInfo.id, importInfo);
140
- if (componentsByImportingFile) componentsByImportingFile.set(file, importList.map(i => (0, _transform.resolveHook)(i.filename, i.importSource, true)).filter(Boolean));
140
+ if (componentsByImportingFile) componentsByImportingFile.set(file, importList.map(i => (0, _transform.resolveHook)(i.filename, i.importSource)).filter(Boolean));
141
141
  }
142
142
  }
143
143
  function hasJSComponents(components) {
144
144
  for (const component of components) {
145
- const importPath = (0, _transform.resolveHook)(component.filename, component.importSource, true);
145
+ const importPath = (0, _transform.resolveHook)(component.filename, component.importSource);
146
146
  const extname = importPath ? _path.default.extname(importPath) : '';
147
147
  if (extname === '.js' || importPath && !extname && _fs.default.existsSync(importPath + '.js')) return true;
148
148
  }
@@ -170,7 +170,7 @@ function transformIndexFile(id, content, templateDir, registerSource, importInfo
170
170
  const lines = [content, ''];
171
171
  lines.push(registerSource);
172
172
  for (const value of importInfos.values()) {
173
- const importPath = (0, _transform.resolveHook)(value.filename, value.importSource, true) || value.importSource;
173
+ const importPath = (0, _transform.resolveHook)(value.filename, value.importSource) || value.importSource;
174
174
  lines.push(`const ${value.id} = () => import('${importPath === null || importPath === void 0 ? void 0 : importPath.replaceAll(_path.default.sep, '/')}').then((mod) => mod.${value.remoteName || 'default'});`);
175
175
  }
176
176
  lines.push(`__pwRegistry.initialize({ ${[...importInfos.keys()].join(',\n ')} });`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playwright/experimental-ct-core",
3
- "version": "1.47.0",
3
+ "version": "1.48.0-alpha-2024-09-07",
4
4
  "description": "Playwright Component Testing Helpers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,8 +26,8 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "playwright-core": "1.47.0",
29
+ "playwright-core": "1.48.0-alpha-2024-09-07",
30
30
  "vite": "^5.2.8",
31
- "playwright": "1.47.0"
31
+ "playwright": "1.48.0-alpha-2024-09-07"
32
32
  }
33
33
  }
@@ -1,38 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.clearCacheCommand = clearCacheCommand;
7
- exports.findRelatedTestFilesCommand = findRelatedTestFilesCommand;
8
- var _compilationCache = require("playwright/lib/transform/compilationCache");
9
- var _vitePlugin = require("./vitePlugin");
10
- var _viteUtils = require("./viteUtils");
11
- var _testServer = require("playwright/lib/runner/testServer");
12
- /**
13
- * Copyright (c) Microsoft Corporation.
14
- *
15
- * Licensed under the Apache License, Version 2.0 (the "License");
16
- * you may not use this file except in compliance with the License.
17
- * You may obtain a copy of the License at
18
- *
19
- * http://www.apache.org/licenses/LICENSE-2.0
20
- *
21
- * Unless required by applicable law or agreed to in writing, software
22
- * distributed under the License is distributed on an "AS IS" BASIS,
23
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
- * See the License for the specific language governing permissions and
25
- * limitations under the License.
26
- */
27
-
28
- async function clearCacheCommand(config) {
29
- const dirs = await (0, _viteUtils.resolveDirs)(config.configDir, config.config);
30
- if (dirs) await (0, _testServer.removeFolderAndLogToConsole)(dirs.outDir);
31
- await (0, _testServer.removeFolderAndLogToConsole)(_compilationCache.cacheDir);
32
- }
33
- async function findRelatedTestFilesCommand(files, config) {
34
- await (0, _vitePlugin.buildBundle)(config.config, config.configDir);
35
- return {
36
- testFiles: (0, _compilationCache.affectedTestFiles)(files)
37
- };
38
- }