nx 18.3.1 → 18.3.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.
- package/.eslintrc.json +4 -0
- package/bin/nx.js +7 -19
- package/migrations.json +2 -1
- package/package.json +12 -12
- package/src/command-line/add/add.js +3 -1
- package/src/command-line/add/command-object.d.ts +1 -0
- package/src/command-line/add/command-object.js +6 -1
- package/src/command-line/graph/command-object.js +1 -1
- package/src/command-line/init/implementation/react/check-for-uncommitted-changes.js +6 -3
- package/src/command-line/show/command-object.js +1 -5
- package/src/command-line/yargs-utils/shared-options.d.ts +3 -0
- package/src/command-line/yargs-utils/shared-options.js +15 -6
- package/src/daemon/cache.js +18 -0
- package/src/daemon/client/client.js +3 -4
- package/src/daemon/server/handle-hash-tasks.js +2 -2
- package/src/daemon/server/project-graph-incremental-recomputation.js +1 -2
- package/src/daemon/server/server.js +1 -4
- package/src/daemon/socket-utils.js +2 -14
- package/src/executors/run-commands/run-commands.impl.js +62 -11
- package/src/native/index.d.ts +1 -4
- package/src/native/index.js +67 -259
- package/src/native/native-bindings.js +268 -0
- package/src/native/transform-objects.js +1 -0
- package/src/project-graph/error-types.d.ts +31 -1
- package/src/project-graph/error-types.js +62 -1
- package/src/project-graph/plugins/isolation/index.js +8 -4
- package/src/project-graph/plugins/isolation/messaging.d.ts +9 -6
- package/src/project-graph/plugins/isolation/messaging.js +27 -10
- package/src/project-graph/plugins/isolation/plugin-pool.d.ts +1 -1
- package/src/project-graph/plugins/isolation/plugin-pool.js +15 -24
- package/src/project-graph/plugins/isolation/plugin-worker.js +21 -5
- package/src/project-graph/plugins/loader.js +22 -18
- package/src/project-graph/project-graph.d.ts +2 -24
- package/src/project-graph/project-graph.js +11 -52
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +3 -3
- package/src/tasks-runner/init-tasks-runner.js +2 -0
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +4 -0
- package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +4 -0
- package/src/tasks-runner/pseudo-terminal.js +6 -0
- package/src/tasks-runner/task-orchestrator.js +47 -29
- package/src/utils/dotenv.d.ts +7 -0
- package/src/utils/dotenv.js +22 -0
- package/src/utils/params.js +20 -17
- package/src/utils/serializable-error.d.ts +4 -0
- package/src/utils/serializable-error.js +28 -0
- package/src/daemon/daemon-project-graph-error.d.ts +0 -8
- package/src/daemon/daemon-project-graph-error.js +0 -13
package/src/native/index.js
CHANGED
@@ -1,268 +1,76 @@
|
|
1
|
-
const {
|
2
|
-
const {
|
1
|
+
const { join, basename } = require('path');
|
2
|
+
const { copyFileSync, existsSync, mkdirSync } = require('fs');
|
3
|
+
const Module = require('module');
|
4
|
+
const { nxVersion } = require('../utils/versions');
|
5
|
+
const { cacheDir } = require('../utils/cache-directory');
|
3
6
|
|
4
|
-
const
|
7
|
+
const nxPackages = new Set([
|
8
|
+
'@nx/nx-android-arm64',
|
9
|
+
'@nx/nx-android-arm-eabi',
|
10
|
+
'@nx/nx-win32-x64-msvc',
|
11
|
+
'@nx/nx-win32-ia32-msvc',
|
12
|
+
'@nx/nx-win32-arm64-msvc',
|
13
|
+
'@nx/nx-darwin-universal',
|
14
|
+
'@nx/nx-darwin-x64',
|
15
|
+
'@nx/nx-darwin-arm64',
|
16
|
+
'@nx/nx-freebsd-x64',
|
17
|
+
'@nx/nx-linux-x64-musl',
|
18
|
+
'@nx/nx-linux-x64-gnu',
|
19
|
+
'@nx/nx-linux-arm64-musl',
|
20
|
+
'@nx/nx-linux-arm64-gnu',
|
21
|
+
'@nx/nx-linux-arm-gnueabihf',
|
22
|
+
]);
|
5
23
|
|
6
|
-
|
7
|
-
|
8
|
-
|
24
|
+
const localNodeFiles = [
|
25
|
+
'nx.android-arm64.node',
|
26
|
+
'nx.android-arm-eabi.node',
|
27
|
+
'nx.win32-x64-msvc.node',
|
28
|
+
'nx.win32-ia32-msvc.node',
|
29
|
+
'nx.win32-arm64-msvc.node',
|
30
|
+
'nx.darwin-universal.node',
|
31
|
+
'nx.darwin-x64.node',
|
32
|
+
'nx.darwin-arm64.node',
|
33
|
+
'nx.freebsd-x64.node',
|
34
|
+
'nx.linux-x64-musl.node',
|
35
|
+
'nx.linux-x64-gnu.node',
|
36
|
+
'nx.linux-arm64-musl.node',
|
37
|
+
'nx.linux-arm64-gnu.node',
|
38
|
+
'nx.linux-arm-gnueabihf.node',
|
39
|
+
];
|
9
40
|
|
10
|
-
|
11
|
-
// For Node 10
|
12
|
-
if (!process.report || typeof process.report.getReport !== 'function') {
|
13
|
-
try {
|
14
|
-
const lddPath = require('child_process').execSync('which ldd').toString().trim();
|
15
|
-
return readFileSync(lddPath, 'utf8').includes('musl')
|
16
|
-
} catch (e) {
|
17
|
-
return true
|
18
|
-
}
|
19
|
-
} else {
|
20
|
-
const { glibcVersionRuntime } = process.report.getReport().header
|
21
|
-
return !glibcVersionRuntime
|
22
|
-
}
|
23
|
-
}
|
41
|
+
const originalLoad = Module._load;
|
24
42
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
localFileExisted = existsSync(join(__dirname, 'nx.android-arm-eabi.node'))
|
42
|
-
try {
|
43
|
-
if (localFileExisted) {
|
44
|
-
nativeBinding = require('./nx.android-arm-eabi.node')
|
45
|
-
} else {
|
46
|
-
nativeBinding = require('@nx/nx-android-arm-eabi')
|
47
|
-
}
|
48
|
-
} catch (e) {
|
49
|
-
loadError = e
|
50
|
-
}
|
51
|
-
break
|
52
|
-
default:
|
53
|
-
throw new Error(`Unsupported architecture on Android ${arch}`)
|
54
|
-
}
|
55
|
-
break
|
56
|
-
case 'win32':
|
57
|
-
switch (arch) {
|
58
|
-
case 'x64':
|
59
|
-
localFileExisted = existsSync(
|
60
|
-
join(__dirname, 'nx.win32-x64-msvc.node')
|
61
|
-
)
|
62
|
-
try {
|
63
|
-
if (localFileExisted) {
|
64
|
-
nativeBinding = require('./nx.win32-x64-msvc.node')
|
65
|
-
} else {
|
66
|
-
nativeBinding = require('@nx/nx-win32-x64-msvc')
|
67
|
-
}
|
68
|
-
} catch (e) {
|
69
|
-
loadError = e
|
70
|
-
}
|
71
|
-
break
|
72
|
-
case 'ia32':
|
73
|
-
localFileExisted = existsSync(
|
74
|
-
join(__dirname, 'nx.win32-ia32-msvc.node')
|
75
|
-
)
|
76
|
-
try {
|
77
|
-
if (localFileExisted) {
|
78
|
-
nativeBinding = require('./nx.win32-ia32-msvc.node')
|
79
|
-
} else {
|
80
|
-
nativeBinding = require('@nx/nx-win32-ia32-msvc')
|
81
|
-
}
|
82
|
-
} catch (e) {
|
83
|
-
loadError = e
|
84
|
-
}
|
85
|
-
break
|
86
|
-
case 'arm64':
|
87
|
-
localFileExisted = existsSync(
|
88
|
-
join(__dirname, 'nx.win32-arm64-msvc.node')
|
89
|
-
)
|
90
|
-
try {
|
91
|
-
if (localFileExisted) {
|
92
|
-
nativeBinding = require('./nx.win32-arm64-msvc.node')
|
93
|
-
} else {
|
94
|
-
nativeBinding = require('@nx/nx-win32-arm64-msvc')
|
95
|
-
}
|
96
|
-
} catch (e) {
|
97
|
-
loadError = e
|
98
|
-
}
|
99
|
-
break
|
100
|
-
default:
|
101
|
-
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
102
|
-
}
|
103
|
-
break
|
104
|
-
case 'darwin':
|
105
|
-
localFileExisted = existsSync(join(__dirname, 'nx.darwin-universal.node'))
|
106
|
-
try {
|
107
|
-
if (localFileExisted) {
|
108
|
-
nativeBinding = require('./nx.darwin-universal.node')
|
109
|
-
} else {
|
110
|
-
nativeBinding = require('@nx/nx-darwin-universal')
|
111
|
-
}
|
112
|
-
break
|
113
|
-
} catch {}
|
114
|
-
switch (arch) {
|
115
|
-
case 'x64':
|
116
|
-
localFileExisted = existsSync(join(__dirname, 'nx.darwin-x64.node'))
|
117
|
-
try {
|
118
|
-
if (localFileExisted) {
|
119
|
-
nativeBinding = require('./nx.darwin-x64.node')
|
120
|
-
} else {
|
121
|
-
nativeBinding = require('@nx/nx-darwin-x64')
|
122
|
-
}
|
123
|
-
} catch (e) {
|
124
|
-
loadError = e
|
125
|
-
}
|
126
|
-
break
|
127
|
-
case 'arm64':
|
128
|
-
localFileExisted = existsSync(
|
129
|
-
join(__dirname, 'nx.darwin-arm64.node')
|
130
|
-
)
|
131
|
-
try {
|
132
|
-
if (localFileExisted) {
|
133
|
-
nativeBinding = require('./nx.darwin-arm64.node')
|
134
|
-
} else {
|
135
|
-
nativeBinding = require('@nx/nx-darwin-arm64')
|
136
|
-
}
|
137
|
-
} catch (e) {
|
138
|
-
loadError = e
|
139
|
-
}
|
140
|
-
break
|
141
|
-
default:
|
142
|
-
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
43
|
+
// We override the _load function so that when a native file is required,
|
44
|
+
// we copy it to a cache directory and require it from there.
|
45
|
+
// This prevents the file being loaded from node_modules and causing file locking issues.
|
46
|
+
// Will only be called once because the require cache takes over afterwards.
|
47
|
+
Module._load = function (request, parent, isMain) {
|
48
|
+
const modulePath = request;
|
49
|
+
if (
|
50
|
+
nxPackages.has(modulePath) ||
|
51
|
+
localNodeFiles.some((f) => modulePath.endsWith(f))
|
52
|
+
) {
|
53
|
+
const nativeLocation = require.resolve(modulePath);
|
54
|
+
const fileName = basename(nativeLocation);
|
55
|
+
// we copy the file to the cache directory (.nx/cache by default) and prefix with nxVersion to avoid stale files being loaded
|
56
|
+
const tmpFile = join(cacheDir, nxVersion + '-' + fileName);
|
57
|
+
if (existsSync(tmpFile)) {
|
58
|
+
return originalLoad.apply(this, [tmpFile, parent, isMain]);
|
143
59
|
}
|
144
|
-
|
145
|
-
|
146
|
-
if (arch !== 'x64') {
|
147
|
-
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
60
|
+
if (!existsSync(cacheDir)) {
|
61
|
+
mkdirSync(cacheDir, { recursive: true });
|
148
62
|
}
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
nativeBinding = require('@nx/nx-freebsd-x64')
|
155
|
-
}
|
156
|
-
} catch (e) {
|
157
|
-
loadError = e
|
158
|
-
}
|
159
|
-
break
|
160
|
-
case 'linux':
|
161
|
-
switch (arch) {
|
162
|
-
case 'x64':
|
163
|
-
if (isMusl()) {
|
164
|
-
localFileExisted = existsSync(
|
165
|
-
join(__dirname, 'nx.linux-x64-musl.node')
|
166
|
-
)
|
167
|
-
try {
|
168
|
-
if (localFileExisted) {
|
169
|
-
nativeBinding = require('./nx.linux-x64-musl.node')
|
170
|
-
} else {
|
171
|
-
nativeBinding = require('@nx/nx-linux-x64-musl')
|
172
|
-
}
|
173
|
-
} catch (e) {
|
174
|
-
loadError = e
|
175
|
-
}
|
176
|
-
} else {
|
177
|
-
localFileExisted = existsSync(
|
178
|
-
join(__dirname, 'nx.linux-x64-gnu.node')
|
179
|
-
)
|
180
|
-
try {
|
181
|
-
if (localFileExisted) {
|
182
|
-
nativeBinding = require('./nx.linux-x64-gnu.node')
|
183
|
-
} else {
|
184
|
-
nativeBinding = require('@nx/nx-linux-x64-gnu')
|
185
|
-
}
|
186
|
-
} catch (e) {
|
187
|
-
loadError = e
|
188
|
-
}
|
189
|
-
}
|
190
|
-
break
|
191
|
-
case 'arm64':
|
192
|
-
if (isMusl()) {
|
193
|
-
localFileExisted = existsSync(
|
194
|
-
join(__dirname, 'nx.linux-arm64-musl.node')
|
195
|
-
)
|
196
|
-
try {
|
197
|
-
if (localFileExisted) {
|
198
|
-
nativeBinding = require('./nx.linux-arm64-musl.node')
|
199
|
-
} else {
|
200
|
-
nativeBinding = require('@nx/nx-linux-arm64-musl')
|
201
|
-
}
|
202
|
-
} catch (e) {
|
203
|
-
loadError = e
|
204
|
-
}
|
205
|
-
} else {
|
206
|
-
localFileExisted = existsSync(
|
207
|
-
join(__dirname, 'nx.linux-arm64-gnu.node')
|
208
|
-
)
|
209
|
-
try {
|
210
|
-
if (localFileExisted) {
|
211
|
-
nativeBinding = require('./nx.linux-arm64-gnu.node')
|
212
|
-
} else {
|
213
|
-
nativeBinding = require('@nx/nx-linux-arm64-gnu')
|
214
|
-
}
|
215
|
-
} catch (e) {
|
216
|
-
loadError = e
|
217
|
-
}
|
218
|
-
}
|
219
|
-
break
|
220
|
-
case 'arm':
|
221
|
-
localFileExisted = existsSync(
|
222
|
-
join(__dirname, 'nx.linux-arm-gnueabihf.node')
|
223
|
-
)
|
224
|
-
try {
|
225
|
-
if (localFileExisted) {
|
226
|
-
nativeBinding = require('./nx.linux-arm-gnueabihf.node')
|
227
|
-
} else {
|
228
|
-
nativeBinding = require('@nx/nx-linux-arm-gnueabihf')
|
229
|
-
}
|
230
|
-
} catch (e) {
|
231
|
-
loadError = e
|
232
|
-
}
|
233
|
-
break
|
234
|
-
default:
|
235
|
-
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
236
|
-
}
|
237
|
-
break
|
238
|
-
default:
|
239
|
-
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
240
|
-
}
|
241
|
-
|
242
|
-
if (!nativeBinding) {
|
243
|
-
if (loadError) {
|
244
|
-
throw loadError
|
63
|
+
copyFileSync(nativeLocation, tmpFile);
|
64
|
+
return originalLoad.apply(this, [tmpFile, parent, isMain]);
|
65
|
+
} else {
|
66
|
+
// call the original _load function for everything else
|
67
|
+
return originalLoad.apply(this, arguments);
|
245
68
|
}
|
246
|
-
|
247
|
-
}
|
69
|
+
};
|
248
70
|
|
249
|
-
const
|
71
|
+
const indexModulePath = require.resolve('./native-bindings.js');
|
72
|
+
delete require.cache[indexModulePath];
|
73
|
+
const indexModule = require('./native-bindings.js');
|
250
74
|
|
251
|
-
module.exports
|
252
|
-
|
253
|
-
module.exports.remove = remove
|
254
|
-
module.exports.copy = copy
|
255
|
-
module.exports.hashArray = hashArray
|
256
|
-
module.exports.hashFile = hashFile
|
257
|
-
module.exports.ImportResult = ImportResult
|
258
|
-
module.exports.findImports = findImports
|
259
|
-
module.exports.transferProjectGraph = transferProjectGraph
|
260
|
-
module.exports.ChildProcess = ChildProcess
|
261
|
-
module.exports.RustPseudoTerminal = RustPseudoTerminal
|
262
|
-
module.exports.HashPlanner = HashPlanner
|
263
|
-
module.exports.TaskHasher = TaskHasher
|
264
|
-
module.exports.EventType = EventType
|
265
|
-
module.exports.Watcher = Watcher
|
266
|
-
module.exports.WorkspaceContext = WorkspaceContext
|
267
|
-
module.exports.WorkspaceErrors = WorkspaceErrors
|
268
|
-
module.exports.testOnlyTransferFileMap = testOnlyTransferFileMap
|
75
|
+
module.exports = indexModule;
|
76
|
+
Module._load = originalLoad;
|
@@ -0,0 +1,268 @@
|
|
1
|
+
const { existsSync, readFileSync } = require('fs')
|
2
|
+
const { join } = require('path')
|
3
|
+
|
4
|
+
const { platform, arch } = process
|
5
|
+
|
6
|
+
let nativeBinding = null
|
7
|
+
let localFileExisted = false
|
8
|
+
let loadError = null
|
9
|
+
|
10
|
+
function isMusl() {
|
11
|
+
// For Node 10
|
12
|
+
if (!process.report || typeof process.report.getReport !== 'function') {
|
13
|
+
try {
|
14
|
+
const lddPath = require('child_process').execSync('which ldd').toString().trim();
|
15
|
+
return readFileSync(lddPath, 'utf8').includes('musl')
|
16
|
+
} catch (e) {
|
17
|
+
return true
|
18
|
+
}
|
19
|
+
} else {
|
20
|
+
const { glibcVersionRuntime } = process.report.getReport().header
|
21
|
+
return !glibcVersionRuntime
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
switch (platform) {
|
26
|
+
case 'android':
|
27
|
+
switch (arch) {
|
28
|
+
case 'arm64':
|
29
|
+
localFileExisted = existsSync(join(__dirname, 'nx.android-arm64.node'))
|
30
|
+
try {
|
31
|
+
if (localFileExisted) {
|
32
|
+
nativeBinding = require('./nx.android-arm64.node')
|
33
|
+
} else {
|
34
|
+
nativeBinding = require('@nx/nx-android-arm64')
|
35
|
+
}
|
36
|
+
} catch (e) {
|
37
|
+
loadError = e
|
38
|
+
}
|
39
|
+
break
|
40
|
+
case 'arm':
|
41
|
+
localFileExisted = existsSync(join(__dirname, 'nx.android-arm-eabi.node'))
|
42
|
+
try {
|
43
|
+
if (localFileExisted) {
|
44
|
+
nativeBinding = require('./nx.android-arm-eabi.node')
|
45
|
+
} else {
|
46
|
+
nativeBinding = require('@nx/nx-android-arm-eabi')
|
47
|
+
}
|
48
|
+
} catch (e) {
|
49
|
+
loadError = e
|
50
|
+
}
|
51
|
+
break
|
52
|
+
default:
|
53
|
+
throw new Error(`Unsupported architecture on Android ${arch}`)
|
54
|
+
}
|
55
|
+
break
|
56
|
+
case 'win32':
|
57
|
+
switch (arch) {
|
58
|
+
case 'x64':
|
59
|
+
localFileExisted = existsSync(
|
60
|
+
join(__dirname, 'nx.win32-x64-msvc.node')
|
61
|
+
)
|
62
|
+
try {
|
63
|
+
if (localFileExisted) {
|
64
|
+
nativeBinding = require('./nx.win32-x64-msvc.node')
|
65
|
+
} else {
|
66
|
+
nativeBinding = require('@nx/nx-win32-x64-msvc')
|
67
|
+
}
|
68
|
+
} catch (e) {
|
69
|
+
loadError = e
|
70
|
+
}
|
71
|
+
break
|
72
|
+
case 'ia32':
|
73
|
+
localFileExisted = existsSync(
|
74
|
+
join(__dirname, 'nx.win32-ia32-msvc.node')
|
75
|
+
)
|
76
|
+
try {
|
77
|
+
if (localFileExisted) {
|
78
|
+
nativeBinding = require('./nx.win32-ia32-msvc.node')
|
79
|
+
} else {
|
80
|
+
nativeBinding = require('@nx/nx-win32-ia32-msvc')
|
81
|
+
}
|
82
|
+
} catch (e) {
|
83
|
+
loadError = e
|
84
|
+
}
|
85
|
+
break
|
86
|
+
case 'arm64':
|
87
|
+
localFileExisted = existsSync(
|
88
|
+
join(__dirname, 'nx.win32-arm64-msvc.node')
|
89
|
+
)
|
90
|
+
try {
|
91
|
+
if (localFileExisted) {
|
92
|
+
nativeBinding = require('./nx.win32-arm64-msvc.node')
|
93
|
+
} else {
|
94
|
+
nativeBinding = require('@nx/nx-win32-arm64-msvc')
|
95
|
+
}
|
96
|
+
} catch (e) {
|
97
|
+
loadError = e
|
98
|
+
}
|
99
|
+
break
|
100
|
+
default:
|
101
|
+
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
102
|
+
}
|
103
|
+
break
|
104
|
+
case 'darwin':
|
105
|
+
localFileExisted = existsSync(join(__dirname, 'nx.darwin-universal.node'))
|
106
|
+
try {
|
107
|
+
if (localFileExisted) {
|
108
|
+
nativeBinding = require('./nx.darwin-universal.node')
|
109
|
+
} else {
|
110
|
+
nativeBinding = require('@nx/nx-darwin-universal')
|
111
|
+
}
|
112
|
+
break
|
113
|
+
} catch {}
|
114
|
+
switch (arch) {
|
115
|
+
case 'x64':
|
116
|
+
localFileExisted = existsSync(join(__dirname, 'nx.darwin-x64.node'))
|
117
|
+
try {
|
118
|
+
if (localFileExisted) {
|
119
|
+
nativeBinding = require('./nx.darwin-x64.node')
|
120
|
+
} else {
|
121
|
+
nativeBinding = require('@nx/nx-darwin-x64')
|
122
|
+
}
|
123
|
+
} catch (e) {
|
124
|
+
loadError = e
|
125
|
+
}
|
126
|
+
break
|
127
|
+
case 'arm64':
|
128
|
+
localFileExisted = existsSync(
|
129
|
+
join(__dirname, 'nx.darwin-arm64.node')
|
130
|
+
)
|
131
|
+
try {
|
132
|
+
if (localFileExisted) {
|
133
|
+
nativeBinding = require('./nx.darwin-arm64.node')
|
134
|
+
} else {
|
135
|
+
nativeBinding = require('@nx/nx-darwin-arm64')
|
136
|
+
}
|
137
|
+
} catch (e) {
|
138
|
+
loadError = e
|
139
|
+
}
|
140
|
+
break
|
141
|
+
default:
|
142
|
+
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
143
|
+
}
|
144
|
+
break
|
145
|
+
case 'freebsd':
|
146
|
+
if (arch !== 'x64') {
|
147
|
+
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
148
|
+
}
|
149
|
+
localFileExisted = existsSync(join(__dirname, 'nx.freebsd-x64.node'))
|
150
|
+
try {
|
151
|
+
if (localFileExisted) {
|
152
|
+
nativeBinding = require('./nx.freebsd-x64.node')
|
153
|
+
} else {
|
154
|
+
nativeBinding = require('@nx/nx-freebsd-x64')
|
155
|
+
}
|
156
|
+
} catch (e) {
|
157
|
+
loadError = e
|
158
|
+
}
|
159
|
+
break
|
160
|
+
case 'linux':
|
161
|
+
switch (arch) {
|
162
|
+
case 'x64':
|
163
|
+
if (isMusl()) {
|
164
|
+
localFileExisted = existsSync(
|
165
|
+
join(__dirname, 'nx.linux-x64-musl.node')
|
166
|
+
)
|
167
|
+
try {
|
168
|
+
if (localFileExisted) {
|
169
|
+
nativeBinding = require('./nx.linux-x64-musl.node')
|
170
|
+
} else {
|
171
|
+
nativeBinding = require('@nx/nx-linux-x64-musl')
|
172
|
+
}
|
173
|
+
} catch (e) {
|
174
|
+
loadError = e
|
175
|
+
}
|
176
|
+
} else {
|
177
|
+
localFileExisted = existsSync(
|
178
|
+
join(__dirname, 'nx.linux-x64-gnu.node')
|
179
|
+
)
|
180
|
+
try {
|
181
|
+
if (localFileExisted) {
|
182
|
+
nativeBinding = require('./nx.linux-x64-gnu.node')
|
183
|
+
} else {
|
184
|
+
nativeBinding = require('@nx/nx-linux-x64-gnu')
|
185
|
+
}
|
186
|
+
} catch (e) {
|
187
|
+
loadError = e
|
188
|
+
}
|
189
|
+
}
|
190
|
+
break
|
191
|
+
case 'arm64':
|
192
|
+
if (isMusl()) {
|
193
|
+
localFileExisted = existsSync(
|
194
|
+
join(__dirname, 'nx.linux-arm64-musl.node')
|
195
|
+
)
|
196
|
+
try {
|
197
|
+
if (localFileExisted) {
|
198
|
+
nativeBinding = require('./nx.linux-arm64-musl.node')
|
199
|
+
} else {
|
200
|
+
nativeBinding = require('@nx/nx-linux-arm64-musl')
|
201
|
+
}
|
202
|
+
} catch (e) {
|
203
|
+
loadError = e
|
204
|
+
}
|
205
|
+
} else {
|
206
|
+
localFileExisted = existsSync(
|
207
|
+
join(__dirname, 'nx.linux-arm64-gnu.node')
|
208
|
+
)
|
209
|
+
try {
|
210
|
+
if (localFileExisted) {
|
211
|
+
nativeBinding = require('./nx.linux-arm64-gnu.node')
|
212
|
+
} else {
|
213
|
+
nativeBinding = require('@nx/nx-linux-arm64-gnu')
|
214
|
+
}
|
215
|
+
} catch (e) {
|
216
|
+
loadError = e
|
217
|
+
}
|
218
|
+
}
|
219
|
+
break
|
220
|
+
case 'arm':
|
221
|
+
localFileExisted = existsSync(
|
222
|
+
join(__dirname, 'nx.linux-arm-gnueabihf.node')
|
223
|
+
)
|
224
|
+
try {
|
225
|
+
if (localFileExisted) {
|
226
|
+
nativeBinding = require('./nx.linux-arm-gnueabihf.node')
|
227
|
+
} else {
|
228
|
+
nativeBinding = require('@nx/nx-linux-arm-gnueabihf')
|
229
|
+
}
|
230
|
+
} catch (e) {
|
231
|
+
loadError = e
|
232
|
+
}
|
233
|
+
break
|
234
|
+
default:
|
235
|
+
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
236
|
+
}
|
237
|
+
break
|
238
|
+
default:
|
239
|
+
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
240
|
+
}
|
241
|
+
|
242
|
+
if (!nativeBinding) {
|
243
|
+
if (loadError) {
|
244
|
+
throw loadError
|
245
|
+
}
|
246
|
+
throw new Error(`Failed to load native binding`)
|
247
|
+
}
|
248
|
+
|
249
|
+
const { expandOutputs, getFilesForOutputs, remove, copy, hashArray, hashFile, ImportResult, findImports, transferProjectGraph, ChildProcess, RustPseudoTerminal, HashPlanner, TaskHasher, EventType, Watcher, WorkspaceContext, WorkspaceErrors, testOnlyTransferFileMap } = nativeBinding
|
250
|
+
|
251
|
+
module.exports.expandOutputs = expandOutputs
|
252
|
+
module.exports.getFilesForOutputs = getFilesForOutputs
|
253
|
+
module.exports.remove = remove
|
254
|
+
module.exports.copy = copy
|
255
|
+
module.exports.hashArray = hashArray
|
256
|
+
module.exports.hashFile = hashFile
|
257
|
+
module.exports.ImportResult = ImportResult
|
258
|
+
module.exports.findImports = findImports
|
259
|
+
module.exports.transferProjectGraph = transferProjectGraph
|
260
|
+
module.exports.ChildProcess = ChildProcess
|
261
|
+
module.exports.RustPseudoTerminal = RustPseudoTerminal
|
262
|
+
module.exports.HashPlanner = HashPlanner
|
263
|
+
module.exports.TaskHasher = TaskHasher
|
264
|
+
module.exports.EventType = EventType
|
265
|
+
module.exports.Watcher = Watcher
|
266
|
+
module.exports.WorkspaceContext = WorkspaceContext
|
267
|
+
module.exports.WorkspaceErrors = WorkspaceErrors
|
268
|
+
module.exports.testOnlyTransferFileMap = testOnlyTransferFileMap
|
@@ -31,6 +31,7 @@ function transformProjectGraphForRust(graph) {
|
|
31
31
|
}
|
32
32
|
for (const [projectName, externalNode] of Object.entries(graph.externalNodes ?? {})) {
|
33
33
|
externalNodes[projectName] = {
|
34
|
+
packageName: externalNode.data.packageName,
|
34
35
|
hash: externalNode.data.hash,
|
35
36
|
version: externalNode.data.version,
|
36
37
|
};
|
@@ -1,6 +1,26 @@
|
|
1
1
|
import { CreateNodesResultWithContext } from './plugins/internal-api';
|
2
|
-
import { ConfigurationResult } from './utils/project-configuration-utils';
|
2
|
+
import { ConfigurationResult, ConfigurationSourceMaps } from './utils/project-configuration-utils';
|
3
3
|
import { ProjectConfiguration } from '../config/workspace-json-project-json';
|
4
|
+
import { ProcessDependenciesError, ProcessProjectGraphError } from './build-project-graph';
|
5
|
+
import { ProjectGraph } from '../config/project-graph';
|
6
|
+
export declare class ProjectGraphError extends Error {
|
7
|
+
#private;
|
8
|
+
constructor(errors: Array<CreateNodesError | MergeNodesError | ProjectsWithNoNameError | ProjectsWithConflictingNamesError | ProcessDependenciesError | ProcessProjectGraphError>, partialProjectGraph: ProjectGraph, partialSourceMaps: ConfigurationSourceMaps);
|
9
|
+
/**
|
10
|
+
* The daemon cannot throw errors which contain methods as they are not serializable.
|
11
|
+
*
|
12
|
+
* This method creates a new {@link ProjectGraphError} from a {@link DaemonProjectGraphError} with the methods based on the same serialized data.
|
13
|
+
*/
|
14
|
+
static fromDaemonProjectGraphError(e: DaemonProjectGraphError): ProjectGraphError;
|
15
|
+
/**
|
16
|
+
* This gets the partial project graph despite the errors which occured.
|
17
|
+
* This partial project graph may be missing nodes, properties of nodes, or dependencies.
|
18
|
+
* This is useful mostly for visualization/debugging. It should not be used for running tasks.
|
19
|
+
*/
|
20
|
+
getPartialProjectGraph(): ProjectGraph;
|
21
|
+
getPartialSourcemaps(): ConfigurationSourceMaps;
|
22
|
+
getErrors(): (ProcessDependenciesError | ProcessProjectGraphError | CreateNodesError | MergeNodesError | ProjectsWithNoNameError | ProjectsWithConflictingNamesError)[];
|
23
|
+
}
|
4
24
|
export declare class ProjectsWithConflictingNamesError extends Error {
|
5
25
|
projects: Record<string, ProjectConfiguration>;
|
6
26
|
constructor(conflicts: Map<string, string[]>, projects: Record<string, ProjectConfiguration>);
|
@@ -43,3 +63,13 @@ export declare class MergeNodesError extends Error {
|
|
43
63
|
export declare function isCreateNodesError(e: unknown): e is CreateNodesError;
|
44
64
|
export declare function isAggregateCreateNodesError(e: unknown): e is AggregateCreateNodesError;
|
45
65
|
export declare function isMergeNodesError(e: unknown): e is MergeNodesError;
|
66
|
+
export declare class DaemonProjectGraphError extends Error {
|
67
|
+
errors: any[];
|
68
|
+
readonly projectGraph: ProjectGraph;
|
69
|
+
readonly sourceMaps: ConfigurationSourceMaps;
|
70
|
+
constructor(errors: any[], projectGraph: ProjectGraph, sourceMaps: ConfigurationSourceMaps);
|
71
|
+
}
|
72
|
+
export declare class LoadPluginError extends Error {
|
73
|
+
plugin: string;
|
74
|
+
constructor(plugin: string, cause: Error);
|
75
|
+
}
|