@cypress/webpack-dev-server 1.8.4 → 2.2.0

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.
Files changed (43) hide show
  1. package/README.md +54 -75
  2. package/dist/CypressCTWebpackPlugin.d.ts +15 -0
  3. package/dist/CypressCTWebpackPlugin.js +105 -0
  4. package/dist/aut-runner.js +1 -0
  5. package/dist/constants.d.ts +1 -0
  6. package/dist/constants.js +9 -0
  7. package/dist/createWebpackDevServer.d.ts +26 -0
  8. package/dist/createWebpackDevServer.js +49 -0
  9. package/dist/devServer.d.ts +35 -0
  10. package/dist/devServer.js +106 -0
  11. package/dist/helpers/angularHandler.d.ts +80 -0
  12. package/dist/helpers/angularHandler.js +131 -0
  13. package/dist/helpers/createReactAppHandler.d.ts +8 -0
  14. package/dist/helpers/createReactAppHandler.js +300 -0
  15. package/dist/helpers/nextHandler.d.ts +3 -0
  16. package/dist/helpers/nextHandler.js +236 -0
  17. package/dist/helpers/nuxtHandler.d.ts +2 -0
  18. package/dist/helpers/nuxtHandler.js +27 -0
  19. package/dist/helpers/sourceRelativeWebpackModules.d.ts +46 -0
  20. package/dist/helpers/sourceRelativeWebpackModules.js +211 -0
  21. package/dist/helpers/vueCliHandler.d.ts +2 -0
  22. package/dist/helpers/vueCliHandler.js +23 -0
  23. package/dist/index.d.ts +3 -15
  24. package/dist/index.js +4 -63
  25. package/dist/loader.d.ts +1 -3
  26. package/dist/loader.js +8 -28
  27. package/dist/makeDefaultWebpackConfig.d.ts +1 -0
  28. package/dist/makeDefaultWebpackConfig.js +45 -0
  29. package/dist/makeWebpackConfig.d.ts +7 -16
  30. package/dist/makeWebpackConfig.js +127 -94
  31. package/dist/measureWebpackPerformance.d.ts +1 -2
  32. package/dist/measureWebpackPerformance.js +11 -8
  33. package/package.json +34 -26
  34. package/CHANGELOG.md +0 -188
  35. package/dist/plugin.d.ts +0 -45
  36. package/dist/plugin.js +0 -84
  37. package/dist/startServer.d.ts +0 -13
  38. package/dist/startServer.js +0 -75
  39. package/dist/webpack.config.d.ts +0 -2
  40. package/dist/webpack.config.js +0 -24
  41. package/dist/webpackDevServerFacts.d.ts +0 -6
  42. package/dist/webpackDevServerFacts.js +0 -19
  43. package/index-template.html +0 -12
package/dist/loader.js CHANGED
@@ -1,31 +1,10 @@
1
1
  "use strict";
2
2
  /* global Cypress */
3
3
  /// <reference types="cypress" />
4
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
- if (k2 === undefined) k2 = k;
6
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
7
- }) : (function(o, m, k, k2) {
8
- if (k2 === undefined) k2 = k;
9
- o[k2] = m[k];
10
- }));
11
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
12
- Object.defineProperty(o, "default", { enumerable: true, value: v });
13
- }) : function(o, v) {
14
- o["default"] = v;
15
- });
16
- var __importStar = (this && this.__importStar) || function (mod) {
17
- if (mod && mod.__esModule) return mod;
18
- var result = {};
19
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
20
- __setModuleDefault(result, mod);
21
- return result;
22
- };
23
- var __importDefault = (this && this.__importDefault) || function (mod) {
24
- return (mod && mod.__esModule) ? mod : { "default": mod };
25
- };
26
4
  Object.defineProperty(exports, "__esModule", { value: true });
27
- const debug_1 = __importDefault(require("debug"));
28
- const path = __importStar(require("path"));
5
+ const tslib_1 = require("tslib");
6
+ const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
7
+ const path = (0, tslib_1.__importStar)(require("path"));
29
8
  const debug = (0, debug_1.default)('cypress:webpack-dev-server:webpack');
30
9
  /**
31
10
  * @param {ComponentSpec} file spec to create import string from.
@@ -37,13 +16,13 @@ const makeImport = (file, filename, chunkName, projectRoot) => {
37
16
  // If we want to rename the chunks, we can use this
38
17
  const magicComments = chunkName ? `/* webpackChunkName: "${chunkName}" */` : '';
39
18
  return `"${filename}": {
40
- shouldLoad: () => decodeURI(document.location.pathname).includes("${file.absolute}"),
19
+ shouldLoad: () => document.location.pathname.includes("${encodeURI(file.absolute)}"),
41
20
  load: () => import("${file.absolute}" ${magicComments}),
42
21
  chunkName: "${chunkName}",
43
22
  }`;
44
23
  };
45
24
  /**
46
- * Creates a object maping a spec file to an object mapping
25
+ * Creates a object mapping a spec file to an object mapping
47
26
  * the spec name to the result of `makeImport`.
48
27
  *
49
28
  * @returns {Record<string, ReturnType<makeImport>}
@@ -67,11 +46,12 @@ function buildSpecs(projectRoot, files = []) {
67
46
  }
68
47
  // Runs the tests inside the iframe
69
48
  function loader() {
49
+ const ctx = this;
70
50
  // In Webpack 5, a spec added after the dev-server is created won't
71
51
  // be included in the compilation. Disabling the caching of this loader ensures
72
52
  // we regenerate our specs and include any new ones in the compilation.
73
- this.cacheable(false);
74
- const { files, projectRoot, supportFile } = this._cypress;
53
+ ctx.cacheable(false);
54
+ const { files, projectRoot, supportFile } = ctx._cypress;
75
55
  const supportFileAbsolutePath = supportFile ? JSON.stringify(path.resolve(projectRoot, supportFile)) : undefined;
76
56
  return `
77
57
  var loadSupportFile = ${supportFile ? `() => import(${supportFileAbsolutePath})` : `() => Promise.resolve()`}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeDefaultWebpackConfig = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const path_1 = (0, tslib_1.__importDefault)(require("path"));
6
+ const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
7
+ const debug = (0, debug_1.default)('cypress:webpack-dev-server:makeDefaultWebpackConfig');
8
+ const OUTPUT_PATH = path_1.default.join(__dirname, 'dist');
9
+ /**
10
+ * @returns {import('webpack').Configuration}
11
+ * @internal
12
+ */
13
+ function makeDefaultWebpackConfig(config) {
14
+ const { module: _HtmlWebpackPlugin, packageJson: { version }, importPath, } = config.sourceWebpackModulesResult.htmlWebpackPlugin;
15
+ const indexHtmlFile = config.devServerConfig.cypressConfig.indexHtmlFile;
16
+ const HtmlWebpackPlugin = _HtmlWebpackPlugin;
17
+ debug(`Using HtmlWebpackPlugin version ${version} from ${importPath}`);
18
+ const finalConfig = {
19
+ mode: 'development',
20
+ optimization: {
21
+ splitChunks: {
22
+ chunks: 'all',
23
+ },
24
+ },
25
+ output: {
26
+ filename: '[name].js',
27
+ path: OUTPUT_PATH,
28
+ },
29
+ plugins: [
30
+ new HtmlWebpackPlugin(Object.assign({ template: indexHtmlFile }, (config.devServerConfig.framework === 'angular' ? { scriptLoading: 'module' } : {}))),
31
+ ],
32
+ };
33
+ if (config.sourceWebpackModulesResult.webpackDevServer.majorVersion === 4) {
34
+ return Object.assign(Object.assign({}, finalConfig), { devServer: {
35
+ client: {
36
+ overlay: false,
37
+ },
38
+ } });
39
+ }
40
+ // @ts-ignore
41
+ return Object.assign(Object.assign({}, finalConfig), { devServer: {
42
+ overlay: false,
43
+ } });
44
+ }
45
+ exports.makeDefaultWebpackConfig = makeDefaultWebpackConfig;
@@ -1,16 +1,7 @@
1
- import * as webpack from 'webpack';
2
- import { CypressCTOptionsPluginOptionsWithEmitter } from './plugin';
3
- export interface UserWebpackDevServerOptions {
4
- /**
5
- * if `true` will compile all the specs together when the first one is request and can slow up initial build time.
6
- * @default false
7
- */
8
- disableLazyCompilation?: boolean;
9
- }
10
- interface MakeWebpackConfigOptions extends CypressCTOptionsPluginOptionsWithEmitter, UserWebpackDevServerOptions {
11
- devServerPublicPathRoute: string;
12
- isOpenMode: boolean;
13
- template?: string;
14
- }
15
- export declare function makeWebpackConfig(userWebpackConfig: webpack.Configuration, options: MakeWebpackConfigOptions): Promise<webpack.Configuration>;
16
- export {};
1
+ import type { CreateFinalWebpackConfig } from './createWebpackDevServer';
2
+ export declare const CYPRESS_WEBPACK_ENTRYPOINT: string;
3
+ /**
4
+ * Creates a webpack 4/5 compatible webpack "configuration"
5
+ * to pass to the sourced webpack function
6
+ */
7
+ export declare function makeWebpackConfig(config: CreateFinalWebpackConfig): Promise<any>;
@@ -1,107 +1,140 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
- return new (P || (P = Promise))(function (resolve, reject) {
24
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
- step((generator = generator.apply(thisArg, _arguments || [])).next());
28
- });
29
- };
30
- var __importDefault = (this && this.__importDefault) || function (mod) {
31
- return (mod && mod.__esModule) ? mod : { "default": mod };
32
- };
33
2
  Object.defineProperty(exports, "__esModule", { value: true });
34
- exports.makeWebpackConfig = void 0;
3
+ exports.makeWebpackConfig = exports.CYPRESS_WEBPACK_ENTRYPOINT = void 0;
4
+ const tslib_1 = require("tslib");
35
5
  const debug_1 = require("debug");
36
- const path = __importStar(require("path"));
6
+ const path = (0, tslib_1.__importStar)(require("path"));
37
7
  const webpack_merge_1 = require("webpack-merge");
38
- const webpack_config_1 = __importDefault(require("./webpack.config"));
39
- const plugin_1 = __importDefault(require("./plugin"));
8
+ const local_pkg_1 = require("local-pkg");
9
+ const makeDefaultWebpackConfig_1 = require("./makeDefaultWebpackConfig");
10
+ const CypressCTWebpackPlugin_1 = require("./CypressCTWebpackPlugin");
11
+ const constants_1 = require("./constants");
40
12
  const debug = (0, debug_1.debug)('cypress:webpack-dev-server:makeWebpackConfig');
41
- const removeList = ['HtmlWebpackPlugin', 'PreloadPlugin', 'HtmlPwaPlugin'];
13
+ const removeList = [
14
+ // We provide a webpack-html-plugin config pinned to a specific version (4.x)
15
+ // that we have tested and are confident works with all common configurations.
16
+ // https://github.com/cypress-io/cypress/issues/15865
17
+ 'HtmlWebpackPlugin',
18
+ // This plugin is an optimization for HtmlWebpackPlugin for use in
19
+ // production environments, not relevant for testing.
20
+ 'PreloadPlugin',
21
+ // Another optimization not relevant in a testing environment.
22
+ 'HtmlPwaPlugin',
23
+ // We already reload when webpack recompiles (via listeners on
24
+ // devServerEvents). Removing this plugin can prevent double-refreshes
25
+ // in some setups.
26
+ 'HotModuleReplacementPlugin',
27
+ ];
28
+ // CaseSensitivePathsPlugin checks the paths of every loaded module to enforce
29
+ // case sensitivity - this helps developers on mac catch issues that will bite
30
+ // them later, but on linux the OS already does this by default. The plugin
31
+ // is somewhat slow, accounting for ~15% of compile time on a couple of CRA
32
+ // based projects (where it's included by default) tested.
33
+ if (process.platform === 'linux') {
34
+ removeList.push('CaseSensitivePathsPlugin');
35
+ }
42
36
  const OsSeparatorRE = RegExp(`\\${path.sep}`, 'g');
43
37
  const posixSeparator = '/';
44
- function makeWebpackConfig(userWebpackConfig, options) {
38
+ exports.CYPRESS_WEBPACK_ENTRYPOINT = path.resolve(__dirname, 'browser.js');
39
+ /**
40
+ * Removes and/or modifies certain plugins known to conflict
41
+ * when used with cypress/webpack-dev-server.
42
+ */
43
+ function modifyWebpackConfigForCypress(webpackConfig) {
45
44
  var _a;
46
- return __awaiter(this, void 0, void 0, function* () {
47
- const { projectRoot, devServerPublicPathRoute, files, supportFile, devServerEvents, template } = options;
48
- debug(`User passed in webpack config with values %o`, userWebpackConfig);
49
- debug(`New webpack entries %o`, files);
50
- debug(`Project root`, projectRoot);
51
- debug(`Support file`, supportFile);
52
- const entry = path.resolve(__dirname, './browser.js');
53
- const publicPath = (path.sep === posixSeparator)
54
- ? path.join(devServerPublicPathRoute, posixSeparator)
55
- // The second line here replaces backslashes on windows with posix compatible slash
56
- // See https://github.com/cypress-io/cypress/issues/16097
57
- : path.join(devServerPublicPathRoute, posixSeparator)
58
- .replace(OsSeparatorRE, posixSeparator);
59
- const dynamicWebpackConfig = {
60
- output: {
61
- publicPath,
62
- },
63
- plugins: [
64
- new plugin_1.default({
65
- files,
66
- projectRoot,
67
- devServerEvents,
68
- supportFile,
69
- }),
70
- ],
45
+ if (webpackConfig === null || webpackConfig === void 0 ? void 0 : webpackConfig.plugins) {
46
+ webpackConfig.plugins = webpackConfig.plugins.filter((plugin) => {
47
+ if (removeList.includes(plugin.constructor.name)) {
48
+ /* eslint-disable no-console */
49
+ console.warn(`[@cypress/webpack-dev-server]: removing ${plugin.constructor.name} from configuration.`);
50
+ return false;
51
+ }
52
+ return true;
53
+ });
54
+ }
55
+ if (typeof ((_a = webpackConfig === null || webpackConfig === void 0 ? void 0 : webpackConfig.module) === null || _a === void 0 ? void 0 : _a.unsafeCache) === 'function') {
56
+ const originalCachePredicate = webpackConfig.module.unsafeCache;
57
+ webpackConfig.module.unsafeCache = (module) => {
58
+ return originalCachePredicate(module) && !/[\\/]webpack-dev-server[\\/]dist[\\/]browser\.js/.test(module.resource);
71
59
  };
72
- // certain plugins conflict with HtmlWebpackPlugin and cause
73
- // problems for some setups.
74
- // most of these are application optimizations that are not relevant in a
75
- // testing environment.
76
- // remove those plugins to ensure a smooth configuration experience.
77
- // we provide a webpack-html-plugin config pinned to a specific version (4.x)
78
- // that we have tested and are confident works with all common configurations.
79
- // https://github.com/cypress-io/cypress/issues/15865
80
- if (userWebpackConfig === null || userWebpackConfig === void 0 ? void 0 : userWebpackConfig.plugins) {
81
- userWebpackConfig.plugins = userWebpackConfig.plugins.filter((plugin) => {
82
- if (removeList.includes(plugin.constructor.name)) {
83
- /* eslint-disable no-console */
84
- console.warn(`[@cypress/webpack-dev-server]: removing ${plugin.constructor.name} from configuration.`);
85
- return false;
86
- }
87
- return true;
88
- });
89
- }
90
- if (typeof ((_a = userWebpackConfig === null || userWebpackConfig === void 0 ? void 0 : userWebpackConfig.module) === null || _a === void 0 ? void 0 : _a.unsafeCache) === 'function') {
91
- const originalCachePredicate = userWebpackConfig.module.unsafeCache;
92
- userWebpackConfig.module.unsafeCache = (module) => {
93
- return originalCachePredicate(module) && !/[\\/]webpack-dev-server[\\/]dist[\\/]browser\.js/.test(module.resource);
94
- };
60
+ }
61
+ return webpackConfig;
62
+ }
63
+ /**
64
+ * Creates a webpack 4/5 compatible webpack "configuration"
65
+ * to pass to the sourced webpack function
66
+ */
67
+ async function makeWebpackConfig(config) {
68
+ var _a, _b;
69
+ const { module: webpack } = config.sourceWebpackModulesResult.webpack;
70
+ let userWebpackConfig = config.devServerConfig.webpackConfig;
71
+ const frameworkWebpackConfig = config.frameworkConfig;
72
+ const { cypressConfig: { projectRoot, devServerPublicPathRoute, supportFile, }, specs: files, devServerEvents, framework, } = config.devServerConfig;
73
+ let configFile = undefined;
74
+ if (!userWebpackConfig && !frameworkWebpackConfig) {
75
+ debug('Not user or framework webpack config received. Trying to automatically source it');
76
+ const { default: findUp } = await (0, local_pkg_1.importModule)('find-up');
77
+ configFile = await findUp(constants_1.configFiles, { cwd: projectRoot });
78
+ if (configFile) {
79
+ debug('found webpack config %s', configFile);
80
+ const sourcedConfig = await (0, local_pkg_1.importModule)(configFile);
81
+ debug('config contains %o', sourcedConfig);
82
+ if (sourcedConfig && typeof sourcedConfig === 'object') {
83
+ userWebpackConfig = (_a = sourcedConfig.default) !== null && _a !== void 0 ? _a : sourcedConfig;
84
+ }
95
85
  }
96
- const mergedConfig = (0, webpack_merge_1.merge)(userWebpackConfig, (0, webpack_config_1.default)(template), dynamicWebpackConfig);
97
- mergedConfig.entry = entry;
98
- debug('Merged webpack config %o', mergedConfig);
99
- if (process.env.WEBPACK_PERF_MEASURE) {
100
- // only for debugging
101
- const { measureWebpackPerformance } = require('./measureWebpackPerformance');
102
- return measureWebpackPerformance(mergedConfig);
86
+ if (!userWebpackConfig) {
87
+ debug('could not find webpack.config!');
88
+ if ((_b = config.devServerConfig) === null || _b === void 0 ? void 0 : _b.onConfigNotFound) {
89
+ config.devServerConfig.onConfigNotFound('webpack', projectRoot, constants_1.configFiles);
90
+ // The config process will be killed from the parent, but we want to early exit so we don't get
91
+ // any additional errors related to not having a config
92
+ process.exit(0);
93
+ }
94
+ else {
95
+ throw new Error(`Your Cypress devServer config is missing a required webpackConfig property, since we could not automatically detect one.\nPlease add one to your ${config.devServerConfig.cypressConfig.configFile}`);
96
+ }
103
97
  }
104
- return mergedConfig;
105
- });
98
+ }
99
+ const userAndFrameworkWebpackConfig = modifyWebpackConfigForCypress((0, webpack_merge_1.merge)(frameworkWebpackConfig !== null && frameworkWebpackConfig !== void 0 ? frameworkWebpackConfig : {}, userWebpackConfig !== null && userWebpackConfig !== void 0 ? userWebpackConfig : {}));
100
+ debug(`User passed in user and framework webpack config with values %o`, userAndFrameworkWebpackConfig);
101
+ debug(`New webpack entries %o`, files);
102
+ debug(`Project root`, projectRoot);
103
+ debug(`Support file`, supportFile);
104
+ const publicPath = (path.sep === posixSeparator)
105
+ ? path.join(devServerPublicPathRoute, posixSeparator)
106
+ // The second line here replaces backslashes on windows with posix compatible slash
107
+ // See https://github.com/cypress-io/cypress/issues/16097
108
+ : path.join(devServerPublicPathRoute, posixSeparator)
109
+ .replace(OsSeparatorRE, posixSeparator);
110
+ const dynamicWebpackConfig = {
111
+ output: {
112
+ publicPath,
113
+ },
114
+ plugins: [
115
+ new CypressCTWebpackPlugin_1.CypressCTWebpackPlugin({
116
+ files,
117
+ projectRoot,
118
+ devServerEvents,
119
+ supportFile,
120
+ webpack,
121
+ }),
122
+ ],
123
+ };
124
+ const mergedConfig = (0, webpack_merge_1.merge)(userAndFrameworkWebpackConfig, (0, makeDefaultWebpackConfig_1.makeDefaultWebpackConfig)(config), dynamicWebpackConfig);
125
+ // Angular loads global styles and polyfills via script injection in the index.html
126
+ if (framework === 'angular') {
127
+ mergedConfig.entry = Object.assign(Object.assign({}, mergedConfig.entry || {}), { 'cypress-entry': exports.CYPRESS_WEBPACK_ENTRYPOINT });
128
+ }
129
+ else {
130
+ mergedConfig.entry = exports.CYPRESS_WEBPACK_ENTRYPOINT;
131
+ }
132
+ debug('Merged webpack config %o', mergedConfig);
133
+ if (process.env.WEBPACK_PERF_MEASURE) {
134
+ // only for debugging
135
+ const { measureWebpackPerformance } = require('./measureWebpackPerformance');
136
+ return measureWebpackPerformance(mergedConfig);
137
+ }
138
+ return mergedConfig;
106
139
  }
107
140
  exports.makeWebpackConfig = makeWebpackConfig;
@@ -1,2 +1 @@
1
- import type { Configuration } from 'webpack';
2
- export declare function measureWebpackPerformance(webpackConfig: Configuration): Configuration;
1
+ export {};
@@ -1,14 +1,16 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.measureWebpackPerformance = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- const fs_1 = __importDefault(require("fs"));
9
- const chalk_1 = __importDefault(require("chalk"));
10
- // @ts-ignore
11
- const speed_measure_webpack_plugin_1 = __importDefault(require("speed-measure-webpack-plugin"));
4
+ const tslib_1 = require("tslib");
5
+ /* eslint-disable no-restricted-syntax */
6
+ /* eslint-disable no-console */
7
+ const path_1 = (0, tslib_1.__importDefault)(require("path"));
8
+ const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
9
+ const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
10
+ const speed_measure_webpack_plugin_1 = (0, tslib_1.__importDefault)(require("speed-measure-webpack-plugin"));
11
+ /**
12
+ * @internal
13
+ */
12
14
  function measureWebpackPerformance(webpackConfig) {
13
15
  if (!process.env.WEBPACK_PERF_MEASURE) {
14
16
  throw new Error('Performance monitoring is possible only with WEBPACK_PERF_MEASURE env variable set');
@@ -50,6 +52,7 @@ function measureWebpackPerformance(webpackConfig) {
50
52
  outputTarget: compareOutput,
51
53
  })
52
54
  : new speed_measure_webpack_plugin_1.default();
55
+ // @ts-expect-error
53
56
  return smp.wrap(webpackConfig);
54
57
  }
55
58
  exports.measureWebpackPerformance = measureWebpackPerformance;
package/package.json CHANGED
@@ -1,41 +1,49 @@
1
1
  {
2
2
  "name": "@cypress/webpack-dev-server",
3
- "version": "1.8.4",
3
+ "version": "2.2.0",
4
4
  "description": "Launches Webpack Dev Server for Component Testing",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
- "build": "tsc",
8
- "build-prod": "tsc",
9
- "test": "node ./test-deps.js",
10
- "test-all": "tsc && mocha -r @packages/ts/register test/**/*.spec.ts test/*.spec.ts --exit",
11
- "watch": "tsc -w"
7
+ "prebuild": "rimraf dist",
8
+ "build": "tsc || echo 'built, with type errors'",
9
+ "build-prod": "yarn build",
10
+ "check-ts": "tsc --noEmit",
11
+ "dev": "tsc --watch",
12
+ "clean": "rimraf dist",
13
+ "cypress:run": "yarn cypress:run-cypress-in-cypress node ../../scripts/cypress run --project . --browser chrome",
14
+ "cypress:run-cypress-in-cypress": "cross-env HTTP_PROXY_TARGET_FOR_ORIGIN_REQUESTS=http://localhost:4455 CYPRESS_REMOTE_DEBUGGING_PORT=6666 TZ=America/New_York",
15
+ "cypress:open": "yarn cypress:run-cypress-in-cypress gulp open --project .",
16
+ "test": "yarn test-unit",
17
+ "test-unit": "mocha -r ts-node/register/transpile-only --config ./test/.mocharc.js"
12
18
  },
13
19
  "dependencies": {
14
- "debug": "^4.3.2",
15
- "lodash": "^4.17.21",
16
- "semver": "^7.3.4",
20
+ "find-up": "6.3.0",
21
+ "fs-extra": "9.1.0",
22
+ "html-webpack-plugin-4": "npm:html-webpack-plugin@^4",
23
+ "html-webpack-plugin-5": "npm:html-webpack-plugin@^5",
24
+ "local-pkg": "0.4.1",
25
+ "speed-measure-webpack-plugin": "1.4.2",
26
+ "tslib": "^2.3.1",
27
+ "webpack-dev-server": "^4.7.4",
17
28
  "webpack-merge": "^5.4.0"
18
29
  },
19
30
  "devDependencies": {
20
- "@types/webpack": ">=4",
21
- "@types/webpack-dev-server": "^4.0.0",
22
- "chai": "^4.2.0",
23
- "html-webpack-plugin": "4.x",
24
- "mocha": "^8.1.3",
25
- "snap-shot-it": "7.9.3",
26
- "speed-measure-webpack-plugin": "1.4.2",
27
- "typescript": "^4.2.3",
28
- "webpack": "^4.44.2",
29
- "webpack-dev-server": "^4.0.0"
30
- },
31
- "peerDependencies": {
32
- "html-webpack-plugin": ">=4",
33
- "webpack": ">=4",
34
- "webpack-dev-server": ">=3.0.0"
31
+ "@types/proxyquire": "^1.3.28",
32
+ "@types/speed-measure-webpack-plugin": "^1.3.4",
33
+ "@types/webpack-dev-server-3": "npm:@types/webpack-dev-server@^3",
34
+ "chai": "^4.3.6",
35
+ "dedent": "^0.7.0",
36
+ "mocha": "^9.2.2",
37
+ "proxyquire": "2.1.3",
38
+ "sinon": "^13.0.1",
39
+ "snap-shot-it": "^7.9.6",
40
+ "ts-node": "^10.2.1",
41
+ "webpack": "npm:webpack@^5",
42
+ "webpack-4": "npm:webpack@^4",
43
+ "webpack-dev-server-3": "npm:webpack-dev-server@^3"
35
44
  },
36
45
  "files": [
37
- "dist",
38
- "index-template.html"
46
+ "dist"
39
47
  ],
40
48
  "license": "MIT",
41
49
  "repository": {