@nx/cypress 23.0.0-beta.2 → 23.0.0-beta.20

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 (147) hide show
  1. package/{index.d.ts → dist/index.d.ts} +0 -1
  2. package/dist/internal.d.ts +5 -0
  3. package/dist/internal.js +12 -0
  4. package/{plugin.d.ts → dist/plugin.d.ts} +0 -1
  5. package/{plugins → dist/plugins}/cypress-preset.d.ts +0 -1
  6. package/{plugins → dist/plugins}/cypress-preset.js +15 -5
  7. package/{src → dist/src}/executors/cypress/cypress.impl.d.ts +0 -1
  8. package/{src → dist/src}/executors/cypress/cypress.impl.js +2 -0
  9. package/{src → dist/src}/executors/cypress/schema.json +1 -0
  10. package/{src → dist/src}/generators/base-setup/base-setup.d.ts +0 -1
  11. package/{src → dist/src}/generators/base-setup/base-setup.js +5 -19
  12. package/dist/src/generators/base-setup/files/config-ts-cjs/cypress.config.ts__ext__ +3 -0
  13. package/dist/src/generators/base-setup/files/config-ts-esm/__directory__/support/commands.ts__ext__ +35 -0
  14. package/{src → dist/src}/generators/component-configuration/component-configuration.d.ts +0 -1
  15. package/{src → dist/src}/generators/component-configuration/component-configuration.js +25 -22
  16. package/{src → dist/src}/generators/configuration/configuration.d.ts +0 -1
  17. package/{src → dist/src}/generators/configuration/configuration.js +12 -11
  18. package/{src → dist/src}/generators/convert-to-inferred/convert-to-inferred.d.ts +0 -1
  19. package/{src → dist/src}/generators/convert-to-inferred/convert-to-inferred.js +7 -6
  20. package/{src → dist/src}/generators/convert-to-inferred/lib/add-dev-server-target-to-config.d.ts +0 -1
  21. package/{src → dist/src}/generators/convert-to-inferred/lib/add-exclude-spec-pattern.d.ts +0 -1
  22. package/{src → dist/src}/generators/convert-to-inferred/lib/target-options-map.d.ts +0 -1
  23. package/{src → dist/src}/generators/convert-to-inferred/lib/upsert-baseUrl.d.ts +0 -1
  24. package/{src → dist/src}/generators/init/init.d.ts +0 -1
  25. package/{src → dist/src}/generators/init/init.js +24 -11
  26. package/{src → dist/src}/generators/init/schema.json +1 -1
  27. package/{src → dist/src}/generators/migrate-to-cypress-11/conversion.util.d.ts +0 -1
  28. package/{src → dist/src}/generators/migrate-to-cypress-11/conversion.util.js +5 -6
  29. package/{src → dist/src}/generators/migrate-to-cypress-11/migrate-to-cypress-11.d.ts +0 -1
  30. package/{src → dist/src}/generators/migrate-to-cypress-11/migrate-to-cypress-11.js +3 -3
  31. package/{src → dist/src}/migrations/update-20-8-0/remove-experimental-fetch-polyfill.d.ts +0 -1
  32. package/{src → dist/src}/migrations/update-20-8-0/remove-experimental-fetch-polyfill.js +2 -2
  33. package/{src → dist/src}/migrations/update-20-8-0/replace-experimental-just-in-time-compile.d.ts +0 -1
  34. package/{src → dist/src}/migrations/update-20-8-0/replace-experimental-just-in-time-compile.js +4 -4
  35. package/{src → dist/src}/migrations/update-20-8-0/set-inject-document-domain.d.ts +0 -1
  36. package/{src → dist/src}/migrations/update-20-8-0/set-inject-document-domain.js +2 -2
  37. package/{src → dist/src}/migrations/update-20-8-0/update-component-testing-mount-imports.d.ts +0 -1
  38. package/{src → dist/src}/migrations/update-20-8-0/update-component-testing-mount-imports.js +2 -2
  39. package/dist/src/migrations/update-21-0-0/remove-tsconfig-and-copy-files-options-from-cypress-executor.d.ts +2 -0
  40. package/{src → dist/src}/migrations/update-21-0-0/remove-tsconfig-and-copy-files-options-from-cypress-executor.js +29 -17
  41. package/{src → dist/src}/migrations/update-22-1-0/rename-cy-exec-code-property.d.ts +0 -1
  42. package/{src → dist/src}/migrations/update-22-1-0/rename-cy-exec-code-property.js +4 -4
  43. package/{src → dist/src}/migrations/update-22-1-0/update-angular-component-testing-support.d.ts +0 -1
  44. package/{src → dist/src}/migrations/update-22-1-0/update-angular-component-testing-support.js +4 -4
  45. package/{src → dist/src}/migrations/update-22-1-0/update-selector-playground-api.d.ts +0 -1
  46. package/{src → dist/src}/migrations/update-22-1-0/update-selector-playground-api.js +3 -3
  47. package/dist/src/migrations/update-23-0-0/remove-experimental-prompt-command.d.ts +2 -0
  48. package/dist/src/migrations/update-23-0-0/remove-experimental-prompt-command.js +47 -0
  49. package/dist/src/migrations/update-23-0-0/rewrite-internal-subpath-imports.d.ts +3 -0
  50. package/dist/src/migrations/update-23-0-0/rewrite-internal-subpath-imports.js +199 -0
  51. package/{src → dist/src}/plugins/plugin.d.ts +0 -1
  52. package/{src → dist/src}/plugins/plugin.js +88 -40
  53. package/{src → dist/src}/plugins/preprocessor-vite.d.ts +0 -1
  54. package/{src → dist/src}/utils/add-linter.d.ts +0 -1
  55. package/{src → dist/src}/utils/add-linter.js +16 -18
  56. package/dist/src/utils/assert-supported-cypress-version.d.ts +2 -0
  57. package/dist/src/utils/assert-supported-cypress-version.js +8 -0
  58. package/{src → dist/src}/utils/config.d.ts +10 -5
  59. package/{src → dist/src}/utils/config.js +52 -48
  60. package/{src → dist/src}/utils/constants.d.ts +0 -1
  61. package/{src → dist/src}/utils/ct-helpers.d.ts +0 -1
  62. package/dist/src/utils/deprecation.d.ts +3 -0
  63. package/dist/src/utils/deprecation.js +20 -0
  64. package/{src → dist/src}/utils/find-target-options.d.ts +0 -1
  65. package/{src → dist/src}/utils/migrations.d.ts +0 -1
  66. package/{src → dist/src}/utils/migrations.js +4 -4
  67. package/{src → dist/src}/utils/project-name.d.ts +0 -1
  68. package/{src → dist/src}/utils/start-dev-server.d.ts +0 -1
  69. package/{src → dist/src}/utils/versions.d.ts +5 -5
  70. package/{src → dist/src}/utils/versions.js +14 -51
  71. package/executors.json +2 -2
  72. package/generators.json +10 -10
  73. package/migrations.json +45 -8
  74. package/package.json +59 -12
  75. package/index.d.ts.map +0 -1
  76. package/plugin.d.ts.map +0 -1
  77. package/plugins/cypress-preset.d.ts.map +0 -1
  78. package/src/executors/cypress/cypress.impl.d.ts.map +0 -1
  79. package/src/generators/base-setup/base-setup.d.ts.map +0 -1
  80. package/src/generators/component-configuration/component-configuration.d.ts.map +0 -1
  81. package/src/generators/configuration/configuration.d.ts.map +0 -1
  82. package/src/generators/convert-to-inferred/convert-to-inferred.d.ts.map +0 -1
  83. package/src/generators/convert-to-inferred/lib/add-dev-server-target-to-config.d.ts.map +0 -1
  84. package/src/generators/convert-to-inferred/lib/add-exclude-spec-pattern.d.ts.map +0 -1
  85. package/src/generators/convert-to-inferred/lib/target-options-map.d.ts.map +0 -1
  86. package/src/generators/convert-to-inferred/lib/upsert-baseUrl.d.ts.map +0 -1
  87. package/src/generators/init/init.d.ts.map +0 -1
  88. package/src/generators/migrate-to-cypress-11/conversion.util.d.ts.map +0 -1
  89. package/src/generators/migrate-to-cypress-11/migrate-to-cypress-11.d.ts.map +0 -1
  90. package/src/migrations/update-20-8-0/remove-experimental-fetch-polyfill.d.ts.map +0 -1
  91. package/src/migrations/update-20-8-0/replace-experimental-just-in-time-compile.d.ts.map +0 -1
  92. package/src/migrations/update-20-8-0/set-inject-document-domain.d.ts.map +0 -1
  93. package/src/migrations/update-20-8-0/update-component-testing-mount-imports.d.ts.map +0 -1
  94. package/src/migrations/update-21-0-0/remove-tsconfig-and-copy-files-options-from-cypress-executor.d.ts +0 -3
  95. package/src/migrations/update-21-0-0/remove-tsconfig-and-copy-files-options-from-cypress-executor.d.ts.map +0 -1
  96. package/src/migrations/update-22-1-0/rename-cy-exec-code-property.d.ts.map +0 -1
  97. package/src/migrations/update-22-1-0/update-angular-component-testing-support.d.ts.map +0 -1
  98. package/src/migrations/update-22-1-0/update-selector-playground-api.d.ts.map +0 -1
  99. package/src/plugins/plugin.d.ts.map +0 -1
  100. package/src/plugins/preprocessor-vite.d.ts.map +0 -1
  101. package/src/utils/add-linter.d.ts.map +0 -1
  102. package/src/utils/config.d.ts.map +0 -1
  103. package/src/utils/constants.d.ts.map +0 -1
  104. package/src/utils/ct-helpers.d.ts.map +0 -1
  105. package/src/utils/cypress-version.d.ts +0 -12
  106. package/src/utils/cypress-version.d.ts.map +0 -1
  107. package/src/utils/cypress-version.js +0 -38
  108. package/src/utils/find-target-options.d.ts.map +0 -1
  109. package/src/utils/migrations.d.ts.map +0 -1
  110. package/src/utils/project-name.d.ts.map +0 -1
  111. package/src/utils/start-dev-server.d.ts.map +0 -1
  112. package/src/utils/versions.d.ts.map +0 -1
  113. /package/{LICENSE → dist/LICENSE} +0 -0
  114. /package/{PLUGIN.md → dist/PLUGIN.md} +0 -0
  115. /package/{index.js → dist/index.js} +0 -0
  116. /package/{plugin.js → dist/plugin.js} +0 -0
  117. /package/{src → dist/src}/generators/base-setup/files/common/__directory__/fixtures/example.json +0 -0
  118. /package/{src → dist/src}/generators/base-setup/files/common/__directory__/support/commands.ts__ext__ +0 -0
  119. /package/{src → dist/src}/generators/base-setup/files/config-js-cjs/__directory__/support/commands.js__ext__ +0 -0
  120. /package/{src → dist/src}/generators/base-setup/files/config-js-cjs/cypress.config.js__ext__ +0 -0
  121. /package/{src → dist/src}/generators/base-setup/files/config-js-esm/__directory__/support/commands.js__ext__ +0 -0
  122. /package/{src → dist/src}/generators/base-setup/files/config-js-esm/cypress.config.js__ext__ +0 -0
  123. /package/{src/generators/base-setup/files/config-ts → dist/src/generators/base-setup/files/config-ts-cjs}/__directory__/support/commands.ts__ext__ +0 -0
  124. /package/{src/generators/base-setup/files/config-ts → dist/src/generators/base-setup/files/config-ts-esm}/cypress.config.ts__ext__ +0 -0
  125. /package/{src → dist/src}/generators/base-setup/files/tsconfig/non-ts-solution/__directory__/tsconfig.json__ext__ +0 -0
  126. /package/{src → dist/src}/generators/base-setup/files/tsconfig/ts-solution/__directory__/tsconfig.json__ext__ +0 -0
  127. /package/{src → dist/src}/generators/component-configuration/files/__directory__/support/component-index.html +0 -0
  128. /package/{src → dist/src}/generators/component-configuration/files/__directory__/support/component.ts__ext__ +0 -0
  129. /package/{src → dist/src}/generators/component-configuration/schema.d.ts +0 -0
  130. /package/{src → dist/src}/generators/component-configuration/schema.json +0 -0
  131. /package/{src → dist/src}/generators/configuration/files/__directory__/e2e/app.cy.ts__tmpl__ +0 -0
  132. /package/{src → dist/src}/generators/configuration/files/__directory__/support/app.po.ts__tmpl__ +0 -0
  133. /package/{src → dist/src}/generators/configuration/files/__directory__/support/e2e.ts__tmpl__ +0 -0
  134. /package/{src → dist/src}/generators/configuration/schema.json +0 -0
  135. /package/{src → dist/src}/generators/convert-to-inferred/lib/add-dev-server-target-to-config.js +0 -0
  136. /package/{src → dist/src}/generators/convert-to-inferred/lib/add-exclude-spec-pattern.js +0 -0
  137. /package/{src → dist/src}/generators/convert-to-inferred/lib/target-options-map.js +0 -0
  138. /package/{src → dist/src}/generators/convert-to-inferred/lib/upsert-baseUrl.js +0 -0
  139. /package/{src → dist/src}/generators/convert-to-inferred/schema.json +0 -0
  140. /package/{src → dist/src}/generators/init/schema.d.ts +0 -0
  141. /package/{src → dist/src}/generators/migrate-to-cypress-11/schema.json +0 -0
  142. /package/{src → dist/src}/plugins/preprocessor-vite.js +0 -0
  143. /package/{src → dist/src}/utils/constants.js +0 -0
  144. /package/{src → dist/src}/utils/ct-helpers.js +0 -0
  145. /package/{src → dist/src}/utils/find-target-options.js +0 -0
  146. /package/{src → dist/src}/utils/project-name.js +0 -0
  147. /package/{src → dist/src}/utils/start-dev-server.js +0 -0
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createNodesV2 = exports.createNodes = void 0;
4
+ const internal_1 = require("@nx/devkit/internal");
4
5
  const devkit_1 = require("@nx/devkit");
5
- const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
6
- const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
7
- const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
8
6
  const js_1 = require("@nx/js");
9
7
  const fs_1 = require("fs");
10
8
  const devkit_internals_1 = require("nx/src/devkit-internals");
@@ -30,28 +28,42 @@ exports.createNodes = [
30
28
  const optionsHash = (0, devkit_internals_1.hashObject)(options);
31
29
  const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `cypress-${optionsHash}.hash`);
32
30
  const pluginCache = new plugin_cache_utils_1.PluginCache(cachePath);
33
- const pmc = (0, devkit_1.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(context.workspaceRoot));
31
+ const packageManager = (0, devkit_1.detectPackageManager)(context.workspaceRoot);
32
+ const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
33
+ const lockFileName = (0, js_1.getLockFileName)(packageManager);
34
+ const normalizedOptions = normalizeOptions(options);
34
35
  try {
35
- return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, pluginCache, pmc), configFiles, options, context);
36
+ const { entries, preErrors } = await filterCypressConfigs(configFiles, context);
37
+ const projectHashes = await (0, internal_1.calculateHashesForCreateNodes)(entries.map((e) => e.projectRoot), normalizedOptions, context, entries.map(() => [lockFileName]));
38
+ let results = [];
39
+ let nodeErrors = [];
40
+ try {
41
+ results = await (0, devkit_1.createNodesFromFiles)((configFile, _, ctx, idx) => createNodesInternal(configFile, normalizedOptions, ctx, pluginCache, pmc, projectHashes[idx]), entries.map((e) => e.configFile), options, context);
42
+ }
43
+ catch (e) {
44
+ if (e instanceof devkit_1.AggregateCreateNodesError) {
45
+ results = e.partialResults ?? [];
46
+ nodeErrors = e.errors;
47
+ }
48
+ else {
49
+ throw e;
50
+ }
51
+ }
52
+ const allErrors = [...preErrors, ...nodeErrors];
53
+ if (allErrors.length > 0) {
54
+ throw new devkit_1.AggregateCreateNodesError(allErrors, results);
55
+ }
56
+ return results;
36
57
  }
37
58
  finally {
38
- pluginCache.writeToDisk(cachePath);
59
+ pluginCache.writeToDisk();
39
60
  }
40
61
  },
41
62
  ];
42
63
  exports.createNodesV2 = exports.createNodes;
43
- async function createNodesInternal(configFilePath, options, context, pluginCache, pmc) {
44
- options = normalizeOptions(options);
64
+ async function createNodesInternal(configFilePath, options, context, pluginCache, pmc, projectHash) {
45
65
  const projectRoot = (0, path_1.dirname)(configFilePath);
46
- // Do not create a project if package.json and project.json isn't there.
47
- const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
48
- if (!siblingFiles.includes('package.json') &&
49
- !siblingFiles.includes('project.json')) {
50
- return {};
51
- }
52
- const hash = (await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [
53
- (0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot)),
54
- ])) + configFilePath;
66
+ const hash = projectHash + configFilePath;
55
67
  if (!pluginCache.has(hash)) {
56
68
  pluginCache.set(hash, await buildCypressTargets(configFilePath, projectRoot, options, context, pmc));
57
69
  }
@@ -70,47 +82,63 @@ async function createNodesInternal(configFilePath, options, context, pluginCache
70
82
  function getTargetOutputs(outputs, subfolder) {
71
83
  return outputs.map((output) => subfolder ? (0, path_1.join)(output, subfolder) : output);
72
84
  }
73
- function getTargetConfig(cypressConfig, outputSubfolder, ciBaseUrl) {
85
+ // Normalize a Cypress config folder (e.g. videosFolder, screenshotsFolder) to a
86
+ // project-root-relative path, then append the per-spec subfolder. Cypress
87
+ // resolves relative folders against the project root (cwd), so this keeps the
88
+ // path Cypress writes to in lockstep with what Nx declares as the target's
89
+ // outputs — regardless of whether the user wrote a relative path or computed
90
+ // an absolute one (e.g. via `path.resolve` / `__dirname`).
91
+ function serializeConfigPath(configPath, projectRoot, workspaceRoot, outputSubfolder) {
92
+ if (!configPath) {
93
+ return configPath;
94
+ }
95
+ const fullProjectRoot = (0, path_1.resolve)(workspaceRoot, projectRoot);
96
+ const fullConfigPath = (0, path_1.resolve)(fullProjectRoot, configPath);
97
+ const relativeConfigPath = (0, devkit_1.normalizePath)((0, path_1.relative)(fullProjectRoot, fullConfigPath));
98
+ return (0, devkit_1.normalizePath)((0, path_1.join)(relativeConfigPath, outputSubfolder));
99
+ }
100
+ function getTargetConfig(cypressConfig, projectRoot, workspaceRoot, outputSubfolder, ciBaseUrl) {
74
101
  const config = {};
75
102
  if (ciBaseUrl) {
76
103
  config['baseUrl'] = ciBaseUrl;
77
104
  }
78
105
  const { screenshotsFolder, videosFolder, e2e, component } = cypressConfig;
79
106
  if (videosFolder) {
80
- config['videosFolder'] = (0, path_1.join)(videosFolder, outputSubfolder);
107
+ config['videosFolder'] = serializeConfigPath(videosFolder, projectRoot, workspaceRoot, outputSubfolder);
81
108
  }
82
109
  if (screenshotsFolder) {
83
- config['screenshotsFolder'] = (0, path_1.join)(screenshotsFolder, outputSubfolder);
110
+ config['screenshotsFolder'] = serializeConfigPath(screenshotsFolder, projectRoot, workspaceRoot, outputSubfolder);
84
111
  }
85
112
  if (e2e) {
86
113
  config['e2e'] = {};
87
114
  if (e2e.videosFolder) {
88
- config['e2e']['videosFolder'] = (0, path_1.join)(e2e.videosFolder, outputSubfolder);
115
+ config['e2e']['videosFolder'] = serializeConfigPath(e2e.videosFolder, projectRoot, workspaceRoot, outputSubfolder);
89
116
  }
90
117
  if (e2e.screenshotsFolder) {
91
- config['e2e']['screenshotsFolder'] = (0, path_1.join)(e2e.screenshotsFolder, outputSubfolder);
118
+ config['e2e']['screenshotsFolder'] = serializeConfigPath(e2e.screenshotsFolder, projectRoot, workspaceRoot, outputSubfolder);
92
119
  }
93
120
  }
94
121
  if (component) {
95
122
  config['component'] = {};
96
123
  if (component.videosFolder) {
97
- config['component']['videosFolder'] = (0, path_1.join)(component.videosFolder, outputSubfolder);
124
+ config['component']['videosFolder'] = serializeConfigPath(component.videosFolder, projectRoot, workspaceRoot, outputSubfolder);
98
125
  }
99
126
  if (component.screenshotsFolder) {
100
- config['component']['screenshotsFolder'] = (0, path_1.join)(component.screenshotsFolder, outputSubfolder);
127
+ config['component']['screenshotsFolder'] = serializeConfigPath(component.screenshotsFolder, projectRoot, workspaceRoot, outputSubfolder);
101
128
  }
102
129
  }
103
130
  // Stringify twice to escape the quotes.
104
131
  return JSON.stringify(JSON.stringify(config));
105
132
  }
106
- function getOutputs(projectRoot, cypressConfig, testingType) {
107
- function getOutput(path) {
108
- if (path.startsWith('..')) {
109
- return (0, devkit_1.joinPathFragments)('{workspaceRoot}', projectRoot, path);
110
- }
111
- else {
112
- return (0, devkit_1.joinPathFragments)('{projectRoot}', path);
133
+ function getOutputs(projectRoot, cypressConfig, testingType, workspaceRoot) {
134
+ const fullProjectRoot = (0, path_1.resolve)(workspaceRoot, projectRoot);
135
+ function getOutput(outputPath) {
136
+ const fullPath = (0, path_1.resolve)(fullProjectRoot, outputPath);
137
+ const relativeToProjectRoot = (0, devkit_1.normalizePath)((0, path_1.relative)(fullProjectRoot, fullPath));
138
+ if (relativeToProjectRoot.startsWith('..')) {
139
+ return (0, devkit_1.joinPathFragments)('{workspaceRoot}', (0, path_1.relative)(workspaceRoot, fullPath));
113
140
  }
141
+ return (0, devkit_1.joinPathFragments)('{projectRoot}', relativeToProjectRoot);
114
142
  }
115
143
  const { screenshotsFolder, videosFolder, e2e, component } = cypressConfig;
116
144
  const outputs = [];
@@ -143,7 +171,7 @@ function getOutputs(projectRoot, cypressConfig, testingType) {
143
171
  return outputs;
144
172
  }
145
173
  async function buildCypressTargets(configFilePath, projectRoot, options, context, pmc) {
146
- const cypressConfig = await (0, config_utils_1.loadConfigFile)((0, path_1.join)(context.workspaceRoot, configFilePath));
174
+ const cypressConfig = await (0, internal_1.loadConfigFile)((0, path_1.join)(context.workspaceRoot, configFilePath));
147
175
  const pluginPresetOptions = {
148
176
  ...cypressConfig.e2e?.[constants_1.NX_PLUGIN_OPTIONS],
149
177
  ...cypressConfig.env,
@@ -151,7 +179,7 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
151
179
  };
152
180
  const webServerCommands = pluginPresetOptions?.webServerCommands;
153
181
  const shouldReuseExistingServer = pluginPresetOptions?.reuseExistingServer ?? true;
154
- const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
182
+ const namedInputs = (0, internal_1.getNamedInputs)(projectRoot, context);
155
183
  const targets = {};
156
184
  let metadata;
157
185
  const tsNodeCompilerOptions = JSON.stringify({ customConditions: null });
@@ -164,7 +192,7 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
164
192
  },
165
193
  cache: true,
166
194
  inputs: getInputs(namedInputs),
167
- outputs: getOutputs(projectRoot, cypressConfig, 'e2e'),
195
+ outputs: getOutputs(projectRoot, cypressConfig, 'e2e', context.workspaceRoot),
168
196
  metadata: {
169
197
  technologies: ['cypress'],
170
198
  description: 'Runs Cypress Tests',
@@ -209,7 +237,7 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
209
237
  const { specFiles, specPatterns, excludeSpecPatterns } = await getSpecFilesAndPatternsForTestType(cypressConfig, 'e2e', context.workspaceRoot, projectRoot);
210
238
  const ciBaseUrl = pluginPresetOptions?.ciBaseUrl;
211
239
  const dependsOn = [];
212
- const outputs = getOutputs(projectRoot, cypressConfig, 'e2e');
240
+ const outputs = getOutputs(projectRoot, cypressConfig, 'e2e', context.workspaceRoot);
213
241
  const inputs = getInputs(namedInputs);
214
242
  const groupName = 'E2E (CI)';
215
243
  metadata = { targetGroups: { [groupName]: [] } };
@@ -239,7 +267,7 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
239
267
  outputs: getTargetOutputs(outputs, outputSubfolder),
240
268
  inputs,
241
269
  cache: true,
242
- command: `cypress run --env webServerCommand="${ciWebServerCommand}" --spec ${relativeSpecFilePath} --config=${getTargetConfig(cypressConfig, outputSubfolder, ciBaseUrl)}`,
270
+ command: `cypress run --env webServerCommand="${ciWebServerCommand}" --spec ${relativeSpecFilePath} --config=${getTargetConfig(cypressConfig, projectRoot, context.workspaceRoot, outputSubfolder, ciBaseUrl)}`,
243
271
  options: {
244
272
  cwd: projectRoot,
245
273
  env: { TS_NODE_COMPILER_OPTIONS: tsNodeCompilerOptions },
@@ -257,7 +285,6 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
257
285
  };
258
286
  dependsOn.push({
259
287
  target: targetName,
260
- projects: 'self',
261
288
  params: 'forward',
262
289
  options: 'forward',
263
290
  });
@@ -299,7 +326,7 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
299
326
  }
300
327
  if ('component' in cypressConfig) {
301
328
  const inputs = getInputs(namedInputs);
302
- const outputs = getOutputs(projectRoot, cypressConfig, 'component');
329
+ const outputs = getOutputs(projectRoot, cypressConfig, 'component', context.workspaceRoot);
303
330
  // This will not override the e2e target if it is the same
304
331
  targets[options.componentTestingTargetName] ??= {
305
332
  command: `cypress run --component`,
@@ -351,7 +378,7 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
351
378
  outputs: getTargetOutputs(outputs, outputSubfolder),
352
379
  inputs,
353
380
  cache: true,
354
- command: `cypress run --component --spec ${relativeSpecFilePath} --config=${getTargetConfig(cypressConfig, outputSubfolder)}`,
381
+ command: `cypress run --component --spec ${relativeSpecFilePath} --config=${getTargetConfig(cypressConfig, projectRoot, context.workspaceRoot, outputSubfolder)}`,
355
382
  options: {
356
383
  cwd: projectRoot,
357
384
  env: { TS_NODE_COMPILER_OPTIONS: tsNodeCompilerOptions },
@@ -373,7 +400,6 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
373
400
  };
374
401
  dependsOn.push({
375
402
  target: targetName,
376
- projects: 'self',
377
403
  params: 'forward',
378
404
  options: 'forward',
379
405
  });
@@ -467,3 +493,25 @@ async function getSpecFilesAndPatternsForTestType(cypressConfig, testType, works
467
493
  const specFiles = await (0, workspace_context_1.globWithWorkspaceContext)(workspaceRoot, specPatterns, excludeSpecPatterns);
468
494
  return { specFiles, specPatterns, excludeSpecPatterns };
469
495
  }
496
+ async function filterCypressConfigs(configFiles, context) {
497
+ const preErrors = [];
498
+ const candidates = await Promise.all(configFiles.map(async (configFile) => {
499
+ try {
500
+ const projectRoot = (0, path_1.dirname)(configFile);
501
+ const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
502
+ if (!siblingFiles.includes('package.json') &&
503
+ !siblingFiles.includes('project.json')) {
504
+ return null;
505
+ }
506
+ return { configFile, projectRoot };
507
+ }
508
+ catch (e) {
509
+ preErrors.push([configFile, e]);
510
+ return null;
511
+ }
512
+ }));
513
+ return {
514
+ entries: candidates.filter((c) => c !== null),
515
+ preErrors,
516
+ };
517
+ }
@@ -31,4 +31,3 @@ type CypressPreprocessor = (file: Record<string, any>) => string | Promise<strin
31
31
  */
32
32
  declare function vitePreprocessor(configOverrides?: InlineConfig): CypressPreprocessor;
33
33
  export default vitePreprocessor;
34
- //# sourceMappingURL=preprocessor-vite.d.ts.map
@@ -20,4 +20,3 @@ export interface CyLinterOptions {
20
20
  addPlugin?: boolean;
21
21
  }
22
22
  export declare function addLinterToCyProject(tree: Tree, options: CyLinterOptions): Promise<() => void>;
23
- //# sourceMappingURL=add-linter.d.ts.map
@@ -3,9 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addLinterToCyProject = addLinterToCyProject;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const eslint_1 = require("@nx/eslint");
6
- const global_eslint_config_1 = require("@nx/eslint/src/generators/init/global-eslint-config");
7
- const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
8
- const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
6
+ const internal_1 = require("@nx/eslint/internal");
9
7
  const versions_1 = require("./versions");
10
8
  async function addLinterToCyProject(tree, options) {
11
9
  if (options.linter === 'none') {
@@ -13,7 +11,7 @@ async function addLinterToCyProject(tree, options) {
13
11
  }
14
12
  const tasks = [];
15
13
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
16
- const eslintFile = (0, eslint_file_1.findEslintFile)(tree, projectConfig.root);
14
+ const eslintFile = (0, internal_1.findEslintFile)(tree, projectConfig.root);
17
15
  if (!eslintFile) {
18
16
  tasks.push(await (0, eslint_1.lintProjectGenerator)(tree, {
19
17
  project: options.project,
@@ -32,30 +30,30 @@ async function addLinterToCyProject(tree, options) {
32
30
  options.overwriteExisting = options.overwriteExisting || !eslintFile;
33
31
  if (!options.skipPackageJson) {
34
32
  const pkgVersions = (0, versions_1.versions)(tree);
35
- tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, { 'eslint-plugin-cypress': pkgVersions.eslintPluginCypressVersion }));
33
+ tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, { 'eslint-plugin-cypress': pkgVersions.eslintPluginCypressVersion }, undefined, true));
36
34
  }
37
- if ((0, eslint_file_1.isEslintConfigSupported)(tree, projectConfig.root) ||
38
- (0, eslint_file_1.isEslintConfigSupported)(tree)) {
35
+ if ((0, internal_1.isEslintConfigSupported)(tree, projectConfig.root) ||
36
+ (0, internal_1.isEslintConfigSupported)(tree)) {
39
37
  const overrides = [];
40
- if ((0, flat_config_1.useFlatConfig)(tree)) {
41
- (0, eslint_file_1.addPredefinedConfigToFlatLintConfig)(tree, projectConfig.root, 'recommended', {
38
+ if ((0, internal_1.useFlatConfig)(tree)) {
39
+ (0, internal_1.addPredefinedConfigToFlatLintConfig)(tree, projectConfig.root, 'recommended', {
42
40
  moduleName: 'cypress',
43
41
  moduleImportPath: 'eslint-plugin-cypress/flat',
44
42
  spread: false,
45
43
  insertAtTheEnd: false,
46
44
  });
47
- (0, eslint_file_1.addOverrideToLintConfig)(tree, projectConfig.root, {
45
+ (0, internal_1.addOverrideToLintConfig)(tree, projectConfig.root, {
48
46
  files: ['*.ts', '*.js'],
49
47
  rules: {},
50
48
  });
51
49
  }
52
50
  else {
53
51
  if (options.rootProject) {
54
- (0, eslint_file_1.addPluginsToLintConfig)(tree, projectConfig.root, '@nx');
55
- overrides.push(global_eslint_config_1.typeScriptOverride);
56
- overrides.push(global_eslint_config_1.javaScriptOverride);
52
+ (0, internal_1.addPluginsToLintConfig)(tree, projectConfig.root, '@nx');
53
+ overrides.push(internal_1.typeScriptOverride);
54
+ overrides.push(internal_1.javaScriptOverride);
57
55
  }
58
- const addExtendsTask = (0, eslint_file_1.addExtendsToLintConfig)(tree, projectConfig.root, 'plugin:cypress/recommended');
56
+ const addExtendsTask = (0, internal_1.addExtendsToLintConfig)(tree, projectConfig.root, 'plugin:cypress/recommended');
59
57
  tasks.push(addExtendsTask);
60
58
  }
61
59
  /**
@@ -71,7 +69,7 @@ async function addLinterToCyProject(tree, options) {
71
69
  };
72
70
  if (options.overwriteExisting) {
73
71
  overrides.unshift({
74
- files: (0, flat_config_1.useFlatConfig)(tree)
72
+ files: (0, internal_1.useFlatConfig)(tree)
75
73
  ? // For flat configs we don't need to specify the files
76
74
  undefined
77
75
  : ['*.ts', '*.tsx', '*.js', '*.jsx'],
@@ -82,11 +80,11 @@ async function addLinterToCyProject(tree, options) {
82
80
  },
83
81
  rules: {},
84
82
  });
85
- (0, eslint_file_1.replaceOverridesInLintConfig)(tree, projectConfig.root, overrides);
83
+ (0, internal_1.replaceOverridesInLintConfig)(tree, projectConfig.root, overrides);
86
84
  }
87
85
  else {
88
86
  overrides.unshift({
89
- files: (0, flat_config_1.useFlatConfig)(tree)
87
+ files: (0, internal_1.useFlatConfig)(tree)
90
88
  ? // For flat configs we don't need to specify the files
91
89
  undefined
92
90
  : [
@@ -100,7 +98,7 @@ async function addLinterToCyProject(tree, options) {
100
98
  },
101
99
  rules: {},
102
100
  });
103
- overrides.forEach((override) => (0, eslint_file_1.addOverrideToLintConfig)(tree, projectConfig.root, override));
101
+ overrides.forEach((override) => (0, internal_1.addOverrideToLintConfig)(tree, projectConfig.root, override));
104
102
  }
105
103
  }
106
104
  return (0, devkit_1.runTasksInSerial)(...tasks);
@@ -0,0 +1,2 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export declare function assertSupportedCypressVersion(tree: Tree): void;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertSupportedCypressVersion = assertSupportedCypressVersion;
4
+ const internal_1 = require("@nx/devkit/internal");
5
+ const versions_1 = require("./versions");
6
+ function assertSupportedCypressVersion(tree) {
7
+ (0, internal_1.assertSupportedPackageVersion)(tree, 'cypress', versions_1.minSupportedCypressVersion);
8
+ }
@@ -4,11 +4,17 @@ import type { NxComponentTestingOptions, NxCypressE2EPresetOptions } from '../..
4
4
  export declare const CYPRESS_CONFIG_FILE_NAME_PATTERN = "cypress.config.{js,ts,mjs,cjs}";
5
5
  export declare function addDefaultE2EConfig(cyConfigContents: string, options: NxCypressE2EPresetOptions, baseUrl: string): Promise<string>;
6
6
  /**
7
- * Adds the nxComponentTestingPreset to the cypress config file
8
- * Make sure after calling this the correct import statement is addeda
9
- * to bring in the nxComponentTestingPreset function
7
+ * Adds the nxComponentTestingPreset to the cypress config file.
8
+ *
9
+ * Pass `presetImportPath` (e.g. `@nx/angular/plugins/component-testing`) to
10
+ * have the matching `import` (ESM) or `const { ... } = require(...)` (CJS)
11
+ * statement prepended automatically based on the detected module shape.
12
+ * Without it, the caller is responsible for prepending the import - but
13
+ * doing so unconditionally produces mixed-syntax files in CJS workspaces
14
+ * (an ESM `import` followed by a CJS `module.exports`), so prefer passing
15
+ * `presetImportPath`.
10
16
  **/
11
- export declare function addDefaultCTConfig(cyConfigContents: string, options?: NxComponentTestingOptions): Promise<string>;
17
+ export declare function addDefaultCTConfig(cyConfigContents: string, options?: NxComponentTestingOptions, presetImportPath?: string): Promise<string>;
12
18
  /**
13
19
  * Adds the mount command for Cypress
14
20
  * Make sure after calling this the correct import statement is added
@@ -17,4 +23,3 @@ export declare function addDefaultCTConfig(cyConfigContents: string, options?: N
17
23
  export declare function addMountDefinition(cmpCommandFileContents: string): Promise<string>;
18
24
  export declare function getProjectCypressConfigPath(tree: Tree, projectRoot: string): string;
19
25
  export declare function resolveCypressConfigObject(cypressConfigContents: string): ObjectLiteralExpression | null;
20
- //# sourceMappingURL=config.d.ts.map
@@ -1,37 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.CYPRESS_CONFIG_FILE_NAME_PATTERN = void 0;
37
4
  exports.addDefaultE2EConfig = addDefaultE2EConfig;
@@ -40,7 +7,7 @@ exports.addMountDefinition = addMountDefinition;
40
7
  exports.getProjectCypressConfigPath = getProjectCypressConfigPath;
41
8
  exports.resolveCypressConfigObject = resolveCypressConfigObject;
42
9
  const devkit_1 = require("@nx/devkit");
43
- const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
10
+ const internal_1 = require("@nx/js/internal");
44
11
  exports.CYPRESS_CONFIG_FILE_NAME_PATTERN = 'cypress.config.{js,ts,mjs,cjs}';
45
12
  const TS_QUERY_COMMON_JS_EXPORT_SELECTOR = 'BinaryExpression:has(Identifier[name="module"]):has(Identifier[name="exports"])';
46
13
  const TS_QUERY_EXPORT_CONFIG_PREFIX = `:matches(ExportAssignment, ${TS_QUERY_COMMON_JS_EXPORT_SELECTOR}) `;
@@ -48,13 +15,23 @@ async function addDefaultE2EConfig(cyConfigContents, options, baseUrl) {
48
15
  if (!cyConfigContents) {
49
16
  throw new Error('The passed in cypress config file is empty!');
50
17
  }
51
- const { tsquery } = await Promise.resolve().then(() => __importStar(require('@phenomnomnominal/tsquery')));
18
+ const { tsquery } = await import('@phenomnomnominal/tsquery');
52
19
  const isCommonJS = tsquery.query(cyConfigContents, TS_QUERY_COMMON_JS_EXPORT_SELECTOR).length >
53
20
  0;
54
21
  const testingTypeConfig = tsquery.query(cyConfigContents, `${TS_QUERY_EXPORT_CONFIG_PREFIX} PropertyAssignment:has(Identifier[name="e2e"])`);
55
22
  let updatedConfigContents = cyConfigContents;
56
23
  if (testingTypeConfig.length === 0) {
57
- const configValue = `nxE2EPreset(__filename, ${JSON.stringify(options, null, 2)
24
+ // ESM-shape configs use `import.meta.url` (a `file://...` URL string)
25
+ // because it's the most universally available `import.meta` field:
26
+ // Node's native TS strip exposes it in ESM scope, and Cypress's bundled
27
+ // tsx CJS loader provides it too (unlike `import.meta.dirname`, which
28
+ // older tsx versions don't shim). CJS-shape configs use `__filename`
29
+ // since `import.meta` isn't defined in plain CJS scope. The base
30
+ // template is selected to match the workspace's `type` field, so the
31
+ // shape detected here is consistent with how the file will actually be
32
+ // evaluated at runtime. `nxBaseCypressPreset` normalizes either form.
33
+ const pathToConfig = isCommonJS ? '__filename' : 'import.meta.url';
34
+ const configValue = `nxE2EPreset(${pathToConfig}, ${JSON.stringify(options, null, 2)
58
35
  .split('\n')
59
36
  .join('\n ')})`;
60
37
  updatedConfigContents = tsquery.replace(cyConfigContents, `${TS_QUERY_EXPORT_CONFIG_PREFIX} ObjectLiteralExpression:first-child`, (node) => {
@@ -64,7 +41,7 @@ async function addDefaultE2EConfig(cyConfigContents, options, baseUrl) {
64
41
  ${node.properties.map((p) => p.getText()).join(',\n')},
65
42
  e2e: {
66
43
  ...${configValue}${baseUrlContents}
67
- }
44
+ }
68
45
  }`;
69
46
  }
70
47
  return `{
@@ -73,6 +50,9 @@ async function addDefaultE2EConfig(cyConfigContents, options, baseUrl) {
73
50
  }
74
51
  }`;
75
52
  });
53
+ // @nx/cypress's package exports cover both bare and `.js`-suffixed
54
+ // subpath forms, so emit the bare path - matches addDefaultCTConfig and
55
+ // keeps generated configs free of incidental `.js` noise.
76
56
  return isCommonJS
77
57
  ? `const { nxE2EPreset } = require('@nx/cypress/plugins/cypress-preset');
78
58
  ${updatedConfigContents}`
@@ -82,33 +62,44 @@ ${updatedConfigContents}`;
82
62
  return updatedConfigContents;
83
63
  }
84
64
  /**
85
- * Adds the nxComponentTestingPreset to the cypress config file
86
- * Make sure after calling this the correct import statement is addeda
87
- * to bring in the nxComponentTestingPreset function
65
+ * Adds the nxComponentTestingPreset to the cypress config file.
66
+ *
67
+ * Pass `presetImportPath` (e.g. `@nx/angular/plugins/component-testing`) to
68
+ * have the matching `import` (ESM) or `const { ... } = require(...)` (CJS)
69
+ * statement prepended automatically based on the detected module shape.
70
+ * Without it, the caller is responsible for prepending the import - but
71
+ * doing so unconditionally produces mixed-syntax files in CJS workspaces
72
+ * (an ESM `import` followed by a CJS `module.exports`), so prefer passing
73
+ * `presetImportPath`.
88
74
  **/
89
- async function addDefaultCTConfig(cyConfigContents, options = {}) {
75
+ async function addDefaultCTConfig(cyConfigContents, options = {}, presetImportPath) {
90
76
  if (!cyConfigContents) {
91
77
  throw new Error('The passed in cypress config file is empty!');
92
78
  }
93
- const { tsquery } = await Promise.resolve().then(() => __importStar(require('@phenomnomnominal/tsquery')));
79
+ const { tsquery } = await import('@phenomnomnominal/tsquery');
80
+ const isCommonJS = tsquery.query(cyConfigContents, TS_QUERY_COMMON_JS_EXPORT_SELECTOR).length >
81
+ 0;
94
82
  const testingTypeConfig = tsquery.query(cyConfigContents, `${TS_QUERY_EXPORT_CONFIG_PREFIX} PropertyAssignment:has(Identifier[name="component"])`);
95
83
  let updatedConfigContents = cyConfigContents;
96
84
  if (testingTypeConfig.length === 0) {
97
- let configValue = 'nxComponentTestingPreset(__filename)';
85
+ // See addDefaultE2EConfig for the rationale on __filename vs
86
+ // import.meta.url.
87
+ const pathToConfig = isCommonJS ? '__filename' : 'import.meta.url';
88
+ let configValue = `nxComponentTestingPreset(${pathToConfig})`;
98
89
  if (options) {
99
90
  if (options.bundler !== 'vite') {
100
91
  // vite is the default bundler, so we don't need to set it
101
92
  delete options.bundler;
102
93
  }
103
94
  if (Object.keys(options).length) {
104
- configValue = `nxComponentTestingPreset(__filename, ${JSON.stringify(options)})`;
95
+ configValue = `nxComponentTestingPreset(${pathToConfig}, ${JSON.stringify(options)})`;
105
96
  }
106
97
  }
107
98
  updatedConfigContents = tsquery.replace(cyConfigContents, `${TS_QUERY_EXPORT_CONFIG_PREFIX} ObjectLiteralExpression:first-child`, (node) => {
108
99
  if (node.properties.length > 0) {
109
100
  return `{
110
101
  ${node.properties.map((p) => p.getText()).join(',\n')},
111
- component: ${configValue}
102
+ component: ${configValue}
112
103
  }`;
113
104
  }
114
105
  return `{
@@ -116,6 +107,19 @@ async function addDefaultCTConfig(cyConfigContents, options = {}) {
116
107
  }`;
117
108
  });
118
109
  }
110
+ if (presetImportPath) {
111
+ // Use the path verbatim - callers pass the public exported subpath. Don't
112
+ // append `.js`: @nx/react and @nx/angular's package exports only declare
113
+ // the bare `./plugins/component-testing` subpath, so a `.js` suffix
114
+ // breaks strict ESM resolution with ERR_PACKAGE_PATH_NOT_EXPORTED.
115
+ // (addDefaultE2EConfig hard-codes `.js` because @nx/cypress has no
116
+ // exports map - it can get away with the suffix; subpath-exporting
117
+ // packages cannot.)
118
+ const prefix = isCommonJS
119
+ ? `const { nxComponentTestingPreset } = require('${presetImportPath}');\n`
120
+ : `import { nxComponentTestingPreset } from '${presetImportPath}';\n`;
121
+ return `${prefix}${updatedConfigContents}`;
122
+ }
119
123
  return updatedConfigContents;
120
124
  }
121
125
  /**
@@ -127,7 +131,7 @@ async function addMountDefinition(cmpCommandFileContents) {
127
131
  if (!cmpCommandFileContents) {
128
132
  throw new Error('The passed in cypress component file is empty!');
129
133
  }
130
- const { tsquery } = await Promise.resolve().then(() => __importStar(require('@phenomnomnominal/tsquery')));
134
+ const { tsquery } = await import('@phenomnomnominal/tsquery');
131
135
  const hasMountCommand = tsquery.query(cmpCommandFileContents, 'CallExpression StringLiteral[value="mount"]')?.length > 0;
132
136
  if (hasMountCommand) {
133
137
  return cmpCommandFileContents;
@@ -153,7 +157,7 @@ function getProjectCypressConfigPath(tree, projectRoot) {
153
157
  return cypressConfigPaths[0];
154
158
  }
155
159
  function resolveCypressConfigObject(cypressConfigContents) {
156
- const ts = (0, ensure_typescript_1.ensureTypescript)();
160
+ const ts = (0, internal_1.ensureTypescript)();
157
161
  const { tsquery } = (require('@phenomnomnominal/tsquery'));
158
162
  const sourceFile = tsquery.ast(cypressConfigContents);
159
163
  const exportDefaultStatement = sourceFile.statements.find((statement) => ts.isExportAssignment(statement));
@@ -169,7 +173,7 @@ function resolveCypressConfigObject(cypressConfigContents) {
169
173
  return null;
170
174
  }
171
175
  function resolveCypressConfigObjectFromExportExpression(exportExpression, sourceFile) {
172
- const ts = (0, ensure_typescript_1.ensureTypescript)();
176
+ const ts = (0, internal_1.ensureTypescript)();
173
177
  if (ts.isObjectLiteralExpression(exportExpression)) {
174
178
  return exportExpression;
175
179
  }
@@ -2,4 +2,3 @@
2
2
  * Key used to store options used by the nx plugin for @nx/cypress.
3
3
  */
4
4
  export declare const NX_PLUGIN_OPTIONS = "__NxPluginOptions__";
5
- //# sourceMappingURL=constants.d.ts.map
@@ -14,4 +14,3 @@ export declare function getTempTailwindPath(context: ExecutorContext): string;
14
14
  export declare function isCtProjectUsingBuildProject(graph: ProjectGraph, parentProjectName: string, childProjectName: string, seen?: Set<string>): boolean;
15
15
  export declare function getProjectConfigByPath(graph: ProjectGraph, configPath: string): ProjectConfiguration;
16
16
  export declare function createExecutorContext(graph: ProjectGraph, targets: Record<string, TargetConfiguration>, projectName: string, targetName: string, configurationName: string): ExecutorContext;
17
- //# sourceMappingURL=ct-helpers.d.ts.map
@@ -0,0 +1,3 @@
1
+ export declare const CYPRESS_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx/cypress:cypress` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/cypress:convert-to-inferred` to migrate to the `@nx/cypress/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
2
+ export declare function warnCypressExecutorDeprecation(): void;
3
+ export declare function warnCypressExecutorGenerating(): void;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CYPRESS_EXECUTOR_DEPRECATION_MESSAGE = void 0;
4
+ exports.warnCypressExecutorDeprecation = warnCypressExecutorDeprecation;
5
+ exports.warnCypressExecutorGenerating = warnCypressExecutorGenerating;
6
+ const devkit_1 = require("@nx/devkit");
7
+ // TODO(v24): Remove the @nx/cypress:cypress executor. The inferred plugin
8
+ // (@nx/cypress/plugin) and the convert-to-inferred generator stay supported.
9
+ exports.CYPRESS_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/cypress:cypress` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/cypress:convert-to-inferred` to migrate to the `@nx/cypress/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
10
+ function warnCypressExecutorDeprecation() {
11
+ devkit_1.logger.warn(exports.CYPRESS_EXECUTOR_DEPRECATION_MESSAGE);
12
+ }
13
+ // Fired when the @nx/cypress:configuration or :component-configuration
14
+ // generator is about to generate a target that uses the deprecated executor —
15
+ // i.e. when @nx/cypress/plugin isn't registered in nx.json. Surfaces the
16
+ // deprecation at generation time rather than only when the user later runs the
17
+ // generated target.
18
+ function warnCypressExecutorGenerating() {
19
+ devkit_1.logger.warn('Generating a target that uses the deprecated `@nx/cypress:cypress` executor. The executor will be removed in Nx v24. Run `nx g @nx/cypress:convert-to-inferred` next to migrate this target to the `@nx/cypress/plugin` inferred plugin and prevent future generators from emitting executor targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
20
+ }
@@ -15,4 +15,3 @@ export interface FoundTarget {
15
15
  }
16
16
  export declare function findBuildConfig(tree: Tree, options: FindTargetOptions): Promise<FoundTarget>;
17
17
  export {};
18
- //# sourceMappingURL=find-target-options.d.ts.map
@@ -11,4 +11,3 @@ export declare function updateObjectProperty(config: ObjectLiteralExpression, pr
11
11
  newName?: string;
12
12
  newValue?: Expression;
13
13
  }): ObjectLiteralExpression;
14
- //# sourceMappingURL=migrations.d.ts.map