nx 21.2.0-canary.20250606-c43d2f2 → 21.2.0-canary.20250610-c8ff339
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/init-local.d.ts +1 -1
- package/bin/init-local.js +7 -1
- package/bin/nx.js +9 -6
- package/package.json +11 -11
- package/src/command-line/release/changelog.js +15 -5
- package/src/command-line/release/version/release-group-processor.js +1 -1
- package/src/command-line/release/version/topological-sort.js +1 -1
- package/src/command-line/report/report.js +1 -1
- package/src/command-line/run/run-one.d.ts +10 -0
- package/src/command-line/run/run-one.js +16 -5
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/styles.js +1 -1
- package/src/native/index.d.ts +11 -3
- package/src/native/native-bindings.js +4 -2
- package/src/native/nx.wasi-browser.js +47 -40
- package/src/native/nx.wasi.cjs +46 -41
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/plugins/js/lock-file/pnpm-parser.js +11 -3
- package/src/plugins/js/lock-file/project-graph-pruning.d.ts +2 -1
- package/src/plugins/js/lock-file/project-graph-pruning.js +4 -0
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +22 -12
- package/src/tasks-runner/run-command.js +2 -2
- package/src/utils/nx-console-prompt.d.ts +1 -0
- package/src/utils/nx-console-prompt.js +50 -0
package/src/core/graph/styles.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[869],{
|
1
|
+
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[869],{5873:()=>{}},s=>{var e;e=5873,s(s.s=e)}]);
|
package/src/native/index.d.ts
CHANGED
@@ -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,11 @@ export interface InputsInput {
|
|
235
243
|
projects?: string | Array<string>
|
236
244
|
}
|
237
245
|
|
238
|
-
export
|
246
|
+
export declare export declare function installNxConsole(): void
|
239
247
|
|
240
|
-
export
|
248
|
+
export const IS_WASM: boolean
|
241
249
|
|
242
|
-
export declare export declare function
|
250
|
+
export declare export declare function logDebug(message: string): void
|
243
251
|
|
244
252
|
/** Stripped version of the NxJson interface for use in rust */
|
245
253
|
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,9 @@ 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
|
391
|
-
module.exports.
|
392
|
-
module.exports.logInfo = nativeBinding.logInfo
|
394
|
+
module.exports.logDebug = nativeBinding.logDebug
|
393
395
|
module.exports.parseTaskStatus = nativeBinding.parseTaskStatus
|
394
396
|
module.exports.remove = nativeBinding.remove
|
395
397
|
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['
|
63
|
-
__napiInstance.exports['
|
64
|
-
__napiInstance.exports['
|
65
|
-
__napiInstance.exports['
|
66
|
-
__napiInstance.exports['
|
67
|
-
__napiInstance.exports['
|
68
|
-
__napiInstance.exports['
|
69
|
-
__napiInstance.exports['
|
70
|
-
__napiInstance.exports['
|
71
|
-
__napiInstance.exports['
|
72
|
-
__napiInstance.exports['
|
73
|
-
__napiInstance.exports['
|
74
|
-
__napiInstance.exports['
|
75
|
-
__napiInstance.exports['
|
76
|
-
__napiInstance.exports['
|
77
|
-
__napiInstance.exports['
|
78
|
-
__napiInstance.exports['
|
79
|
-
__napiInstance.exports['
|
80
|
-
__napiInstance.exports['
|
81
|
-
__napiInstance.exports['
|
82
|
-
__napiInstance.exports['
|
83
|
-
__napiInstance.exports['
|
84
|
-
__napiInstance.exports['
|
85
|
-
__napiInstance.exports['
|
86
|
-
__napiInstance.exports['
|
87
|
-
__napiInstance.exports['
|
88
|
-
__napiInstance.exports['
|
89
|
-
__napiInstance.exports['
|
90
|
-
__napiInstance.exports['
|
91
|
-
__napiInstance.exports['
|
92
|
-
__napiInstance.exports['
|
93
|
-
__napiInstance.exports['
|
94
|
-
__napiInstance.exports['
|
95
|
-
__napiInstance.exports['
|
96
|
-
__napiInstance.exports['
|
97
|
-
__napiInstance.exports['
|
98
|
-
__napiInstance.exports['
|
99
|
-
__napiInstance.exports['
|
100
|
-
__napiInstance.exports['
|
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
|
package/src/native/nx.wasi.cjs
CHANGED
@@ -90,51 +90,56 @@ 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['
|
94
|
-
__napiInstance.exports['
|
95
|
-
__napiInstance.exports['
|
96
|
-
__napiInstance.exports['
|
97
|
-
__napiInstance.exports['
|
98
|
-
__napiInstance.exports['
|
99
|
-
__napiInstance.exports['
|
100
|
-
__napiInstance.exports['
|
101
|
-
__napiInstance.exports['
|
102
|
-
__napiInstance.exports['
|
103
|
-
__napiInstance.exports['
|
104
|
-
__napiInstance.exports['
|
105
|
-
__napiInstance.exports['
|
106
|
-
__napiInstance.exports['
|
107
|
-
__napiInstance.exports['
|
108
|
-
__napiInstance.exports['
|
109
|
-
__napiInstance.exports['
|
110
|
-
__napiInstance.exports['
|
111
|
-
__napiInstance.exports['
|
112
|
-
__napiInstance.exports['
|
113
|
-
__napiInstance.exports['
|
114
|
-
__napiInstance.exports['
|
115
|
-
__napiInstance.exports['
|
116
|
-
__napiInstance.exports['
|
117
|
-
__napiInstance.exports['
|
118
|
-
__napiInstance.exports['
|
119
|
-
__napiInstance.exports['
|
120
|
-
__napiInstance.exports['
|
121
|
-
__napiInstance.exports['
|
122
|
-
__napiInstance.exports['
|
123
|
-
__napiInstance.exports['
|
124
|
-
__napiInstance.exports['
|
125
|
-
__napiInstance.exports['
|
126
|
-
__napiInstance.exports['
|
127
|
-
__napiInstance.exports['
|
128
|
-
__napiInstance.exports['
|
129
|
-
__napiInstance.exports['
|
130
|
-
__napiInstance.exports['
|
131
|
-
__napiInstance.exports['
|
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__IS_WASM_16']?.()
|
99
|
+
__napiInstance.exports['__napi_register__get_binary_target_17']?.()
|
100
|
+
__napiInstance.exports['__napi_register__ImportResult_struct_18']?.()
|
101
|
+
__napiInstance.exports['__napi_register__find_imports_19']?.()
|
102
|
+
__napiInstance.exports['__napi_register__transfer_project_graph_20']?.()
|
103
|
+
__napiInstance.exports['__napi_register__ExternalNode_struct_21']?.()
|
104
|
+
__napiInstance.exports['__napi_register__Target_struct_22']?.()
|
105
|
+
__napiInstance.exports['__napi_register__Project_struct_23']?.()
|
106
|
+
__napiInstance.exports['__napi_register__ProjectGraph_struct_24']?.()
|
107
|
+
__napiInstance.exports['__napi_register__HashPlanner_struct_25']?.()
|
108
|
+
__napiInstance.exports['__napi_register__HashPlanner_impl_29']?.()
|
109
|
+
__napiInstance.exports['__napi_register__HashDetails_struct_30']?.()
|
110
|
+
__napiInstance.exports['__napi_register__HasherOptions_struct_31']?.()
|
111
|
+
__napiInstance.exports['__napi_register__TaskHasher_struct_32']?.()
|
112
|
+
__napiInstance.exports['__napi_register__TaskHasher_impl_35']?.()
|
113
|
+
__napiInstance.exports['__napi_register__Task_struct_36']?.()
|
114
|
+
__napiInstance.exports['__napi_register__TaskTarget_struct_37']?.()
|
115
|
+
__napiInstance.exports['__napi_register__TaskResult_struct_38']?.()
|
116
|
+
__napiInstance.exports['__napi_register__TaskGraph_struct_39']?.()
|
117
|
+
__napiInstance.exports['__napi_register__FileData_struct_40']?.()
|
118
|
+
__napiInstance.exports['__napi_register__InputsInput_struct_41']?.()
|
119
|
+
__napiInstance.exports['__napi_register__FileSetInput_struct_42']?.()
|
120
|
+
__napiInstance.exports['__napi_register__RuntimeInput_struct_43']?.()
|
121
|
+
__napiInstance.exports['__napi_register__EnvironmentInput_struct_44']?.()
|
122
|
+
__napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_45']?.()
|
123
|
+
__napiInstance.exports['__napi_register__DepsOutputsInput_struct_46']?.()
|
124
|
+
__napiInstance.exports['__napi_register__NxJson_struct_47']?.()
|
125
|
+
__napiInstance.exports['__napi_register__FileLock_struct_48']?.()
|
126
|
+
__napiInstance.exports['__napi_register__FileLock_impl_50']?.()
|
127
|
+
__napiInstance.exports['__napi_register__WorkspaceContext_struct_51']?.()
|
128
|
+
__napiInstance.exports['__napi_register__WorkspaceContext_impl_62']?.()
|
129
|
+
__napiInstance.exports['__napi_register__WorkspaceErrors_63']?.()
|
130
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_64']?.()
|
131
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_65']?.()
|
132
|
+
__napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_66']?.()
|
133
|
+
__napiInstance.exports['__napi_register__FileMap_struct_67']?.()
|
134
|
+
__napiInstance.exports['__napi_register____test_only_transfer_file_map_68']?.()
|
132
135
|
}
|
133
136
|
module.exports.FileLock = __napiModule.exports.FileLock
|
134
137
|
module.exports.HashPlanner = __napiModule.exports.HashPlanner
|
135
138
|
module.exports.ImportResult = __napiModule.exports.ImportResult
|
139
|
+
module.exports.NxConsolePreferences = __napiModule.exports.NxConsolePreferences
|
136
140
|
module.exports.TaskHasher = __napiModule.exports.TaskHasher
|
137
141
|
module.exports.WorkspaceContext = __napiModule.exports.WorkspaceContext
|
142
|
+
module.exports.canInstallNxConsole = __napiModule.exports.canInstallNxConsole
|
138
143
|
module.exports.copy = __napiModule.exports.copy
|
139
144
|
module.exports.expandOutputs = __napiModule.exports.expandOutputs
|
140
145
|
module.exports.findImports = __napiModule.exports.findImports
|
@@ -143,9 +148,9 @@ module.exports.getFilesForOutputs = __napiModule.exports.getFilesForOutputs
|
|
143
148
|
module.exports.getTransformableOutputs = __napiModule.exports.getTransformableOutputs
|
144
149
|
module.exports.hashArray = __napiModule.exports.hashArray
|
145
150
|
module.exports.hashFile = __napiModule.exports.hashFile
|
151
|
+
module.exports.installNxConsole = __napiModule.exports.installNxConsole
|
146
152
|
module.exports.IS_WASM = __napiModule.exports.IS_WASM
|
147
|
-
module.exports.
|
148
|
-
module.exports.logInfo = __napiModule.exports.logInfo
|
153
|
+
module.exports.logDebug = __napiModule.exports.logDebug
|
149
154
|
module.exports.remove = __napiModule.exports.remove
|
150
155
|
module.exports.testOnlyTransferFileMap = __napiModule.exports.testOnlyTransferFileMap
|
151
156
|
module.exports.transferProjectGraph = __napiModule.exports.transferProjectGraph
|
Binary file
|
@@ -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
|
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,
|
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 =
|
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, {});
|
@@ -90,9 +90,8 @@ class TargetProjectLocator {
|
|
90
90
|
return externalProject;
|
91
91
|
}
|
92
92
|
if (this.tsConfig.config) {
|
93
|
-
// TODO
|
94
|
-
//
|
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
|
-
|
260
|
-
|
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(
|
270
|
+
this.typescriptResolutionCache.set(cacheKey, resolvedModule ? resolvedModule : null);
|
265
271
|
}
|
266
|
-
|
267
|
-
|
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
|
-
|
270
|
-
return resolvedProject;
|
271
|
-
}
|
278
|
+
return resolvedProject;
|
272
279
|
}
|
273
|
-
|
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, {
|
@@ -137,12 +137,12 @@ async function getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, pr
|
|
137
137
|
// @ts-ignore
|
138
138
|
return (chunk, encoding, callback) => {
|
139
139
|
if (isError) {
|
140
|
-
(0, native_1.
|
140
|
+
(0, native_1.logDebug)(Buffer.isBuffer(chunk)
|
141
141
|
? chunk.toString(encoding)
|
142
142
|
: chunk.toString());
|
143
143
|
}
|
144
144
|
else {
|
145
|
-
(0, native_1.
|
145
|
+
(0, native_1.logDebug)(Buffer.isBuffer(chunk)
|
146
146
|
? chunk.toString(encoding)
|
147
147
|
: chunk.toString());
|
148
148
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function ensureNxConsoleInstalled(): Promise<void>;
|
@@ -0,0 +1,50 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ensureNxConsoleInstalled = ensureNxConsoleInstalled;
|
4
|
+
const enquirer_1 = require("enquirer");
|
5
|
+
const os_1 = require("os");
|
6
|
+
const output_1 = require("./output");
|
7
|
+
const native_1 = require("../native");
|
8
|
+
async function ensureNxConsoleInstalled() {
|
9
|
+
const preferences = new native_1.NxConsolePreferences((0, os_1.homedir)());
|
10
|
+
let setting = preferences.getAutoInstallPreference();
|
11
|
+
const canInstallConsole = (0, native_1.canInstallNxConsole)();
|
12
|
+
// Noop
|
13
|
+
if (!canInstallConsole) {
|
14
|
+
return;
|
15
|
+
}
|
16
|
+
if (typeof setting !== 'boolean') {
|
17
|
+
setting = await promptForNxConsoleInstallation();
|
18
|
+
preferences.setAutoInstallPreference(setting);
|
19
|
+
}
|
20
|
+
if (setting) {
|
21
|
+
(0, native_1.installNxConsole)();
|
22
|
+
}
|
23
|
+
}
|
24
|
+
/**
|
25
|
+
* Prompts the user whether they want to automatically install the Nx Console extension
|
26
|
+
* and persists their preference using the NxConsolePreferences struct
|
27
|
+
*/
|
28
|
+
async function promptForNxConsoleInstallation() {
|
29
|
+
try {
|
30
|
+
output_1.output.log({
|
31
|
+
title: "Enhance your developer experience with Nx Console, Nx's official editor extension",
|
32
|
+
bodyLines: [
|
33
|
+
'- Enable your AI assistant to do more by understanding your workspace',
|
34
|
+
'- Add IntelliSense for Nx configuration files',
|
35
|
+
'- Explore your workspace visually',
|
36
|
+
'- Generate code and execute tasks interactively',
|
37
|
+
],
|
38
|
+
});
|
39
|
+
const { shouldInstallNxConsole } = await (0, enquirer_1.prompt)({
|
40
|
+
type: 'confirm',
|
41
|
+
name: 'shouldInstallNxConsole',
|
42
|
+
message: 'Install Nx Console? (you can uninstall anytime)',
|
43
|
+
initial: true,
|
44
|
+
});
|
45
|
+
return shouldInstallNxConsole;
|
46
|
+
}
|
47
|
+
catch (error) {
|
48
|
+
return false;
|
49
|
+
}
|
50
|
+
}
|