@cypress/webpack-dev-server 5.3.0 → 5.4.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.
@@ -25,38 +25,49 @@ exports.nextHandler = nextHandler;
25
25
  * `loadConfig` acquires the next.config.js
26
26
  * `getNextJsBaseWebpackConfig` acquires the webpackConfig dependent on the next.config.js
27
27
  */
28
- function getNextJsPackages(devServerConfig) {
29
- var _a, _b, _c, _d, _e;
28
+ async function getNextJsPackages(devServerConfig) {
29
+ var _a, _b, _c, _d, _e, _f;
30
30
  const resolvePaths = { paths: [devServerConfig.cypressConfig.projectRoot] };
31
31
  const packages = {};
32
+ // Starting with Next.js 16.0.3, we need to proactively install SWC bindings
33
+ // See: https://github.com/vercel/next.js/pull/85787
34
+ try {
35
+ const installBindingsPath = require.resolve('next/dist/build/swc/install-bindings', resolvePaths);
36
+ const { installBindings } = require(installBindingsPath);
37
+ await installBindings();
38
+ }
39
+ catch (e) {
40
+ // installBindings doesn't exist in Next.js < 16.0.3, which is fine
41
+ debug('installBindings not available (Next.js < 16.0.3): %s', (_a = e.message) !== null && _a !== void 0 ? _a : e);
42
+ }
32
43
  try {
33
44
  const loadConfigPath = require.resolve('next/dist/server/config', resolvePaths);
34
45
  packages.loadConfig = require(loadConfigPath).default;
35
46
  }
36
47
  catch (e) {
37
- throw new Error(`Failed to load "next/dist/server/config" with error: ${(_a = e.message) !== null && _a !== void 0 ? _a : e}`);
48
+ throw new Error(`Failed to load "next/dist/server/config" with error: ${(_b = e.message) !== null && _b !== void 0 ? _b : e}`);
38
49
  }
39
50
  try {
40
51
  const getNextJsBaseWebpackConfigPath = require.resolve('next/dist/build/webpack-config', resolvePaths);
41
52
  packages.getNextJsBaseWebpackConfig = require(getNextJsBaseWebpackConfigPath).default;
42
53
  }
43
54
  catch (e) {
44
- throw new Error(`Failed to load "next/dist/build/webpack-config" with error: ${(_b = e.message) !== null && _b !== void 0 ? _b : e}`);
55
+ throw new Error(`Failed to load "next/dist/build/webpack-config" with error: ${(_c = e.message) !== null && _c !== void 0 ? _c : e}`);
45
56
  }
46
57
  try {
47
58
  const loadJsConfigPath = require.resolve('next/dist/build/load-jsconfig', resolvePaths);
48
59
  packages.nextLoadJsConfig = require(loadJsConfigPath).default;
49
60
  }
50
61
  catch (e) {
51
- throw new Error(`Failed to load "next/dist/build/load-jsconfig" with error: ${(_c = e.message) !== null && _c !== void 0 ? _c : e}`);
62
+ throw new Error(`Failed to load "next/dist/build/load-jsconfig" with error: ${(_d = e.message) !== null && _d !== void 0 ? _d : e}`);
52
63
  }
53
64
  // Does not exist prior to Next 13.
54
65
  try {
55
66
  const getUtilsPath = require.resolve('next/dist/build/utils', resolvePaths);
56
- packages.getSupportedBrowsers = (_d = require(getUtilsPath).getSupportedBrowsers) !== null && _d !== void 0 ? _d : (() => Promise.resolve([]));
67
+ packages.getSupportedBrowsers = (_e = require(getUtilsPath).getSupportedBrowsers) !== null && _e !== void 0 ? _e : (() => Promise.resolve([]));
57
68
  }
58
69
  catch (e) {
59
- throw new Error(`Failed to load "next/dist/build/utils" with error: ${(_e = e.message) !== null && _e !== void 0 ? _e : e}`);
70
+ throw new Error(`Failed to load "next/dist/build/utils" with error: ${(_f = e.message) !== null && _f !== void 0 ? _f : e}`);
60
71
  }
61
72
  return packages;
62
73
  }
@@ -102,7 +113,7 @@ function getNextJsPackages(devServerConfig) {
102
113
  ]
103
114
  */
104
115
  async function loadWebpackConfig(devServerConfig) {
105
- const { loadConfig, getNextJsBaseWebpackConfig, nextLoadJsConfig, getSupportedBrowsers } = getNextJsPackages(devServerConfig);
116
+ const { loadConfig, getNextJsBaseWebpackConfig, nextLoadJsConfig, getSupportedBrowsers } = await getNextJsPackages(devServerConfig);
106
117
  const nextConfig = await loadConfig('development', devServerConfig.cypressConfig.projectRoot);
107
118
  const runWebpackSpan = getRunWebpackSpan(devServerConfig);
108
119
  const reactVersion = getReactVersion(devServerConfig.cypressConfig.projectRoot);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cypress/webpack-dev-server",
3
- "version": "5.3.0",
3
+ "version": "5.4.1",
4
4
  "description": "Launches Webpack Dev Server for Component Testing",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {