@nx/rollup 23.0.0-beta.2 → 23.0.0-beta.21
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/migrations.json +8 -1
- package/package.json +5 -5
- package/src/executors/rollup/lib/normalize.js +2 -2
- package/src/executors/rollup/rollup.impl.d.ts.map +1 -1
- package/src/executors/rollup/rollup.impl.js +7 -6
- package/src/executors/rollup/schema.d.ts +0 -1
- package/src/executors/rollup/schema.json +2 -6
- package/src/generators/configuration/configuration.d.ts.map +1 -1
- package/src/generators/configuration/configuration.js +11 -13
- package/src/generators/convert-to-inferred/convert-to-inferred.d.ts.map +1 -1
- package/src/generators/convert-to-inferred/convert-to-inferred.js +9 -6
- package/src/generators/init/init.d.ts.map +1 -1
- package/src/generators/init/init.js +2 -2
- package/src/migrations/update-23-0-0/remove-use-legacy-typescript-plugin.d.ts +3 -0
- package/src/migrations/update-23-0-0/remove-use-legacy-typescript-plugin.d.ts.map +1 -0
- package/src/migrations/update-23-0-0/remove-use-legacy-typescript-plugin.js +125 -0
- package/src/plugins/nx-copy-assets.plugin.d.ts +1 -1
- package/src/plugins/nx-copy-assets.plugin.d.ts.map +1 -1
- package/src/plugins/nx-copy-assets.plugin.js +2 -2
- package/src/plugins/plugin.d.ts.map +1 -1
- package/src/plugins/plugin.js +58 -35
- package/src/plugins/with-nx/normalize-options.d.ts.map +1 -1
- package/src/plugins/with-nx/normalize-options.js +3 -8
- package/src/plugins/with-nx/type-definitions.d.ts +8 -0
- package/src/plugins/with-nx/type-definitions.d.ts.map +1 -0
- package/src/plugins/with-nx/type-definitions.js +48 -0
- package/src/plugins/with-nx/with-nx-options.d.ts +0 -4
- package/src/plugins/with-nx/with-nx-options.d.ts.map +1 -1
- package/src/plugins/with-nx/with-nx.d.ts +1 -1
- package/src/plugins/with-nx/with-nx.d.ts.map +1 -1
- package/src/plugins/with-nx/with-nx.js +26 -43
- package/src/utils/deprecation.d.ts +4 -0
- package/src/utils/deprecation.d.ts.map +1 -0
- package/src/utils/deprecation.js +19 -0
- package/src/utils/ensure-dependencies.js +8 -8
package/migrations.json
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generators": {
|
|
2
|
+
"generators": {
|
|
3
|
+
"update-23-0-0-remove-use-legacy-typescript-plugin": {
|
|
4
|
+
"cli": "nx",
|
|
5
|
+
"version": "23.0.0-beta.4",
|
|
6
|
+
"description": "Remove deprecated useLegacyTypescriptPlugin option from @nx/rollup:rollup",
|
|
7
|
+
"implementation": "./src/migrations/update-23-0-0/remove-use-legacy-typescript-plugin"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
3
10
|
"packageJsonUpdates": {}
|
|
4
11
|
}
|
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.21",
|
|
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,9 @@
|
|
|
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.21",
|
|
34
|
+
"@nx/js": "23.0.0-beta.21",
|
|
35
|
+
"@phenomnomnominal/tsquery": "~6.2.0",
|
|
35
36
|
"@rollup/plugin-babel": "^6.0.4",
|
|
36
37
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
37
38
|
"@rollup/plugin-image": "^3.0.3",
|
|
@@ -45,11 +46,10 @@
|
|
|
45
46
|
"postcss": "^8.4.38",
|
|
46
47
|
"postcss-modules": "^6.0.1",
|
|
47
48
|
"rollup": "^4.14.0",
|
|
48
|
-
"rollup-plugin-typescript2": "^0.36.0",
|
|
49
49
|
"tslib": "^2.3.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"nx": "23.0.0-beta.
|
|
52
|
+
"nx": "23.0.0-beta.21",
|
|
53
53
|
"source-map-js": "^1.2.0"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeRollupExecutorOptions = normalizeRollupExecutorOptions;
|
|
4
4
|
exports.normalizePluginPath = normalizePluginPath;
|
|
5
5
|
const path_1 = require("path");
|
|
6
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/js/internal");
|
|
7
7
|
function normalizeRollupExecutorOptions(options, context) {
|
|
8
8
|
const { root } = context;
|
|
9
|
-
const skipTypeCheck = (0,
|
|
9
|
+
const skipTypeCheck = (0, internal_1.isUsingTsSolutionSetup)() ? true : options.skipTypeCheck;
|
|
10
10
|
return {
|
|
11
11
|
...options,
|
|
12
12
|
rollupConfig: []
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/executors/rollup/rollup.impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,KAAK,eAAe,EAAU,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"rollup.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/executors/rollup/rollup.impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,KAAK,eAAe,EAAU,MAAM,YAAY,CAAC;AAG1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EACL,+BAA+B,EAEhC,MAAM,iBAAiB,CAAC;AAMzB,wBAAuB,cAAc,CACnC,UAAU,EAAE,qBAAqB,EACjC,OAAO,EAAE,eAAe,qCAoEzB;AAID,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,+BAA+B,EACxC,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,MAAM,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,EAAE,CAAC,CAuDxD;AAWD,eAAe,cAAc,CAAC"}
|
|
@@ -6,20 +6,21 @@ const tslib_1 = require("tslib");
|
|
|
6
6
|
const rollup = tslib_1.__importStar(require("rollup"));
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const devkit_1 = require("@nx/devkit");
|
|
9
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
9
10
|
const normalize_1 = require("./lib/normalize");
|
|
10
|
-
const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
|
|
11
|
-
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
12
11
|
const with_nx_1 = require("../../plugins/with-nx/with-nx");
|
|
13
12
|
const generate_package_json_1 = require("../../plugins/package-json/generate-package-json");
|
|
14
|
-
const
|
|
13
|
+
const internal_2 = require("@nx/js/internal");
|
|
14
|
+
const deprecation_1 = require("../../utils/deprecation");
|
|
15
15
|
async function* rollupExecutor(rawOptions, context) {
|
|
16
|
+
(0, deprecation_1.warnRollupExecutorDeprecation)();
|
|
16
17
|
process.env.NODE_ENV ??= 'production';
|
|
17
18
|
const options = (0, normalize_1.normalizeRollupExecutorOptions)(rawOptions, context);
|
|
18
19
|
const rollupOptions = await createRollupOptions(options, context);
|
|
19
20
|
const outfile = resolveOutfile(context, options);
|
|
20
21
|
if (options.watch) {
|
|
21
22
|
// region Watch build
|
|
22
|
-
return yield* (0,
|
|
23
|
+
return yield* (0, internal_1.createAsyncIterable)(({ next }) => {
|
|
23
24
|
const watcher = rollup.watch(rollupOptions);
|
|
24
25
|
watcher.on('event', (data) => {
|
|
25
26
|
if (data.code === 'START') {
|
|
@@ -79,14 +80,14 @@ async function* rollupExecutor(rawOptions, context) {
|
|
|
79
80
|
}
|
|
80
81
|
// -----------------------------------------------------------------------------
|
|
81
82
|
async function createRollupOptions(options, context) {
|
|
82
|
-
const { dependencies } = (0,
|
|
83
|
+
const { dependencies } = (0, internal_2.calculateProjectBuildableDependencies)(context.taskGraph, context.projectGraph, context.root, context.projectName, context.targetName, context.configurationName, true);
|
|
83
84
|
const rollupConfig = (0, with_nx_1.withNx)(options, {}, dependencies);
|
|
84
85
|
// `generatePackageJson` is a plugin rather than being embedded into @nx/rollup:rollup.
|
|
85
86
|
// Make sure the plugin is always present to keep the previous before of Nx < 19.4, where it was not a plugin.
|
|
86
87
|
const generatePackageJsonPlugin = Array.isArray(rollupConfig.plugins)
|
|
87
88
|
? rollupConfig.plugins.find((p) => p['name'] === generate_package_json_1.pluginName)
|
|
88
89
|
: null;
|
|
89
|
-
const userDefinedRollupConfigs = options.rollupConfig.map((plugin) => (0,
|
|
90
|
+
const userDefinedRollupConfigs = options.rollupConfig.map((plugin) => (0, internal_1.loadConfigFile)(plugin));
|
|
90
91
|
let finalConfig = rollupConfig;
|
|
91
92
|
for (const _config of userDefinedRollupConfigs) {
|
|
92
93
|
const config = await _config;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"description": "Packages a library for different web usages (ESM, CommonJS).",
|
|
6
6
|
"cli": "nx",
|
|
7
7
|
"type": "object",
|
|
8
|
+
"x-deprecated": "The `@nx/rollup:rollup` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/rollup:convert-to-inferred` to migrate to the `@nx/rollup/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
|
|
8
9
|
"properties": {
|
|
9
10
|
"project": {
|
|
10
11
|
"type": "string",
|
|
@@ -155,11 +156,6 @@
|
|
|
155
156
|
"sourceMap": {
|
|
156
157
|
"description": "Output sourcemaps.",
|
|
157
158
|
"type": "boolean"
|
|
158
|
-
},
|
|
159
|
-
"useLegacyTypescriptPlugin": {
|
|
160
|
-
"type": "boolean",
|
|
161
|
-
"description": "Use rollup-plugin-typescript2 instead of @rollup/plugin-typescript.",
|
|
162
|
-
"default": false
|
|
163
159
|
}
|
|
164
160
|
},
|
|
165
161
|
"required": ["tsConfig", "main", "outputPath"],
|
|
@@ -191,5 +187,5 @@
|
|
|
191
187
|
]
|
|
192
188
|
}
|
|
193
189
|
},
|
|
194
|
-
"examplesFile": "
|
|
190
|
+
"examplesFile": "../../../docs/rollup-examples.md"
|
|
195
191
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/generators/configuration/configuration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/generators/configuration/configuration.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,iBAAiB,EAOjB,IAAI,EAIL,MAAM,YAAY,CAAC;AAkBpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAI/C,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,mBAAmB,8BAoC7B;AAwPD,eAAe,sBAAsB,CAAC"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.configurationGenerator = configurationGenerator;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
7
|
-
const
|
|
8
|
-
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
9
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
|
+
const internal_2 = require("@nx/js/internal");
|
|
10
8
|
const posix_1 = require("node:path/posix");
|
|
11
9
|
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
12
10
|
const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
|
|
13
11
|
const has_plugin_1 = require("../../utils/has-plugin");
|
|
12
|
+
const deprecation_1 = require("../../utils/deprecation");
|
|
14
13
|
const init_1 = require("../init/init");
|
|
15
14
|
let ts;
|
|
16
15
|
async function configurationGenerator(tree, options) {
|
|
@@ -23,12 +22,13 @@ async function configurationGenerator(tree, options) {
|
|
|
23
22
|
if (!options.skipPackageJson) {
|
|
24
23
|
tasks.push((0, ensure_dependencies_1.ensureDependencies)(tree, options));
|
|
25
24
|
}
|
|
26
|
-
const isTsSolutionSetup = (0,
|
|
25
|
+
const isTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)(tree);
|
|
27
26
|
let outputConfig;
|
|
28
27
|
if ((0, has_plugin_1.hasPlugin)(tree)) {
|
|
29
28
|
outputConfig = createRollupConfig(tree, options, isTsSolutionSetup);
|
|
30
29
|
}
|
|
31
30
|
else {
|
|
31
|
+
(0, deprecation_1.warnRollupExecutorGenerating)();
|
|
32
32
|
options.buildTarget ??= 'build';
|
|
33
33
|
checkForTargetConflicts(tree, options);
|
|
34
34
|
addBuildTarget(tree, options, isTsSolutionSetup);
|
|
@@ -103,7 +103,7 @@ function updatePackageJson(tree, options, outputConfig, isTsSolutionSetup) {
|
|
|
103
103
|
}
|
|
104
104
|
else {
|
|
105
105
|
packageJson = {
|
|
106
|
-
name: options.importPath || (0,
|
|
106
|
+
name: options.importPath || (0, internal_2.getImportPath)(tree, options.project),
|
|
107
107
|
version: '0.0.1',
|
|
108
108
|
};
|
|
109
109
|
}
|
|
@@ -117,9 +117,7 @@ function updatePackageJson(tree, options, outputConfig, isTsSolutionSetup) {
|
|
|
117
117
|
// target must exist if we don't receive an outputConfig
|
|
118
118
|
const projectTarget = project.targets[options.buildTarget];
|
|
119
119
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
120
|
-
const mergedTarget = (0, devkit_internals_1.mergeTargetConfigurations)(projectTarget, (projectTarget.executor
|
|
121
|
-
? nxJson.targetDefaults?.[projectTarget.executor]
|
|
122
|
-
: undefined) ?? nxJson.targetDefaults?.[options.buildTarget]);
|
|
120
|
+
const mergedTarget = (0, devkit_internals_1.mergeTargetConfigurations)(projectTarget, (0, internal_1.readTargetDefaultsForTarget)(options.buildTarget, nxJson.targetDefaults, projectTarget.executor));
|
|
123
121
|
({ main, outputPath } = mergedTarget.options);
|
|
124
122
|
}
|
|
125
123
|
packageJson = (0, js_1.getUpdatedPackageJsonContent)(packageJson, {
|
|
@@ -132,7 +130,7 @@ function updatePackageJson(tree, options, outputConfig, isTsSolutionSetup) {
|
|
|
132
130
|
format: options.format ?? ['esm'],
|
|
133
131
|
outputFileExtensionForCjs: '.cjs.js',
|
|
134
132
|
outputFileExtensionForEsm: '.esm.js',
|
|
135
|
-
developmentConditionName: (0,
|
|
133
|
+
developmentConditionName: (0, internal_2.getDefinedCustomConditionName)(tree),
|
|
136
134
|
});
|
|
137
135
|
// rollup has a specific declaration file generation not handled by the util above,
|
|
138
136
|
// adjust accordingly
|
|
@@ -143,8 +141,8 @@ function updatePackageJson(tree, options, outputConfig, isTsSolutionSetup) {
|
|
|
143
141
|
(0, devkit_1.writeJson)(tree, packageJsonPath, packageJson);
|
|
144
142
|
}
|
|
145
143
|
function addBuildTarget(tree, options, isTsSolutionSetup) {
|
|
146
|
-
(0,
|
|
147
|
-
|
|
144
|
+
(0, internal_1.addBuildTargetDefaults)(tree, '@nx/rollup:rollup', options.buildTarget, [
|
|
145
|
+
internal_2.TS_SOLUTION_SETUP_TSCONFIG_INPUT,
|
|
148
146
|
]);
|
|
149
147
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
150
148
|
const prevBuildOptions = project.targets?.[options.buildTarget]?.options;
|
|
@@ -207,7 +205,7 @@ function updateTsConfig(tree, options) {
|
|
|
207
205
|
throw new Error(`The '${tsconfigPath}' file doesn't exist. Provide the 'tsConfig' option with the correct path pointing to the tsconfig file to use for builds.`);
|
|
208
206
|
}
|
|
209
207
|
if (!ts) {
|
|
210
|
-
ts = (0,
|
|
208
|
+
ts = (0, internal_2.ensureTypescript)();
|
|
211
209
|
}
|
|
212
210
|
const parsedTsConfig = (0, js_1.readTsConfig)(tsconfigPath, {
|
|
213
211
|
...ts.sys,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-to-inferred.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/generators/convert-to-inferred/convert-to-inferred.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"convert-to-inferred.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/generators/convert-to-inferred/convert-to-inferred.ts"],"names":[],"mappings":"AAKA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAMpB,UAAU,MAAM;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,iBA+GlE;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertToInferred = convertToInferred;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
6
|
const extract_rollup_config_from_executor_options_1 = require("./lib/extract-rollup-config-from-executor-options");
|
|
7
7
|
const add_plugin_registrations_1 = require("./lib/add-plugin-registrations");
|
|
8
|
-
const executor_to_plugin_migrator_1 = require("@nx/devkit/src/generators/plugin-migrations/executor-to-plugin-migrator");
|
|
9
8
|
async function convertToInferred(tree, options) {
|
|
10
9
|
const migratedProjects = new Map();
|
|
11
10
|
let projects = (0, devkit_1.getProjects)(tree);
|
|
12
|
-
(0,
|
|
11
|
+
(0, internal_1.forEachExecutorOptions)(tree, '@nx/rollup:rollup', (_, projectName, targetName, configurationName) => {
|
|
13
12
|
if (options.project && projectName !== options.project)
|
|
14
13
|
return;
|
|
15
14
|
const project = projects.get(projectName);
|
|
@@ -19,9 +18,13 @@ async function convertToInferred(tree, options) {
|
|
|
19
18
|
return;
|
|
20
19
|
// Since targetDefaults for '@nx/rollup:rollup' will no longer apply, we want to copy them to the target options.
|
|
21
20
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
22
|
-
const defaults = nxJson.
|
|
21
|
+
const defaults = (0, internal_1.normalizeTargetDefaults)(nxJson?.targetDefaults).find((e) => e.executor === '@nx/rollup:rollup' &&
|
|
22
|
+
e.target === undefined &&
|
|
23
|
+
e.projects === undefined &&
|
|
24
|
+
e.plugin === undefined);
|
|
23
25
|
if (defaults) {
|
|
24
|
-
|
|
26
|
+
const { target: _t, executor: _e, projects: _p, plugin: _pl, ...rest } = defaults;
|
|
27
|
+
for (const [key, value] of Object.entries(rest)) {
|
|
25
28
|
target[key] ??= value;
|
|
26
29
|
}
|
|
27
30
|
}
|
|
@@ -67,7 +70,7 @@ async function convertToInferred(tree, options) {
|
|
|
67
70
|
migratedProjects.set(projectName, { buildTargetName: targetName });
|
|
68
71
|
});
|
|
69
72
|
if (migratedProjects.size === 0) {
|
|
70
|
-
throw new
|
|
73
|
+
throw new internal_1.NoTargetsToMigrateError();
|
|
71
74
|
}
|
|
72
75
|
projects = (0, devkit_1.getProjects)(tree);
|
|
73
76
|
await (0, add_plugin_registrations_1.addPluginRegistrations)(tree, migratedProjects, projects, '@nx/rollup/plugin');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/generators/init/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/generators/init/init.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,iBAAiB,EAEjB,IAAI,EACL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAkDnE;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rollupInitGenerator = rollupInitGenerator;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const versions_1 = require("../../utils/versions");
|
|
6
|
-
const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
|
|
7
7
|
const plugin_1 = require("../../plugins/plugin");
|
|
8
8
|
async function rollupInitGenerator(tree, schema) {
|
|
9
9
|
let task = () => { };
|
|
@@ -20,7 +20,7 @@ async function rollupInitGenerator(tree, schema) {
|
|
|
20
20
|
task = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies, undefined, schema.keepExistingVersions);
|
|
21
21
|
}
|
|
22
22
|
if (schema.addPlugin) {
|
|
23
|
-
await (0,
|
|
23
|
+
await (0, internal_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/rollup/plugin', plugin_1.createNodesV2, {
|
|
24
24
|
buildTargetName: ['build', 'rollup:build', 'rollup-build'],
|
|
25
25
|
buildDepsTargetName: [
|
|
26
26
|
'build-deps',
|
|
@@ -0,0 +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,EAML,IAAI,EAIL,MAAM,YAAY,CAAC;AAgBpB,yBAA+B,IAAI,EAAE,IAAI,iBAwGxC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
6
|
+
const ROLLUP_CONFIG_NAMES = [
|
|
7
|
+
'rollup.config.cjs',
|
|
8
|
+
'rollup.config.mjs',
|
|
9
|
+
'rollup.config.js',
|
|
10
|
+
'rollup.config.ts',
|
|
11
|
+
];
|
|
12
|
+
const PROPERTY_NAME = 'useLegacyTypescriptPlugin';
|
|
13
|
+
async function default_1(tree) {
|
|
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;
|
|
19
|
+
for (const [projectName] of projects) {
|
|
20
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
21
|
+
let projectJsonChanged = false;
|
|
22
|
+
if (projectConfig.targets) {
|
|
23
|
+
for (const [, targetConfig] of Object.entries(projectConfig.targets)) {
|
|
24
|
+
if (targetConfig.executor !== '@nx/rollup:rollup' &&
|
|
25
|
+
targetConfig.executor !== '@nrwl/rollup:rollup') {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (targetConfig.options &&
|
|
29
|
+
'useLegacyTypescriptPlugin' in targetConfig.options) {
|
|
30
|
+
delete targetConfig.options.useLegacyTypescriptPlugin;
|
|
31
|
+
projectJsonChanged = true;
|
|
32
|
+
}
|
|
33
|
+
if (targetConfig.configurations) {
|
|
34
|
+
for (const [, config] of Object.entries(targetConfig.configurations)) {
|
|
35
|
+
if ('useLegacyTypescriptPlugin' in config) {
|
|
36
|
+
delete config.useLegacyTypescriptPlugin;
|
|
37
|
+
projectJsonChanged = true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (projectJsonChanged) {
|
|
44
|
+
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
|
45
|
+
anyChange = true;
|
|
46
|
+
}
|
|
47
|
+
(0, devkit_1.visitNotIgnoredFiles)(tree, projectConfig.root, (filePath) => {
|
|
48
|
+
const basename = filePath.split('/').pop();
|
|
49
|
+
if (!ROLLUP_CONFIG_NAMES.includes(basename))
|
|
50
|
+
return;
|
|
51
|
+
if (stripFromRollupConfig(tree, filePath)) {
|
|
52
|
+
anyChange = true;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
// Strip from nx.json targetDefaults (keyed by target name or executor name).
|
|
57
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
58
|
+
if (nxJson?.targetDefaults) {
|
|
59
|
+
const ROLLUP_EXECUTORS = ['@nx/rollup:rollup', '@nrwl/rollup:rollup'];
|
|
60
|
+
let nxJsonChanged = false;
|
|
61
|
+
for (const [targetOrExecutor, targetDefault] of Object.entries(nxJson.targetDefaults)) {
|
|
62
|
+
if (!ROLLUP_EXECUTORS.includes(targetOrExecutor) &&
|
|
63
|
+
!ROLLUP_EXECUTORS.includes(targetDefault.executor)) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (targetDefault.options &&
|
|
67
|
+
'useLegacyTypescriptPlugin' in targetDefault.options) {
|
|
68
|
+
delete targetDefault.options.useLegacyTypescriptPlugin;
|
|
69
|
+
nxJsonChanged = true;
|
|
70
|
+
}
|
|
71
|
+
if (targetDefault.configurations) {
|
|
72
|
+
for (const [, config] of Object.entries(targetDefault.configurations)) {
|
|
73
|
+
if ('useLegacyTypescriptPlugin' in config) {
|
|
74
|
+
delete config.useLegacyTypescriptPlugin;
|
|
75
|
+
nxJsonChanged = true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (nxJsonChanged) {
|
|
81
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
82
|
+
anyChange = true;
|
|
83
|
+
}
|
|
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
|
+
}
|
|
90
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
91
|
+
}
|
|
92
|
+
function stripFromRollupConfig(tree, filePath) {
|
|
93
|
+
const original = tree.read(filePath, 'utf-8');
|
|
94
|
+
if (!original?.includes(PROPERTY_NAME))
|
|
95
|
+
return false;
|
|
96
|
+
// Filter by the property NAME (not any descendant Identifier) so we don't
|
|
97
|
+
// strip `{ alias: useLegacyTypescriptPlugin }` where the identifier appears as a value.
|
|
98
|
+
// Also handle shorthand `{ useLegacyTypescriptPlugin }` — strip the entry, leave
|
|
99
|
+
// the variable declaration behind (not our problem).
|
|
100
|
+
const matches = (0, tsquery_1.query)((0, tsquery_1.ast)(original), 'PropertyAssignment, ShorthandPropertyAssignment').filter((p) => p.name && p.name.text === PROPERTY_NAME);
|
|
101
|
+
if (matches.length === 0)
|
|
102
|
+
return false;
|
|
103
|
+
// Walk in reverse so each splice doesn't shift the offsets of remaining matches
|
|
104
|
+
// (a file may legitimately contain multiple withNx({...}) calls, e.g. multi-format
|
|
105
|
+
// configs returning more than one rollup options object).
|
|
106
|
+
let updated = original;
|
|
107
|
+
for (const propNode of matches.slice().reverse()) {
|
|
108
|
+
let start = propNode.getStart();
|
|
109
|
+
let end = propNode.getEnd();
|
|
110
|
+
if (updated[end] === ',')
|
|
111
|
+
end += 1;
|
|
112
|
+
// If the property occupies its own line, drop the whole line including indentation.
|
|
113
|
+
const lineStart = updated.lastIndexOf('\n', start - 1) + 1;
|
|
114
|
+
const nextNewline = updated.indexOf('\n', end);
|
|
115
|
+
const lineEnd = nextNewline === -1 ? updated.length : nextNewline + 1;
|
|
116
|
+
if (/^\s*$/.test(updated.slice(lineStart, start)) &&
|
|
117
|
+
/^\s*$/.test(updated.slice(end, lineEnd))) {
|
|
118
|
+
start = lineStart;
|
|
119
|
+
end = lineEnd;
|
|
120
|
+
}
|
|
121
|
+
updated = updated.slice(0, start) + updated.slice(end);
|
|
122
|
+
}
|
|
123
|
+
tree.write(filePath, updated);
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-copy-assets.plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/rollup/src/plugins/nx-copy-assets.plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"nx-copy-assets.plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/rollup/src/plugins/nx-copy-assets.plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAE,SAAS,EAAqB,MAAM,iBAAiB,CAAC;AAC/D,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAiBA;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,MAAM,CAqD7E"}
|
|
@@ -4,7 +4,7 @@ exports.extractGlobLiteralPrefix = extractGlobLiteralPrefix;
|
|
|
4
4
|
exports.nxCopyAssetsPlugin = nxCopyAssetsPlugin;
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const
|
|
7
|
+
const internal_1 = require("@nx/js/internal");
|
|
8
8
|
/**
|
|
9
9
|
* Splits a glob into its literal directory prefix and the remaining pattern.
|
|
10
10
|
* CopyAssetsHandler expects input to be a directory and glob to be a pattern
|
|
@@ -60,7 +60,7 @@ function nxCopyAssetsPlugin(options) {
|
|
|
60
60
|
const outputDir = (0, node_path_1.isAbsolute)(options.outputPath)
|
|
61
61
|
? options.outputPath
|
|
62
62
|
: (0, node_path_1.join)(devkit_1.workspaceRoot, options.outputPath);
|
|
63
|
-
handler = new
|
|
63
|
+
handler = new internal_1.CopyAssetsHandler({
|
|
64
64
|
rootDir: devkit_1.workspaceRoot,
|
|
65
65
|
projectDir: options.projectRoot,
|
|
66
66
|
outputDir,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/rollup/src/plugins/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/rollup/src/plugins/plugin.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,KAAK,kBAAkB,EAIvB,aAAa,EAKd,MAAM,YAAY,CAAC;AASpB;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAMD,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,mBAAmB,CAgE1D,CAAC;AAEF,eAAO,MAAM,aAAa,oCAAc,CAAC"}
|
package/src/plugins/plugin.js
CHANGED
|
@@ -1,29 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createNodesV2 = exports.createNodes = exports.createDependencies = void 0;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
5
6
|
const path_1 = require("path");
|
|
6
7
|
const fs_1 = require("fs");
|
|
7
8
|
const devkit_1 = require("@nx/devkit");
|
|
8
|
-
const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
|
|
9
9
|
const js_1 = require("@nx/js");
|
|
10
|
-
const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
|
|
11
10
|
const file_hasher_1 = require("nx/src/hasher/file-hasher");
|
|
12
|
-
const
|
|
13
|
-
const util_1 = require("@nx/js/src/plugins/typescript/util");
|
|
14
|
-
function readTargetsCache(cachePath) {
|
|
15
|
-
try {
|
|
16
|
-
return process.env.NX_CACHE_PROJECT_GRAPH !== 'false'
|
|
17
|
-
? (0, devkit_1.readJsonFile)(cachePath)
|
|
18
|
-
: {};
|
|
19
|
-
}
|
|
20
|
-
catch {
|
|
21
|
-
return {};
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function writeTargetsToCache(cachePath, results) {
|
|
25
|
-
(0, devkit_1.writeJsonFile)(cachePath, results);
|
|
26
|
-
}
|
|
11
|
+
const internal_2 = require("@nx/js/internal");
|
|
27
12
|
/**
|
|
28
13
|
* @deprecated The 'createDependencies' function is now a no-op. This functionality is included in 'createNodesV2'.
|
|
29
14
|
*/
|
|
@@ -38,34 +23,50 @@ exports.createNodes = [
|
|
|
38
23
|
const normalizedOptions = normalizeOptions(options);
|
|
39
24
|
const optionsHash = (0, file_hasher_1.hashObject)(normalizedOptions);
|
|
40
25
|
const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `rollup-${optionsHash}.hash`);
|
|
41
|
-
const targetsCache =
|
|
42
|
-
const isTsSolutionSetup = (0,
|
|
43
|
-
const
|
|
26
|
+
const targetsCache = new internal_1.PluginCache(cachePath);
|
|
27
|
+
const isTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)();
|
|
28
|
+
const packageManager = (0, devkit_1.detectPackageManager)(context.workspaceRoot);
|
|
29
|
+
const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
|
30
|
+
const lockFileName = (0, js_1.getLockFileName)(packageManager);
|
|
44
31
|
try {
|
|
45
|
-
|
|
32
|
+
const { entries, preErrors } = await filterRollupConfigs(configFilePaths, context);
|
|
33
|
+
const projectHashes = await (0, internal_1.calculateHashesForCreateNodes)(entries.map((e) => e.projectRoot), normalizedOptions, context, entries.map(() => [lockFileName]));
|
|
34
|
+
let results = [];
|
|
35
|
+
let nodeErrors = [];
|
|
36
|
+
try {
|
|
37
|
+
results = await (0, devkit_1.createNodesFromFiles)((configFile, _, ctx, idx) => createNodesInternal(configFile, normalizedOptions, ctx, targetsCache, isTsSolutionSetup, pmc, projectHashes[idx]), entries.map((e) => e.configFile), normalizedOptions, context);
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
if (e instanceof devkit_1.AggregateCreateNodesError) {
|
|
41
|
+
results = e.partialResults ?? [];
|
|
42
|
+
nodeErrors = e.errors;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
throw e;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const allErrors = [...preErrors, ...nodeErrors];
|
|
49
|
+
if (allErrors.length > 0) {
|
|
50
|
+
throw new devkit_1.AggregateCreateNodesError(allErrors, results);
|
|
51
|
+
}
|
|
52
|
+
return results;
|
|
46
53
|
}
|
|
47
54
|
finally {
|
|
48
|
-
|
|
55
|
+
targetsCache.writeToDisk();
|
|
49
56
|
}
|
|
50
57
|
},
|
|
51
58
|
];
|
|
52
59
|
exports.createNodesV2 = exports.createNodes;
|
|
53
|
-
async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup, pmc) {
|
|
60
|
+
async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup, pmc, hash) {
|
|
54
61
|
const projectRoot = (0, path_1.dirname)(configFilePath);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const siblingFiles = (0, fs_1.readdirSync)(fullyQualifiedProjectRoot);
|
|
58
|
-
if (!siblingFiles.includes('package.json') &&
|
|
59
|
-
!siblingFiles.includes('project.json')) {
|
|
60
|
-
return {};
|
|
62
|
+
if (!targetsCache.has(hash)) {
|
|
63
|
+
targetsCache.set(hash, await buildRollupTarget(configFilePath, projectRoot, options, context, isTsSolutionSetup, pmc));
|
|
61
64
|
}
|
|
62
|
-
const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
|
|
63
|
-
targetsCache[hash] ??= await buildRollupTarget(configFilePath, projectRoot, options, context, isTsSolutionSetup, pmc);
|
|
64
65
|
return {
|
|
65
66
|
projects: {
|
|
66
67
|
[projectRoot]: {
|
|
67
68
|
root: projectRoot,
|
|
68
|
-
targets: targetsCache
|
|
69
|
+
targets: targetsCache.get(hash),
|
|
69
70
|
},
|
|
70
71
|
},
|
|
71
72
|
};
|
|
@@ -89,7 +90,7 @@ async function buildRollupTarget(configFilePath, projectRoot, options, context,
|
|
|
89
90
|
}
|
|
90
91
|
const isTsConfig = configFilePath.endsWith('ts');
|
|
91
92
|
const tsConfigPlugin = '@rollup/plugin-typescript';
|
|
92
|
-
const namedInputs = (0,
|
|
93
|
+
const namedInputs = (0, internal_1.getNamedInputs)(projectRoot, context);
|
|
93
94
|
const rollupConfig = (await loadConfigFile((0, devkit_1.joinPathFragments)(context.workspaceRoot, configFilePath), isTsConfig ? { configPlugin: tsConfigPlugin } : {}, true // Enable watch mode so that rollup properly reloads config files without reusing a cached version
|
|
94
95
|
)).options;
|
|
95
96
|
const outputs = getOutputs(rollupConfig, projectRoot);
|
|
@@ -106,7 +107,7 @@ async function buildRollupTarget(configFilePath, projectRoot, options, context,
|
|
|
106
107
|
? ['production', '^production']
|
|
107
108
|
: ['default', '^default']),
|
|
108
109
|
{ externalDependencies: ['rollup'] },
|
|
109
|
-
|
|
110
|
+
internal_2.TS_SOLUTION_SETUP_TSCONFIG_INPUT,
|
|
110
111
|
],
|
|
111
112
|
outputs,
|
|
112
113
|
metadata: {
|
|
@@ -128,7 +129,7 @@ async function buildRollupTarget(configFilePath, projectRoot, options, context,
|
|
|
128
129
|
'@nx/js:typescript-sync',
|
|
129
130
|
];
|
|
130
131
|
}
|
|
131
|
-
(0,
|
|
132
|
+
(0, internal_2.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
|
|
132
133
|
return targets;
|
|
133
134
|
}
|
|
134
135
|
function getOutputs(rollupConfigs, projectRoot) {
|
|
@@ -157,6 +158,28 @@ function getOutputs(rollupConfigs, projectRoot) {
|
|
|
157
158
|
}
|
|
158
159
|
return Array.from(outputs);
|
|
159
160
|
}
|
|
161
|
+
async function filterRollupConfigs(configFiles, context) {
|
|
162
|
+
const preErrors = [];
|
|
163
|
+
const candidates = await Promise.all(configFiles.map(async (configFile) => {
|
|
164
|
+
try {
|
|
165
|
+
const projectRoot = (0, path_1.dirname)(configFile);
|
|
166
|
+
const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
|
|
167
|
+
if (!siblingFiles.includes('package.json') &&
|
|
168
|
+
!siblingFiles.includes('project.json')) {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
return { configFile, projectRoot };
|
|
172
|
+
}
|
|
173
|
+
catch (e) {
|
|
174
|
+
preErrors.push([configFile, e]);
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
}));
|
|
178
|
+
return {
|
|
179
|
+
entries: candidates.filter((c) => c !== null),
|
|
180
|
+
preErrors,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
160
183
|
function normalizeOptions(options) {
|
|
161
184
|
return {
|
|
162
185
|
buildTargetName: options.buildTargetName ?? 'build',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/plugins/with-nx/normalize-options.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,mCAAmC,EACnC,yBAAyB,EAC1B,MAAM,mBAAmB,CAAC;AAI3B,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,yBAAyB,GACjC,mCAAmC,
|
|
1
|
+
{"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/plugins/with-nx/normalize-options.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,mCAAmC,EACnC,yBAAyB,EAC1B,MAAM,mBAAmB,CAAC;AAI3B,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,yBAAyB,GACjC,mCAAmC,CA+BrC"}
|
|
@@ -5,13 +5,13 @@ const node_path_1 = require("node:path");
|
|
|
5
5
|
const node_fs_1 = require("node:fs");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const js_1 = require("@nx/js");
|
|
8
|
-
const
|
|
8
|
+
const internal_1 = require("@nx/js/internal");
|
|
9
9
|
function normalizeOptions(projectRoot, sourceRoot, options) {
|
|
10
10
|
if (global.NX_GRAPH_CREATION)
|
|
11
11
|
return options;
|
|
12
12
|
normalizeRelativePaths(projectRoot, options);
|
|
13
13
|
// New TS Solution already has a typecheck target
|
|
14
|
-
if ((0,
|
|
14
|
+
if ((0, internal_1.isUsingTsSolutionSetup)()) {
|
|
15
15
|
options.skipTypeCheck = true;
|
|
16
16
|
}
|
|
17
17
|
return {
|
|
@@ -30,12 +30,7 @@ function normalizeOptions(projectRoot, sourceRoot, options) {
|
|
|
30
30
|
javascriptEnabled: options.javascriptEnabled ?? false,
|
|
31
31
|
skipTypeCheck: options.skipTypeCheck ?? false,
|
|
32
32
|
skipTypeField: options.skipTypeField ?? false,
|
|
33
|
-
|
|
34
|
-
* TODO(v23): Update default to true
|
|
35
|
-
* This defaults to false for pure plugin usage to match what is the current behaviour for users
|
|
36
|
-
* However, this differs from the Rollup executor usage as it defaulted to `true` in the `schema.json`
|
|
37
|
-
*/
|
|
38
|
-
buildLibsFromSource: options.buildLibsFromSource ?? false,
|
|
33
|
+
buildLibsFromSource: options.buildLibsFromSource ?? true,
|
|
39
34
|
};
|
|
40
35
|
}
|
|
41
36
|
function normalizeAssets(assets, root, sourceRoot) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { OutputBundle } from 'rollup';
|
|
2
|
+
export declare function typeDefinitions(options: {
|
|
3
|
+
projectRoot: string;
|
|
4
|
+
}): {
|
|
5
|
+
name: string;
|
|
6
|
+
generateBundle(_opts: unknown, bundle: OutputBundle): Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=type-definitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-definitions.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/plugins/with-nx/type-definitions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAe3C,wBAAgB,eAAe,CAAC,OAAO,EAAE;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE;;0BAGhC,OAAO,UAAU,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;EA2C5E"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.typeDefinitions = typeDefinitions;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
/*
|
|
7
|
+
* This plugin takes all entry-points from the generated bundle and creates a
|
|
8
|
+
* bundled version of corresponding d.ts files.
|
|
9
|
+
*
|
|
10
|
+
* For example, `src/index.ts` generates two corresponding files:
|
|
11
|
+
* - `dist/xyz/index.js`
|
|
12
|
+
* - `dist/xyz/src/index.d.ts`
|
|
13
|
+
*
|
|
14
|
+
* We want a third file: `dist/index.d.ts` that re-exports from `src/index.d.ts`.
|
|
15
|
+
* That way, when TSC or IDEs look for types, it will find them in the right place.
|
|
16
|
+
*/
|
|
17
|
+
function typeDefinitions(options) {
|
|
18
|
+
return {
|
|
19
|
+
name: 'dts-bundle',
|
|
20
|
+
async generateBundle(_opts, bundle) {
|
|
21
|
+
for (const [name, file] of Object.entries(bundle)) {
|
|
22
|
+
if (file.type === 'asset' ||
|
|
23
|
+
!file.isEntry ||
|
|
24
|
+
file.facadeModuleId == null) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
const hasDefaultExport = file.exports.includes('default');
|
|
28
|
+
const entrySourceFileName = (0, path_1.relative)(options.projectRoot, file.facadeModuleId);
|
|
29
|
+
const entrySourceDtsName = entrySourceFileName.replace(/\.[cm]?[jt]sx?$/, '');
|
|
30
|
+
// Replace various JavaScript file extensions (e.g., .js, .cjs, .mjs, .cjs.js, .mjs.js) with .d.ts for generating type definition file names.
|
|
31
|
+
// This regex matches the pattern used in packages/rollup/src/plugins/package-json/update-package-json.ts
|
|
32
|
+
const dtsFileName = file.fileName.replace(/(\.cjs|\.mjs|\.esm\.js|\.cjs\.js|\.mjs\.js|\.js)$/, '.d.ts');
|
|
33
|
+
const relativeSourceDtsName = JSON.stringify('./' + entrySourceDtsName);
|
|
34
|
+
const dtsFileSource = hasDefaultExport
|
|
35
|
+
? (0, devkit_1.stripIndents) `
|
|
36
|
+
export * from ${relativeSourceDtsName};
|
|
37
|
+
export { default } from ${relativeSourceDtsName};
|
|
38
|
+
`
|
|
39
|
+
: `export * from ${relativeSourceDtsName};\n`;
|
|
40
|
+
this.emitFile({
|
|
41
|
+
type: 'asset',
|
|
42
|
+
fileName: dtsFileName,
|
|
43
|
+
source: dtsFileSource,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -80,10 +80,6 @@ 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;
|
|
87
83
|
/**
|
|
88
84
|
* Whether to generate a package.json file in the output path. It's not supported when the workspace is
|
|
89
85
|
* set up with TypeScript Project References along with the package managers' Workspaces feature. Otherwise,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-nx-options.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/plugins/with-nx/with-nx-options.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,yBAAyB;IACxC;;SAEK;IACL,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,KAAK,CAAC;IACnC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,GAAG,MAAM,CAAC;IACrC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC9B;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC;IAC3B;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB
|
|
1
|
+
{"version":3,"file":"with-nx-options.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/plugins/with-nx/with-nx-options.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,yBAAyB;IACxC;;SAEK;IACL,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,KAAK,CAAC;IACnC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,GAAG,MAAM,CAAC;IACrC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC9B;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC;IAC3B;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mCACf,SAAQ,yBAAyB;IACjC,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,QAAQ,EAAE,OAAO,GAAG,KAAK,GAAG,KAAK,CAAC;IAClC,MAAM,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC;CAC3B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DependentBuildableProjectNode } from '@nx/js/
|
|
1
|
+
import { DependentBuildableProjectNode } from '@nx/js/internal';
|
|
2
2
|
import * as rollup from 'rollup';
|
|
3
3
|
import { RollupWithNxPluginOptions } from './with-nx-options';
|
|
4
4
|
export declare function withNx(rawOptions: RollupWithNxPluginOptions, rollupConfig?: rollup.RollupOptions, dependencies?: DependentBuildableProjectNode[]): rollup.RollupOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-nx.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/plugins/with-nx/with-nx.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"with-nx.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/plugins/with-nx/with-nx.ts"],"names":[],"mappings":"AASA,OAAO,EAIL,6BAA6B,EAG9B,MAAM,iBAAiB,CAAC;AASzB,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAQjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AA4B9D,wBAAgB,MAAM,CACpB,UAAU,EAAE,yBAAyB,EACrC,YAAY,GAAE,MAAM,CAAC,aAAkB,EAEvC,YAAY,CAAC,EAAE,6BAA6B,EAAE,GAC7C,MAAM,CAAC,aAAa,CAuQtB"}
|
|
@@ -4,10 +4,9 @@ exports.withNx = withNx;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const path_1 = require("path");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const ts_config_1 = require("@nx/js/src/utils/typescript/ts-config");
|
|
7
|
+
const internal_1 = require("@nx/js/internal");
|
|
8
|
+
const type_definitions_1 = require("./type-definitions");
|
|
9
|
+
const js_1 = require("@nx/js");
|
|
11
10
|
const plugin_babel_1 = require("@rollup/plugin-babel");
|
|
12
11
|
const plugin_node_resolve_1 = tslib_1.__importDefault(require("@rollup/plugin-node-resolve"));
|
|
13
12
|
const autoprefixer_1 = tslib_1.__importDefault(require("autoprefixer"));
|
|
@@ -52,16 +51,16 @@ dependencies) {
|
|
|
52
51
|
: (0, devkit_1.readCachedProjectGraph)();
|
|
53
52
|
// If dependencies are not passed from executor, calculate them from project graph.
|
|
54
53
|
if (!dependencies && !global.NX_GRAPH_CREATION) {
|
|
55
|
-
const result = (0,
|
|
54
|
+
const result = (0, internal_1.calculateProjectBuildableDependencies)(undefined, projectGraph, devkit_1.workspaceRoot, projectNode.name, process.env.NX_TASK_TARGET_TARGET, process.env.NX_TASK_TARGET_CONFIGURATION, true);
|
|
56
55
|
dependencies = result.dependencies;
|
|
57
56
|
}
|
|
58
|
-
const projectSourceRoot = (0,
|
|
57
|
+
const projectSourceRoot = (0, internal_1.getProjectSourceRoot)(projectNode.data);
|
|
59
58
|
const options = (0, normalize_options_1.normalizeOptions)(projectNode.data.root, projectSourceRoot, rawOptions);
|
|
60
59
|
const useBabel = options.compiler === 'babel';
|
|
61
60
|
const useSwc = options.compiler === 'swc';
|
|
62
61
|
const tsConfigPath = options.buildLibsFromSource || global.NX_GRAPH_CREATION
|
|
63
62
|
? (0, node_path_1.join)(devkit_1.workspaceRoot, options.tsConfig)
|
|
64
|
-
: (0,
|
|
63
|
+
: (0, internal_1.createTmpTsConfig)(options.tsConfig, devkit_1.workspaceRoot, projectNode.data.root, dependencies);
|
|
65
64
|
ensureTypeScript();
|
|
66
65
|
const tsConfigFile = ts.readConfigFile(tsConfigPath, ts.sys.readFile);
|
|
67
66
|
const tsConfig = ts.parseJsonConfigFileContent(tsConfigFile.config, ts.sys, (0, node_path_1.dirname)(tsConfigPath));
|
|
@@ -141,7 +140,7 @@ dependencies) {
|
|
|
141
140
|
if (!global.NX_GRAPH_CREATION) {
|
|
142
141
|
// Ensure TypeScript is available before any plugin initialization
|
|
143
142
|
ensureTypeScript();
|
|
144
|
-
const isTsSolutionSetup = (0,
|
|
143
|
+
const isTsSolutionSetup = (0, internal_1.isUsingTsSolutionSetup)();
|
|
145
144
|
if (isTsSolutionSetup) {
|
|
146
145
|
if (options.generatePackageJson) {
|
|
147
146
|
throw new Error(`Setting 'generatePackageJson: true' is not supported with the current TypeScript setup. Update the 'package.json' file at the project root as needed and unset the 'generatePackageJson' option. See https://nx.dev/docs/technologies/node/guides/deploying-node-projects for the recommended pruned package.json workflow.`);
|
|
@@ -166,39 +165,23 @@ dependencies) {
|
|
|
166
165
|
}),
|
|
167
166
|
image(),
|
|
168
167
|
json(),
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
})
|
|
185
|
-
|
|
186
|
-
// @rollup/plugin-typescript needs outDir and declarationDir to match Rollup's output directory
|
|
187
|
-
const { outDir, declarationDir, ...tsCompilerOptions } = compilerOptions;
|
|
188
|
-
const rollupOutputDir = Array.isArray(finalConfig.output)
|
|
189
|
-
? finalConfig.output[0].dir
|
|
190
|
-
: finalConfig.output.dir;
|
|
191
|
-
return require('@rollup/plugin-typescript')({
|
|
192
|
-
tsconfig: tsConfigPath,
|
|
193
|
-
compilerOptions: {
|
|
194
|
-
...tsCompilerOptions,
|
|
195
|
-
composite: false,
|
|
196
|
-
outDir: rollupOutputDir,
|
|
197
|
-
declarationDir: rollupOutputDir,
|
|
198
|
-
noEmitOnError: !options.skipTypeCheck,
|
|
199
|
-
},
|
|
200
|
-
});
|
|
201
|
-
})(),
|
|
168
|
+
(() => {
|
|
169
|
+
// @rollup/plugin-typescript needs outDir and declarationDir to match Rollup's output directory
|
|
170
|
+
const { outDir, declarationDir, ...tsCompilerOptions } = compilerOptions;
|
|
171
|
+
const rollupOutputDir = Array.isArray(finalConfig.output)
|
|
172
|
+
? finalConfig.output[0].dir
|
|
173
|
+
: finalConfig.output.dir;
|
|
174
|
+
return require('@rollup/plugin-typescript')({
|
|
175
|
+
tsconfig: tsConfigPath,
|
|
176
|
+
compilerOptions: {
|
|
177
|
+
...tsCompilerOptions,
|
|
178
|
+
composite: false,
|
|
179
|
+
outDir: rollupOutputDir,
|
|
180
|
+
declarationDir: rollupOutputDir,
|
|
181
|
+
noEmitOnError: !options.skipTypeCheck,
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
})(),
|
|
202
185
|
(0, type_definitions_1.typeDefinitions)({
|
|
203
186
|
projectRoot,
|
|
204
187
|
}),
|
|
@@ -268,10 +251,10 @@ function createInput(options) {
|
|
|
268
251
|
return input;
|
|
269
252
|
}
|
|
270
253
|
function createTsCompilerOptions(projectRoot, config, tsConfigPath, options, dependencies) {
|
|
271
|
-
const compilerOptionPaths = (0,
|
|
254
|
+
const compilerOptionPaths = (0, internal_1.computeCompilerOptionsPaths)(config, dependencies ?? []);
|
|
272
255
|
// Resolve paths to absolute so they work without baseUrl and regardless
|
|
273
256
|
// of which tsconfig the plugin reads (project vs workspace root).
|
|
274
|
-
const pathsBase = (0,
|
|
257
|
+
const pathsBase = (0, js_1.resolvePathsBaseUrl)(tsConfigPath);
|
|
275
258
|
for (const key of Object.keys(compilerOptionPaths)) {
|
|
276
259
|
compilerOptionPaths[key] = compilerOptionPaths[key].map((p) => {
|
|
277
260
|
if ((0, path_1.isAbsolute)(p)) {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const ROLLUP_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx/rollup:rollup` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/rollup:convert-to-inferred` to migrate to the `@nx/rollup/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
|
|
2
|
+
export declare function warnRollupExecutorDeprecation(): void;
|
|
3
|
+
export declare function warnRollupExecutorGenerating(): void;
|
|
4
|
+
//# sourceMappingURL=deprecation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../../../../packages/rollup/src/utils/deprecation.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,mCAAmC,mQACkN,CAAC;AAEnQ,wBAAgB,6BAA6B,IAAI,IAAI,CAEpD;AAMD,wBAAgB,4BAA4B,IAAI,IAAI,CAInD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ROLLUP_EXECUTOR_DEPRECATION_MESSAGE = void 0;
|
|
4
|
+
exports.warnRollupExecutorDeprecation = warnRollupExecutorDeprecation;
|
|
5
|
+
exports.warnRollupExecutorGenerating = warnRollupExecutorGenerating;
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
// TODO(v24): Remove the @nx/rollup:rollup executor. The inferred plugin
|
|
8
|
+
// (@nx/rollup/plugin) and the convert-to-inferred generator stay supported.
|
|
9
|
+
exports.ROLLUP_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/rollup:rollup` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/rollup:convert-to-inferred` to migrate to the `@nx/rollup/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
|
|
10
|
+
function warnRollupExecutorDeprecation() {
|
|
11
|
+
devkit_1.logger.warn(exports.ROLLUP_EXECUTOR_DEPRECATION_MESSAGE);
|
|
12
|
+
}
|
|
13
|
+
// Fired when the @nx/rollup:configuration generator is about to generate a
|
|
14
|
+
// target that uses the deprecated executor — i.e. when @nx/rollup/plugin
|
|
15
|
+
// isn't registered in nx.json. Surfaces the deprecation at generation time
|
|
16
|
+
// rather than only when the user later runs the generated target.
|
|
17
|
+
function warnRollupExecutorGenerating() {
|
|
18
|
+
devkit_1.logger.warn('Generating a target that uses the deprecated `@nx/rollup:rollup` executor. The executor will be removed in Nx v24. Run `nx g @nx/rollup:convert-to-inferred` next to migrate this target to the `@nx/rollup/plugin` inferred plugin and prevent future generators from emitting executor targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
|
|
19
|
+
}
|
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ensureDependencies = ensureDependencies;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/js/internal");
|
|
6
|
+
const versions_1 = require("./versions");
|
|
7
7
|
function ensureDependencies(tree, options) {
|
|
8
8
|
switch (options.compiler) {
|
|
9
9
|
case 'swc':
|
|
10
10
|
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
11
|
-
'@swc/helpers':
|
|
12
|
-
'@swc/core':
|
|
13
|
-
'swc-loader':
|
|
11
|
+
'@swc/helpers': internal_1.swcHelpersVersion,
|
|
12
|
+
'@swc/core': internal_1.swcCoreVersion,
|
|
13
|
+
'swc-loader': versions_1.swcLoaderVersion,
|
|
14
14
|
});
|
|
15
15
|
case 'babel':
|
|
16
16
|
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
17
|
-
'core-js':
|
|
18
|
-
tslib:
|
|
17
|
+
'core-js': versions_1.coreJsVersion, // needed for preset-env to work
|
|
18
|
+
tslib: versions_1.tsLibVersion,
|
|
19
19
|
});
|
|
20
20
|
default:
|
|
21
|
-
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { tslib:
|
|
21
|
+
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { tslib: versions_1.tsLibVersion });
|
|
22
22
|
}
|
|
23
23
|
}
|