nx 19.2.0-beta.5 → 19.2.0-beta.7
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/post-install.js +8 -8
- package/package.json +12 -12
- package/src/command-line/deprecated/command-objects.js +2 -1
- package/src/command-line/examples.js +59 -5
- package/src/command-line/graph/command-object.d.ts +25 -2
- package/src/command-line/graph/command-object.js +57 -3
- package/src/command-line/graph/graph.js +2 -1
- package/src/command-line/init/implementation/react/index.js +1 -1
- package/src/command-line/init/implementation/react/rename-js-to-jsx.d.ts +1 -1
- package/src/command-line/init/implementation/react/rename-js-to-jsx.js +2 -2
- package/src/command-line/init/init-v2.js +1 -1
- package/src/command-line/nx-commands.js +1 -1
- package/src/command-line/yargs-utils/shared-options.d.ts +0 -21
- package/src/command-line/yargs-utils/shared-options.js +2 -52
- package/src/daemon/client/client.d.ts +6 -0
- package/src/daemon/client/client.js +45 -2
- package/src/daemon/is-on-daemon.d.ts +1 -0
- package/src/daemon/is-on-daemon.js +7 -0
- package/src/daemon/message-types/get-context-file-data.d.ts +5 -0
- package/src/daemon/message-types/get-context-file-data.js +11 -0
- package/src/daemon/message-types/get-files-in-directory.d.ts +6 -0
- package/src/daemon/message-types/get-files-in-directory.js +11 -0
- package/src/daemon/message-types/get-nx-workspace-files.d.ts +6 -0
- package/src/daemon/message-types/get-nx-workspace-files.js +11 -0
- package/src/daemon/message-types/glob.d.ts +7 -0
- package/src/daemon/message-types/glob.js +11 -0
- package/src/daemon/message-types/hash-glob.d.ts +7 -0
- package/src/daemon/message-types/hash-glob.js +11 -0
- package/src/daemon/message-types/update-context-files.d.ts +7 -0
- package/src/daemon/message-types/update-context-files.js +11 -0
- package/src/daemon/server/handle-context-file-data.d.ts +2 -0
- package/src/daemon/server/handle-context-file-data.js +13 -0
- package/src/daemon/server/handle-get-files-in-directory.d.ts +2 -0
- package/src/daemon/server/handle-get-files-in-directory.js +13 -0
- package/src/daemon/server/handle-glob.d.ts +2 -0
- package/src/daemon/server/handle-glob.js +13 -0
- package/src/daemon/server/handle-hash-glob.d.ts +2 -0
- package/src/daemon/server/handle-hash-glob.js +13 -0
- package/src/daemon/server/handle-nx-workspace-files.d.ts +2 -0
- package/src/daemon/server/handle-nx-workspace-files.js +13 -0
- package/src/daemon/server/plugins.js +1 -0
- package/src/daemon/server/server.js +39 -9
- package/src/devkit-exports.d.ts +1 -1
- package/src/devkit-exports.js +2 -1
- package/src/generators/utils/glob.d.ts +11 -0
- package/src/generators/utils/glob.js +20 -3
- package/src/generators/utils/project-configuration.js +1 -1
- package/src/project-graph/file-map-utils.js +1 -8
- package/src/project-graph/file-utils.js +33 -34
- package/src/project-graph/plugins/isolation/plugin-pool.js +10 -9
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +1 -1
- package/src/project-graph/utils/retrieve-workspace-files.js +6 -6
- package/src/utils/all-file-data.js +1 -7
- package/src/utils/workspace-context.d.ts +13 -5
- package/src/utils/workspace-context.js +45 -14
- package/src/daemon/server/handle-request-file-data.d.ts +0 -4
- package/src/daemon/server/handle-request-file-data.js +0 -13
@@ -1,8 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.resetWorkspaceContext = exports.updateProjectFiles = exports.getFilesInDirectoryUsingContext = exports.getAllFileDataInContext = exports.updateFilesInContext = exports.hashWithWorkspaceContext = exports.globWithWorkspaceContext = exports.getNxWorkspaceFilesFromContext = exports.setupWorkspaceContext = void 0;
|
3
|
+
exports.resetWorkspaceContext = exports.updateProjectFiles = exports.getFilesInDirectoryUsingContext = exports.getAllFileDataInContext = exports.updateFilesInContext = exports.hashWithWorkspaceContext = exports.globWithWorkspaceContext = exports.globWithWorkspaceContextSync = exports.getNxWorkspaceFilesFromContext = exports.setupWorkspaceContext = void 0;
|
4
4
|
const perf_hooks_1 = require("perf_hooks");
|
5
5
|
const cache_directory_1 = require("./cache-directory");
|
6
|
+
const is_on_daemon_1 = require("../daemon/is-on-daemon");
|
7
|
+
const client_1 = require("../daemon/client/client");
|
6
8
|
let workspaceContext;
|
7
9
|
function setupWorkspaceContext(workspaceRoot) {
|
8
10
|
const { WorkspaceContext } = require('../native');
|
@@ -12,33 +14,62 @@ function setupWorkspaceContext(workspaceRoot) {
|
|
12
14
|
perf_hooks_1.performance.measure('workspace context init', 'workspace-context', 'workspace-context:end');
|
13
15
|
}
|
14
16
|
exports.setupWorkspaceContext = setupWorkspaceContext;
|
15
|
-
function getNxWorkspaceFilesFromContext(workspaceRoot, projectRootMap) {
|
16
|
-
|
17
|
-
|
17
|
+
async function getNxWorkspaceFilesFromContext(workspaceRoot, projectRootMap) {
|
18
|
+
if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
19
|
+
ensureContextAvailable(workspaceRoot);
|
20
|
+
return workspaceContext.getWorkspaceFiles(projectRootMap);
|
21
|
+
}
|
22
|
+
return client_1.daemonClient.getWorkspaceFiles(projectRootMap);
|
18
23
|
}
|
19
24
|
exports.getNxWorkspaceFilesFromContext = getNxWorkspaceFilesFromContext;
|
20
|
-
|
25
|
+
/**
|
26
|
+
* Sync method to get files matching globs from workspace context.
|
27
|
+
* NOTE: This method will create the workspace context if it doesn't exist.
|
28
|
+
* It should only be used within Nx internal in code paths that **must** be sync.
|
29
|
+
* If used in an isolated plugin thread this will cause the workspace context
|
30
|
+
* to be recreated which is slow.
|
31
|
+
*/
|
32
|
+
function globWithWorkspaceContextSync(workspaceRoot, globs, exclude) {
|
21
33
|
ensureContextAvailable(workspaceRoot);
|
22
34
|
return workspaceContext.glob(globs, exclude);
|
23
35
|
}
|
36
|
+
exports.globWithWorkspaceContextSync = globWithWorkspaceContextSync;
|
37
|
+
async function globWithWorkspaceContext(workspaceRoot, globs, exclude) {
|
38
|
+
if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
39
|
+
ensureContextAvailable(workspaceRoot);
|
40
|
+
return workspaceContext.glob(globs, exclude);
|
41
|
+
}
|
42
|
+
else {
|
43
|
+
return client_1.daemonClient.glob(globs, exclude);
|
44
|
+
}
|
45
|
+
}
|
24
46
|
exports.globWithWorkspaceContext = globWithWorkspaceContext;
|
25
|
-
function hashWithWorkspaceContext(workspaceRoot, globs, exclude) {
|
26
|
-
|
27
|
-
|
47
|
+
async function hashWithWorkspaceContext(workspaceRoot, globs, exclude) {
|
48
|
+
if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
49
|
+
ensureContextAvailable(workspaceRoot);
|
50
|
+
return workspaceContext.hashFilesMatchingGlob(globs, exclude);
|
51
|
+
}
|
52
|
+
return client_1.daemonClient.hashGlob(globs, exclude);
|
28
53
|
}
|
29
54
|
exports.hashWithWorkspaceContext = hashWithWorkspaceContext;
|
30
55
|
function updateFilesInContext(updatedFiles, deletedFiles) {
|
31
56
|
return workspaceContext?.incrementalUpdate(updatedFiles, deletedFiles);
|
32
57
|
}
|
33
58
|
exports.updateFilesInContext = updateFilesInContext;
|
34
|
-
function getAllFileDataInContext(workspaceRoot) {
|
35
|
-
|
36
|
-
|
59
|
+
async function getAllFileDataInContext(workspaceRoot) {
|
60
|
+
if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
61
|
+
ensureContextAvailable(workspaceRoot);
|
62
|
+
return workspaceContext.allFileData();
|
63
|
+
}
|
64
|
+
return client_1.daemonClient.getWorkspaceContextFileData();
|
37
65
|
}
|
38
66
|
exports.getAllFileDataInContext = getAllFileDataInContext;
|
39
|
-
function getFilesInDirectoryUsingContext(workspaceRoot, dir) {
|
40
|
-
|
41
|
-
|
67
|
+
async function getFilesInDirectoryUsingContext(workspaceRoot, dir) {
|
68
|
+
if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
69
|
+
ensureContextAvailable(workspaceRoot);
|
70
|
+
return workspaceContext.getFilesInDirectory(dir);
|
71
|
+
}
|
72
|
+
return client_1.daemonClient.getFilesInDirectory(dir);
|
42
73
|
}
|
43
74
|
exports.getFilesInDirectoryUsingContext = getFilesInDirectoryUsingContext;
|
44
75
|
function updateProjectFiles(projectRootMappings, rustReferences, updatedFiles, deletedFiles) {
|
@@ -1,13 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.handleRequestFileData = void 0;
|
4
|
-
const workspace_context_1 = require("../../utils/workspace-context");
|
5
|
-
const workspace_root_1 = require("../../utils/workspace-root");
|
6
|
-
async function handleRequestFileData() {
|
7
|
-
const response = JSON.stringify((0, workspace_context_1.getAllFileDataInContext)(workspace_root_1.workspaceRoot));
|
8
|
-
return {
|
9
|
-
response,
|
10
|
-
description: 'handleRequestFileData',
|
11
|
-
};
|
12
|
-
}
|
13
|
-
exports.handleRequestFileData = handleRequestFileData;
|