nx 22.3.2 → 22.4.0-beta.0
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/executors.json +16 -16
- package/generators.json +13 -13
- package/migrations.json +138 -138
- package/package.json +14 -11
- package/presets/npm.json +4 -4
- package/schemas/nx-schema.json +1289 -1289
- package/schemas/project-schema.json +359 -359
- package/schemas/workspace-schema.json +165 -165
- package/src/ai/set-up-ai-agents/schema.json +31 -31
- package/src/command-line/graph/graph.d.ts.map +1 -1
- package/src/command-line/graph/graph.js +90 -57
- package/src/command-line/watch/watch.d.ts.map +1 -1
- package/src/command-line/watch/watch.js +22 -6
- package/src/config/nx-json.d.ts +5 -0
- package/src/config/nx-json.d.ts.map +1 -1
- package/src/daemon/cache.d.ts.map +1 -1
- package/src/daemon/cache.js +9 -3
- package/src/daemon/client/client.d.ts +20 -3
- package/src/daemon/client/client.d.ts.map +1 -1
- package/src/daemon/client/client.js +410 -81
- package/src/daemon/client/daemon-socket-messenger.d.ts +5 -2
- package/src/daemon/client/daemon-socket-messenger.d.ts.map +1 -1
- package/src/daemon/client/daemon-socket-messenger.js +28 -6
- package/src/daemon/logger.d.ts +26 -0
- package/src/daemon/logger.d.ts.map +1 -0
- package/src/daemon/logger.js +65 -0
- package/src/daemon/server/file-watching/file-change-events.js +1 -1
- package/src/daemon/server/handle-process-in-background.js +1 -1
- package/src/daemon/server/handle-request-project-graph.js +1 -1
- package/src/daemon/server/nx-console-operations.js +1 -1
- package/src/daemon/server/project-graph-incremental-recomputation.d.ts +1 -1
- package/src/daemon/server/project-graph-incremental-recomputation.d.ts.map +1 -1
- package/src/daemon/server/project-graph-incremental-recomputation.js +7 -7
- package/src/daemon/server/project-graph-listener-sockets.d.ts +1 -1
- package/src/daemon/server/project-graph-listener-sockets.d.ts.map +1 -1
- package/src/daemon/server/project-graph-listener-sockets.js +2 -2
- package/src/daemon/server/server.d.ts.map +1 -1
- package/src/daemon/server/server.js +34 -18
- package/src/daemon/server/shutdown-utils.d.ts +1 -0
- package/src/daemon/server/shutdown-utils.d.ts.map +1 -1
- package/src/daemon/server/shutdown-utils.js +52 -1
- package/src/daemon/server/sync-generators.js +1 -1
- package/src/executors/noop/schema.json +8 -8
- package/src/executors/run-commands/schema.json +187 -187
- package/src/executors/run-script/schema.json +25 -25
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/schema.json +38 -38
- package/src/project-graph/nx-deps-cache.js +1 -1
- package/src/daemon/server/logger.d.ts +0 -19
- package/src/daemon/server/logger.d.ts.map +0 -1
- package/src/daemon/server/logger.js +0 -38
|
@@ -1,185 +1,185 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://nx.dev",
|
|
4
|
+
"title": "JSON schema for Nx workspaces",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"version": {
|
|
8
|
+
"type": "number",
|
|
9
|
+
"enum": [1, 2]
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"allOf": [
|
|
13
|
+
{
|
|
14
|
+
"if": {
|
|
15
|
+
"properties": { "version": { "const": 2 } },
|
|
16
|
+
"required": ["version"]
|
|
17
|
+
},
|
|
18
|
+
"then": {
|
|
19
|
+
"properties": {
|
|
20
|
+
"projects": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"additionalProperties": {
|
|
23
|
+
"oneOf": [
|
|
24
|
+
{
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"type": "object",
|
|
29
|
+
"properties": {
|
|
30
|
+
"targets": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"description": "Configures all the targets which define what tasks you can run against the project",
|
|
33
|
+
"additionalProperties": {
|
|
21
34
|
"type": "object",
|
|
22
|
-
"
|
|
23
|
-
|
|
35
|
+
"properties": {
|
|
36
|
+
"executor": {
|
|
37
|
+
"description": "The function that Nx will invoke when you run this target",
|
|
38
|
+
"type": "string"
|
|
39
|
+
},
|
|
40
|
+
"options": {
|
|
41
|
+
"type": "object"
|
|
42
|
+
},
|
|
43
|
+
"outputs": {
|
|
44
|
+
"type": "array",
|
|
45
|
+
"items": {
|
|
46
|
+
"type": "string"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"configurations": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"description": "provides extra sets of values that will be merged into the options map",
|
|
52
|
+
"additionalProperties": {
|
|
53
|
+
"type": "object"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"dependsOn": {
|
|
57
|
+
"type": "array",
|
|
58
|
+
"description": "Target dependency.",
|
|
59
|
+
"items": {
|
|
60
|
+
"oneOf": [
|
|
24
61
|
{
|
|
25
|
-
|
|
62
|
+
"type": "string"
|
|
26
63
|
},
|
|
27
64
|
{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"properties": {
|
|
36
|
-
"executor": {
|
|
37
|
-
"description": "The function that Nx will invoke when you run this target",
|
|
38
|
-
"type": "string"
|
|
39
|
-
},
|
|
40
|
-
"options": {
|
|
41
|
-
"type": "object"
|
|
42
|
-
},
|
|
43
|
-
"outputs": {
|
|
44
|
-
"type": "array",
|
|
45
|
-
"items": {
|
|
46
|
-
"type": "string"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
"configurations": {
|
|
50
|
-
"type": "object",
|
|
51
|
-
"description": "provides extra sets of values that will be merged into the options map",
|
|
52
|
-
"additionalProperties": {
|
|
53
|
-
"type": "object"
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
"dependsOn": {
|
|
57
|
-
"type": "array",
|
|
58
|
-
"description": "Target dependency.",
|
|
59
|
-
"items": {
|
|
60
|
-
"oneOf": [
|
|
61
|
-
{
|
|
62
|
-
"type": "string"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"type": "object",
|
|
66
|
-
"properties": {
|
|
67
|
-
"projects": {
|
|
68
|
-
"oneOf": [
|
|
69
|
-
{
|
|
70
|
-
"type": "string",
|
|
71
|
-
"description": "A project name"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"type": "array",
|
|
75
|
-
"description": "An array of project names",
|
|
76
|
-
"items": {
|
|
77
|
-
"type": "string"
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
]
|
|
81
|
-
},
|
|
82
|
-
"dependencies": {
|
|
83
|
-
"type": "boolean"
|
|
84
|
-
},
|
|
85
|
-
"target": {
|
|
86
|
-
"type": "string",
|
|
87
|
-
"description": "The name of the target."
|
|
88
|
-
},
|
|
89
|
-
"params": {
|
|
90
|
-
"type": "string",
|
|
91
|
-
"description": "Configuration for params handling.",
|
|
92
|
-
"enum": ["ignore", "forward"],
|
|
93
|
-
"default": "ignore"
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
"oneOf": [
|
|
97
|
-
{
|
|
98
|
-
"required": ["projects", "target"]
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"required": ["dependencies", "target"]
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"required": ["target"],
|
|
105
|
-
"not": {
|
|
106
|
-
"anyOf": [
|
|
107
|
-
{ "required": ["projects"] },
|
|
108
|
-
{ "required": ["dependencies"] }
|
|
109
|
-
]
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
],
|
|
113
|
-
"additionalProperties": false
|
|
114
|
-
}
|
|
115
|
-
]
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
"command": {
|
|
119
|
-
"type": "string",
|
|
120
|
-
"description": "A shorthand for using the nx:run-commands executor"
|
|
121
|
-
},
|
|
122
|
-
"cache": {
|
|
123
|
-
"type": "boolean",
|
|
124
|
-
"description": "Specifies if the given target should be cacheable"
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
"tags": {
|
|
130
|
-
"type": "array",
|
|
131
|
-
"items": {
|
|
132
|
-
"type": "string"
|
|
133
|
-
}
|
|
65
|
+
"type": "object",
|
|
66
|
+
"properties": {
|
|
67
|
+
"projects": {
|
|
68
|
+
"oneOf": [
|
|
69
|
+
{
|
|
70
|
+
"type": "string",
|
|
71
|
+
"description": "A project name"
|
|
134
72
|
},
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
73
|
+
{
|
|
74
|
+
"type": "array",
|
|
75
|
+
"description": "An array of project names",
|
|
76
|
+
"items": {
|
|
77
|
+
"type": "string"
|
|
78
|
+
}
|
|
140
79
|
}
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
"dependencies": {
|
|
83
|
+
"type": "boolean"
|
|
84
|
+
},
|
|
85
|
+
"target": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"description": "The name of the target."
|
|
88
|
+
},
|
|
89
|
+
"params": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"description": "Configuration for params handling.",
|
|
92
|
+
"enum": ["ignore", "forward"],
|
|
93
|
+
"default": "ignore"
|
|
141
94
|
}
|
|
95
|
+
},
|
|
96
|
+
"oneOf": [
|
|
97
|
+
{
|
|
98
|
+
"required": ["projects", "target"]
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"required": ["dependencies", "target"]
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"required": ["target"],
|
|
105
|
+
"not": {
|
|
106
|
+
"anyOf": [
|
|
107
|
+
{ "required": ["projects"] },
|
|
108
|
+
{ "required": ["dependencies"] }
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
"additionalProperties": false
|
|
142
114
|
}
|
|
143
|
-
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"command": {
|
|
119
|
+
"type": "string",
|
|
120
|
+
"description": "A shorthand for using the nx:run-commands executor"
|
|
121
|
+
},
|
|
122
|
+
"cache": {
|
|
123
|
+
"type": "boolean",
|
|
124
|
+
"description": "Specifies if the given target should be cacheable"
|
|
125
|
+
}
|
|
144
126
|
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"tags": {
|
|
130
|
+
"type": "array",
|
|
131
|
+
"items": {
|
|
132
|
+
"type": "string"
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"implicitDependencies": {
|
|
136
|
+
"type": "array",
|
|
137
|
+
"items": {
|
|
138
|
+
"type": "string"
|
|
139
|
+
}
|
|
145
140
|
}
|
|
141
|
+
}
|
|
146
142
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"else": {
|
|
149
|
+
"properties": {
|
|
150
|
+
"projects": {
|
|
151
|
+
"type": "object",
|
|
152
|
+
"additionalProperties": {
|
|
153
|
+
"type": "object",
|
|
154
|
+
"properties": {
|
|
155
|
+
"architect": {
|
|
156
|
+
"type": "object",
|
|
157
|
+
"description": "Configures all the targets which define what tasks you can run against the project",
|
|
158
|
+
"additionalProperties": {
|
|
159
|
+
"type": "object",
|
|
160
|
+
"properties": {
|
|
161
|
+
"builder": {
|
|
162
|
+
"description": "The function that Nx will invoke when you run this architect",
|
|
163
|
+
"type": "string"
|
|
164
|
+
},
|
|
165
|
+
"options": {
|
|
166
|
+
"type": "object"
|
|
167
|
+
},
|
|
168
|
+
"configurations": {
|
|
151
169
|
"type": "object",
|
|
170
|
+
"description": "provides extra sets of values that will be merged into the options map",
|
|
152
171
|
"additionalProperties": {
|
|
153
|
-
|
|
154
|
-
"properties": {
|
|
155
|
-
"architect": {
|
|
156
|
-
"type": "object",
|
|
157
|
-
"description": "Configures all the targets which define what tasks you can run against the project",
|
|
158
|
-
"additionalProperties": {
|
|
159
|
-
"type": "object",
|
|
160
|
-
"properties": {
|
|
161
|
-
"builder": {
|
|
162
|
-
"description": "The function that Nx will invoke when you run this architect",
|
|
163
|
-
"type": "string"
|
|
164
|
-
},
|
|
165
|
-
"options": {
|
|
166
|
-
"type": "object"
|
|
167
|
-
},
|
|
168
|
-
"configurations": {
|
|
169
|
-
"type": "object",
|
|
170
|
-
"description": "provides extra sets of values that will be merged into the options map",
|
|
171
|
-
"additionalProperties": {
|
|
172
|
-
"type": "object"
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
172
|
+
"type": "object"
|
|
179
173
|
}
|
|
174
|
+
}
|
|
180
175
|
}
|
|
176
|
+
}
|
|
181
177
|
}
|
|
178
|
+
}
|
|
182
179
|
}
|
|
180
|
+
}
|
|
183
181
|
}
|
|
184
|
-
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
185
|
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
"writeNxCloudRules": {
|
|
14
|
-
"type": "boolean",
|
|
15
|
-
"description": "Whether to write Nx Cloud rules",
|
|
16
|
-
"default": false
|
|
17
|
-
},
|
|
18
|
-
"packageVersion": {
|
|
19
|
-
"type": "string",
|
|
20
|
-
"description": "The version of the package to use",
|
|
21
|
-
"default": "latest"
|
|
22
|
-
},
|
|
23
|
-
"agents": {
|
|
24
|
-
"type": "array",
|
|
25
|
-
"description": "The agents to setup Nx configuration for.",
|
|
26
|
-
"items": {
|
|
27
|
-
"type": "string",
|
|
28
|
-
"enum": ["claude", "gemini", "codex", "cursor", "copilot"]
|
|
29
|
-
},
|
|
30
|
-
"default": ["claude", "gemini", "codex", "cursor", "copilot"]
|
|
31
|
-
}
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "SetupAiAgents",
|
|
4
|
+
"title": "Set Up AI Agents",
|
|
5
|
+
"description": "Sets up the Nx MCP & rule files for common AI Agents.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"directory": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "Directory where the AI agent configuration files will be generated",
|
|
11
|
+
"default": "."
|
|
32
12
|
},
|
|
33
|
-
"
|
|
13
|
+
"writeNxCloudRules": {
|
|
14
|
+
"type": "boolean",
|
|
15
|
+
"description": "Whether to write Nx Cloud rules",
|
|
16
|
+
"default": false
|
|
17
|
+
},
|
|
18
|
+
"packageVersion": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "The version of the package to use",
|
|
21
|
+
"default": "latest"
|
|
22
|
+
},
|
|
23
|
+
"agents": {
|
|
24
|
+
"type": "array",
|
|
25
|
+
"description": "The agents to setup Nx configuration for.",
|
|
26
|
+
"items": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"enum": ["claude", "gemini", "codex", "cursor", "copilot"]
|
|
29
|
+
},
|
|
30
|
+
"default": ["claude", "gemini", "codex", "cursor", "copilot"]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"required": ["directory"]
|
|
34
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/graph/graph.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/graph/graph.ts"],"names":[],"mappings":"AA2BA,OAAO,EAEL,cAAc,EACd,YAAY,EACZ,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,4BAA4B,CAAC;AAKpC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAwBpD,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,uBAAuB,EAAE,CAAC;IACpC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,EAAE,CAAC,CAAC;IACvD,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,0BAA0B,CAAC,EAAE,MAAM,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,yBAAyB;IACxC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAC5C;AAkJD,wBAAsB,aAAa,CACjC,IAAI,EAAE;IACJ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,UAAU,GAAG,OAAO,GAAG,iBAAiB,CAAC;IAC/C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,EACD,gBAAgB,EAAE,MAAM,EAAE,GACzB,OAAO,CAAC,IAAI,CAAC,CA2Tf;AAw0BD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACrC;;OAEG;IACH,KAAK,EAAE,YAAY,CAAC;CACrB"}
|
|
@@ -4,6 +4,7 @@ exports.generateGraph = generateGraph;
|
|
|
4
4
|
const crypto_1 = require("crypto");
|
|
5
5
|
const node_child_process_1 = require("node:child_process");
|
|
6
6
|
const node_fs_1 = require("node:fs");
|
|
7
|
+
const daemon_socket_messenger_1 = require("../../daemon/client/daemon-socket-messenger");
|
|
7
8
|
const http = require("node:http");
|
|
8
9
|
const minimatch_1 = require("minimatch");
|
|
9
10
|
const node_url_1 = require("node:url");
|
|
@@ -148,7 +149,6 @@ async function generateGraph(args, affectedProjects) {
|
|
|
148
149
|
}
|
|
149
150
|
let rawGraph;
|
|
150
151
|
let sourceMaps;
|
|
151
|
-
let isPartial = false;
|
|
152
152
|
try {
|
|
153
153
|
const projectGraphAndSourceMaps = await (0, project_graph_1.createProjectGraphAndSourceMapsAsync)({ exitOnError: false });
|
|
154
154
|
rawGraph = projectGraphAndSourceMaps.projectGraph;
|
|
@@ -158,7 +158,6 @@ async function generateGraph(args, affectedProjects) {
|
|
|
158
158
|
if (e instanceof error_types_1.ProjectGraphError) {
|
|
159
159
|
rawGraph = e.getPartialProjectGraph();
|
|
160
160
|
sourceMaps = e.getPartialSourcemaps();
|
|
161
|
-
isPartial = true;
|
|
162
161
|
}
|
|
163
162
|
if (!rawGraph) {
|
|
164
163
|
(0, project_graph_1.handleProjectGraphError)({ exitOnError: true }, e);
|
|
@@ -385,7 +384,7 @@ async function startServer(html, environmentJs, host, port = 4211, watchForChang
|
|
|
385
384
|
});
|
|
386
385
|
}
|
|
387
386
|
if (watchForChanges && client_1.daemonClient.enabled()) {
|
|
388
|
-
unregisterFileWatcher = await
|
|
387
|
+
unregisterFileWatcher = await createProjectGraphListener();
|
|
389
388
|
}
|
|
390
389
|
const { projectGraphClientResponse, sourceMapResponse } = await createProjectGraphAndSourceMapClientResponse(affected, focus, exclude);
|
|
391
390
|
currentProjectGraphClientResponse = projectGraphClientResponse;
|
|
@@ -535,29 +534,58 @@ let currentSourceMapsClientResponse = {};
|
|
|
535
534
|
let isFilteredGraph = false;
|
|
536
535
|
function debounce(fn, time) {
|
|
537
536
|
let timeout;
|
|
538
|
-
return (...args) => {
|
|
537
|
+
return ((...args) => {
|
|
539
538
|
if (timeout) {
|
|
540
539
|
clearTimeout(timeout);
|
|
541
540
|
}
|
|
542
541
|
timeout = setTimeout(() => fn(...args), time);
|
|
543
|
-
};
|
|
542
|
+
});
|
|
544
543
|
}
|
|
545
|
-
function
|
|
546
|
-
return client_1.daemonClient.
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
if (error === '
|
|
552
|
-
output_1.output.
|
|
544
|
+
function createProjectGraphListener() {
|
|
545
|
+
return client_1.daemonClient.registerProjectGraphRecomputationListener(debounce(async (error, data) => {
|
|
546
|
+
if (error === 'reconnecting') {
|
|
547
|
+
output_1.output.note({ title: 'Daemon restarting, reconnecting...' });
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
else if (error === 'reconnected') {
|
|
551
|
+
output_1.output.note({ title: 'Reconnected to daemon' });
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
else if (error === 'closed') {
|
|
555
|
+
output_1.output.error({
|
|
556
|
+
title: `Failed to reconnect to daemon after multiple attempts`,
|
|
557
|
+
});
|
|
558
|
+
process.exit(1);
|
|
559
|
+
}
|
|
560
|
+
else if (error instanceof daemon_socket_messenger_1.VersionMismatchError) {
|
|
561
|
+
output_1.output.error({
|
|
562
|
+
title: 'Nx version changed. Please restart your command.',
|
|
563
|
+
});
|
|
553
564
|
process.exit(1);
|
|
554
565
|
}
|
|
555
566
|
else if (error) {
|
|
556
|
-
output_1.output.error({
|
|
567
|
+
output_1.output.error({
|
|
568
|
+
title: `Watch error: ${error?.message ?? 'Unknown'}`,
|
|
569
|
+
});
|
|
557
570
|
}
|
|
558
|
-
else if (
|
|
559
|
-
output_1.output.note({ title: '
|
|
560
|
-
|
|
571
|
+
else if (data !== null) {
|
|
572
|
+
output_1.output.note({ title: 'Project graph recomputed, updating...' });
|
|
573
|
+
let projectGraph = data.projectGraph;
|
|
574
|
+
let sourceMaps = data.sourceMaps;
|
|
575
|
+
let errors;
|
|
576
|
+
if (data.error instanceof error_types_1.ProjectGraphError) {
|
|
577
|
+
projectGraph = data.error.getPartialProjectGraph();
|
|
578
|
+
sourceMaps = data.error.getPartialSourcemaps();
|
|
579
|
+
errors = data.error.getErrors().map((e) => ({
|
|
580
|
+
message: e.message,
|
|
581
|
+
stack: e.stack,
|
|
582
|
+
cause: e.cause,
|
|
583
|
+
name: e.name,
|
|
584
|
+
pluginName: e.pluginName,
|
|
585
|
+
fileName: e.file ?? e.cause?.errors?.[0]?.location?.file,
|
|
586
|
+
}));
|
|
587
|
+
}
|
|
588
|
+
const { projectGraphClientResponse, sourceMapResponse } = transformProjectGraphToClientResponse(projectGraph, sourceMaps, errors, currentProjectGraphClientResponse.affected, isFilteredGraph ? currentProjectGraphClientResponse.focus : null, isFilteredGraph ? currentProjectGraphClientResponse.exclude : []);
|
|
561
589
|
if (projectGraphClientResponse.hash !==
|
|
562
590
|
currentProjectGraphClientResponse.hash &&
|
|
563
591
|
sourceMapResponse) {
|
|
@@ -571,7 +599,7 @@ function createFileWatcher() {
|
|
|
571
599
|
output_1.output.warn({
|
|
572
600
|
title: `${projectGraphClientResponse.errors.length > 1
|
|
573
601
|
? `${projectGraphClientResponse.errors.length} errors`
|
|
574
|
-
: `An error`}
|
|
602
|
+
: `An error`} occurred while processing the project graph. Showing partial graph.`,
|
|
575
603
|
});
|
|
576
604
|
}
|
|
577
605
|
output_1.output.note({ title: 'Graph changes updated.' });
|
|
@@ -586,21 +614,56 @@ function createFileWatcher() {
|
|
|
586
614
|
}
|
|
587
615
|
}, 500));
|
|
588
616
|
}
|
|
617
|
+
function transformProjectGraphToClientResponse(projectGraph, sourceMaps, errors, affected = [], focus = null, exclude = []) {
|
|
618
|
+
node_perf_hooks_1.performance.mark('project graph transform:start');
|
|
619
|
+
let graph = (0, operators_1.pruneExternalNodes)(projectGraph);
|
|
620
|
+
// Apply focus and exclude filters
|
|
621
|
+
graph = filterGraph(graph, focus, exclude);
|
|
622
|
+
const fileMap = (0, nx_deps_cache_1.readFileMapCache)()?.fileMap.projectFileMap || {};
|
|
623
|
+
const layout = (0, configuration_1.workspaceLayout)();
|
|
624
|
+
const projects = Object.values(graph.nodes);
|
|
625
|
+
const dependencies = graph.dependencies;
|
|
626
|
+
const nxJson = (0, configuration_1.readNxJson)();
|
|
627
|
+
const connectedToCloud = (0, nx_cloud_utils_1.isNxCloudUsed)(nxJson);
|
|
628
|
+
const disabledTaskSyncGenerators = nxJson.sync?.disabledTaskSyncGenerators;
|
|
629
|
+
const hasher = (0, crypto_1.createHash)('sha256');
|
|
630
|
+
hasher.update(JSON.stringify({
|
|
631
|
+
layout,
|
|
632
|
+
projects,
|
|
633
|
+
dependencies,
|
|
634
|
+
sourceMaps,
|
|
635
|
+
connectedToCloud,
|
|
636
|
+
disabledTaskSyncGenerators,
|
|
637
|
+
}));
|
|
638
|
+
const hash = hasher.digest('hex');
|
|
639
|
+
node_perf_hooks_1.performance.mark('project graph transform:end');
|
|
640
|
+
node_perf_hooks_1.performance.measure('project graph transform', 'project graph transform:start', 'project graph transform:end');
|
|
641
|
+
return {
|
|
642
|
+
projectGraphClientResponse: {
|
|
643
|
+
...currentProjectGraphClientResponse,
|
|
644
|
+
hash,
|
|
645
|
+
layout,
|
|
646
|
+
projects,
|
|
647
|
+
dependencies,
|
|
648
|
+
affected,
|
|
649
|
+
fileMap,
|
|
650
|
+
isPartial: false,
|
|
651
|
+
errors,
|
|
652
|
+
connectedToCloud,
|
|
653
|
+
disabledTaskSyncGenerators,
|
|
654
|
+
},
|
|
655
|
+
sourceMapResponse: sourceMaps,
|
|
656
|
+
};
|
|
657
|
+
}
|
|
589
658
|
async function createProjectGraphAndSourceMapClientResponse(affected = [], focus = null, exclude = []) {
|
|
590
659
|
node_perf_hooks_1.performance.mark('project graph watch calculation:start');
|
|
591
660
|
let projectGraph;
|
|
592
661
|
let sourceMaps;
|
|
593
|
-
let isPartial = false;
|
|
594
662
|
let errors;
|
|
595
|
-
let connectedToCloud;
|
|
596
|
-
let disabledTaskSyncGenerators;
|
|
597
663
|
try {
|
|
598
664
|
const projectGraphAndSourceMaps = await (0, project_graph_1.createProjectGraphAndSourceMapsAsync)({ exitOnError: false });
|
|
599
665
|
projectGraph = projectGraphAndSourceMaps.projectGraph;
|
|
600
666
|
sourceMaps = projectGraphAndSourceMaps.sourceMaps;
|
|
601
|
-
const nxJson = (0, configuration_1.readNxJson)();
|
|
602
|
-
connectedToCloud = (0, nx_cloud_utils_1.isNxCloudUsed)(nxJson);
|
|
603
|
-
disabledTaskSyncGenerators = nxJson.sync?.disabledTaskSyncGenerators;
|
|
604
667
|
}
|
|
605
668
|
catch (e) {
|
|
606
669
|
if (e instanceof error_types_1.ProjectGraphError) {
|
|
@@ -614,50 +677,20 @@ async function createProjectGraphAndSourceMapClientResponse(affected = [], focus
|
|
|
614
677
|
pluginName: e.pluginName,
|
|
615
678
|
fileName: e.file ?? e.cause?.errors?.[0]?.location?.file,
|
|
616
679
|
}));
|
|
617
|
-
isPartial = true;
|
|
618
680
|
}
|
|
619
681
|
if (!projectGraph) {
|
|
620
682
|
(0, project_graph_1.handleProjectGraphError)({ exitOnError: true }, e);
|
|
621
683
|
}
|
|
622
684
|
}
|
|
623
|
-
let graph = (0, operators_1.pruneExternalNodes)(projectGraph);
|
|
624
|
-
// Apply focus and exclude filters
|
|
625
|
-
graph = filterGraph(graph, focus, exclude);
|
|
626
|
-
const fileMap = (0, nx_deps_cache_1.readFileMapCache)()?.fileMap.projectFileMap || {};
|
|
627
685
|
node_perf_hooks_1.performance.mark('project graph watch calculation:end');
|
|
628
686
|
node_perf_hooks_1.performance.mark('project graph response generation:start');
|
|
629
|
-
|
|
630
|
-
const projects = Object.values(graph.nodes);
|
|
631
|
-
const dependencies = graph.dependencies;
|
|
632
|
-
const hasher = (0, crypto_1.createHash)('sha256');
|
|
633
|
-
hasher.update(JSON.stringify({
|
|
634
|
-
layout,
|
|
635
|
-
projects,
|
|
636
|
-
dependencies,
|
|
637
|
-
sourceMaps,
|
|
638
|
-
errors,
|
|
639
|
-
connectedToCloud,
|
|
640
|
-
disabledTaskSyncGenerators,
|
|
641
|
-
}));
|
|
642
|
-
const hash = hasher.digest('hex');
|
|
687
|
+
let { projectGraphClientResponse, sourceMapResponse } = transformProjectGraphToClientResponse(projectGraph, sourceMaps, errors, affected, focus, exclude);
|
|
643
688
|
node_perf_hooks_1.performance.mark('project graph response generation:end');
|
|
644
689
|
node_perf_hooks_1.performance.measure('project graph watch calculation', 'project graph watch calculation:start', 'project graph watch calculation:end');
|
|
645
690
|
node_perf_hooks_1.performance.measure('project graph response generation', 'project graph response generation:start', 'project graph response generation:end');
|
|
646
691
|
return {
|
|
647
|
-
projectGraphClientResponse
|
|
648
|
-
|
|
649
|
-
hash,
|
|
650
|
-
layout,
|
|
651
|
-
projects,
|
|
652
|
-
dependencies,
|
|
653
|
-
affected,
|
|
654
|
-
fileMap,
|
|
655
|
-
isPartial,
|
|
656
|
-
errors,
|
|
657
|
-
connectedToCloud,
|
|
658
|
-
disabledTaskSyncGenerators,
|
|
659
|
-
},
|
|
660
|
-
sourceMapResponse: sourceMaps,
|
|
692
|
+
projectGraphClientResponse,
|
|
693
|
+
sourceMapResponse,
|
|
661
694
|
};
|
|
662
695
|
}
|
|
663
696
|
async function createTaskGraphClientResponse(pruneExternal = false) {
|