@nx/rollup 23.0.0-beta.23 → 23.0.0-beta.25

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 (151) hide show
  1. package/{index.d.ts → dist/index.d.ts} +0 -1
  2. package/dist/internal.d.ts +1 -0
  3. package/dist/internal.js +7 -0
  4. package/{plugin.d.ts → dist/plugin.d.ts} +0 -1
  5. package/{src → dist/src}/executors/rollup/lib/normalize.d.ts +0 -1
  6. package/{src → dist/src}/executors/rollup/rollup.impl.d.ts +2 -3
  7. package/{src → dist/src}/executors/rollup/rollup.impl.js +2 -2
  8. package/{src → dist/src}/generators/configuration/configuration.d.ts +0 -1
  9. package/{src → dist/src}/generators/configuration/configuration.js +2 -0
  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/convert-to-inferred.js +2 -0
  12. package/{src → dist/src}/generators/convert-to-inferred/lib/add-plugin-registrations.d.ts +0 -1
  13. package/{src → dist/src}/generators/convert-to-inferred/lib/extract-rollup-config-from-executor-options.d.ts +0 -1
  14. package/{src → dist/src}/generators/convert-to-inferred/lib/normalize-path-options.d.ts +0 -1
  15. package/{src → dist/src}/generators/init/init.d.ts +0 -1
  16. package/{src → dist/src}/generators/init/init.js +8 -6
  17. package/{src → dist/src}/generators/init/schema.json +1 -1
  18. package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.d.ts +9 -0
  19. package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.js +134 -0
  20. package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.md +25 -0
  21. package/{src → dist/src}/migrations/update-23-0-0/remove-use-legacy-typescript-plugin.d.ts +0 -1
  22. package/dist/src/migrations/update-23-0-0/rewrite-internal-subpath-imports.d.ts +3 -0
  23. package/dist/src/migrations/update-23-0-0/rewrite-internal-subpath-imports.js +202 -0
  24. package/{src → dist/src}/plugins/analyze.d.ts +0 -1
  25. package/{src → dist/src}/plugins/delete-output.d.ts +0 -1
  26. package/{src → dist/src}/plugins/nx-copy-assets.plugin.d.ts +0 -1
  27. package/{src → dist/src}/plugins/package-json/generate-package-json.d.ts +0 -1
  28. package/{src → dist/src}/plugins/package-json/update-package-json.d.ts +0 -1
  29. package/{src → dist/src}/plugins/plugin.d.ts +0 -1
  30. package/{src → dist/src}/plugins/postcss/index.d.ts +0 -1
  31. package/{src → dist/src}/plugins/postcss/loaders/index.d.ts +0 -1
  32. package/{src → dist/src}/plugins/postcss/loaders/less-loader.d.ts +0 -1
  33. package/{src → dist/src}/plugins/postcss/loaders/postcss-loader.d.ts +0 -1
  34. package/{src → dist/src}/plugins/postcss/loaders/sass-loader.d.ts +0 -1
  35. package/{src → dist/src}/plugins/postcss/loaders/stylus-loader.d.ts +0 -1
  36. package/{src → dist/src}/plugins/postcss/loaders/types.d.ts +0 -1
  37. package/{src → dist/src}/plugins/postcss/options.d.ts +0 -1
  38. package/{src → dist/src}/plugins/postcss/postcss-plugin.d.ts +0 -1
  39. package/{src → dist/src}/plugins/postcss/utils/index.d.ts +0 -1
  40. package/{src → dist/src}/plugins/postcss/utils/load-module.d.ts +0 -1
  41. package/{src → dist/src}/plugins/postcss/utils/normalize-path.d.ts +0 -1
  42. package/{src → dist/src}/plugins/postcss/utils/safe-identifier.d.ts +0 -1
  43. package/{src → dist/src}/plugins/postcss/utils/style-inject.d.ts +0 -1
  44. package/{src → dist/src}/plugins/swc.d.ts +0 -1
  45. package/{src → dist/src}/plugins/with-nx/get-project-node.d.ts +0 -1
  46. package/{src → dist/src}/plugins/with-nx/normalize-options.d.ts +0 -1
  47. package/{src → dist/src}/plugins/with-nx/type-definitions.d.ts +0 -1
  48. package/{src → dist/src}/plugins/with-nx/with-nx-options.d.ts +0 -1
  49. package/{src → dist/src}/plugins/with-nx/with-nx.d.ts +0 -1
  50. package/{src → dist/src}/utils/deprecation.d.ts +0 -1
  51. package/{src → dist/src}/utils/ensure-dependencies.d.ts +0 -1
  52. package/{src → dist/src}/utils/ensure-dependencies.js +3 -3
  53. package/{src → dist/src}/utils/fs.d.ts +0 -1
  54. package/{src → dist/src}/utils/has-plugin.d.ts +0 -1
  55. package/{src → dist/src}/utils/versions.d.ts +3 -1
  56. package/dist/src/utils/versions.js +18 -0
  57. package/{with-nx.d.ts → dist/with-nx.d.ts} +0 -1
  58. package/executors.json +2 -2
  59. package/generators.json +6 -6
  60. package/migrations.json +24 -3
  61. package/package.json +65 -11
  62. package/index.d.ts.map +0 -1
  63. package/plugin.d.ts.map +0 -1
  64. package/src/executors/rollup/lib/normalize.d.ts.map +0 -1
  65. package/src/executors/rollup/rollup.impl.d.ts.map +0 -1
  66. package/src/generators/configuration/configuration.d.ts.map +0 -1
  67. package/src/generators/convert-to-inferred/convert-to-inferred.d.ts.map +0 -1
  68. package/src/generators/convert-to-inferred/lib/add-plugin-registrations.d.ts.map +0 -1
  69. package/src/generators/convert-to-inferred/lib/extract-rollup-config-from-executor-options.d.ts.map +0 -1
  70. package/src/generators/convert-to-inferred/lib/normalize-path-options.d.ts.map +0 -1
  71. package/src/generators/init/init.d.ts.map +0 -1
  72. package/src/migrations/update-23-0-0/remove-use-legacy-typescript-plugin.d.ts.map +0 -1
  73. package/src/plugins/analyze.d.ts.map +0 -1
  74. package/src/plugins/delete-output.d.ts.map +0 -1
  75. package/src/plugins/nx-copy-assets.plugin.d.ts.map +0 -1
  76. package/src/plugins/package-json/generate-package-json.d.ts.map +0 -1
  77. package/src/plugins/package-json/update-package-json.d.ts.map +0 -1
  78. package/src/plugins/plugin.d.ts.map +0 -1
  79. package/src/plugins/postcss/index.d.ts.map +0 -1
  80. package/src/plugins/postcss/loaders/index.d.ts.map +0 -1
  81. package/src/plugins/postcss/loaders/less-loader.d.ts.map +0 -1
  82. package/src/plugins/postcss/loaders/postcss-loader.d.ts.map +0 -1
  83. package/src/plugins/postcss/loaders/sass-loader.d.ts.map +0 -1
  84. package/src/plugins/postcss/loaders/stylus-loader.d.ts.map +0 -1
  85. package/src/plugins/postcss/loaders/types.d.ts.map +0 -1
  86. package/src/plugins/postcss/options.d.ts.map +0 -1
  87. package/src/plugins/postcss/postcss-plugin.d.ts.map +0 -1
  88. package/src/plugins/postcss/utils/index.d.ts.map +0 -1
  89. package/src/plugins/postcss/utils/load-module.d.ts.map +0 -1
  90. package/src/plugins/postcss/utils/normalize-path.d.ts.map +0 -1
  91. package/src/plugins/postcss/utils/safe-identifier.d.ts.map +0 -1
  92. package/src/plugins/postcss/utils/style-inject.d.ts.map +0 -1
  93. package/src/plugins/swc.d.ts.map +0 -1
  94. package/src/plugins/with-nx/get-project-node.d.ts.map +0 -1
  95. package/src/plugins/with-nx/normalize-options.d.ts.map +0 -1
  96. package/src/plugins/with-nx/type-definitions.d.ts.map +0 -1
  97. package/src/plugins/with-nx/with-nx-options.d.ts.map +0 -1
  98. package/src/plugins/with-nx/with-nx.d.ts.map +0 -1
  99. package/src/utils/deprecation.d.ts.map +0 -1
  100. package/src/utils/ensure-dependencies.d.ts.map +0 -1
  101. package/src/utils/fs.d.ts.map +0 -1
  102. package/src/utils/has-plugin.d.ts.map +0 -1
  103. package/src/utils/versions.d.ts.map +0 -1
  104. package/src/utils/versions.js +0 -8
  105. package/with-nx.d.ts.map +0 -1
  106. /package/{LICENSE → dist/LICENSE} +0 -0
  107. /package/{index.js → dist/index.js} +0 -0
  108. /package/{plugin.js → dist/plugin.js} +0 -0
  109. /package/{src → dist/src}/executors/rollup/lib/normalize.js +0 -0
  110. /package/{src → dist/src}/executors/rollup/schema.d.ts +0 -0
  111. /package/{src → dist/src}/executors/rollup/schema.json +0 -0
  112. /package/{src → dist/src}/generators/configuration/schema.d.ts +0 -0
  113. /package/{src → dist/src}/generators/configuration/schema.json +0 -0
  114. /package/{src → dist/src}/generators/convert-to-inferred/lib/add-plugin-registrations.js +0 -0
  115. /package/{src → dist/src}/generators/convert-to-inferred/lib/extract-rollup-config-from-executor-options.js +0 -0
  116. /package/{src → dist/src}/generators/convert-to-inferred/lib/normalize-path-options.js +0 -0
  117. /package/{src → dist/src}/generators/convert-to-inferred/schema.json +0 -0
  118. /package/{src → dist/src}/generators/init/schema.d.ts +0 -0
  119. /package/{src → dist/src}/migrations/update-23-0-0/remove-use-legacy-typescript-plugin.js +0 -0
  120. /package/{src → dist/src}/migrations/update-23-0-0/remove-use-legacy-typescript-plugin.md +0 -0
  121. /package/{src → dist/src}/plugins/analyze.js +0 -0
  122. /package/{src → dist/src}/plugins/delete-output.js +0 -0
  123. /package/{src → dist/src}/plugins/nx-copy-assets.plugin.js +0 -0
  124. /package/{src → dist/src}/plugins/package-json/generate-package-json.js +0 -0
  125. /package/{src → dist/src}/plugins/package-json/update-package-json.js +0 -0
  126. /package/{src → dist/src}/plugins/plugin.js +0 -0
  127. /package/{src → dist/src}/plugins/postcss/index.js +0 -0
  128. /package/{src → dist/src}/plugins/postcss/loaders/index.js +0 -0
  129. /package/{src → dist/src}/plugins/postcss/loaders/less-loader.js +0 -0
  130. /package/{src → dist/src}/plugins/postcss/loaders/postcss-loader.js +0 -0
  131. /package/{src → dist/src}/plugins/postcss/loaders/sass-loader.js +0 -0
  132. /package/{src → dist/src}/plugins/postcss/loaders/stylus-loader.js +0 -0
  133. /package/{src → dist/src}/plugins/postcss/loaders/types.js +0 -0
  134. /package/{src → dist/src}/plugins/postcss/options.js +0 -0
  135. /package/{src → dist/src}/plugins/postcss/postcss-plugin.js +0 -0
  136. /package/{src → dist/src}/plugins/postcss/types/concat-with-sourcemaps.d.ts +0 -0
  137. /package/{src → dist/src}/plugins/postcss/utils/index.js +0 -0
  138. /package/{src → dist/src}/plugins/postcss/utils/load-module.js +0 -0
  139. /package/{src → dist/src}/plugins/postcss/utils/normalize-path.js +0 -0
  140. /package/{src → dist/src}/plugins/postcss/utils/safe-identifier.js +0 -0
  141. /package/{src → dist/src}/plugins/postcss/utils/style-inject.js +0 -0
  142. /package/{src → dist/src}/plugins/swc.js +0 -0
  143. /package/{src → dist/src}/plugins/with-nx/get-project-node.js +0 -0
  144. /package/{src → dist/src}/plugins/with-nx/normalize-options.js +0 -0
  145. /package/{src → dist/src}/plugins/with-nx/type-definitions.js +0 -0
  146. /package/{src → dist/src}/plugins/with-nx/with-nx-options.js +0 -0
  147. /package/{src → dist/src}/plugins/with-nx/with-nx.js +0 -0
  148. /package/{src → dist/src}/utils/deprecation.js +0 -0
  149. /package/{src → dist/src}/utils/fs.js +0 -0
  150. /package/{src → dist/src}/utils/has-plugin.js +0 -0
  151. /package/{with-nx.js → dist/with-nx.js} +0 -0
@@ -5,4 +5,3 @@ export declare const rollupProjectGenerator: typeof configurationGenerator;
5
5
  export * from './src/generators/init/init';
6
6
  export type { AssetGlobPattern, Globals, RollupExecutorOptions, } from './src/executors/rollup/schema';
7
7
  export * from './src/executors/rollup/rollup.impl';
8
- //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ export { hasPlugin } from './src/utils/has-plugin';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasPlugin = void 0;
4
+ // Curated internal API surface for other first-party Nx plugins. Prefer this
5
+ // over deep `@nx/rollup/src/*` imports — those are not part of the public API.
6
+ var has_plugin_1 = require("./src/utils/has-plugin");
7
+ Object.defineProperty(exports, "hasPlugin", { enumerable: true, get: function () { return has_plugin_1.hasPlugin; } });
@@ -1,2 +1 @@
1
1
  export { createNodes, createNodesV2, RollupPluginOptions, } from './src/plugins/plugin';
2
- //# sourceMappingURL=plugin.d.ts.map
@@ -6,4 +6,3 @@ export interface NormalizedRollupExecutorOptions extends RollupExecutorOptions {
6
6
  }
7
7
  export declare function normalizeRollupExecutorOptions(options: RollupExecutorOptions, context: ExecutorContext): NormalizedRollupExecutorOptions;
8
8
  export declare function normalizePluginPath(pluginPath: void | string, root: string): string;
9
- //# sourceMappingURL=normalize.d.ts.map
@@ -1,8 +1,7 @@
1
- import * as rollup from 'rollup';
1
+ import type * as Rollup from 'rollup';
2
2
  import { type ExecutorContext } from '@nx/devkit';
3
3
  import { RollupExecutorOptions } from './schema';
4
4
  import { NormalizedRollupExecutorOptions } from './lib/normalize';
5
5
  export declare function rollupExecutor(rawOptions: RollupExecutorOptions, context: ExecutorContext): AsyncGenerator<unknown, any, any>;
6
- export declare function createRollupOptions(options: NormalizedRollupExecutorOptions, context: ExecutorContext): Promise<rollup.RollupOptions | rollup.RollupOptions[]>;
6
+ export declare function createRollupOptions(options: NormalizedRollupExecutorOptions, context: ExecutorContext): Promise<Rollup.RollupOptions | Rollup.RollupOptions[]>;
7
7
  export default rollupExecutor;
8
- //# sourceMappingURL=rollup.impl.d.ts.map
@@ -2,8 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.rollupExecutor = rollupExecutor;
4
4
  exports.createRollupOptions = createRollupOptions;
5
- const tslib_1 = require("tslib");
6
- const rollup = tslib_1.__importStar(require("rollup"));
7
5
  const path_1 = require("path");
8
6
  const devkit_1 = require("@nx/devkit");
9
7
  const internal_1 = require("@nx/devkit/internal");
@@ -14,6 +12,8 @@ const internal_2 = require("@nx/js/internal");
14
12
  const deprecation_1 = require("../../utils/deprecation");
15
13
  async function* rollupExecutor(rawOptions, context) {
16
14
  (0, deprecation_1.warnRollupExecutorDeprecation)();
15
+ // Lazy-loaded: `rollup` is an optional peer, absent at project-graph discovery time.
16
+ const rollup = require('rollup');
17
17
  process.env.NODE_ENV ??= 'production';
18
18
  const options = (0, normalize_1.normalizeRollupExecutorOptions)(rawOptions, context);
19
19
  const rollupOptions = await createRollupOptions(options, context);
@@ -2,4 +2,3 @@ import { GeneratorCallback, Tree } from '@nx/devkit';
2
2
  import { RollupProjectSchema } from './schema';
3
3
  export declare function configurationGenerator(tree: Tree, options: RollupProjectSchema): Promise<GeneratorCallback>;
4
4
  export default configurationGenerator;
5
- //# sourceMappingURL=configuration.d.ts.map
@@ -10,9 +10,11 @@ const devkit_internals_1 = require("nx/src/devkit-internals");
10
10
  const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
11
11
  const has_plugin_1 = require("../../utils/has-plugin");
12
12
  const deprecation_1 = require("../../utils/deprecation");
13
+ const versions_1 = require("../../utils/versions");
13
14
  const init_1 = require("../init/init");
14
15
  let ts;
15
16
  async function configurationGenerator(tree, options) {
17
+ (0, versions_1.assertSupportedRollupVersion)(tree);
16
18
  const tasks = [];
17
19
  const nxJson = (0, devkit_1.readNxJson)(tree);
18
20
  const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
@@ -5,4 +5,3 @@ interface Schema {
5
5
  }
6
6
  export declare function convertToInferred(tree: Tree, options: Schema): Promise<void>;
7
7
  export default convertToInferred;
8
- //# sourceMappingURL=convert-to-inferred.d.ts.map
@@ -5,7 +5,9 @@ const internal_1 = require("@nx/devkit/internal");
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const extract_rollup_config_from_executor_options_1 = require("./lib/extract-rollup-config-from-executor-options");
7
7
  const add_plugin_registrations_1 = require("./lib/add-plugin-registrations");
8
+ const versions_1 = require("../../utils/versions");
8
9
  async function convertToInferred(tree, options) {
10
+ (0, versions_1.assertSupportedRollupVersion)(tree);
9
11
  const migratedProjects = new Map();
10
12
  let projects = (0, devkit_1.getProjects)(tree);
11
13
  (0, internal_1.forEachExecutorOptions)(tree, '@nx/rollup:rollup', (_, projectName, targetName, configurationName) => {
@@ -1,3 +1,2 @@
1
1
  import { type ProjectConfiguration, type Tree } from '@nx/devkit';
2
2
  export declare function addPluginRegistrations<T>(tree: Tree, projectTargets: Map<string, T>, projects: Map<string, ProjectConfiguration>, pluginPath: string): Promise<void>;
3
- //# sourceMappingURL=add-plugin-registrations.d.ts.map
@@ -1,4 +1,3 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  import { RollupExecutorOptions } from '../../../executors/rollup/schema';
3
3
  export declare function extractRollupConfigFromExecutorOptions(tree: Tree, options: RollupExecutorOptions, configurations: Record<string, Partial<RollupExecutorOptions>>, projectRoot: string): Record<string, unknown>;
4
- //# sourceMappingURL=extract-rollup-config-from-executor-options.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import { RollupExecutorOptions } from '../../../executors/rollup/schema';
2
2
  export declare function normalizePathOptions(projectRoot: string, options: RollupExecutorOptions): void;
3
- //# sourceMappingURL=normalize-path-options.d.ts.map
@@ -2,4 +2,3 @@ import { GeneratorCallback, Tree } from '@nx/devkit';
2
2
  import { Schema } from './schema';
3
3
  export declare function rollupInitGenerator(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
4
4
  export default rollupInitGenerator;
5
- //# sourceMappingURL=init.d.ts.map
@@ -6,18 +6,20 @@ const devkit_1 = require("@nx/devkit");
6
6
  const versions_1 = require("../../utils/versions");
7
7
  const plugin_1 = require("../../plugins/plugin");
8
8
  async function rollupInitGenerator(tree, schema) {
9
+ (0, versions_1.assertSupportedRollupVersion)(tree);
9
10
  let task = () => { };
10
11
  const nxJson = (0, devkit_1.readNxJson)(tree);
11
12
  schema.addPlugin ??=
12
13
  process.env.NX_ADD_PLUGINS !== 'false' &&
13
14
  nxJson.useInferencePlugins !== false;
14
15
  if (!schema.skipPackageJson) {
15
- const devDependencies = { '@nx/rollup': versions_1.nxVersion };
16
- if (schema.addPlugin) {
17
- // Ensure user can run Rollup CLI.
18
- devDependencies['rollup'] = versions_1.rollupVersion;
19
- }
20
- task = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies, undefined, schema.keepExistingVersions);
16
+ // Rollup is a peer dependency, so ensure it is installed for both the
17
+ // inferred-plugin (CLI) path and the executor (programmatic) path.
18
+ const devDependencies = {
19
+ '@nx/rollup': versions_1.nxVersion,
20
+ rollup: versions_1.rollupVersion,
21
+ };
22
+ task = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies, undefined, schema.keepExistingVersions ?? true);
21
23
  }
22
24
  if (schema.addPlugin) {
23
25
  await (0, internal_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/rollup/plugin', plugin_1.createNodesV2, {
@@ -20,7 +20,7 @@
20
20
  "type": "boolean",
21
21
  "x-priority": "internal",
22
22
  "description": "Keep existing dependencies versions",
23
- "default": false
23
+ "default": true
24
24
  },
25
25
  "updatePackageScripts": {
26
26
  "type": "boolean",
@@ -0,0 +1,9 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export default function migrateCreateNodesV2ToCreateNodes(tree: Tree): Promise<void>;
3
+ /**
4
+ * Rewrites named imports and re-exports of `createNodesV2` to `createNodes`
5
+ * when they come from one of the given module specifiers. Only the named
6
+ * bindings are touched — the module specifier, the `import`/`export` keyword,
7
+ * any `type` modifier, and any default import are left untouched.
8
+ */
9
+ export declare function rewriteCreateNodesV2Imports(source: string, specifiers: ReadonlySet<string>): string;
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = migrateCreateNodesV2ToCreateNodes;
4
+ exports.rewriteCreateNodesV2Imports = rewriteCreateNodesV2Imports;
5
+ const devkit_1 = require("@nx/devkit");
6
+ const TS_EXTENSIONS = ['.ts', '.tsx', '.cts', '.mts'];
7
+ const DEPRECATED_NAME = 'createNodesV2';
8
+ const CANONICAL_NAME = 'createNodes';
9
+ // Module specifiers from which `@nx/rollup` publicly exposes `createNodesV2`.
10
+ // A named import or re-export of `createNodesV2` from one of these is rewritten
11
+ // to the canonical `createNodes` export.
12
+ const TARGET_SPECIFIERS = new Set(['@nx/rollup/plugin']);
13
+ let ts;
14
+ async function migrateCreateNodesV2ToCreateNodes(tree) {
15
+ let touchedCount = 0;
16
+ (0, devkit_1.visitNotIgnoredFiles)(tree, '.', (filePath) => {
17
+ if (!TS_EXTENSIONS.some((ext) => filePath.endsWith(ext))) {
18
+ return;
19
+ }
20
+ const original = tree.read(filePath, 'utf-8');
21
+ if (!original || !original.includes(DEPRECATED_NAME)) {
22
+ return;
23
+ }
24
+ const updated = rewriteCreateNodesV2Imports(original, TARGET_SPECIFIERS);
25
+ if (updated !== original) {
26
+ tree.write(filePath, updated);
27
+ touchedCount += 1;
28
+ }
29
+ });
30
+ if (touchedCount > 0) {
31
+ devkit_1.logger.info(`Renamed \`${DEPRECATED_NAME}\` imports to \`${CANONICAL_NAME}\` in ${touchedCount} file(s).`);
32
+ }
33
+ await (0, devkit_1.formatFiles)(tree);
34
+ }
35
+ /**
36
+ * Rewrites named imports and re-exports of `createNodesV2` to `createNodes`
37
+ * when they come from one of the given module specifiers. Only the named
38
+ * bindings are touched — the module specifier, the `import`/`export` keyword,
39
+ * any `type` modifier, and any default import are left untouched.
40
+ */
41
+ function rewriteCreateNodesV2Imports(source, specifiers) {
42
+ ts ??= (0, devkit_1.ensurePackage)('typescript', '*');
43
+ const sourceFile = ts.createSourceFile('tmp.ts', source, ts.ScriptTarget.Latest,
44
+ /* setParentNodes */ true, ts.ScriptKind.TSX);
45
+ const changes = [];
46
+ for (const stmt of sourceFile.statements) {
47
+ if (ts.isImportDeclaration(stmt)) {
48
+ collectImportRewrite(sourceFile, stmt, specifiers, changes);
49
+ }
50
+ else if (ts.isExportDeclaration(stmt)) {
51
+ collectExportRewrite(sourceFile, stmt, specifiers, changes);
52
+ }
53
+ }
54
+ return changes.length > 0 ? (0, devkit_1.applyChangesToString)(source, changes) : source;
55
+ }
56
+ function isTargetSpecifier(node, specifiers) {
57
+ return ts.isStringLiteral(node) && specifiers.has(node.text);
58
+ }
59
+ function collectImportRewrite(sourceFile, stmt, specifiers, changes) {
60
+ if (!isTargetSpecifier(stmt.moduleSpecifier, specifiers)) {
61
+ return;
62
+ }
63
+ const namedBindings = stmt.importClause?.namedBindings;
64
+ // Only `import { ... }` carries renameable named bindings. `import x`,
65
+ // `import * as ns`, and side-effect imports reference the module wholesale
66
+ // and keep working through the `createNodesV2` runtime alias, so we leave
67
+ // them be. A mixed `import def, { createNodesV2 }` still has its named
68
+ // bindings rewritten below — the default binding is untouched.
69
+ if (!namedBindings || !ts.isNamedImports(namedBindings)) {
70
+ return;
71
+ }
72
+ rewriteNamedBindings(sourceFile, namedBindings, changes);
73
+ }
74
+ function collectExportRewrite(sourceFile, stmt, specifiers, changes) {
75
+ if (!stmt.moduleSpecifier ||
76
+ !isTargetSpecifier(stmt.moduleSpecifier, specifiers)) {
77
+ return;
78
+ }
79
+ // `export { ... } from '...'` can be rewritten; `export * from '...'` has no
80
+ // named bindings to rename.
81
+ if (!stmt.exportClause || !ts.isNamedExports(stmt.exportClause)) {
82
+ return;
83
+ }
84
+ rewriteNamedBindings(sourceFile, stmt.exportClause, changes);
85
+ }
86
+ /**
87
+ * Re-renders the `{ ... }` of a named import/export, renaming any
88
+ * `createNodesV2` specifier to `createNodes`. If renaming would collide with a
89
+ * `createNodes` that is already present (e.g. `{ createNodes, createNodesV2 }`),
90
+ * the duplicate is dropped. Returns without recording a change when the binding
91
+ * list contains no `createNodesV2`.
92
+ */
93
+ function rewriteNamedBindings(sourceFile, namedBindings, changes) {
94
+ const elements = namedBindings.elements;
95
+ const hasDeprecated = elements.some((el) => (el.propertyName ?? el.name).text === DEPRECATED_NAME);
96
+ if (!hasDeprecated) {
97
+ return;
98
+ }
99
+ const seen = new Set();
100
+ const rendered = [];
101
+ for (const el of elements) {
102
+ const text = renderSpecifier(el);
103
+ if (!seen.has(text)) {
104
+ seen.add(text);
105
+ rendered.push(text);
106
+ }
107
+ }
108
+ const start = namedBindings.getStart(sourceFile);
109
+ changes.push({
110
+ type: devkit_1.ChangeType.Delete,
111
+ start,
112
+ length: namedBindings.getEnd() - start,
113
+ }, {
114
+ type: devkit_1.ChangeType.Insert,
115
+ index: start,
116
+ text: `{ ${rendered.join(', ')} }`,
117
+ });
118
+ }
119
+ function renderSpecifier(el) {
120
+ const typePrefix = el.isTypeOnly ? 'type ' : '';
121
+ const rename = (name) => name === DEPRECATED_NAME ? CANONICAL_NAME : name;
122
+ // `{ name }` — no alias, so the local binding follows the rename.
123
+ if (!el.propertyName) {
124
+ return `${typePrefix}${rename(el.name.text)}`;
125
+ }
126
+ // `{ propertyName as name }` — only the imported (left) side is renamed; the
127
+ // local alias is preserved. A now-redundant alias such as
128
+ // `createNodesV2 as createNodes` collapses to `createNodes`.
129
+ const canonicalImported = rename(el.propertyName.text);
130
+ const localName = el.name.text;
131
+ return canonicalImported === localName
132
+ ? `${typePrefix}${localName}`
133
+ : `${typePrefix}${canonicalImported} as ${localName}`;
134
+ }
@@ -0,0 +1,25 @@
1
+ #### Rename `createNodesV2` imports to `createNodes`
2
+
3
+ `@nx/rollup` renamed its primary inferred-plugin export from `createNodesV2` to `createNodes`. The `createNodesV2` name is preserved as a deprecated alias for now, but new code should use `createNodes`.
4
+
5
+ This migration scans every `.ts`, `.tsx`, `.cts`, and `.mts` file in your workspace and rewrites named imports and re-exports of `createNodesV2` from `@nx/rollup/plugin` to `createNodes`.
6
+
7
+ #### Sample Code Changes
8
+
9
+ ##### Before
10
+
11
+ ```ts
12
+ import { createNodesV2 } from '@nx/rollup/plugin';
13
+ ```
14
+
15
+ ##### After
16
+
17
+ ```ts
18
+ import { createNodes } from '@nx/rollup/plugin';
19
+ ```
20
+
21
+ Aliases are preserved (`createNodesV2 as cn` becomes `createNodes as cn`), and if a file already imports both names (`{ createNodes, createNodesV2 }`) the redundant binding is dropped.
22
+
23
+ #### What is not rewritten
24
+
25
+ Only static `import`/`export` named bindings from `@nx/rollup/plugin` are rewritten. Namespace imports, dynamic `import(...)`, `require(...)` destructuring, and property access such as `plugin.createNodesV2` are left untouched — they keep working through the `createNodesV2` runtime alias. Update those by hand if you want to drop the deprecated name everywhere.
@@ -1,3 +1,2 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  export default function (tree: Tree): Promise<void>;
3
- //# sourceMappingURL=remove-use-legacy-typescript-plugin.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,202 @@
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/rollup/src/';
8
+ const TO_PUBLIC = '@nx/rollup';
9
+ const TO_INTERNAL = '@nx/rollup/internal';
10
+ // Symbols exported from `@nx/rollup`'s public entry (packages/rollup/index.ts).
11
+ // A named import/export of one of these from `@nx/rollup/src/*` is routed to
12
+ // the public `@nx/rollup` entry; everything else goes to `@nx/rollup/internal`.
13
+ const PUBLIC_SYMBOLS = new Set([
14
+ 'AssetGlobPattern',
15
+ 'Globals',
16
+ 'RollupExecutorOptions',
17
+ 'configurationGenerator',
18
+ 'createRollupOptions',
19
+ 'rollupExecutor',
20
+ 'rollupInitGenerator',
21
+ 'rollupProjectGenerator',
22
+ ]);
23
+ // Methods on `jest` and `vi` that take a module specifier as their first arg.
24
+ const MOCK_HELPER_METHODS = new Set([
25
+ 'mock',
26
+ 'unmock',
27
+ 'doMock',
28
+ 'dontMock',
29
+ 'requireActual',
30
+ 'requireMock',
31
+ 'importActual',
32
+ 'importMock',
33
+ ]);
34
+ let ts;
35
+ async function rewriteInternalSubpathImports(tree) {
36
+ let touchedCount = 0;
37
+ (0, devkit_1.visitNotIgnoredFiles)(tree, '.', (filePath) => {
38
+ if (!TS_EXTENSIONS.some((ext) => filePath.endsWith(ext))) {
39
+ return;
40
+ }
41
+ const original = tree.read(filePath, 'utf-8');
42
+ if (!original || !original.includes(FROM_PREFIX)) {
43
+ return;
44
+ }
45
+ const updated = rewriteSubpathImports(original);
46
+ if (updated !== original) {
47
+ tree.write(filePath, updated);
48
+ touchedCount += 1;
49
+ }
50
+ });
51
+ if (touchedCount > 0) {
52
+ devkit_1.logger.info(`Rewrote @nx/rollup/src/* imports in ${touchedCount} file(s) ` +
53
+ `(public symbols to @nx/rollup, internals to @nx/rollup/internal).`);
54
+ }
55
+ await (0, devkit_1.formatFiles)(tree);
56
+ }
57
+ function rewriteSubpathImports(source) {
58
+ ts ??= (0, devkit_1.ensurePackage)('typescript', '*');
59
+ const sourceFile = ts.createSourceFile('tmp.ts', source, ts.ScriptTarget.Latest,
60
+ /* setParentNodes */ true, ts.ScriptKind.TSX);
61
+ const changes = [];
62
+ for (const stmt of sourceFile.statements) {
63
+ if (ts.isImportDeclaration(stmt)) {
64
+ collectImportRewrite(sourceFile, stmt, changes);
65
+ }
66
+ else if (ts.isExportDeclaration(stmt)) {
67
+ collectExportRewrite(sourceFile, stmt, changes);
68
+ }
69
+ }
70
+ collectCallExpressionRewrites(sourceFile, changes);
71
+ return changes.length > 0 ? (0, devkit_1.applyChangesToString)(source, changes) : source;
72
+ }
73
+ function isSubpathSpecifier(node) {
74
+ return ts.isStringLiteral(node) && node.text.startsWith(FROM_PREFIX);
75
+ }
76
+ function collectImportRewrite(sourceFile, stmt, changes) {
77
+ if (!isSubpathSpecifier(stmt.moduleSpecifier)) {
78
+ return;
79
+ }
80
+ const clause = stmt.importClause;
81
+ // Pure named imports (`import { a, b } from '...'`) can be split by symbol.
82
+ // A default or namespace import grabs the whole module, so it can't be
83
+ // split — route it wholesale to the internal entry.
84
+ if (clause &&
85
+ !clause.name &&
86
+ clause.namedBindings &&
87
+ ts.isNamedImports(clause.namedBindings)) {
88
+ rewriteNamedDeclaration(sourceFile, stmt, stmt.moduleSpecifier, clause.isTypeOnly, clause.namedBindings.elements, 'import', changes);
89
+ return;
90
+ }
91
+ replaceSpecifier(sourceFile, stmt.moduleSpecifier, TO_INTERNAL, changes);
92
+ }
93
+ function collectExportRewrite(sourceFile, stmt, changes) {
94
+ if (!stmt.moduleSpecifier || !isSubpathSpecifier(stmt.moduleSpecifier)) {
95
+ return;
96
+ }
97
+ // `export { a, b } from '...'` can be split; `export * from '...'` cannot.
98
+ if (stmt.exportClause && ts.isNamedExports(stmt.exportClause)) {
99
+ rewriteNamedDeclaration(sourceFile, stmt, stmt.moduleSpecifier, stmt.isTypeOnly, stmt.exportClause.elements, 'export', changes);
100
+ return;
101
+ }
102
+ replaceSpecifier(sourceFile, stmt.moduleSpecifier, TO_INTERNAL, changes);
103
+ }
104
+ /**
105
+ * Partition the named bindings of an import/export declaration into the ones
106
+ * that resolve to `@nx/rollup`'s public entry and the ones that don't. If both
107
+ * groups are non-empty, the single declaration is split into two.
108
+ */
109
+ function rewriteNamedDeclaration(sourceFile, decl, specifier, isTypeOnly, elements, keyword, changes) {
110
+ const publicEls = [];
111
+ const internalEls = [];
112
+ for (const el of elements) {
113
+ // `propertyName` is the original name in `orig as alias`; fall back to
114
+ // `name` for the plain `orig` form.
115
+ const importedName = (el.propertyName ?? el.name).text;
116
+ (PUBLIC_SYMBOLS.has(importedName) ? publicEls : internalEls).push(el);
117
+ }
118
+ if (publicEls.length === 0) {
119
+ replaceSpecifier(sourceFile, specifier, TO_INTERNAL, changes);
120
+ return;
121
+ }
122
+ if (internalEls.length === 0) {
123
+ replaceSpecifier(sourceFile, specifier, TO_PUBLIC, changes);
124
+ return;
125
+ }
126
+ // Mixed — replace the whole declaration with one statement per target.
127
+ const quote = sourceFile.text.charAt(specifier.getStart(sourceFile));
128
+ const start = decl.getStart(sourceFile);
129
+ const end = decl.getEnd();
130
+ const semicolon = sourceFile.text.charAt(end - 1) === ';' ? ';' : '';
131
+ const prefix = isTypeOnly ? `${keyword} type` : keyword;
132
+ const render = (els, target) => `${prefix} { ${els
133
+ .map((el) => el.getText(sourceFile))
134
+ .join(', ')} } from ${quote}${target}${quote}${semicolon}`;
135
+ changes.push({ type: devkit_1.ChangeType.Delete, start, length: end - start }, {
136
+ type: devkit_1.ChangeType.Insert,
137
+ index: start,
138
+ text: `${render(publicEls, TO_PUBLIC)}\n${render(internalEls, TO_INTERNAL)}`,
139
+ });
140
+ }
141
+ function collectCallExpressionRewrites(sourceFile, changes) {
142
+ const visit = (node) => {
143
+ if (ts.isCallExpression(node) &&
144
+ shouldRewriteCallExpression(node) &&
145
+ node.arguments.length >= 1 &&
146
+ isSubpathSpecifier(node.arguments[0])) {
147
+ // `require(...)`, dynamic `import(...)` and `jest.mock(...)` reference
148
+ // the module as a whole and can't be symbol-split, so they go to the
149
+ // internal entry.
150
+ replaceSpecifier(sourceFile, node.arguments[0], TO_INTERNAL, changes);
151
+ }
152
+ else if (ts.isImportTypeNode(node)) {
153
+ // `typeof import('...')` parses as an `ImportTypeNode`, not a
154
+ // CallExpression — its argument is `LiteralTypeNode<StringLiteral>`.
155
+ // The whole module is referenced, so it can't be symbol-split.
156
+ const literal = getImportTypeStringLiteral(node);
157
+ if (literal && literal.text.startsWith(FROM_PREFIX)) {
158
+ replaceSpecifier(sourceFile, literal, TO_INTERNAL, changes);
159
+ }
160
+ }
161
+ ts.forEachChild(node, visit);
162
+ };
163
+ visit(sourceFile);
164
+ }
165
+ function getImportTypeStringLiteral(node) {
166
+ const arg = node.argument;
167
+ if (arg && ts.isLiteralTypeNode(arg) && ts.isStringLiteral(arg.literal)) {
168
+ return arg.literal;
169
+ }
170
+ return undefined;
171
+ }
172
+ function shouldRewriteCallExpression(call) {
173
+ const callee = call.expression;
174
+ // `require('...')`
175
+ if (ts.isIdentifier(callee) && callee.text === 'require')
176
+ return true;
177
+ // dynamic `import('...')` (runtime form parses as a CallExpression whose
178
+ // callee is the `import` keyword). The `typeof import('...')` type-position
179
+ // form is an `ImportTypeNode` (handled in `collectCallExpressionRewrites`).
180
+ if (callee.kind === ts.SyntaxKind.ImportKeyword)
181
+ return true;
182
+ // `jest.mock(...)` / `vi.mock(...)` and friends.
183
+ if (ts.isPropertyAccessExpression(callee)) {
184
+ const obj = callee.expression;
185
+ if (ts.isIdentifier(obj) &&
186
+ (obj.text === 'jest' || obj.text === 'vi') &&
187
+ MOCK_HELPER_METHODS.has(callee.name.text)) {
188
+ return true;
189
+ }
190
+ }
191
+ return false;
192
+ }
193
+ function replaceSpecifier(sourceFile, literal, target, changes) {
194
+ const start = literal.getStart(sourceFile);
195
+ const end = literal.getEnd();
196
+ const quote = sourceFile.text.charAt(start);
197
+ changes.push({ type: devkit_1.ChangeType.Delete, start, length: end - start }, {
198
+ type: devkit_1.ChangeType.Insert,
199
+ index: start,
200
+ text: `${quote}${target}${quote}`,
201
+ });
202
+ }
@@ -2,4 +2,3 @@ export declare function analyze(): {
2
2
  name: string;
3
3
  renderChunk(source: any, chunk: any): void;
4
4
  };
5
- //# sourceMappingURL=analyze.d.ts.map
@@ -3,4 +3,3 @@ export interface DeleteOutputOptions {
3
3
  dirs: string[];
4
4
  }
5
5
  export declare function deleteOutput(options: DeleteOutputOptions): Plugin;
6
- //# sourceMappingURL=delete-output.d.ts.map
@@ -21,4 +21,3 @@ export declare function extractGlobLiteralPrefix(glob: string): {
21
21
  glob: string;
22
22
  };
23
23
  export declare function nxCopyAssetsPlugin(options: NxCopyAssetsPluginOptions): Plugin;
24
- //# sourceMappingURL=nx-copy-assets.plugin.d.ts.map
@@ -11,4 +11,3 @@ export interface GeneratePackageJsonOptions {
11
11
  }
12
12
  export declare const pluginName = "rollup-plugin-nx-generate-package-json";
13
13
  export declare function generatePackageJson(options: GeneratePackageJsonOptions, packageJson: PackageJson): Plugin;
14
- //# sourceMappingURL=generate-package-json.d.ts.map
@@ -8,4 +8,3 @@ export declare function updatePackageJson(options: {
8
8
  outputFileName?: string;
9
9
  additionalEntryPoints?: string[];
10
10
  }, packageJson: PackageJson): void;
11
- //# sourceMappingURL=update-package-json.d.ts.map
@@ -10,4 +10,3 @@ export interface RollupPluginOptions {
10
10
  }
11
11
  export declare const createNodes: CreateNodes<RollupPluginOptions>;
12
12
  export declare const createNodesV2: CreateNodes<RollupPluginOptions>;
13
- //# sourceMappingURL=plugin.d.ts.map
@@ -13,4 +13,3 @@
13
13
  export { postcss } from './postcss-plugin';
14
14
  export { postcss as default } from './postcss-plugin';
15
15
  export type { PostCSSPluginOptions, PostCSSModulesOptions, FilterPattern, UseOptions, LessOptions, SassOptions, StylusOptions, } from './options';
16
- //# sourceMappingURL=index.d.ts.map
@@ -35,4 +35,3 @@ export declare class Loaders {
35
35
  */
36
36
  process(code: string, context: LoaderContext): Promise<LoaderResult>;
37
37
  }
38
- //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,3 @@ import type { Loader, LessLoaderOptions } from './types';
4
4
  * Compiles .less files to CSS
5
5
  */
6
6
  export declare function createLessLoader(options?: LessLoaderOptions): Loader;
7
- //# sourceMappingURL=less-loader.d.ts.map
@@ -4,4 +4,3 @@ import type { Loader, PostCSSLoaderOptions } from './types';
4
4
  * This loader always runs last in the chain
5
5
  */
6
6
  export declare function createPostCSSLoader(options: PostCSSLoaderOptions): Loader;
7
- //# sourceMappingURL=postcss-loader.d.ts.map
@@ -4,4 +4,3 @@ import type { Loader, SassLoaderOptions } from './types';
4
4
  * Compiles .sass and .scss files to CSS
5
5
  */
6
6
  export declare function createSassLoader(options?: SassLoaderOptions): Loader;
7
- //# sourceMappingURL=sass-loader.d.ts.map
@@ -4,4 +4,3 @@ import type { Loader, StylusLoaderOptions } from './types';
4
4
  * Compiles .styl and .stylus files to CSS
5
5
  */
6
6
  export declare function createStylusLoader(options?: StylusLoaderOptions): Loader;
7
- //# sourceMappingURL=stylus-loader.d.ts.map
@@ -85,4 +85,3 @@ export interface StylusLoaderOptions {
85
85
  /** Additional Stylus options */
86
86
  [key: string]: unknown;
87
87
  }
88
- //# sourceMappingURL=types.d.ts.map
@@ -108,4 +108,3 @@ export interface NormalizedPostCSSOptions extends PostCSSPluginOptions {
108
108
  * Normalize plugin options with defaults
109
109
  */
110
110
  export declare function normalizeOptions(options?: PostCSSPluginOptions): NormalizedPostCSSOptions;
111
- //# sourceMappingURL=options.d.ts.map
@@ -7,4 +7,3 @@ import type { PostCSSPluginOptions } from './options';
7
7
  * Supports CSS injection into the DOM or extraction to separate files.
8
8
  */
9
9
  export declare function postcss(pluginOptions?: PostCSSPluginOptions): Plugin;
10
- //# sourceMappingURL=postcss-plugin.d.ts.map
@@ -2,4 +2,3 @@ export { normalizePath, humanizePath } from './normalize-path';
2
2
  export { loadModule, requireModule } from './load-module';
3
3
  export { safeIdentifier, escapeClassNameDashes } from './safe-identifier';
4
4
  export { styleInjectCode, STYLE_INJECT_ID, STYLE_INJECT_PATH, } from './style-inject';
5
- //# sourceMappingURL=index.d.ts.map