@cypress/vite-dev-server 5.2.1 → 6.0.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/README.md CHANGED
@@ -12,7 +12,7 @@ import { defineConfig } from 'cypress'
12
12
  export default defineConfig({
13
13
  component: {
14
14
  devServer: {
15
- framework: 'create-react-app',
15
+ framework: 'react',
16
16
  bundler: 'vite',
17
17
  // viteConfig?: Will try to infer, if passed it will be used as is
18
18
  }
@@ -51,10 +51,11 @@ We then merge the sourced config with the user's vite config, and layer on our o
51
51
 
52
52
  ## Compatibility
53
53
 
54
- | @cypress/vite-dev-server | cypress |
55
- | ------------------------ | ------- |
56
- | <= v2 | <= v9 |
57
- | >= v3 | >= v10 |
54
+ | @cypress/vite-dev-server | cypress |
55
+ | ------------------------ | ------------- |
56
+ | <= v2 | <= v9 |
57
+ | >= v3 <= v5 | >= v10 <= v13 |
58
+ | >= v6 | >= v14 |
58
59
 
59
60
  #### `devServerPublicPathRoute` for Vite v5
60
61
 
@@ -1,6 +1,6 @@
1
1
  /// <reference types="cypress" />
2
2
  /// <reference types="node" />
3
- import type { UserConfig } from 'vite-5';
3
+ import type { UserConfig } from 'vite-6';
4
4
  declare const ALL_FRAMEWORKS: readonly ["react", "vue"];
5
5
  type ConfigHandler = UserConfig | (() => UserConfig | Promise<UserConfig>);
6
6
  export type ViteDevServerConfig = {
@@ -14,6 +14,6 @@ export type ViteDevServerConfig = {
14
14
  };
15
15
  export declare function devServer(config: ViteDevServerConfig): Promise<Cypress.ResolvedDevServerConfig>;
16
16
  export declare namespace devServer {
17
- var create: (devServerConfig: ViteDevServerConfig, vite: typeof import("vite-5")) => Promise<import("vite-5").ViteDevServer>;
17
+ var create: (devServerConfig: ViteDevServerConfig, vite: typeof import("vite-6")) => Promise<import("vite-6").ViteDevServer>;
18
18
  }
19
19
  export {};
package/dist/getVite.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import type { ViteDevServerConfig } from './devServer';
2
- export type Vite = typeof import('vite-5');
2
+ export type Vite = typeof import('vite-6');
3
3
  export declare function getVite(config: ViteDevServerConfig): Vite;
@@ -1,4 +1,4 @@
1
- import type { PluginOption } from 'vite-5';
1
+ import type { PluginOption } from 'vite-6';
2
2
  import type { Vite } from '../getVite';
3
3
  import type { ViteDevServerConfig } from '../devServer';
4
4
  export declare const Cypress: (options: ViteDevServerConfig, vite: Vite) => PluginOption;
@@ -23,7 +23,11 @@ const Cypress = (options, vite) => {
23
23
  // TODO: use async fs methods here
24
24
  // eslint-disable-next-line no-restricted-syntax
25
25
  let loader = fs_1.default.readFileSync(INIT_FILEPATH, 'utf8');
26
- devServerEvents.on('dev-server:specs:changed', (specs) => {
26
+ devServerEvents.on('dev-server:specs:changed', ({ specs, options }) => {
27
+ if (options === null || options === void 0 ? void 0 : options.neededForJustInTimeCompile) {
28
+ // if an option is needed for just in time compile, no-op as this isn't supported in vite
29
+ return;
30
+ }
27
31
  debug(`dev-server:secs:changed: ${specs.map((spec) => spec.relative)}`);
28
32
  specsPathsSet = getSpecsPathsSet(specs);
29
33
  });
@@ -63,12 +67,7 @@ const Cypress = (options, vite) => {
63
67
  },
64
68
  configureServer: async (server) => {
65
69
  server.middlewares.use(`${base}index.html`, async (req, res) => {
66
- let transformedIndexHtml = await server.transformIndexHtml(base, '');
67
- const viteImport = `<script type="module" src="${options.cypressConfig.devServerPublicPathRoute}/@vite/client"></script>`;
68
- // If we're doing cy-in-cy, we need to be able to access the Cypress instance from the parent frame.
69
- if (process.env.CYPRESS_INTERNAL_VITE_OPEN_MODE_TESTING) {
70
- transformedIndexHtml = transformedIndexHtml.replace(viteImport, `<script>document.domain = 'localhost';</script>${viteImport}`);
71
- }
70
+ const transformedIndexHtml = await server.transformIndexHtml(base, '');
72
71
  return res.end(transformedIndexHtml);
73
72
  });
74
73
  },
@@ -1,4 +1,4 @@
1
- import type { PluginOption } from 'vite-5';
1
+ import type { PluginOption } from 'vite-6';
2
2
  import type { Vite } from '../getVite';
3
3
  import type { ViteDevServerConfig } from '../devServer';
4
4
  export declare const CypressSourcemap: (options: ViteDevServerConfig, vite: Vite) => PluginOption;
@@ -1,4 +1,4 @@
1
- import type { InlineConfig } from 'vite-5';
1
+ import type { InlineConfig } from 'vite-6';
2
2
  import type { ViteDevServerConfig } from './devServer';
3
3
  import type { Vite } from './getVite';
4
4
  export declare const createViteDevServerConfig: (config: ViteDevServerConfig, vite: Vite) => Promise<InlineConfig>;
@@ -52,7 +52,7 @@ const createViteDevServerConfig = async (config, vite) => {
52
52
  exports.createViteDevServerConfig = createViteDevServerConfig;
53
53
  function makeCypressViteConfig(config, vite) {
54
54
  var _a, _b, _c;
55
- const { cypressConfig: { experimentalJustInTimeCompile, port, projectRoot, devServerPublicPathRoute, supportFile, cypressBinaryRoot, isTextTerminal, }, specs, } = config;
55
+ const { cypressConfig: { port, projectRoot, devServerPublicPathRoute, supportFile, cypressBinaryRoot, isTextTerminal, }, specs, } = config;
56
56
  const vitePort = port !== null && port !== void 0 ? port : undefined;
57
57
  // Vite caches its output in the .vite directory in the node_modules where vite lives.
58
58
  // So we want to find that node_modules path and ensure it's added to the "allow" list
@@ -95,7 +95,7 @@ function makeCypressViteConfig(config, vite) {
95
95
  // Supported from Vite v3 - add null check for v2 users.
96
96
  (_a = vite.searchForWorkspaceRoot) === null || _a === void 0 ? void 0 : _a.call(vite, process.cwd()),
97
97
  ],
98
- }, port: vitePort, host: '127.0.0.1' }, (isTextTerminal && !experimentalJustInTimeCompile
98
+ }, port: vitePort, host: '127.0.0.1' }, (isTextTerminal
99
99
  ? { watch: { ignored: '**/*' }, hmr: false }
100
100
  : {})),
101
101
  plugins: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cypress/vite-dev-server",
3
- "version": "5.2.1",
3
+ "version": "6.0.1",
4
4
  "description": "Launches Vite Dev Server for Component Testing",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -29,8 +29,12 @@
29
29
  "ts-node": "^10.9.2",
30
30
  "vite-4": "npm:vite@^4.5.3",
31
31
  "vite-5": "npm:vite@^5.2.8",
32
+ "vite-6": "npm:vite@^6.0.0",
32
33
  "vite-plugin-inspect": "0.8.4"
33
34
  },
35
+ "peerDependencies": {
36
+ "cypress": ">=14.0.0"
37
+ },
34
38
  "files": [
35
39
  "dist",
36
40
  "client",