@nx/cypress 23.0.0-beta.18 → 23.0.0-beta.19

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 (150) 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/{src → dist/src}/executors/cypress/cypress.impl.d.ts +0 -1
  7. package/{src → dist/src}/generators/base-setup/base-setup.d.ts +0 -1
  8. package/{src → dist/src}/generators/component-configuration/component-configuration.d.ts +0 -1
  9. package/{src → dist/src}/generators/configuration/configuration.d.ts +0 -1
  10. package/{src → dist/src}/generators/convert-to-inferred/convert-to-inferred.d.ts +0 -1
  11. package/{src → dist/src}/generators/convert-to-inferred/lib/add-dev-server-target-to-config.d.ts +0 -1
  12. package/{src → dist/src}/generators/convert-to-inferred/lib/add-exclude-spec-pattern.d.ts +0 -1
  13. package/{src → dist/src}/generators/convert-to-inferred/lib/target-options-map.d.ts +0 -1
  14. package/{src → dist/src}/generators/convert-to-inferred/lib/upsert-baseUrl.d.ts +0 -1
  15. package/{src → dist/src}/generators/init/init.d.ts +0 -1
  16. package/{src → dist/src}/generators/migrate-to-cypress-11/conversion.util.d.ts +0 -1
  17. package/{src → dist/src}/generators/migrate-to-cypress-11/migrate-to-cypress-11.d.ts +0 -1
  18. package/{src → dist/src}/migrations/update-20-8-0/remove-experimental-fetch-polyfill.d.ts +0 -1
  19. package/{src → dist/src}/migrations/update-20-8-0/replace-experimental-just-in-time-compile.d.ts +0 -1
  20. package/{src → dist/src}/migrations/update-20-8-0/set-inject-document-domain.d.ts +0 -1
  21. package/{src → dist/src}/migrations/update-20-8-0/update-component-testing-mount-imports.d.ts +0 -1
  22. package/dist/src/migrations/update-21-0-0/remove-tsconfig-and-copy-files-options-from-cypress-executor.d.ts +2 -0
  23. package/{src → dist/src}/migrations/update-22-1-0/rename-cy-exec-code-property.d.ts +0 -1
  24. package/{src → dist/src}/migrations/update-22-1-0/update-angular-component-testing-support.d.ts +0 -1
  25. package/{src → dist/src}/migrations/update-22-1-0/update-selector-playground-api.d.ts +0 -1
  26. package/{src → dist/src}/migrations/update-23-0-0/remove-experimental-prompt-command.d.ts +0 -1
  27. package/dist/src/migrations/update-23-0-0/rewrite-internal-subpath-imports.d.ts +3 -0
  28. package/dist/src/migrations/update-23-0-0/rewrite-internal-subpath-imports.js +199 -0
  29. package/{src → dist/src}/plugins/plugin.d.ts +0 -1
  30. package/{src → dist/src}/plugins/plugin.js +46 -12
  31. package/{src → dist/src}/plugins/preprocessor-vite.d.ts +0 -1
  32. package/{src → dist/src}/utils/add-linter.d.ts +0 -1
  33. package/{src → dist/src}/utils/assert-supported-cypress-version.d.ts +0 -1
  34. package/{src → dist/src}/utils/config.d.ts +0 -1
  35. package/{src → dist/src}/utils/config.js +3 -36
  36. package/{src → dist/src}/utils/constants.d.ts +0 -1
  37. package/{src → dist/src}/utils/ct-helpers.d.ts +0 -1
  38. package/{src → dist/src}/utils/deprecation.d.ts +0 -1
  39. package/{src → dist/src}/utils/find-target-options.d.ts +0 -1
  40. package/{src → dist/src}/utils/migrations.d.ts +0 -1
  41. package/{src → dist/src}/utils/project-name.d.ts +0 -1
  42. package/{src → dist/src}/utils/start-dev-server.d.ts +0 -1
  43. package/{src → dist/src}/utils/versions.d.ts +0 -1
  44. package/{src → dist/src}/utils/versions.js +3 -10
  45. package/executors.json +2 -2
  46. package/generators.json +10 -10
  47. package/migrations.json +14 -9
  48. package/package.json +45 -37
  49. package/index.d.ts.map +0 -1
  50. package/plugin.d.ts.map +0 -1
  51. package/plugins/cypress-preset.d.ts.map +0 -1
  52. package/src/executors/cypress/cypress.impl.d.ts.map +0 -1
  53. package/src/generators/base-setup/base-setup.d.ts.map +0 -1
  54. package/src/generators/component-configuration/component-configuration.d.ts.map +0 -1
  55. package/src/generators/configuration/configuration.d.ts.map +0 -1
  56. package/src/generators/convert-to-inferred/convert-to-inferred.d.ts.map +0 -1
  57. package/src/generators/convert-to-inferred/lib/add-dev-server-target-to-config.d.ts.map +0 -1
  58. package/src/generators/convert-to-inferred/lib/add-exclude-spec-pattern.d.ts.map +0 -1
  59. package/src/generators/convert-to-inferred/lib/target-options-map.d.ts.map +0 -1
  60. package/src/generators/convert-to-inferred/lib/upsert-baseUrl.d.ts.map +0 -1
  61. package/src/generators/init/init.d.ts.map +0 -1
  62. package/src/generators/migrate-to-cypress-11/conversion.util.d.ts.map +0 -1
  63. package/src/generators/migrate-to-cypress-11/migrate-to-cypress-11.d.ts.map +0 -1
  64. package/src/migrations/update-20-8-0/remove-experimental-fetch-polyfill.d.ts.map +0 -1
  65. package/src/migrations/update-20-8-0/replace-experimental-just-in-time-compile.d.ts.map +0 -1
  66. package/src/migrations/update-20-8-0/set-inject-document-domain.d.ts.map +0 -1
  67. package/src/migrations/update-20-8-0/update-component-testing-mount-imports.d.ts.map +0 -1
  68. package/src/migrations/update-21-0-0/remove-tsconfig-and-copy-files-options-from-cypress-executor.d.ts +0 -3
  69. package/src/migrations/update-21-0-0/remove-tsconfig-and-copy-files-options-from-cypress-executor.d.ts.map +0 -1
  70. package/src/migrations/update-22-1-0/rename-cy-exec-code-property.d.ts.map +0 -1
  71. package/src/migrations/update-22-1-0/update-angular-component-testing-support.d.ts.map +0 -1
  72. package/src/migrations/update-22-1-0/update-selector-playground-api.d.ts.map +0 -1
  73. package/src/migrations/update-23-0-0/remove-experimental-prompt-command.d.ts.map +0 -1
  74. package/src/plugins/plugin.d.ts.map +0 -1
  75. package/src/plugins/preprocessor-vite.d.ts.map +0 -1
  76. package/src/utils/add-linter.d.ts.map +0 -1
  77. package/src/utils/assert-supported-cypress-version.d.ts.map +0 -1
  78. package/src/utils/config.d.ts.map +0 -1
  79. package/src/utils/constants.d.ts.map +0 -1
  80. package/src/utils/ct-helpers.d.ts.map +0 -1
  81. package/src/utils/cypress-version.d.ts +0 -12
  82. package/src/utils/cypress-version.d.ts.map +0 -1
  83. package/src/utils/cypress-version.js +0 -38
  84. package/src/utils/deprecation.d.ts.map +0 -1
  85. package/src/utils/find-target-options.d.ts.map +0 -1
  86. package/src/utils/migrations.d.ts.map +0 -1
  87. package/src/utils/project-name.d.ts.map +0 -1
  88. package/src/utils/start-dev-server.d.ts.map +0 -1
  89. package/src/utils/versions.d.ts.map +0 -1
  90. /package/{LICENSE → dist/LICENSE} +0 -0
  91. /package/{PLUGIN.md → dist/PLUGIN.md} +0 -0
  92. /package/{index.js → dist/index.js} +0 -0
  93. /package/{plugin.js → dist/plugin.js} +0 -0
  94. /package/{plugins → dist/plugins}/cypress-preset.js +0 -0
  95. /package/{src → dist/src}/executors/cypress/cypress.impl.js +0 -0
  96. /package/{src → dist/src}/executors/cypress/schema.json +0 -0
  97. /package/{src → dist/src}/generators/base-setup/base-setup.js +0 -0
  98. /package/{src → dist/src}/generators/base-setup/files/common/__directory__/fixtures/example.json +0 -0
  99. /package/{src → dist/src}/generators/base-setup/files/common/__directory__/support/commands.ts__ext__ +0 -0
  100. /package/{src → dist/src}/generators/base-setup/files/config-js-cjs/__directory__/support/commands.js__ext__ +0 -0
  101. /package/{src → dist/src}/generators/base-setup/files/config-js-cjs/cypress.config.js__ext__ +0 -0
  102. /package/{src → dist/src}/generators/base-setup/files/config-js-esm/__directory__/support/commands.js__ext__ +0 -0
  103. /package/{src → dist/src}/generators/base-setup/files/config-js-esm/cypress.config.js__ext__ +0 -0
  104. /package/{src → dist/src}/generators/base-setup/files/config-ts-cjs/__directory__/support/commands.ts__ext__ +0 -0
  105. /package/{src → dist/src}/generators/base-setup/files/config-ts-cjs/cypress.config.ts__ext__ +0 -0
  106. /package/{src → dist/src}/generators/base-setup/files/config-ts-esm/__directory__/support/commands.ts__ext__ +0 -0
  107. /package/{src → dist/src}/generators/base-setup/files/config-ts-esm/cypress.config.ts__ext__ +0 -0
  108. /package/{src → dist/src}/generators/base-setup/files/tsconfig/non-ts-solution/__directory__/tsconfig.json__ext__ +0 -0
  109. /package/{src → dist/src}/generators/base-setup/files/tsconfig/ts-solution/__directory__/tsconfig.json__ext__ +0 -0
  110. /package/{src → dist/src}/generators/component-configuration/component-configuration.js +0 -0
  111. /package/{src → dist/src}/generators/component-configuration/files/__directory__/support/component-index.html +0 -0
  112. /package/{src → dist/src}/generators/component-configuration/files/__directory__/support/component.ts__ext__ +0 -0
  113. /package/{src → dist/src}/generators/component-configuration/schema.d.ts +0 -0
  114. /package/{src → dist/src}/generators/component-configuration/schema.json +0 -0
  115. /package/{src → dist/src}/generators/configuration/configuration.js +0 -0
  116. /package/{src → dist/src}/generators/configuration/files/__directory__/e2e/app.cy.ts__tmpl__ +0 -0
  117. /package/{src → dist/src}/generators/configuration/files/__directory__/support/app.po.ts__tmpl__ +0 -0
  118. /package/{src → dist/src}/generators/configuration/files/__directory__/support/e2e.ts__tmpl__ +0 -0
  119. /package/{src → dist/src}/generators/configuration/schema.json +0 -0
  120. /package/{src → dist/src}/generators/convert-to-inferred/convert-to-inferred.js +0 -0
  121. /package/{src → dist/src}/generators/convert-to-inferred/lib/add-dev-server-target-to-config.js +0 -0
  122. /package/{src → dist/src}/generators/convert-to-inferred/lib/add-exclude-spec-pattern.js +0 -0
  123. /package/{src → dist/src}/generators/convert-to-inferred/lib/target-options-map.js +0 -0
  124. /package/{src → dist/src}/generators/convert-to-inferred/lib/upsert-baseUrl.js +0 -0
  125. /package/{src → dist/src}/generators/convert-to-inferred/schema.json +0 -0
  126. /package/{src → dist/src}/generators/init/init.js +0 -0
  127. /package/{src → dist/src}/generators/init/schema.d.ts +0 -0
  128. /package/{src → dist/src}/generators/init/schema.json +0 -0
  129. /package/{src → dist/src}/generators/migrate-to-cypress-11/conversion.util.js +0 -0
  130. /package/{src → dist/src}/generators/migrate-to-cypress-11/migrate-to-cypress-11.js +0 -0
  131. /package/{src → dist/src}/generators/migrate-to-cypress-11/schema.json +0 -0
  132. /package/{src → dist/src}/migrations/update-20-8-0/remove-experimental-fetch-polyfill.js +0 -0
  133. /package/{src → dist/src}/migrations/update-20-8-0/replace-experimental-just-in-time-compile.js +0 -0
  134. /package/{src → dist/src}/migrations/update-20-8-0/set-inject-document-domain.js +0 -0
  135. /package/{src → dist/src}/migrations/update-20-8-0/update-component-testing-mount-imports.js +0 -0
  136. /package/{src → dist/src}/migrations/update-21-0-0/remove-tsconfig-and-copy-files-options-from-cypress-executor.js +0 -0
  137. /package/{src → dist/src}/migrations/update-22-1-0/rename-cy-exec-code-property.js +0 -0
  138. /package/{src → dist/src}/migrations/update-22-1-0/update-angular-component-testing-support.js +0 -0
  139. /package/{src → dist/src}/migrations/update-22-1-0/update-selector-playground-api.js +0 -0
  140. /package/{src → dist/src}/migrations/update-23-0-0/remove-experimental-prompt-command.js +0 -0
  141. /package/{src → dist/src}/plugins/preprocessor-vite.js +0 -0
  142. /package/{src → dist/src}/utils/add-linter.js +0 -0
  143. /package/{src → dist/src}/utils/assert-supported-cypress-version.js +0 -0
  144. /package/{src → dist/src}/utils/constants.js +0 -0
  145. /package/{src → dist/src}/utils/ct-helpers.js +0 -0
  146. /package/{src → dist/src}/utils/deprecation.js +0 -0
  147. /package/{src → dist/src}/utils/find-target-options.js +0 -0
  148. /package/{src → dist/src}/utils/migrations.js +0 -0
  149. /package/{src → dist/src}/utils/project-name.js +0 -0
  150. /package/{src → dist/src}/utils/start-dev-server.js +0 -0
@@ -2,4 +2,3 @@ export { configurationGenerator } from './src/generators/configuration/configura
2
2
  export { componentConfigurationGenerator } from './src/generators/component-configuration/component-configuration';
3
3
  export { cypressInitGenerator } from './src/generators/init/init';
4
4
  export { migrateCypressProject } from './src/generators/migrate-to-cypress-11/migrate-to-cypress-11';
5
- //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,5 @@
1
+ export * from './src/utils/versions';
2
+ export * from './src/utils/ct-helpers';
3
+ export * from './src/utils/find-target-options';
4
+ export * from './src/utils/config';
5
+ export type { CypressExecutorOptions } from './src/executors/cypress/cypress.impl';
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ // Semi-private surface for first-party Nx packages.
3
+ //
4
+ // External plugins should NOT import from here — this entry is curated for
5
+ // internal consumers and may change without semver protection. Mirrors
6
+ // `@nx/devkit/internal`.
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ const tslib_1 = require("tslib");
9
+ tslib_1.__exportStar(require("./src/utils/versions"), exports);
10
+ tslib_1.__exportStar(require("./src/utils/ct-helpers"), exports);
11
+ tslib_1.__exportStar(require("./src/utils/find-target-options"), exports);
12
+ tslib_1.__exportStar(require("./src/utils/config"), exports);
@@ -1,2 +1 @@
1
1
  export { createNodesV2, createNodes } from './src/plugins/plugin';
2
- //# sourceMappingURL=plugin.d.ts.map
@@ -78,4 +78,3 @@ export type NxCypressE2EPresetOptions = {
78
78
  viteConfigOverrides?: InlineConfig;
79
79
  };
80
80
  export {};
81
- //# sourceMappingURL=cypress-preset.d.ts.map
@@ -36,4 +36,3 @@ export interface CypressExecutorOptions extends Json {
36
36
  export default function cypressExecutor(options: CypressExecutorOptions, context: ExecutorContext): Promise<{
37
37
  success: any;
38
38
  }>;
39
- //# sourceMappingURL=cypress.impl.d.ts.map
@@ -10,4 +10,3 @@ export interface CypressBaseSetupSchema {
10
10
  jsx?: boolean;
11
11
  }
12
12
  export declare function addBaseCypressSetup(tree: Tree, options: CypressBaseSetupSchema): void;
13
- //# sourceMappingURL=base-setup.d.ts.map
@@ -4,4 +4,3 @@ export declare function componentConfigurationGenerator(tree: Tree, options: Cyp
4
4
  export declare function componentConfigurationGeneratorInternal(tree: Tree, options: CypressComponentConfigurationSchema): Promise<GeneratorCallback>;
5
5
  export declare function updateTsConfigForComponentTesting(tree: Tree, projectConfig: ProjectConfiguration): void;
6
6
  export default componentConfigurationGenerator;
7
- //# sourceMappingURL=component-configuration.d.ts.map
@@ -22,4 +22,3 @@ export interface CypressE2EConfigSchema {
22
22
  export declare function configurationGenerator(tree: Tree, options: CypressE2EConfigSchema): Promise<GeneratorCallback>;
23
23
  export declare function configurationGeneratorInternal(tree: Tree, options: CypressE2EConfigSchema): Promise<GeneratorCallback>;
24
24
  export default configurationGenerator;
25
- //# sourceMappingURL=configuration.d.ts.map
@@ -6,4 +6,3 @@ interface Schema {
6
6
  }
7
7
  export declare function convertToInferred(tree: Tree, options: Schema): Promise<void>;
8
8
  export default convertToInferred;
9
- //# sourceMappingURL=convert-to-inferred.d.ts.map
@@ -10,4 +10,3 @@ import type { Tree } from '@nx/devkit';
10
10
  * b. Replace the existing webServerCommands with the value passed in
11
11
  */
12
12
  export declare function addDevServerTargetToConfig(tree: Tree, configFilePath: string, webServerCommands: Record<string, string>, ciDevServerTarget?: string): void;
13
- //# sourceMappingURL=add-dev-server-target-to-config.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import type { Tree } from '@nx/devkit';
2
2
  export declare function addExcludeSpecPattern(tree: Tree, configFilePath: string, excludeSpecPattern: string | string[]): void;
3
- //# sourceMappingURL=add-exclude-spec-pattern.d.ts.map
@@ -16,4 +16,3 @@ export declare const targetOptionsToCliMap: {
16
16
  quiet: string;
17
17
  runnerUi: string;
18
18
  };
19
- //# sourceMappingURL=target-options-map.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import type { Tree } from '@nx/devkit';
2
2
  export declare function upsertBaseUrl(tree: Tree, configFilePath: string, baseUrlValueInProject: string): void;
3
- //# sourceMappingURL=upsert-baseUrl.d.ts.map
@@ -4,4 +4,3 @@ export declare function addPlugin(tree: Tree, graph: ProjectGraph, updatePackage
4
4
  export declare function cypressInitGenerator(tree: Tree, options: Schema): Promise<GeneratorCallback>;
5
5
  export declare function cypressInitGeneratorInternal(tree: Tree, options: Schema): Promise<GeneratorCallback>;
6
6
  export default cypressInitGenerator;
7
- //# sourceMappingURL=init.d.ts.map
@@ -37,4 +37,3 @@ export declare function updatePluginFile(tree: Tree, projectConfig: ProjectConfi
37
37
  };
38
38
  cypressConfigJson: Record<string, any>;
39
39
  };
40
- //# sourceMappingURL=conversion.util.d.ts.map
@@ -1,4 +1,3 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  export declare function migrateCypressProject(tree: Tree): Promise<() => void>;
3
3
  export default migrateCypressProject;
4
- //# sourceMappingURL=migrate-to-cypress-11.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  export default function (tree: Tree): Promise<void>;
3
- //# sourceMappingURL=remove-experimental-fetch-polyfill.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  export default function (tree: Tree): Promise<void>;
3
- //# sourceMappingURL=replace-experimental-just-in-time-compile.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  export default function (tree: Tree): Promise<void>;
3
- //# sourceMappingURL=set-inject-document-domain.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  export default function (tree: Tree): Promise<void>;
3
- //# sourceMappingURL=update-component-testing-mount-imports.d.ts.map
@@ -0,0 +1,2 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export default function (tree: Tree): Promise<void>;
@@ -1,3 +1,2 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  export default function renameCyExecCodeProperty(tree: Tree): Promise<void>;
3
- //# sourceMappingURL=rename-cy-exec-code-property.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  export default function updateAngularComponentTestingSupport(tree: Tree): Promise<void>;
3
- //# sourceMappingURL=update-angular-component-testing-support.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  export default function updateSelectorPlaygroundApi(tree: Tree): Promise<void>;
3
- //# sourceMappingURL=update-selector-playground-api.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  export default function removeExperimentalPromptCommand(tree: Tree): Promise<void>;
3
- //# sourceMappingURL=remove-experimental-prompt-command.d.ts.map
@@ -0,0 +1,3 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export default function rewriteInternalSubpathImports(tree: Tree): Promise<void>;
3
+ export declare function rewriteSubpathImports(source: string): string;
@@ -0,0 +1,199 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = rewriteInternalSubpathImports;
4
+ exports.rewriteSubpathImports = rewriteSubpathImports;
5
+ const devkit_1 = require("@nx/devkit");
6
+ const TS_EXTENSIONS = ['.ts', '.tsx', '.cts', '.mts'];
7
+ const FROM_PREFIX = '@nx/cypress/src/';
8
+ const TO_PUBLIC = '@nx/cypress';
9
+ const TO_INTERNAL = '@nx/cypress/internal';
10
+ // Symbols exported from `@nx/cypress`'s public entry (packages/cypress/index.ts).
11
+ // A named import/export of one of these from `@nx/cypress/src/*` is routed to
12
+ // the public `@nx/cypress` entry; everything else goes to `@nx/cypress/internal`.
13
+ const PUBLIC_SYMBOLS = new Set([
14
+ 'configurationGenerator',
15
+ 'componentConfigurationGenerator',
16
+ 'cypressInitGenerator',
17
+ 'migrateCypressProject',
18
+ ]);
19
+ // Methods on `jest` and `vi` that take a module specifier as their first arg.
20
+ const MOCK_HELPER_METHODS = new Set([
21
+ 'mock',
22
+ 'unmock',
23
+ 'doMock',
24
+ 'dontMock',
25
+ 'requireActual',
26
+ 'requireMock',
27
+ 'importActual',
28
+ 'importMock',
29
+ ]);
30
+ let ts;
31
+ async function rewriteInternalSubpathImports(tree) {
32
+ let touchedCount = 0;
33
+ (0, devkit_1.visitNotIgnoredFiles)(tree, '.', (filePath) => {
34
+ if (!TS_EXTENSIONS.some((ext) => filePath.endsWith(ext))) {
35
+ return;
36
+ }
37
+ const original = tree.read(filePath, 'utf-8');
38
+ if (!original || !original.includes(FROM_PREFIX)) {
39
+ return;
40
+ }
41
+ const updated = rewriteSubpathImports(original);
42
+ if (updated !== original) {
43
+ tree.write(filePath, updated);
44
+ touchedCount += 1;
45
+ }
46
+ });
47
+ if (touchedCount > 0) {
48
+ devkit_1.logger.info(`Rewrote @nx/cypress/src/* imports in ${touchedCount} file(s) ` +
49
+ `(public symbols to @nx/cypress, internals to @nx/cypress/internal).`);
50
+ }
51
+ await (0, devkit_1.formatFiles)(tree);
52
+ }
53
+ function rewriteSubpathImports(source) {
54
+ ts ??= (0, devkit_1.ensurePackage)('typescript', '*');
55
+ const sourceFile = ts.createSourceFile('tmp.ts', source, ts.ScriptTarget.Latest,
56
+ /* setParentNodes */ true, ts.ScriptKind.TSX);
57
+ const changes = [];
58
+ for (const stmt of sourceFile.statements) {
59
+ if (ts.isImportDeclaration(stmt)) {
60
+ collectImportRewrite(sourceFile, stmt, changes);
61
+ }
62
+ else if (ts.isExportDeclaration(stmt)) {
63
+ collectExportRewrite(sourceFile, stmt, changes);
64
+ }
65
+ }
66
+ collectCallExpressionRewrites(sourceFile, changes);
67
+ return changes.length > 0 ? (0, devkit_1.applyChangesToString)(source, changes) : source;
68
+ }
69
+ function isSubpathSpecifier(node) {
70
+ return ts.isStringLiteral(node) && node.text.startsWith(FROM_PREFIX);
71
+ }
72
+ function collectImportRewrite(sourceFile, stmt, changes) {
73
+ if (!isSubpathSpecifier(stmt.moduleSpecifier)) {
74
+ return;
75
+ }
76
+ const clause = stmt.importClause;
77
+ // Pure named imports (`import { a, b } from '...'`) can be split by symbol.
78
+ // A default or namespace import grabs the whole module, so it can't be
79
+ // split — route it wholesale to the internal entry.
80
+ if (clause &&
81
+ !clause.name &&
82
+ clause.namedBindings &&
83
+ ts.isNamedImports(clause.namedBindings)) {
84
+ rewriteNamedDeclaration(sourceFile, stmt, stmt.moduleSpecifier, clause.isTypeOnly, clause.namedBindings.elements, 'import', changes);
85
+ return;
86
+ }
87
+ replaceSpecifier(sourceFile, stmt.moduleSpecifier, TO_INTERNAL, changes);
88
+ }
89
+ function collectExportRewrite(sourceFile, stmt, changes) {
90
+ if (!stmt.moduleSpecifier || !isSubpathSpecifier(stmt.moduleSpecifier)) {
91
+ return;
92
+ }
93
+ // `export { a, b } from '...'` can be split; `export * from '...'` cannot.
94
+ if (stmt.exportClause && ts.isNamedExports(stmt.exportClause)) {
95
+ rewriteNamedDeclaration(sourceFile, stmt, stmt.moduleSpecifier, stmt.isTypeOnly, stmt.exportClause.elements, 'export', changes);
96
+ return;
97
+ }
98
+ replaceSpecifier(sourceFile, stmt.moduleSpecifier, TO_INTERNAL, changes);
99
+ }
100
+ /**
101
+ * Partition the named bindings of an import/export declaration into the ones
102
+ * that resolve to `@nx/cypress`'s public entry and the ones that don't. If both
103
+ * groups are non-empty, the single declaration is split into two.
104
+ */
105
+ function rewriteNamedDeclaration(sourceFile, decl, specifier, isTypeOnly, elements, keyword, changes) {
106
+ const publicEls = [];
107
+ const internalEls = [];
108
+ for (const el of elements) {
109
+ // `propertyName` is the original name in `orig as alias`; fall back to
110
+ // `name` for the plain `orig` form.
111
+ const importedName = (el.propertyName ?? el.name).text;
112
+ (PUBLIC_SYMBOLS.has(importedName) ? publicEls : internalEls).push(el);
113
+ }
114
+ if (publicEls.length === 0) {
115
+ replaceSpecifier(sourceFile, specifier, TO_INTERNAL, changes);
116
+ return;
117
+ }
118
+ if (internalEls.length === 0) {
119
+ replaceSpecifier(sourceFile, specifier, TO_PUBLIC, changes);
120
+ return;
121
+ }
122
+ // Mixed — replace the whole declaration with one statement per target.
123
+ const quote = sourceFile.text.charAt(specifier.getStart(sourceFile));
124
+ const start = decl.getStart(sourceFile);
125
+ const end = decl.getEnd();
126
+ const semicolon = sourceFile.text.charAt(end - 1) === ';' ? ';' : '';
127
+ const prefix = isTypeOnly ? `${keyword} type` : keyword;
128
+ const render = (els, target) => `${prefix} { ${els
129
+ .map((el) => el.getText(sourceFile))
130
+ .join(', ')} } from ${quote}${target}${quote}${semicolon}`;
131
+ changes.push({ type: devkit_1.ChangeType.Delete, start, length: end - start }, {
132
+ type: devkit_1.ChangeType.Insert,
133
+ index: start,
134
+ text: `${render(publicEls, TO_PUBLIC)}\n${render(internalEls, TO_INTERNAL)}`,
135
+ });
136
+ }
137
+ function collectCallExpressionRewrites(sourceFile, changes) {
138
+ const visit = (node) => {
139
+ if (ts.isCallExpression(node) &&
140
+ shouldRewriteCallExpression(node) &&
141
+ node.arguments.length >= 1 &&
142
+ isSubpathSpecifier(node.arguments[0])) {
143
+ // `require(...)`, dynamic `import(...)` and `jest.mock(...)` reference
144
+ // the module as a whole and can't be symbol-split, so they go to the
145
+ // internal entry.
146
+ replaceSpecifier(sourceFile, node.arguments[0], TO_INTERNAL, changes);
147
+ }
148
+ else if (ts.isImportTypeNode(node)) {
149
+ // `typeof import('...')` parses as an `ImportTypeNode`, not a
150
+ // CallExpression — its argument is `LiteralTypeNode<StringLiteral>`.
151
+ // The whole module is referenced, so it can't be symbol-split.
152
+ const literal = getImportTypeStringLiteral(node);
153
+ if (literal && literal.text.startsWith(FROM_PREFIX)) {
154
+ replaceSpecifier(sourceFile, literal, TO_INTERNAL, changes);
155
+ }
156
+ }
157
+ ts.forEachChild(node, visit);
158
+ };
159
+ visit(sourceFile);
160
+ }
161
+ function getImportTypeStringLiteral(node) {
162
+ const arg = node.argument;
163
+ if (arg && ts.isLiteralTypeNode(arg) && ts.isStringLiteral(arg.literal)) {
164
+ return arg.literal;
165
+ }
166
+ return undefined;
167
+ }
168
+ function shouldRewriteCallExpression(call) {
169
+ const callee = call.expression;
170
+ // `require('...')`
171
+ if (ts.isIdentifier(callee) && callee.text === 'require')
172
+ return true;
173
+ // dynamic `import('...')` (runtime form parses as a CallExpression whose
174
+ // callee is the `import` keyword). The type-position form
175
+ // (`typeof import('...')`) is an `ImportTypeNode`, not a CallExpression, so
176
+ // we don't touch it.
177
+ if (callee.kind === ts.SyntaxKind.ImportKeyword)
178
+ return true;
179
+ // `jest.mock(...)` / `vi.mock(...)` and friends.
180
+ if (ts.isPropertyAccessExpression(callee)) {
181
+ const obj = callee.expression;
182
+ if (ts.isIdentifier(obj) &&
183
+ (obj.text === 'jest' || obj.text === 'vi') &&
184
+ MOCK_HELPER_METHODS.has(callee.name.text)) {
185
+ return true;
186
+ }
187
+ }
188
+ return false;
189
+ }
190
+ function replaceSpecifier(sourceFile, literal, target, changes) {
191
+ const start = literal.getStart(sourceFile);
192
+ const end = literal.getEnd();
193
+ const quote = sourceFile.text.charAt(start);
194
+ changes.push({ type: devkit_1.ChangeType.Delete, start, length: end - start }, {
195
+ type: devkit_1.ChangeType.Insert,
196
+ index: start,
197
+ text: `${quote}${target}${quote}`,
198
+ });
199
+ }
@@ -8,4 +8,3 @@ export interface CypressPluginOptions {
8
8
  }
9
9
  export declare const createNodes: CreateNodesV2<CypressPluginOptions>;
10
10
  export declare const createNodesV2: CreateNodesV2<CypressPluginOptions>;
11
- //# sourceMappingURL=plugin.d.ts.map
@@ -31,8 +31,29 @@ exports.createNodes = [
31
31
  const packageManager = (0, devkit_1.detectPackageManager)(context.workspaceRoot);
32
32
  const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
33
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, lockFileName), 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
59
  pluginCache.writeToDisk();
@@ -40,18 +61,9 @@ exports.createNodes = [
40
61
  },
41
62
  ];
42
63
  exports.createNodesV2 = exports.createNodes;
43
- async function createNodesInternal(configFilePath, options, context, pluginCache, pmc, lockFileName) {
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, internal_1.calculateHashForCreateNodes)(projectRoot, options, context, [
53
- lockFileName,
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
  }
@@ -481,3 +493,25 @@ async function getSpecFilesAndPatternsForTestType(cypressConfig, testType, works
481
493
  const specFiles = await (0, workspace_context_1.globWithWorkspaceContext)(workspaceRoot, specPatterns, excludeSpecPatterns);
482
494
  return { specFiles, specPatterns, excludeSpecPatterns };
483
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
@@ -1,3 +1,2 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  export declare function assertSupportedCypressVersion(tree: Tree): void;
3
- //# sourceMappingURL=assert-supported-cypress-version.d.ts.map
@@ -23,4 +23,3 @@ export declare function addDefaultCTConfig(cyConfigContents: string, options?: N
23
23
  export declare function addMountDefinition(cmpCommandFileContents: string): Promise<string>;
24
24
  export declare function getProjectCypressConfigPath(tree: Tree, projectRoot: string): string;
25
25
  export declare function resolveCypressConfigObject(cypressConfigContents: string): ObjectLiteralExpression | null;
26
- //# 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;
@@ -48,7 +15,7 @@ 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"])`);
@@ -109,7 +76,7 @@ async function addDefaultCTConfig(cyConfigContents, options = {}, presetImportPa
109
76
  if (!cyConfigContents) {
110
77
  throw new Error('The passed in cypress config file is empty!');
111
78
  }
112
- const { tsquery } = await Promise.resolve().then(() => __importStar(require('@phenomnomnominal/tsquery')));
79
+ const { tsquery } = await import('@phenomnomnominal/tsquery');
113
80
  const isCommonJS = tsquery.query(cyConfigContents, TS_QUERY_COMMON_JS_EXPORT_SELECTOR).length >
114
81
  0;
115
82
  const testingTypeConfig = tsquery.query(cyConfigContents, `${TS_QUERY_EXPORT_CONFIG_PREFIX} PropertyAssignment:has(Identifier[name="component"])`);
@@ -164,7 +131,7 @@ async function addMountDefinition(cmpCommandFileContents) {
164
131
  if (!cmpCommandFileContents) {
165
132
  throw new Error('The passed in cypress component file is empty!');
166
133
  }
167
- const { tsquery } = await Promise.resolve().then(() => __importStar(require('@phenomnomnominal/tsquery')));
134
+ const { tsquery } = await import('@phenomnomnominal/tsquery');
168
135
  const hasMountCommand = tsquery.query(cmpCommandFileContents, 'CallExpression StringLiteral[value="mount"]')?.length > 0;
169
136
  if (hasMountCommand) {
170
137
  return cmpCommandFileContents;
@@ -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
@@ -1,4 +1,3 @@
1
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
2
  export declare function warnCypressExecutorDeprecation(): void;
3
3
  export declare function warnCypressExecutorGenerating(): void;
4
- //# sourceMappingURL=deprecation.d.ts.map
@@ -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
@@ -1,4 +1,3 @@
1
1
  export declare function getUnscopedLibName(libRoot: string): string;
2
2
  export declare function getE2eProjectName(targetProjectName: string, targetLibRoot: string, cypressDirectory?: string): string;
3
3
  export declare function filePathPrefix(directory: string): string;
4
- //# sourceMappingURL=project-name.d.ts.map
@@ -7,4 +7,3 @@ export declare function startDevServer(opts: Omit<CypressExecutorOptions, 'cypre
7
7
  baseUrl: any;
8
8
  portLockFilePath: string;
9
9
  }, void, unknown>;
10
- //# sourceMappingURL=start-dev-server.d.ts.map
@@ -13,4 +13,3 @@ export declare function versions(tree: Tree): CypressVersions;
13
13
  export declare function getInstalledCypressVersion(tree?: Tree): string | null;
14
14
  export declare function getInstalledCypressMajorVersion(tree?: Tree): number | null;
15
15
  export declare function assertMinimumCypressVersion(minVersion: number, tree?: Tree): void;
16
- //# sourceMappingURL=versions.d.ts.map
@@ -5,10 +5,10 @@ exports.versions = versions;
5
5
  exports.getInstalledCypressVersion = getInstalledCypressVersion;
6
6
  exports.getInstalledCypressMajorVersion = getInstalledCypressMajorVersion;
7
7
  exports.assertMinimumCypressVersion = assertMinimumCypressVersion;
8
- const devkit_1 = require("@nx/devkit");
9
8
  const internal_1 = require("@nx/devkit/internal");
9
+ const path_1 = require("path");
10
10
  const semver_1 = require("semver");
11
- exports.nxVersion = require('../../package.json').version;
11
+ exports.nxVersion = require((0, path_1.join)('@nx/cypress', 'package.json')).version;
12
12
  exports.minSupportedCypressVersion = '13.0.0';
13
13
  exports.eslintPluginCypressVersion = '^3.5.0';
14
14
  exports.typesNodeVersion = '^22.0.0';
@@ -58,14 +58,7 @@ function getInstalledCypressVersion(tree) {
58
58
  if (!tree) {
59
59
  return (0, internal_1.getInstalledPackageVersion)('cypress');
60
60
  }
61
- const installedVersion = (0, devkit_1.getDependencyVersionFromPackageJson)(tree, 'cypress');
62
- if (!installedVersion) {
63
- return null;
64
- }
65
- if (installedVersion === 'latest' || installedVersion === 'next') {
66
- return (0, semver_1.clean)(exports.cypressVersion) ?? (0, semver_1.coerce)(exports.cypressVersion)?.version ?? null;
67
- }
68
- return (0, semver_1.clean)(installedVersion) ?? (0, semver_1.coerce)(installedVersion)?.version ?? null;
61
+ return (0, internal_1.getDeclaredPackageVersion)(tree, 'cypress');
69
62
  }
70
63
  function getInstalledCypressMajorVersion(tree) {
71
64
  const installedCypressVersion = getInstalledCypressVersion(tree);
package/executors.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "executors": {
3
3
  "cypress": {
4
- "implementation": "./src/executors/cypress/cypress.impl",
5
- "schema": "./src/executors/cypress/schema.json",
4
+ "implementation": "./dist/src/executors/cypress/cypress.impl",
5
+ "schema": "./dist/src/executors/cypress/schema.json",
6
6
  "description": "Run Cypress E2E tests."
7
7
  }
8
8
  }