nx 22.1.0-rc.1 → 22.1.0-rc.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/bin/init-local.d.ts.map +1 -1
  2. package/bin/init-local.js +40 -2
  3. package/package.json +11 -11
  4. package/src/command-line/add/add.d.ts.map +1 -1
  5. package/src/command-line/add/add.js +5 -2
  6. package/src/command-line/init/command-object.d.ts.map +1 -1
  7. package/src/command-line/init/command-object.js +10 -0
  8. package/src/core/graph/main.js +1 -1
  9. package/src/daemon/client/client.d.ts +3 -0
  10. package/src/daemon/client/client.d.ts.map +1 -1
  11. package/src/daemon/client/client.js +14 -0
  12. package/src/daemon/message-types/nx-console.d.ts +18 -0
  13. package/src/daemon/message-types/nx-console.d.ts.map +1 -0
  14. package/src/daemon/message-types/nx-console.js +19 -0
  15. package/src/daemon/server/handle-nx-console.d.ts +4 -0
  16. package/src/daemon/server/handle-nx-console.d.ts.map +1 -0
  17. package/src/daemon/server/handle-nx-console.js +54 -0
  18. package/src/daemon/server/nx-console-operations.d.ts +31 -0
  19. package/src/daemon/server/nx-console-operations.d.ts.map +1 -0
  20. package/src/daemon/server/nx-console-operations.js +135 -0
  21. package/src/daemon/server/server.d.ts.map +1 -1
  22. package/src/daemon/server/server.js +12 -0
  23. package/src/daemon/server/shutdown-utils.d.ts.map +1 -1
  24. package/src/daemon/server/shutdown-utils.js +3 -0
  25. package/src/devkit-internals.d.ts +1 -1
  26. package/src/devkit-internals.d.ts.map +1 -1
  27. package/src/devkit-internals.js +2 -1
  28. package/src/native/index.d.ts +37 -24
  29. package/src/native/native-bindings.js +1 -0
  30. package/src/native/nx.wasm32-wasi.wasm +0 -0
  31. package/src/tasks-runner/process-metrics-service.d.ts +2 -2
  32. package/src/tasks-runner/process-metrics-service.d.ts.map +1 -1
  33. package/src/utils/package-json.d.ts +4 -0
  34. package/src/utils/package-json.d.ts.map +1 -1
  35. package/src/utils/package-json.js +45 -11
@@ -1 +1 @@
1
- {"version":3,"file":"init-local.d.ts","sourceRoot":"","sources":["../../../../packages/nx/bin/init-local.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAIxE;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,SAAS,EAAE,oBAAoB,iBA6C9D;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,YA6BvD"}
1
+ {"version":3,"file":"init-local.d.ts","sourceRoot":"","sources":["../../../../packages/nx/bin/init-local.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAMxE;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,SAAS,EAAE,oBAAoB,iBA6C9D;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,YA6BvD"}
package/bin/init-local.js CHANGED
@@ -5,7 +5,9 @@ exports.rewriteTargetsAndProjects = rewriteTargetsAndProjects;
5
5
  const perf_hooks_1 = require("perf_hooks");
6
6
  const nx_commands_1 = require("../src/command-line/nx-commands");
7
7
  const strip_indents_1 = require("../src/utils/strip-indents");
8
- const nx_console_prompt_1 = require("../src/utils/nx-console-prompt");
8
+ const client_1 = require("../src/daemon/client/client");
9
+ const enquirer_1 = require("enquirer");
10
+ const output_1 = require("../src/utils/output");
9
11
  /**
10
12
  * Nx is being run inside a workspace.
11
13
  *
@@ -29,7 +31,7 @@ async function initLocal(workspace) {
29
31
  }
30
32
  // Ensure NxConsole is installed if the user has it configured.
31
33
  try {
32
- await (0, nx_console_prompt_1.ensureNxConsoleInstalled)();
34
+ await ensureNxConsoleInstalledViaDaemon();
33
35
  }
34
36
  catch { }
35
37
  const command = process.argv[2];
@@ -115,6 +117,42 @@ function shouldDelegateToAngularCLI() {
115
117
  ];
116
118
  return commands.indexOf(command) > -1;
117
119
  }
120
+ async function ensureNxConsoleInstalledViaDaemon() {
121
+ // Only proceed if daemon is available
122
+ if (!client_1.daemonClient.enabled()) {
123
+ return;
124
+ }
125
+ // Get status from daemon
126
+ const status = await client_1.daemonClient.getNxConsoleStatus();
127
+ // If we should prompt the user
128
+ if (status.shouldPrompt && process.stdout.isTTY) {
129
+ output_1.output.log({
130
+ title: "Install Nx's official editor extension to:",
131
+ bodyLines: [
132
+ '- Enable your AI assistant to do more by understanding your workspace',
133
+ '- Add IntelliSense for Nx configuration files',
134
+ '- Explore your workspace visually',
135
+ ],
136
+ });
137
+ try {
138
+ const { shouldInstallNxConsole } = await (0, enquirer_1.prompt)({
139
+ type: 'confirm',
140
+ name: 'shouldInstallNxConsole',
141
+ message: 'Install Nx Console? (you can uninstall anytime)',
142
+ initial: true,
143
+ });
144
+ // Set preference and install if user said yes
145
+ const result = await client_1.daemonClient.setNxConsolePreferenceAndInstall(shouldInstallNxConsole);
146
+ if (result.installed) {
147
+ output_1.output.log({ title: 'Successfully installed Nx Console!' });
148
+ }
149
+ }
150
+ catch (error) {
151
+ // User cancelled or error occurred, save preference as false
152
+ await client_1.daemonClient.setNxConsolePreferenceAndInstall(false);
153
+ }
154
+ }
155
+ }
118
156
  function handleAngularCLIFallbacks(workspace) {
119
157
  if (process.argv[2] === 'update' && process.env.FORCE_NG_UPDATE != 'true') {
120
158
  console.log(`Nx provides a much improved version of "ng update". It runs the same migrations, but allows you to:`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "22.1.0-rc.1",
3
+ "version": "22.1.0-rc.3",
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": {
@@ -83,16 +83,16 @@
83
83
  }
84
84
  },
85
85
  "optionalDependencies": {
86
- "@nx/nx-darwin-arm64": "22.1.0-rc.1",
87
- "@nx/nx-darwin-x64": "22.1.0-rc.1",
88
- "@nx/nx-freebsd-x64": "22.1.0-rc.1",
89
- "@nx/nx-linux-arm-gnueabihf": "22.1.0-rc.1",
90
- "@nx/nx-linux-arm64-gnu": "22.1.0-rc.1",
91
- "@nx/nx-linux-arm64-musl": "22.1.0-rc.1",
92
- "@nx/nx-linux-x64-gnu": "22.1.0-rc.1",
93
- "@nx/nx-linux-x64-musl": "22.1.0-rc.1",
94
- "@nx/nx-win32-arm64-msvc": "22.1.0-rc.1",
95
- "@nx/nx-win32-x64-msvc": "22.1.0-rc.1"
86
+ "@nx/nx-darwin-arm64": "22.1.0-rc.3",
87
+ "@nx/nx-darwin-x64": "22.1.0-rc.3",
88
+ "@nx/nx-freebsd-x64": "22.1.0-rc.3",
89
+ "@nx/nx-linux-arm-gnueabihf": "22.1.0-rc.3",
90
+ "@nx/nx-linux-arm64-gnu": "22.1.0-rc.3",
91
+ "@nx/nx-linux-arm64-musl": "22.1.0-rc.3",
92
+ "@nx/nx-linux-x64-gnu": "22.1.0-rc.3",
93
+ "@nx/nx-linux-x64-musl": "22.1.0-rc.3",
94
+ "@nx/nx-win32-arm64-msvc": "22.1.0-rc.3",
95
+ "@nx/nx-win32-x64-msvc": "22.1.0-rc.3"
96
96
  },
97
97
  "nx-migrations": {
98
98
  "migrations": "./migrations.json",
@@ -1 +1 @@
1
- {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/add/add.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AASnD,wBAAgB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAc/D;AA6HD,eAAO,MAAM,oBAAoB,qBAUhC,CAAC"}
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/add/add.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AASnD,wBAAgB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAc/D;AAgID,eAAO,MAAM,oBAAoB,qBAUhC,CAAC"}
@@ -41,11 +41,14 @@ async function installPackage(pkgName, version, nxJson) {
41
41
  : `${pmc.addDev} ${pkgName}@${version}`;
42
42
  await new Promise((resolve) => (0, child_process_1.exec)(command, {
43
43
  windowsHide: false,
44
- }, (error, stdout) => {
44
+ }, (error, stdout, stderr) => {
45
45
  if (error) {
46
46
  spinner.fail();
47
47
  output_1.output.addNewline();
48
- logger_1.logger.error(stdout);
48
+ const errorOutput = [stdout.trim(), stderr.trim()]
49
+ .filter(Boolean)
50
+ .join('\n');
51
+ logger_1.logger.error(errorOutput);
49
52
  output_1.output.error({
50
53
  title: `Failed to install ${pkgName}. Please check the error above for more details.`,
51
54
  });
@@ -1 +1 @@
1
- {"version":3,"file":"command-object.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/init/command-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,aAAa,EAAE,MAAM,OAAO,CAAC;AAG5C,eAAO,MAAM,gBAAgB,EAAE,aAoB9B,CAAC"}
1
+ {"version":3,"file":"command-object.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/init/command-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,aAAa,EAAE,MAAM,OAAO,CAAC;AAG5C,eAAO,MAAM,gBAAgB,EAAE,aAiC9B,CAAC"}
@@ -7,6 +7,16 @@ exports.yargsInitCommand = {
7
7
  describe: 'Adds Nx to any type of workspace. It installs nx, creates an nx.json configuration file and optionally sets up remote caching. For more info, check https://nx.dev/recipes/adopting-nx.',
8
8
  builder: (yargs) => withInitOptions(yargs),
9
9
  handler: async (args) => {
10
+ // Node 24 has stricter readline behavior, and enquirer is not checking for closed state
11
+ // when invoking operations, thus you get an ERR_USE_AFTER_CLOSE error.
12
+ process.on('uncaughtException', (error) => {
13
+ if (error &&
14
+ typeof error === 'object' &&
15
+ 'code' in error &&
16
+ error['code'] === 'ERR_USE_AFTER_CLOSE')
17
+ return;
18
+ throw error;
19
+ });
10
20
  try {
11
21
  const useV2 = await isInitV2();
12
22
  if (useV2) {