@nx/rollup 21.3.0-canary.20250625-fe687a0 → 21.3.0-canary.20250627-07233f0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/rollup",
3
- "version": "21.3.0-canary.20250625-fe687a0",
3
+ "version": "21.3.0-canary.20250627-07233f0",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Rollup contains executors and generators that support building applications using Rollup.",
6
6
  "repository": {
@@ -29,8 +29,8 @@
29
29
  "migrations": "./migrations.json"
30
30
  },
31
31
  "dependencies": {
32
- "@nx/devkit": "21.3.0-canary.20250625-fe687a0",
33
- "@nx/js": "21.3.0-canary.20250625-fe687a0",
32
+ "@nx/devkit": "21.3.0-canary.20250627-07233f0",
33
+ "@nx/js": "21.3.0-canary.20250627-07233f0",
34
34
  "@rollup/plugin-babel": "^6.0.4",
35
35
  "@rollup/plugin-commonjs": "^25.0.7",
36
36
  "@rollup/plugin-image": "^3.0.3",
@@ -33,5 +33,6 @@ export interface RollupExecutorOptions {
33
33
  rollupConfig?: string | string[];
34
34
  skipTypeCheck?: boolean;
35
35
  skipTypeField?: boolean;
36
+ useLegacyTypescriptPlugin?: boolean;
36
37
  watch?: boolean;
37
38
  }
@@ -155,6 +155,11 @@
155
155
  "sourceMap": {
156
156
  "description": "Output sourcemaps.",
157
157
  "type": "boolean"
158
+ },
159
+ "useLegacyTypescriptPlugin": {
160
+ "type": "boolean",
161
+ "description": "Use rollup-plugin-typescript2 instead of @rollup/plugin-typescript.",
162
+ "default": true
158
163
  }
159
164
  },
160
165
  "required": ["tsConfig", "main", "outputPath"],
@@ -80,6 +80,10 @@ export interface RollupWithNxPluginOptions {
80
80
  * The path to tsconfig file.
81
81
  */
82
82
  tsConfig: string;
83
+ /**
84
+ * Use rollup-plugin-typescript2 instead of @rollup/plugin-typescript.
85
+ */
86
+ useLegacyTypescriptPlugin?: boolean;
83
87
  /**
84
88
  * Whether to generate a package.json file in the output path. It's not supported when the workspace is
85
89
  * set up with TypeScript Project References along with the package managers' Workspaces feature. Otherwise,
@@ -134,20 +134,39 @@ dependencies) {
134
134
  else {
135
135
  options.generatePackageJson ??= true;
136
136
  }
137
+ const compilerOptions = createTsCompilerOptions(projectRoot, tsConfig, options, dependencies);
138
+ compilerOptions.outDir = Array.isArray(finalConfig.output)
139
+ ? finalConfig.output[0].dir
140
+ : finalConfig.output.dir;
137
141
  finalConfig.plugins = [
138
142
  copy({
139
143
  targets: convertCopyAssetsToRollupOptions(options.outputPath, options.assets),
140
144
  }),
141
145
  image(),
142
146
  json(),
143
- // Needed to generate type definitions, even if we're using babel or swc.
144
- require('rollup-plugin-typescript2')({
145
- check: !options.skipTypeCheck,
146
- tsconfig: tsConfigPath,
147
- tsconfigOverride: {
148
- compilerOptions: createTsCompilerOptions(projectRoot, tsConfig, options, dependencies),
149
- },
150
- }),
147
+ // TypeScript compilation and declaration generation
148
+ // TODO(v22): Change default value of useLegacyTypescriptPlugin to false for Nx 22
149
+ options.useLegacyTypescriptPlugin !== false
150
+ ? (() => {
151
+ // TODO(v23): Remove in Nx 23
152
+ // Show deprecation warning
153
+ devkit_1.logger.warn(`rollup-plugin-typescript2 usage is deprecated and will be removed in Nx 23. ` +
154
+ `Set 'useLegacyTypescriptPlugin: false' to use the official @rollup/plugin-typescript.`);
155
+ return require('rollup-plugin-typescript2')({
156
+ check: !options.skipTypeCheck,
157
+ tsconfig: tsConfigPath,
158
+ tsconfigOverride: {
159
+ compilerOptions,
160
+ },
161
+ });
162
+ })()
163
+ : require('@rollup/plugin-typescript')({
164
+ tsconfig: tsConfigPath,
165
+ compilerOptions,
166
+ declaration: true,
167
+ declarationMap: !!options.sourceMap,
168
+ noEmitOnError: !options.skipTypeCheck,
169
+ }),
151
170
  (0, type_definitions_1.typeDefinitions)({
152
171
  projectRoot,
153
172
  }),