@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/CHANGELOG.md DELETED
@@ -1,188 +0,0 @@
1
- # [@cypress/webpack-dev-server-v1.8.4](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.8.3...@cypress/webpack-dev-server-v1.8.4) (2022-03-29)
2
-
3
-
4
- ### Bug Fixes
5
-
6
- * **deps:** add 'lodash' to webpack-dev-server plugin dependencies ([#20815](https://github.com/cypress-io/cypress/issues/20815)) ([a472427](https://github.com/cypress-io/cypress/commit/a4724271601aff110c68ae4364e68764f22cd12c))
7
-
8
- # [@cypress/webpack-dev-server-v1.8.3](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.8.2...@cypress/webpack-dev-server-v1.8.3) (2022-03-15)
9
-
10
-
11
- ### Bug Fixes
12
-
13
- * **webpack-dev-server:** do not encodeUri in loader ([#20575](https://github.com/cypress-io/cypress/issues/20575)) ([1b152fc](https://github.com/cypress-io/cypress/commit/1b152fca1b9ed9894cf7a5b2a964c856f73fc685)), closes [#20593](https://github.com/cypress-io/cypress/issues/20593)
14
-
15
- # [@cypress/webpack-dev-server-v1.8.2](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.8.1...@cypress/webpack-dev-server-v1.8.2) (2022-03-03)
16
-
17
-
18
- ### Bug Fixes
19
-
20
- * avoid nextjs unsafeCache and watchOptions ([#20440](https://github.com/cypress-io/cypress/issues/20440)) ([9f60901](https://github.com/cypress-io/cypress/commit/9f6090170b0675d25b26b98cd0f987a5e395ab78))
21
- * error regression - strip ansi colors out of cy.fixture() error message ([#20335](https://github.com/cypress-io/cypress/issues/20335)) ([e0bd6ac](https://github.com/cypress-io/cypress/commit/e0bd6ac2aaf8d00b9233fffefed8f6ed2484bf45))
22
-
23
- # [@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)
24
-
25
-
26
- ### Bug Fixes
27
-
28
- * 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))
29
-
30
- # [@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)
31
-
32
-
33
- ### Features
34
-
35
- * 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))
36
-
37
- # [@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)
38
-
39
-
40
- ### Features
41
-
42
- * normalized signatures webpack & vite servers ([#18379](https://github.com/cypress-io/cypress/issues/18379)) ([8f5308f](https://github.com/cypress-io/cypress/commit/8f5308f7068b80fb877da539ce34fb67ba497c4f))
43
-
44
- # [@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)
45
-
46
-
47
- ### Features
48
-
49
- * 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))
50
-
51
- # [@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)
52
-
53
-
54
- ### Features
55
-
56
- * support webpack-dev-server v4 ([#17918](https://github.com/cypress-io/cypress/issues/17918)) ([16e4759](https://github.com/cypress-io/cypress/commit/16e4759e0196f68c5f0525efb020211337748f94))
57
-
58
- # [@cypress/webpack-dev-server-v1.4.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.3.1...@cypress/webpack-dev-server-v1.4.0) (2021-06-17)
59
-
60
-
61
- ### Features
62
-
63
- * **npm/webpack-dev-server,runner-ct:** Normalize webpack errors + general React/TS improvements ([#16613](https://github.com/cypress-io/cypress/issues/16613)) ([c0fc23a](https://github.com/cypress-io/cypress/commit/c0fc23a052e53354a8300dd3f783cb161ae161e1))
64
-
65
- # [@cypress/webpack-dev-server-v1.3.1](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.3.0...@cypress/webpack-dev-server-v1.3.1) (2021-05-26)
66
-
67
-
68
- ### Bug Fixes
69
-
70
- * encodeURI to correctly load specs with white space ([#16416](https://github.com/cypress-io/cypress/issues/16416)) ([116fe64](https://github.com/cypress-io/cypress/commit/116fe649d74e54da9dd84bf126f08f4b9162c5d3))
71
- * Properly typecheck webpack-dev-server and fix several undefined issues ([#16503](https://github.com/cypress-io/cypress/issues/16503)) ([4bb1ecd](https://github.com/cypress-io/cypress/commit/4bb1ecd077fc3724e6c127982f98e1e6b0f1bb98))
72
-
73
- # [@cypress/webpack-dev-server-v1.3.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.2.0...@cypress/webpack-dev-server-v1.3.0) (2021-05-13)
74
-
75
-
76
- ### Features
77
-
78
- * support webpack dev server v4 ([#16414](https://github.com/cypress-io/cypress/issues/16414)) ([0cea625](https://github.com/cypress-io/cypress/commit/0cea625f359ef554e87600ef7e7c3afa4e36da4d))
79
-
80
- # [@cypress/webpack-dev-server-v1.2.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.6...@cypress/webpack-dev-server-v1.2.0) (2021-05-11)
81
-
82
-
83
- ### Features
84
-
85
- * exclude html pwa plugin in webpack dev server ([#16388](https://github.com/cypress-io/cypress/issues/16388)) ([14c2292](https://github.com/cypress-io/cypress/commit/14c22929badfe56385260a49336cf29e10902470))
86
-
87
- # [@cypress/webpack-dev-server-v1.1.6](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.5...@cypress/webpack-dev-server-v1.1.6) (2021-04-30)
88
-
89
-
90
- ### Bug Fixes
91
-
92
- * update docs ([#16266](https://github.com/cypress-io/cypress/issues/16266)) ([72e064b](https://github.com/cypress-io/cypress/commit/72e064bd0705ae39830a2be2052534699862551a))
93
-
94
- # [@cypress/webpack-dev-server-v1.1.5](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.4...@cypress/webpack-dev-server-v1.1.5) (2021-04-26)
95
-
96
-
97
- ### Bug Fixes
98
-
99
- * **component-testing:** correct imports for relative paths in cypress.json ([#16056](https://github.com/cypress-io/cypress/issues/16056)) ([10b89f8](https://github.com/cypress-io/cypress/commit/10b89f8d587d331256549c3ab7662f119df7a0f1))
100
- * **webpack-dev-server:** remove hard dependency on html-webpack-plugin v4 ([#16108](https://github.com/cypress-io/cypress/issues/16108)) ([4cfe4b1](https://github.com/cypress-io/cypress/commit/4cfe4b1971c615d615c05ce35b9f7dd5ef8315fc))
101
- * remove lazy-compile-webpack-plugin, make html-webpack-plugin a dependency ([#15954](https://github.com/cypress-io/cypress/issues/15954)) ([19136b6](https://github.com/cypress-io/cypress/commit/19136b6a131cffc31899c754cccce64ce1b4fb87))
102
- * run-ct does not hang on windows anymore ([#16022](https://github.com/cypress-io/cypress/issues/16022)) ([6c12a6c](https://github.com/cypress-io/cypress/commit/6c12a6c7b706ee4f708a9d19c62f18cd0838a433))
103
-
104
- # [@cypress/webpack-dev-server-v1.1.4](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.3...@cypress/webpack-dev-server-v1.1.4) (2021-04-21)
105
-
106
-
107
- ### Bug Fixes
108
-
109
- * **webpack:** allow load custom asset on windows ([#16099](https://github.com/cypress-io/cypress/issues/16099)) ([7340851](https://github.com/cypress-io/cypress/commit/7340851097c792ca0d8d3157c3d803dccdd905d2)), closes [#16097](https://github.com/cypress-io/cypress/issues/16097)
110
-
111
- # [@cypress/webpack-dev-server-v1.1.3](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.2...@cypress/webpack-dev-server-v1.1.3) (2021-04-13)
112
-
113
-
114
- ### Bug Fixes
115
-
116
- * ensure root el mounting exists, remove userland html webpack plugin ([#15870](https://github.com/cypress-io/cypress/issues/15870)) ([726120d](https://github.com/cypress-io/cypress/commit/726120da183cb6d89c83181761d21f09844a9fc2))
117
- * make component testing windows compatible ([#15889](https://github.com/cypress-io/cypress/issues/15889)) ([602c762](https://github.com/cypress-io/cypress/commit/602c762cfd707ae497273ac38206d7f9d8545439))
118
- * remove lazy-compile-webpack-plugin ([#15964](https://github.com/cypress-io/cypress/issues/15964)) ([dcf3b14](https://github.com/cypress-io/cypress/commit/dcf3b14f3668cba8e19cf4eecd80db0c726f4248))
119
- * **webpack-dev-server:** remove output.publicPath from webpack-dev-server ([#15839](https://github.com/cypress-io/cypress/issues/15839)) ([8e894a0](https://github.com/cypress-io/cypress/commit/8e894a0fdb899be8dd8993319c9297ea73c10321))
120
-
121
-
122
- ### Reverts
123
-
124
- * Revert "fix: ensure root el mounting exists, remove userland html webpack plugin (#15870)" (#15949) ([1d271ea](https://github.com/cypress-io/cypress/commit/1d271ea209c9d5116d61ed9b147a75eda6a61210)), closes [#15870](https://github.com/cypress-io/cypress/issues/15870) [#15949](https://github.com/cypress-io/cypress/issues/15949)
125
-
126
- # [@cypress/webpack-dev-server-v1.1.2](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.1...@cypress/webpack-dev-server-v1.1.2) (2021-04-06)
127
-
128
-
129
- ### Bug Fixes
130
-
131
- * **component-testing:** Correctly specify @cypress/webpack-dev-server peerDependencies ([#15820](https://github.com/cypress-io/cypress/issues/15820)) ([519b29c](https://github.com/cypress-io/cypress/commit/519b29cb897af59b84dc2f35752f785985348f2d))
132
-
133
- # [@cypress/webpack-dev-server-v1.1.1](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.0...@cypress/webpack-dev-server-v1.1.1) (2021-04-05)
134
-
135
-
136
- ### Bug Fixes
137
-
138
- * **@cypress/react:** Devtools unpredictable resets ([#15612](https://github.com/cypress-io/cypress/issues/15612)) ([b1f831a](https://github.com/cypress-io/cypress/commit/b1f831a86a8bcc6646067bc8a9e67871026ff575)), closes [#15634](https://github.com/cypress-io/cypress/issues/15634)
139
- * **component-testing:** Fix webpack-dev-server deps validation crash ([#15708](https://github.com/cypress-io/cypress/issues/15708)) ([254eb47](https://github.com/cypress-io/cypress/commit/254eb47d91c75a9f56162e7493ab83e5be169935))
140
-
141
- # [@cypress/webpack-dev-server-v1.1.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.0.4...@cypress/webpack-dev-server-v1.1.0) (2021-03-15)
142
-
143
-
144
- ### Bug Fixes
145
-
146
- * **@cypress/react:** Correctly unmount react components ([#15250](https://github.com/cypress-io/cypress/issues/15250)) ([6b515c7](https://github.com/cypress-io/cypress/commit/6b515c777ca2fa599f21dc47d181fd28a7eb6db0))
147
-
148
-
149
- ### Features
150
-
151
- * Use lazy compilation for webpack-dev-server by default ([#15158](https://github.com/cypress-io/cypress/issues/15158)) ([f237050](https://github.com/cypress-io/cypress/commit/f237050fdb49e4e59c07a70bb178d88d0e7387a8))
152
- * webpack stop early when error in run mode ([4ec655b](https://github.com/cypress-io/cypress/commit/4ec655b784ff5f961f1d7ce371c5953d9116c576))
153
-
154
- # [@cypress/webpack-dev-server-v1.0.4](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.0.3...@cypress/webpack-dev-server-v1.0.4) (2021-03-10)
155
-
156
-
157
- ### Bug Fixes
158
-
159
- * trigger release of the packages ([#15405](https://github.com/cypress-io/cypress/issues/15405)) ([1ce5755](https://github.com/cypress-io/cypress/commit/1ce57554e260850472cf753de68858f47b3f7b3d))
160
-
161
- # [@cypress/webpack-dev-server-v1.0.3](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.0.2...@cypress/webpack-dev-server-v1.0.3) (2021-02-18)
162
-
163
-
164
- ### Bug Fixes
165
-
166
- * missing index-template.html from package.json deps for webpack-dev-server ([#15151](https://github.com/cypress-io/cypress/issues/15151)) ([36b0440](https://github.com/cypress-io/cypress/commit/36b0440b663c6a0075d23d8d23ae14d47de297c8))
167
-
168
- # [@cypress/webpack-dev-server-v1.0.2](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.0.1...@cypress/webpack-dev-server-v1.0.2) (2021-02-18)
169
-
170
-
171
- ### Bug Fixes
172
-
173
- * add webpack-dev-server to peerDependencies, improve peerDependency error handling, fix index-template.html path ([#15149](https://github.com/cypress-io/cypress/issues/15149)) ([2863e33](https://github.com/cypress-io/cypress/commit/2863e338920362cbb1ecf20c2fab28fbd3a52c33))
174
-
175
- # [@cypress/webpack-dev-server-v1.0.1](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.0.0...@cypress/webpack-dev-server-v1.0.1) (2021-02-17)
176
-
177
-
178
- ### Bug Fixes
179
-
180
- * add a trivial change to trigger semantic release ([#15127](https://github.com/cypress-io/cypress/issues/15127)) ([fb7540e](https://github.com/cypress-io/cypress/commit/fb7540e99d56e0cff89aaf2fe76065b9815bdbec))
181
- * trigger semantic release ([#15128](https://github.com/cypress-io/cypress/issues/15128)) ([3a6f3b1](https://github.com/cypress-io/cypress/commit/3a6f3b1928277f7086062b1107f424e5a0247e00))
182
-
183
- # @cypress/webpack-dev-server-v1.0.0 (2021-02-16)
184
-
185
-
186
- ### Features
187
-
188
- * component testing ([#14479](https://github.com/cypress-io/cypress/issues/14479)) ([af26fbe](https://github.com/cypress-io/cypress/commit/af26fbebe6bc609132013a0493a116cc78bb1bd4))
package/dist/plugin.d.ts DELETED
@@ -1,45 +0,0 @@
1
- /// <reference types="cypress" />
2
- /// <reference types="node" />
3
- import { Compiler } from 'webpack';
4
- import { EventEmitter } from 'events';
5
- import { PathLike } from 'fs';
6
- import type { Compilation } from 'webpack';
7
- declare type UtimesSync = (path: PathLike, atime: string | number | Date, mtime: string | number | Date) => void;
8
- export interface CypressCTOptionsPluginOptions {
9
- files: Cypress.Cypress['spec'][];
10
- projectRoot: string;
11
- supportFile: string;
12
- devServerEvents?: EventEmitter;
13
- }
14
- export declare type CypressCTOptionsPluginOptionsWithEmitter = CypressCTOptionsPluginOptions & {
15
- devServerEvents: EventEmitter;
16
- };
17
- export interface CypressCTWebpackContext {
18
- _cypress: CypressCTOptionsPluginOptions;
19
- }
20
- export declare type Webpack45Compilation = Compilation & {
21
- inputFileSystem: {
22
- fileSystem: {
23
- utimesSync: UtimesSync;
24
- };
25
- };
26
- };
27
- export declare const normalizeError: (error: Error | string) => string;
28
- export default class CypressCTOptionsPlugin {
29
- private files;
30
- private supportFile;
31
- private errorEmitted;
32
- private readonly projectRoot;
33
- private readonly devServerEvents;
34
- constructor(options: CypressCTOptionsPluginOptionsWithEmitter);
35
- private pluginFunc;
36
- private setupCustomHMR;
37
- /**
38
- *
39
- * @param compilation webpack 4 `compilation.Compilation`, webpack 5
40
- * `Compilation`
41
- */
42
- private plugin;
43
- apply(compiler: Compiler): void;
44
- }
45
- export {};
package/dist/plugin.js DELETED
@@ -1,84 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.normalizeError = void 0;
7
- const webpack_1 = __importDefault(require("webpack"));
8
- const lodash_1 = __importDefault(require("lodash"));
9
- const semver_1 = __importDefault(require("semver"));
10
- const fs_1 = __importDefault(require("fs"));
11
- const path_1 = __importDefault(require("path"));
12
- const normalizeError = (error) => {
13
- return typeof error === 'string' ? error : error.message;
14
- };
15
- exports.normalizeError = normalizeError;
16
- class CypressCTOptionsPlugin {
17
- constructor(options) {
18
- this.files = [];
19
- this.errorEmitted = false;
20
- this.pluginFunc = (context) => {
21
- context._cypress = {
22
- files: this.files,
23
- projectRoot: this.projectRoot,
24
- supportFile: this.supportFile,
25
- };
26
- };
27
- this.setupCustomHMR = (compiler) => {
28
- compiler.hooks.afterCompile.tap('CypressCTOptionsPlugin', (compilation) => {
29
- const stats = compilation.getStats();
30
- if (stats.hasErrors()) {
31
- this.errorEmitted = true;
32
- // webpack 4: string[]
33
- // webpack 5: Error[]
34
- const errors = stats.toJson().errors;
35
- if (!errors || !errors.length) {
36
- return;
37
- }
38
- this.devServerEvents.emit('dev-server:compile:error', (0, exports.normalizeError)(errors[0]));
39
- }
40
- else if (this.errorEmitted) {
41
- // compilation succeed but assets haven't emitted to the output yet
42
- this.devServerEvents.emit('dev-server:compile:error', null);
43
- }
44
- });
45
- compiler.hooks.afterEmit.tap('CypressCTOptionsPlugin', (compilation) => {
46
- if (!compilation.getStats().hasErrors()) {
47
- this.devServerEvents.emit('dev-server:compile:success');
48
- }
49
- });
50
- };
51
- /**
52
- *
53
- * @param compilation webpack 4 `compilation.Compilation`, webpack 5
54
- * `Compilation`
55
- */
56
- this.plugin = (compilation) => {
57
- this.devServerEvents.on('dev-server:specs:changed', (specs) => {
58
- if (lodash_1.default.isEqual(specs, this.files))
59
- return;
60
- this.files = specs;
61
- const inputFileSystem = compilation.inputFileSystem;
62
- const utimesSync = semver_1.default.gt('4.0.0', webpack_1.default.version) ? inputFileSystem.fileSystem.utimesSync : fs_1.default.utimesSync;
63
- utimesSync(path_1.default.resolve(__dirname, 'browser.js'), new Date(), new Date());
64
- });
65
- // Webpack 5
66
- /* istanbul ignore next */
67
- if ('NormalModule' in webpack_1.default) {
68
- webpack_1.default.NormalModule.getCompilationHooks(compilation).loader.tap('CypressCTOptionsPlugin', (context) => this.pluginFunc(context));
69
- return;
70
- }
71
- // Webpack 4
72
- compilation.hooks.normalModuleLoader.tap('CypressCTOptionsPlugin', (context) => this.pluginFunc(context));
73
- };
74
- this.files = options.files;
75
- this.supportFile = options.supportFile;
76
- this.projectRoot = options.projectRoot;
77
- this.devServerEvents = options.devServerEvents;
78
- }
79
- apply(compiler) {
80
- this.setupCustomHMR(compiler);
81
- compiler.hooks.compilation.tap('CypressCTOptionsPlugin', (compilation) => this.plugin(compilation));
82
- }
83
- }
84
- exports.default = CypressCTOptionsPlugin;
@@ -1,13 +0,0 @@
1
- /// <reference types="cypress" />
2
- import webpack from 'webpack';
3
- import WebpackDevServer from 'webpack-dev-server';
4
- import { UserWebpackDevServerOptions } from './makeWebpackConfig';
5
- export interface StartDevServer extends UserWebpackDevServerOptions {
6
- options: Cypress.DevServerConfig;
7
- webpackConfig?: WebpackConfigurationWithDevServer;
8
- template?: string;
9
- }
10
- export interface WebpackConfigurationWithDevServer extends webpack.Configuration {
11
- devServer?: WebpackDevServer.Configuration;
12
- }
13
- export declare function start({ webpackConfig: userWebpackConfig, template, options, ...userOptions }: StartDevServer, exitProcess?: (code?: number | undefined) => never): Promise<WebpackDevServer>;
@@ -1,75 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __rest = (this && this.__rest) || function (s, e) {
12
- var t = {};
13
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
- t[p] = s[p];
15
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
- t[p[i]] = s[p[i]];
19
- }
20
- return t;
21
- };
22
- var __importDefault = (this && this.__importDefault) || function (mod) {
23
- return (mod && mod.__esModule) ? mod : { "default": mod };
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.start = void 0;
27
- const debug_1 = __importDefault(require("debug"));
28
- const webpack_1 = __importDefault(require("webpack"));
29
- const webpack_dev_server_1 = __importDefault(require("webpack-dev-server"));
30
- const makeWebpackConfig_1 = require("./makeWebpackConfig");
31
- const webpackDevServerFacts_1 = require("./webpackDevServerFacts");
32
- const debug = (0, debug_1.default)('cypress:webpack-dev-server:start');
33
- function start(_a, exitProcess = process.exit) {
34
- var { webpackConfig: userWebpackConfig, template, options } = _a, userOptions = __rest(_a, ["webpackConfig", "template", "options"]);
35
- return __awaiter(this, void 0, void 0, function* () {
36
- if (!userWebpackConfig) {
37
- debug('User did not pass in any webpack configuration');
38
- }
39
- const { projectRoot, devServerPublicPathRoute, isTextTerminal } = options.config;
40
- const webpackConfig = yield (0, makeWebpackConfig_1.makeWebpackConfig)(userWebpackConfig || {}, Object.assign({ files: options.specs, template,
41
- projectRoot,
42
- devServerPublicPathRoute, devServerEvents: options.devServerEvents, supportFile: options.config.supportFile, isOpenMode: !isTextTerminal }, userOptions));
43
- debug('compiling webpack');
44
- const compiler = (0, webpack_1.default)(webpackConfig);
45
- // When compiling in run mode
46
- // Stop the clock early, no need to run all the tests on a failed build
47
- if (isTextTerminal) {
48
- compiler.hooks.done.tap('cyCustomErrorBuild', function (stats) {
49
- if (stats.hasErrors()) {
50
- exitProcess(1);
51
- }
52
- });
53
- }
54
- debug('starting webpack dev server');
55
- let webpackDevServerConfig = Object.assign(Object.assign({}, ((userWebpackConfig === null || userWebpackConfig === void 0 ? void 0 : userWebpackConfig.devServer) || {})), { hot: false });
56
- if (webpackDevServerFacts_1.webpackDevServerFacts.isV3()) {
57
- debug('using webpack-dev-server v3');
58
- webpackDevServerConfig = Object.assign(Object.assign({}, webpackDevServerConfig), {
59
- // @ts-ignore ignore webpack-dev-server v3 type errors
60
- inline: false, publicPath: devServerPublicPathRoute, noInfo: false });
61
- // @ts-ignore ignore webpack-dev-server v3 type errors
62
- return new webpack_dev_server_1.default(compiler, webpackDevServerConfig);
63
- }
64
- if (webpackDevServerFacts_1.webpackDevServerFacts.isV4()) {
65
- debug('using webpack-dev-server v4');
66
- webpackDevServerConfig = Object.assign(Object.assign({ host: 'localhost', port: 'auto' }, userWebpackConfig === null || userWebpackConfig === void 0 ? void 0 : userWebpackConfig.devServer), { devMiddleware: {
67
- publicPath: devServerPublicPathRoute,
68
- }, hot: false });
69
- // @ts-ignore Webpack types are clashing between Webpack and WebpackDevServer
70
- return new webpack_dev_server_1.default(webpackDevServerConfig, compiler);
71
- }
72
- throw webpackDevServerFacts_1.webpackDevServerFacts.unsupported();
73
- });
74
- }
75
- exports.start = start;
@@ -1,2 +0,0 @@
1
- declare function _exports(template?: string | undefined): import('webpack').Configuration;
2
- export = _exports;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- const path = require('path');
3
- const HtmlWebpackPlugin = require('html-webpack-plugin');
4
- /**
5
- * @param {string} [template] - base template to use
6
- * @returns {import('webpack').Configuration}
7
- */
8
- module.exports = function makeDefaultConfig(template) {
9
- return {
10
- mode: 'development',
11
- optimization: {
12
- splitChunks: {
13
- chunks: 'all',
14
- },
15
- },
16
- output: {
17
- filename: '[name].js',
18
- path: path.resolve(__dirname, 'dist'),
19
- },
20
- plugins: [new HtmlWebpackPlugin({
21
- template: template || path.resolve(__dirname, '..', 'index-template.html'),
22
- })],
23
- };
24
- };
@@ -1,6 +0,0 @@
1
- export declare const webpackDevServerFacts: {
2
- version: string;
3
- isV3(version?: string): boolean;
4
- isV4(version?: string): boolean;
5
- unsupported(): Error;
6
- };
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.webpackDevServerFacts = void 0;
7
- const package_json_1 = __importDefault(require("webpack-dev-server/package.json"));
8
- exports.webpackDevServerFacts = {
9
- version: package_json_1.default.version,
10
- isV3(version = package_json_1.default.version) {
11
- return /^3\./.test(version);
12
- },
13
- isV4(version = package_json_1.default.version) {
14
- return /^4\./.test(version);
15
- },
16
- unsupported() {
17
- return Error(`@cypress/webpack-dev-server only supports webpack-dev-server v3 and v4. Found: ${exports.webpackDevServerFacts.version}.`);
18
- },
19
- };
@@ -1,12 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <meta name="viewport" content="width=device-width,initial-scale=1.0">
7
- <title>Components App</title>
8
- </head>
9
- <body>
10
- <div id="__cy_root"></div>
11
- </body>
12
- </html>