nx 21.2.0-beta.1 → 21.2.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 (42) hide show
  1. package/README.md +1 -1
  2. package/bin/init-local.d.ts +1 -1
  3. package/bin/init-local.js +7 -1
  4. package/bin/nx.js +9 -6
  5. package/package.json +11 -11
  6. package/src/command-line/affected/command-object.js +1 -1
  7. package/src/command-line/graph/graph.d.ts +1 -0
  8. package/src/command-line/graph/graph.js +56 -11
  9. package/src/command-line/init/implementation/angular/legacy-angular-versions.js +23 -4
  10. package/src/command-line/migrate/migrate.js +10 -4
  11. package/src/command-line/release/changelog.js +15 -5
  12. package/src/command-line/release/version/release-group-processor.js +1 -1
  13. package/src/command-line/release/version/topological-sort.js +1 -1
  14. package/src/command-line/report/report.js +1 -1
  15. package/src/command-line/run/run-one.d.ts +10 -0
  16. package/src/command-line/run/run-one.js +16 -5
  17. package/src/core/graph/main.js +1 -1
  18. package/src/core/graph/styles.js +1 -1
  19. package/src/executors/run-commands/run-commands.impl.d.ts +2 -1
  20. package/src/executors/run-commands/run-commands.impl.js +5 -0
  21. package/src/native/index.d.ts +12 -2
  22. package/src/native/native-bindings.js +4 -1
  23. package/src/native/nx.wasi-browser.js +47 -40
  24. package/src/native/nx.wasi.cjs +47 -40
  25. package/src/native/nx.wasm32-wasi.wasm +0 -0
  26. package/src/nx-cloud/utilities/url-shorten.d.ts +1 -1
  27. package/src/nx-cloud/utilities/url-shorten.js +27 -26
  28. package/src/plugins/js/lock-file/pnpm-parser.js +11 -3
  29. package/src/plugins/js/lock-file/project-graph-pruning.d.ts +2 -1
  30. package/src/plugins/js/lock-file/project-graph-pruning.js +4 -0
  31. package/src/plugins/js/project-graph/affected/lock-file-changes.js +6 -3
  32. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +22 -12
  33. package/src/plugins/js/utils/register.d.ts +3 -2
  34. package/src/plugins/js/utils/register.js +36 -22
  35. package/src/plugins/js/utils/typescript.d.ts +2 -1
  36. package/src/plugins/js/utils/typescript.js +12 -7
  37. package/src/project-graph/plugins/transpiler.js +5 -5
  38. package/src/tasks-runner/run-command.js +12 -1
  39. package/src/tasks-runner/running-tasks/noop-child-process.d.ts +2 -1
  40. package/src/tasks-runner/running-tasks/noop-child-process.js +4 -1
  41. package/src/utils/nx-console-prompt.d.ts +1 -0
  42. package/src/utils/nx-console-prompt.js +50 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk=self.webpackChunk||[]).push([[869],{7148:()=>{}},s=>{var e;e=7148,s(s.s=e)}]);
1
+ "use strict";(self.webpackChunk=self.webpackChunk||[]).push([[869],{5873:()=>{}},s=>{var e;e=5873,s(s.s=e)}]);
@@ -1,4 +1,5 @@
1
1
  import { ExecutorContext } from '../../config/misc-interfaces';
2
+ import { NoopChildProcess } from '../../tasks-runner/running-tasks/noop-child-process';
2
3
  import { ParallelRunningTasks, SeriallyRunningTasks } from './running-tasks';
3
4
  export declare const LARGE_BUFFER: number;
4
5
  export type Json = {
@@ -54,5 +55,5 @@ export default function (options: RunCommandsOptions, context: ExecutorContext):
54
55
  success: boolean;
55
56
  terminalOutput: string;
56
57
  }>;
57
- export declare function runCommands(options: RunCommandsOptions, context: ExecutorContext): Promise<import("../../tasks-runner/pseudo-terminal").PseudoTtyProcess | ParallelRunningTasks | SeriallyRunningTasks>;
58
+ export declare function runCommands(options: RunCommandsOptions, context: ExecutorContext): Promise<import("../../tasks-runner/pseudo-terminal").PseudoTtyProcess | NoopChildProcess | ParallelRunningTasks | SeriallyRunningTasks>;
58
59
  export declare function interpolateArgsIntoCommand(command: string, opts: Pick<NormalizedRunCommandsOptions, 'args' | 'parsedArgs' | '__unparsed__' | 'unknownOptions' | 'unparsedCommandArgs'>, forwardAllArgs: boolean): string;
@@ -7,6 +7,7 @@ exports.interpolateArgsIntoCommand = interpolateArgsIntoCommand;
7
7
  const yargsParser = require("yargs-parser");
8
8
  const is_tui_enabled_1 = require("../../tasks-runner/is-tui-enabled");
9
9
  const pseudo_terminal_1 = require("../../tasks-runner/pseudo-terminal");
10
+ const noop_child_process_1 = require("../../tasks-runner/running-tasks/noop-child-process");
10
11
  const running_tasks_1 = require("./running-tasks");
11
12
  exports.LARGE_BUFFER = 1024 * 1000000;
12
13
  const propKeys = [
@@ -45,6 +46,10 @@ async function runCommands(options, context) {
45
46
  !options.parallel) {
46
47
  throw new Error('ERROR: Bad executor config for run-commands - "prefix", "prefixColor", "color" and "bgColor" can only be set when "parallel=true".');
47
48
  }
49
+ // Handle empty commands array - return immediately with success
50
+ if (normalized.commands.length === 0) {
51
+ return new noop_child_process_1.NoopChildProcess({ code: 0, terminalOutput: '' });
52
+ }
48
53
  const isSingleCommand = normalized.commands.length === 1;
49
54
  const usePseudoTerminal = (isSingleCommand || !options.parallel) && pseudo_terminal_1.PseudoTerminal.isSupported();
50
55
  const isSingleCommandAndCanUsePseudoTerminal = isSingleCommand &&
@@ -73,6 +73,12 @@ export declare class NxCache {
73
73
  checkCacheFsInSync(): boolean
74
74
  }
75
75
 
76
+ export declare class NxConsolePreferences {
77
+ constructor(homeDir: string)
78
+ getAutoInstallPreference(): boolean | null
79
+ setAutoInstallPreference(autoInstall: boolean): void
80
+ }
81
+
76
82
  export declare class NxTaskHistory {
77
83
  constructor(db: ExternalObject<NxDbConnection>)
78
84
  recordTaskRuns(taskRuns: Array<TaskRun>): void
@@ -148,6 +154,8 @@ export interface CachedResult {
148
154
  size?: number
149
155
  }
150
156
 
157
+ export declare export declare function canInstallNxConsole(): boolean
158
+
151
159
  export declare export declare function closeDbConnection(connection: ExternalObject<NxDbConnection>): void
152
160
 
153
161
  export declare export declare function connectToNxDb(cacheDir: string, nxVersion: string, dbName?: string | undefined | null): ExternalObject<NxDbConnection>
@@ -235,11 +243,13 @@ export interface InputsInput {
235
243
  projects?: string | Array<string>
236
244
  }
237
245
 
246
+ export declare export declare function installNxConsole(): void
247
+
238
248
  export const IS_WASM: boolean
239
249
 
240
- export declare export declare function logError(message: string): void
250
+ export declare export declare function logDebug(message: string): void
241
251
 
242
- export declare export declare function logInfo(message: string): void
252
+ export declare export declare function logError(message: string): void
243
253
 
244
254
  /** Stripped version of the NxJson interface for use in rust */
245
255
  export interface NxJson {
@@ -368,6 +368,7 @@ module.exports.HashPlanner = nativeBinding.HashPlanner
368
368
  module.exports.HttpRemoteCache = nativeBinding.HttpRemoteCache
369
369
  module.exports.ImportResult = nativeBinding.ImportResult
370
370
  module.exports.NxCache = nativeBinding.NxCache
371
+ module.exports.NxConsolePreferences = nativeBinding.NxConsolePreferences
371
372
  module.exports.NxTaskHistory = nativeBinding.NxTaskHistory
372
373
  module.exports.RunningTasksService = nativeBinding.RunningTasksService
373
374
  module.exports.RustPseudoTerminal = nativeBinding.RustPseudoTerminal
@@ -375,6 +376,7 @@ module.exports.TaskDetails = nativeBinding.TaskDetails
375
376
  module.exports.TaskHasher = nativeBinding.TaskHasher
376
377
  module.exports.Watcher = nativeBinding.Watcher
377
378
  module.exports.WorkspaceContext = nativeBinding.WorkspaceContext
379
+ module.exports.canInstallNxConsole = nativeBinding.canInstallNxConsole
378
380
  module.exports.closeDbConnection = nativeBinding.closeDbConnection
379
381
  module.exports.connectToNxDb = nativeBinding.connectToNxDb
380
382
  module.exports.copy = nativeBinding.copy
@@ -387,9 +389,10 @@ module.exports.getFilesForOutputs = nativeBinding.getFilesForOutputs
387
389
  module.exports.getTransformableOutputs = nativeBinding.getTransformableOutputs
388
390
  module.exports.hashArray = nativeBinding.hashArray
389
391
  module.exports.hashFile = nativeBinding.hashFile
392
+ module.exports.installNxConsole = nativeBinding.installNxConsole
390
393
  module.exports.IS_WASM = nativeBinding.IS_WASM
394
+ module.exports.logDebug = nativeBinding.logDebug
391
395
  module.exports.logError = nativeBinding.logError
392
- module.exports.logInfo = nativeBinding.logInfo
393
396
  module.exports.parseTaskStatus = nativeBinding.parseTaskStatus
394
397
  module.exports.remove = nativeBinding.remove
395
398
  module.exports.restoreTerminal = nativeBinding.restoreTerminal
@@ -59,51 +59,57 @@ function __napi_rs_initialize_modules(__napiInstance) {
59
59
  __napiInstance.exports['__napi_register__get_transformable_outputs_5']?.()
60
60
  __napiInstance.exports['__napi_register__hash_array_6']?.()
61
61
  __napiInstance.exports['__napi_register__hash_file_7']?.()
62
- __napiInstance.exports['__napi_register__log_info_8']?.()
63
- __napiInstance.exports['__napi_register__log_error_9']?.()
64
- __napiInstance.exports['__napi_register__IS_WASM_10']?.()
65
- __napiInstance.exports['__napi_register__get_binary_target_11']?.()
66
- __napiInstance.exports['__napi_register__ImportResult_struct_12']?.()
67
- __napiInstance.exports['__napi_register__find_imports_13']?.()
68
- __napiInstance.exports['__napi_register__transfer_project_graph_14']?.()
69
- __napiInstance.exports['__napi_register__ExternalNode_struct_15']?.()
70
- __napiInstance.exports['__napi_register__Target_struct_16']?.()
71
- __napiInstance.exports['__napi_register__Project_struct_17']?.()
72
- __napiInstance.exports['__napi_register__ProjectGraph_struct_18']?.()
73
- __napiInstance.exports['__napi_register__HashPlanner_struct_19']?.()
74
- __napiInstance.exports['__napi_register__HashPlanner_impl_23']?.()
75
- __napiInstance.exports['__napi_register__HashDetails_struct_24']?.()
76
- __napiInstance.exports['__napi_register__HasherOptions_struct_25']?.()
77
- __napiInstance.exports['__napi_register__TaskHasher_struct_26']?.()
78
- __napiInstance.exports['__napi_register__TaskHasher_impl_29']?.()
79
- __napiInstance.exports['__napi_register__Task_struct_30']?.()
80
- __napiInstance.exports['__napi_register__TaskTarget_struct_31']?.()
81
- __napiInstance.exports['__napi_register__TaskResult_struct_32']?.()
82
- __napiInstance.exports['__napi_register__TaskGraph_struct_33']?.()
83
- __napiInstance.exports['__napi_register__FileData_struct_34']?.()
84
- __napiInstance.exports['__napi_register__InputsInput_struct_35']?.()
85
- __napiInstance.exports['__napi_register__FileSetInput_struct_36']?.()
86
- __napiInstance.exports['__napi_register__RuntimeInput_struct_37']?.()
87
- __napiInstance.exports['__napi_register__EnvironmentInput_struct_38']?.()
88
- __napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_39']?.()
89
- __napiInstance.exports['__napi_register__DepsOutputsInput_struct_40']?.()
90
- __napiInstance.exports['__napi_register__NxJson_struct_41']?.()
91
- __napiInstance.exports['__napi_register__FileLock_struct_42']?.()
92
- __napiInstance.exports['__napi_register__FileLock_impl_44']?.()
93
- __napiInstance.exports['__napi_register__WorkspaceContext_struct_45']?.()
94
- __napiInstance.exports['__napi_register__WorkspaceContext_impl_56']?.()
95
- __napiInstance.exports['__napi_register__WorkspaceErrors_57']?.()
96
- __napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_58']?.()
97
- __napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_59']?.()
98
- __napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_60']?.()
99
- __napiInstance.exports['__napi_register__FileMap_struct_61']?.()
100
- __napiInstance.exports['__napi_register____test_only_transfer_file_map_62']?.()
62
+ __napiInstance.exports['__napi_register__can_install_nx_console_8']?.()
63
+ __napiInstance.exports['__napi_register__install_nx_console_9']?.()
64
+ __napiInstance.exports['__napi_register__NxConsolePreferences_struct_10']?.()
65
+ __napiInstance.exports['__napi_register__NxConsolePreferences_impl_14']?.()
66
+ __napiInstance.exports['__napi_register__log_debug_15']?.()
67
+ __napiInstance.exports['__napi_register__log_error_16']?.()
68
+ __napiInstance.exports['__napi_register__IS_WASM_17']?.()
69
+ __napiInstance.exports['__napi_register__get_binary_target_18']?.()
70
+ __napiInstance.exports['__napi_register__ImportResult_struct_19']?.()
71
+ __napiInstance.exports['__napi_register__find_imports_20']?.()
72
+ __napiInstance.exports['__napi_register__transfer_project_graph_21']?.()
73
+ __napiInstance.exports['__napi_register__ExternalNode_struct_22']?.()
74
+ __napiInstance.exports['__napi_register__Target_struct_23']?.()
75
+ __napiInstance.exports['__napi_register__Project_struct_24']?.()
76
+ __napiInstance.exports['__napi_register__ProjectGraph_struct_25']?.()
77
+ __napiInstance.exports['__napi_register__HashPlanner_struct_26']?.()
78
+ __napiInstance.exports['__napi_register__HashPlanner_impl_30']?.()
79
+ __napiInstance.exports['__napi_register__HashDetails_struct_31']?.()
80
+ __napiInstance.exports['__napi_register__HasherOptions_struct_32']?.()
81
+ __napiInstance.exports['__napi_register__TaskHasher_struct_33']?.()
82
+ __napiInstance.exports['__napi_register__TaskHasher_impl_36']?.()
83
+ __napiInstance.exports['__napi_register__Task_struct_37']?.()
84
+ __napiInstance.exports['__napi_register__TaskTarget_struct_38']?.()
85
+ __napiInstance.exports['__napi_register__TaskResult_struct_39']?.()
86
+ __napiInstance.exports['__napi_register__TaskGraph_struct_40']?.()
87
+ __napiInstance.exports['__napi_register__FileData_struct_41']?.()
88
+ __napiInstance.exports['__napi_register__InputsInput_struct_42']?.()
89
+ __napiInstance.exports['__napi_register__FileSetInput_struct_43']?.()
90
+ __napiInstance.exports['__napi_register__RuntimeInput_struct_44']?.()
91
+ __napiInstance.exports['__napi_register__EnvironmentInput_struct_45']?.()
92
+ __napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_46']?.()
93
+ __napiInstance.exports['__napi_register__DepsOutputsInput_struct_47']?.()
94
+ __napiInstance.exports['__napi_register__NxJson_struct_48']?.()
95
+ __napiInstance.exports['__napi_register__FileLock_struct_49']?.()
96
+ __napiInstance.exports['__napi_register__FileLock_impl_51']?.()
97
+ __napiInstance.exports['__napi_register__WorkspaceContext_struct_52']?.()
98
+ __napiInstance.exports['__napi_register__WorkspaceContext_impl_63']?.()
99
+ __napiInstance.exports['__napi_register__WorkspaceErrors_64']?.()
100
+ __napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_65']?.()
101
+ __napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_66']?.()
102
+ __napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_67']?.()
103
+ __napiInstance.exports['__napi_register__FileMap_struct_68']?.()
104
+ __napiInstance.exports['__napi_register____test_only_transfer_file_map_69']?.()
101
105
  }
102
106
  export const FileLock = __napiModule.exports.FileLock
103
107
  export const HashPlanner = __napiModule.exports.HashPlanner
104
108
  export const ImportResult = __napiModule.exports.ImportResult
109
+ export const NxConsolePreferences = __napiModule.exports.NxConsolePreferences
105
110
  export const TaskHasher = __napiModule.exports.TaskHasher
106
111
  export const WorkspaceContext = __napiModule.exports.WorkspaceContext
112
+ export const canInstallNxConsole = __napiModule.exports.canInstallNxConsole
107
113
  export const copy = __napiModule.exports.copy
108
114
  export const expandOutputs = __napiModule.exports.expandOutputs
109
115
  export const findImports = __napiModule.exports.findImports
@@ -112,9 +118,10 @@ export const getFilesForOutputs = __napiModule.exports.getFilesForOutputs
112
118
  export const getTransformableOutputs = __napiModule.exports.getTransformableOutputs
113
119
  export const hashArray = __napiModule.exports.hashArray
114
120
  export const hashFile = __napiModule.exports.hashFile
121
+ export const installNxConsole = __napiModule.exports.installNxConsole
115
122
  export const IS_WASM = __napiModule.exports.IS_WASM
123
+ export const logDebug = __napiModule.exports.logDebug
116
124
  export const logError = __napiModule.exports.logError
117
- export const logInfo = __napiModule.exports.logInfo
118
125
  export const remove = __napiModule.exports.remove
119
126
  export const testOnlyTransferFileMap = __napiModule.exports.testOnlyTransferFileMap
120
127
  export const transferProjectGraph = __napiModule.exports.transferProjectGraph
@@ -90,51 +90,57 @@ function __napi_rs_initialize_modules(__napiInstance) {
90
90
  __napiInstance.exports['__napi_register__get_transformable_outputs_5']?.()
91
91
  __napiInstance.exports['__napi_register__hash_array_6']?.()
92
92
  __napiInstance.exports['__napi_register__hash_file_7']?.()
93
- __napiInstance.exports['__napi_register__log_info_8']?.()
94
- __napiInstance.exports['__napi_register__log_error_9']?.()
95
- __napiInstance.exports['__napi_register__IS_WASM_10']?.()
96
- __napiInstance.exports['__napi_register__get_binary_target_11']?.()
97
- __napiInstance.exports['__napi_register__ImportResult_struct_12']?.()
98
- __napiInstance.exports['__napi_register__find_imports_13']?.()
99
- __napiInstance.exports['__napi_register__transfer_project_graph_14']?.()
100
- __napiInstance.exports['__napi_register__ExternalNode_struct_15']?.()
101
- __napiInstance.exports['__napi_register__Target_struct_16']?.()
102
- __napiInstance.exports['__napi_register__Project_struct_17']?.()
103
- __napiInstance.exports['__napi_register__ProjectGraph_struct_18']?.()
104
- __napiInstance.exports['__napi_register__HashPlanner_struct_19']?.()
105
- __napiInstance.exports['__napi_register__HashPlanner_impl_23']?.()
106
- __napiInstance.exports['__napi_register__HashDetails_struct_24']?.()
107
- __napiInstance.exports['__napi_register__HasherOptions_struct_25']?.()
108
- __napiInstance.exports['__napi_register__TaskHasher_struct_26']?.()
109
- __napiInstance.exports['__napi_register__TaskHasher_impl_29']?.()
110
- __napiInstance.exports['__napi_register__Task_struct_30']?.()
111
- __napiInstance.exports['__napi_register__TaskTarget_struct_31']?.()
112
- __napiInstance.exports['__napi_register__TaskResult_struct_32']?.()
113
- __napiInstance.exports['__napi_register__TaskGraph_struct_33']?.()
114
- __napiInstance.exports['__napi_register__FileData_struct_34']?.()
115
- __napiInstance.exports['__napi_register__InputsInput_struct_35']?.()
116
- __napiInstance.exports['__napi_register__FileSetInput_struct_36']?.()
117
- __napiInstance.exports['__napi_register__RuntimeInput_struct_37']?.()
118
- __napiInstance.exports['__napi_register__EnvironmentInput_struct_38']?.()
119
- __napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_39']?.()
120
- __napiInstance.exports['__napi_register__DepsOutputsInput_struct_40']?.()
121
- __napiInstance.exports['__napi_register__NxJson_struct_41']?.()
122
- __napiInstance.exports['__napi_register__FileLock_struct_42']?.()
123
- __napiInstance.exports['__napi_register__FileLock_impl_44']?.()
124
- __napiInstance.exports['__napi_register__WorkspaceContext_struct_45']?.()
125
- __napiInstance.exports['__napi_register__WorkspaceContext_impl_56']?.()
126
- __napiInstance.exports['__napi_register__WorkspaceErrors_57']?.()
127
- __napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_58']?.()
128
- __napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_59']?.()
129
- __napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_60']?.()
130
- __napiInstance.exports['__napi_register__FileMap_struct_61']?.()
131
- __napiInstance.exports['__napi_register____test_only_transfer_file_map_62']?.()
93
+ __napiInstance.exports['__napi_register__can_install_nx_console_8']?.()
94
+ __napiInstance.exports['__napi_register__install_nx_console_9']?.()
95
+ __napiInstance.exports['__napi_register__NxConsolePreferences_struct_10']?.()
96
+ __napiInstance.exports['__napi_register__NxConsolePreferences_impl_14']?.()
97
+ __napiInstance.exports['__napi_register__log_debug_15']?.()
98
+ __napiInstance.exports['__napi_register__log_error_16']?.()
99
+ __napiInstance.exports['__napi_register__IS_WASM_17']?.()
100
+ __napiInstance.exports['__napi_register__get_binary_target_18']?.()
101
+ __napiInstance.exports['__napi_register__ImportResult_struct_19']?.()
102
+ __napiInstance.exports['__napi_register__find_imports_20']?.()
103
+ __napiInstance.exports['__napi_register__transfer_project_graph_21']?.()
104
+ __napiInstance.exports['__napi_register__ExternalNode_struct_22']?.()
105
+ __napiInstance.exports['__napi_register__Target_struct_23']?.()
106
+ __napiInstance.exports['__napi_register__Project_struct_24']?.()
107
+ __napiInstance.exports['__napi_register__ProjectGraph_struct_25']?.()
108
+ __napiInstance.exports['__napi_register__HashPlanner_struct_26']?.()
109
+ __napiInstance.exports['__napi_register__HashPlanner_impl_30']?.()
110
+ __napiInstance.exports['__napi_register__HashDetails_struct_31']?.()
111
+ __napiInstance.exports['__napi_register__HasherOptions_struct_32']?.()
112
+ __napiInstance.exports['__napi_register__TaskHasher_struct_33']?.()
113
+ __napiInstance.exports['__napi_register__TaskHasher_impl_36']?.()
114
+ __napiInstance.exports['__napi_register__Task_struct_37']?.()
115
+ __napiInstance.exports['__napi_register__TaskTarget_struct_38']?.()
116
+ __napiInstance.exports['__napi_register__TaskResult_struct_39']?.()
117
+ __napiInstance.exports['__napi_register__TaskGraph_struct_40']?.()
118
+ __napiInstance.exports['__napi_register__FileData_struct_41']?.()
119
+ __napiInstance.exports['__napi_register__InputsInput_struct_42']?.()
120
+ __napiInstance.exports['__napi_register__FileSetInput_struct_43']?.()
121
+ __napiInstance.exports['__napi_register__RuntimeInput_struct_44']?.()
122
+ __napiInstance.exports['__napi_register__EnvironmentInput_struct_45']?.()
123
+ __napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_46']?.()
124
+ __napiInstance.exports['__napi_register__DepsOutputsInput_struct_47']?.()
125
+ __napiInstance.exports['__napi_register__NxJson_struct_48']?.()
126
+ __napiInstance.exports['__napi_register__FileLock_struct_49']?.()
127
+ __napiInstance.exports['__napi_register__FileLock_impl_51']?.()
128
+ __napiInstance.exports['__napi_register__WorkspaceContext_struct_52']?.()
129
+ __napiInstance.exports['__napi_register__WorkspaceContext_impl_63']?.()
130
+ __napiInstance.exports['__napi_register__WorkspaceErrors_64']?.()
131
+ __napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_65']?.()
132
+ __napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_66']?.()
133
+ __napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_67']?.()
134
+ __napiInstance.exports['__napi_register__FileMap_struct_68']?.()
135
+ __napiInstance.exports['__napi_register____test_only_transfer_file_map_69']?.()
132
136
  }
133
137
  module.exports.FileLock = __napiModule.exports.FileLock
134
138
  module.exports.HashPlanner = __napiModule.exports.HashPlanner
135
139
  module.exports.ImportResult = __napiModule.exports.ImportResult
140
+ module.exports.NxConsolePreferences = __napiModule.exports.NxConsolePreferences
136
141
  module.exports.TaskHasher = __napiModule.exports.TaskHasher
137
142
  module.exports.WorkspaceContext = __napiModule.exports.WorkspaceContext
143
+ module.exports.canInstallNxConsole = __napiModule.exports.canInstallNxConsole
138
144
  module.exports.copy = __napiModule.exports.copy
139
145
  module.exports.expandOutputs = __napiModule.exports.expandOutputs
140
146
  module.exports.findImports = __napiModule.exports.findImports
@@ -143,9 +149,10 @@ module.exports.getFilesForOutputs = __napiModule.exports.getFilesForOutputs
143
149
  module.exports.getTransformableOutputs = __napiModule.exports.getTransformableOutputs
144
150
  module.exports.hashArray = __napiModule.exports.hashArray
145
151
  module.exports.hashFile = __napiModule.exports.hashFile
152
+ module.exports.installNxConsole = __napiModule.exports.installNxConsole
146
153
  module.exports.IS_WASM = __napiModule.exports.IS_WASM
154
+ module.exports.logDebug = __napiModule.exports.logDebug
147
155
  module.exports.logError = __napiModule.exports.logError
148
- module.exports.logInfo = __napiModule.exports.logInfo
149
156
  module.exports.remove = __napiModule.exports.remove
150
157
  module.exports.testOnlyTransferFileMap = __napiModule.exports.testOnlyTransferFileMap
151
158
  module.exports.transferProjectGraph = __napiModule.exports.transferProjectGraph
Binary file
@@ -7,4 +7,4 @@ export declare function getURLifShortenFailed(usesGithub: boolean, githubSlug: s
7
7
  export declare function getNxCloudVersion(apiUrl: string): Promise<string | null>;
8
8
  export declare function removeVersionModifier(versionString: string): string;
9
9
  export declare function versionIsValid(version: string): boolean;
10
- export declare function compareCleanCloudVersions(version1: string, version2: string): number;
10
+ export declare function isOldNxCloudVersion(version: string): boolean;
@@ -6,7 +6,7 @@ exports.getURLifShortenFailed = getURLifShortenFailed;
6
6
  exports.getNxCloudVersion = getNxCloudVersion;
7
7
  exports.removeVersionModifier = removeVersionModifier;
8
8
  exports.versionIsValid = versionIsValid;
9
- exports.compareCleanCloudVersions = compareCleanCloudVersions;
9
+ exports.isOldNxCloudVersion = isOldNxCloudVersion;
10
10
  const logger_1 = require("../../utils/logger");
11
11
  const git_utils_1 = require("../../utils/git-utils");
12
12
  const get_cloud_options_1 = require("./get-cloud-options");
@@ -21,8 +21,7 @@ async function createNxCloudOnboardingURL(onboardingSource, accessToken, usesGit
21
21
  }
22
22
  try {
23
23
  const version = await getNxCloudVersion(apiUrl);
24
- if ((version && compareCleanCloudVersions(version, '2406.11.5') < 0) ||
25
- !version) {
24
+ if (!version || isOldNxCloudVersion(version)) {
26
25
  return apiUrl;
27
26
  }
28
27
  }
@@ -96,7 +95,7 @@ async function getInstallationSupportsGitHub(apiUrl) {
96
95
  }
97
96
  catch (e) {
98
97
  if (process.env.NX_VERBOSE_LOGGING === 'true') {
99
- logger_1.logger.warn(`Failed to access system features. GitHub integration assumed to be disabled.
98
+ logger_1.logger.warn(`Failed to access system features. GitHub integration assumed to be disabled.
100
99
  ${e}`);
101
100
  }
102
101
  return false;
@@ -131,26 +130,28 @@ function versionIsValid(version) {
131
130
  const pattern = /^\d{4}\.\d{2}\.\d+$/;
132
131
  return pattern.test(version);
133
132
  }
134
- function compareCleanCloudVersions(version1, version2) {
135
- const parseVersion = (version) => {
136
- // The format we're using is YYMM.DD.BuildNumber
137
- const parts = version.split('.').map((part) => parseInt(part, 10));
138
- return {
139
- yearMonth: parts[0],
140
- day: parts[1],
141
- buildNumber: parts[2],
142
- };
143
- };
144
- const v1 = parseVersion(version1);
145
- const v2 = parseVersion(version2);
146
- if (v1.yearMonth !== v2.yearMonth) {
147
- return v1.yearMonth > v2.yearMonth ? 1 : -1;
148
- }
149
- if (v1.day !== v2.day) {
150
- return v1.day > v2.day ? 1 : -1;
151
- }
152
- if (v1.buildNumber !== v2.buildNumber) {
153
- return v1.buildNumber > v2.buildNumber ? 1 : -1;
154
- }
155
- return 0;
133
+ function isOldNxCloudVersion(version) {
134
+ const [major, minor, buildNumber] = version
135
+ .split('.')
136
+ .map((part) => parseInt(part, 10));
137
+ // for on-prem images we are using YYYY.MM.BuildNumber format
138
+ // the first year is 2025
139
+ if (major >= 2025 && major < 2300) {
140
+ return false;
141
+ }
142
+ // Previously we used YYMM.DD.BuildNumber
143
+ // All versions before '2406.11.5' had different URL shortening logic
144
+ const newVersionMajor = 2406;
145
+ const newVersionMinor = 11;
146
+ const newVersionBuildNumber = 5;
147
+ if (major !== newVersionMajor) {
148
+ return major < newVersionMajor;
149
+ }
150
+ if (minor !== newVersionMinor) {
151
+ return minor < newVersionMinor;
152
+ }
153
+ if (buildNumber !== newVersionBuildNumber) {
154
+ return buildNumber < newVersionBuildNumber;
155
+ }
156
+ return false;
156
157
  }
@@ -9,6 +9,7 @@ const object_sort_1 = require("../../../utils/object-sort");
9
9
  const project_graph_builder_1 = require("../../../project-graph/project-graph-builder");
10
10
  const project_graph_1 = require("../../../config/project-graph");
11
11
  const file_hasher_1 = require("../../../hasher/file-hasher");
12
+ const project_graph_pruning_1 = require("./project-graph-pruning");
12
13
  // we use key => node map to avoid duplicate work when parsing keys
13
14
  let keyMap = new Map();
14
15
  let currentLockFileHash;
@@ -278,7 +279,7 @@ function parseBaseVersion(rawVersion, isV5) {
278
279
  function stringifyPnpmLockfile(graph, rootLockFileContent, packageJson) {
279
280
  const data = (0, pnpm_normalizer_1.parseAndNormalizePnpmLockfile)(rootLockFileContent);
280
281
  const { lockfileVersion, packages } = data;
281
- const rootSnapshot = mapRootSnapshot(packageJson, packages, graph.externalNodes, +lockfileVersion);
282
+ const rootSnapshot = mapRootSnapshot(packageJson, packages, graph, +lockfileVersion);
282
283
  const snapshots = mapSnapshots(data.packages, graph.externalNodes, +lockfileVersion);
283
284
  const output = {
284
285
  ...data,
@@ -397,7 +398,7 @@ function versionIsAlias(key, versionExpr, lockfileVersion) {
397
398
  ? key.startsWith(`${packageName}/${version}`)
398
399
  : key.startsWith(`${packageName}@${version}`);
399
400
  }
400
- function mapRootSnapshot(packageJson, packages, nodes, lockfileVersion) {
401
+ function mapRootSnapshot(packageJson, packages, graph, lockfileVersion) {
401
402
  const snapshot = { specifiers: {} };
402
403
  [
403
404
  'dependencies',
@@ -408,7 +409,14 @@ function mapRootSnapshot(packageJson, packages, nodes, lockfileVersion) {
408
409
  if (packageJson[depType]) {
409
410
  Object.keys(packageJson[depType]).forEach((packageName) => {
410
411
  const version = packageJson[depType][packageName];
411
- const node = nodes[`npm:${packageName}@${version}`] || nodes[`npm:${packageName}`];
412
+ const node = graph.externalNodes[`npm:${packageName}@${version}`] ||
413
+ (graph.externalNodes[`npm:${packageName}`] &&
414
+ graph.externalNodes[`npm:${packageName}`].data.version === version
415
+ ? graph.externalNodes[`npm:${packageName}`]
416
+ : (0, project_graph_pruning_1.findNodeMatchingVersion)(graph, packageName, version));
417
+ if (!node) {
418
+ throw new Error(`Could not find external node for package ${packageName}@${version}.`);
419
+ }
412
420
  snapshot.specifiers[packageName] = version;
413
421
  // peer dependencies are mapped to dependencies
414
422
  let section = depType === 'peerDependencies' ? 'dependencies' : depType;
@@ -1,7 +1,8 @@
1
- import { ProjectGraph } from '../../../config/project-graph';
1
+ import { ProjectGraph, ProjectGraphExternalNode } from '../../../config/project-graph';
2
2
  import { PackageJson } from '../../../utils/package-json';
3
3
  /**
4
4
  * Prune project graph's external nodes and their dependencies
5
5
  * based on the pruned package.json
6
6
  */
7
7
  export declare function pruneProjectGraph(graph: ProjectGraph, prunedPackageJson: PackageJson): ProjectGraph;
8
+ export declare function findNodeMatchingVersion(graph: ProjectGraph, packageName: string, versionExpr: string): ProjectGraphExternalNode;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.pruneProjectGraph = pruneProjectGraph;
4
+ exports.findNodeMatchingVersion = findNodeMatchingVersion;
4
5
  const semver_1 = require("semver");
5
6
  const project_graph_builder_1 = require("../../../project-graph/project-graph-builder");
6
7
  const operators_1 = require("../../../project-graph/operators");
@@ -92,6 +93,9 @@ function rehoistNodes(graph, packageJsonDeps, builder) {
92
93
  }
93
94
  }
94
95
  });
96
+ if (!packagesToRehoist.size) {
97
+ return;
98
+ }
95
99
  // invert dependencies for easier traversal back
96
100
  const invertedGraph = (0, operators_1.reverse)(builder.graph);
97
101
  const invBuilder = new project_graph_builder_1.ProjectGraphBuilder(invertedGraph, {});
@@ -51,10 +51,13 @@ const getProjectPathsAffectedByDependencyUpdates = (changedLockFile) => {
51
51
  return Array.from(changedProjectPaths);
52
52
  };
53
53
  const getProjectsNamesFromPaths = (projectGraphNodes, projectPaths) => {
54
+ if (!projectPaths.length) {
55
+ return [];
56
+ }
54
57
  const lookup = new RootPathLookup(projectGraphNodes);
55
- return projectPaths.map((path) => {
56
- return lookup.findNodeNameByRoot(path);
57
- });
58
+ return projectPaths
59
+ .map((path) => lookup.findNodeNameByRoot(path))
60
+ .filter(Boolean);
58
61
  };
59
62
  class RootPathLookup {
60
63
  constructor(nodes) {
@@ -90,9 +90,8 @@ class TargetProjectLocator {
90
90
  return externalProject;
91
91
  }
92
92
  if (this.tsConfig.config) {
93
- // TODO(meeroslav): this block is probably obsolete
94
- // and existed only because of the incomplete `paths` matching
95
- // if import cannot be matched using tsconfig `paths` the compilation would fail anyway
93
+ // TODO: this can be removed once we rework resolveImportWithRequire below
94
+ // to properly handle ESM (exports, imports, conditions)
96
95
  const resolvedProject = this.resolveImportWithTypescript(importExpr, filePath);
97
96
  if (resolvedProject) {
98
97
  return resolvedProject;
@@ -256,21 +255,32 @@ class TargetProjectLocator {
256
255
  }
257
256
  resolveImportWithTypescript(normalizedImportExpr, filePath) {
258
257
  let resolvedModule;
259
- if (this.typescriptResolutionCache.has(normalizedImportExpr)) {
260
- resolvedModule = this.typescriptResolutionCache.get(normalizedImportExpr);
258
+ const projectName = (0, find_project_for_path_1.findProjectForPath)(filePath, this.projectRootMappings);
259
+ const cacheScope = projectName
260
+ ? // fall back to the project name if the project root can't be determined
261
+ this.nodes[projectName]?.data?.root || projectName
262
+ : // fall back to the file path if the project can't be determined
263
+ filePath;
264
+ const cacheKey = `${normalizedImportExpr}__${cacheScope}`;
265
+ if (this.typescriptResolutionCache.has(cacheKey)) {
266
+ resolvedModule = this.typescriptResolutionCache.get(cacheKey);
261
267
  }
262
268
  else {
263
269
  resolvedModule = (0, typescript_1.resolveModuleByImport)(normalizedImportExpr, filePath, this.tsConfig.absolutePath);
264
- this.typescriptResolutionCache.set(normalizedImportExpr, resolvedModule ? resolvedModule : null);
270
+ this.typescriptResolutionCache.set(cacheKey, resolvedModule ? resolvedModule : null);
265
271
  }
266
- // TODO: vsavkin temporary workaround. Remove it once we reworking handling of npm packages.
267
- if (resolvedModule && resolvedModule.indexOf('node_modules/') === -1) {
272
+ if (!resolvedModule) {
273
+ return;
274
+ }
275
+ const nodeModulesIndex = resolvedModule.lastIndexOf('node_modules/');
276
+ if (nodeModulesIndex === -1) {
268
277
  const resolvedProject = this.findProjectOfResolvedModule(resolvedModule);
269
- if (resolvedProject) {
270
- return resolvedProject;
271
- }
278
+ return resolvedProject;
272
279
  }
273
- return;
280
+ // strip the node_modules/ prefix from the resolved module path
281
+ const packagePath = resolvedModule.substring(nodeModulesIndex + 'node_modules/'.length);
282
+ const externalProject = this.findNpmProjectFromImport(packagePath, filePath);
283
+ return externalProject;
274
284
  }
275
285
  resolveImportWithRequire(normalizedImportExpr, filePath) {
276
286
  return (0, node_path_1.relative)(workspace_root_1.workspaceRoot, require.resolve(normalizedImportExpr, {
@@ -1,3 +1,4 @@
1
+ import type { TsConfigOptions } from 'ts-node';
1
2
  import type { CompilerOptions } from 'typescript';
2
3
  /**
3
4
  * Optionally, if swc-node and tsconfig-paths are available in the current workspace, apply the require
@@ -23,7 +24,7 @@ export declare function registerTsProject(tsConfigPath: string): () => void;
23
24
  */
24
25
  export declare function registerTsProject(path: string, configFilename: string): any;
25
26
  export declare function getSwcTranspiler(compilerOptions: CompilerOptions): (...args: unknown[]) => unknown;
26
- export declare function getTsNodeTranspiler(compilerOptions: CompilerOptions): (...args: unknown[]) => unknown;
27
+ export declare function getTsNodeTranspiler(compilerOptions: CompilerOptions, tsNodeOptions?: TsConfigOptions): (...args: unknown[]) => unknown;
27
28
  export declare function getTranspiler(compilerOptions: CompilerOptions, tsConfigRaw?: unknown): () => (...args: unknown[]) => unknown;
28
29
  /**
29
30
  * Register ts-node or swc-node given a set of compiler options.
@@ -33,7 +34,7 @@ export declare function getTranspiler(compilerOptions: CompilerOptions, tsConfig
33
34
  *
34
35
  * @returns cleanup method
35
36
  */
36
- export declare function registerTranspiler(compilerOptions: CompilerOptions): () => void;
37
+ export declare function registerTranspiler(compilerOptions: CompilerOptions, tsConfigRaw?: unknown): () => void;
37
38
  /**
38
39
  * @param tsConfigPath Adds the paths from a tsconfig file into node resolutions
39
40
  * @returns cleanup function