nx 22.1.0-rc.2 → 22.1.0-rc.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/bin/init-local.d.ts.map +1 -1
- package/bin/init-local.js +40 -2
- package/executors.json +16 -16
- package/generators.json +13 -13
- package/migrations.json +143 -143
- package/package.json +11 -14
- package/presets/npm.json +4 -4
- package/schemas/nx-schema.json +1286 -1286
- 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/add/add.d.ts.map +1 -1
- package/src/command-line/add/add.js +5 -2
- package/src/command-line/init/command-object.d.ts.map +1 -1
- package/src/command-line/init/command-object.js +10 -0
- package/src/core/graph/main.js +1 -1
- package/src/daemon/client/client.d.ts +3 -0
- package/src/daemon/client/client.d.ts.map +1 -1
- package/src/daemon/client/client.js +18 -4
- package/src/daemon/client/daemon-socket-messenger.d.ts.map +1 -1
- package/src/daemon/client/daemon-socket-messenger.js +4 -0
- package/src/daemon/message-types/nx-console.d.ts +18 -0
- package/src/daemon/message-types/nx-console.d.ts.map +1 -0
- package/src/daemon/message-types/nx-console.js +19 -0
- package/src/daemon/server/handle-nx-console.d.ts +4 -0
- package/src/daemon/server/handle-nx-console.d.ts.map +1 -0
- package/src/daemon/server/handle-nx-console.js +54 -0
- package/src/daemon/server/nx-console-operations.d.ts +31 -0
- package/src/daemon/server/nx-console-operations.d.ts.map +1 -0
- package/src/daemon/server/nx-console-operations.js +135 -0
- package/src/daemon/server/server.d.ts.map +1 -1
- package/src/daemon/server/server.js +16 -0
- package/src/daemon/server/shutdown-utils.d.ts.map +1 -1
- package/src/daemon/server/shutdown-utils.js +3 -0
- package/src/devkit-internals.d.ts +1 -1
- package/src/devkit-internals.d.ts.map +1 -1
- package/src/devkit-internals.js +2 -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/index.d.ts +37 -24
- package/src/native/native-bindings.js +1 -0
- package/src/native/nx.wasi-browser.js +45 -53
- 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/plugins/resolve-plugin.js +1 -1
- 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/utils/consume-messages-from-socket.d.ts.map +1 -1
- package/src/utils/consume-messages-from-socket.js +4 -2
- package/src/utils/package-json.d.ts +4 -0
- package/src/utils/package-json.d.ts.map +1 -1
- package/src/utils/package-json.js +45 -11
|
@@ -6,6 +6,7 @@ import { ConfigurationSourceMaps } from '../../project-graph/utils/project-confi
|
|
|
6
6
|
import { NxWorkspaceFiles, TaskRun, TaskTarget } from '../../native';
|
|
7
7
|
import type { FlushSyncGeneratorChangesResult, SyncGeneratorRunResult } from '../../utils/sync-generators';
|
|
8
8
|
import { PostTasksExecutionContext, PreTasksExecutionContext } from '../../project-graph/plugins/public-api';
|
|
9
|
+
import { type NxConsoleStatusResponse, type SetNxConsolePreferenceAndInstallResponse } from '../message-types/nx-console';
|
|
9
10
|
export type UnregisterCallback = () => void;
|
|
10
11
|
export type ChangedFile = {
|
|
11
12
|
path: string;
|
|
@@ -69,6 +70,8 @@ export declare class DaemonClient {
|
|
|
69
70
|
updateWorkspaceContext(createdFiles: string[], updatedFiles: string[], deletedFiles: string[]): Promise<void>;
|
|
70
71
|
runPreTasksExecution(context: PreTasksExecutionContext): Promise<NodeJS.ProcessEnv[]>;
|
|
71
72
|
runPostTasksExecution(context: PostTasksExecutionContext): Promise<void>;
|
|
73
|
+
getNxConsoleStatus(): Promise<NxConsoleStatusResponse>;
|
|
74
|
+
setNxConsolePreferenceAndInstall(preference: boolean): Promise<SetNxConsolePreferenceAndInstallResponse>;
|
|
72
75
|
isServerAvailable(): Promise<boolean>;
|
|
73
76
|
private sendToDaemonViaQueue;
|
|
74
77
|
private setUpConnection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/client/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAS,MAAM,eAAe,CAAC;AAoBpD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAUpE,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uDAAuD,CAAC;AAKhG,OAAO,EAAW,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAoC9E,OAAO,KAAK,EACV,+BAA+B,EAC/B,sBAAsB,EACvB,MAAM,6BAA6B,CAAC;AAcrC,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/client/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAS,MAAM,eAAe,CAAC;AAoBpD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAUpE,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uDAAuD,CAAC;AAKhG,OAAO,EAAW,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAoC9E,OAAO,KAAK,EACV,+BAA+B,EAC/B,sBAAsB,EACvB,MAAM,6BAA6B,CAAC;AAcrC,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,wCAAwC,CAAC;AAQhD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AoB;IASlC,OAAO,CAAC,eAAe;YAoDT,mBAAmB;YAuCnB,uCAAuC;IAiBrD,OAAO,CAAC,gCAAgC;IAyBxC,OAAO,CAAC,aAAa;IAmDf,iBAAiB,IAAI,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAwDjD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAkB5B;AAED,eAAO,MAAM,YAAY,cAAqB,CAAC;AAE/C,wBAAgB,eAAe,YAE9B"}
|
|
@@ -32,6 +32,7 @@ const flush_sync_generator_changes_to_disk_1 = require("../message-types/flush-s
|
|
|
32
32
|
const delayed_spinner_1 = require("../../utils/delayed-spinner");
|
|
33
33
|
const run_tasks_execution_hooks_1 = require("../message-types/run-tasks-execution-hooks");
|
|
34
34
|
const register_project_graph_listener_1 = require("../message-types/register-project-graph-listener");
|
|
35
|
+
const nx_console_1 = require("../message-types/nx-console");
|
|
35
36
|
const node_v8_1 = require("node:v8");
|
|
36
37
|
const consume_messages_from_socket_1 = require("../../utils/consume-messages-from-socket");
|
|
37
38
|
const DAEMON_ENV_SETTINGS = {
|
|
@@ -357,6 +358,19 @@ class DaemonClient {
|
|
|
357
358
|
};
|
|
358
359
|
return this.sendToDaemonViaQueue(message);
|
|
359
360
|
}
|
|
361
|
+
getNxConsoleStatus() {
|
|
362
|
+
const message = {
|
|
363
|
+
type: nx_console_1.GET_NX_CONSOLE_STATUS,
|
|
364
|
+
};
|
|
365
|
+
return this.sendToDaemonViaQueue(message);
|
|
366
|
+
}
|
|
367
|
+
setNxConsolePreferenceAndInstall(preference) {
|
|
368
|
+
const message = {
|
|
369
|
+
type: nx_console_1.SET_NX_CONSOLE_PREFERENCE_AND_INSTALL,
|
|
370
|
+
preference,
|
|
371
|
+
};
|
|
372
|
+
return this.sendToDaemonViaQueue(message);
|
|
373
|
+
}
|
|
360
374
|
async isServerAvailable() {
|
|
361
375
|
return new Promise((resolve) => {
|
|
362
376
|
try {
|
|
@@ -485,12 +499,12 @@ class DaemonClient {
|
|
|
485
499
|
}
|
|
486
500
|
handleMessage(serializedResult) {
|
|
487
501
|
try {
|
|
488
|
-
perf_hooks_1.performance.mark('result-parse-start');
|
|
502
|
+
perf_hooks_1.performance.mark('result-parse-start-' + this.currentMessage.type);
|
|
489
503
|
const parsedResult = (0, consume_messages_from_socket_1.isJsonMessage)(serializedResult)
|
|
490
504
|
? JSON.parse(serializedResult)
|
|
491
505
|
: (0, node_v8_1.deserialize)(Buffer.from(serializedResult, 'binary'));
|
|
492
|
-
perf_hooks_1.performance.mark('result-parse-end');
|
|
493
|
-
perf_hooks_1.performance.measure('deserialize daemon response', 'result-parse-start', 'result-parse-end');
|
|
506
|
+
perf_hooks_1.performance.mark('result-parse-end-' + this.currentMessage.type);
|
|
507
|
+
perf_hooks_1.performance.measure('deserialize daemon response - ' + this.currentMessage.type, 'result-parse-start-' + this.currentMessage.type, 'result-parse-end-' + this.currentMessage.type);
|
|
494
508
|
if (parsedResult.error) {
|
|
495
509
|
if ('message' in parsedResult.error &&
|
|
496
510
|
(parsedResult.error.message === 'NX_VERSION_CHANGED' ||
|
|
@@ -502,7 +516,7 @@ class DaemonClient {
|
|
|
502
516
|
}
|
|
503
517
|
}
|
|
504
518
|
else {
|
|
505
|
-
perf_hooks_1.performance.measure(
|
|
519
|
+
perf_hooks_1.performance.measure(`${this.currentMessage.type} round trip`, 'sendMessageToDaemon-start', 'result-parse-end-' + this.currentMessage.type);
|
|
506
520
|
return this.currentResolve(parsedResult);
|
|
507
521
|
}
|
|
508
522
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon-socket-messenger.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/client/daemon-socket-messenger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAQ7B,MAAM,WAAW,OAAQ,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED,qBAAa,qBAAqB;IACpB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAE5B,WAAW,CAAC,eAAe,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"daemon-socket-messenger.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/client/daemon-socket-messenger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAQ7B,MAAM,WAAW,OAAQ,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED,qBAAa,qBAAqB;IACpB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAE5B,WAAW,CAAC,eAAe,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM;IAkBjE,MAAM,CACJ,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,EACjC,OAAO,GAAE,MAAM,IAAe,EAC9B,OAAO,GAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAkB;IAe7C,KAAK;CAGN"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DaemonSocketMessenger = void 0;
|
|
4
|
+
const perf_hooks_1 = require("perf_hooks");
|
|
4
5
|
const consume_messages_from_socket_1 = require("../../utils/consume-messages-from-socket");
|
|
5
6
|
const socket_utils_1 = require("../socket-utils");
|
|
6
7
|
class DaemonSocketMessenger {
|
|
@@ -8,7 +9,10 @@ class DaemonSocketMessenger {
|
|
|
8
9
|
this.socket = socket;
|
|
9
10
|
}
|
|
10
11
|
async sendMessage(messageToDaemon, force) {
|
|
12
|
+
perf_hooks_1.performance.mark('daemon-message-serialization-start-' + messageToDaemon.type);
|
|
11
13
|
const serialized = (0, socket_utils_1.serialize)(messageToDaemon, force);
|
|
14
|
+
perf_hooks_1.performance.mark('daemon-message-serialization-end-' + messageToDaemon.type);
|
|
15
|
+
perf_hooks_1.performance.measure('daemon-message-serialization-' + messageToDaemon.type, 'daemon-message-serialization-start-' + messageToDaemon.type, 'daemon-message-serialization-end-' + messageToDaemon.type);
|
|
12
16
|
this.socket.write(serialized);
|
|
13
17
|
// send EOT to indicate that the message has been fully written
|
|
14
18
|
this.socket.write(consume_messages_from_socket_1.MESSAGE_END_SEQ);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const GET_NX_CONSOLE_STATUS: "GET_NX_CONSOLE_STATUS";
|
|
2
|
+
export declare const SET_NX_CONSOLE_PREFERENCE_AND_INSTALL: "SET_NX_CONSOLE_PREFERENCE_AND_INSTALL";
|
|
3
|
+
export type HandleGetNxConsoleStatusMessage = {
|
|
4
|
+
type: typeof GET_NX_CONSOLE_STATUS;
|
|
5
|
+
};
|
|
6
|
+
export type NxConsoleStatusResponse = {
|
|
7
|
+
shouldPrompt: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type HandleSetNxConsolePreferenceAndInstallMessage = {
|
|
10
|
+
type: typeof SET_NX_CONSOLE_PREFERENCE_AND_INSTALL;
|
|
11
|
+
preference: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type SetNxConsolePreferenceAndInstallResponse = {
|
|
14
|
+
installed: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function isHandleGetNxConsoleStatusMessage(message: unknown): message is HandleGetNxConsoleStatusMessage;
|
|
17
|
+
export declare function isHandleSetNxConsolePreferenceAndInstallMessage(message: unknown): message is HandleSetNxConsolePreferenceAndInstallMessage;
|
|
18
|
+
//# sourceMappingURL=nx-console.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nx-console.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/message-types/nx-console.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,EAAG,uBAAgC,CAAC;AACtE,eAAO,MAAM,qCAAqC,EAChD,uCAAgD,CAAC;AAEnD,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,OAAO,qBAAqB,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,OAAO,qCAAqC,CAAC;IACnD,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,wCAAwC,GAAG;IACrD,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,OAAO,GACf,OAAO,IAAI,+BAA+B,CAO5C;AAED,wBAAgB,+CAA+C,CAC7D,OAAO,EAAE,OAAO,GACf,OAAO,IAAI,6CAA6C,CAO1D"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SET_NX_CONSOLE_PREFERENCE_AND_INSTALL = exports.GET_NX_CONSOLE_STATUS = void 0;
|
|
4
|
+
exports.isHandleGetNxConsoleStatusMessage = isHandleGetNxConsoleStatusMessage;
|
|
5
|
+
exports.isHandleSetNxConsolePreferenceAndInstallMessage = isHandleSetNxConsolePreferenceAndInstallMessage;
|
|
6
|
+
exports.GET_NX_CONSOLE_STATUS = 'GET_NX_CONSOLE_STATUS';
|
|
7
|
+
exports.SET_NX_CONSOLE_PREFERENCE_AND_INSTALL = 'SET_NX_CONSOLE_PREFERENCE_AND_INSTALL';
|
|
8
|
+
function isHandleGetNxConsoleStatusMessage(message) {
|
|
9
|
+
return (typeof message === 'object' &&
|
|
10
|
+
message !== null &&
|
|
11
|
+
'type' in message &&
|
|
12
|
+
message['type'] === exports.GET_NX_CONSOLE_STATUS);
|
|
13
|
+
}
|
|
14
|
+
function isHandleSetNxConsolePreferenceAndInstallMessage(message) {
|
|
15
|
+
return (typeof message === 'object' &&
|
|
16
|
+
message !== null &&
|
|
17
|
+
'type' in message &&
|
|
18
|
+
message['type'] === exports.SET_NX_CONSOLE_PREFERENCE_AND_INSTALL);
|
|
19
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HandlerResult } from './server';
|
|
2
|
+
export declare function handleGetNxConsoleStatus(): Promise<HandlerResult>;
|
|
3
|
+
export declare function handleSetNxConsolePreferenceAndInstall(preference: boolean): Promise<HandlerResult>;
|
|
4
|
+
//# sourceMappingURL=handle-nx-console.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-nx-console.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/server/handle-nx-console.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAU9C,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,aAAa,CAAC,CAmCvE;AAED,wBAAsB,sCAAsC,CAC1D,UAAU,EAAE,OAAO,GAClB,OAAO,CAAC,aAAa,CAAC,CAexB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleGetNxConsoleStatus = handleGetNxConsoleStatus;
|
|
4
|
+
exports.handleSetNxConsolePreferenceAndInstall = handleSetNxConsolePreferenceAndInstall;
|
|
5
|
+
const nx_console_operations_1 = require("./nx-console-operations");
|
|
6
|
+
// Module-level state for caching
|
|
7
|
+
let cachedShouldPrompt = null;
|
|
8
|
+
let isComputing = false;
|
|
9
|
+
async function handleGetNxConsoleStatus() {
|
|
10
|
+
// Return cached result if available
|
|
11
|
+
if (cachedShouldPrompt !== null) {
|
|
12
|
+
const response = {
|
|
13
|
+
shouldPrompt: cachedShouldPrompt,
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
response,
|
|
17
|
+
description: 'handleGetNxConsoleStatus',
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
// Kick off background computation if not already running
|
|
21
|
+
if (!isComputing) {
|
|
22
|
+
isComputing = true;
|
|
23
|
+
(0, nx_console_operations_1.getNxConsoleStatus)()
|
|
24
|
+
.then((result) => {
|
|
25
|
+
cachedShouldPrompt = result;
|
|
26
|
+
isComputing = false;
|
|
27
|
+
})
|
|
28
|
+
.catch(() => {
|
|
29
|
+
cachedShouldPrompt = null;
|
|
30
|
+
isComputing = false;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
// Return false for shouldPrompt if cache not ready (main process will noop)
|
|
34
|
+
const response = {
|
|
35
|
+
shouldPrompt: false,
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
response,
|
|
39
|
+
description: 'handleGetNxConsoleStatus',
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
async function handleSetNxConsolePreferenceAndInstall(preference) {
|
|
43
|
+
// Immediately update cache - we know the answer now!
|
|
44
|
+
// User answered the prompt, so we won't prompt again
|
|
45
|
+
cachedShouldPrompt = false;
|
|
46
|
+
const result = await (0, nx_console_operations_1.handleNxConsolePreferenceAndInstall)({ preference });
|
|
47
|
+
const response = {
|
|
48
|
+
installed: result.installed,
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
response,
|
|
52
|
+
description: 'handleSetNxConsolePreferenceAndInstall',
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the Nx Console status (whether we should prompt the user to install).
|
|
3
|
+
* Uses latest Nx version if available, falls back to local implementation.
|
|
4
|
+
*
|
|
5
|
+
* @returns boolean indicating whether we should prompt the user
|
|
6
|
+
*/
|
|
7
|
+
export declare function getNxConsoleStatus({ inner, }?: {
|
|
8
|
+
inner?: boolean;
|
|
9
|
+
}): Promise<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* Handles user preference submission and installs Nx Console if requested.
|
|
12
|
+
* Uses latest Nx version if available, falls back to local implementation.
|
|
13
|
+
*
|
|
14
|
+
* @param preference - whether the user wants to install Nx Console
|
|
15
|
+
* @returns object indicating whether installation succeeded
|
|
16
|
+
*/
|
|
17
|
+
export declare function handleNxConsolePreferenceAndInstall({ preference, inner, }: {
|
|
18
|
+
preference: boolean;
|
|
19
|
+
inner?: boolean;
|
|
20
|
+
}): Promise<{
|
|
21
|
+
installed: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Clean up the latest Nx installation on daemon shutdown.
|
|
25
|
+
*/
|
|
26
|
+
export declare function cleanupLatestNxInstallation(): void;
|
|
27
|
+
export declare function getNxConsoleStatusImpl(): Promise<boolean>;
|
|
28
|
+
export declare function handleNxConsolePreferenceAndInstallImpl(preference: boolean): Promise<{
|
|
29
|
+
installed: boolean;
|
|
30
|
+
}>;
|
|
31
|
+
//# sourceMappingURL=nx-console-operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nx-console-operations.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/server/nx-console-operations.ts"],"names":[],"mappings":"AAiBA;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,KAAK,GACN,GAAE;IACD,KAAK,CAAC,EAAE,OAAO,CAAC;CACZ,GAAG,OAAO,CAAC,OAAO,CAAC,CAwCxB;AAED;;;;;;GAMG;AACH,wBAAsB,mCAAmC,CAAC,EACxD,UAAU,EACV,KAAK,GACN,EAAE;IACD,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,OAAO,CAAC;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC,CAgDlC;AAED;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,IAAI,CAOlD;AAED,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,OAAO,CAAC,CAsB/D;AAED,wBAAsB,uCAAuC,CAC3D,UAAU,EAAE,OAAO,GAClB,OAAO,CAAC;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC,CAUjC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNxConsoleStatus = getNxConsoleStatus;
|
|
4
|
+
exports.handleNxConsolePreferenceAndInstall = handleNxConsolePreferenceAndInstall;
|
|
5
|
+
exports.cleanupLatestNxInstallation = cleanupLatestNxInstallation;
|
|
6
|
+
exports.getNxConsoleStatusImpl = getNxConsoleStatusImpl;
|
|
7
|
+
exports.handleNxConsolePreferenceAndInstallImpl = handleNxConsolePreferenceAndInstallImpl;
|
|
8
|
+
const devkit_internals_1 = require("../../devkit-internals");
|
|
9
|
+
const os_1 = require("os");
|
|
10
|
+
const native_1 = require("../../native");
|
|
11
|
+
const logger_1 = require("./logger");
|
|
12
|
+
// Module-level state - persists across invocations within daemon lifecycle
|
|
13
|
+
let latestNxTmpPath = null;
|
|
14
|
+
let cleanupFn = null;
|
|
15
|
+
const log = (...messageParts) => {
|
|
16
|
+
logger_1.serverLogger.log('[NX-CONSOLE]:', ...messageParts);
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Gets the Nx Console status (whether we should prompt the user to install).
|
|
20
|
+
* Uses latest Nx version if available, falls back to local implementation.
|
|
21
|
+
*
|
|
22
|
+
* @returns boolean indicating whether we should prompt the user
|
|
23
|
+
*/
|
|
24
|
+
async function getNxConsoleStatus({ inner, } = {}) {
|
|
25
|
+
// Use local implementation if explicitly requested
|
|
26
|
+
if (process.env.NX_USE_LOCAL === 'true' || inner === true) {
|
|
27
|
+
log('Using local implementation (NX_USE_LOCAL=true or inner call)');
|
|
28
|
+
return await getNxConsoleStatusImpl();
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
// If we don't have a tmp path yet, pull latest Nx
|
|
32
|
+
if (latestNxTmpPath === null) {
|
|
33
|
+
log('Pulling latest Nx (latest) to check console status...');
|
|
34
|
+
const packageInstallResults = await (0, devkit_internals_1.installPackageToTmpAsync)('nx', 'latest');
|
|
35
|
+
latestNxTmpPath = packageInstallResults.tempDir;
|
|
36
|
+
cleanupFn = packageInstallResults.cleanup;
|
|
37
|
+
log('Successfully pulled latest Nx to', latestNxTmpPath);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
log('Reusing cached Nx installation from', latestNxTmpPath);
|
|
41
|
+
}
|
|
42
|
+
// Try to use the cached tmp path
|
|
43
|
+
const modulePath = require.resolve('nx/src/daemon/server/nx-console-operations.js', { paths: [latestNxTmpPath] });
|
|
44
|
+
const module = await Promise.resolve(`${modulePath}`).then(s => require(s));
|
|
45
|
+
const result = await module.getNxConsoleStatus({ inner: true });
|
|
46
|
+
log('Console status check completed, shouldPrompt:', result);
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
// If tmp path failed (e.g., directory was deleted), fall back to local immediately
|
|
51
|
+
log('Failed to use latest Nx, falling back to local implementation. Error:', error.message);
|
|
52
|
+
return await getNxConsoleStatusImpl();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Handles user preference submission and installs Nx Console if requested.
|
|
57
|
+
* Uses latest Nx version if available, falls back to local implementation.
|
|
58
|
+
*
|
|
59
|
+
* @param preference - whether the user wants to install Nx Console
|
|
60
|
+
* @returns object indicating whether installation succeeded
|
|
61
|
+
*/
|
|
62
|
+
async function handleNxConsolePreferenceAndInstall({ preference, inner, }) {
|
|
63
|
+
log('Handling user preference:', preference);
|
|
64
|
+
// Use local implementation if explicitly requested
|
|
65
|
+
if (process.env.NX_USE_LOCAL === 'true' || inner === true) {
|
|
66
|
+
log('Using local implementation (NX_USE_LOCAL=true or inner call)');
|
|
67
|
+
return await handleNxConsolePreferenceAndInstallImpl(preference);
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
// If we don't have a tmp path yet, pull latest Nx
|
|
71
|
+
if (latestNxTmpPath === null) {
|
|
72
|
+
log('Pulling latest Nx (latest) to handle preference and install...');
|
|
73
|
+
const packageInstallResults = await (0, devkit_internals_1.installPackageToTmpAsync)('nx', 'latest');
|
|
74
|
+
latestNxTmpPath = packageInstallResults.tempDir;
|
|
75
|
+
cleanupFn = packageInstallResults.cleanup;
|
|
76
|
+
log('Successfully pulled latest Nx to', latestNxTmpPath);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
log('Reusing cached Nx installation from', latestNxTmpPath);
|
|
80
|
+
}
|
|
81
|
+
// Try to use the cached tmp path
|
|
82
|
+
const modulePath = require.resolve('nx/src/daemon/server/nx-console-operations.js', { paths: [latestNxTmpPath] });
|
|
83
|
+
const module = await Promise.resolve(`${modulePath}`).then(s => require(s));
|
|
84
|
+
const result = await module.handleNxConsolePreferenceAndInstall({
|
|
85
|
+
preference,
|
|
86
|
+
inner: true,
|
|
87
|
+
});
|
|
88
|
+
log('Preference saved and installation', result.installed ? 'succeeded' : 'skipped/failed');
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
// If tmp path failed (e.g., directory was deleted), fall back to local immediately
|
|
93
|
+
log('Failed to use latest Nx, falling back to local implementation. Error:', error.message);
|
|
94
|
+
return await handleNxConsolePreferenceAndInstallImpl(preference);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Clean up the latest Nx installation on daemon shutdown.
|
|
99
|
+
*/
|
|
100
|
+
function cleanupLatestNxInstallation() {
|
|
101
|
+
if (cleanupFn) {
|
|
102
|
+
log('Cleaning up latest Nx installation from', latestNxTmpPath);
|
|
103
|
+
cleanupFn();
|
|
104
|
+
}
|
|
105
|
+
latestNxTmpPath = null;
|
|
106
|
+
cleanupFn = null;
|
|
107
|
+
}
|
|
108
|
+
async function getNxConsoleStatusImpl() {
|
|
109
|
+
// If no cached preference, read from disk
|
|
110
|
+
const preferences = new native_1.NxConsolePreferences((0, os_1.homedir)());
|
|
111
|
+
const preference = preferences.getAutoInstallPreference();
|
|
112
|
+
const canInstallConsole = (0, native_1.canInstallNxConsole)();
|
|
113
|
+
// If user previously opted in but extension is not installed,
|
|
114
|
+
// they must have manually uninstalled it - respect that choice
|
|
115
|
+
if (preference === true && canInstallConsole) {
|
|
116
|
+
const preferences = new native_1.NxConsolePreferences((0, os_1.homedir)());
|
|
117
|
+
preferences.setAutoInstallPreference(false);
|
|
118
|
+
return false; // Don't prompt
|
|
119
|
+
}
|
|
120
|
+
// Noop if can't install
|
|
121
|
+
if (!canInstallConsole) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
// Prompt if we can install and user hasn't answered yet
|
|
125
|
+
return typeof preference !== 'boolean';
|
|
126
|
+
}
|
|
127
|
+
async function handleNxConsolePreferenceAndInstallImpl(preference) {
|
|
128
|
+
const preferences = new native_1.NxConsolePreferences((0, os_1.homedir)());
|
|
129
|
+
preferences.setAutoInstallPreference(preference);
|
|
130
|
+
let installed = false;
|
|
131
|
+
if (preference) {
|
|
132
|
+
installed = (0, native_1.installNxConsole)();
|
|
133
|
+
}
|
|
134
|
+
return { installed };
|
|
135
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/server/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/server/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAgKnD,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CACtC,CAAC;AAGF,eAAO,MAAM,WAAW,EAAE,GAAG,CAAC,MAAM,CAAa,CAAC;AA8RlD,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,EAClC,IAAI,EAAE,MAAM,GAAG,IAAI,iBA6BpB;AAoMD,wBAAsB,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,CAqEnD"}
|
|
@@ -54,6 +54,8 @@ const handle_flush_sync_generator_changes_to_disk_1 = require("./handle-flush-sy
|
|
|
54
54
|
const run_tasks_execution_hooks_1 = require("../message-types/run-tasks-execution-hooks");
|
|
55
55
|
const handle_tasks_execution_hooks_1 = require("./handle-tasks-execution-hooks");
|
|
56
56
|
const register_project_graph_listener_1 = require("../message-types/register-project-graph-listener");
|
|
57
|
+
const nx_console_1 = require("../message-types/nx-console");
|
|
58
|
+
const handle_nx_console_1 = require("./handle-nx-console");
|
|
57
59
|
const v8_1 = require("v8");
|
|
58
60
|
let performanceObserver;
|
|
59
61
|
let workspaceWatcherError;
|
|
@@ -101,6 +103,7 @@ async function handleMessage(socket, data) {
|
|
|
101
103
|
const unparsedPayload = data;
|
|
102
104
|
let payload;
|
|
103
105
|
let mode = 'json';
|
|
106
|
+
logger_1.serverLogger.log(`Received raw message of length ${unparsedPayload.length}`);
|
|
104
107
|
try {
|
|
105
108
|
// JSON Message
|
|
106
109
|
if ((0, consume_messages_from_socket_1.isJsonMessage)(unparsedPayload)) {
|
|
@@ -115,6 +118,7 @@ async function handleMessage(socket, data) {
|
|
|
115
118
|
catch (e) {
|
|
116
119
|
await (0, shutdown_utils_1.respondWithErrorAndExit)(socket, `Invalid payload from the client`, new Error(`Unsupported payload sent to daemon server: ${unparsedPayload}`));
|
|
117
120
|
}
|
|
121
|
+
logger_1.serverLogger.log(`Received ${mode} message of type ${payload.type}`);
|
|
118
122
|
if (payload.type === 'PING') {
|
|
119
123
|
await handleResult(socket, 'PING', () => Promise.resolve({ response: true, description: 'ping' }), mode);
|
|
120
124
|
}
|
|
@@ -193,6 +197,12 @@ async function handleMessage(socket, data) {
|
|
|
193
197
|
else if ((0, run_tasks_execution_hooks_1.isHandlePostTasksExecutionMessage)(payload)) {
|
|
194
198
|
await handleResult(socket, run_tasks_execution_hooks_1.POST_TASKS_EXECUTION, () => (0, handle_tasks_execution_hooks_1.handleRunPostTasksExecution)(payload.context), mode);
|
|
195
199
|
}
|
|
200
|
+
else if ((0, nx_console_1.isHandleGetNxConsoleStatusMessage)(payload)) {
|
|
201
|
+
await handleResult(socket, nx_console_1.GET_NX_CONSOLE_STATUS, () => (0, handle_nx_console_1.handleGetNxConsoleStatus)(), mode);
|
|
202
|
+
}
|
|
203
|
+
else if ((0, nx_console_1.isHandleSetNxConsolePreferenceAndInstallMessage)(payload)) {
|
|
204
|
+
await handleResult(socket, nx_console_1.SET_NX_CONSOLE_PREFERENCE_AND_INSTALL, () => (0, handle_nx_console_1.handleSetNxConsolePreferenceAndInstall)(payload.preference), mode);
|
|
205
|
+
}
|
|
196
206
|
else {
|
|
197
207
|
await (0, shutdown_utils_1.respondWithErrorAndExit)(socket, `Invalid payload from the client`, new Error(`Unsupported payload sent to daemon server: ${unparsedPayload}`));
|
|
198
208
|
}
|
|
@@ -211,9 +221,11 @@ async function handleResult(socket, type, hrFn, mode) {
|
|
|
211
221
|
await (0, shutdown_utils_1.respondWithErrorAndExit)(socket, hr.description, hr.error);
|
|
212
222
|
}
|
|
213
223
|
else {
|
|
224
|
+
logger_1.serverLogger.log(`Serializing response for ${type} message in ${mode} mode`);
|
|
214
225
|
const response = typeof hr.response === 'string'
|
|
215
226
|
? hr.response
|
|
216
227
|
: serializeUnserializedResult(hr.response, mode);
|
|
228
|
+
logger_1.serverLogger.log(`Responding to ${type} message`);
|
|
217
229
|
await (0, shutdown_utils_1.respondToClient)(socket, response, hr.description);
|
|
218
230
|
}
|
|
219
231
|
const endMark = new Date();
|
|
@@ -416,6 +428,10 @@ async function startServer() {
|
|
|
416
428
|
(0, project_graph_incremental_recomputation_1.registerProjectGraphRecomputationListener)(sync_generators_1.collectAndScheduleSyncGenerators);
|
|
417
429
|
// trigger an initial project graph recomputation
|
|
418
430
|
(0, project_graph_incremental_recomputation_1.addUpdatedAndDeletedFiles)([], [], []);
|
|
431
|
+
// Kick off Nx Console check in background to prime the cache
|
|
432
|
+
(0, handle_nx_console_1.handleGetNxConsoleStatus)().catch(() => {
|
|
433
|
+
// Ignore errors, this is a background operation
|
|
434
|
+
});
|
|
419
435
|
return resolve(server);
|
|
420
436
|
}
|
|
421
437
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shutdown-utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/server/shutdown-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAI1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"shutdown-utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/server/shutdown-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAI1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAU5C,eAAO,MAAM,4BAA4B,EAAG,QAAiB,CAAC;AAI9D,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO,QAErD;AAED,wBAAgB,kBAAkB,YAEjC;AAID,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,OAAO,QAE3D;AAED,wBAAgB,wBAAwB,YAEvC;AAED,UAAU,oCAAoC;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC3B;AAED,wBAAsB,8BAA8B,CAAC,EACnD,MAAM,EACN,MAAM,EACN,OAAO,GACR,EAAE,oCAAoC,iBAsCtC;AAID,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI,CAK3D;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,oBAcpB;AAED,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,KAAK,iBAsBb"}
|
|
@@ -17,6 +17,7 @@ const error_types_1 = require("../../project-graph/error-types");
|
|
|
17
17
|
const db_connection_1 = require("../../utils/db-connection");
|
|
18
18
|
const get_plugins_1 = require("../../project-graph/plugins/get-plugins");
|
|
19
19
|
const consume_messages_from_socket_1 = require("../../utils/consume-messages-from-socket");
|
|
20
|
+
const nx_console_operations_1 = require("./nx-console-operations");
|
|
20
21
|
exports.SERVER_INACTIVITY_TIMEOUT_MS = 10800000; // 10800000 ms = 3 hours
|
|
21
22
|
let watcherInstance;
|
|
22
23
|
function storeWatcherInstance(instance) {
|
|
@@ -53,6 +54,8 @@ async function handleServerProcessTermination({ server, reason, sockets, }) {
|
|
|
53
54
|
(0, cache_1.deleteDaemonJsonProcessCache)();
|
|
54
55
|
(0, get_plugins_1.cleanupPlugins)();
|
|
55
56
|
(0, db_connection_1.removeDbConnections)();
|
|
57
|
+
// Clean up Nx Console latest installation
|
|
58
|
+
(0, nx_console_operations_1.cleanupLatestNxInstallation)();
|
|
56
59
|
logger_1.serverLogger.log(`Server stopped because: "${reason}"`);
|
|
57
60
|
}
|
|
58
61
|
finally {
|
|
@@ -15,7 +15,7 @@ export { splitTarget } from './utils/split-target';
|
|
|
15
15
|
export { combineOptionsForExecutor } from './utils/params';
|
|
16
16
|
export { sortObjectByKeys } from './utils/object-sort';
|
|
17
17
|
export { stripIndent } from './utils/logger';
|
|
18
|
-
export { readModulePackageJson, installPackageToTmp, } from './utils/package-json';
|
|
18
|
+
export { readModulePackageJson, installPackageToTmp, installPackageToTmpAsync, } from './utils/package-json';
|
|
19
19
|
export { splitByColons } from './utils/split-target';
|
|
20
20
|
export { hashObject } from './hasher/file-hasher';
|
|
21
21
|
export { hashWithWorkspaceContext, hashMultiGlobWithWorkspaceContext, } from './utils/workspace-context';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devkit-internals.d.ts","sourceRoot":"","sources":["../../../../packages/nx/src/devkit-internals.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EACL,sBAAsB,EACtB,aAAa,GACd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,gDAAgD,EAAE,MAAM,gDAAgD,CAAC;AAClH,OAAO,EAAE,yBAAyB,EAAE,MAAM,mDAAmD,CAAC;AAC9F,OAAO,EACL,oCAAoC,EACpC,uBAAuB,GACxB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACL,qBAAqB,EACrB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"devkit-internals.d.ts","sourceRoot":"","sources":["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A6B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|
package/src/devkit-internals.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.signalToCode = exports.globalSpinner = exports.readYamlFile = exports.isUsingPrettierInTree = exports.isCI = exports.interpolate = exports.registerTsProject = exports.LoadedNxPlugin = exports.retrieveProjectConfigurations = exports.findProjectForPath = exports.createProjectRootMappings = exports.createProjectRootMappingsFromProjectConfigurations = exports.hashMultiGlobWithWorkspaceContext = exports.hashWithWorkspaceContext = exports.hashObject = exports.splitByColons = exports.installPackageToTmp = exports.readModulePackageJson = exports.stripIndent = exports.sortObjectByKeys = exports.combineOptionsForExecutor = exports.splitTarget = exports.getIgnoreObjectForTree = exports.findMatchingConfigFiles = exports.readProjectConfigurationsFromRootMap = exports.mergeTargetConfigurations = exports.retrieveProjectConfigurationsWithAngularProjects = exports.calculateDefaultProjectName = exports.readNxJsonFromDisk = exports.parseExecutor = exports.getExecutorInformation = exports.createTempNpmDirectory = void 0;
|
|
3
|
+
exports.signalToCode = exports.globalSpinner = exports.readYamlFile = exports.isUsingPrettierInTree = exports.isCI = exports.interpolate = exports.registerTsProject = exports.LoadedNxPlugin = exports.retrieveProjectConfigurations = exports.findProjectForPath = exports.createProjectRootMappings = exports.createProjectRootMappingsFromProjectConfigurations = exports.hashMultiGlobWithWorkspaceContext = exports.hashWithWorkspaceContext = exports.hashObject = exports.splitByColons = exports.installPackageToTmpAsync = exports.installPackageToTmp = exports.readModulePackageJson = exports.stripIndent = exports.sortObjectByKeys = exports.combineOptionsForExecutor = exports.splitTarget = exports.getIgnoreObjectForTree = exports.findMatchingConfigFiles = exports.readProjectConfigurationsFromRootMap = exports.mergeTargetConfigurations = exports.retrieveProjectConfigurationsWithAngularProjects = exports.calculateDefaultProjectName = exports.readNxJsonFromDisk = exports.parseExecutor = exports.getExecutorInformation = exports.createTempNpmDirectory = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
/**
|
|
6
6
|
* Note to developers: STOP! These exports are available via requireNx in @nx/devkit.
|
|
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "stripIndent", { enumerable: true, get: function
|
|
|
36
36
|
var package_json_1 = require("./utils/package-json");
|
|
37
37
|
Object.defineProperty(exports, "readModulePackageJson", { enumerable: true, get: function () { return package_json_1.readModulePackageJson; } });
|
|
38
38
|
Object.defineProperty(exports, "installPackageToTmp", { enumerable: true, get: function () { return package_json_1.installPackageToTmp; } });
|
|
39
|
+
Object.defineProperty(exports, "installPackageToTmpAsync", { enumerable: true, get: function () { return package_json_1.installPackageToTmpAsync; } });
|
|
39
40
|
var split_target_2 = require("./utils/split-target");
|
|
40
41
|
Object.defineProperty(exports, "splitByColons", { enumerable: true, get: function () { return split_target_2.splitByColons; } });
|
|
41
42
|
var file_hasher_1 = require("./hasher/file-hasher");
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
"version": 2,
|
|
3
|
+
"title": "Noop",
|
|
4
|
+
"description": "An executor that does nothing.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"cli": "nx",
|
|
7
|
+
"outputCapture": "pipe",
|
|
8
|
+
"properties": {},
|
|
9
|
+
"additionalProperties": true
|
|
10
10
|
}
|