nx 18.2.0-beta.0 → 18.2.0-beta.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.
@@ -1 +1 @@
1
- (()=>{"use strict";var e,r={},t={};function o(e){var n=t[e];if(void 0!==n)return n.exports;var i=t[e]={id:e,loaded:!1,exports:{}};return r[e].call(i.exports,i,i.exports,o),i.loaded=!0,i.exports}o.m=r,e=[],o.O=(r,t,n,i)=>{if(!t){var l=1/0;for(f=0;f<e.length;f++){for(var[t,n,i]=e[f],a=!0,u=0;u<t.length;u++)(!1&i||l>=i)&&Object.keys(o.O).every((e=>o.O[e](t[u])))?t.splice(u--,1):(a=!1,i<l&&(l=i));if(a){e.splice(f--,1);var d=n();void 0!==d&&(r=d)}}return r}i=i||0;for(var f=e.length;f>0&&e[f-1][2]>i;f--)e[f]=e[f-1];e[f]=[t,n,i]},o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e={2:0};o.O.j=r=>0===e[r];var r=(r,t)=>{var n,i,[l,a,u]=t,d=0;if(l.some((r=>0!==e[r]))){for(n in a)o.o(a,n)&&(o.m[n]=a[n]);if(u)var f=u(o)}for(r&&r(t);d<l.length;d++)i=l[d],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return o.O(f)},t=self.webpackChunk=self.webpackChunk||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})()})();
1
+ (()=>{"use strict";var e,r={},t={};function o(e){var n=t[e];if(void 0!==n)return n.exports;var i=t[e]={id:e,loaded:!1,exports:{}};return r[e].call(i.exports,i,i.exports,o),i.loaded=!0,i.exports}o.m=r,e=[],o.O=(r,t,n,i)=>{if(!t){var l=1/0;for(f=0;f<e.length;f++){for(var[t,n,i]=e[f],a=!0,u=0;u<t.length;u++)(!1&i||l>=i)&&Object.keys(o.O).every((e=>o.O[e](t[u])))?t.splice(u--,1):(a=!1,i<l&&(l=i));if(a){e.splice(f--,1);var d=n();void 0!==d&&(r=d)}}return r}i=i||0;for(var f=e.length;f>0&&e[f-1][2]>i;f--)e[f]=e[f-1];e[f]=[t,n,i]},o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e={666:0};o.O.j=r=>0===e[r];var r=(r,t)=>{var n,i,[l,a,u]=t,d=0;if(l.some((r=>0!==e[r]))){for(n in a)o.o(a,n)&&(o.m[n]=a[n]);if(u)var f=u(o)}for(r&&r(t);d<l.length;d++)i=l[d],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return o.O(f)},t=self.webpackChunk=self.webpackChunk||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})()})();
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3],{22232:(s,e,k)=>{k.r(e)}},s=>{var e;e=22232,s(s.s=e)}]);
1
+ "use strict";(self.webpackChunk=self.webpackChunk||[]).push([[532],{22232:()=>{}},s=>{var e;e=22232,s(s.s=e)}]);
@@ -220,14 +220,31 @@ plugins) {
220
220
  const results = [];
221
221
  const errors = [];
222
222
  // We iterate over plugins first - this ensures that plugins specified first take precedence.
223
- for (const { plugin, options } of plugins) {
223
+ for (const { plugin, options, include, exclude } of plugins) {
224
224
  const [pattern, createNodes] = plugin.createNodes ?? [];
225
225
  const pluginResults = [];
226
226
  perf_hooks_1.performance.mark(`${plugin.name}:createNodes - start`);
227
227
  if (!pattern) {
228
228
  continue;
229
229
  }
230
- const matchingConfigFiles = workspaceFiles.filter(minimatch_1.minimatch.filter(pattern, { dot: true }));
230
+ const matchingConfigFiles = [];
231
+ for (const file of workspaceFiles) {
232
+ if ((0, minimatch_1.minimatch)(file, pattern, { dot: true })) {
233
+ if (include) {
234
+ const included = include.some((includedPattern) => (0, minimatch_1.minimatch)(file, includedPattern, { dot: true }));
235
+ if (!included) {
236
+ continue;
237
+ }
238
+ }
239
+ if (exclude) {
240
+ const excluded = include.some((excludedPattern) => (0, minimatch_1.minimatch)(file, excludedPattern, { dot: true }));
241
+ if (excluded) {
242
+ continue;
243
+ }
244
+ }
245
+ matchingConfigFiles.push(file);
246
+ }
247
+ }
231
248
  for (const file of matchingConfigFiles) {
232
249
  perf_hooks_1.performance.mark(`${plugin.name}:createNodes:${file} - start`);
233
250
  try {
@@ -9,12 +9,12 @@ import { LoadedNxPlugin } from '../../utils/nx-plugin';
9
9
  * @param nxJson
10
10
  */
11
11
  export declare function retrieveWorkspaceFiles(workspaceRoot: string, projectRootMap: Record<string, string>): Promise<{
12
- allWorkspaceFiles: import("nx/src/devkit-exports").FileData[];
12
+ allWorkspaceFiles: import("../file-utils").FileData[];
13
13
  fileMap: {
14
14
  projectFileMap: ProjectFiles;
15
- nonProjectFiles: import("nx/src/native").FileData[];
15
+ nonProjectFiles: import("../../native").FileData[];
16
16
  };
17
- rustReferences: import("nx/src/native").NxWorkspaceFilesExternals;
17
+ rustReferences: import("../../native").NxWorkspaceFilesExternals;
18
18
  }>;
19
19
  /**
20
20
  * Walk through the workspace and return `ProjectConfigurations`. Only use this if the projectFileMap is not needed.
@@ -215,18 +215,21 @@ class Cache {
215
215
  }
216
216
  tryAndRetry(fn) {
217
217
  let attempts = 0;
218
- const baseTimeout = 100;
218
+ const baseTimeout = 5;
219
+ // Generate a random number between 2 and 4 to raise to the power of attempts
220
+ const baseExponent = Math.random() * 2 + 2;
219
221
  const _try = async () => {
220
222
  try {
221
223
  attempts++;
222
224
  return await fn();
223
225
  }
224
226
  catch (e) {
225
- if (attempts === 10) {
227
+ // Max time is 5 * 4^3 = 20480ms
228
+ if (attempts === 6) {
226
229
  // After enough attempts, throw the error
227
230
  throw e;
228
231
  }
229
- await new Promise((res) => setTimeout(res, baseTimeout * attempts));
232
+ await new Promise((res) => setTimeout(res, baseExponent ** attempts));
230
233
  return await _try();
231
234
  }
232
235
  };
@@ -91,6 +91,8 @@ export type NxPlugin = NxPluginV1 | NxPluginV2;
91
91
  export type LoadedNxPlugin = {
92
92
  plugin: NxPluginV2 & Pick<NxPluginV1, 'processProjectGraph'>;
93
93
  options?: unknown;
94
+ include?: string[];
95
+ exclude?: string[];
94
96
  };
95
97
  export declare const nxPluginCache: Map<string, LoadedNxPlugin['plugin']>;
96
98
  export declare function getPluginPathAndName(moduleName: string, paths: string[], projects: Record<string, ProjectConfiguration>, root: string): {
@@ -71,8 +71,19 @@ async function loadNxPluginAsync(pluginConfiguration, paths, projects, root) {
71
71
  ? pluginConfiguration
72
72
  : { plugin: pluginConfiguration, options: undefined };
73
73
  let pluginModule = exports.nxPluginCache.get(moduleName);
74
+ const include = typeof pluginConfiguration === 'object'
75
+ ? pluginConfiguration.include
76
+ : undefined;
77
+ const exclude = typeof pluginConfiguration === 'object'
78
+ ? pluginConfiguration.exclude
79
+ : undefined;
74
80
  if (pluginModule) {
75
- return { plugin: pluginModule, options };
81
+ return {
82
+ plugin: pluginModule,
83
+ options,
84
+ include,
85
+ exclude,
86
+ };
76
87
  }
77
88
  performance.mark(`Load Nx Plugin: ${moduleName} - start`);
78
89
  let { pluginPath, name } = await getPluginPathAndName(moduleName, paths, projects, root);
@@ -81,7 +92,12 @@ async function loadNxPluginAsync(pluginConfiguration, paths, projects, root) {
81
92
  exports.nxPluginCache.set(moduleName, plugin);
82
93
  performance.mark(`Load Nx Plugin: ${moduleName} - end`);
83
94
  performance.measure(`Load Nx Plugin: ${moduleName}`, `Load Nx Plugin: ${moduleName} - start`, `Load Nx Plugin: ${moduleName} - end`);
84
- return { plugin, options };
95
+ return {
96
+ plugin,
97
+ options,
98
+ include,
99
+ exclude,
100
+ };
85
101
  }
86
102
  exports.loadNxPluginAsync = loadNxPluginAsync;
87
103
  async function loadNxPlugins(plugins, paths = (0, installation_directory_1.getNxRequirePaths)(), root = workspace_root_1.workspaceRoot, projects) {