@nx/rollup 20.2.0-rc.0 → 20.2.1
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 +3 -3
- package/src/plugins/plugin.js +12 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/rollup",
|
|
3
|
-
"version": "20.2.
|
|
3
|
+
"version": "20.2.1",
|
|
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": {
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"rollup-plugin-postcss": "^4.0.2",
|
|
44
44
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
45
45
|
"tslib": "^2.3.0",
|
|
46
|
-
"@nx/devkit": "20.2.
|
|
47
|
-
"@nx/js": "20.2.
|
|
46
|
+
"@nx/devkit": "20.2.1",
|
|
47
|
+
"@nx/js": "20.2.1"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|
package/src/plugins/plugin.js
CHANGED
|
@@ -9,6 +9,7 @@ const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculat
|
|
|
9
9
|
const js_1 = require("@nx/js");
|
|
10
10
|
const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
|
|
11
11
|
const file_hasher_1 = require("nx/src/hasher/file-hasher");
|
|
12
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
12
13
|
const pmc = (0, devkit_1.getPackageManagerCommand)();
|
|
13
14
|
function readTargetsCache(cachePath) {
|
|
14
15
|
return (0, fs_1.existsSync)(cachePath) ? (0, devkit_1.readJsonFile)(cachePath) : {};
|
|
@@ -28,7 +29,7 @@ exports.createNodes = [
|
|
|
28
29
|
rollupConfigGlob,
|
|
29
30
|
async (configFilePath, options, context) => {
|
|
30
31
|
devkit_1.logger.warn('`createNodes` is deprecated. Update your plugin to utilize createNodesV2 instead. In Nx 20, this will change to the createNodesV2 API.');
|
|
31
|
-
return createNodesInternal(configFilePath, normalizeOptions(options), context, {});
|
|
32
|
+
return createNodesInternal(configFilePath, normalizeOptions(options), context, {}, (0, ts_solution_setup_1.isUsingTsSolutionSetup)());
|
|
32
33
|
},
|
|
33
34
|
];
|
|
34
35
|
exports.createNodesV2 = [
|
|
@@ -38,15 +39,16 @@ exports.createNodesV2 = [
|
|
|
38
39
|
const optionsHash = (0, file_hasher_1.hashObject)(normalizedOptions);
|
|
39
40
|
const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `rollup-${optionsHash}.hash`);
|
|
40
41
|
const targetsCache = readTargetsCache(cachePath);
|
|
42
|
+
const isTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)();
|
|
41
43
|
try {
|
|
42
|
-
return await (0, devkit_1.createNodesFromFiles)((configFile, _, context) => createNodesInternal(configFile, normalizedOptions, context, targetsCache), configFilePaths, normalizedOptions, context);
|
|
44
|
+
return await (0, devkit_1.createNodesFromFiles)((configFile, _, context) => createNodesInternal(configFile, normalizedOptions, context, targetsCache, isTsSolutionSetup), configFilePaths, normalizedOptions, context);
|
|
43
45
|
}
|
|
44
46
|
finally {
|
|
45
47
|
writeTargetsToCache(cachePath, targetsCache);
|
|
46
48
|
}
|
|
47
49
|
},
|
|
48
50
|
];
|
|
49
|
-
async function createNodesInternal(configFilePath, options, context, targetsCache) {
|
|
51
|
+
async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup) {
|
|
50
52
|
const projectRoot = (0, path_1.dirname)(configFilePath);
|
|
51
53
|
const fullyQualifiedProjectRoot = (0, path_1.join)(context.workspaceRoot, projectRoot);
|
|
52
54
|
// Do not create a project if package.json and project.json do not exist
|
|
@@ -56,7 +58,7 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
|
|
|
56
58
|
return {};
|
|
57
59
|
}
|
|
58
60
|
const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
|
|
59
|
-
targetsCache[hash] ??= await buildRollupTarget(configFilePath, projectRoot, options, context);
|
|
61
|
+
targetsCache[hash] ??= await buildRollupTarget(configFilePath, projectRoot, options, context, isTsSolutionSetup);
|
|
60
62
|
return {
|
|
61
63
|
projects: {
|
|
62
64
|
[projectRoot]: {
|
|
@@ -66,7 +68,7 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
|
|
|
66
68
|
},
|
|
67
69
|
};
|
|
68
70
|
}
|
|
69
|
-
async function buildRollupTarget(configFilePath, projectRoot, options, context) {
|
|
71
|
+
async function buildRollupTarget(configFilePath, projectRoot, options, context, isTsSolutionSetup) {
|
|
70
72
|
let loadConfigFile;
|
|
71
73
|
try {
|
|
72
74
|
// Try to load the workspace version of rollup first (it should already exist).
|
|
@@ -114,6 +116,11 @@ async function buildRollupTarget(configFilePath, projectRoot, options, context)
|
|
|
114
116
|
},
|
|
115
117
|
},
|
|
116
118
|
};
|
|
119
|
+
if (isTsSolutionSetup) {
|
|
120
|
+
targets[options.buildTargetName].syncGenerators = [
|
|
121
|
+
'@nx/js:typescript-sync',
|
|
122
|
+
];
|
|
123
|
+
}
|
|
117
124
|
return targets;
|
|
118
125
|
}
|
|
119
126
|
function getOutputs(rollupConfigs, projectRoot) {
|