nx 19.6.2 → 19.6.4

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/.eslintrc.json CHANGED
@@ -100,7 +100,18 @@
100
100
  "events", // This is coming from @storybook/builder-manager since it uses the browser polyfill
101
101
  "process", // This is coming from @storybook/builder-manager since it uses the browser polyfill
102
102
  "prettier", // This is coming from @storybook/builder-manager since it uses the browser polyfill
103
- "util" // This is coming from @storybook/builder-manager since it uses the browser polyfill
103
+ "util", // This is coming from @storybook/builder-manager since it uses the browser polyfill
104
+ // The native modules are optional and only one of them will ever be installed on a given machine
105
+ "@nx/nx-darwin-x64",
106
+ "@nx/nx-darwin-arm64",
107
+ "@nx/nx-linux-x64-gnu",
108
+ "@nx/nx-linux-x64-musl",
109
+ "@nx/nx-win32-x64-msvc",
110
+ "@nx/nx-linux-arm64-gnu",
111
+ "@nx/nx-linux-arm64-musl",
112
+ "@nx/nx-linux-arm-gnueabihf",
113
+ "@nx/nx-win32-arm64-msvc",
114
+ "@nx/nx-freebsd-x64"
104
115
  ]
105
116
  }
106
117
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "19.6.2",
3
+ "version": "19.6.4",
4
4
  "private": false,
5
5
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
6
6
  "repository": {
@@ -71,7 +71,7 @@
71
71
  "yargs-parser": "21.1.1",
72
72
  "node-machine-id": "1.1.12",
73
73
  "ora": "5.3.0",
74
- "@nrwl/tao": "19.6.2"
74
+ "@nrwl/tao": "19.6.4"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "@swc-node/register": "^1.8.0",
@@ -86,16 +86,16 @@
86
86
  }
87
87
  },
88
88
  "optionalDependencies": {
89
- "@nx/nx-darwin-x64": "19.6.2",
90
- "@nx/nx-darwin-arm64": "19.6.2",
91
- "@nx/nx-linux-x64-gnu": "19.6.2",
92
- "@nx/nx-linux-x64-musl": "19.6.2",
93
- "@nx/nx-win32-x64-msvc": "19.6.2",
94
- "@nx/nx-linux-arm64-gnu": "19.6.2",
95
- "@nx/nx-linux-arm64-musl": "19.6.2",
96
- "@nx/nx-linux-arm-gnueabihf": "19.6.2",
97
- "@nx/nx-win32-arm64-msvc": "19.6.2",
98
- "@nx/nx-freebsd-x64": "19.6.2"
89
+ "@nx/nx-darwin-x64": "19.6.4",
90
+ "@nx/nx-darwin-arm64": "19.6.4",
91
+ "@nx/nx-linux-x64-gnu": "19.6.4",
92
+ "@nx/nx-linux-x64-musl": "19.6.4",
93
+ "@nx/nx-win32-x64-msvc": "19.6.4",
94
+ "@nx/nx-linux-arm64-gnu": "19.6.4",
95
+ "@nx/nx-linux-arm64-musl": "19.6.4",
96
+ "@nx/nx-linux-arm-gnueabihf": "19.6.4",
97
+ "@nx/nx-win32-arm64-msvc": "19.6.4",
98
+ "@nx/nx-freebsd-x64": "19.6.4"
99
99
  },
100
100
  "nx-migrations": {
101
101
  "migrations": "./migrations.json",
@@ -1,4 +1,4 @@
1
- import { ProjectFileMap, ProjectGraphDependency, ProjectGraphProjectNode } from '../../config/project-graph';
1
+ import { ProjectFileMap, ProjectGraph, ProjectGraphDependency, ProjectGraphProjectNode } from '../../config/project-graph';
2
2
  import { TaskGraph } from '../../config/task-graph';
3
3
  export interface GraphError {
4
4
  message: string;
@@ -48,3 +48,20 @@ export declare function generateGraph(args: {
48
48
  exclude?: string[];
49
49
  affected?: boolean;
50
50
  }, affectedProjects: string[]): Promise<void>;
51
+ /**
52
+ * The data type that `nx graph --file graph.json` or `nx build --graph graph.json` contains
53
+ */
54
+ export interface GraphJson {
55
+ /**
56
+ * A graph of tasks populated with `nx build --graph`
57
+ */
58
+ tasks?: TaskGraph;
59
+ /**
60
+ * The plans for hashing a task in the task graph
61
+ */
62
+ taskPlans?: Record<string, string[]>;
63
+ /**
64
+ * The project graph
65
+ */
66
+ graph: ProjectGraph;
67
+ }
@@ -675,8 +675,10 @@ function expandInputs(inputs, project, allWorkspaceFiles, depGraphClientResponse
675
675
  const externalInputs = [];
676
676
  const otherInputs = [];
677
677
  inputs.forEach((input) => {
678
- if (input.startsWith('{workspaceRoot}')) {
679
- workspaceRootInputs.push(input);
678
+ // grouped workspace inputs look like workspace:[pattern,otherPattern]
679
+ if (input.startsWith('workspace:[')) {
680
+ const inputs = input.substring(11, input.length - 1).split(',');
681
+ workspaceRootInputs.push(...inputs);
680
682
  return;
681
683
  }
682
684
  const maybeProjectName = input.split(':')[0];
@@ -696,22 +698,7 @@ function expandInputs(inputs, project, allWorkspaceFiles, depGraphClientResponse
696
698
  return;
697
699
  }
698
700
  });
699
- const workspaceRootsExpanded = workspaceRootInputs.flatMap((input) => {
700
- const matches = [];
701
- const withoutWorkspaceRoot = input.substring(16);
702
- const matchingFile = allWorkspaceFiles.find((t) => t.file === withoutWorkspaceRoot);
703
- if (matchingFile) {
704
- matches.push(matchingFile.file);
705
- }
706
- else {
707
- allWorkspaceFiles
708
- .filter((f) => (0, minimatch_1.minimatch)(f.file, withoutWorkspaceRoot))
709
- .forEach((f) => {
710
- matches.push(f.file);
711
- });
712
- }
713
- return matches;
714
- });
701
+ const workspaceRootsExpanded = getExpandedWorkspaceRoots(workspaceRootInputs, allWorkspaceFiles);
715
702
  const otherInputsExpanded = otherInputs.map((input) => {
716
703
  if (input === 'TsConfig') {
717
704
  return (0, path_1.relative)(workspace_root_1.workspaceRoot, (0, typescript_1.getRootTsConfigPath)());
@@ -744,6 +731,36 @@ function expandInputs(inputs, project, allWorkspaceFiles, depGraphClientResponse
744
731
  external: externalInputs,
745
732
  };
746
733
  }
734
+ function getExpandedWorkspaceRoots(workspaceRootInputs, allWorkspaceFiles) {
735
+ const workspaceRootsExpanded = [];
736
+ const negativeWRPatterns = [];
737
+ const positiveWRPatterns = [];
738
+ for (const fileset of workspaceRootInputs) {
739
+ if (fileset.startsWith('!')) {
740
+ negativeWRPatterns.push(fileset.substring(17));
741
+ }
742
+ else {
743
+ positiveWRPatterns.push(fileset.substring(16));
744
+ }
745
+ }
746
+ for (const pattern of positiveWRPatterns) {
747
+ const matchingFile = allWorkspaceFiles.find((t) => t.file === pattern);
748
+ if (matchingFile &&
749
+ !negativeWRPatterns.some((p) => (0, minimatch_1.minimatch)(matchingFile.file, p))) {
750
+ workspaceRootsExpanded.push(matchingFile.file);
751
+ }
752
+ else {
753
+ allWorkspaceFiles
754
+ .filter((f) => (0, minimatch_1.minimatch)(f.file, pattern) &&
755
+ !negativeWRPatterns.some((p) => (0, minimatch_1.minimatch)(f.file, p)))
756
+ .forEach((f) => {
757
+ workspaceRootsExpanded.push(f.file);
758
+ });
759
+ }
760
+ }
761
+ workspaceRootsExpanded.sort();
762
+ return workspaceRootsExpanded;
763
+ }
747
764
  async function createJsonOutput(prunedGraph, rawGraph, projects, targets) {
748
765
  const response = {
749
766
  graph: prunedGraph,
@@ -1079,55 +1079,24 @@ function getImplementationPath(collection, collectionPath, name) {
1079
1079
  }
1080
1080
  return { path: implPath, fnSymbol };
1081
1081
  }
1082
- // TODO (v17): This should just become something like:
1083
- // ```
1084
- // return !collection.generators[name] && collection.schematics[name]
1085
- // ```
1082
+ // TODO (v21): Remove CLI determination of Angular Migration
1086
1083
  function isAngularMigration(collection, collectionPath, name) {
1087
1084
  const entry = collection.generators?.[name] || collection.schematics?.[name];
1088
- // In the future we will determine this based on the location of the entry in the collection.
1089
- // If the entry is under `schematics`, it will be assumed to be an angular cli migration.
1090
- // If the entry is under `generators`, it will be assumed to be an nx migration.
1091
- // For now, we will continue to obey the cli property, if it exists.
1092
- // If it doesn't exist, we will check if the implementation references @angular/devkit.
1093
1085
  const shouldBeNx = !!collection.generators?.[name];
1094
1086
  const shouldBeNg = !!collection.schematics?.[name];
1095
- let useAngularDevkitToRunMigration = false;
1096
- const { path: implementationPath } = getImplementationPath(collection, collectionPath, name);
1097
- const implStringContents = (0, fs_1.readFileSync)(implementationPath, 'utf-8');
1098
- // TODO (v17): Remove this check and the cli property access - it is only here for backwards compatibility.
1099
- if (['@angular/material', '@angular/cdk'].includes(collection.name) ||
1100
- [
1101
- "import('@angular-devkit",
1102
- 'import("@angular-devkit',
1103
- "require('@angular-devkit",
1104
- 'require("@angular-devkit',
1105
- "from '@angular-devkit",
1106
- 'from "@angular-devkit',
1107
- ].some((s) => implStringContents.includes(s))) {
1108
- useAngularDevkitToRunMigration = true;
1109
- }
1110
- if (useAngularDevkitToRunMigration && shouldBeNx) {
1087
+ if (entry.cli && entry.cli !== 'nx' && collection.generators?.[name]) {
1111
1088
  output_1.output.warn({
1112
1089
  title: `The migration '${collection.name}:${name}' appears to be an Angular CLI migration, but is located in the 'generators' section of migrations.json.`,
1113
1090
  bodyLines: [
1114
- 'In Nx 17, migrations inside `generators` will be treated as Angular Devkit migrations.',
1115
- "Please open an issue on the plugin's repository if you believe this is an error.",
1116
- ],
1117
- });
1118
- }
1119
- if (!useAngularDevkitToRunMigration && entry.cli === 'nx' && shouldBeNg) {
1120
- output_1.output.warn({
1121
- title: `The migration '${collection.name}:${name}' appears to be an Nx migration, but is located in the 'schematics' section of migrations.json.`,
1122
- bodyLines: [
1123
- 'In Nx 17, migrations inside `generators` will be treated as nx devkit migrations.',
1091
+ 'In Nx 21, migrations inside `generators` will be treated as Nx Devkit migrations and therefore may not run correctly if they are using Angular Devkit.',
1092
+ 'If the migration should be run with Angular Devkit, please place the migration inside `schematics` instead.',
1124
1093
  "Please open an issue on the plugin's repository if you believe this is an error.",
1125
1094
  ],
1126
1095
  });
1127
1096
  }
1128
1097
  // Currently, if the cli property exists we listen to it. If its nx, its not an ng cli migration.
1129
1098
  // If the property is not set, we will fall back to our intuition.
1130
- return entry.cli ? entry.cli !== 'nx' : useAngularDevkitToRunMigration;
1099
+ return entry.cli ? entry.cli !== 'nx' : !shouldBeNx && shouldBeNg;
1131
1100
  }
1132
1101
  const getNgCompatLayer = (() => {
1133
1102
  let _ngCliAdapter;
@@ -10,19 +10,21 @@ export declare class ReleaseClient {
10
10
  release: (args: import("./command-object").ReleaseOptions) => Promise<import("./version").NxReleaseVersionResult | number>;
11
11
  constructor(overrideReleaseConfig: NxReleaseConfiguration);
12
12
  }
13
+ declare const defaultClient: ReleaseClient;
13
14
  /**
14
15
  * @public
15
16
  */
16
- export declare const releaseChangelog: any;
17
+ export declare const releaseChangelog: typeof defaultClient.releaseChangelog;
17
18
  /**
18
19
  * @public
19
20
  */
20
- export declare const releasePublish: any;
21
+ export declare const releasePublish: typeof defaultClient.releasePublish;
21
22
  /**
22
23
  * @public
23
24
  */
24
- export declare const releaseVersion: any;
25
+ export declare const releaseVersion: typeof defaultClient.releaseVersion;
25
26
  /**
26
27
  * @public
27
28
  */
28
- export declare const release: any;
29
+ export declare const release: typeof defaultClient.release;
30
+ export {};
@@ -1,7 +1,8 @@
1
- import { Argv } from 'yargs';
1
+ import { Argv, ParserConfigurationOptions } from 'yargs';
2
2
  interface ExcludeOptions {
3
3
  exclude: string[];
4
4
  }
5
+ export declare const defaultYargsParserConfiguration: Partial<ParserConfigurationOptions>;
5
6
  export declare function withExcludeOption(yargs: Argv): Argv<ExcludeOptions>;
6
7
  export interface RunOptions {
7
8
  exclude: string;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultYargsParserConfiguration = void 0;
3
4
  exports.withExcludeOption = withExcludeOption;
4
5
  exports.withRunOptions = withRunOptions;
5
6
  exports.withTargetAndConfigurationOption = withTargetAndConfigurationOption;
@@ -12,6 +13,13 @@ exports.withOverrides = withOverrides;
12
13
  exports.withOutputStyleOption = withOutputStyleOption;
13
14
  exports.withRunOneOptions = withRunOneOptions;
14
15
  exports.parseCSV = parseCSV;
16
+ exports.defaultYargsParserConfiguration = {
17
+ 'strip-dashed': true,
18
+ 'unknown-options-as-args': true,
19
+ 'populate--': true,
20
+ 'parse-numbers': false,
21
+ 'parse-positional-numbers': false,
22
+ };
15
23
  function withExcludeOption(yargs) {
16
24
  return yargs.option('exclude', {
17
25
  describe: 'Exclude certain projects from being processed',
@@ -128,11 +136,7 @@ function withBatch(yargs) {
128
136
  }
129
137
  function withAffectedOptions(yargs) {
130
138
  return withExcludeOption(yargs)
131
- .parserConfiguration({
132
- 'strip-dashed': true,
133
- 'unknown-options-as-args': true,
134
- 'populate--': true,
135
- })
139
+ .parserConfiguration(exports.defaultYargsParserConfiguration)
136
140
  .option('files', {
137
141
  describe: 'Change the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces',
138
142
  type: 'string',
@@ -169,11 +173,7 @@ function withAffectedOptions(yargs) {
169
173
  }
170
174
  function withRunManyOptions(yargs) {
171
175
  return withRunOptions(yargs)
172
- .parserConfiguration({
173
- 'strip-dashed': true,
174
- 'unknown-options-as-args': true,
175
- 'populate--': true,
176
- })
176
+ .parserConfiguration(exports.defaultYargsParserConfiguration)
177
177
  .option('projects', {
178
178
  type: 'string',
179
179
  alias: 'p',
@@ -225,11 +225,7 @@ function withOutputStyleOption(yargs, choices = [
225
225
  function withRunOneOptions(yargs) {
226
226
  const executorShouldShowHelp = !(process.argv[2] === 'run' && process.argv[3] === '--help');
227
227
  const res = withRunOptions(withOutputStyleOption(withConfiguration(yargs), allOutputStyles))
228
- .parserConfiguration({
229
- 'strip-dashed': true,
230
- 'unknown-options-as-args': true,
231
- 'populate--': true,
232
- })
228
+ .parserConfiguration(exports.defaultYargsParserConfiguration)
233
229
  .option('project', {
234
230
  describe: 'Target project',
235
231
  type: 'string',