nx 18.4.0-canary.20240418-e549ea2 → 19.0.0-beta.1
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/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/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/core/graph/main.js +1 -1
- 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 +13 -5
- package/src/native/index.d.ts +1 -4
- package/src/native/index.js +5 -6
- package/src/native/native-bindings.js +111 -133
- package/src/native/transform-objects.js +1 -0
- package/src/project-graph/error-types.d.ts +5 -1
- package/src/project-graph/error-types.js +11 -1
- 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.js +11 -14
- package/src/project-graph/plugins/isolation/plugin-worker.js +21 -5
- package/src/project-graph/plugins/loader.js +22 -18
- package/src/tasks-runner/task-orchestrator.js +47 -29
- package/src/utils/params.js +20 -17
- package/src/utils/serializable-error.d.ts +4 -0
- package/src/utils/serializable-error.js +28 -0
@@ -60,10 +60,7 @@ async function handleMessage(socket, data) {
|
|
60
60
|
await (0, shutdown_utils_1.respondWithErrorAndExit)(socket, `File watcher error in the workspace '${workspace_root_1.workspaceRoot}'.`, workspaceWatcherError);
|
61
61
|
}
|
62
62
|
if (daemonIsOutdated()) {
|
63
|
-
await (0, shutdown_utils_1.respondWithErrorAndExit)(socket, `Lock files changed`,
|
64
|
-
name: '',
|
65
|
-
message: 'LOCK-FILES-CHANGED',
|
66
|
-
});
|
63
|
+
await (0, shutdown_utils_1.respondWithErrorAndExit)(socket, `Lock files changed`, new Error('LOCK-FILES-CHANGED'));
|
67
64
|
}
|
68
65
|
(0, shutdown_utils_1.resetInactivityTimeout)(handleInactivityTimeout);
|
69
66
|
const unparsedPayload = data;
|
@@ -5,7 +5,7 @@ const fs_1 = require("fs");
|
|
5
5
|
const os_1 = require("os");
|
6
6
|
const path_1 = require("path");
|
7
7
|
const tmp_dir_1 = require("./tmp-dir");
|
8
|
-
const
|
8
|
+
const serializable_error_1 = require("../utils/serializable-error");
|
9
9
|
exports.isWindows = (0, os_1.platform)() === 'win32';
|
10
10
|
/**
|
11
11
|
* For IPC with the daemon server we use unix sockets or windows named pipes, depending on the user's operating system.
|
@@ -28,21 +28,9 @@ function killSocketOrPath() {
|
|
28
28
|
catch { }
|
29
29
|
}
|
30
30
|
exports.killSocketOrPath = killSocketOrPath;
|
31
|
-
// Include the original stack trace within the serialized error so that the client can show it to the user.
|
32
|
-
function serializeError(error) {
|
33
|
-
if (!error) {
|
34
|
-
return null;
|
35
|
-
}
|
36
|
-
if (error instanceof error_types_1.DaemonProjectGraphError) {
|
37
|
-
error.errors = error.errors.map((e) => JSON.parse(serializeError(e)));
|
38
|
-
}
|
39
|
-
return `{${Object.getOwnPropertyNames(error)
|
40
|
-
.map((k) => `"${k}": ${JSON.stringify(error[k])}`)
|
41
|
-
.join(',')}}`;
|
42
|
-
}
|
43
31
|
// Prepare a serialized project graph result for sending over IPC from the server to the client
|
44
32
|
function serializeResult(error, serializedProjectGraph, serializedSourceMaps) {
|
45
33
|
// We do not want to repeat work `JSON.stringify`ing an object containing the potentially large project graph so merge as strings
|
46
|
-
return `{ "error": ${
|
34
|
+
return `{ "error": ${JSON.stringify(error ? (0, serializable_error_1.createSerializableError)(error) : error)}, "projectGraph": ${serializedProjectGraph}, "sourceMaps": ${serializedSourceMaps} }`;
|
47
35
|
}
|
48
36
|
exports.serializeResult = serializeResult;
|
@@ -8,6 +8,16 @@ const npm_run_path_1 = require("npm-run-path");
|
|
8
8
|
const chalk = require("chalk");
|
9
9
|
const pseudo_terminal_1 = require("../../tasks-runner/pseudo-terminal");
|
10
10
|
exports.LARGE_BUFFER = 1024 * 1000000;
|
11
|
+
const exitListeners = new Set();
|
12
|
+
function processExitListener() {
|
13
|
+
for (const listener of exitListeners) {
|
14
|
+
listener();
|
15
|
+
}
|
16
|
+
}
|
17
|
+
process.on('exit', processExitListener);
|
18
|
+
process.on('SIGTERM', processExitListener);
|
19
|
+
process.on('SIGINT', processExitListener);
|
20
|
+
process.on('SIGQUIT', processExitListener);
|
11
21
|
async function loadEnvVars(path) {
|
12
22
|
if (path) {
|
13
23
|
const result = (await Promise.resolve().then(() => require('dotenv'))).config({ path });
|
@@ -205,11 +215,8 @@ function nodeProcess(commandConfig, cwd, env, readyWhen, streamOutput = true) {
|
|
205
215
|
/**
|
206
216
|
* Ensure the child process is killed when the parent exits
|
207
217
|
*/
|
208
|
-
const
|
209
|
-
|
210
|
-
process.on('SIGTERM', processExitListener);
|
211
|
-
process.on('SIGINT', processExitListener);
|
212
|
-
process.on('SIGQUIT', processExitListener);
|
218
|
+
const childProcessKiller = (signal) => childProcess.kill(signal);
|
219
|
+
exitListeners.add(childProcessKiller);
|
213
220
|
childProcess.stdout.on('data', (data) => {
|
214
221
|
const output = addColorAndPrefix(data, commandConfig);
|
215
222
|
terminalOutput += output;
|
@@ -239,6 +246,7 @@ function nodeProcess(commandConfig, cwd, env, readyWhen, streamOutput = true) {
|
|
239
246
|
res({ success: false, terminalOutput });
|
240
247
|
});
|
241
248
|
childProcess.on('exit', (code) => {
|
249
|
+
exitListeners.delete(childProcessKiller);
|
242
250
|
if (!readyWhen) {
|
243
251
|
res({ success: code === 0, terminalOutput });
|
244
252
|
}
|
package/src/native/index.d.ts
CHANGED
@@ -29,11 +29,8 @@ export function findImports(projectFileMap: Record<string, Array<string>>): Arra
|
|
29
29
|
* This wont be needed once the project graph is created in Rust
|
30
30
|
*/
|
31
31
|
export function transferProjectGraph(projectGraph: ProjectGraph): ExternalObject<ProjectGraph>
|
32
|
-
export interface ExternalNodeData {
|
33
|
-
version: string
|
34
|
-
hash?: string
|
35
|
-
}
|
36
32
|
export interface ExternalNode {
|
33
|
+
packageName?: string
|
37
34
|
version: string
|
38
35
|
hash?: string
|
39
36
|
}
|
package/src/native/index.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
const { join,
|
1
|
+
const { join, basename } = require('path');
|
2
2
|
const { copyFileSync, existsSync, mkdirSync } = require('fs');
|
3
3
|
const Module = require('module');
|
4
|
-
const { nxVersion} = require(
|
5
|
-
const { cacheDir} = require(
|
4
|
+
const { nxVersion } = require('../utils/versions');
|
5
|
+
const { cacheDir } = require('../utils/cache-directory');
|
6
6
|
|
7
7
|
const nxPackages = new Set([
|
8
8
|
'@nx/nx-android-arm64',
|
@@ -40,7 +40,7 @@ const localNodeFiles = [
|
|
40
40
|
|
41
41
|
const originalLoad = Module._load;
|
42
42
|
|
43
|
-
// We override the _load function so that when a native file is required,
|
43
|
+
// We override the _load function so that when a native file is required,
|
44
44
|
// we copy it to a cache directory and require it from there.
|
45
45
|
// This prevents the file being loaded from node_modules and causing file locking issues.
|
46
46
|
// Will only be called once because the require cache takes over afterwards.
|
@@ -51,7 +51,7 @@ Module._load = function (request, parent, isMain) {
|
|
51
51
|
localNodeFiles.some((f) => modulePath.endsWith(f))
|
52
52
|
) {
|
53
53
|
const nativeLocation = require.resolve(modulePath);
|
54
|
-
const fileName = basename(nativeLocation)
|
54
|
+
const fileName = basename(nativeLocation);
|
55
55
|
// we copy the file to the cache directory (.nx/cache by default) and prefix with nxVersion to avoid stale files being loaded
|
56
56
|
const tmpFile = join(cacheDir, nxVersion + '-' + fileName);
|
57
57
|
if (existsSync(tmpFile)) {
|
@@ -72,6 +72,5 @@ const indexModulePath = require.resolve('./native-bindings.js');
|
|
72
72
|
delete require.cache[indexModulePath];
|
73
73
|
const indexModule = require('./native-bindings.js');
|
74
74
|
|
75
|
-
|
76
75
|
module.exports = indexModule;
|
77
76
|
Module._load = originalLoad;
|
@@ -1,27 +1,24 @@
|
|
1
|
-
const { existsSync, readFileSync } = require('fs')
|
2
|
-
const { join } = require('path')
|
1
|
+
const { existsSync, readFileSync } = require('fs')
|
2
|
+
const { join } = require('path')
|
3
3
|
|
4
|
-
const { platform, arch } = process
|
4
|
+
const { platform, arch } = process
|
5
5
|
|
6
|
-
let nativeBinding = null
|
7
|
-
let localFileExisted = false
|
8
|
-
let loadError = null
|
6
|
+
let nativeBinding = null
|
7
|
+
let localFileExisted = false
|
8
|
+
let loadError = null
|
9
9
|
|
10
10
|
function isMusl() {
|
11
11
|
// For Node 10
|
12
12
|
if (!process.report || typeof process.report.getReport !== 'function') {
|
13
13
|
try {
|
14
|
-
const lddPath = require('child_process')
|
15
|
-
|
16
|
-
.toString()
|
17
|
-
.trim();
|
18
|
-
return readFileSync(lddPath, 'utf8').includes('musl');
|
14
|
+
const lddPath = require('child_process').execSync('which ldd').toString().trim();
|
15
|
+
return readFileSync(lddPath, 'utf8').includes('musl')
|
19
16
|
} catch (e) {
|
20
|
-
return true
|
17
|
+
return true
|
21
18
|
}
|
22
19
|
} else {
|
23
|
-
const { glibcVersionRuntime } = process.report.getReport().header
|
24
|
-
return !glibcVersionRuntime
|
20
|
+
const { glibcVersionRuntime } = process.report.getReport().header
|
21
|
+
return !glibcVersionRuntime
|
25
22
|
}
|
26
23
|
}
|
27
24
|
|
@@ -29,262 +26,243 @@ switch (platform) {
|
|
29
26
|
case 'android':
|
30
27
|
switch (arch) {
|
31
28
|
case 'arm64':
|
32
|
-
localFileExisted = existsSync(join(__dirname, 'nx.android-arm64.node'))
|
29
|
+
localFileExisted = existsSync(join(__dirname, 'nx.android-arm64.node'))
|
33
30
|
try {
|
34
31
|
if (localFileExisted) {
|
35
|
-
nativeBinding = require('./nx.android-arm64.node')
|
32
|
+
nativeBinding = require('./nx.android-arm64.node')
|
36
33
|
} else {
|
37
|
-
nativeBinding = require('@nx/nx-android-arm64')
|
34
|
+
nativeBinding = require('@nx/nx-android-arm64')
|
38
35
|
}
|
39
36
|
} catch (e) {
|
40
|
-
loadError = e
|
37
|
+
loadError = e
|
41
38
|
}
|
42
|
-
break
|
39
|
+
break
|
43
40
|
case 'arm':
|
44
|
-
localFileExisted = existsSync(
|
45
|
-
join(__dirname, 'nx.android-arm-eabi.node')
|
46
|
-
);
|
41
|
+
localFileExisted = existsSync(join(__dirname, 'nx.android-arm-eabi.node'))
|
47
42
|
try {
|
48
43
|
if (localFileExisted) {
|
49
|
-
nativeBinding = require('./nx.android-arm-eabi.node')
|
44
|
+
nativeBinding = require('./nx.android-arm-eabi.node')
|
50
45
|
} else {
|
51
|
-
nativeBinding = require('@nx/nx-android-arm-eabi')
|
46
|
+
nativeBinding = require('@nx/nx-android-arm-eabi')
|
52
47
|
}
|
53
48
|
} catch (e) {
|
54
|
-
loadError = e
|
49
|
+
loadError = e
|
55
50
|
}
|
56
|
-
break
|
51
|
+
break
|
57
52
|
default:
|
58
|
-
throw new Error(`Unsupported architecture on Android ${arch}`)
|
53
|
+
throw new Error(`Unsupported architecture on Android ${arch}`)
|
59
54
|
}
|
60
|
-
break
|
55
|
+
break
|
61
56
|
case 'win32':
|
62
57
|
switch (arch) {
|
63
58
|
case 'x64':
|
64
59
|
localFileExisted = existsSync(
|
65
60
|
join(__dirname, 'nx.win32-x64-msvc.node')
|
66
|
-
)
|
61
|
+
)
|
67
62
|
try {
|
68
63
|
if (localFileExisted) {
|
69
|
-
nativeBinding = require('./nx.win32-x64-msvc.node')
|
64
|
+
nativeBinding = require('./nx.win32-x64-msvc.node')
|
70
65
|
} else {
|
71
|
-
nativeBinding = require('@nx/nx-win32-x64-msvc')
|
66
|
+
nativeBinding = require('@nx/nx-win32-x64-msvc')
|
72
67
|
}
|
73
68
|
} catch (e) {
|
74
|
-
loadError = e
|
69
|
+
loadError = e
|
75
70
|
}
|
76
|
-
break
|
71
|
+
break
|
77
72
|
case 'ia32':
|
78
73
|
localFileExisted = existsSync(
|
79
74
|
join(__dirname, 'nx.win32-ia32-msvc.node')
|
80
|
-
)
|
75
|
+
)
|
81
76
|
try {
|
82
77
|
if (localFileExisted) {
|
83
|
-
nativeBinding = require('./nx.win32-ia32-msvc.node')
|
78
|
+
nativeBinding = require('./nx.win32-ia32-msvc.node')
|
84
79
|
} else {
|
85
|
-
nativeBinding = require('@nx/nx-win32-ia32-msvc')
|
80
|
+
nativeBinding = require('@nx/nx-win32-ia32-msvc')
|
86
81
|
}
|
87
82
|
} catch (e) {
|
88
|
-
loadError = e
|
83
|
+
loadError = e
|
89
84
|
}
|
90
|
-
break
|
85
|
+
break
|
91
86
|
case 'arm64':
|
92
87
|
localFileExisted = existsSync(
|
93
88
|
join(__dirname, 'nx.win32-arm64-msvc.node')
|
94
|
-
)
|
89
|
+
)
|
95
90
|
try {
|
96
91
|
if (localFileExisted) {
|
97
|
-
nativeBinding = require('./nx.win32-arm64-msvc.node')
|
92
|
+
nativeBinding = require('./nx.win32-arm64-msvc.node')
|
98
93
|
} else {
|
99
|
-
nativeBinding = require('@nx/nx-win32-arm64-msvc')
|
94
|
+
nativeBinding = require('@nx/nx-win32-arm64-msvc')
|
100
95
|
}
|
101
96
|
} catch (e) {
|
102
|
-
loadError = e
|
97
|
+
loadError = e
|
103
98
|
}
|
104
|
-
break
|
99
|
+
break
|
105
100
|
default:
|
106
|
-
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
101
|
+
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
107
102
|
}
|
108
|
-
break
|
103
|
+
break
|
109
104
|
case 'darwin':
|
110
|
-
localFileExisted = existsSync(join(__dirname, 'nx.darwin-universal.node'))
|
105
|
+
localFileExisted = existsSync(join(__dirname, 'nx.darwin-universal.node'))
|
111
106
|
try {
|
112
107
|
if (localFileExisted) {
|
113
|
-
nativeBinding = require('./nx.darwin-universal.node')
|
108
|
+
nativeBinding = require('./nx.darwin-universal.node')
|
114
109
|
} else {
|
115
|
-
nativeBinding = require('@nx/nx-darwin-universal')
|
110
|
+
nativeBinding = require('@nx/nx-darwin-universal')
|
116
111
|
}
|
117
|
-
break
|
112
|
+
break
|
118
113
|
} catch {}
|
119
114
|
switch (arch) {
|
120
115
|
case 'x64':
|
121
|
-
localFileExisted = existsSync(join(__dirname, 'nx.darwin-x64.node'))
|
116
|
+
localFileExisted = existsSync(join(__dirname, 'nx.darwin-x64.node'))
|
122
117
|
try {
|
123
118
|
if (localFileExisted) {
|
124
|
-
nativeBinding = require('./nx.darwin-x64.node')
|
119
|
+
nativeBinding = require('./nx.darwin-x64.node')
|
125
120
|
} else {
|
126
|
-
nativeBinding = require('@nx/nx-darwin-x64')
|
121
|
+
nativeBinding = require('@nx/nx-darwin-x64')
|
127
122
|
}
|
128
123
|
} catch (e) {
|
129
|
-
loadError = e
|
124
|
+
loadError = e
|
130
125
|
}
|
131
|
-
break
|
126
|
+
break
|
132
127
|
case 'arm64':
|
133
|
-
localFileExisted = existsSync(
|
128
|
+
localFileExisted = existsSync(
|
129
|
+
join(__dirname, 'nx.darwin-arm64.node')
|
130
|
+
)
|
134
131
|
try {
|
135
132
|
if (localFileExisted) {
|
136
|
-
nativeBinding = require('./nx.darwin-arm64.node')
|
133
|
+
nativeBinding = require('./nx.darwin-arm64.node')
|
137
134
|
} else {
|
138
|
-
nativeBinding = require('@nx/nx-darwin-arm64')
|
135
|
+
nativeBinding = require('@nx/nx-darwin-arm64')
|
139
136
|
}
|
140
137
|
} catch (e) {
|
141
|
-
loadError = e
|
138
|
+
loadError = e
|
142
139
|
}
|
143
|
-
break
|
140
|
+
break
|
144
141
|
default:
|
145
|
-
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
142
|
+
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
146
143
|
}
|
147
|
-
break
|
144
|
+
break
|
148
145
|
case 'freebsd':
|
149
146
|
if (arch !== 'x64') {
|
150
|
-
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
147
|
+
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
151
148
|
}
|
152
|
-
localFileExisted = existsSync(join(__dirname, 'nx.freebsd-x64.node'))
|
149
|
+
localFileExisted = existsSync(join(__dirname, 'nx.freebsd-x64.node'))
|
153
150
|
try {
|
154
151
|
if (localFileExisted) {
|
155
|
-
nativeBinding = require('./nx.freebsd-x64.node')
|
152
|
+
nativeBinding = require('./nx.freebsd-x64.node')
|
156
153
|
} else {
|
157
|
-
nativeBinding = require('@nx/nx-freebsd-x64')
|
154
|
+
nativeBinding = require('@nx/nx-freebsd-x64')
|
158
155
|
}
|
159
156
|
} catch (e) {
|
160
|
-
loadError = e
|
157
|
+
loadError = e
|
161
158
|
}
|
162
|
-
break
|
159
|
+
break
|
163
160
|
case 'linux':
|
164
161
|
switch (arch) {
|
165
162
|
case 'x64':
|
166
163
|
if (isMusl()) {
|
167
164
|
localFileExisted = existsSync(
|
168
165
|
join(__dirname, 'nx.linux-x64-musl.node')
|
169
|
-
)
|
166
|
+
)
|
170
167
|
try {
|
171
168
|
if (localFileExisted) {
|
172
|
-
nativeBinding = require('./nx.linux-x64-musl.node')
|
169
|
+
nativeBinding = require('./nx.linux-x64-musl.node')
|
173
170
|
} else {
|
174
|
-
nativeBinding = require('@nx/nx-linux-x64-musl')
|
171
|
+
nativeBinding = require('@nx/nx-linux-x64-musl')
|
175
172
|
}
|
176
173
|
} catch (e) {
|
177
|
-
loadError = e
|
174
|
+
loadError = e
|
178
175
|
}
|
179
176
|
} else {
|
180
177
|
localFileExisted = existsSync(
|
181
178
|
join(__dirname, 'nx.linux-x64-gnu.node')
|
182
|
-
)
|
179
|
+
)
|
183
180
|
try {
|
184
181
|
if (localFileExisted) {
|
185
|
-
nativeBinding = require('./nx.linux-x64-gnu.node')
|
182
|
+
nativeBinding = require('./nx.linux-x64-gnu.node')
|
186
183
|
} else {
|
187
|
-
nativeBinding = require('@nx/nx-linux-x64-gnu')
|
184
|
+
nativeBinding = require('@nx/nx-linux-x64-gnu')
|
188
185
|
}
|
189
186
|
} catch (e) {
|
190
|
-
loadError = e
|
187
|
+
loadError = e
|
191
188
|
}
|
192
189
|
}
|
193
|
-
break
|
190
|
+
break
|
194
191
|
case 'arm64':
|
195
192
|
if (isMusl()) {
|
196
193
|
localFileExisted = existsSync(
|
197
194
|
join(__dirname, 'nx.linux-arm64-musl.node')
|
198
|
-
)
|
195
|
+
)
|
199
196
|
try {
|
200
197
|
if (localFileExisted) {
|
201
|
-
nativeBinding = require('./nx.linux-arm64-musl.node')
|
198
|
+
nativeBinding = require('./nx.linux-arm64-musl.node')
|
202
199
|
} else {
|
203
|
-
nativeBinding = require('@nx/nx-linux-arm64-musl')
|
200
|
+
nativeBinding = require('@nx/nx-linux-arm64-musl')
|
204
201
|
}
|
205
202
|
} catch (e) {
|
206
|
-
loadError = e
|
203
|
+
loadError = e
|
207
204
|
}
|
208
205
|
} else {
|
209
206
|
localFileExisted = existsSync(
|
210
207
|
join(__dirname, 'nx.linux-arm64-gnu.node')
|
211
|
-
)
|
208
|
+
)
|
212
209
|
try {
|
213
210
|
if (localFileExisted) {
|
214
|
-
nativeBinding = require('./nx.linux-arm64-gnu.node')
|
211
|
+
nativeBinding = require('./nx.linux-arm64-gnu.node')
|
215
212
|
} else {
|
216
|
-
nativeBinding = require('@nx/nx-linux-arm64-gnu')
|
213
|
+
nativeBinding = require('@nx/nx-linux-arm64-gnu')
|
217
214
|
}
|
218
215
|
} catch (e) {
|
219
|
-
loadError = e
|
216
|
+
loadError = e
|
220
217
|
}
|
221
218
|
}
|
222
|
-
break
|
219
|
+
break
|
223
220
|
case 'arm':
|
224
221
|
localFileExisted = existsSync(
|
225
222
|
join(__dirname, 'nx.linux-arm-gnueabihf.node')
|
226
|
-
)
|
223
|
+
)
|
227
224
|
try {
|
228
225
|
if (localFileExisted) {
|
229
|
-
nativeBinding = require('./nx.linux-arm-gnueabihf.node')
|
226
|
+
nativeBinding = require('./nx.linux-arm-gnueabihf.node')
|
230
227
|
} else {
|
231
|
-
nativeBinding = require('@nx/nx-linux-arm-gnueabihf')
|
228
|
+
nativeBinding = require('@nx/nx-linux-arm-gnueabihf')
|
232
229
|
}
|
233
230
|
} catch (e) {
|
234
|
-
loadError = e
|
231
|
+
loadError = e
|
235
232
|
}
|
236
|
-
break
|
233
|
+
break
|
237
234
|
default:
|
238
|
-
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
235
|
+
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
239
236
|
}
|
240
|
-
break
|
237
|
+
break
|
241
238
|
default:
|
242
|
-
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
239
|
+
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
243
240
|
}
|
244
241
|
|
245
242
|
if (!nativeBinding) {
|
246
243
|
if (loadError) {
|
247
|
-
throw loadError
|
244
|
+
throw loadError
|
248
245
|
}
|
249
|
-
throw new Error(`Failed to load native binding`)
|
246
|
+
throw new Error(`Failed to load native binding`)
|
250
247
|
}
|
251
248
|
|
252
|
-
const {
|
253
|
-
expandOutputs,
|
254
|
-
getFilesForOutputs,
|
255
|
-
remove,
|
256
|
-
copy,
|
257
|
-
hashArray,
|
258
|
-
hashFile,
|
259
|
-
ImportResult,
|
260
|
-
findImports,
|
261
|
-
transferProjectGraph,
|
262
|
-
ChildProcess,
|
263
|
-
RustPseudoTerminal,
|
264
|
-
HashPlanner,
|
265
|
-
TaskHasher,
|
266
|
-
EventType,
|
267
|
-
Watcher,
|
268
|
-
WorkspaceContext,
|
269
|
-
WorkspaceErrors,
|
270
|
-
testOnlyTransferFileMap,
|
271
|
-
} = nativeBinding;
|
249
|
+
const { expandOutputs, getFilesForOutputs, remove, copy, hashArray, hashFile, ImportResult, findImports, transferProjectGraph, ChildProcess, RustPseudoTerminal, HashPlanner, TaskHasher, EventType, Watcher, WorkspaceContext, WorkspaceErrors, testOnlyTransferFileMap } = nativeBinding
|
272
250
|
|
273
|
-
module.exports.expandOutputs = expandOutputs
|
274
|
-
module.exports.getFilesForOutputs = getFilesForOutputs
|
275
|
-
module.exports.remove = remove
|
276
|
-
module.exports.copy = copy
|
277
|
-
module.exports.hashArray = hashArray
|
278
|
-
module.exports.hashFile = hashFile
|
279
|
-
module.exports.ImportResult = ImportResult
|
280
|
-
module.exports.findImports = findImports
|
281
|
-
module.exports.transferProjectGraph = transferProjectGraph
|
282
|
-
module.exports.ChildProcess = ChildProcess
|
283
|
-
module.exports.RustPseudoTerminal = RustPseudoTerminal
|
284
|
-
module.exports.HashPlanner = HashPlanner
|
285
|
-
module.exports.TaskHasher = TaskHasher
|
286
|
-
module.exports.EventType = EventType
|
287
|
-
module.exports.Watcher = Watcher
|
288
|
-
module.exports.WorkspaceContext = WorkspaceContext
|
289
|
-
module.exports.WorkspaceErrors = WorkspaceErrors
|
290
|
-
module.exports.testOnlyTransferFileMap = testOnlyTransferFileMap
|
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
|
};
|
@@ -19,7 +19,7 @@ export declare class ProjectGraphError extends Error {
|
|
19
19
|
*/
|
20
20
|
getPartialProjectGraph(): ProjectGraph;
|
21
21
|
getPartialSourcemaps(): ConfigurationSourceMaps;
|
22
|
-
getErrors(): (
|
22
|
+
getErrors(): (ProcessDependenciesError | ProcessProjectGraphError | CreateNodesError | MergeNodesError | ProjectsWithNoNameError | ProjectsWithConflictingNamesError)[];
|
23
23
|
}
|
24
24
|
export declare class ProjectsWithConflictingNamesError extends Error {
|
25
25
|
projects: Record<string, ProjectConfiguration>;
|
@@ -69,3 +69,7 @@ export declare class DaemonProjectGraphError extends Error {
|
|
69
69
|
readonly sourceMaps: ConfigurationSourceMaps;
|
70
70
|
constructor(errors: any[], projectGraph: ProjectGraph, sourceMaps: ConfigurationSourceMaps);
|
71
71
|
}
|
72
|
+
export declare class LoadPluginError extends Error {
|
73
|
+
plugin: string;
|
74
|
+
constructor(plugin: string, cause: Error);
|
75
|
+
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
var _ProjectGraphError_errors, _ProjectGraphError_partialProjectGraph, _ProjectGraphError_partialSourceMaps;
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.DaemonProjectGraphError = exports.isMergeNodesError = exports.isAggregateCreateNodesError = exports.isCreateNodesError = exports.MergeNodesError = exports.AggregateCreateNodesError = exports.CreateNodesError = exports.ProjectConfigurationsError = exports.isProjectsWithNoNameError = exports.ProjectsWithNoNameError = exports.isProjectsWithConflictingNamesError = exports.ProjectsWithConflictingNamesError = exports.ProjectGraphError = void 0;
|
4
|
+
exports.LoadPluginError = exports.DaemonProjectGraphError = exports.isMergeNodesError = exports.isAggregateCreateNodesError = exports.isCreateNodesError = exports.MergeNodesError = exports.AggregateCreateNodesError = exports.CreateNodesError = exports.ProjectConfigurationsError = exports.isProjectsWithNoNameError = exports.ProjectsWithNoNameError = exports.isProjectsWithConflictingNamesError = exports.ProjectsWithConflictingNamesError = exports.ProjectGraphError = void 0;
|
5
5
|
const tslib_1 = require("tslib");
|
6
6
|
class ProjectGraphError extends Error {
|
7
7
|
constructor(errors, partialProjectGraph, partialSourceMaps) {
|
@@ -145,3 +145,13 @@ class DaemonProjectGraphError extends Error {
|
|
145
145
|
}
|
146
146
|
}
|
147
147
|
exports.DaemonProjectGraphError = DaemonProjectGraphError;
|
148
|
+
class LoadPluginError extends Error {
|
149
|
+
constructor(plugin, cause) {
|
150
|
+
super(`Could not load plugin ${plugin}`, {
|
151
|
+
cause,
|
152
|
+
});
|
153
|
+
this.plugin = plugin;
|
154
|
+
this.name = this.constructor.name;
|
155
|
+
}
|
156
|
+
}
|
157
|
+
exports.LoadPluginError = LoadPluginError;
|
@@ -1,7 +1,9 @@
|
|
1
|
+
/// <reference types="node" />
|
1
2
|
import { ProjectGraph, ProjectGraphProcessorContext } from '../../../config/project-graph';
|
2
3
|
import { PluginConfiguration } from '../../../config/nx-json';
|
3
4
|
import { CreateDependenciesContext, CreateNodesContext } from '../public-api';
|
4
5
|
import { LoadedNxPlugin } from '../internal-api';
|
6
|
+
import { Serializable } from 'child_process';
|
5
7
|
export interface PluginWorkerLoadMessage {
|
6
8
|
type: 'load';
|
7
9
|
payload: {
|
@@ -19,7 +21,7 @@ export interface PluginWorkerLoadResult {
|
|
19
21
|
success: true;
|
20
22
|
} | {
|
21
23
|
success: false;
|
22
|
-
error:
|
24
|
+
error: Error;
|
23
25
|
};
|
24
26
|
}
|
25
27
|
export interface PluginWorkerCreateNodesMessage {
|
@@ -38,7 +40,7 @@ export interface PluginWorkerCreateNodesResult {
|
|
38
40
|
tx: string;
|
39
41
|
} | {
|
40
42
|
success: false;
|
41
|
-
error:
|
43
|
+
error: Error;
|
42
44
|
tx: string;
|
43
45
|
};
|
44
46
|
}
|
@@ -57,7 +59,7 @@ export interface PluginCreateDependenciesResult {
|
|
57
59
|
tx: string;
|
58
60
|
} | {
|
59
61
|
success: false;
|
60
|
-
error:
|
62
|
+
error: Error;
|
61
63
|
tx: string;
|
62
64
|
};
|
63
65
|
}
|
@@ -77,18 +79,19 @@ export interface PluginWorkerProcessProjectGraphResult {
|
|
77
79
|
tx: string;
|
78
80
|
} | {
|
79
81
|
success: false;
|
80
|
-
error:
|
82
|
+
error: Error;
|
81
83
|
tx: string;
|
82
84
|
};
|
83
85
|
}
|
84
86
|
export type PluginWorkerMessage = PluginWorkerLoadMessage | PluginWorkerCreateNodesMessage | PluginCreateDependenciesMessage | PluginWorkerProcessProjectGraphMessage;
|
85
87
|
export type PluginWorkerResult = PluginWorkerLoadResult | PluginWorkerCreateNodesResult | PluginCreateDependenciesResult | PluginWorkerProcessProjectGraphResult;
|
88
|
+
export declare function isPluginWorkerMessage(message: Serializable): message is PluginWorkerMessage;
|
89
|
+
export declare function isPluginWorkerResult(message: Serializable): message is PluginWorkerResult;
|
86
90
|
type MaybePromise<T> = T | Promise<T>;
|
87
91
|
type MessageHandlerReturn<T extends PluginWorkerMessage | PluginWorkerResult> = T extends PluginWorkerResult ? MaybePromise<PluginWorkerMessage | void> : MaybePromise<PluginWorkerResult | void>;
|
88
|
-
export declare function consumeMessage<T extends PluginWorkerMessage | PluginWorkerResult>(raw:
|
92
|
+
export declare function consumeMessage<T extends PluginWorkerMessage | PluginWorkerResult>(raw: T, handlers: {
|
89
93
|
[K in T['type']]: (payload: Extract<T, {
|
90
94
|
type: K;
|
91
95
|
}>['payload']) => MessageHandlerReturn<T>;
|
92
96
|
}): Promise<void>;
|
93
|
-
export declare function createMessage(message: PluginWorkerMessage | PluginWorkerResult): string;
|
94
97
|
export {};
|