nx 22.5.0-beta.2 → 22.5.0-beta.4
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/README.md +3 -3
- package/package.json +13 -13
- package/src/ai/constants.d.ts +1 -0
- package/src/ai/constants.d.ts.map +1 -1
- package/src/ai/constants.js +4 -0
- package/src/ai/set-up-ai-agents/set-up-ai-agents.d.ts.map +1 -1
- package/src/ai/set-up-ai-agents/set-up-ai-agents.js +22 -0
- package/src/command-line/configure-ai-agents/configure-ai-agents.d.ts.map +1 -1
- package/src/command-line/configure-ai-agents/configure-ai-agents.js +77 -43
- package/src/command-line/nx-commands.js +1 -1
- package/src/command-line/release/changelog/version-plan-filtering.d.ts +6 -3
- package/src/command-line/release/changelog/version-plan-filtering.d.ts.map +1 -1
- package/src/command-line/release/changelog/version-plan-filtering.js +4 -3
- package/src/command-line/release/changelog.d.ts.map +1 -1
- package/src/command-line/release/changelog.js +11 -9
- package/src/command-line/release/utils/git.d.ts +3 -2
- package/src/command-line/release/utils/git.d.ts.map +1 -1
- package/src/command-line/release/utils/git.js +3 -69
- package/src/command-line/release/utils/release-graph.d.ts +10 -0
- package/src/command-line/release/utils/release-graph.d.ts.map +1 -1
- package/src/command-line/release/utils/release-graph.js +32 -1
- package/src/command-line/release/utils/repository-git-tags.d.ts +26 -0
- package/src/command-line/release/utils/repository-git-tags.d.ts.map +1 -0
- package/src/command-line/release/utils/repository-git-tags.js +125 -0
- package/src/command-line/release/utils/resolve-semver-specifier.d.ts +2 -1
- package/src/command-line/release/utils/resolve-semver-specifier.d.ts.map +1 -1
- package/src/command-line/release/utils/resolve-semver-specifier.js +2 -2
- package/src/command-line/release/utils/shared.d.ts +3 -2
- package/src/command-line/release/utils/shared.d.ts.map +1 -1
- package/src/command-line/release/utils/shared.js +4 -10
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.d.ts +2 -1
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.d.ts.map +1 -1
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.js +2 -2
- package/src/command-line/release/version/release-group-processor.d.ts.map +1 -1
- package/src/command-line/release/version/release-group-processor.js +1 -1
- package/src/command-line/run/run-one.d.ts +1 -1
- package/src/command-line/run/run-one.d.ts.map +1 -1
- package/src/command-line/run/run-one.js +12 -9
- package/src/core/graph/main.js +1 -1
- package/src/daemon/client/client.js +4 -4
- package/src/daemon/server/server.d.ts.map +1 -1
- package/src/daemon/server/server.js +3 -2
- package/src/daemon/server/shutdown-utils.d.ts.map +1 -1
- package/src/daemon/server/shutdown-utils.js +1 -1
- package/src/executors/run-commands/running-tasks.d.ts.map +1 -1
- package/src/executors/run-commands/running-tasks.js +4 -4
- package/src/hasher/hash-task.d.ts +3 -3
- package/src/hasher/hash-task.d.ts.map +1 -1
- package/src/hasher/hash-task.js +24 -5
- package/src/hasher/native-task-hasher-impl.d.ts +1 -1
- package/src/hasher/native-task-hasher-impl.d.ts.map +1 -1
- package/src/hasher/native-task-hasher-impl.js +2 -2
- package/src/hasher/task-hasher.d.ts +4 -1
- package/src/hasher/task-hasher.d.ts.map +1 -1
- package/src/hasher/task-hasher.js +1 -0
- package/src/native/index.d.ts +18 -2
- package/src/native/nx.wasi.cjs +29 -28
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/project-graph/plugins/get-plugins.d.ts.map +1 -1
- package/src/project-graph/plugins/get-plugins.js +81 -11
- package/src/project-graph/plugins/isolation/plugin-pool.d.ts.map +1 -1
- package/src/project-graph/plugins/isolation/plugin-pool.js +78 -27
- package/src/project-graph/plugins/isolation/plugin-worker.js +33 -17
- package/src/project-graph/project-graph.js +1 -1
- package/src/tasks-runner/cache.d.ts +2 -2
- package/src/tasks-runner/cache.d.ts.map +1 -1
- package/src/tasks-runner/cache.js +14 -11
- package/src/tasks-runner/forked-process-task-runner.d.ts +3 -3
- package/src/tasks-runner/forked-process-task-runner.d.ts.map +1 -1
- package/src/tasks-runner/forked-process-task-runner.js +12 -11
- package/src/tasks-runner/process-metrics-service.d.ts +2 -2
- package/src/tasks-runner/process-metrics-service.d.ts.map +1 -1
- package/src/tasks-runner/process-metrics-service.js +2 -2
- package/src/tasks-runner/run-command.d.ts.map +1 -1
- package/src/tasks-runner/task-io-service.d.ts +97 -0
- package/src/tasks-runner/task-io-service.d.ts.map +1 -0
- package/src/tasks-runner/task-io-service.js +146 -0
- package/src/utils/consume-messages-from-socket.d.ts.map +1 -1
- package/src/utils/consume-messages-from-socket.js +3 -1
- package/src/utils/promised-based-queue.d.ts +0 -7
- package/src/utils/promised-based-queue.d.ts.map +1 -1
- package/src/utils/promised-based-queue.js +0 -9
|
@@ -4,8 +4,7 @@ exports.loadRemoteNxPlugin = loadRemoteNxPlugin;
|
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
const net_1 = require("net");
|
|
6
6
|
const path = require("path");
|
|
7
|
-
|
|
8
|
-
// import { logger } from '../../utils/logger';
|
|
7
|
+
const logger_1 = require("../../../utils/logger");
|
|
9
8
|
const socket_utils_1 = require("../../../daemon/socket-utils");
|
|
10
9
|
const consume_messages_from_socket_1 = require("../../../utils/consume-messages-from-socket");
|
|
11
10
|
const installation_directory_1 = require("../../../utils/installation-directory");
|
|
@@ -116,6 +115,7 @@ function createWorkerHandler(worker, pending, onload, onloadError, socket) {
|
|
|
116
115
|
const { name, createNodesPattern, include, exclude } = result;
|
|
117
116
|
pluginName = name;
|
|
118
117
|
pluginNames.set(worker, pluginName);
|
|
118
|
+
logger_1.logger.verbose(`[plugin-pool] loaded plugin "${name}" from worker (pid: ${worker.pid})`);
|
|
119
119
|
onload({
|
|
120
120
|
name,
|
|
121
121
|
include,
|
|
@@ -298,6 +298,7 @@ function registerPendingPromise(tx, pending, callback, context) {
|
|
|
298
298
|
}
|
|
299
299
|
global.nxPluginWorkerCount ??= 0;
|
|
300
300
|
async function startPluginWorker(name) {
|
|
301
|
+
performance.mark(`start-plugin-worker:${name}`);
|
|
301
302
|
// this should only really be true when running unit tests within
|
|
302
303
|
// the Nx repo. We still need to start the worker in this case,
|
|
303
304
|
// but its typescript.
|
|
@@ -325,6 +326,7 @@ async function startPluginWorker(name) {
|
|
|
325
326
|
shell: false,
|
|
326
327
|
windowsHide: true,
|
|
327
328
|
});
|
|
329
|
+
logger_1.logger.verbose(`[plugin-pool] spawned worker for "${name}" (pid: ${worker.pid}, socket: ${ipcPath})`);
|
|
328
330
|
// To make debugging easier and allow plugins to communicate things
|
|
329
331
|
// like performance metrics, we pipe the stdout/stderr of the worker
|
|
330
332
|
// to the main process.
|
|
@@ -343,32 +345,11 @@ async function startPluginWorker(name) {
|
|
|
343
345
|
if (stderrMaxListeners !== 0) {
|
|
344
346
|
process.stderr.setMaxListeners(stderrMaxListeners + 1);
|
|
345
347
|
}
|
|
346
|
-
worker.
|
|
347
|
-
worker.
|
|
348
|
+
// Pipe and unref the worker streams. The utility handles cross-runtime compatibility.
|
|
349
|
+
pipeAndUnrefChildStream(worker.stdout, process.stdout, 'stdout');
|
|
350
|
+
pipeAndUnrefChildStream(worker.stderr, process.stderr, 'stderr');
|
|
348
351
|
// Unref the worker process so it doesn't prevent the parent from exiting.
|
|
349
|
-
// IMPORTANT: We must also unref the stdout/stderr streams. When streams are
|
|
350
|
-
// piped, they maintain internal references in Node's event loop. Without
|
|
351
|
-
// unreferencing them, the parent process will wait for the worker to exit
|
|
352
|
-
// even after worker.unref() is called. This causes e2e tests to hang on CI
|
|
353
|
-
// where test frameworks wait for all handles to be released.
|
|
354
|
-
//
|
|
355
|
-
// Although TypeScript types these as Readable/Writable, they are actually
|
|
356
|
-
// net.Socket instances at runtime. Node.js internally creates sockets for
|
|
357
|
-
// stdio pipes (see lib/internal/child_process.js createSocket function).
|
|
358
|
-
// Socket.unref() allows the event loop to exit if these are the only handles.
|
|
359
352
|
worker.unref();
|
|
360
|
-
if (worker.stdout instanceof net_1.Socket) {
|
|
361
|
-
worker.stdout.unref();
|
|
362
|
-
}
|
|
363
|
-
else {
|
|
364
|
-
throw new Error(`Expected worker.stdout to be an instance of Socket, but got ${getTypeName(worker.stdout)}`);
|
|
365
|
-
}
|
|
366
|
-
if (worker.stderr instanceof net_1.Socket) {
|
|
367
|
-
worker.stderr.unref();
|
|
368
|
-
}
|
|
369
|
-
else {
|
|
370
|
-
throw new Error(`Expected worker.stderr to be an instance of Socket, but got ${getTypeName(worker.stderr)}`);
|
|
371
|
-
}
|
|
372
353
|
let attempts = 0;
|
|
373
354
|
return new Promise((resolve, reject) => {
|
|
374
355
|
const id = setInterval(async () => {
|
|
@@ -376,6 +357,7 @@ async function startPluginWorker(name) {
|
|
|
376
357
|
if (socket) {
|
|
377
358
|
socket.unref();
|
|
378
359
|
clearInterval(id);
|
|
360
|
+
logger_1.logger.verbose(`[plugin-pool] connected to worker for "${name}" (pid: ${worker.pid}) after ${attempts} attempt(s)`);
|
|
379
361
|
resolve({
|
|
380
362
|
worker,
|
|
381
363
|
socket,
|
|
@@ -384,12 +366,16 @@ async function startPluginWorker(name) {
|
|
|
384
366
|
else if (attempts > 10000) {
|
|
385
367
|
// daemon fails to start, the process probably exited
|
|
386
368
|
// we print the logs and exit the client
|
|
387
|
-
|
|
369
|
+
clearInterval(id);
|
|
370
|
+
reject(new Error(`Failed to start plugin worker for plugin ${name}`));
|
|
388
371
|
}
|
|
389
372
|
else {
|
|
390
373
|
attempts++;
|
|
391
374
|
}
|
|
392
375
|
}, 10);
|
|
376
|
+
}).finally(() => {
|
|
377
|
+
performance.mark(`start-plugin-worker-end:${name}`);
|
|
378
|
+
performance.measure(`start-plugin-worker:${name}`, `start-plugin-worker:${name}`, `start-plugin-worker-end:${name}`);
|
|
393
379
|
});
|
|
394
380
|
}
|
|
395
381
|
function isServerAvailable(ipcPath) {
|
|
@@ -420,3 +406,68 @@ function getTypeName(u) {
|
|
|
420
406
|
}
|
|
421
407
|
return u.constructor?.name ?? 'unknown object';
|
|
422
408
|
}
|
|
409
|
+
/**
|
|
410
|
+
* Detects if we're running under an alternative JavaScript runtime (Bun or Deno).
|
|
411
|
+
* Returns the runtime name for helpful error messages, or null if running on Node.js.
|
|
412
|
+
*/
|
|
413
|
+
function detectAlternativeRuntime() {
|
|
414
|
+
// Check for Bun runtime - the Bun global is only available in Bun
|
|
415
|
+
if ('Bun' in globalThis && typeof globalThis.Bun !== 'undefined') {
|
|
416
|
+
return 'bun';
|
|
417
|
+
}
|
|
418
|
+
// Check for Deno runtime - the Deno global is only available in Deno
|
|
419
|
+
if ('Deno' in globalThis && typeof globalThis.Deno !== 'undefined') {
|
|
420
|
+
return 'deno';
|
|
421
|
+
}
|
|
422
|
+
return null;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Pipes a child process stream to a destination and attempts to unref it to prevent
|
|
426
|
+
* the stream from keeping the parent process alive.
|
|
427
|
+
*
|
|
428
|
+
* In Node.js, child process stdio streams are actually net.Socket instances when
|
|
429
|
+
* using 'pipe' stdio option. However, alternative runtimes like Bun and Deno may
|
|
430
|
+
* use standard Readable/Writable streams instead.
|
|
431
|
+
*
|
|
432
|
+
* This function:
|
|
433
|
+
* 1. Pipes the source to the destination
|
|
434
|
+
* 2. Attempts to unref the source stream to allow the parent process to exit
|
|
435
|
+
* 3. Uses duck-typing to check for unref support when not a Socket instance
|
|
436
|
+
* 4. Emits helpful warnings for alternative runtimes if unref is not available
|
|
437
|
+
*
|
|
438
|
+
* @param source - The child process stream (stdout or stderr)
|
|
439
|
+
* @param destination - The process stream to pipe to (process.stdout or process.stderr)
|
|
440
|
+
* @param streamName - Name of the stream for warning messages ('stdout' or 'stderr')
|
|
441
|
+
*/
|
|
442
|
+
function pipeAndUnrefChildStream(source, destination, streamName) {
|
|
443
|
+
if (!source) {
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
source.pipe(destination);
|
|
447
|
+
// Node.js creates net.Socket instances for stdio pipes. Use instanceof check first.
|
|
448
|
+
if (source instanceof net_1.Socket) {
|
|
449
|
+
source.unref();
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
// For non-Socket streams (e.g., in Bun/Deno), use duck-typing to check for unref
|
|
453
|
+
// NOTE: These should also be a Socket, but alternative runtimes may implement differently...
|
|
454
|
+
// See:
|
|
455
|
+
// - https://github.com/denoland/deno/issues/31961
|
|
456
|
+
// - https://github.com/oven-sh/bun/issues/26505
|
|
457
|
+
if (typeof source.unref === 'function') {
|
|
458
|
+
source.unref();
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
// Stream doesn't support unref - emit a warning with runtime-specific guidance
|
|
462
|
+
const runtime = detectAlternativeRuntime();
|
|
463
|
+
if (runtime) {
|
|
464
|
+
console.warn(`[NX] worker.${streamName} does not support unref() in ${runtime}. ` +
|
|
465
|
+
`This may cause the process to hang when waiting for plugin workers to exit. ` +
|
|
466
|
+
`This is a known limitation of ${runtime}'s Node.js compatibility layer.`);
|
|
467
|
+
}
|
|
468
|
+
else {
|
|
469
|
+
console.warn(`[NX] worker.${streamName} is not a net.Socket and does not have an unref() method. ` +
|
|
470
|
+
`Expected Socket, got ${getTypeName(source)}. ` +
|
|
471
|
+
`This may cause the process to hang when waiting for plugin workers to exit.`);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
@@ -2,30 +2,35 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const node_perf_hooks_1 = require("node:perf_hooks");
|
|
4
4
|
node_perf_hooks_1.performance.mark(`plugin worker ${process.pid} code loading -- start`);
|
|
5
|
-
const messaging_1 = require("./messaging");
|
|
6
|
-
const serializable_error_1 = require("../../../utils/serializable-error");
|
|
7
5
|
const consume_messages_from_socket_1 = require("../../../utils/consume-messages-from-socket");
|
|
8
|
-
const
|
|
6
|
+
const logger_1 = require("../../../utils/logger");
|
|
7
|
+
const serializable_error_1 = require("../../../utils/serializable-error");
|
|
8
|
+
const messaging_1 = require("./messaging");
|
|
9
9
|
const fs_1 = require("fs");
|
|
10
|
-
|
|
10
|
+
const net_1 = require("net");
|
|
11
|
+
const environment = process.env;
|
|
12
|
+
if (environment.NX_PERF_LOGGING === 'true') {
|
|
11
13
|
require('../../../utils/perf-logging');
|
|
12
14
|
}
|
|
13
15
|
node_perf_hooks_1.performance.mark(`plugin worker ${process.pid} code loading -- end`);
|
|
14
16
|
node_perf_hooks_1.performance.measure(`plugin worker ${process.pid} code loading`, `plugin worker ${process.pid} code loading -- start`, `plugin worker ${process.pid} code loading -- end`);
|
|
15
17
|
global.NX_GRAPH_CREATION = true;
|
|
16
18
|
global.NX_PLUGIN_WORKER = true;
|
|
17
|
-
let connected = false;
|
|
18
19
|
let plugin;
|
|
19
20
|
const socketPath = process.argv[2];
|
|
21
|
+
const expectedPluginName = process.argv[3];
|
|
22
|
+
let connectErrorTimeout = setErrorTimeout(5000, `The plugin worker for ${expectedPluginName} is exiting as it was not connected to within 5 seconds. ` +
|
|
23
|
+
'Plugin workers expect to receive a socket connection from the parent process shortly after being started. ' +
|
|
24
|
+
'If you are seeing this issue, please report it to the Nx team at https://github.com/nrwl/nx/issues.');
|
|
20
25
|
const server = (0, net_1.createServer)((socket) => {
|
|
21
|
-
|
|
26
|
+
connectErrorTimeout?.clear();
|
|
27
|
+
logger_1.logger.verbose(`[plugin-worker] "${expectedPluginName}" (pid: ${process.pid}) connected`);
|
|
22
28
|
// This handles cases where the host process was killed
|
|
23
29
|
// after the worker connected but before the worker was
|
|
24
30
|
// instructed to load the plugin.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}, 10000).unref();
|
|
31
|
+
let loadErrorTimeout = setErrorTimeout(10_000, `Plugin Worker for ${expectedPluginName} is exiting as it did not receive a load message within 10 seconds of connecting. ` +
|
|
32
|
+
'This likely indicates that the host process was terminated before the worker could be instructed to load the plugin. ' +
|
|
33
|
+
'If you are seeing this issue, please report it to the Nx team at https://github.com/nrwl/nx/issues.');
|
|
29
34
|
socket.on('data', (0, consume_messages_from_socket_1.consumeMessagesFromSocket)((raw) => {
|
|
30
35
|
const message = JSON.parse(raw.toString());
|
|
31
36
|
if (!(0, messaging_1.isPluginWorkerMessage)(message)) {
|
|
@@ -33,8 +38,7 @@ const server = (0, net_1.createServer)((socket) => {
|
|
|
33
38
|
}
|
|
34
39
|
return (0, messaging_1.consumeMessage)(socket, message, {
|
|
35
40
|
load: async ({ plugin: pluginConfiguration, root, name, pluginPath, shouldRegisterTSTranspiler, }) => {
|
|
36
|
-
|
|
37
|
-
clearTimeout(loadTimeout);
|
|
41
|
+
loadErrorTimeout?.clear();
|
|
38
42
|
process.chdir(root);
|
|
39
43
|
try {
|
|
40
44
|
const { loadResolvedNxPluginAsync } = await Promise.resolve().then(() => require('../load-resolved-plugin'));
|
|
@@ -44,6 +48,7 @@ const server = (0, net_1.createServer)((socket) => {
|
|
|
44
48
|
require('../transpiler').registerPluginTSTranspiler();
|
|
45
49
|
}
|
|
46
50
|
plugin = await loadResolvedNxPluginAsync(pluginConfiguration, pluginPath, name);
|
|
51
|
+
logger_1.logger.verbose(`[plugin-worker] "${name}" (pid: ${process.pid}) loaded successfully`);
|
|
47
52
|
return {
|
|
48
53
|
type: 'load-result',
|
|
49
54
|
payload: {
|
|
@@ -186,13 +191,24 @@ const server = (0, net_1.createServer)((socket) => {
|
|
|
186
191
|
});
|
|
187
192
|
});
|
|
188
193
|
server.listen(socketPath);
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
194
|
+
logger_1.logger.verbose(`[plugin-worker] "${expectedPluginName}" (pid: ${process.pid}) listening on ${socketPath}`);
|
|
195
|
+
function setErrorTimeout(timeoutMs, errorMessage) {
|
|
196
|
+
if (environment.NX_PLUGIN_NO_TIMEOUTS === 'true') {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
let cleared = false;
|
|
200
|
+
const timeout = setTimeout(() => {
|
|
201
|
+
if (!cleared) {
|
|
202
|
+
console.error(errorMessage);
|
|
193
203
|
process.exit(1);
|
|
194
204
|
}
|
|
195
|
-
},
|
|
205
|
+
}, timeoutMs).unref();
|
|
206
|
+
return {
|
|
207
|
+
clear: () => {
|
|
208
|
+
cleared = true;
|
|
209
|
+
clearTimeout(timeout);
|
|
210
|
+
},
|
|
211
|
+
};
|
|
196
212
|
}
|
|
197
213
|
const exitHandler = (exitCode) => () => {
|
|
198
214
|
server.close();
|
|
@@ -40,7 +40,7 @@ function readCachedProjectGraph(minimumComputedAt) {
|
|
|
40
40
|
? (0, strip_indents_1.stripIndents) `
|
|
41
41
|
Make sure invoke 'node ./decorate-angular-cli.js' in your postinstall script.
|
|
42
42
|
The decorated CLI will compute the project graph.
|
|
43
|
-
'ng --help' should say 'Smart
|
|
43
|
+
'ng --help' should say 'Smart Monorepos · Fast Builds'.
|
|
44
44
|
`
|
|
45
45
|
: '';
|
|
46
46
|
throw new Error((0, strip_indents_1.stripIndents) `
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DefaultTasksRunnerOptions, RemoteCache } from './default-tasks-runner';
|
|
2
|
-
import { Task } from '../config/task-graph';
|
|
3
1
|
import { NxJsonConfiguration } from '../config/nx-json';
|
|
2
|
+
import { Task } from '../config/task-graph';
|
|
3
|
+
import { DefaultTasksRunnerOptions, RemoteCache } from './default-tasks-runner';
|
|
4
4
|
export type CachedResult = {
|
|
5
5
|
terminalOutput: string;
|
|
6
6
|
outputsPath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/tasks-runner/cache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/tasks-runner/cache.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,mBAAmB,EAAc,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAoB5C,OAAO,EACL,yBAAyB,EACzB,WAAW,EAEZ,MAAM,wBAAwB,CAAC;AAGhC,MAAM,MAAM,YAAY,GAAG;IACzB,cAAc,E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;AAED;;GAEG;AACH,qBAAa,KAAK;IAOJ,OAAO,CAAC,QAAQ,CAAC,OAAO;IANpC,IAAI,SAAiB;IACrB,SAAS,SAAyB;IAClC,kBAAkB,SAAmC;IAErD,OAAO,CAAC,iBAAiB,CAAgB;gBAEZ,OAAO,EAAE,yBAAyB;IAW/D,qBAAqB;IAuBf,gBAAgB;IAchB,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAkB7C,GAAG,CACP,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,MAAM,GAAG,IAAI,EAC7B,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,EAAE,MAAM;IAkDR,kBAAkB,CACtB,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,MAAM,EAAE;IAoBnB,mBAAmB,CAAC,IAAI,EAAE,IAAI;YAIhB,wBAAwB;YAIxB,oBAAoB;YAOpB,cAAc;YAiBd,IAAI;YAiBJ,MAAM;YAYN,eAAe;YAwBf,wBAAwB;IAyBtC,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,wBAAwB;CAKjC;AA0BD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAKvE;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,MAAM,GAAG,MAAM,GAC5B,MAAM,GAAG,SAAS,CAqCpB;AAED,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,MAAM,CAS1E"}
|
|
@@ -6,24 +6,25 @@ exports.getCache = getCache;
|
|
|
6
6
|
exports.resolveMaxCacheSize = resolveMaxCacheSize;
|
|
7
7
|
exports.parseMaxCacheSize = parseMaxCacheSize;
|
|
8
8
|
exports.formatCacheSize = formatCacheSize;
|
|
9
|
-
const workspace_root_1 = require("../utils/workspace-root");
|
|
10
|
-
const path_1 = require("path");
|
|
11
|
-
const perf_hooks_1 = require("perf_hooks");
|
|
12
|
-
const default_tasks_runner_1 = require("./default-tasks-runner");
|
|
13
9
|
const child_process_1 = require("child_process");
|
|
10
|
+
const node_machine_id_1 = require("node-machine-id");
|
|
14
11
|
const node_fs_1 = require("node:fs");
|
|
15
12
|
const promises_1 = require("node:fs/promises");
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const native_1 = require("../native");
|
|
19
|
-
const db_connection_1 = require("../utils/db-connection");
|
|
20
|
-
const nx_cloud_utils_1 = require("../utils/nx-cloud-utils");
|
|
13
|
+
const path_1 = require("path");
|
|
14
|
+
const perf_hooks_1 = require("perf_hooks");
|
|
21
15
|
const nx_json_1 = require("../config/nx-json");
|
|
16
|
+
const native_1 = require("../native");
|
|
22
17
|
const update_manager_1 = require("../nx-cloud/update-manager");
|
|
23
18
|
const get_cloud_options_1 = require("../nx-cloud/utilities/get-cloud-options");
|
|
19
|
+
const cache_directory_1 = require("../utils/cache-directory");
|
|
20
|
+
const db_connection_1 = require("../utils/db-connection");
|
|
24
21
|
const is_ci_1 = require("../utils/is-ci");
|
|
25
|
-
const output_1 = require("../utils/output");
|
|
26
22
|
const logger_1 = require("../utils/logger");
|
|
23
|
+
const nx_cloud_utils_1 = require("../utils/nx-cloud-utils");
|
|
24
|
+
const output_1 = require("../utils/output");
|
|
25
|
+
const workspace_root_1 = require("../utils/workspace-root");
|
|
26
|
+
const default_tasks_runner_1 = require("./default-tasks-runner");
|
|
27
|
+
const task_io_service_1 = require("./task-io-service");
|
|
27
28
|
// This function is called once during tasks runner initialization. It checks if the db cache is enabled and logs a warning if it is not.
|
|
28
29
|
function dbCacheEnabled() {
|
|
29
30
|
// ...but if on wasm and the the db cache isnt supported we shouldn't warn
|
|
@@ -103,7 +104,9 @@ class DbCache {
|
|
|
103
104
|
}
|
|
104
105
|
async put(task, terminalOutput, outputs, code) {
|
|
105
106
|
return tryAndRetry(async () => {
|
|
106
|
-
this.cache.put(task.hash, terminalOutput, outputs, code);
|
|
107
|
+
const expandedOutputs = this.cache.put(task.hash, terminalOutput, outputs, code);
|
|
108
|
+
// Notify TaskIOService of actual output files
|
|
109
|
+
(0, task_io_service_1.getTaskIOService)().notifyTaskOutputs(task.id, expandedOutputs);
|
|
107
110
|
if (this.remoteCache) {
|
|
108
111
|
await this.remoteCache.store(task.hash, this.cache.cacheDirectory, terminalOutput, code);
|
|
109
112
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Batch } from './tasks-schedule';
|
|
1
|
+
import { ProjectGraph } from '../config/project-graph';
|
|
3
2
|
import { Task, TaskGraph } from '../config/task-graph';
|
|
3
|
+
import { DefaultTasksRunnerOptions } from './default-tasks-runner';
|
|
4
4
|
import { PseudoTtyProcess } from './pseudo-terminal';
|
|
5
|
-
import { ProjectGraph } from '../config/project-graph';
|
|
6
5
|
import { BatchProcess } from './running-tasks/batch-process';
|
|
7
6
|
import { RunningTask } from './running-tasks/running-task';
|
|
7
|
+
import { Batch } from './tasks-schedule';
|
|
8
8
|
export declare class ForkedProcessTaskRunner {
|
|
9
9
|
private readonly options;
|
|
10
10
|
private readonly tuiEnabled;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forked-process-task-runner.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/tasks-runner/forked-process-task-runner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"forked-process-task-runner.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/tasks-runner/forked-process-task-runner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAMvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAEnE,OAAO,EAAkB,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,YA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,EAAE,MAAM,CAAC,UAAU,CAAC;QACvB,qBAAqB,EAAE,OAAO,CAAC;KAChC,GACA,OAAO,CAAC,WAAW,GAAG,gBAAgB,CAAC;YAiC5B,oBAAoB;YAYpB,6BAA6B;IAkE3C,OAAO,CAAC,8BAA8B;IAmEtC,OAAO,CAAC,8BAA8B;IA2EtC,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO;IAO/B,OAAO,CAAC,0BAA0B;CAwCnC"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ForkedProcessTaskRunner = void 0;
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
4
|
const child_process_1 = require("child_process");
|
|
6
|
-
const
|
|
7
|
-
const utils_1 = require("./utils");
|
|
5
|
+
const fs_1 = require("fs");
|
|
8
6
|
const path_1 = require("path");
|
|
9
|
-
const
|
|
7
|
+
const native_1 = require("../native");
|
|
8
|
+
const exit_codes_1 = require("../utils/exit-codes");
|
|
9
|
+
const output_1 = require("../utils/output");
|
|
10
10
|
const strip_indents_1 = require("../utils/strip-indents");
|
|
11
|
+
const batch_messages_1 = require("./batch/batch-messages");
|
|
12
|
+
const process_metrics_service_1 = require("./process-metrics-service");
|
|
11
13
|
const pseudo_terminal_1 = require("./pseudo-terminal");
|
|
12
|
-
const exit_codes_1 = require("../utils/exit-codes");
|
|
13
|
-
const node_child_process_1 = require("./running-tasks/node-child-process");
|
|
14
14
|
const batch_process_1 = require("./running-tasks/batch-process");
|
|
15
|
-
const
|
|
16
|
-
const
|
|
15
|
+
const node_child_process_1 = require("./running-tasks/node-child-process");
|
|
16
|
+
const task_io_service_1 = require("./task-io-service");
|
|
17
|
+
const utils_1 = require("./utils");
|
|
17
18
|
const forkScript = (0, path_1.join)(__dirname, './fork.js');
|
|
18
19
|
const workerPath = (0, path_1.join)(__dirname, './batch/run-batch.js');
|
|
19
20
|
class ForkedProcessTaskRunner {
|
|
@@ -144,7 +145,7 @@ class ForkedProcessTaskRunner {
|
|
|
144
145
|
// Register forked process for metrics collection
|
|
145
146
|
const pid = p.getPid();
|
|
146
147
|
if (pid) {
|
|
147
|
-
(0,
|
|
148
|
+
(0, task_io_service_1.registerTaskProcessStart)(task.id, pid);
|
|
148
149
|
}
|
|
149
150
|
p.send({
|
|
150
151
|
targetDescription: task.target,
|
|
@@ -185,7 +186,7 @@ class ForkedProcessTaskRunner {
|
|
|
185
186
|
});
|
|
186
187
|
// Register forked process for metrics collection
|
|
187
188
|
if (p.pid) {
|
|
188
|
-
(0,
|
|
189
|
+
(0, task_io_service_1.registerTaskProcessStart)(task.id, p.pid);
|
|
189
190
|
}
|
|
190
191
|
// Send message to run the executor
|
|
191
192
|
p.send({
|
|
@@ -228,7 +229,7 @@ class ForkedProcessTaskRunner {
|
|
|
228
229
|
});
|
|
229
230
|
// Register forked process for metrics collection
|
|
230
231
|
if (p.pid) {
|
|
231
|
-
(0,
|
|
232
|
+
(0, task_io_service_1.registerTaskProcessStart)(task.id, p.pid);
|
|
232
233
|
}
|
|
233
234
|
const cp = new node_child_process_1.NodeChildProcessWithDirectOutput(p, temporaryOutputPath);
|
|
234
235
|
this.processes.add(cp);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type {
|
|
1
|
+
import { GroupInfo, GroupType, Metadata, MetricsUpdate, ProcessMetadata, ProcessMetrics, SystemInfo } from '../native';
|
|
2
|
+
export type { GroupInfo, GroupType, Metadata, MetricsUpdate, ProcessMetadata, ProcessMetrics, SystemInfo, };
|
|
3
3
|
export type MetricsCallback = (event: MetricsUpdate) => void;
|
|
4
4
|
/**
|
|
5
5
|
* Simplified service providing subscription-based access to Rust metrics collector
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-metrics-service.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/tasks-runner/process-metrics-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"process-metrics-service.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/tasks-runner/process-metrics-service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,SAAS,EACT,QAAQ,EACR,aAAa,EACb,eAAe,EACf,cAAc,EAEd,UAAU,EACX,MAAM,WAAW,CAAC;AAEnB,YAAY,EACV,SAAS,EACT,SAAS,EACT,QAAQ,EACR,aAAa,EACb,eAAe,EACf,cAAc,EACd,UAAU,GACX,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;AAE7D;;;;GAIG;AACH,cAAM,qBAAqB;IACzB,OAAO,CAAC,SAAS,CAAwC;IACzD,OAAO,CAAC,iBAAiB,CAAS;;IAmBlC;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAe/B;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IA+B1C;;;OAGG;IACH,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAQtD;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAQpE;;OAEG;IACH,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAQxC;;OAEG;IACH,yBAAyB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ5D;;OAEG;IACH,aAAa,IAAI,UAAU,GAAG,IAAI;IASlC;;OAEG;IACH,QAAQ,IAAI,IAAI;CAOjB;AAOD;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,qBAAqB,CAKhE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getProcessMetricsService = getProcessMetricsService;
|
|
4
|
-
const native_1 = require("../native");
|
|
5
4
|
const cache_1 = require("../daemon/cache");
|
|
5
|
+
const native_1 = require("../native");
|
|
6
6
|
/**
|
|
7
7
|
* Simplified service providing subscription-based access to Rust metrics collector
|
|
8
8
|
* Manages singleton access pattern for metrics collection during execution of tasks and CLI commands
|
|
@@ -50,7 +50,7 @@ class ProcessMetricsService {
|
|
|
50
50
|
*/
|
|
51
51
|
subscribe(callback) {
|
|
52
52
|
if (!this.collector) {
|
|
53
|
-
|
|
53
|
+
throw new Error('Metrics collector not initialized');
|
|
54
54
|
}
|
|
55
55
|
try {
|
|
56
56
|
// Start collection on first subscription (idempotent - safe to call multiple times)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-command.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/tasks-runner/run-command.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,mBAAmB,EAGpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAa/E,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAkBrD,OAAO,EAEL,SAAS,EACT,UAAU,EACV,WAAW,EACZ,MAAM,cAAc,CAAC;AAkBtB,OAAO,EAAE,WAAW,EAAc,MAAM,gBAAgB,CAAC;AAuWzD,wBAAsB,UAAU,CAC9B,aAAa,EAAE,uBAAuB,EAAE,EACxC,mBAAmB,EAAE,YAAY,EACjC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,mBAAmB,CAAA;CAAE,EAC3C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,GAAG,EACd,iBAAiB,EAAE,MAAM,GAAG,IAAI,EAChC,uBAAuB,EA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,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,OAAO,CAAC;IACzB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,eAAe,EAAE,IAAI,EAAE,CAAC;CACzB,GAAG,OAAO,CAAC;IAAE,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,CAAC,CA4GxC;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,EAAE,CAarE;AAsED,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,mBAAmB,GAC1B;IACD,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,EAAE,GAAG,CAAC;CACpB,CAyBA;AAqCD,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,mBAAmB,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,EAC3C,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,OAAO,GACtB,GAAG,CAsDL"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { ProjectGraph } from '../config/project-graph';
|
|
2
|
+
import { TaskGraph } from '../config/task-graph';
|
|
3
|
+
/**
|
|
4
|
+
* Maps taskId -> PID. Note that this only Returns
|
|
5
|
+
* the PID that the main task process is running under,
|
|
6
|
+
* not any child processes it may have spawned. To fully
|
|
7
|
+
* trace the task's processes, you'll need to correlate
|
|
8
|
+
* spawned processes's PIDs with their parent PID.
|
|
9
|
+
*/
|
|
10
|
+
export type TaskPidUpdate = {
|
|
11
|
+
taskId: string;
|
|
12
|
+
pid: number;
|
|
13
|
+
};
|
|
14
|
+
export type TaskPidCallback = (update: TaskPidUpdate) => void;
|
|
15
|
+
export type TaskInputInfo = {
|
|
16
|
+
taskId: string;
|
|
17
|
+
inputs: {
|
|
18
|
+
files: string[];
|
|
19
|
+
runtime: string[];
|
|
20
|
+
environment: string[];
|
|
21
|
+
depOutputs: string[];
|
|
22
|
+
external: string[];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type TaskInputCallback = (taskInputInfo: TaskInputInfo) => void;
|
|
26
|
+
export type TaskOutputsUpdate = {
|
|
27
|
+
taskId: string;
|
|
28
|
+
outputs: string[];
|
|
29
|
+
};
|
|
30
|
+
export type TaskOutputsCallback = (update: TaskOutputsUpdate) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Service for tracking task process IDs and providing access to task IO information.
|
|
33
|
+
* Subscribes to ProcessMetricsService for PID discovery.
|
|
34
|
+
* IO information comes from hash inputs (populated during hashing).
|
|
35
|
+
* Output files are reported when tasks are stored to cache.
|
|
36
|
+
*/
|
|
37
|
+
declare class TaskIOService {
|
|
38
|
+
protected taskToPids: Map<string, number>;
|
|
39
|
+
protected taskToInputs: Map<string, TaskInputInfo>;
|
|
40
|
+
protected taskToOutputs: Map<string, string[]>;
|
|
41
|
+
private pidCallbacks;
|
|
42
|
+
private taskInputCallbacks;
|
|
43
|
+
private taskOutputsCallbacks;
|
|
44
|
+
protected projectGraph: ProjectGraph | null;
|
|
45
|
+
protected taskGraph: TaskGraph | null;
|
|
46
|
+
constructor(projectGraph?: ProjectGraph, taskGraph?: TaskGraph);
|
|
47
|
+
/**
|
|
48
|
+
* Subscribe to task PID updates.
|
|
49
|
+
* Receives notifications when processes are added/removed from tasks.
|
|
50
|
+
*/
|
|
51
|
+
subscribeToTaskPids(callback: TaskPidCallback): void;
|
|
52
|
+
/**
|
|
53
|
+
* Subscribe to hash inputs as they are computed.
|
|
54
|
+
* Called when a task's hash inputs become available.
|
|
55
|
+
*/
|
|
56
|
+
subscribeToTaskInputs(callback: TaskInputCallback): void;
|
|
57
|
+
/**
|
|
58
|
+
* Subscribe to task outputs as they are stored to cache.
|
|
59
|
+
* Called when a task's output files are collected for caching.
|
|
60
|
+
*/
|
|
61
|
+
subscribeToTaskOutputs(callback: TaskOutputsCallback): void;
|
|
62
|
+
/**
|
|
63
|
+
* Notify subscribers that hash inputs are available for a task.
|
|
64
|
+
* Called from the hasher when inputs are computed.
|
|
65
|
+
*/
|
|
66
|
+
notifyTaskInputs(taskId: string, inputs: {
|
|
67
|
+
files: string[];
|
|
68
|
+
runtime: string[];
|
|
69
|
+
environment: string[];
|
|
70
|
+
depOutputs: string[];
|
|
71
|
+
external: string[];
|
|
72
|
+
}): void;
|
|
73
|
+
/**
|
|
74
|
+
* Notify subscribers that task outputs have been collected.
|
|
75
|
+
* Called from the cache when outputs are stored.
|
|
76
|
+
*/
|
|
77
|
+
notifyTaskOutputs(taskId: string, outputs: string[]): void;
|
|
78
|
+
/**
|
|
79
|
+
* Registers a PID to a task and notifies subscribers.
|
|
80
|
+
* @param update The TaskPidUpdate containing taskId and pid.
|
|
81
|
+
*/
|
|
82
|
+
notifyPidUpdate(update: TaskPidUpdate): void;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Get or create the singleton TaskIOService instance.
|
|
86
|
+
* Optionally provide projectGraph and taskGraph to initialize with context.
|
|
87
|
+
*/
|
|
88
|
+
export declare function getTaskIOService(projectGraph?: ProjectGraph, taskGraph?: TaskGraph): TaskIOService;
|
|
89
|
+
/**
|
|
90
|
+
* Register a task process start with both IO and metrics services.
|
|
91
|
+
* This is the standard way to notify the system that a task process has started.
|
|
92
|
+
* Both services need to be notified together - TaskIOService for external subscribers
|
|
93
|
+
* and ProcessMetricsService for native resource monitoring.
|
|
94
|
+
*/
|
|
95
|
+
export declare function registerTaskProcessStart(taskId: string, pid: number): void;
|
|
96
|
+
export {};
|
|
97
|
+
//# sourceMappingURL=task-io-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-io-service.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/tasks-runner/task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