@nx/rollup 18.0.0-beta.1 → 18.0.0-beta.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": "18.0.0-beta.
|
|
3
|
+
"version": "18.0.0-beta.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": {
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"rollup-plugin-typescript2": "0.34.1",
|
|
46
46
|
"rxjs": "^7.8.0",
|
|
47
47
|
"tslib": "^2.3.0",
|
|
48
|
-
"@nx/devkit": "18.0.0-beta.
|
|
49
|
-
"@nx/js": "18.0.0-beta.
|
|
50
|
-
"@nrwl/rollup": "18.0.0-beta.
|
|
48
|
+
"@nx/devkit": "18.0.0-beta.3",
|
|
49
|
+
"@nx/js": "18.0.0-beta.3",
|
|
50
|
+
"@nrwl/rollup": "18.0.0-beta.3"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as rollup from 'rollup';
|
|
2
2
|
import type { ExecutorContext } from '@nx/devkit';
|
|
3
3
|
import { DependentBuildableProjectNode } from '@nx/js/src/utils/buildable-libs-utils';
|
|
4
|
+
import type { PackageJson } from 'nx/src/utils/package-json';
|
|
4
5
|
import { RollupExecutorOptions } from './schema';
|
|
5
6
|
import { NormalizedRollupExecutorOptions } from './lib/normalize';
|
|
6
7
|
export type RollupExecutorEvent = {
|
|
@@ -8,5 +9,5 @@ export type RollupExecutorEvent = {
|
|
|
8
9
|
outfile?: string;
|
|
9
10
|
};
|
|
10
11
|
export declare function rollupExecutor(rawOptions: RollupExecutorOptions, context: ExecutorContext): AsyncGenerator<RollupExecutorEvent, any, undefined>;
|
|
11
|
-
export declare function createRollupOptions(options: NormalizedRollupExecutorOptions, dependencies: DependentBuildableProjectNode[], context: ExecutorContext, packageJson:
|
|
12
|
+
export declare function createRollupOptions(options: NormalizedRollupExecutorOptions, dependencies: DependentBuildableProjectNode[], context: ExecutorContext, packageJson: PackageJson, sourceRoot: string, npmDeps: string[]): rollup.InputOptions[];
|
|
12
13
|
export default rollupExecutor;
|
|
@@ -13,13 +13,13 @@ const autoprefixer = require("autoprefixer");
|
|
|
13
13
|
const devkit_1 = require("@nx/devkit");
|
|
14
14
|
const buildable_libs_utils_1 = require("@nx/js/src/utils/buildable-libs-utils");
|
|
15
15
|
const plugin_node_resolve_1 = require("@rollup/plugin-node-resolve");
|
|
16
|
+
const type_definitions_1 = require("@nx/js/src/plugins/rollup/type-definitions");
|
|
16
17
|
const run_rollup_1 = require("./lib/run-rollup");
|
|
17
18
|
const normalize_1 = require("./lib/normalize");
|
|
18
19
|
const analyze_plugin_1 = require("./lib/analyze-plugin");
|
|
19
20
|
const fs_1 = require("../../utils/fs");
|
|
20
21
|
const swc_plugin_1 = require("./lib/swc-plugin");
|
|
21
22
|
const update_package_json_1 = require("./lib/update-package-json");
|
|
22
|
-
const type_definitions_1 = require("@nx/js/src/plugins/rollup/type-definitions");
|
|
23
23
|
// These use require because the ES import isn't correct.
|
|
24
24
|
const commonjs = require('@rollup/plugin-commonjs');
|
|
25
25
|
const image = require('@rollup/plugin-image');
|
|
@@ -103,6 +103,18 @@ function createRollupOptions(options, dependencies, context, packageJson, source
|
|
|
103
103
|
if (!options.format || !options.format.length) {
|
|
104
104
|
options.format = readCompatibleFormats(config);
|
|
105
105
|
}
|
|
106
|
+
if (packageJson.type === 'module') {
|
|
107
|
+
if (options.format.includes('cjs')) {
|
|
108
|
+
devkit_1.logger.warn(`Package type is set to "module" but "cjs" format is included. Going to use "esm" format instead. You can change the package type to "commonjs" or remove type in the package.json file.`);
|
|
109
|
+
}
|
|
110
|
+
options.format = ['esm'];
|
|
111
|
+
}
|
|
112
|
+
else if (packageJson.type === 'commonjs') {
|
|
113
|
+
if (options.format.includes('esm')) {
|
|
114
|
+
devkit_1.logger.warn(`Package type is set to "commonjs" but "esm" format is included. Going to use "cjs" format instead. You can change the package type to "module" or remove type in the package.json file.`);
|
|
115
|
+
}
|
|
116
|
+
options.format = ['cjs'];
|
|
117
|
+
}
|
|
106
118
|
return options.format.map((format, idx) => {
|
|
107
119
|
// Either we're generating only one format, so we should bundle types
|
|
108
120
|
// OR we are generating dual formats, so only bundle types for CJS.
|