@cypress/webpack-dev-server 1.5.0 → 1.8.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/CHANGELOG.md +28 -0
- package/README.md +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +16 -3
- package/dist/loader.d.ts +2 -1
- package/dist/loader.js +5 -1
- package/dist/makeWebpackConfig.js +2 -2
- package/dist/plugin.js +1 -1
- package/dist/startServer.d.ts +6 -2
- package/dist/startServer.js +7 -7
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
# [@cypress/webpack-dev-server-v1.8.1](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.8.0...@cypress/webpack-dev-server-v1.8.1) (2022-02-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* detect newly added specs in dev-server compilation ([#17950](https://github.com/cypress-io/cypress/issues/17950)) ([f9ce67c](https://github.com/cypress-io/cypress/commit/f9ce67cfb6fed74a3549e7aff7ce0a5b217d9a13))
|
|
7
|
+
|
|
8
|
+
# [@cypress/webpack-dev-server-v1.8.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.7.0...@cypress/webpack-dev-server-v1.8.0) (2021-12-16)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* use hoisted yarn install in binary build ([#17285](https://github.com/cypress-io/cypress/issues/17285)) ([e4f5b10](https://github.com/cypress-io/cypress/commit/e4f5b106d49d6ac0857c5fdac886f83b99558c88))
|
|
14
|
+
|
|
15
|
+
# [@cypress/webpack-dev-server-v1.7.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.6.0...@cypress/webpack-dev-server-v1.7.0) (2021-10-15)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* normalized signatures webpack & vite servers ([#18379](https://github.com/cypress-io/cypress/issues/18379)) ([8f5308f](https://github.com/cypress-io/cypress/commit/8f5308f7068b80fb877da539ce34fb67ba497c4f))
|
|
21
|
+
|
|
22
|
+
# [@cypress/webpack-dev-server-v1.6.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.5.0...@cypress/webpack-dev-server-v1.6.0) (2021-09-10)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* allow usage of @react/plugins with cypress.config.js ([#17738](https://github.com/cypress-io/cypress/issues/17738)) ([da4b1e0](https://github.com/cypress-io/cypress/commit/da4b1e06ce33945aabddda0e6e175dc0e1b488a5))
|
|
28
|
+
|
|
1
29
|
# [@cypress/webpack-dev-server-v1.5.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.4.0...@cypress/webpack-dev-server-v1.5.0) (2021-08-30)
|
|
2
30
|
|
|
3
31
|
|
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ by calling an event `devServerEvents.emit('dev-server:compile:success')`
|
|
|
46
46
|
|
|
47
47
|
## Webpack
|
|
48
48
|
|
|
49
|
-
Webpack-dev-server fulfills his
|
|
49
|
+
Webpack-dev-server fulfills his responsibilities by
|
|
50
50
|
|
|
51
51
|
- Making a `webpack.config` from the users setup by changing the entrypoint to `browser.ts`
|
|
52
52
|
- Launches the webpack dev server with `devServer.publicPath = "__cypress/src/"` and `devServer.hot = false`
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
import { StartDevServer, WebpackConfigurationWithDevServer } from './startServer';
|
|
2
3
|
declare type DoneCallback = () => unknown;
|
|
3
4
|
export interface ResolvedDevServerConfig {
|
|
4
5
|
port: number;
|
|
@@ -6,3 +7,9 @@ export interface ResolvedDevServerConfig {
|
|
|
6
7
|
}
|
|
7
8
|
export { StartDevServer };
|
|
8
9
|
export declare function startDevServer(startDevServerArgs: StartDevServer, exitProcess?: (code?: number | undefined) => never): Promise<ResolvedDevServerConfig>;
|
|
10
|
+
export interface CypressWebpackDevServerConfig {
|
|
11
|
+
webpackConfig?: WebpackConfigurationWithDevServer;
|
|
12
|
+
template?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function devServer(cypressDevServerConfig: Cypress.DevServerConfig, devServerConfig?: CypressWebpackDevServerConfig): Promise<ResolvedDevServerConfig>;
|
|
15
|
+
export declare function defineDevServerConfig(devServerConfig: CypressWebpackDevServerConfig): CypressWebpackDevServerConfig;
|
package/dist/index.js
CHANGED
|
@@ -9,16 +9,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.startDevServer = void 0;
|
|
12
|
+
exports.defineDevServerConfig = exports.devServer = exports.startDevServer = void 0;
|
|
13
13
|
const debug_1 = require("debug");
|
|
14
14
|
const startServer_1 = require("./startServer");
|
|
15
15
|
const webpackDevServerFacts_1 = require("./webpackDevServerFacts");
|
|
16
|
-
const debug = debug_1.debug('cypress:webpack-dev-server:webpack');
|
|
16
|
+
const debug = (0, debug_1.debug)('cypress:webpack-dev-server:webpack');
|
|
17
17
|
function startDevServer(startDevServerArgs, exitProcess = process.exit) {
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
const webpackDevServer = yield startServer_1.start(startDevServerArgs, exitProcess);
|
|
19
|
+
const webpackDevServer = yield (0, startServer_1.start)(startDevServerArgs, exitProcess);
|
|
20
20
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
21
21
|
if (webpackDevServerFacts_1.webpackDevServerFacts.isV3()) {
|
|
22
|
+
// @ts-ignore
|
|
22
23
|
const server = webpackDevServer.listen(0, '127.0.0.1', () => {
|
|
23
24
|
// FIXME: handle address returning a string
|
|
24
25
|
const port = server.address().port;
|
|
@@ -50,3 +51,15 @@ function startDevServer(startDevServerArgs, exitProcess = process.exit) {
|
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
53
|
exports.startDevServer = startDevServer;
|
|
54
|
+
function devServer(cypressDevServerConfig, devServerConfig) {
|
|
55
|
+
return startDevServer({
|
|
56
|
+
options: cypressDevServerConfig,
|
|
57
|
+
webpackConfig: devServerConfig === null || devServerConfig === void 0 ? void 0 : devServerConfig.webpackConfig,
|
|
58
|
+
template: devServerConfig === null || devServerConfig === void 0 ? void 0 : devServerConfig.template,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
exports.devServer = devServer;
|
|
62
|
+
function defineDevServerConfig(devServerConfig) {
|
|
63
|
+
return devServerConfig;
|
|
64
|
+
}
|
|
65
|
+
exports.defineDevServerConfig = defineDevServerConfig;
|
package/dist/loader.d.ts
CHANGED
package/dist/loader.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
27
|
const debug_1 = __importDefault(require("debug"));
|
|
28
28
|
const path = __importStar(require("path"));
|
|
29
|
-
const debug = debug_1.default('cypress:webpack-dev-server:webpack');
|
|
29
|
+
const debug = (0, debug_1.default)('cypress:webpack-dev-server:webpack');
|
|
30
30
|
/**
|
|
31
31
|
* @param {ComponentSpec} file spec to create import string from.
|
|
32
32
|
* @param {string} filename name of the spec file - this is the same as file.name
|
|
@@ -67,6 +67,10 @@ function buildSpecs(projectRoot, files = []) {
|
|
|
67
67
|
}
|
|
68
68
|
// Runs the tests inside the iframe
|
|
69
69
|
function loader() {
|
|
70
|
+
// In Webpack 5, a spec added after the dev-server is created won't
|
|
71
|
+
// be included in the compilation. Disabling the caching of this loader ensures
|
|
72
|
+
// we regenerate our specs and include any new ones in the compilation.
|
|
73
|
+
this.cacheable(false);
|
|
70
74
|
const { files, projectRoot, supportFile } = this._cypress;
|
|
71
75
|
const supportFileAbsolutePath = supportFile ? JSON.stringify(path.resolve(projectRoot, supportFile)) : undefined;
|
|
72
76
|
return `
|
|
@@ -37,7 +37,7 @@ const path = __importStar(require("path"));
|
|
|
37
37
|
const webpack_merge_1 = require("webpack-merge");
|
|
38
38
|
const webpack_config_1 = __importDefault(require("./webpack.config"));
|
|
39
39
|
const plugin_1 = __importDefault(require("./plugin"));
|
|
40
|
-
const debug = debug_1.debug('cypress:webpack-dev-server:makeWebpackConfig');
|
|
40
|
+
const debug = (0, debug_1.debug)('cypress:webpack-dev-server:makeWebpackConfig');
|
|
41
41
|
const removeList = ['HtmlWebpackPlugin', 'PreloadPlugin', 'HtmlPwaPlugin'];
|
|
42
42
|
const OsSeparatorRE = RegExp(`\\${path.sep}`, 'g');
|
|
43
43
|
const posixSeparator = '/';
|
|
@@ -86,7 +86,7 @@ function makeWebpackConfig(userWebpackConfig, options) {
|
|
|
86
86
|
return true;
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
-
const mergedConfig = webpack_merge_1.merge(userWebpackConfig, webpack_config_1.default(template), dynamicWebpackConfig);
|
|
89
|
+
const mergedConfig = (0, webpack_merge_1.merge)(userWebpackConfig, (0, webpack_config_1.default)(template), dynamicWebpackConfig);
|
|
90
90
|
mergedConfig.entry = entry;
|
|
91
91
|
debug('Merged webpack config %o', mergedConfig);
|
|
92
92
|
if (process.env.WEBPACK_PERF_MEASURE) {
|
package/dist/plugin.js
CHANGED
|
@@ -35,7 +35,7 @@ class CypressCTOptionsPlugin {
|
|
|
35
35
|
if (!errors || !errors.length) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
this.devServerEvents.emit('dev-server:compile:error', exports.normalizeError(errors[0]));
|
|
38
|
+
this.devServerEvents.emit('dev-server:compile:error', (0, exports.normalizeError)(errors[0]));
|
|
39
39
|
}
|
|
40
40
|
else if (this.errorEmitted) {
|
|
41
41
|
// compilation succeed but assets haven't emitted to the output yet
|
package/dist/startServer.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
/// <reference types="cypress" />
|
|
2
|
+
import webpack from 'webpack';
|
|
2
3
|
import WebpackDevServer from 'webpack-dev-server';
|
|
3
4
|
import { UserWebpackDevServerOptions } from './makeWebpackConfig';
|
|
4
5
|
export interface StartDevServer extends UserWebpackDevServerOptions {
|
|
5
|
-
options: Cypress.
|
|
6
|
-
webpackConfig?:
|
|
6
|
+
options: Cypress.DevServerConfig;
|
|
7
|
+
webpackConfig?: WebpackConfigurationWithDevServer;
|
|
7
8
|
template?: string;
|
|
8
9
|
}
|
|
10
|
+
export interface WebpackConfigurationWithDevServer extends webpack.Configuration {
|
|
11
|
+
devServer?: WebpackDevServer.Configuration;
|
|
12
|
+
}
|
|
9
13
|
export declare function start({ webpackConfig: userWebpackConfig, template, options, ...userOptions }: StartDevServer, exitProcess?: (code?: number | undefined) => never): Promise<WebpackDevServer>;
|
package/dist/startServer.js
CHANGED
|
@@ -29,7 +29,7 @@ const webpack_1 = __importDefault(require("webpack"));
|
|
|
29
29
|
const webpack_dev_server_1 = __importDefault(require("webpack-dev-server"));
|
|
30
30
|
const makeWebpackConfig_1 = require("./makeWebpackConfig");
|
|
31
31
|
const webpackDevServerFacts_1 = require("./webpackDevServerFacts");
|
|
32
|
-
const debug = debug_1.default('cypress:webpack-dev-server:start');
|
|
32
|
+
const debug = (0, debug_1.default)('cypress:webpack-dev-server:start');
|
|
33
33
|
function start(_a, exitProcess = process.exit) {
|
|
34
34
|
var { webpackConfig: userWebpackConfig, template, options } = _a, userOptions = __rest(_a, ["webpackConfig", "template", "options"]);
|
|
35
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -37,11 +37,11 @@ function start(_a, exitProcess = process.exit) {
|
|
|
37
37
|
debug('User did not pass in any webpack configuration');
|
|
38
38
|
}
|
|
39
39
|
const { projectRoot, devServerPublicPathRoute, isTextTerminal } = options.config;
|
|
40
|
-
const webpackConfig = yield makeWebpackConfig_1.makeWebpackConfig(userWebpackConfig || {}, Object.assign({ files: options.specs, template,
|
|
40
|
+
const webpackConfig = yield (0, makeWebpackConfig_1.makeWebpackConfig)(userWebpackConfig || {}, Object.assign({ files: options.specs, template,
|
|
41
41
|
projectRoot,
|
|
42
42
|
devServerPublicPathRoute, devServerEvents: options.devServerEvents, supportFile: options.config.supportFile, isOpenMode: !isTextTerminal }, userOptions));
|
|
43
43
|
debug('compiling webpack');
|
|
44
|
-
const compiler = webpack_1.default(webpackConfig);
|
|
44
|
+
const compiler = (0, webpack_1.default)(webpackConfig);
|
|
45
45
|
// When compiling in run mode
|
|
46
46
|
// Stop the clock early, no need to run all the tests on a failed build
|
|
47
47
|
if (isTextTerminal) {
|
|
@@ -52,13 +52,13 @@ function start(_a, exitProcess = process.exit) {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
debug('starting webpack dev server');
|
|
55
|
-
let webpackDevServerConfig = Object.assign(Object.assign({}, userWebpackConfig === null || userWebpackConfig === void 0 ? void 0 : userWebpackConfig.devServer), { hot: false });
|
|
55
|
+
let webpackDevServerConfig = Object.assign(Object.assign({}, ((userWebpackConfig === null || userWebpackConfig === void 0 ? void 0 : userWebpackConfig.devServer) || {})), { hot: false });
|
|
56
56
|
if (webpackDevServerFacts_1.webpackDevServerFacts.isV3()) {
|
|
57
57
|
debug('using webpack-dev-server v3');
|
|
58
58
|
webpackDevServerConfig = Object.assign(Object.assign({}, webpackDevServerConfig), {
|
|
59
|
-
// @ts-
|
|
59
|
+
// @ts-ignore ignore webpack-dev-server v3 type errors
|
|
60
60
|
inline: false, publicPath: devServerPublicPathRoute, noInfo: false });
|
|
61
|
-
// @ts-
|
|
61
|
+
// @ts-ignore ignore webpack-dev-server v3 type errors
|
|
62
62
|
return new webpack_dev_server_1.default(compiler, webpackDevServerConfig);
|
|
63
63
|
}
|
|
64
64
|
if (webpackDevServerFacts_1.webpackDevServerFacts.isV4()) {
|
|
@@ -66,7 +66,7 @@ function start(_a, exitProcess = process.exit) {
|
|
|
66
66
|
webpackDevServerConfig = Object.assign(Object.assign({ host: 'localhost', port: 'auto' }, userWebpackConfig === null || userWebpackConfig === void 0 ? void 0 : userWebpackConfig.devServer), { devMiddleware: {
|
|
67
67
|
publicPath: devServerPublicPathRoute,
|
|
68
68
|
}, hot: false });
|
|
69
|
-
// @ts-
|
|
69
|
+
// @ts-ignore Webpack types are clashing between Webpack and WebpackDevServer
|
|
70
70
|
return new webpack_dev_server_1.default(webpackDevServerConfig, compiler);
|
|
71
71
|
}
|
|
72
72
|
throw webpackDevServerFacts_1.webpackDevServerFacts.unsupported();
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cypress/webpack-dev-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "Launches Webpack Dev Server for Component Testing",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "tsc",
|
|
8
8
|
"build-prod": "tsc",
|
|
9
|
-
"test": "node ./test-
|
|
9
|
+
"test": "node ./test-deps.js",
|
|
10
10
|
"test-all": "tsc && mocha -r @packages/ts/register test/**/*.spec.ts test/*.spec.ts --exit",
|
|
11
11
|
"watch": "tsc -w"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"debug": "4.3.2",
|
|
14
|
+
"debug": "^4.3.2",
|
|
15
15
|
"semver": "^7.3.4",
|
|
16
16
|
"webpack-merge": "^5.4.0"
|
|
17
17
|
},
|