@nrwl/workspace 12.10.0-beta.6 → 13.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -1
- package/index.js +2 -3
- package/index.js.map +1 -1
- package/migrations.json +6 -0
- package/package.json +5 -5
- package/src/command-line/dep-graph.js +17 -21
- package/src/command-line/dep-graph.js.map +1 -1
- package/src/command-line/examples.js +38 -38
- package/src/command-line/examples.js.map +1 -1
- package/src/command-line/lint.js +5 -4
- package/src/command-line/lint.js.map +1 -1
- package/src/command-line/nx-commands.js +26 -3
- package/src/command-line/nx-commands.js.map +1 -1
- package/src/command-line/supported-nx-commands.js +1 -0
- package/src/command-line/supported-nx-commands.js.map +1 -1
- package/src/command-line/utils.js +1 -1
- package/src/command-line/utils.js.map +1 -1
- package/src/core/dep-graph/main.es5.js +1 -1
- package/src/core/dep-graph/main.esm.js +1 -1
- package/src/core/dep-graph/polyfills.es5.js +1 -1
- package/src/core/dep-graph/polyfills.esm.js +1 -1
- package/src/core/dep-graph/runtime.es5.js +1 -1
- package/src/core/dep-graph/runtime.esm.js +1 -1
- package/src/core/file-utils.d.ts +11 -4
- package/src/core/file-utils.js +103 -15
- package/src/core/file-utils.js.map +1 -1
- package/src/core/hasher/file-hasher.d.ts +1 -16
- package/src/core/hasher/file-hasher.js +4 -20
- package/src/core/hasher/file-hasher.js.map +1 -1
- package/src/core/nx-deps/nx-deps-cache.d.ts +6 -6
- package/src/core/nx-deps/nx-deps-cache.js +9 -5
- package/src/core/nx-deps/nx-deps-cache.js.map +1 -1
- package/src/core/project-graph/build-dependencies/build-explicit-typescript-and-package-json-dependencies.d.ts +2 -0
- package/src/core/project-graph/build-dependencies/build-explicit-typescript-and-package-json-dependencies.js +12 -0
- package/src/core/project-graph/build-dependencies/build-explicit-typescript-and-package-json-dependencies.js.map +1 -0
- package/src/core/project-graph/build-dependencies/explicit-package-json-dependencies.d.ts +3 -2
- package/src/core/project-graph/build-dependencies/explicit-package-json-dependencies.js +14 -8
- package/src/core/project-graph/build-dependencies/explicit-package-json-dependencies.js.map +1 -1
- package/src/core/project-graph/build-dependencies/explicit-project-dependencies.d.ts +3 -2
- package/src/core/project-graph/build-dependencies/explicit-project-dependencies.js +12 -6
- package/src/core/project-graph/build-dependencies/explicit-project-dependencies.js.map +1 -1
- package/src/core/project-graph/build-project-graph.d.ts +7 -0
- package/src/core/project-graph/build-project-graph.js +221 -0
- package/src/core/project-graph/build-project-graph.js.map +1 -0
- package/src/core/project-graph/daemon/cache.d.ts +5 -13
- package/src/core/project-graph/daemon/cache.js +39 -16
- package/src/core/project-graph/daemon/cache.js.map +1 -1
- package/src/core/project-graph/daemon/client/client.js +32 -55
- package/src/core/project-graph/daemon/client/client.js.map +1 -1
- package/src/core/project-graph/daemon/client/exec-is-server-available.d.ts +1 -0
- package/src/core/project-graph/daemon/client/exec-is-server-available.js +13 -0
- package/src/core/project-graph/daemon/client/exec-is-server-available.js.map +1 -0
- package/src/core/project-graph/daemon/client/generate-help-output.d.ts +1 -0
- package/src/core/project-graph/daemon/client/generate-help-output.js +28 -0
- package/src/core/project-graph/daemon/client/generate-help-output.js.map +1 -0
- package/src/core/project-graph/daemon/server/logger.d.ts +19 -0
- package/src/core/project-graph/daemon/server/logger.js +41 -0
- package/src/core/project-graph/daemon/server/logger.js.map +1 -0
- package/src/core/project-graph/daemon/server/server.d.ts +1 -5
- package/src/core/project-graph/daemon/server/server.js +160 -193
- package/src/core/project-graph/daemon/server/server.js.map +1 -1
- package/src/core/project-graph/daemon/server/shutdown-utils.d.ts +13 -0
- package/src/core/project-graph/daemon/server/shutdown-utils.js +28 -0
- package/src/core/project-graph/daemon/server/shutdown-utils.js.map +1 -0
- package/src/core/project-graph/daemon/server/start.js +1 -8
- package/src/core/project-graph/daemon/server/start.js.map +1 -1
- package/src/core/project-graph/daemon/server/stop.js +1 -11
- package/src/core/project-graph/daemon/server/stop.js.map +1 -1
- package/src/core/project-graph/daemon/server/watcher.d.ts +1 -1
- package/src/core/project-graph/daemon/server/watcher.js +1 -1
- package/src/core/project-graph/daemon/socket-utils.d.ts +13 -0
- package/src/core/project-graph/daemon/socket-utils.js +39 -10
- package/src/core/project-graph/daemon/socket-utils.js.map +1 -1
- package/src/core/project-graph/daemon/tmp-dir.d.ts +7 -0
- package/src/core/project-graph/daemon/tmp-dir.js +59 -0
- package/src/core/project-graph/daemon/tmp-dir.js.map +1 -0
- package/src/core/project-graph/index.d.ts +1 -1
- package/src/core/project-graph/index.js +1 -3
- package/src/core/project-graph/index.js.map +1 -1
- package/src/core/project-graph/operators.js +1 -1
- package/src/core/project-graph/operators.js.map +1 -1
- package/src/core/project-graph/project-graph-worker.d.ts +1 -0
- package/src/core/project-graph/project-graph-worker.js +17 -0
- package/src/core/project-graph/project-graph-worker.js.map +1 -0
- package/src/core/project-graph/project-graph.d.ts +1 -30
- package/src/core/project-graph/project-graph.js +5 -195
- package/src/core/project-graph/project-graph.js.map +1 -1
- package/src/generators/init/init.js +27 -27
- package/src/generators/init/init.js.map +1 -1
- package/src/generators/new/new.js +1 -1
- package/src/generators/new/new.js.map +1 -1
- package/src/migrations/update-10-0-0/update-10-0-0.js +1 -1
- package/src/migrations/update-10-0-0/update-10-0-0.js.map +1 -1
- package/src/migrations/update-13-0-0/set-default-base-if-not-set.d.ts +3 -0
- package/src/migrations/update-13-0-0/set-default-base-if-not-set.js +30 -0
- package/src/migrations/update-13-0-0/set-default-base-if-not-set.js.map +1 -0
- package/src/utilities/default-base.js +2 -2
- package/src/utilities/default-base.js.map +1 -1
- package/src/utilities/run-webpack.d.ts +3 -2
- package/src/utilities/run-webpack.js +18 -34
- package/src/utilities/run-webpack.js.map +1 -1
- package/src/utils/ast-utils.d.ts +1 -10
- package/src/utils/ast-utils.js +1 -19
- package/src/utils/ast-utils.js.map +1 -1
- package/src/utils/testing-utils.js +1 -1
- package/src/utils/testing-utils.js.map +1 -1
- package/src/utils/versions.js +1 -1
- package/src/core/file-graph/index.d.ts +0 -1
- package/src/core/file-graph/index.js +0 -5
- package/src/core/file-graph/index.js.map +0 -1
- package/src/core/file-graph/project-file-map.d.ts +0 -3
- package/src/core/file-graph/project-file-map.js +0 -35
- package/src/core/file-graph/project-file-map.js.map +0 -1
- package/src/utilities/create-project-graph-from-tree.d.ts +0 -5
- package/src/utilities/create-project-graph-from-tree.js +0 -13
- package/src/utilities/create-project-graph-from-tree.js.map +0 -1
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.killSocketOrPath = exports.FULL_OS_SOCKET_PATH = exports.isWindows = void 0;
|
|
4
|
-
const
|
|
3
|
+
exports.deserializeResult = exports.serializeResult = exports.killSocketOrPath = exports.FULL_OS_SOCKET_PATH = exports.isWindows = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
5
|
const os_1 = require("os");
|
|
6
6
|
const path_1 = require("path");
|
|
7
|
-
const
|
|
7
|
+
const tmp_dir_1 = require("./tmp-dir");
|
|
8
|
+
exports.isWindows = os_1.platform() === 'win32';
|
|
8
9
|
/**
|
|
9
10
|
* For IPC with the daemon server we use unix sockets or windows named pipes, depending on the user's operating system.
|
|
10
11
|
*
|
|
11
12
|
* See https://nodejs.org/dist/latest-v14.x/docs/api/net.html#net_identifying_paths_for_ipc_connections for a full breakdown
|
|
12
13
|
* of OS differences between Unix domain sockets and named pipes.
|
|
13
|
-
*
|
|
14
|
-
* We currently create the socket/pipe based on a path within the current workspace so that we maintain one unique daemon per
|
|
15
|
-
* workspace to ensure that subtle differences between Nx workspaces cannot cause issues.
|
|
16
14
|
*/
|
|
17
|
-
const workspaceSocketPath = path_1.join(app_root_1.appRootPath, './nx-daemon.sock');
|
|
18
|
-
exports.isWindows = os_1.platform() === 'win32';
|
|
19
15
|
exports.FULL_OS_SOCKET_PATH = exports.isWindows
|
|
20
|
-
? '\\\\.\\pipe\\nx\\' + path_1.resolve(
|
|
21
|
-
: path_1.resolve(
|
|
16
|
+
? '\\\\.\\pipe\\nx\\' + path_1.resolve(tmp_dir_1.DAEMON_SOCKET_PATH)
|
|
17
|
+
: path_1.resolve(tmp_dir_1.DAEMON_SOCKET_PATH);
|
|
22
18
|
function killSocketOrPath() {
|
|
23
19
|
try {
|
|
24
20
|
fs_1.unlinkSync(exports.FULL_OS_SOCKET_PATH);
|
|
@@ -26,4 +22,37 @@ function killSocketOrPath() {
|
|
|
26
22
|
catch (_a) { }
|
|
27
23
|
}
|
|
28
24
|
exports.killSocketOrPath = killSocketOrPath;
|
|
25
|
+
// Include the original stack trace within the serialized error so that the client can show it to the user.
|
|
26
|
+
function serializeError(error) {
|
|
27
|
+
if (!error) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return JSON.stringify(error, Object.getOwnPropertyNames(error));
|
|
31
|
+
}
|
|
32
|
+
// Prepare a serialized project graph result for sending over IPC from the server to the client
|
|
33
|
+
function serializeResult(error, serializedProjectGraph) {
|
|
34
|
+
// We do not want to repeat work `JSON.stringify`ing an object containing the potentially large project graph so merge as strings
|
|
35
|
+
return `{ "error": ${serializeError(error)}, "projectGraph": ${serializedProjectGraph} }`;
|
|
36
|
+
}
|
|
37
|
+
exports.serializeResult = serializeResult;
|
|
38
|
+
// Interpret a string sent over IPC from the server to the client as a project graph result
|
|
39
|
+
function deserializeResult(serializedResult) {
|
|
40
|
+
try {
|
|
41
|
+
const result = JSON.parse(serializedResult);
|
|
42
|
+
if (result.error) {
|
|
43
|
+
const err = new Error();
|
|
44
|
+
err.message = result.error.message;
|
|
45
|
+
err.stack = result.error.stack;
|
|
46
|
+
result.error = err;
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
catch (_a) {
|
|
51
|
+
return {
|
|
52
|
+
error: new Error('Could not deserialized project graph result'),
|
|
53
|
+
projectGraph: null,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.deserializeResult = deserializeResult;
|
|
29
58
|
//# sourceMappingURL=socket-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket-utils.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/core/project-graph/daemon/socket-utils.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"socket-utils.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/core/project-graph/daemon/socket-utils.ts"],"names":[],"mappings":";;;AACA,2BAAgC;AAChC,2BAA8B;AAC9B,+BAA+B;AAC/B,uCAA+C;AAElC,QAAA,SAAS,GAAG,aAAQ,EAAE,KAAK,OAAO,CAAC;AAEhD;;;;;GAKG;AACU,QAAA,mBAAmB,GAAG,iBAAS;IAC1C,CAAC,CAAC,mBAAmB,GAAG,cAAO,CAAC,4BAAkB,CAAC;IACnD,CAAC,CAAC,cAAO,CAAC,4BAAkB,CAAC,CAAC;AAEhC,SAAgB,gBAAgB;IAC9B,IAAI;QACF,eAAU,CAAC,2BAAmB,CAAC,CAAC;KACjC;IAAC,WAAM,GAAE;AACZ,CAAC;AAJD,4CAIC;AAOD,2GAA2G;AAC3G,SAAS,cAAc,CAAC,KAAmB;IACzC,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,IAAI,CAAC;KACb;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,+FAA+F;AAC/F,SAAgB,eAAe,CAC7B,KAAmB,EACnB,sBAAqC;IAErC,iIAAiI;IACjI,OAAO,cAAc,cAAc,CACjC,KAAK,CACN,qBAAqB,sBAAsB,IAAI,CAAC;AACnD,CAAC;AARD,0CAQC;AAED,2FAA2F;AAC3F,SAAgB,iBAAiB,CAC/B,gBAAwB;IAExB,IAAI;QACF,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAC5C,IAAI,MAAM,CAAC,KAAK,EAAE;YAChB,MAAM,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;YACxB,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;YACnC,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;YAC/B,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC;SACpB;QACD,OAAO,MAAM,CAAC;KACf;IAAC,WAAM;QACN,OAAO;YACL,KAAK,EAAE,IAAI,KAAK,CAAC,6CAA6C,CAAC;YAC/D,YAAY,EAAE,IAAI;SACnB,CAAC;KACH;AACH,CAAC;AAlBD,8CAkBC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E.g. on a mac the value for this will be something like:
|
|
3
|
+
* /var/folders/zk/9ff5snsj71j2r07qht44w_nr0000gn/T/nx-daemon/{{subDirForCurrentWorkspace}}
|
|
4
|
+
*/
|
|
5
|
+
export declare const DAEMON_DIR_FOR_CURRENT_WORKSPACE: string;
|
|
6
|
+
export declare const DAEMON_OUTPUT_LOG_FILE: string;
|
|
7
|
+
export declare const DAEMON_SOCKET_PATH: string;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DAEMON_SOCKET_PATH = exports.DAEMON_OUTPUT_LOG_FILE = exports.DAEMON_DIR_FOR_CURRENT_WORKSPACE = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Per workspace (to avoid subtle differences and issues), we want to have a deterministic
|
|
6
|
+
* location within the OS's tmp directory where we write log files for background processes
|
|
7
|
+
* and where we create the actual unix socket/named pipe for the daemon.
|
|
8
|
+
*/
|
|
9
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
10
|
+
const app_root_1 = require("@nrwl/tao/src/utils/app-root");
|
|
11
|
+
const fs_extra_1 = require("fs-extra");
|
|
12
|
+
const os_1 = require("os");
|
|
13
|
+
const path_1 = require("path");
|
|
14
|
+
const crypto_1 = require("crypto");
|
|
15
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
|
|
16
|
+
function escapeRegExp(string) {
|
|
17
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* As part of deterministically generating a tmp dir for the daemon related outputs to go in,
|
|
21
|
+
* we create a unique name for the current workspace based on the full normalized absolute
|
|
22
|
+
* path to its root directory.
|
|
23
|
+
*/
|
|
24
|
+
function createUniqueNameForCurrentWorkspace() {
|
|
25
|
+
let pathAsName = devkit_1.normalizePath(app_root_1.appRootPath).replace(
|
|
26
|
+
// Replace the occurrences of / in the unix-style normalized path with a -
|
|
27
|
+
new RegExp(escapeRegExp('/'), 'g'), '-');
|
|
28
|
+
if (pathAsName[0] === '-') {
|
|
29
|
+
pathAsName = pathAsName.slice(1);
|
|
30
|
+
}
|
|
31
|
+
return pathAsName;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The unique names generated by createUniqueNameForCurrentWorkspace() can potentially be too long
|
|
35
|
+
* to leverage for the daemon because the character length of unix sockets and named pipes is limited:
|
|
36
|
+
*
|
|
37
|
+
* - Windows: 256 chars (named pipe)
|
|
38
|
+
* - Unix: 108 chars (unix socket)
|
|
39
|
+
* - macOS and BSD: 104 chars (unix socket)
|
|
40
|
+
*
|
|
41
|
+
* We therefore hash them using a fixed length algorithm to be able to limit their length but still
|
|
42
|
+
* have them be unique and deterministic. SHA-1 should be "good enough" for this specific purpose.
|
|
43
|
+
*/
|
|
44
|
+
const subDirForCurrentWorkspace = crypto_1.createHash('sha1')
|
|
45
|
+
.update(createUniqueNameForCurrentWorkspace())
|
|
46
|
+
.digest('hex')
|
|
47
|
+
.slice(0, 32);
|
|
48
|
+
/**
|
|
49
|
+
* E.g. on a mac the value for this will be something like:
|
|
50
|
+
* /var/folders/zk/9ff5snsj71j2r07qht44w_nr0000gn/T/nx-daemon/{{subDirForCurrentWorkspace}}
|
|
51
|
+
*/
|
|
52
|
+
exports.DAEMON_DIR_FOR_CURRENT_WORKSPACE = path_1.join(os_1.tmpdir(), 'nx-daemon', subDirForCurrentWorkspace);
|
|
53
|
+
fs_extra_1.ensureDirSync(exports.DAEMON_DIR_FOR_CURRENT_WORKSPACE);
|
|
54
|
+
exports.DAEMON_OUTPUT_LOG_FILE = path_1.join(exports.DAEMON_DIR_FOR_CURRENT_WORKSPACE, 'server.log');
|
|
55
|
+
fs_extra_1.ensureFileSync(exports.DAEMON_OUTPUT_LOG_FILE);
|
|
56
|
+
exports.DAEMON_SOCKET_PATH = path_1.join(exports.DAEMON_DIR_FOR_CURRENT_WORKSPACE,
|
|
57
|
+
// As per notes above on socket/named pipe length limitations, we keep this intentionally short
|
|
58
|
+
'd.sock');
|
|
59
|
+
//# sourceMappingURL=tmp-dir.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tmp-dir.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/core/project-graph/daemon/tmp-dir.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,yCAA6C;AAC7C,2DAA2D;AAC3D,uCAAyD;AACzD,2BAA4B;AAC5B,+BAA4B;AAC5B,mCAAoC;AAEpC,6FAA6F;AAC7F,SAAS,YAAY,CAAC,MAAM;IAC1B,OAAO,MAAM,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC,CAAC,oCAAoC;AAC5F,CAAC;AAED;;;;GAIG;AACH,SAAS,mCAAmC;IAC1C,IAAI,UAAU,GAAG,sBAAa,CAAC,sBAAW,CAAC,CAAC,OAAO;IACjD,0EAA0E;IAC1E,IAAI,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAClC,GAAG,CACJ,CAAC;IACF,IAAI,UAAU,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACzB,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KAClC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,yBAAyB,GAAG,mBAAU,CAAC,MAAM,CAAC;KACjD,MAAM,CAAC,mCAAmC,EAAE,CAAC;KAC7C,MAAM,CAAC,KAAK,CAAC;KACb,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAEhB;;;GAGG;AACU,QAAA,gCAAgC,GAAG,WAAI,CAClD,WAAM,EAAE,EACR,WAAW,EACX,yBAAyB,CAC1B,CAAC;AACF,wBAAa,CAAC,wCAAgC,CAAC,CAAC;AAEnC,QAAA,sBAAsB,GAAG,WAAI,CACxC,wCAAgC,EAChC,YAAY,CACb,CAAC;AACF,yBAAc,CAAC,8BAAsB,CAAC,CAAC;AAE1B,QAAA,kBAAkB,GAAG,WAAI,CACpC,wCAAgC;AAChC,+FAA+F;AAC/F,QAAQ,CACT,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { createProjectGraphAsync, readCachedProjectGraph, } from './project-graph';
|
|
2
2
|
export * from './project-graph-models';
|
|
3
3
|
export * from './operators';
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readCachedProjectGraph = exports.
|
|
3
|
+
exports.readCachedProjectGraph = exports.createProjectGraphAsync = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
var project_graph_1 = require("./project-graph");
|
|
6
|
-
Object.defineProperty(exports, "createProjectGraph", { enumerable: true, get: function () { return project_graph_1.createProjectGraph; } });
|
|
7
6
|
Object.defineProperty(exports, "createProjectGraphAsync", { enumerable: true, get: function () { return project_graph_1.createProjectGraphAsync; } });
|
|
8
|
-
Object.defineProperty(exports, "readCurrentProjectGraph", { enumerable: true, get: function () { return project_graph_1.readCurrentProjectGraph; } });
|
|
9
7
|
Object.defineProperty(exports, "readCachedProjectGraph", { enumerable: true, get: function () { return project_graph_1.readCachedProjectGraph; } });
|
|
10
8
|
tslib_1.__exportStar(require("./project-graph-models"), exports);
|
|
11
9
|
tslib_1.__exportStar(require("./operators"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/workspace/src/core/project-graph/index.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/workspace/src/core/project-graph/index.ts"],"names":[],"mappings":";;;;AAAA,iDAGyB;AAFvB,wHAAA,uBAAuB,OAAA;AACvB,uHAAA,sBAAsB,OAAA;AAExB,iEAAuC;AACvC,sDAA4B"}
|
|
@@ -49,7 +49,7 @@ function isWorkspaceProject(project) {
|
|
|
49
49
|
}
|
|
50
50
|
exports.isWorkspaceProject = isWorkspaceProject;
|
|
51
51
|
function isNpmProject(project) {
|
|
52
|
-
return project.type === 'npm';
|
|
52
|
+
return (project === null || project === void 0 ? void 0 : project.type) === 'npm';
|
|
53
53
|
}
|
|
54
54
|
exports.isNpmProject = isNpmProject;
|
|
55
55
|
function getSortedProjectNodes(nodes) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operators.js","sourceRoot":"","sources":["../../../../../../packages/workspace/src/core/project-graph/operators.ts"],"names":[],"mappings":";;;AAEA,MAAM,WAAW,GAAG,IAAI,GAAG,EAA8B,CAAC;AAE1D,SAAgB,OAAO,CAAC,KAAmB;IACzC,MAAM,cAAc,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC9C,IAAI,cAAc;QAAE,OAAO,cAAc,CAAC;IAE1C,MAAM,MAAM,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,EAAkB,CAAC;IACxE,MAAM,CAAC,IAAI,CAAC,K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AAC,CAAC,CAAC,IAAI,CAAC,CAAC;aACnB;QACH,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;YAClD,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBACf,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE;oBAC9C,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iBACtC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;AAtBD,kCAsBC;AAED,SAAgB,kBAAkB,CAAC,OAAyB;IAC1D,OAAO,CACL,OAAO,CAAC,IAAI,KAAK,KAAK,IAAI,OAAO,CAAC,IAAI,KAAK,KAAK,IAAI,OAAO,CAAC,IAAI,KAAK,KAAK,CAC3E,CAAC;AACJ,CAAC;AAJD,gDAIC;AAED,SAAgB,YAAY,CAC1B,OAAyB;IAEzB,OAAO,OAAO,
|
|
1
|
+
{"version":3,"file":"operators.js","sourceRoot":"","sources":["../../../../../../packages/workspace/src/core/project-graph/operators.ts"],"names":[],"mappings":";;;AAEA,MAAM,WAAW,GAAG,IAAI,GAAG,EAA8B,CAAC;AAE1D,SAAgB,OAAO,CAAC,KAAmB;IACzC,MAAM,cAAc,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC9C,IAAI,cAAc;QAAE,OAAO,cAAc,CAAC;IAE1C,MAAM,MAAM,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,EAAkB,CAAC;IACxE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAA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AQ,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YAC7C,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,SAAS,UAAU,CAAC,IAAI;QACtB,IAAI,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAAE,OAAO;QACjD,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE7B,MAAM,EAAE,GAAG,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5C,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACf,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE;gBAC/B,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;aACjC;YACD,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACf,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AA1CD,4BA0CC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const worker_threads_1 = require("worker_threads");
|
|
4
|
+
const build_explicit_typescript_and_package_json_dependencies_1 = require("./build-dependencies/build-explicit-typescript-and-package-json-dependencies");
|
|
5
|
+
let workspace;
|
|
6
|
+
let projectGraph;
|
|
7
|
+
worker_threads_1.parentPort.on('message', (message) => {
|
|
8
|
+
if (message.workspace) {
|
|
9
|
+
workspace = message.workspace;
|
|
10
|
+
projectGraph = message.projectGraph;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
const res = build_explicit_typescript_and_package_json_dependencies_1.buildExplicitTypescriptAndPackageJsonDependencies(workspace, projectGraph, message.filesToProcess);
|
|
14
|
+
worker_threads_1.parentPort.postMessage(res);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=project-graph-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-graph-worker.js","sourceRoot":"","sources":["../../../../../../packages/workspace/src/core/project-graph/project-graph-worker.ts"],"names":[],"mappings":";;AAAA,mDAA4C;AAE5C,0JAAiJ;AAEjJ,IAAI,SAA2B,CAAC;AAChC,IAAI,YAAiC,CAAC;AAEtC,2BAAU,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;IACnC,IAAI,OAAO,CAAC,SAAS,EAAE;QACrB,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QAC9B,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;KACrC;SAAM;QACL,MAAM,GAAG,GAAG,2GAAiD,CAC3D,SAAS,EACT,YAAY,EACZ,OAAO,CAAC,cAAc,CACvB,CAAC;QACF,2BAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;KAC7B;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -1,36 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProjectGraph } from '@nrwl/devkit';
|
|
2
2
|
/**
|
|
3
3
|
* Synchronously reads the latest cached copy of the workspace's ProjectGraph.
|
|
4
4
|
* @throws {Error} if there is no cached ProjectGraph to read from
|
|
5
|
-
|
|
6
|
-
* @param {string} projectGraphVersion Version to map ProjectGraph to
|
|
7
|
-
* @returns {ProjectGraph}
|
|
8
5
|
*/
|
|
9
6
|
export declare function readCachedProjectGraph(projectGraphVersion?: string): ProjectGraph;
|
|
10
|
-
/**
|
|
11
|
-
* Migrate project graph from v3 to v4
|
|
12
|
-
* @param {ProjectGraph} projectGraph
|
|
13
|
-
*/
|
|
14
|
-
export declare function projectGraphMigrate3to4(projectGraph: ProjectGraph): ProjectGraph;
|
|
15
|
-
/**
|
|
16
|
-
* Backwards compatibility adapter for project Nodes
|
|
17
|
-
* @param {ProjectGraph} projectGraph
|
|
18
|
-
* @returns {ProjectGraph}
|
|
19
|
-
*/
|
|
20
|
-
export declare function projectGraphCompat4to3(projectGraph: ProjectGraph): ProjectGraph;
|
|
21
|
-
/**
|
|
22
|
-
* Backwards compatibility adapter for FileData
|
|
23
|
-
* @param {FileData} fileData
|
|
24
|
-
* @param {string?} projectGraphVersion
|
|
25
|
-
* @returns
|
|
26
|
-
*/
|
|
27
|
-
export declare function projectFileDataCompatAdapter(fileData: FileData, projectGraphVersion: string): FileData;
|
|
28
7
|
export declare function createProjectGraphAsync(projectGraphVersion?: string): Promise<ProjectGraph>;
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated This function is deprecated in favor of the new asynchronous version {@link createProjectGraphAsync}
|
|
31
|
-
*/
|
|
32
|
-
export declare function createProjectGraph(workspaceJson?: WorkspaceJsonConfiguration, nxJson?: NxJsonConfiguration, workspaceFiles?: FileData[], projectGraphVersion?: string): ProjectGraph;
|
|
33
|
-
/**
|
|
34
|
-
* @deprecated This function is deprecated in favor of {@link readCachedProjectGraph}
|
|
35
|
-
*/
|
|
36
|
-
export declare function readCurrentProjectGraph(): ProjectGraph | null;
|
|
@@ -1,27 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createProjectGraphAsync = exports.readCachedProjectGraph = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
-
const app_root_1 = require("@nrwl/tao/src/utils/app-root");
|
|
7
|
-
const path_1 = require("path");
|
|
8
|
-
const perf_hooks_1 = require("perf_hooks");
|
|
9
|
-
const assert_workspace_validity_1 = require("../assert-workspace-validity");
|
|
10
|
-
const file_graph_1 = require("../file-graph");
|
|
11
|
-
const file_utils_1 = require("../file-utils");
|
|
12
|
-
const normalize_nx_json_1 = require("../normalize-nx-json");
|
|
13
5
|
const nx_deps_cache_1 = require("../nx-deps/nx-deps-cache");
|
|
14
|
-
const
|
|
15
|
-
const build_nodes_1 = require("./build-nodes");
|
|
16
|
-
const fs_1 = require("fs");
|
|
6
|
+
const build_project_graph_1 = require("./build-project-graph");
|
|
17
7
|
/**
|
|
18
8
|
* Synchronously reads the latest cached copy of the workspace's ProjectGraph.
|
|
19
9
|
* @throws {Error} if there is no cached ProjectGraph to read from
|
|
20
|
-
|
|
21
|
-
* @param {string} projectGraphVersion Version to map ProjectGraph to
|
|
22
|
-
* @returns {ProjectGraph}
|
|
23
10
|
*/
|
|
24
|
-
function readCachedProjectGraph(projectGraphVersion = '
|
|
11
|
+
function readCachedProjectGraph(projectGraphVersion = '4.0') {
|
|
25
12
|
const projectGraphCache = nx_deps_cache_1.readCache();
|
|
26
13
|
if (!projectGraphCache) {
|
|
27
14
|
throw new Error(`
|
|
@@ -33,65 +20,13 @@ function readCachedProjectGraph(projectGraphVersion = '3.0') {
|
|
|
33
20
|
If you encounter this error as part of running standard \`nx\` commands then please open an issue on https://github.com/nrwl/nx
|
|
34
21
|
`);
|
|
35
22
|
}
|
|
36
|
-
|
|
23
|
+
return {
|
|
37
24
|
version: projectGraphCache.version,
|
|
38
25
|
nodes: projectGraphCache.nodes,
|
|
39
26
|
dependencies: projectGraphCache.dependencies,
|
|
40
27
|
};
|
|
41
|
-
if (projectGraphVersion !== projectGraph.version) {
|
|
42
|
-
projectGraph =
|
|
43
|
-
projectGraphVersion === '3.0'
|
|
44
|
-
? projectGraphCompat4to3(projectGraph)
|
|
45
|
-
: projectGraphMigrate3to4(projectGraph);
|
|
46
|
-
}
|
|
47
|
-
return projectGraph;
|
|
48
28
|
}
|
|
49
29
|
exports.readCachedProjectGraph = readCachedProjectGraph;
|
|
50
|
-
/**
|
|
51
|
-
* Migrate project graph from v3 to v4
|
|
52
|
-
* @param {ProjectGraph} projectGraph
|
|
53
|
-
*/
|
|
54
|
-
function projectGraphMigrate3to4(projectGraph) {
|
|
55
|
-
const nodes = {};
|
|
56
|
-
Object.entries(projectGraph.nodes).forEach(([name, node]) => {
|
|
57
|
-
const files = node.data.files.map(({ file, hash, deps }) => (Object.assign({ file,
|
|
58
|
-
hash }, (deps && { deps }))));
|
|
59
|
-
nodes[name] = Object.assign(Object.assign({}, node), { data: Object.assign(Object.assign({}, node.data), { files }) });
|
|
60
|
-
});
|
|
61
|
-
return Object.assign(Object.assign({}, projectGraph), { nodes, version: '4.0' });
|
|
62
|
-
}
|
|
63
|
-
exports.projectGraphMigrate3to4 = projectGraphMigrate3to4;
|
|
64
|
-
/**
|
|
65
|
-
* Backwards compatibility adapter for project Nodes
|
|
66
|
-
* @param {ProjectGraph} projectGraph
|
|
67
|
-
* @returns {ProjectGraph}
|
|
68
|
-
*/
|
|
69
|
-
function projectGraphCompat4to3(projectGraph) {
|
|
70
|
-
const nodes = {};
|
|
71
|
-
Object.entries(projectGraph.nodes).forEach(([name, node]) => {
|
|
72
|
-
const files = node.data.files.map(({ file, hash, ext, deps }) => (Object.assign({ file,
|
|
73
|
-
hash, ext: ext || path_1.extname(file) }, (deps && { deps }))));
|
|
74
|
-
nodes[name] = Object.assign(Object.assign({}, node), { data: Object.assign(Object.assign({}, node.data), { files }) });
|
|
75
|
-
});
|
|
76
|
-
return Object.assign(Object.assign({}, projectGraph), { nodes, version: '3.0' });
|
|
77
|
-
}
|
|
78
|
-
exports.projectGraphCompat4to3 = projectGraphCompat4to3;
|
|
79
|
-
/**
|
|
80
|
-
* Backwards compatibility adapter for FileData
|
|
81
|
-
* @param {FileData} fileData
|
|
82
|
-
* @param {string?} projectGraphVersion
|
|
83
|
-
* @returns
|
|
84
|
-
*/
|
|
85
|
-
function projectFileDataCompatAdapter(fileData, projectGraphVersion) {
|
|
86
|
-
const { file, hash, ext, deps } = fileData;
|
|
87
|
-
if (projectGraphVersion !== '3.0') {
|
|
88
|
-
return Object.assign({ file, hash }, { deps });
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
return Object.assign({ file, hash, ext: ext || path_1.extname(file) }, { deps });
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
exports.projectFileDataCompatAdapter = projectFileDataCompatAdapter;
|
|
95
30
|
function createProjectGraphAsync(projectGraphVersion = '3.0') {
|
|
96
31
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
97
32
|
/**
|
|
@@ -99,139 +34,14 @@ function createProjectGraphAsync(projectGraphVersion = '3.0') {
|
|
|
99
34
|
* If the environment variable is not set to true, fallback to using the existing in-process logic.
|
|
100
35
|
*/
|
|
101
36
|
if (process.env.NX_DAEMON !== 'true') {
|
|
102
|
-
return
|
|
37
|
+
return build_project_graph_1.buildProjectGraph(projectGraphVersion);
|
|
103
38
|
}
|
|
104
39
|
const daemonClient = require('./daemon/client/client');
|
|
105
40
|
if (!(yield daemonClient.isServerAvailable())) {
|
|
106
|
-
devkit_1.logger.warn('\nWARNING: You set NX_DAEMON=true but the Daemon Server is not running. Starting Daemon Server in the background...');
|
|
107
41
|
yield daemonClient.startInBackground();
|
|
108
42
|
}
|
|
109
43
|
return daemonClient.getProjectGraphFromServer();
|
|
110
44
|
});
|
|
111
45
|
}
|
|
112
46
|
exports.createProjectGraphAsync = createProjectGraphAsync;
|
|
113
|
-
function readCombinedDeps() {
|
|
114
|
-
const json = devkit_1.readJsonFile(path_1.join(app_root_1.appRootPath, 'package.json'));
|
|
115
|
-
return Object.assign(Object.assign({}, json.dependencies), json.devDependencies);
|
|
116
|
-
}
|
|
117
|
-
// TODO(v13): remove this deprecated function
|
|
118
|
-
/**
|
|
119
|
-
* @deprecated This function is deprecated in favor of the new asynchronous version {@link createProjectGraphAsync}
|
|
120
|
-
*/
|
|
121
|
-
function createProjectGraph(workspaceJson, nxJson, workspaceFiles, projectGraphVersion) {
|
|
122
|
-
projectGraphVersion = projectGraphVersion || '3.0';
|
|
123
|
-
workspaceJson = workspaceJson || file_utils_1.readWorkspaceJson();
|
|
124
|
-
nxJson = nxJson || file_utils_1.readNxJson();
|
|
125
|
-
workspaceFiles = workspaceFiles || file_utils_1.readWorkspaceFiles(projectGraphVersion);
|
|
126
|
-
const cacheEnabled = process.env.NX_CACHE_PROJECT_GRAPH !== 'false';
|
|
127
|
-
let cache = cacheEnabled ? nx_deps_cache_1.readCache() : false;
|
|
128
|
-
assert_workspace_validity_1.assertWorkspaceValidity(workspaceJson, nxJson);
|
|
129
|
-
const normalizedNxJson = normalize_nx_json_1.normalizeNxJson(nxJson);
|
|
130
|
-
const projectFileMap = file_graph_1.createProjectFileMap(workspaceJson, workspaceFiles);
|
|
131
|
-
const packageJsonDeps = readCombinedDeps();
|
|
132
|
-
const rootTsConfig = readRootTsConfig();
|
|
133
|
-
let filesToProcess = projectFileMap;
|
|
134
|
-
let cachedFileData = {};
|
|
135
|
-
if (cache &&
|
|
136
|
-
(cache.version === '3.0' || cache.version === '4.0') &&
|
|
137
|
-
!nx_deps_cache_1.shouldRecomputeWholeGraph(cache, packageJsonDeps, workspaceJson, normalizedNxJson, rootTsConfig)) {
|
|
138
|
-
const fromCache = nx_deps_cache_1.extractCachedFileData(projectFileMap, cache);
|
|
139
|
-
filesToProcess = fromCache.filesToProcess;
|
|
140
|
-
cachedFileData = fromCache.cachedFileData;
|
|
141
|
-
}
|
|
142
|
-
const context = createContext(workspaceJson, normalizedNxJson, projectFileMap, filesToProcess);
|
|
143
|
-
let projectGraph = buildProjectGraph(context, cachedFileData, projectGraphVersion);
|
|
144
|
-
if (cache && cache.version && projectGraphVersion !== cache.version) {
|
|
145
|
-
projectGraph =
|
|
146
|
-
projectGraphVersion === '3.0'
|
|
147
|
-
? projectGraphCompat4to3(projectGraph)
|
|
148
|
-
: projectGraphMigrate3to4(projectGraph);
|
|
149
|
-
}
|
|
150
|
-
if (cacheEnabled) {
|
|
151
|
-
nx_deps_cache_1.writeCache(packageJsonDeps, nxJson, rootTsConfig, projectGraph);
|
|
152
|
-
}
|
|
153
|
-
return addWorkspaceFiles(projectGraph, workspaceFiles);
|
|
154
|
-
}
|
|
155
|
-
exports.createProjectGraph = createProjectGraph;
|
|
156
|
-
// TODO(v13): remove this deprecated function
|
|
157
|
-
/**
|
|
158
|
-
* @deprecated This function is deprecated in favor of {@link readCachedProjectGraph}
|
|
159
|
-
*/
|
|
160
|
-
function readCurrentProjectGraph() {
|
|
161
|
-
const cache = nx_deps_cache_1.readCache();
|
|
162
|
-
return cache === false ? null : cache;
|
|
163
|
-
}
|
|
164
|
-
exports.readCurrentProjectGraph = readCurrentProjectGraph;
|
|
165
|
-
function addWorkspaceFiles(projectGraph, allWorkspaceFiles) {
|
|
166
|
-
return Object.assign(Object.assign({}, projectGraph), { allWorkspaceFiles });
|
|
167
|
-
}
|
|
168
|
-
function buildProjectGraph(ctx, cachedFileData, projectGraphVersion) {
|
|
169
|
-
perf_hooks_1.performance.mark('build project graph:start');
|
|
170
|
-
const builder = new devkit_1.ProjectGraphBuilder();
|
|
171
|
-
build_nodes_1.buildWorkspaceProjectNodes(ctx, builder);
|
|
172
|
-
build_nodes_1.buildNpmPackageNodes(builder);
|
|
173
|
-
for (const proj of Object.keys(cachedFileData)) {
|
|
174
|
-
for (const f of builder.graph.nodes[proj].data.files) {
|
|
175
|
-
const cached = cachedFileData[proj][f.file];
|
|
176
|
-
if (cached) {
|
|
177
|
-
f.deps = cached.deps;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
build_dependencies_1.buildExplicitTypeScriptDependencies(ctx, builder);
|
|
182
|
-
build_dependencies_1.buildExplicitPackageJsonDependencies(ctx, builder);
|
|
183
|
-
build_dependencies_1.buildImplicitProjectDependencies(ctx, builder);
|
|
184
|
-
builder.setVersion(projectGraphVersion);
|
|
185
|
-
const initProjectGraph = builder.getUpdatedProjectGraph();
|
|
186
|
-
const r = updateProjectGraphWithPlugins(ctx, initProjectGraph);
|
|
187
|
-
perf_hooks_1.performance.mark('build project graph:end');
|
|
188
|
-
perf_hooks_1.performance.measure('build project graph', 'build project graph:start', 'build project graph:end');
|
|
189
|
-
return r;
|
|
190
|
-
}
|
|
191
|
-
function createContext(workspaceJson, nxJson, fileMap, filesToProcess) {
|
|
192
|
-
const projects = Object.keys(workspaceJson.projects).reduce((map, projectName) => {
|
|
193
|
-
map[projectName] = Object.assign(Object.assign({}, workspaceJson.projects[projectName]), nxJson.projects[projectName]);
|
|
194
|
-
return map;
|
|
195
|
-
}, {});
|
|
196
|
-
return {
|
|
197
|
-
workspace: Object.assign(Object.assign(Object.assign({}, workspaceJson), nxJson), { projects }),
|
|
198
|
-
fileMap,
|
|
199
|
-
filesToProcess,
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
function updateProjectGraphWithPlugins(context, initProjectGraph) {
|
|
203
|
-
return (context.workspace.plugins || []).reduce((graph, path) => {
|
|
204
|
-
try {
|
|
205
|
-
const pluginPath = require.resolve(path, {
|
|
206
|
-
paths: [app_root_1.appRootPath],
|
|
207
|
-
});
|
|
208
|
-
const pluginModule = require(pluginPath);
|
|
209
|
-
if (!pluginModule.processProjectGraph) {
|
|
210
|
-
return graph;
|
|
211
|
-
}
|
|
212
|
-
return pluginModule.processProjectGraph(graph, context);
|
|
213
|
-
}
|
|
214
|
-
catch (e) {
|
|
215
|
-
const message = `Failed to process the project graph with "${path}". This will error in the future!`;
|
|
216
|
-
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
|
217
|
-
console.error(e);
|
|
218
|
-
devkit_1.logger.error(message);
|
|
219
|
-
return graph;
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
devkit_1.logger.warn(message);
|
|
223
|
-
devkit_1.logger.warn(`Run with NX_VERBOSE_LOGGING=true to see the error.`);
|
|
224
|
-
}
|
|
225
|
-
return graph;
|
|
226
|
-
}
|
|
227
|
-
}, initProjectGraph);
|
|
228
|
-
}
|
|
229
|
-
function readRootTsConfig() {
|
|
230
|
-
for (const tsConfigName of ['tsconfig.base.json', 'tsconfig.json']) {
|
|
231
|
-
const tsConfigPath = path_1.join(app_root_1.appRootPath, tsConfigName);
|
|
232
|
-
if (fs_1.existsSync(tsConfigPath)) {
|
|
233
|
-
return devkit_1.readJsonFile(tsConfigPath);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
47
|
//# sourceMappingURL=project-graph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-graph.js","sourceRoot":"","sources":["../../../../../../packages/workspace/src/core/project-graph/project-graph.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"project-graph.js","sourceRoot":"","sources":["../../../../../../packages/workspace/src/core/project-graph/project-graph.ts"],"names":[],"mappings":";;;;AACA,4DAAwE;AACxE,+DAA0D;AAE1D;;;GAGG;AACH,SAAgB,sBAAsB,CACpC,mBAAmB,GAAG,KAAK;IAE3B,MAAM,iBAAiB,GAA8B,yBAAS,EAAE,CAAC;IACjE,IAAI,CAAC,iBAAiB,EAAE;QACtB,MAAM,IAAI,KAAK,CAAC;;;;;;;KAOf,CAAC,CAAC;KACJ;IACD,OAAO;QACL,OAAO,EAAE,iBAAiB,CAAC,OAAO;QAClC,KAAK,EAAE,iBAAiB,CAAC,KAAK;QAC9B,YAAY,EAAE,iBAAiB,CAAC,YAAY;KAC7C,CAAC;AACJ,CAAC;AAnBD,wDAmBC;AAED,SAAsB,uBAAuB,CAC3C,mBAAmB,GAAG,KAAK;;QAE3B;;;WAGG;QACH,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,MAAM,EAAE;YACpC,OAAO,uCAAiB,CAAC,mBAAmB,CAAC,CAAC;SAC/C;QAED,MAAM,YAAY,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;QACvD,IAAI,CAAC,CAAC,MAAM,YAAY,CAAC,iBAAiB,EAAE,CAAC,EAAE;YAC7C,MAAM,YAAY,CAAC,iBAAiB,EAAE,CAAC;SACxC;QAED,OAAO,YAAY,CAAC,yBAAyB,EAAE,CAAC;IAClD,CAAC;CAAA;AAjBD,0DAiBC"}
|