nx 21.2.0-canary.20250606-c43d2f2 → 21.2.0-canary.20250611-ec0eda5
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/hasher/hash-plan-inspector.d.ts +25 -0
- package/src/hasher/hash-plan-inspector.js +54 -0
- package/src/native/index.d.ts +16 -3
- package/src/native/native-bindings.js +5 -2
- package/src/native/nx.wasi-browser.js +47 -40
- package/src/native/nx.wasi.cjs +49 -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 +49 -0
- package/src/utils/workspace-context.d.ts +1 -1
- package/src/utils/workspace-context.js +2 -2
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)}]);
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { NxJsonConfiguration } from '../config/nx-json';
|
2
|
+
import { ProjectGraph } from '../config/project-graph';
|
3
|
+
import type { Target } from '../command-line/run/run';
|
4
|
+
import { TargetDependencies } from '../config/nx-json';
|
5
|
+
import { TargetDependencyConfig } from '../config/workspace-json-project-json';
|
6
|
+
export declare class HashPlanInspector {
|
7
|
+
private projectGraph;
|
8
|
+
private readonly workspaceRootPath;
|
9
|
+
private readonly projectGraphRef;
|
10
|
+
private planner;
|
11
|
+
private inspector;
|
12
|
+
private readonly nxJson;
|
13
|
+
constructor(projectGraph: ProjectGraph, workspaceRootPath?: string, nxJson?: NxJsonConfiguration);
|
14
|
+
init(): Promise<void>;
|
15
|
+
/**
|
16
|
+
* This is a lower level method which will inspect the hash plan for a set of tasks.
|
17
|
+
*/
|
18
|
+
inspectHashPlan(projectNames: string[], targets: string[], configuration?: string, overrides?: Object, extraTargetDependencies?: TargetDependencies, excludeTaskDependencies?: boolean): Record<string, string[]>;
|
19
|
+
/**
|
20
|
+
* This inspects tasks involved in the execution of a task, including its dependencies by default.
|
21
|
+
*/
|
22
|
+
inspectTask({ project, target, configuration }: Target, parsedArgs?: {
|
23
|
+
[k: string]: any;
|
24
|
+
}, extraTargetDependencies?: Record<string, (TargetDependencyConfig | string)[]>, excludeTaskDependencies?: boolean): Record<string, string[]>;
|
25
|
+
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.HashPlanInspector = void 0;
|
4
|
+
const native_1 = require("../native");
|
5
|
+
const nx_json_1 = require("../config/nx-json");
|
6
|
+
const transform_objects_1 = require("../native/transform-objects");
|
7
|
+
const workspace_root_1 = require("../utils/workspace-root");
|
8
|
+
const find_project_for_path_1 = require("../project-graph/utils/find-project-for-path");
|
9
|
+
const create_task_graph_1 = require("../tasks-runner/create-task-graph");
|
10
|
+
const command_line_utils_1 = require("../utils/command-line-utils");
|
11
|
+
const workspace_context_1 = require("../utils/workspace-context");
|
12
|
+
class HashPlanInspector {
|
13
|
+
constructor(projectGraph, workspaceRootPath = workspace_root_1.workspaceRoot, nxJson) {
|
14
|
+
this.projectGraph = projectGraph;
|
15
|
+
this.workspaceRootPath = workspaceRootPath;
|
16
|
+
this.nxJson = nxJson ?? (0, nx_json_1.readNxJson)(this.workspaceRootPath);
|
17
|
+
this.projectGraphRef = (0, native_1.transferProjectGraph)((0, transform_objects_1.transformProjectGraphForRust)(this.projectGraph));
|
18
|
+
this.planner = new native_1.HashPlanner(this.nxJson, this.projectGraphRef);
|
19
|
+
}
|
20
|
+
async init() {
|
21
|
+
const projectRootMap = (0, find_project_for_path_1.createProjectRootMappings)(this.projectGraph.nodes);
|
22
|
+
const map = Object.fromEntries(projectRootMap.entries());
|
23
|
+
const { externalReferences } = await (0, workspace_context_1.getNxWorkspaceFilesFromContext)(this.workspaceRootPath, map, false);
|
24
|
+
this.inspector = new native_1.HashPlanInspector(externalReferences.allWorkspaceFiles, this.projectGraphRef, externalReferences.projectFiles);
|
25
|
+
}
|
26
|
+
/**
|
27
|
+
* This is a lower level method which will inspect the hash plan for a set of tasks.
|
28
|
+
*/
|
29
|
+
inspectHashPlan(projectNames, targets, configuration, overrides = {}, extraTargetDependencies = {}, excludeTaskDependencies = false) {
|
30
|
+
const taskGraph = (0, create_task_graph_1.createTaskGraph)(this.projectGraph, extraTargetDependencies, projectNames, targets, configuration, overrides, excludeTaskDependencies);
|
31
|
+
// Generate task IDs for ALL tasks in the task graph (including dependencies)
|
32
|
+
const taskIds = Object.keys(taskGraph.tasks);
|
33
|
+
const plansReference = this.planner.getPlansReference(taskIds, taskGraph);
|
34
|
+
return this.inspector.inspect(plansReference);
|
35
|
+
}
|
36
|
+
/**
|
37
|
+
* This inspects tasks involved in the execution of a task, including its dependencies by default.
|
38
|
+
*/
|
39
|
+
inspectTask({ project, target, configuration }, parsedArgs = {}, extraTargetDependencies = {}, excludeTaskDependencies = false) {
|
40
|
+
// Mirror the exact flow from run-one.ts
|
41
|
+
const { nxArgs, overrides } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)({
|
42
|
+
...parsedArgs,
|
43
|
+
configuration: configuration,
|
44
|
+
targets: [target],
|
45
|
+
}, 'run-one', { printWarnings: false }, this.nxJson);
|
46
|
+
// Create task graph exactly like run-one.ts does via createTaskGraphAndRunValidations
|
47
|
+
const taskGraph = (0, create_task_graph_1.createTaskGraph)(this.projectGraph, extraTargetDependencies, [project], nxArgs.targets, nxArgs.configuration, overrides, excludeTaskDependencies);
|
48
|
+
// Generate task IDs for ALL tasks in the task graph (including dependencies)
|
49
|
+
const taskIds = Object.keys(taskGraph.tasks);
|
50
|
+
const plansReference = this.planner.getPlansReference(taskIds, taskGraph);
|
51
|
+
return this.inspector.inspect(plansReference);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
exports.HashPlanInspector = HashPlanInspector;
|
package/src/native/index.d.ts
CHANGED
@@ -41,6 +41,11 @@ export declare class FileLock {
|
|
41
41
|
lock(): void
|
42
42
|
}
|
43
43
|
|
44
|
+
export declare class HashPlanInspector {
|
45
|
+
constructor(allWorkspaceFiles: ExternalObject<Array<FileData>>, projectGraph: ExternalObject<ProjectGraph>, projectFileMap: ExternalObject<Record<string, Array<FileData>>>)
|
46
|
+
inspect(hashPlans: ExternalObject<Record<string, Array<HashInstruction>>>): Record<string, string[]>
|
47
|
+
}
|
48
|
+
|
44
49
|
export declare class HashPlanner {
|
45
50
|
constructor(nxJson: NxJson, projectGraph: ExternalObject<ProjectGraph>)
|
46
51
|
getPlans(taskIds: Array<string>, taskGraph: TaskGraph): Record<string, string[]>
|
@@ -73,6 +78,12 @@ export declare class NxCache {
|
|
73
78
|
checkCacheFsInSync(): boolean
|
74
79
|
}
|
75
80
|
|
81
|
+
export declare class NxConsolePreferences {
|
82
|
+
constructor(homeDir: string)
|
83
|
+
getAutoInstallPreference(): boolean | null
|
84
|
+
setAutoInstallPreference(autoInstall: boolean): void
|
85
|
+
}
|
86
|
+
|
76
87
|
export declare class NxTaskHistory {
|
77
88
|
constructor(db: ExternalObject<NxDbConnection>)
|
78
89
|
recordTaskRuns(taskRuns: Array<TaskRun>): void
|
@@ -148,6 +159,8 @@ export interface CachedResult {
|
|
148
159
|
size?: number
|
149
160
|
}
|
150
161
|
|
162
|
+
export declare export declare function canInstallNxConsole(): boolean
|
163
|
+
|
151
164
|
export declare export declare function closeDbConnection(connection: ExternalObject<NxDbConnection>): void
|
152
165
|
|
153
166
|
export declare export declare function connectToNxDb(cacheDir: string, nxVersion: string, dbName?: string | undefined | null): ExternalObject<NxDbConnection>
|
@@ -235,11 +248,11 @@ export interface InputsInput {
|
|
235
248
|
projects?: string | Array<string>
|
236
249
|
}
|
237
250
|
|
238
|
-
export
|
251
|
+
export declare export declare function installNxConsole(): void
|
239
252
|
|
240
|
-
export
|
253
|
+
export const IS_WASM: boolean
|
241
254
|
|
242
|
-
export declare export declare function
|
255
|
+
export declare export declare function logDebug(message: string): void
|
243
256
|
|
244
257
|
/** Stripped version of the NxJson interface for use in rust */
|
245
258
|
export interface NxJson {
|
@@ -364,10 +364,12 @@ if (!nativeBinding) {
|
|
364
364
|
module.exports.AppLifeCycle = nativeBinding.AppLifeCycle
|
365
365
|
module.exports.ChildProcess = nativeBinding.ChildProcess
|
366
366
|
module.exports.FileLock = nativeBinding.FileLock
|
367
|
+
module.exports.HashPlanInspector = nativeBinding.HashPlanInspector
|
367
368
|
module.exports.HashPlanner = nativeBinding.HashPlanner
|
368
369
|
module.exports.HttpRemoteCache = nativeBinding.HttpRemoteCache
|
369
370
|
module.exports.ImportResult = nativeBinding.ImportResult
|
370
371
|
module.exports.NxCache = nativeBinding.NxCache
|
372
|
+
module.exports.NxConsolePreferences = nativeBinding.NxConsolePreferences
|
371
373
|
module.exports.NxTaskHistory = nativeBinding.NxTaskHistory
|
372
374
|
module.exports.RunningTasksService = nativeBinding.RunningTasksService
|
373
375
|
module.exports.RustPseudoTerminal = nativeBinding.RustPseudoTerminal
|
@@ -375,6 +377,7 @@ module.exports.TaskDetails = nativeBinding.TaskDetails
|
|
375
377
|
module.exports.TaskHasher = nativeBinding.TaskHasher
|
376
378
|
module.exports.Watcher = nativeBinding.Watcher
|
377
379
|
module.exports.WorkspaceContext = nativeBinding.WorkspaceContext
|
380
|
+
module.exports.canInstallNxConsole = nativeBinding.canInstallNxConsole
|
378
381
|
module.exports.closeDbConnection = nativeBinding.closeDbConnection
|
379
382
|
module.exports.connectToNxDb = nativeBinding.connectToNxDb
|
380
383
|
module.exports.copy = nativeBinding.copy
|
@@ -387,9 +390,9 @@ module.exports.getFilesForOutputs = nativeBinding.getFilesForOutputs
|
|
387
390
|
module.exports.getTransformableOutputs = nativeBinding.getTransformableOutputs
|
388
391
|
module.exports.hashArray = nativeBinding.hashArray
|
389
392
|
module.exports.hashFile = nativeBinding.hashFile
|
393
|
+
module.exports.installNxConsole = nativeBinding.installNxConsole
|
390
394
|
module.exports.IS_WASM = nativeBinding.IS_WASM
|
391
|
-
module.exports.
|
392
|
-
module.exports.logInfo = nativeBinding.logInfo
|
395
|
+
module.exports.logDebug = nativeBinding.logDebug
|
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['
|
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,59 @@ 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__HashPlanInspector_struct_25']?.()
|
108
|
+
__napiInstance.exports['__napi_register__HashPlanInspector_impl_28']?.()
|
109
|
+
__napiInstance.exports['__napi_register__HashPlanner_struct_29']?.()
|
110
|
+
__napiInstance.exports['__napi_register__HashPlanner_impl_33']?.()
|
111
|
+
__napiInstance.exports['__napi_register__HashDetails_struct_34']?.()
|
112
|
+
__napiInstance.exports['__napi_register__HasherOptions_struct_35']?.()
|
113
|
+
__napiInstance.exports['__napi_register__TaskHasher_struct_36']?.()
|
114
|
+
__napiInstance.exports['__napi_register__TaskHasher_impl_39']?.()
|
115
|
+
__napiInstance.exports['__napi_register__Task_struct_40']?.()
|
116
|
+
__napiInstance.exports['__napi_register__TaskTarget_struct_41']?.()
|
117
|
+
__napiInstance.exports['__napi_register__TaskResult_struct_42']?.()
|
118
|
+
__napiInstance.exports['__napi_register__TaskGraph_struct_43']?.()
|
119
|
+
__napiInstance.exports['__napi_register__FileData_struct_44']?.()
|
120
|
+
__napiInstance.exports['__napi_register__InputsInput_struct_45']?.()
|
121
|
+
__napiInstance.exports['__napi_register__FileSetInput_struct_46']?.()
|
122
|
+
__napiInstance.exports['__napi_register__RuntimeInput_struct_47']?.()
|
123
|
+
__napiInstance.exports['__napi_register__EnvironmentInput_struct_48']?.()
|
124
|
+
__napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_49']?.()
|
125
|
+
__napiInstance.exports['__napi_register__DepsOutputsInput_struct_50']?.()
|
126
|
+
__napiInstance.exports['__napi_register__NxJson_struct_51']?.()
|
127
|
+
__napiInstance.exports['__napi_register__FileLock_struct_52']?.()
|
128
|
+
__napiInstance.exports['__napi_register__FileLock_impl_54']?.()
|
129
|
+
__napiInstance.exports['__napi_register__WorkspaceContext_struct_55']?.()
|
130
|
+
__napiInstance.exports['__napi_register__WorkspaceContext_impl_66']?.()
|
131
|
+
__napiInstance.exports['__napi_register__WorkspaceErrors_67']?.()
|
132
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_68']?.()
|
133
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_69']?.()
|
134
|
+
__napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_70']?.()
|
135
|
+
__napiInstance.exports['__napi_register__FileMap_struct_71']?.()
|
136
|
+
__napiInstance.exports['__napi_register____test_only_transfer_file_map_72']?.()
|
132
137
|
}
|
133
138
|
module.exports.FileLock = __napiModule.exports.FileLock
|
139
|
+
module.exports.HashPlanInspector = __napiModule.exports.HashPlanInspector
|
134
140
|
module.exports.HashPlanner = __napiModule.exports.HashPlanner
|
135
141
|
module.exports.ImportResult = __napiModule.exports.ImportResult
|
142
|
+
module.exports.NxConsolePreferences = __napiModule.exports.NxConsolePreferences
|
136
143
|
module.exports.TaskHasher = __napiModule.exports.TaskHasher
|
137
144
|
module.exports.WorkspaceContext = __napiModule.exports.WorkspaceContext
|
145
|
+
module.exports.canInstallNxConsole = __napiModule.exports.canInstallNxConsole
|
138
146
|
module.exports.copy = __napiModule.exports.copy
|
139
147
|
module.exports.expandOutputs = __napiModule.exports.expandOutputs
|
140
148
|
module.exports.findImports = __napiModule.exports.findImports
|
@@ -143,9 +151,9 @@ module.exports.getFilesForOutputs = __napiModule.exports.getFilesForOutputs
|
|
143
151
|
module.exports.getTransformableOutputs = __napiModule.exports.getTransformableOutputs
|
144
152
|
module.exports.hashArray = __napiModule.exports.hashArray
|
145
153
|
module.exports.hashFile = __napiModule.exports.hashFile
|
154
|
+
module.exports.installNxConsole = __napiModule.exports.installNxConsole
|
146
155
|
module.exports.IS_WASM = __napiModule.exports.IS_WASM
|
147
|
-
module.exports.
|
148
|
-
module.exports.logInfo = __napiModule.exports.logInfo
|
156
|
+
module.exports.logDebug = __napiModule.exports.logDebug
|
149
157
|
module.exports.remove = __napiModule.exports.remove
|
150
158
|
module.exports.testOnlyTransferFileMap = __napiModule.exports.testOnlyTransferFileMap
|
151
159
|
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,49 @@
|
|
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: "Install Nx's official editor extension to:",
|
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
|
+
],
|
37
|
+
});
|
38
|
+
const { shouldInstallNxConsole } = await (0, enquirer_1.prompt)({
|
39
|
+
type: 'confirm',
|
40
|
+
name: 'shouldInstallNxConsole',
|
41
|
+
message: 'Install Nx Console? (you can uninstall anytime)',
|
42
|
+
initial: true,
|
43
|
+
});
|
44
|
+
return shouldInstallNxConsole;
|
45
|
+
}
|
46
|
+
catch (error) {
|
47
|
+
return false;
|
48
|
+
}
|
49
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { NxWorkspaceFilesExternals } from '../native';
|
2
2
|
export declare function setupWorkspaceContext(workspaceRoot: string): void;
|
3
|
-
export declare function getNxWorkspaceFilesFromContext(workspaceRoot: string, projectRootMap: Record<string, string
|
3
|
+
export declare function getNxWorkspaceFilesFromContext(workspaceRoot: string, projectRootMap: Record<string, string>, useDaemonProcess?: boolean): Promise<import("../native").NxWorkspaceFiles>;
|
4
4
|
/**
|
5
5
|
* Sync method to get files matching globs from workspace context.
|
6
6
|
* NOTE: This method will create the workspace context if it doesn't exist.
|
@@ -25,8 +25,8 @@ function setupWorkspaceContext(workspaceRoot) {
|
|
25
25
|
perf_hooks_1.performance.mark('workspace-context:end');
|
26
26
|
perf_hooks_1.performance.measure('workspace context init', 'workspace-context', 'workspace-context:end');
|
27
27
|
}
|
28
|
-
async function getNxWorkspaceFilesFromContext(workspaceRoot, projectRootMap) {
|
29
|
-
if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
28
|
+
async function getNxWorkspaceFilesFromContext(workspaceRoot, projectRootMap, useDaemonProcess = true) {
|
29
|
+
if (!useDaemonProcess || (0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
30
30
|
ensureContextAvailable(workspaceRoot);
|
31
31
|
return workspaceContext.getWorkspaceFiles(projectRootMap);
|
32
32
|
}
|