@nx/rollup 23.0.0-beta.11 → 23.0.0-beta.13
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 +4 -4
- package/src/executors/rollup/lib/normalize.js +2 -2
- package/src/executors/rollup/rollup.impl.js +2 -2
- package/src/generators/configuration/configuration.d.ts.map +1 -1
- package/src/generators/configuration/configuration.js +7 -11
- package/src/generators/convert-to-inferred/convert-to-inferred.d.ts.map +1 -1
- package/src/generators/convert-to-inferred/convert-to-inferred.js +6 -2
- 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 +4 -5
- package/src/plugins/with-nx/normalize-options.js +2 -2
- 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.d.ts +1 -1
- package/src/plugins/with-nx/with-nx.d.ts.map +1 -1
- package/src/plugins/with-nx/with-nx.js +9 -10
- package/src/utils/ensure-dependencies.js +8 -8
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.13",
|
|
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.13",
|
|
34
|
+
"@nx/js": "23.0.0-beta.13",
|
|
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.13",
|
|
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: []
|
|
@@ -10,7 +10,7 @@ const internal_1 = require("@nx/devkit/internal");
|
|
|
10
10
|
const normalize_1 = require("./lib/normalize");
|
|
11
11
|
const with_nx_1 = require("../../plugins/with-nx/with-nx");
|
|
12
12
|
const generate_package_json_1 = require("../../plugins/package-json/generate-package-json");
|
|
13
|
-
const
|
|
13
|
+
const internal_2 = require("@nx/js/internal");
|
|
14
14
|
const deprecation_1 = require("../../utils/deprecation");
|
|
15
15
|
async function* rollupExecutor(rawOptions, context) {
|
|
16
16
|
(0, deprecation_1.warnRollupExecutorDeprecation)();
|
|
@@ -80,7 +80,7 @@ async function* rollupExecutor(rawOptions, context) {
|
|
|
80
80
|
}
|
|
81
81
|
// -----------------------------------------------------------------------------
|
|
82
82
|
async function createRollupOptions(options, context) {
|
|
83
|
-
const { dependencies } = (0,
|
|
83
|
+
const { dependencies } = (0, internal_2.calculateProjectBuildableDependencies)(context.taskGraph, context.projectGraph, context.root, context.projectName, context.targetName, context.configurationName, true);
|
|
84
84
|
const rollupConfig = (0, with_nx_1.withNx)(options, {}, dependencies);
|
|
85
85
|
// `generatePackageJson` is a plugin rather than being embedded into @nx/rollup:rollup.
|
|
86
86
|
// Make sure the plugin is always present to keep the previous before of Nx < 19.4, where it was not a plugin.
|
|
@@ -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"}
|
|
@@ -4,9 +4,7 @@ exports.configurationGenerator = configurationGenerator;
|
|
|
4
4
|
const internal_1 = require("@nx/devkit/internal");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
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");
|
|
@@ -24,7 +22,7 @@ async function configurationGenerator(tree, options) {
|
|
|
24
22
|
if (!options.skipPackageJson) {
|
|
25
23
|
tasks.push((0, ensure_dependencies_1.ensureDependencies)(tree, options));
|
|
26
24
|
}
|
|
27
|
-
const isTsSolutionSetup = (0,
|
|
25
|
+
const isTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)(tree);
|
|
28
26
|
let outputConfig;
|
|
29
27
|
if ((0, has_plugin_1.hasPlugin)(tree)) {
|
|
30
28
|
outputConfig = createRollupConfig(tree, options, isTsSolutionSetup);
|
|
@@ -105,7 +103,7 @@ function updatePackageJson(tree, options, outputConfig, isTsSolutionSetup) {
|
|
|
105
103
|
}
|
|
106
104
|
else {
|
|
107
105
|
packageJson = {
|
|
108
|
-
name: options.importPath || (0,
|
|
106
|
+
name: options.importPath || (0, internal_2.getImportPath)(tree, options.project),
|
|
109
107
|
version: '0.0.1',
|
|
110
108
|
};
|
|
111
109
|
}
|
|
@@ -119,9 +117,7 @@ function updatePackageJson(tree, options, outputConfig, isTsSolutionSetup) {
|
|
|
119
117
|
// target must exist if we don't receive an outputConfig
|
|
120
118
|
const projectTarget = project.targets[options.buildTarget];
|
|
121
119
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
122
|
-
const mergedTarget = (0, devkit_internals_1.mergeTargetConfigurations)(projectTarget, (projectTarget.executor
|
|
123
|
-
? nxJson.targetDefaults?.[projectTarget.executor]
|
|
124
|
-
: undefined) ?? nxJson.targetDefaults?.[options.buildTarget]);
|
|
120
|
+
const mergedTarget = (0, devkit_internals_1.mergeTargetConfigurations)(projectTarget, (0, internal_1.readTargetDefaultsForTarget)(options.buildTarget, nxJson.targetDefaults, projectTarget.executor));
|
|
125
121
|
({ main, outputPath } = mergedTarget.options);
|
|
126
122
|
}
|
|
127
123
|
packageJson = (0, js_1.getUpdatedPackageJsonContent)(packageJson, {
|
|
@@ -134,7 +130,7 @@ function updatePackageJson(tree, options, outputConfig, isTsSolutionSetup) {
|
|
|
134
130
|
format: options.format ?? ['esm'],
|
|
135
131
|
outputFileExtensionForCjs: '.cjs.js',
|
|
136
132
|
outputFileExtensionForEsm: '.esm.js',
|
|
137
|
-
developmentConditionName: (0,
|
|
133
|
+
developmentConditionName: (0, internal_2.getDefinedCustomConditionName)(tree),
|
|
138
134
|
});
|
|
139
135
|
// rollup has a specific declaration file generation not handled by the util above,
|
|
140
136
|
// adjust accordingly
|
|
@@ -146,7 +142,7 @@ function updatePackageJson(tree, options, outputConfig, isTsSolutionSetup) {
|
|
|
146
142
|
}
|
|
147
143
|
function addBuildTarget(tree, options, isTsSolutionSetup) {
|
|
148
144
|
(0, internal_1.addBuildTargetDefaults)(tree, '@nx/rollup:rollup', options.buildTarget, [
|
|
149
|
-
|
|
145
|
+
internal_2.TS_SOLUTION_SETUP_TSCONFIG_INPUT,
|
|
150
146
|
]);
|
|
151
147
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
152
148
|
const prevBuildOptions = project.targets?.[options.buildTarget]?.options;
|
|
@@ -209,7 +205,7 @@ function updateTsConfig(tree, options) {
|
|
|
209
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.`);
|
|
210
206
|
}
|
|
211
207
|
if (!ts) {
|
|
212
|
-
ts = (0,
|
|
208
|
+
ts = (0, internal_2.ensureTypescript)();
|
|
213
209
|
}
|
|
214
210
|
const parsedTsConfig = (0, js_1.readTsConfig)(tsconfigPath, {
|
|
215
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"}
|
|
@@ -18,9 +18,13 @@ async function convertToInferred(tree, options) {
|
|
|
18
18
|
return;
|
|
19
19
|
// Since targetDefaults for '@nx/rollup:rollup' will no longer apply, we want to copy them to the target options.
|
|
20
20
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
21
|
-
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);
|
|
22
25
|
if (defaults) {
|
|
23
|
-
|
|
26
|
+
const { target: _t, executor: _e, projects: _p, plugin: _pl, ...rest } = defaults;
|
|
27
|
+
for (const [key, value] of Object.entries(rest)) {
|
|
24
28
|
target[key] ??= value;
|
|
25
29
|
}
|
|
26
30
|
}
|
|
@@ -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":"AAQA,OAAO,EACL,KAAK,kBAAkB,EAGvB,aAAa,EAKd,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/rollup/src/plugins/plugin.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,kBAAkB,EAGvB,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,CAmC1D,CAAC;AAEF,eAAO,MAAM,aAAa,oCAAc,CAAC"}
|
package/src/plugins/plugin.js
CHANGED
|
@@ -8,8 +8,7 @@ const fs_1 = require("fs");
|
|
|
8
8
|
const devkit_1 = require("@nx/devkit");
|
|
9
9
|
const js_1 = require("@nx/js");
|
|
10
10
|
const file_hasher_1 = require("nx/src/hasher/file-hasher");
|
|
11
|
-
const
|
|
12
|
-
const util_1 = require("@nx/js/src/plugins/typescript/util");
|
|
11
|
+
const internal_2 = require("@nx/js/internal");
|
|
13
12
|
/**
|
|
14
13
|
* @deprecated The 'createDependencies' function is now a no-op. This functionality is included in 'createNodesV2'.
|
|
15
14
|
*/
|
|
@@ -25,7 +24,7 @@ exports.createNodes = [
|
|
|
25
24
|
const optionsHash = (0, file_hasher_1.hashObject)(normalizedOptions);
|
|
26
25
|
const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `rollup-${optionsHash}.hash`);
|
|
27
26
|
const targetsCache = new internal_1.PluginCache(cachePath);
|
|
28
|
-
const isTsSolutionSetup = (0,
|
|
27
|
+
const isTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)();
|
|
29
28
|
const packageManager = (0, devkit_1.detectPackageManager)(context.workspaceRoot);
|
|
30
29
|
const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
|
31
30
|
const lockFileName = (0, js_1.getLockFileName)(packageManager);
|
|
@@ -96,7 +95,7 @@ async function buildRollupTarget(configFilePath, projectRoot, options, context,
|
|
|
96
95
|
? ['production', '^production']
|
|
97
96
|
: ['default', '^default']),
|
|
98
97
|
{ externalDependencies: ['rollup'] },
|
|
99
|
-
|
|
98
|
+
internal_2.TS_SOLUTION_SETUP_TSCONFIG_INPUT,
|
|
100
99
|
],
|
|
101
100
|
outputs,
|
|
102
101
|
metadata: {
|
|
@@ -118,7 +117,7 @@ async function buildRollupTarget(configFilePath, projectRoot, options, context,
|
|
|
118
117
|
'@nx/js:typescript-sync',
|
|
119
118
|
];
|
|
120
119
|
}
|
|
121
|
-
(0,
|
|
120
|
+
(0, internal_2.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
|
|
122
121
|
return targets;
|
|
123
122
|
}
|
|
124
123
|
function getOutputs(rollupConfigs, projectRoot) {
|
|
@@ -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 {
|
|
@@ -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
|
+
}
|
|
@@ -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.`);
|
|
@@ -252,10 +251,10 @@ function createInput(options) {
|
|
|
252
251
|
return input;
|
|
253
252
|
}
|
|
254
253
|
function createTsCompilerOptions(projectRoot, config, tsConfigPath, options, dependencies) {
|
|
255
|
-
const compilerOptionPaths = (0,
|
|
254
|
+
const compilerOptionPaths = (0, internal_1.computeCompilerOptionsPaths)(config, dependencies ?? []);
|
|
256
255
|
// Resolve paths to absolute so they work without baseUrl and regardless
|
|
257
256
|
// of which tsconfig the plugin reads (project vs workspace root).
|
|
258
|
-
const pathsBase = (0,
|
|
257
|
+
const pathsBase = (0, js_1.resolvePathsBaseUrl)(tsConfigPath);
|
|
259
258
|
for (const key of Object.keys(compilerOptionPaths)) {
|
|
260
259
|
compilerOptionPaths[key] = compilerOptionPaths[key].map((p) => {
|
|
261
260
|
if ((0, path_1.isAbsolute)(p)) {
|
|
@@ -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
|
}
|