@nx/rollup 23.0.0-beta.18 → 23.0.0-beta.19

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.18",
3
+ "version": "23.0.0-beta.19",
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.18",
34
- "@nx/js": "23.0.0-beta.18",
33
+ "@nx/devkit": "23.0.0-beta.19",
34
+ "@nx/js": "23.0.0-beta.19",
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.18",
52
+ "nx": "23.0.0-beta.19",
53
53
  "source-map-js": "^1.2.0"
54
54
  },
55
55
  "publishConfig": {
@@ -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;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"}
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"}
@@ -29,7 +29,27 @@ exports.createNodes = [
29
29
  const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
30
30
  const lockFileName = (0, js_1.getLockFileName)(packageManager);
31
31
  try {
32
- return await (0, devkit_1.createNodesFromFiles)((configFile, _, context) => createNodesInternal(configFile, normalizedOptions, context, targetsCache, isTsSolutionSetup, pmc, lockFileName), configFilePaths, normalizedOptions, context);
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;
33
53
  }
34
54
  finally {
35
55
  targetsCache.writeToDisk();
@@ -37,16 +57,8 @@ exports.createNodes = [
37
57
  },
38
58
  ];
39
59
  exports.createNodesV2 = exports.createNodes;
40
- async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup, pmc, lockFileName) {
60
+ async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup, pmc, hash) {
41
61
  const projectRoot = (0, path_1.dirname)(configFilePath);
42
- const fullyQualifiedProjectRoot = (0, path_1.join)(context.workspaceRoot, projectRoot);
43
- // Do not create a project if package.json and project.json do not exist
44
- const siblingFiles = (0, fs_1.readdirSync)(fullyQualifiedProjectRoot);
45
- if (!siblingFiles.includes('package.json') &&
46
- !siblingFiles.includes('project.json')) {
47
- return {};
48
- }
49
- const hash = await (0, internal_1.calculateHashForCreateNodes)(projectRoot, options, context, [lockFileName]);
50
62
  if (!targetsCache.has(hash)) {
51
63
  targetsCache.set(hash, await buildRollupTarget(configFilePath, projectRoot, options, context, isTsSolutionSetup, pmc));
52
64
  }
@@ -146,6 +158,28 @@ function getOutputs(rollupConfigs, projectRoot) {
146
158
  }
147
159
  return Array.from(outputs);
148
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
+ }
149
183
  function normalizeOptions(options) {
150
184
  return {
151
185
  buildTargetName: options.buildTargetName ?? 'build',