@nx/rollup 20.6.1 → 20.6.3

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": "20.6.1",
3
+ "version": "20.6.3",
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": "20.6.1",
33
- "@nx/js": "20.6.1",
32
+ "@nx/devkit": "20.6.3",
33
+ "@nx/js": "20.6.3",
34
34
  "@rollup/plugin-babel": "^6.0.4",
35
35
  "@rollup/plugin-commonjs": "^25.0.7",
36
36
  "@rollup/plugin-image": "^3.0.3",
@@ -15,22 +15,23 @@ export interface Globals {
15
15
  export interface RollupExecutorOptions {
16
16
  outputPath: string;
17
17
  tsConfig: string;
18
- allowJs?: boolean;
19
- project: string;
20
18
  main: string;
21
- outputFileName?: string;
22
- extractCss?: boolean | string;
23
- external?: string[] | 'all' | 'none';
24
- rollupConfig?: string | string[];
25
- watch?: boolean;
19
+ additionalEntryPoints?: string[];
20
+ allowJs?: boolean;
26
21
  assets?: any[];
22
+ babelUpwardRootMode?: boolean;
23
+ buildLibsFromSource?: boolean;
24
+ compiler?: 'babel' | 'tsc' | 'swc';
27
25
  deleteOutputPath?: boolean;
26
+ external?: string[] | 'all' | 'none';
27
+ extractCss?: boolean | string;
28
28
  format?: ('cjs' | 'esm')[];
29
- compiler?: 'babel' | 'tsc' | 'swc';
30
- javascriptEnabled?: boolean;
31
29
  generateExportsField?: boolean;
32
- additionalEntryPoints?: string[];
30
+ javascriptEnabled?: boolean;
31
+ project?: string;
32
+ outputFileName?: string;
33
+ rollupConfig?: string | string[];
33
34
  skipTypeCheck?: boolean;
34
- babelUpwardRootMode?: boolean;
35
35
  skipTypeField?: boolean;
36
+ watch?: boolean;
36
37
  }
@@ -1,15 +1,14 @@
1
1
  {
2
2
  "version": 2,
3
3
  "outputCapture": "direct-nodejs",
4
- "title": "Web Library Rollup Target (Experimental)",
4
+ "title": "Web Library Rollup Target",
5
5
  "description": "Packages a library for different web usages (ESM, CommonJS).",
6
6
  "cli": "nx",
7
7
  "type": "object",
8
8
  "properties": {
9
9
  "project": {
10
10
  "type": "string",
11
- "description": "The path to package.json file.",
12
- "x-priority": "important"
11
+ "description": "The path to package.json file."
13
12
  },
14
13
  "main": {
15
14
  "type": "string",
@@ -138,6 +137,11 @@
138
137
  },
139
138
  "x-priority": "important"
140
139
  },
140
+ "buildLibsFromSource": {
141
+ "type": "boolean",
142
+ "description": "Read buildable libraries from source instead of building them separately.",
143
+ "default": true
144
+ },
141
145
  "skipTypeCheck": {
142
146
  "type": "boolean",
143
147
  "description": "Whether to skip TypeScript type checking.",
@@ -122,6 +122,8 @@ function updatePackageJson(tree, options, outputConfig, isTsSolutionSetup) {
122
122
  : undefined) ?? nxJson.targetDefaults?.[options.buildTarget]);
123
123
  ({ main, outputPath } = mergedTarget.options);
124
124
  }
125
+ // the file must exist in the TS solution setup
126
+ const tsconfigBase = (0, devkit_1.readJson)(tree, 'tsconfig.base.json');
125
127
  packageJson = (0, js_1.getUpdatedPackageJsonContent)(packageJson, {
126
128
  main,
127
129
  outputPath,
@@ -132,6 +134,7 @@ function updatePackageJson(tree, options, outputConfig, isTsSolutionSetup) {
132
134
  format: options.format ?? ['esm'],
133
135
  outputFileExtensionForCjs: '.cjs.js',
134
136
  outputFileExtensionForEsm: '.esm.js',
137
+ skipDevelopmentExports: !tsconfigBase.compilerOptions?.customConditions?.includes('development'),
135
138
  });
136
139
  // rollup has a specific declaration file generation not handled by the util above,
137
140
  // adjust accordingly
@@ -15,6 +15,10 @@ export interface RollupWithNxPluginOptions {
15
15
  * Whether to set rootmode to upward. See https://babeljs.io/docs/en/options#rootmode
16
16
  */
17
17
  babelUpwardRootMode?: boolean;
18
+ /**
19
+ * Build the libraries from source. Default is `true`.
20
+ */
21
+ buildLibsFromSource?: boolean;
18
22
  /**
19
23
  * Which compiler to use.
20
24
  */
@@ -43,7 +43,9 @@ dependencies) {
43
43
  const options = (0, normalize_options_1.normalizeOptions)(projectNode.data.root, projectNode.data.sourceRoot, rawOptions);
44
44
  const useBabel = options.compiler === 'babel';
45
45
  const useSwc = options.compiler === 'swc';
46
- const tsConfigPath = (0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, options.tsConfig);
46
+ const tsConfigPath = options.buildLibsFromSource || global.NX_GRAPH_CREATION
47
+ ? (0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, options.tsConfig)
48
+ : (0, buildable_libs_utils_1.createTmpTsConfig)(options.tsConfig, devkit_1.workspaceRoot, projectRoot, dependencies);
47
49
  const tsConfigFile = ts.readConfigFile(tsConfigPath, ts.sys.readFile);
48
50
  const tsConfig = ts.parseJsonConfigFileContent(tsConfigFile.config, ts.sys, (0, node_path_1.dirname)(tsConfigPath));
49
51
  if (!options.format || !options.format.length) {
@@ -141,7 +143,7 @@ dependencies) {
141
143
  // Needed to generate type definitions, even if we're using babel or swc.
142
144
  require('rollup-plugin-typescript2')({
143
145
  check: !options.skipTypeCheck,
144
- tsconfig: options.tsConfig,
146
+ tsconfig: tsConfigPath,
145
147
  tsconfigOverride: {
146
148
  compilerOptions: createTsCompilerOptions(projectRoot, tsConfig, options, dependencies),
147
149
  },