@nx/rollup 23.0.0-beta.17 → 23.0.0-beta.18
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": "23.0.0-beta.
|
|
3
|
+
"version": "23.0.0-beta.18",
|
|
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": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"migrations": "./migrations.json"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@nx/devkit": "23.0.0-beta.
|
|
34
|
-
"@nx/js": "23.0.0-beta.
|
|
33
|
+
"@nx/devkit": "23.0.0-beta.18",
|
|
34
|
+
"@nx/js": "23.0.0-beta.18",
|
|
35
35
|
"@phenomnomnominal/tsquery": "~6.2.0",
|
|
36
36
|
"@rollup/plugin-babel": "^6.0.4",
|
|
37
37
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"tslib": "^2.3.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"nx": "23.0.0-beta.
|
|
52
|
+
"nx": "23.0.0-beta.18",
|
|
53
53
|
"source-map-js": "^1.2.0"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-use-legacy-typescript-plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/migrations/update-23-0-0/remove-use-legacy-typescript-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"remove-use-legacy-typescript-plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/migrations/update-23-0-0/remove-use-legacy-typescript-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,IAAI,EAIL,MAAM,YAAY,CAAC;AAgBpB,yBAA+B,IAAI,EAAE,IAAI,iBAwGxC"}
|
|
@@ -12,6 +12,10 @@ const ROLLUP_CONFIG_NAMES = [
|
|
|
12
12
|
const PROPERTY_NAME = 'useLegacyTypescriptPlugin';
|
|
13
13
|
async function default_1(tree) {
|
|
14
14
|
const projects = (0, devkit_1.getProjects)(tree);
|
|
15
|
+
// Track whether the migration actually stripped any legacy config so we
|
|
16
|
+
// only strip the orphan devDep when it was needed (a user could have
|
|
17
|
+
// installed `rollup-plugin-typescript2` for their own custom rollup setup).
|
|
18
|
+
let anyChange = false;
|
|
15
19
|
for (const [projectName] of projects) {
|
|
16
20
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
17
21
|
let projectJsonChanged = false;
|
|
@@ -38,12 +42,15 @@ async function default_1(tree) {
|
|
|
38
42
|
}
|
|
39
43
|
if (projectJsonChanged) {
|
|
40
44
|
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
|
45
|
+
anyChange = true;
|
|
41
46
|
}
|
|
42
47
|
(0, devkit_1.visitNotIgnoredFiles)(tree, projectConfig.root, (filePath) => {
|
|
43
48
|
const basename = filePath.split('/').pop();
|
|
44
49
|
if (!ROLLUP_CONFIG_NAMES.includes(basename))
|
|
45
50
|
return;
|
|
46
|
-
stripFromRollupConfig(tree, filePath)
|
|
51
|
+
if (stripFromRollupConfig(tree, filePath)) {
|
|
52
|
+
anyChange = true;
|
|
53
|
+
}
|
|
47
54
|
});
|
|
48
55
|
}
|
|
49
56
|
// Strip from nx.json targetDefaults (keyed by target name or executor name).
|
|
@@ -72,21 +79,27 @@ async function default_1(tree) {
|
|
|
72
79
|
}
|
|
73
80
|
if (nxJsonChanged) {
|
|
74
81
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
82
|
+
anyChange = true;
|
|
75
83
|
}
|
|
76
84
|
}
|
|
85
|
+
// Only strip the orphan devDep when we actually stripped a legacy config.
|
|
86
|
+
// Skipping otherwise preserves a user's own dep on rollup-plugin-typescript2.
|
|
87
|
+
if (anyChange) {
|
|
88
|
+
(0, devkit_1.removeDependenciesFromPackageJson)(tree, [], ['rollup-plugin-typescript2']);
|
|
89
|
+
}
|
|
77
90
|
await (0, devkit_1.formatFiles)(tree);
|
|
78
91
|
}
|
|
79
92
|
function stripFromRollupConfig(tree, filePath) {
|
|
80
93
|
const original = tree.read(filePath, 'utf-8');
|
|
81
94
|
if (!original?.includes(PROPERTY_NAME))
|
|
82
|
-
return;
|
|
95
|
+
return false;
|
|
83
96
|
// Filter by the property NAME (not any descendant Identifier) so we don't
|
|
84
97
|
// strip `{ alias: useLegacyTypescriptPlugin }` where the identifier appears as a value.
|
|
85
98
|
// Also handle shorthand `{ useLegacyTypescriptPlugin }` — strip the entry, leave
|
|
86
99
|
// the variable declaration behind (not our problem).
|
|
87
100
|
const matches = (0, tsquery_1.query)((0, tsquery_1.ast)(original), 'PropertyAssignment, ShorthandPropertyAssignment').filter((p) => p.name && p.name.text === PROPERTY_NAME);
|
|
88
101
|
if (matches.length === 0)
|
|
89
|
-
return;
|
|
102
|
+
return false;
|
|
90
103
|
// Walk in reverse so each splice doesn't shift the offsets of remaining matches
|
|
91
104
|
// (a file may legitimately contain multiple withNx({...}) calls, e.g. multi-format
|
|
92
105
|
// configs returning more than one rollup options object).
|
|
@@ -108,4 +121,5 @@ function stripFromRollupConfig(tree, filePath) {
|
|
|
108
121
|
updated = updated.slice(0, start) + updated.slice(end);
|
|
109
122
|
}
|
|
110
123
|
tree.write(filePath, updated);
|
|
124
|
+
return true;
|
|
111
125
|
}
|