nx 22.1.0-rc.5 → 22.1.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.
Files changed (67) hide show
  1. package/bin/init-local.d.ts.map +1 -1
  2. package/bin/init-local.js +2 -40
  3. package/package.json +11 -11
  4. package/src/command-line/daemon/command-object.d.ts +3 -2
  5. package/src/command-line/daemon/command-object.d.ts.map +1 -1
  6. package/src/command-line/daemon/command-object.js +11 -4
  7. package/src/command-line/graph/graph.d.ts.map +1 -1
  8. package/src/command-line/graph/graph.js +25 -16
  9. package/src/command-line/release/utils/shared.d.ts.map +1 -1
  10. package/src/command-line/release/utils/shared.js +5 -5
  11. package/src/command-line/yargs-utils/arguments-of.d.ts +12 -0
  12. package/src/command-line/yargs-utils/arguments-of.d.ts.map +1 -0
  13. package/src/command-line/yargs-utils/arguments-of.js +9 -0
  14. package/src/core/graph/main.js +1 -1
  15. package/src/daemon/client/client.d.ts +0 -3
  16. package/src/daemon/client/client.d.ts.map +1 -1
  17. package/src/daemon/client/client.js +2 -14
  18. package/src/daemon/server/server.d.ts.map +1 -1
  19. package/src/daemon/server/server.js +9 -21
  20. package/src/daemon/server/shutdown-utils.d.ts.map +1 -1
  21. package/src/daemon/server/shutdown-utils.js +0 -3
  22. package/src/devkit-internals.d.ts +1 -1
  23. package/src/devkit-internals.d.ts.map +1 -1
  24. package/src/devkit-internals.js +1 -2
  25. package/src/hasher/task-hasher.js +1 -1
  26. package/src/native/nx.wasi-browser.js +45 -53
  27. package/src/native/nx.wasm32-wasi.wasm +0 -0
  28. package/src/project-graph/error-types.d.ts +3 -2
  29. package/src/project-graph/error-types.d.ts.map +1 -1
  30. package/src/project-graph/error-types.js +9 -2
  31. package/src/project-graph/plugins/get-plugins.d.ts.map +1 -1
  32. package/src/project-graph/plugins/get-plugins.js +33 -35
  33. package/src/project-graph/plugins/in-process-loader.d.ts.map +1 -1
  34. package/src/project-graph/plugins/in-process-loader.js +2 -2
  35. package/src/project-graph/plugins/isolation/plugin-pool.js +3 -2
  36. package/src/project-graph/plugins/isolation/plugin-worker.js +3 -3
  37. package/src/project-graph/plugins/loaded-nx-plugin.d.ts +5 -0
  38. package/src/project-graph/plugins/loaded-nx-plugin.d.ts.map +1 -1
  39. package/src/project-graph/plugins/loaded-nx-plugin.js +5 -0
  40. package/src/project-graph/project-graph.d.ts +1 -0
  41. package/src/project-graph/project-graph.d.ts.map +1 -1
  42. package/src/project-graph/project-graph.js +21 -0
  43. package/src/project-graph/utils/project-configuration-utils.d.ts +1 -1
  44. package/src/project-graph/utils/project-configuration-utils.d.ts.map +1 -1
  45. package/src/project-graph/utils/project-configuration-utils.js +46 -15
  46. package/src/project-graph/utils/retrieve-workspace-files.d.ts +1 -1
  47. package/src/project-graph/utils/retrieve-workspace-files.d.ts.map +1 -1
  48. package/src/tasks-runner/utils.d.ts.map +1 -1
  49. package/src/tasks-runner/utils.js +3 -2
  50. package/src/utils/ab-testing.js +1 -1
  51. package/src/utils/assert-workspace-validity.d.ts.map +1 -1
  52. package/src/utils/assert-workspace-validity.js +5 -8
  53. package/src/utils/call-sites.d.ts +15 -0
  54. package/src/utils/call-sites.d.ts.map +1 -0
  55. package/src/utils/call-sites.js +28 -0
  56. package/src/utils/package-json.d.ts +0 -4
  57. package/src/utils/package-json.d.ts.map +1 -1
  58. package/src/utils/package-json.js +11 -45
  59. package/src/daemon/message-types/nx-console.d.ts +0 -18
  60. package/src/daemon/message-types/nx-console.d.ts.map +0 -1
  61. package/src/daemon/message-types/nx-console.js +0 -19
  62. package/src/daemon/server/handle-nx-console.d.ts +0 -4
  63. package/src/daemon/server/handle-nx-console.d.ts.map +0 -1
  64. package/src/daemon/server/handle-nx-console.js +0 -54
  65. package/src/daemon/server/nx-console-operations.d.ts +0 -31
  66. package/src/daemon/server/nx-console-operations.d.ts.map +0 -1
  67. package/src/daemon/server/nx-console-operations.js +0 -135
@@ -1,31 +0,0 @@
1
- /**
2
- * Gets the Nx Console status (whether we should prompt the user to install).
3
- * Uses latest Nx version if available, falls back to local implementation.
4
- *
5
- * @returns boolean indicating whether we should prompt the user
6
- */
7
- export declare function getNxConsoleStatus({ inner, }?: {
8
- inner?: boolean;
9
- }): Promise<boolean>;
10
- /**
11
- * Handles user preference submission and installs Nx Console if requested.
12
- * Uses latest Nx version if available, falls back to local implementation.
13
- *
14
- * @param preference - whether the user wants to install Nx Console
15
- * @returns object indicating whether installation succeeded
16
- */
17
- export declare function handleNxConsolePreferenceAndInstall({ preference, inner, }: {
18
- preference: boolean;
19
- inner?: boolean;
20
- }): Promise<{
21
- installed: boolean;
22
- }>;
23
- /**
24
- * Clean up the latest Nx installation on daemon shutdown.
25
- */
26
- export declare function cleanupLatestNxInstallation(): void;
27
- export declare function getNxConsoleStatusImpl(): Promise<boolean>;
28
- export declare function handleNxConsolePreferenceAndInstallImpl(preference: boolean): Promise<{
29
- installed: boolean;
30
- }>;
31
- //# sourceMappingURL=nx-console-operations.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nx-console-operations.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/server/nx-console-operations.ts"],"names":[],"mappings":"AAiBA;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,KAAK,GACN,GAAE;IACD,KAAK,CAAC,EAAE,OAAO,CAAC;CACZ,GAAG,OAAO,CAAC,OAAO,CAAC,CAwCxB;AAED;;;;;;GAMG;AACH,wBAAsB,mCAAmC,CAAC,EACxD,UAAU,EACV,KAAK,GACN,EAAE;IACD,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,OAAO,CAAC;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC,CAgDlC;AAED;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,IAAI,CAOlD;AAED,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,OAAO,CAAC,CAsB/D;AAED,wBAAsB,uCAAuC,CAC3D,UAAU,EAAE,OAAO,GAClB,OAAO,CAAC;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC,CAUjC"}
@@ -1,135 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNxConsoleStatus = getNxConsoleStatus;
4
- exports.handleNxConsolePreferenceAndInstall = handleNxConsolePreferenceAndInstall;
5
- exports.cleanupLatestNxInstallation = cleanupLatestNxInstallation;
6
- exports.getNxConsoleStatusImpl = getNxConsoleStatusImpl;
7
- exports.handleNxConsolePreferenceAndInstallImpl = handleNxConsolePreferenceAndInstallImpl;
8
- const devkit_internals_1 = require("../../devkit-internals");
9
- const os_1 = require("os");
10
- const native_1 = require("../../native");
11
- const logger_1 = require("./logger");
12
- // Module-level state - persists across invocations within daemon lifecycle
13
- let latestNxTmpPath = null;
14
- let cleanupFn = null;
15
- const log = (...messageParts) => {
16
- logger_1.serverLogger.log('[NX-CONSOLE]:', ...messageParts);
17
- };
18
- /**
19
- * Gets the Nx Console status (whether we should prompt the user to install).
20
- * Uses latest Nx version if available, falls back to local implementation.
21
- *
22
- * @returns boolean indicating whether we should prompt the user
23
- */
24
- async function getNxConsoleStatus({ inner, } = {}) {
25
- // Use local implementation if explicitly requested
26
- if (process.env.NX_USE_LOCAL === 'true' || inner === true) {
27
- log('Using local implementation (NX_USE_LOCAL=true or inner call)');
28
- return await getNxConsoleStatusImpl();
29
- }
30
- try {
31
- // If we don't have a tmp path yet, pull latest Nx
32
- if (latestNxTmpPath === null) {
33
- log('Pulling latest Nx (latest) to check console status...');
34
- const packageInstallResults = await (0, devkit_internals_1.installPackageToTmpAsync)('nx', 'latest');
35
- latestNxTmpPath = packageInstallResults.tempDir;
36
- cleanupFn = packageInstallResults.cleanup;
37
- log('Successfully pulled latest Nx to', latestNxTmpPath);
38
- }
39
- else {
40
- log('Reusing cached Nx installation from', latestNxTmpPath);
41
- }
42
- // Try to use the cached tmp path
43
- const modulePath = require.resolve('nx/src/daemon/server/nx-console-operations.js', { paths: [latestNxTmpPath] });
44
- const module = await Promise.resolve(`${modulePath}`).then(s => require(s));
45
- const result = await module.getNxConsoleStatus({ inner: true });
46
- log('Console status check completed, shouldPrompt:', result);
47
- return result;
48
- }
49
- catch (error) {
50
- // If tmp path failed (e.g., directory was deleted), fall back to local immediately
51
- log('Failed to use latest Nx, falling back to local implementation. Error:', error.message);
52
- return await getNxConsoleStatusImpl();
53
- }
54
- }
55
- /**
56
- * Handles user preference submission and installs Nx Console if requested.
57
- * Uses latest Nx version if available, falls back to local implementation.
58
- *
59
- * @param preference - whether the user wants to install Nx Console
60
- * @returns object indicating whether installation succeeded
61
- */
62
- async function handleNxConsolePreferenceAndInstall({ preference, inner, }) {
63
- log('Handling user preference:', preference);
64
- // Use local implementation if explicitly requested
65
- if (process.env.NX_USE_LOCAL === 'true' || inner === true) {
66
- log('Using local implementation (NX_USE_LOCAL=true or inner call)');
67
- return await handleNxConsolePreferenceAndInstallImpl(preference);
68
- }
69
- try {
70
- // If we don't have a tmp path yet, pull latest Nx
71
- if (latestNxTmpPath === null) {
72
- log('Pulling latest Nx (latest) to handle preference and install...');
73
- const packageInstallResults = await (0, devkit_internals_1.installPackageToTmpAsync)('nx', 'latest');
74
- latestNxTmpPath = packageInstallResults.tempDir;
75
- cleanupFn = packageInstallResults.cleanup;
76
- log('Successfully pulled latest Nx to', latestNxTmpPath);
77
- }
78
- else {
79
- log('Reusing cached Nx installation from', latestNxTmpPath);
80
- }
81
- // Try to use the cached tmp path
82
- const modulePath = require.resolve('nx/src/daemon/server/nx-console-operations.js', { paths: [latestNxTmpPath] });
83
- const module = await Promise.resolve(`${modulePath}`).then(s => require(s));
84
- const result = await module.handleNxConsolePreferenceAndInstall({
85
- preference,
86
- inner: true,
87
- });
88
- log('Preference saved and installation', result.installed ? 'succeeded' : 'skipped/failed');
89
- return result;
90
- }
91
- catch (error) {
92
- // If tmp path failed (e.g., directory was deleted), fall back to local immediately
93
- log('Failed to use latest Nx, falling back to local implementation. Error:', error.message);
94
- return await handleNxConsolePreferenceAndInstallImpl(preference);
95
- }
96
- }
97
- /**
98
- * Clean up the latest Nx installation on daemon shutdown.
99
- */
100
- function cleanupLatestNxInstallation() {
101
- if (cleanupFn) {
102
- log('Cleaning up latest Nx installation from', latestNxTmpPath);
103
- cleanupFn();
104
- }
105
- latestNxTmpPath = null;
106
- cleanupFn = null;
107
- }
108
- async function getNxConsoleStatusImpl() {
109
- // If no cached preference, read from disk
110
- const preferences = new native_1.NxConsolePreferences((0, os_1.homedir)());
111
- const preference = preferences.getAutoInstallPreference();
112
- const canInstallConsole = (0, native_1.canInstallNxConsole)();
113
- // If user previously opted in but extension is not installed,
114
- // they must have manually uninstalled it - respect that choice
115
- if (preference === true && canInstallConsole) {
116
- const preferences = new native_1.NxConsolePreferences((0, os_1.homedir)());
117
- preferences.setAutoInstallPreference(false);
118
- return false; // Don't prompt
119
- }
120
- // Noop if can't install
121
- if (!canInstallConsole) {
122
- return false;
123
- }
124
- // Prompt if we can install and user hasn't answered yet
125
- return typeof preference !== 'boolean';
126
- }
127
- async function handleNxConsolePreferenceAndInstallImpl(preference) {
128
- const preferences = new native_1.NxConsolePreferences((0, os_1.homedir)());
129
- preferences.setAutoInstallPreference(preference);
130
- let installed = false;
131
- if (preference) {
132
- installed = (0, native_1.installNxConsole)();
133
- }
134
- return { installed };
135
- }