@cypress/webpack-dev-server 3.3.1 → 3.4.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.
|
@@ -41,9 +41,10 @@ async function generateTsConfig(devServerConfig, buildOptions) {
|
|
|
41
41
|
var _a;
|
|
42
42
|
const { cypressConfig } = devServerConfig;
|
|
43
43
|
const { projectRoot } = cypressConfig;
|
|
44
|
+
const { workspaceRoot = projectRoot } = buildOptions;
|
|
44
45
|
const specPattern = Array.isArray(cypressConfig.specPattern) ? cypressConfig.specPattern : [cypressConfig.specPattern];
|
|
45
|
-
const getProjectFilePath = (...fileParts) => (0, exports.toPosix)(path.join(
|
|
46
|
-
const includePaths = [...specPattern.map((pattern) => getProjectFilePath(pattern))];
|
|
46
|
+
const getProjectFilePath = (...fileParts) => (0, exports.toPosix)(path.join(...fileParts));
|
|
47
|
+
const includePaths = [...specPattern.map((pattern) => getProjectFilePath(projectRoot, pattern))];
|
|
47
48
|
if (cypressConfig.supportFile) {
|
|
48
49
|
includePaths.push((0, exports.toPosix)(cypressConfig.supportFile));
|
|
49
50
|
}
|
|
@@ -51,14 +52,14 @@ async function generateTsConfig(devServerConfig, buildOptions) {
|
|
|
51
52
|
const polyfills = Array.isArray(buildOptions.polyfills)
|
|
52
53
|
? buildOptions.polyfills.filter((p) => { var _a, _b; return ((_a = devServerConfig.options) === null || _a === void 0 ? void 0 : _a.projectConfig.sourceRoot) && p.startsWith((_b = devServerConfig.options) === null || _b === void 0 ? void 0 : _b.projectConfig.sourceRoot); })
|
|
53
54
|
: [buildOptions.polyfills];
|
|
54
|
-
includePaths.push(...polyfills.map((p) => getProjectFilePath(p)));
|
|
55
|
+
includePaths.push(...polyfills.map((p) => getProjectFilePath(workspaceRoot, p)));
|
|
55
56
|
}
|
|
56
|
-
const cypressTypes = getProjectFilePath('node_modules', 'cypress', 'types', 'index.d.ts');
|
|
57
|
+
const cypressTypes = getProjectFilePath(workspaceRoot, 'node_modules', 'cypress', 'types', 'index.d.ts');
|
|
57
58
|
includePaths.push(cypressTypes);
|
|
58
59
|
const tsConfigContent = JSON.stringify({
|
|
59
|
-
extends: getProjectFilePath((_a = buildOptions.tsConfig) !== null && _a !== void 0 ? _a : 'tsconfig.json'),
|
|
60
|
+
extends: getProjectFilePath(projectRoot, (_a = buildOptions.tsConfig) !== null && _a !== void 0 ? _a : 'tsconfig.json'),
|
|
60
61
|
compilerOptions: {
|
|
61
|
-
outDir: getProjectFilePath('out-tsc/cy'),
|
|
62
|
+
outDir: getProjectFilePath(projectRoot, 'out-tsc/cy'),
|
|
62
63
|
allowSyntheticDefaultImports: true,
|
|
63
64
|
skipLibCheck: true,
|
|
64
65
|
},
|
|
@@ -141,7 +142,7 @@ async function getAngularCliWebpackConfig(devServerConfig) {
|
|
|
141
142
|
const projectConfig = ((_a = devServerConfig.options) === null || _a === void 0 ? void 0 : _a.projectConfig) || await getProjectConfig(projectRoot);
|
|
142
143
|
const tsConfig = await generateTsConfig(devServerConfig, projectConfig.buildOptions);
|
|
143
144
|
const buildOptions = getAngularBuildOptions(projectConfig.buildOptions, tsConfig);
|
|
144
|
-
const context = createFakeContext(projectRoot, projectConfig, logging);
|
|
145
|
+
const context = createFakeContext(projectConfig.buildOptions.workspaceRoot || projectRoot, projectConfig, logging);
|
|
145
146
|
const { config } = await generateBrowserWebpackConfigFromContext(buildOptions, context, (wco) => {
|
|
146
147
|
const stylesConfig = getStylesConfig(wco);
|
|
147
148
|
// We modify resolve-url-loader and set `root` to be `projectRoot` + `sourceRoot` to ensure
|
|
@@ -158,9 +159,9 @@ async function getAngularCliWebpackConfig(devServerConfig) {
|
|
|
158
159
|
if (typeof loader !== 'object' || typeof loader.options !== 'object' || !((_a = loader.loader) === null || _a === void 0 ? void 0 : _a.includes('resolve-url-loader'))) {
|
|
159
160
|
return;
|
|
160
161
|
}
|
|
161
|
-
const root = path.join(devServerConfig.cypressConfig.projectRoot, projectConfig.sourceRoot);
|
|
162
|
+
const root = projectConfig.buildOptions.workspaceRoot || path.join(devServerConfig.cypressConfig.projectRoot, projectConfig.sourceRoot);
|
|
162
163
|
debug('Adding root %s to resolve-url-loader options', root);
|
|
163
|
-
loader.options.root =
|
|
164
|
+
loader.options.root = root;
|
|
164
165
|
});
|
|
165
166
|
});
|
|
166
167
|
});
|