nx 16.7.2 → 16.7.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/bin/nx.js CHANGED
@@ -85,7 +85,7 @@ function main() {
85
85
  * - .env.local
86
86
  */
87
87
  function loadDotEnvFiles() {
88
- for (const file of ['.env', '.local.env', '.env.local']) {
88
+ for (const file of ['.local.env', '.env.local', '.env']) {
89
89
  (0, dotenv_1.config)({
90
90
  path: file,
91
91
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "16.7.2",
3
+ "version": "16.7.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": {
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "homepage": "https://nx.dev",
34
34
  "dependencies": {
35
- "@nrwl/tao": "16.7.2",
35
+ "@nrwl/tao": "16.7.4",
36
36
  "@parcel/watcher": "2.0.4",
37
37
  "@yarnpkg/lockfile": "^1.1.0",
38
38
  "@yarnpkg/parsers": "3.0.0-rc.46",
@@ -81,16 +81,16 @@
81
81
  }
82
82
  },
83
83
  "optionalDependencies": {
84
- "@nx/nx-darwin-arm64": "16.7.2",
85
- "@nx/nx-darwin-x64": "16.7.2",
86
- "@nx/nx-freebsd-x64": "16.7.2",
87
- "@nx/nx-linux-arm-gnueabihf": "16.7.2",
88
- "@nx/nx-linux-arm64-gnu": "16.7.2",
89
- "@nx/nx-linux-arm64-musl": "16.7.2",
90
- "@nx/nx-linux-x64-gnu": "16.7.2",
91
- "@nx/nx-linux-x64-musl": "16.7.2",
92
- "@nx/nx-win32-arm64-msvc": "16.7.2",
93
- "@nx/nx-win32-x64-msvc": "16.7.2"
84
+ "@nx/nx-darwin-arm64": "16.7.4",
85
+ "@nx/nx-darwin-x64": "16.7.4",
86
+ "@nx/nx-freebsd-x64": "16.7.4",
87
+ "@nx/nx-linux-arm-gnueabihf": "16.7.4",
88
+ "@nx/nx-linux-arm64-gnu": "16.7.4",
89
+ "@nx/nx-linux-arm64-musl": "16.7.4",
90
+ "@nx/nx-linux-x64-gnu": "16.7.4",
91
+ "@nx/nx-linux-x64-musl": "16.7.4",
92
+ "@nx/nx-win32-arm64-msvc": "16.7.4",
93
+ "@nx/nx-win32-x64-msvc": "16.7.4"
94
94
  },
95
95
  "nx-migrations": {
96
96
  "migrations": "./migrations.json",
@@ -177,5 +177,5 @@
177
177
  },
178
178
  "main": "./bin/nx.js",
179
179
  "type": "commonjs",
180
- "gitHead": "b024f44a1ad4e1773e80f6dc72f9d22766b950f9"
180
+ "gitHead": "5d73f6e0f2c6d4dfb2e9d45519d591c338bb5c37"
181
181
  }
@@ -5,17 +5,19 @@ const tslib_1 = require("tslib");
5
5
  const child_process_1 = require("child_process");
6
6
  const path = require("path");
7
7
  const command_line_utils_1 = require("../../utils/command-line-utils");
8
+ const ignore_1 = require("../../utils/ignore");
8
9
  const fileutils_1 = require("../../utils/fileutils");
9
10
  const file_utils_1 = require("../../project-graph/file-utils");
10
11
  const prettier = require("prettier");
11
12
  const object_sort_1 = require("../../utils/object-sort");
13
+ const package_json_1 = require("../../utils/package-json");
12
14
  const typescript_1 = require("../../plugins/js/utils/typescript");
13
15
  const project_graph_1 = require("../../project-graph/project-graph");
14
16
  const affected_project_graph_1 = require("../../project-graph/affected/affected-project-graph");
15
17
  const configuration_1 = require("../../config/configuration");
16
18
  const chunkify_1 = require("../../utils/chunkify");
17
19
  const all_file_data_1 = require("../../utils/all-file-data");
18
- const PRETTIER_PATH = require.resolve('prettier/bin-prettier');
20
+ const PRETTIER_PATH = getPrettierPath();
19
21
  function format(command, args) {
20
22
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
21
23
  const { nxArgs } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', { printWarnings: false }, (0, configuration_1.readNxJson)());
@@ -62,9 +64,11 @@ function getPatterns(args) {
62
64
  // which allows it to be considered for calculating "patterns"
63
65
  .concat('.swcrc');
64
66
  const patterns = p.files.filter((f) => (0, fileutils_1.fileExists)(f) && supportedExtensions.includes(path.extname(f)));
67
+ // exclude patterns in .nxignore or .gitignore
68
+ const nonIgnoredPatterns = (0, ignore_1.getIgnoreObject)().filter(patterns);
65
69
  return args.libsAndApps
66
- ? yield getPatternsFromApps(patterns, yield (0, all_file_data_1.allFileData)(), graph)
67
- : patterns;
70
+ ? yield getPatternsFromApps(nonIgnoredPatterns, yield (0, all_file_data_1.allFileData)(), graph)
71
+ : nonIgnoredPatterns;
68
72
  }
69
73
  catch (_a) {
70
74
  return allFilesPattern;
@@ -143,3 +147,7 @@ function sortTsConfig() {
143
147
  // catch noop
144
148
  }
145
149
  }
150
+ function getPrettierPath() {
151
+ const { bin } = (0, package_json_1.readModulePackageJson)('prettier').packageJson;
152
+ return require.resolve(path.join('prettier', bin));
153
+ }
@@ -34,7 +34,9 @@ function formatChangedFilesWithPrettierIfAvailable(tree) {
34
34
  if (support.ignored || !support.inferredParser) {
35
35
  return;
36
36
  }
37
- tree.write(file.path, prettier.format(file.content.toString('utf-8'), options));
37
+ tree.write(file.path,
38
+ // In prettier v3 the format result is a promise
39
+ yield prettier.format(file.content.toString('utf-8'), options));
38
40
  }
39
41
  catch (e) {
40
42
  console.warn(`Could not format ${file.path}. Error: "${e.message}"`);
@@ -167,7 +167,7 @@ function findCreatedProjectFiles(tree, globPatterns) {
167
167
  for (const change of tree.listChanges()) {
168
168
  if (change.type === 'CREATE') {
169
169
  const fileName = (0, path_1.basename)(change.path);
170
- if (globPatterns.some((pattern) => minimatch(change.path, pattern))) {
170
+ if (globPatterns.some((pattern) => minimatch(change.path, pattern, { dot: true }))) {
171
171
  createdProjectFiles.push(change.path);
172
172
  }
173
173
  else if (fileName === 'package.json') {
@@ -222,7 +222,7 @@ class TaskHasherImpl {
222
222
  const { getFilesForOutputs } = require('../native');
223
223
  const outputFiles = getFilesForOutputs(workspace_root_1.workspaceRoot, outputs);
224
224
  const filteredFiles = outputFiles.filter((p) => p === dependentTasksOutputFiles ||
225
- minimatch(p, dependentTasksOutputFiles));
225
+ minimatch(p, dependentTasksOutputFiles, { dot: true }));
226
226
  const hashDetails = {};
227
227
  const hashes = [];
228
228
  for (const [file, hash] of yield this.fileHasher.hashFiles(filteredFiles.map((p) => (0, path_1.join)(workspace_root_1.workspaceRoot, p)))) {
@@ -9,7 +9,7 @@ const retrieve_workspace_files_1 = require("../../project-graph/utils/retrieve-w
9
9
  function default_1(tree) {
10
10
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
11
  const nxJson = (0, nx_json_1.readNxJson)(tree);
12
- const projectFiles = (0, retrieve_workspace_files_1.retrieveProjectConfigurationPaths)(tree.root, nxJson);
12
+ const projectFiles = yield (0, retrieve_workspace_files_1.retrieveProjectConfigurationPaths)(tree.root, nxJson);
13
13
  const projectJsons = projectFiles.filter((f) => f.endsWith('project.json'));
14
14
  for (let f of projectJsons) {
15
15
  const projectJson = (0, json_1.readJson)(tree, f);
@@ -23,16 +23,12 @@ const processProjectGraph = (graph, context) => tslib_1.__awaiter(void 0, void 0
23
23
  let parsedLockFile;
24
24
  if (lockFileNeedsReprocessing(lockHash)) {
25
25
  parsedLockFile = (0, lock_file_1.parseLockFile)();
26
- if (parsedLockFile) {
27
- writeLastProcessedLockfileHash(lockHash, parsedLockFile);
28
- }
26
+ writeLastProcessedLockfileHash(lockHash, parsedLockFile);
29
27
  }
30
28
  else {
31
29
  parsedLockFile = readParsedLockFile();
32
30
  }
33
- if (parsedLockFile) {
34
- builder.mergeProjectGraph(parsedLockFile);
35
- }
31
+ builder.mergeProjectGraph(parsedLockFile);
36
32
  }
37
33
  }
38
34
  perf_hooks_1.performance.mark('build typescript dependencies - start');
@@ -287,8 +287,7 @@ function mapSnapshots(dependencies, nodes, packageJson, isBerry) {
287
287
  if (isBerry && key.includes('@patch:') && key.includes('#')) {
288
288
  normalizedKey = key
289
289
  .slice(0, key.indexOf('#'))
290
- .replace(`@patch:${packageName}@`, '@npm:')
291
- .replace(/:.*$/u, ':' + snapshotKey.version);
290
+ .replace(`@patch:${packageName}@`, '@npm:');
292
291
  }
293
292
  if (!existingKeys.get(packageName) ||
294
293
  !existingKeys.get(packageName).has(normalizedKey)) {
@@ -366,6 +365,10 @@ function findPatchedKeys(dependencies, node) {
366
365
  if (!keys[0].startsWith(`${node.data.packageName}@patch:`)) {
367
366
  continue;
368
367
  }
368
+ // local patches are currently not supported
369
+ if (keys[0].includes('.yarn/patches')) {
370
+ continue;
371
+ }
369
372
  if (snapshot.version === node.data.version) {
370
373
  return [keys, snapshot];
371
374
  }
@@ -14,7 +14,9 @@ const getTouchedProjectsFromProjectGlobChanges = (touchedFiles, projectGraphNode
14
14
  const globPattern = (0, globs_1.combineGlobPatterns)((0, retrieve_workspace_files_1.configurationGlobs)(workspace_root_1.workspaceRoot, yield (0, nx_plugin_1.loadNxPlugins)(nxJson === null || nxJson === void 0 ? void 0 : nxJson.plugins, (0, installation_directory_1.getNxRequirePaths)(workspace_root_1.workspaceRoot), workspace_root_1.workspaceRoot)));
15
15
  const touchedProjects = new Set();
16
16
  for (const touchedFile of touchedFiles) {
17
- const isProjectFile = minimatch(touchedFile.file, globPattern);
17
+ const isProjectFile = minimatch(touchedFile.file, globPattern, {
18
+ dot: true,
19
+ });
18
20
  if (isProjectFile) {
19
21
  // If the file no longer exists on disk, then it was deleted
20
22
  if (!(0, fs_1.existsSync)((0, path_1.join)(workspace_root_1.workspaceRoot, touchedFile.file))) {
@@ -34,7 +34,7 @@ const getImplicitlyTouchedProjects = (fileChanges, projectGraphNodes, nxJson) =>
34
34
  });
35
35
  const touched = new Set();
36
36
  for (const [pattern, projects] of Object.entries(implicits)) {
37
- const implicitDependencyWasChanged = fileChanges.some((f) => minimatch(f.file, pattern));
37
+ const implicitDependencyWasChanged = fileChanges.some((f) => minimatch(f.file, pattern, { dot: true }));
38
38
  if (!implicitDependencyWasChanged) {
39
39
  continue;
40
40
  }
@@ -61,7 +61,7 @@ plugins, root = workspace_root_1.workspaceRoot) {
61
61
  continue;
62
62
  }
63
63
  for (const file of projectFiles) {
64
- if (minimatch(file, pattern)) {
64
+ if (minimatch(file, pattern, { dot: true })) {
65
65
  const { projects: projectNodes, externalNodes: pluginExternalNodes } = configurationConstructor(file, {
66
66
  nxJsonConfiguration: nxJson,
67
67
  workspaceRoot: root,
@@ -35,7 +35,7 @@ export declare function retrieveProjectConfigurationsSync(workspaceRoot: string,
35
35
  externalNodes: Record<string, ProjectGraphExternalNode>;
36
36
  projectNodes: Record<string, ProjectConfiguration>;
37
37
  };
38
- export declare function retrieveProjectConfigurationPaths(root: string, nxJson: NxJsonConfiguration): string[];
38
+ export declare function retrieveProjectConfigurationPaths(root: string, nxJson: NxJsonConfiguration): Promise<string[]>;
39
39
  export declare function retrieveProjectConfigurationPathsWithoutPluginInference(root: string): string[];
40
40
  export declare function retrieveProjectConfigurationsWithoutPluginInference(root: string): Record<string, ProjectConfiguration>;
41
41
  export declare function configurationGlobs(workspaceRoot: string, plugins: NxPluginV2[]): string[];
@@ -97,9 +97,11 @@ function _retrieveProjectConfigurations(workspaceRoot, nxJson, plugins, globs) {
97
97
  }
98
98
  function retrieveProjectConfigurationPaths(root, nxJson) {
99
99
  var _a;
100
- const projectGlobPatterns = configurationGlobs(root, (0, nx_plugin_1.loadNxPluginsSync)((_a = nxJson === null || nxJson === void 0 ? void 0 : nxJson.plugins) !== null && _a !== void 0 ? _a : [], (0, installation_directory_1.getNxRequirePaths)(root), root));
101
- const { getProjectConfigurationFiles } = require('../../native');
102
- return getProjectConfigurationFiles(root, projectGlobPatterns);
100
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
101
+ const projectGlobPatterns = configurationGlobs(root, yield (0, nx_plugin_1.loadNxPlugins)((_a = nxJson === null || nxJson === void 0 ? void 0 : nxJson.plugins) !== null && _a !== void 0 ? _a : [], (0, installation_directory_1.getNxRequirePaths)(root), root));
102
+ const { getProjectConfigurationFiles } = require('../../native');
103
+ return getProjectConfigurationFiles(root, projectGlobPatterns);
104
+ });
103
105
  }
104
106
  exports.retrieveProjectConfigurationPaths = retrieveProjectConfigurationPaths;
105
107
  function retrieveProjectConfigurationPathsWithoutPluginInference(root) {
@@ -310,9 +310,9 @@ class ForkedProcessTaskRunner {
310
310
  `.env.${task.target.target}`,
311
311
  `.${task.target.target}.env`,
312
312
  // Load base DotEnv Files at workspace root
313
- `.env`,
314
313
  `.local.env`,
315
314
  `.env.local`,
315
+ `.env`,
316
316
  ];
317
317
  for (const file of dotEnvFiles) {
318
318
  (0, dotenv_1.config)({
@@ -161,7 +161,7 @@ exports.getMatchingStringsWithCache = (() => {
161
161
  }
162
162
  const patternCache = minimatchCache.get(pattern);
163
163
  if (!regexCache.has(pattern)) {
164
- const regex = minimatch.makeRe(pattern);
164
+ const regex = minimatch.makeRe(pattern, { dot: true });
165
165
  if (regex) {
166
166
  regexCache.set(pattern, regex);
167
167
  }
@@ -49,7 +49,7 @@ export interface PackageJson {
49
49
  }>;
50
50
  resolutions?: Record<string, string>;
51
51
  overrides?: PackageOverride;
52
- bin?: Record<string, string>;
52
+ bin?: Record<string, string> | string;
53
53
  workspaces?: string[] | {
54
54
  packages: string[];
55
55
  };