nx 20.0.0-beta.2 → 20.0.0-beta.3

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.
Files changed (35) hide show
  1. package/.eslintrc.json +9 -1
  2. package/package.json +14 -13
  3. package/schemas/nx-schema.json +26 -21
  4. package/src/command-line/graph/graph.js +9 -9
  5. package/src/command-line/init/implementation/add-nx-to-nest.js +5 -5
  6. package/src/command-line/init/implementation/react/clean-up-files.js +7 -7
  7. package/src/command-line/init/implementation/react/index.js +19 -12
  8. package/src/command-line/init/implementation/react/rename-js-to-jsx.js +3 -3
  9. package/src/command-line/release/changelog.js +1 -2
  10. package/src/command-line/release/config/version-plans.js +6 -7
  11. package/src/command-line/release/plan.js +6 -5
  12. package/src/command-line/release/release.js +2 -2
  13. package/src/command-line/release/version.js +5 -3
  14. package/src/command-line/reset/reset.js +4 -4
  15. package/src/core/graph/main.js +1 -1
  16. package/src/core/graph/styles.css +1 -1
  17. package/src/core/graph/styles.js +1 -1
  18. package/src/daemon/cache.d.ts +1 -2
  19. package/src/daemon/cache.js +12 -21
  20. package/src/daemon/client/client.js +9 -8
  21. package/src/daemon/tmp-dir.js +6 -7
  22. package/src/generators/tree.d.ts +1 -1
  23. package/src/generators/tree.js +11 -11
  24. package/src/native/nx.wasm32-wasi.wasm +0 -0
  25. package/src/plugins/js/index.js +1 -2
  26. package/src/project-graph/nx-deps-cache.js +5 -6
  27. package/src/tasks-runner/cache.js +17 -16
  28. package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +5 -0
  29. package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +7 -0
  30. package/src/tasks-runner/remove-old-cache-records.js +2 -3
  31. package/src/utils/fileutils.d.ts +9 -1
  32. package/src/utils/fileutils.js +29 -12
  33. package/src/utils/ignore.js +2 -2
  34. package/src/utils/package-manager.js +2 -2
  35. package/src/utils/plugins/core-plugins.js +4 -0
@@ -1,5 +1,5 @@
1
1
  import type { JsonParseOptions, JsonSerializeOptions } from './json';
2
- import { PathLike } from 'fs';
2
+ import { PathLike } from 'node:fs';
3
3
  export interface JsonReadOptions extends JsonParseOptions {
4
4
  /**
5
5
  * mutable field recording whether JSON ends with new line
@@ -43,6 +43,14 @@ export declare function readYamlFile<T extends object = any>(path: string, optio
43
43
  * @param options JSON serialize options
44
44
  */
45
45
  export declare function writeJsonFile<T extends object = object>(path: string, data: T, options?: JsonWriteOptions): void;
46
+ /**
47
+ * Serializes the given data to JSON and writes it to a file asynchronously.
48
+ *
49
+ * @param path A path to a file.
50
+ * @param data data which should be serialized to JSON and written to the file
51
+ * @param options JSON serialize options
52
+ */
53
+ export declare function writeJsonFileAsync<T extends object = object>(path: string, data: T, options?: JsonWriteOptions): Promise<void>;
46
54
  /**
47
55
  * Check if a directory exists
48
56
  * @param path Path to directory
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.readJsonFile = readJsonFile;
4
4
  exports.readYamlFile = readYamlFile;
5
5
  exports.writeJsonFile = writeJsonFile;
6
+ exports.writeJsonFileAsync = writeJsonFileAsync;
6
7
  exports.directoryExists = directoryExists;
7
8
  exports.fileExists = fileExists;
8
9
  exports.createDirectory = createDirectory;
@@ -10,7 +11,8 @@ exports.isRelativePath = isRelativePath;
10
11
  exports.extractFileFromTarball = extractFileFromTarball;
11
12
  exports.readFileIfExisting = readFileIfExisting;
12
13
  const json_1 = require("./json");
13
- const fs_1 = require("fs");
14
+ const node_fs_1 = require("node:fs");
15
+ const promises_1 = require("node:fs/promises");
14
16
  const path_1 = require("path");
15
17
  const tar = require("tar-stream");
16
18
  const zlib_1 = require("zlib");
@@ -22,7 +24,7 @@ const zlib_1 = require("zlib");
22
24
  * @returns Object the JSON content of the file represents
23
25
  */
24
26
  function readJsonFile(path, options) {
25
- const content = (0, fs_1.readFileSync)(path, 'utf-8');
27
+ const content = (0, node_fs_1.readFileSync)(path, 'utf-8');
26
28
  if (options) {
27
29
  options.endsWithNewline = content.charCodeAt(content.length - 1) === 10;
28
30
  }
@@ -41,7 +43,7 @@ function readJsonFile(path, options) {
41
43
  * @returns
42
44
  */
43
45
  function readYamlFile(path, options) {
44
- const content = (0, fs_1.readFileSync)(path, 'utf-8');
46
+ const content = (0, node_fs_1.readFileSync)(path, 'utf-8');
45
47
  const { load } = require('@zkochan/js-yaml');
46
48
  return load(content, { ...options, filename: path });
47
49
  }
@@ -53,12 +55,27 @@ function readYamlFile(path, options) {
53
55
  * @param options JSON serialize options
54
56
  */
55
57
  function writeJsonFile(path, data, options) {
56
- (0, fs_1.mkdirSync)((0, path_1.dirname)(path), { recursive: true });
58
+ (0, node_fs_1.mkdirSync)((0, path_1.dirname)(path), { recursive: true });
57
59
  const serializedJson = (0, json_1.serializeJson)(data, options);
58
60
  const content = options?.appendNewLine
59
61
  ? `${serializedJson}\n`
60
62
  : serializedJson;
61
- (0, fs_1.writeFileSync)(path, content, { encoding: 'utf-8' });
63
+ (0, node_fs_1.writeFileSync)(path, content, { encoding: 'utf-8' });
64
+ }
65
+ /**
66
+ * Serializes the given data to JSON and writes it to a file asynchronously.
67
+ *
68
+ * @param path A path to a file.
69
+ * @param data data which should be serialized to JSON and written to the file
70
+ * @param options JSON serialize options
71
+ */
72
+ async function writeJsonFileAsync(path, data, options) {
73
+ await (0, promises_1.mkdir)((0, path_1.dirname)(path), { recursive: true });
74
+ const serializedJson = (0, json_1.serializeJson)(data, options);
75
+ const content = options?.appendNewLine
76
+ ? `${serializedJson}\n`
77
+ : serializedJson;
78
+ await (0, promises_1.writeFile)(path, content, { encoding: 'utf-8' });
62
79
  }
63
80
  /**
64
81
  * Check if a directory exists
@@ -66,7 +83,7 @@ function writeJsonFile(path, data, options) {
66
83
  */
67
84
  function directoryExists(path) {
68
85
  try {
69
- return (0, fs_1.statSync)(path).isDirectory();
86
+ return (0, node_fs_1.statSync)(path).isDirectory();
70
87
  }
71
88
  catch {
72
89
  return false;
@@ -78,14 +95,14 @@ function directoryExists(path) {
78
95
  */
79
96
  function fileExists(path) {
80
97
  try {
81
- return (0, fs_1.statSync)(path).isFile();
98
+ return (0, node_fs_1.statSync)(path).isFile();
82
99
  }
83
100
  catch {
84
101
  return false;
85
102
  }
86
103
  }
87
104
  function createDirectory(path) {
88
- (0, fs_1.mkdirSync)(path, { recursive: true });
105
+ (0, node_fs_1.mkdirSync)(path, { recursive: true });
89
106
  }
90
107
  function isRelativePath(path) {
91
108
  return (path === '.' ||
@@ -102,9 +119,9 @@ function isRelativePath(path) {
102
119
  */
103
120
  async function extractFileFromTarball(tarballPath, file, destinationFilePath) {
104
121
  return new Promise((resolve, reject) => {
105
- (0, fs_1.mkdirSync)((0, path_1.dirname)(destinationFilePath), { recursive: true });
122
+ (0, node_fs_1.mkdirSync)((0, path_1.dirname)(destinationFilePath), { recursive: true });
106
123
  var tarExtractStream = tar.extract();
107
- const destinationFileStream = (0, fs_1.createWriteStream)(destinationFilePath);
124
+ const destinationFileStream = (0, node_fs_1.createWriteStream)(destinationFilePath);
108
125
  let isFileExtracted = false;
109
126
  tarExtractStream.on('entry', function (header, stream, next) {
110
127
  if (header.name === file) {
@@ -126,9 +143,9 @@ async function extractFileFromTarball(tarballPath, file, destinationFilePath) {
126
143
  reject();
127
144
  }
128
145
  });
129
- (0, fs_1.createReadStream)(tarballPath).pipe((0, zlib_1.createGunzip)()).pipe(tarExtractStream);
146
+ (0, node_fs_1.createReadStream)(tarballPath).pipe((0, zlib_1.createGunzip)()).pipe(tarExtractStream);
130
147
  });
131
148
  }
132
149
  function readFileIfExisting(path) {
133
- return (0, fs_1.existsSync)(path) ? (0, fs_1.readFileSync)(path, 'utf-8') : '';
150
+ return (0, node_fs_1.existsSync)(path) ? (0, node_fs_1.readFileSync)(path, 'utf-8') : '';
134
151
  }
@@ -4,7 +4,7 @@ exports.ALWAYS_IGNORE = void 0;
4
4
  exports.getIgnoredGlobs = getIgnoredGlobs;
5
5
  exports.getAlwaysIgnore = getAlwaysIgnore;
6
6
  exports.getIgnoreObject = getIgnoreObject;
7
- const fs_extra_1 = require("fs-extra");
7
+ const node_fs_1 = require("node:fs");
8
8
  const ignore_1 = require("ignore");
9
9
  const fileutils_1 = require("./fileutils");
10
10
  const path_1 = require("./path");
@@ -48,7 +48,7 @@ function getIgnoreObject(root = workspace_root_1.workspaceRoot) {
48
48
  function getIgnoredGlobsFromFile(file, root) {
49
49
  try {
50
50
  const results = [];
51
- const contents = (0, fs_extra_1.readFileSync)(file, 'utf-8');
51
+ const contents = (0, node_fs_1.readFileSync)(file, 'utf-8');
52
52
  const lines = contents.split('\n');
53
53
  for (const line of lines) {
54
54
  const trimmed = line.trim();
@@ -15,7 +15,7 @@ exports.packageRegistryView = packageRegistryView;
15
15
  exports.packageRegistryPack = packageRegistryPack;
16
16
  const child_process_1 = require("child_process");
17
17
  const fs_1 = require("fs");
18
- const fs_extra_1 = require("fs-extra");
18
+ const promises_1 = require("node:fs/promises");
19
19
  const path_1 = require("path");
20
20
  const semver_1 = require("semver");
21
21
  const tmp_1 = require("tmp");
@@ -301,7 +301,7 @@ function createTempNpmDirectory() {
301
301
  copyPackageManagerConfigurationFiles(workspace_root_1.workspaceRoot, dir);
302
302
  const cleanup = async () => {
303
303
  try {
304
- await (0, fs_extra_1.remove)(dir);
304
+ await (0, promises_1.rm)(dir, { recursive: true, force: true });
305
305
  }
306
306
  catch {
307
307
  // It's okay if this fails, the OS will clean it up eventually
@@ -82,6 +82,10 @@ exports.CORE_PLUGINS = [
82
82
  name: '@nx/rollup',
83
83
  capabilities: 'executors,generators',
84
84
  },
85
+ {
86
+ name: '@nx/rspack',
87
+ capabilities: 'executors,generators',
88
+ },
85
89
  {
86
90
  name: '@nx/storybook',
87
91
  capabilities: 'executors,generators',