nx 20.5.0-canary.20250207-8fb9592 → 20.5.0-canary.20250208-c0fd00d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -11
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/client/client.d.ts +1 -0
- package/src/daemon/client/client.js +8 -0
- package/src/daemon/message-types/glob.d.ts +7 -0
- package/src/daemon/message-types/glob.js +9 -1
- package/src/daemon/server/handle-glob.d.ts +1 -0
- package/src/daemon/server/handle-glob.js +8 -0
- package/src/daemon/server/server.js +3 -0
- package/src/native/index.d.ts +7 -0
- package/src/native/nx.wasi.cjs +7 -7
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/project-graph/affected/locators/project-glob-changes.js +2 -2
- package/src/project-graph/utils/project-configuration-utils.d.ts +1 -1
- package/src/project-graph/utils/project-configuration-utils.js +5 -5
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +1 -1
- package/src/project-graph/utils/retrieve-workspace-files.js +14 -18
- package/src/utils/workspace-context.d.ts +1 -0
- package/src/utils/workspace-context.js +8 -0
package/src/core/graph/styles.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[532],{
|
1
|
+
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[532],{69552:()=>{}},s=>{var e;e=69552,s(s.s=e)}]);
|
@@ -47,6 +47,7 @@ export declare class DaemonClient {
|
|
47
47
|
recordOutputsHash(outputs: string[], hash: string): Promise<any>;
|
48
48
|
outputsHashesMatch(outputs: string[], hash: string): Promise<any>;
|
49
49
|
glob(globs: string[], exclude?: string[]): Promise<string[]>;
|
50
|
+
multiGlob(globs: string[], exclude?: string[]): Promise<string[][]>;
|
50
51
|
getWorkspaceContextFileData(): Promise<FileData[]>;
|
51
52
|
getWorkspaceFiles(projectRootMap: Record<string, string>): Promise<NxWorkspaceFiles>;
|
52
53
|
getFilesInDirectory(dir: string): Promise<string[]>;
|
@@ -215,6 +215,14 @@ class DaemonClient {
|
|
215
215
|
};
|
216
216
|
return this.sendToDaemonViaQueue(message);
|
217
217
|
}
|
218
|
+
multiGlob(globs, exclude) {
|
219
|
+
const message = {
|
220
|
+
type: 'MULTI_GLOB',
|
221
|
+
globs,
|
222
|
+
exclude,
|
223
|
+
};
|
224
|
+
return this.sendToDaemonViaQueue(message);
|
225
|
+
}
|
218
226
|
getWorkspaceContextFileData() {
|
219
227
|
const message = {
|
220
228
|
type: get_context_file_data_1.GET_CONTEXT_FILE_DATA,
|
@@ -5,3 +5,10 @@ export type HandleGlobMessage = {
|
|
5
5
|
exclude?: string[];
|
6
6
|
};
|
7
7
|
export declare function isHandleGlobMessage(message: unknown): message is HandleGlobMessage;
|
8
|
+
export declare const MULTI_GLOB: "MULTI_GLOB";
|
9
|
+
export type HandleMultiGlobMessage = {
|
10
|
+
type: typeof MULTI_GLOB;
|
11
|
+
globs: string[];
|
12
|
+
exclude?: string[];
|
13
|
+
};
|
14
|
+
export declare function isHandleMultiGlobMessage(message: unknown): message is HandleMultiGlobMessage;
|
@@ -1,7 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.GLOB = void 0;
|
3
|
+
exports.MULTI_GLOB = exports.GLOB = void 0;
|
4
4
|
exports.isHandleGlobMessage = isHandleGlobMessage;
|
5
|
+
exports.isHandleMultiGlobMessage = isHandleMultiGlobMessage;
|
5
6
|
exports.GLOB = 'GLOB';
|
6
7
|
function isHandleGlobMessage(message) {
|
7
8
|
return (typeof message === 'object' &&
|
@@ -9,3 +10,10 @@ function isHandleGlobMessage(message) {
|
|
9
10
|
'type' in message &&
|
10
11
|
message['type'] === exports.GLOB);
|
11
12
|
}
|
13
|
+
exports.MULTI_GLOB = 'MULTI_GLOB';
|
14
|
+
function isHandleMultiGlobMessage(message) {
|
15
|
+
return (typeof message === 'object' &&
|
16
|
+
message !== null &&
|
17
|
+
'type' in message &&
|
18
|
+
message['type'] === exports.MULTI_GLOB);
|
19
|
+
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.handleGlob = handleGlob;
|
4
|
+
exports.handleMultiGlob = handleMultiGlob;
|
4
5
|
const workspace_root_1 = require("../../utils/workspace-root");
|
5
6
|
const workspace_context_1 = require("../../utils/workspace-context");
|
6
7
|
async function handleGlob(globs, exclude) {
|
@@ -10,3 +11,10 @@ async function handleGlob(globs, exclude) {
|
|
10
11
|
description: 'handleGlob',
|
11
12
|
};
|
12
13
|
}
|
14
|
+
async function handleMultiGlob(globs, exclude) {
|
15
|
+
const files = await (0, workspace_context_1.multiGlobWithWorkspaceContext)(workspace_root_1.workspaceRoot, globs, exclude);
|
16
|
+
return {
|
17
|
+
response: JSON.stringify(files),
|
18
|
+
description: 'handleMultiGlob',
|
19
|
+
};
|
20
|
+
}
|
@@ -129,6 +129,9 @@ async function handleMessage(socket, data) {
|
|
129
129
|
else if ((0, glob_1.isHandleGlobMessage)(payload)) {
|
130
130
|
await handleResult(socket, glob_1.GLOB, () => (0, handle_glob_1.handleGlob)(payload.globs, payload.exclude));
|
131
131
|
}
|
132
|
+
else if ((0, glob_1.isHandleMultiGlobMessage)(payload)) {
|
133
|
+
await handleResult(socket, glob_1.MULTI_GLOB, () => (0, handle_glob_1.handleMultiGlob)(payload.globs, payload.exclude));
|
134
|
+
}
|
132
135
|
else if ((0, get_nx_workspace_files_1.isHandleNxWorkspaceFilesMessage)(payload)) {
|
133
136
|
await handleResult(socket, get_nx_workspace_files_1.GET_NX_WORKSPACE_FILES, () => (0, handle_nx_workspace_files_1.handleNxWorkspaceFiles)(payload.projectRootMap));
|
134
137
|
}
|
package/src/native/index.d.ts
CHANGED
@@ -93,6 +93,13 @@ export declare class WorkspaceContext {
|
|
93
93
|
constructor(workspaceRoot: string, cacheDir: string)
|
94
94
|
getWorkspaceFiles(projectRootMap: Record<string, string>): NxWorkspaceFiles
|
95
95
|
glob(globs: Array<string>, exclude?: Array<string> | undefined | null): Array<string>
|
96
|
+
/**
|
97
|
+
* Performs multiple glob pattern matches against workspace files in parallel
|
98
|
+
* @returns An array of arrays, where each inner array contains the file paths
|
99
|
+
* that matched the corresponding glob pattern in the input. The outer array maintains the same order
|
100
|
+
* as the input globs.
|
101
|
+
*/
|
102
|
+
multiGlob(globs: Array<string>, exclude?: Array<string> | undefined | null): Array<Array<string>>
|
96
103
|
hashFilesMatchingGlob(globs: Array<string>, exclude?: Array<string> | undefined | null): string
|
97
104
|
incrementalUpdate(updatedFiles: Array<string>, deletedFiles: Array<string>): Record<string, string>
|
98
105
|
updateProjectFiles(projectRootMappings: ProjectRootMappings, projectFiles: ExternalObject<ProjectFiles>, globalFiles: ExternalObject<Array<FileData>>, updatedFiles: Record<string, string>, deletedFiles: Array<string>): UpdatedWorkspaceFiles
|
package/src/native/nx.wasi.cjs
CHANGED
@@ -119,13 +119,13 @@ function __napi_rs_initialize_modules(__napiInstance) {
|
|
119
119
|
__napiInstance.exports['__napi_register__FileLock_struct_39']?.()
|
120
120
|
__napiInstance.exports['__napi_register__FileLock_impl_41']?.()
|
121
121
|
__napiInstance.exports['__napi_register__WorkspaceContext_struct_42']?.()
|
122
|
-
__napiInstance.exports['
|
123
|
-
__napiInstance.exports['
|
124
|
-
__napiInstance.exports['
|
125
|
-
__napiInstance.exports['
|
126
|
-
__napiInstance.exports['
|
127
|
-
__napiInstance.exports['
|
128
|
-
__napiInstance.exports['
|
122
|
+
__napiInstance.exports['__napi_register__WorkspaceContext_impl_52']?.()
|
123
|
+
__napiInstance.exports['__napi_register__WorkspaceErrors_53']?.()
|
124
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_54']?.()
|
125
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_55']?.()
|
126
|
+
__napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_56']?.()
|
127
|
+
__napiInstance.exports['__napi_register__FileMap_struct_57']?.()
|
128
|
+
__napiInstance.exports['__napi_register____test_only_transfer_file_map_58']?.()
|
129
129
|
}
|
130
130
|
module.exports.FileLock = __napiModule.exports.FileLock
|
131
131
|
module.exports.HashPlanner = __napiModule.exports.HashPlanner
|
Binary file
|
@@ -20,8 +20,8 @@ const getTouchedProjectsFromProjectGlobChanges = async (touchedFiles, projectGra
|
|
20
20
|
'package.json',
|
21
21
|
]);
|
22
22
|
}
|
23
|
-
const plugins = await (0, get_plugins_1.getPlugins)();
|
24
|
-
return (0, globs_1.combineGlobPatterns)((0, retrieve_workspace_files_1.
|
23
|
+
const plugins = (await (0, get_plugins_1.getPlugins)()).filter((p) => !!p.createNodes);
|
24
|
+
return (0, globs_1.combineGlobPatterns)((0, retrieve_workspace_files_1.getGlobPatternsOfPlugins)(plugins));
|
25
25
|
})();
|
26
26
|
const touchedProjects = new Set();
|
27
27
|
for (const touchedFile of touchedFiles) {
|
@@ -35,7 +35,7 @@ export type ConfigurationResult = {
|
|
35
35
|
* @param workspaceFiles A list of non-ignored workspace files
|
36
36
|
* @param plugins The plugins that should be used to infer project configuration
|
37
37
|
*/
|
38
|
-
export declare function
|
38
|
+
export declare function createProjectConfigurationsWithPlugins(root: string, nxJson: NxJsonConfiguration, projectFiles: string[][], // making this parameter allows devkit to pick up newly created projects
|
39
39
|
plugins: LoadedNxPlugin[]): Promise<ConfigurationResult>;
|
40
40
|
export declare function findMatchingConfigFiles(projectFiles: string[], pattern: string, include: string[], exclude: string[]): string[];
|
41
41
|
export declare function readProjectConfigurationsFromRootMap(projectRootMap: Record<string, ProjectConfiguration>): Record<string, ProjectConfiguration>;
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.mergeProjectConfigurationIntoRootMap = mergeProjectConfigurationIntoRootMap;
|
4
4
|
exports.mergeMetadata = mergeMetadata;
|
5
|
-
exports.
|
5
|
+
exports.createProjectConfigurationsWithPlugins = createProjectConfigurationsWithPlugins;
|
6
6
|
exports.findMatchingConfigFiles = findMatchingConfigFiles;
|
7
7
|
exports.readProjectConfigurationsFromRootMap = readProjectConfigurationsFromRootMap;
|
8
8
|
exports.validateProject = validateProject;
|
@@ -222,7 +222,7 @@ function mergeMetadata(sourceMap, sourceInformation, baseSourceMapPath, metadata
|
|
222
222
|
* @param workspaceFiles A list of non-ignored workspace files
|
223
223
|
* @param plugins The plugins that should be used to infer project configuration
|
224
224
|
*/
|
225
|
-
async function
|
225
|
+
async function createProjectConfigurationsWithPlugins(root = workspace_root_1.workspaceRoot, nxJson, projectFiles, // making this parameter allows devkit to pick up newly created projects
|
226
226
|
plugins) {
|
227
227
|
perf_hooks_1.performance.mark('build-project-configs:start');
|
228
228
|
let spinner;
|
@@ -253,7 +253,7 @@ plugins) {
|
|
253
253
|
if (!pattern) {
|
254
254
|
continue;
|
255
255
|
}
|
256
|
-
const matchingConfigFiles = findMatchingConfigFiles(projectFiles, pattern, include, exclude);
|
256
|
+
const matchingConfigFiles = findMatchingConfigFiles(projectFiles[index], pattern, include, exclude);
|
257
257
|
inProgressPlugins.add(pluginName);
|
258
258
|
let r = createNodes(matchingConfigFiles, {
|
259
259
|
nxJsonConfiguration: nxJson,
|
@@ -289,7 +289,7 @@ plugins) {
|
|
289
289
|
externalNodes,
|
290
290
|
projectRootMap: rootMap,
|
291
291
|
sourceMaps: configurationSourceMaps,
|
292
|
-
matchingProjectFiles: projectFiles,
|
292
|
+
matchingProjectFiles: projectFiles.flat(),
|
293
293
|
};
|
294
294
|
}
|
295
295
|
else {
|
@@ -298,7 +298,7 @@ plugins) {
|
|
298
298
|
externalNodes,
|
299
299
|
projectRootMap: rootMap,
|
300
300
|
sourceMaps: configurationSourceMaps,
|
301
|
-
matchingProjectFiles: projectFiles,
|
301
|
+
matchingProjectFiles: projectFiles.flat(),
|
302
302
|
});
|
303
303
|
}
|
304
304
|
});
|
@@ -23,4 +23,4 @@ export declare function retrieveProjectConfigurations(plugins: LoadedNxPlugin[],
|
|
23
23
|
export declare function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot: string, nxJson: NxJsonConfiguration): Promise<ConfigurationResult>;
|
24
24
|
export declare function retrieveProjectConfigurationPaths(root: string, plugins: Array<LoadedNxPlugin>): Promise<string[]>;
|
25
25
|
export declare function retrieveProjectConfigurationsWithoutPluginInference(root: string): Promise<Record<string, ProjectConfiguration>>;
|
26
|
-
export declare function
|
26
|
+
export declare function getGlobPatternsOfPlugins(plugins: Array<LoadedNxPlugin>): string[];
|
@@ -5,7 +5,7 @@ exports.retrieveProjectConfigurations = retrieveProjectConfigurations;
|
|
5
5
|
exports.retrieveProjectConfigurationsWithAngularProjects = retrieveProjectConfigurationsWithAngularProjects;
|
6
6
|
exports.retrieveProjectConfigurationPaths = retrieveProjectConfigurationPaths;
|
7
7
|
exports.retrieveProjectConfigurationsWithoutPluginInference = retrieveProjectConfigurationsWithoutPluginInference;
|
8
|
-
exports.
|
8
|
+
exports.getGlobPatternsOfPlugins = getGlobPatternsOfPlugins;
|
9
9
|
const perf_hooks_1 = require("perf_hooks");
|
10
10
|
const angular_json_1 = require("../../adapter/angular-json");
|
11
11
|
const nx_json_1 = require("../../config/nx-json");
|
@@ -41,9 +41,10 @@ async function retrieveWorkspaceFiles(workspaceRoot, projectRootMap) {
|
|
41
41
|
* Walk through the workspace and return `ProjectConfigurations`. Only use this if the projectFileMap is not needed.
|
42
42
|
*/
|
43
43
|
async function retrieveProjectConfigurations(plugins, workspaceRoot, nxJson) {
|
44
|
-
const
|
45
|
-
const
|
46
|
-
|
44
|
+
const pluginsWithCreateNodes = plugins.filter((p) => !!p.createNodes);
|
45
|
+
const globPatterns = getGlobPatternsOfPlugins(pluginsWithCreateNodes);
|
46
|
+
const pluginConfigFiles = await (0, workspace_context_1.multiGlobWithWorkspaceContext)(workspaceRoot, globPatterns);
|
47
|
+
return (0, project_configuration_utils_1.createProjectConfigurationsWithPlugins)(workspaceRoot, nxJson, pluginConfigFiles, plugins);
|
47
48
|
}
|
48
49
|
async function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot, nxJson) {
|
49
50
|
const pluginsToLoad = nxJson?.plugins ?? [];
|
@@ -56,31 +57,26 @@ async function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot, n
|
|
56
57
|
const res = await retrieveProjectConfigurations(plugins, workspaceRoot, nxJson);
|
57
58
|
return res;
|
58
59
|
}
|
59
|
-
function retrieveProjectConfigurationPaths(root, plugins) {
|
60
|
-
const projectGlobPatterns =
|
61
|
-
|
60
|
+
async function retrieveProjectConfigurationPaths(root, plugins) {
|
61
|
+
const projectGlobPatterns = getGlobPatternsOfPlugins(plugins);
|
62
|
+
const pluginConfigFiles = await (0, workspace_context_1.multiGlobWithWorkspaceContext)(root, projectGlobPatterns);
|
63
|
+
return pluginConfigFiles.flat();
|
62
64
|
}
|
63
65
|
const projectsWithoutPluginCache = new Map();
|
64
66
|
// TODO: This function is called way too often, it should be optimized without this cache
|
65
67
|
async function retrieveProjectConfigurationsWithoutPluginInference(root) {
|
66
68
|
const nxJson = (0, nx_json_1.readNxJson)(root);
|
67
69
|
const plugins = await (0, get_plugins_1.getOnlyDefaultPlugins)(); // only load default plugins
|
68
|
-
const projectGlobPatterns =
|
70
|
+
const projectGlobPatterns = getGlobPatternsOfPlugins(plugins);
|
69
71
|
const cacheKey = root + ',' + projectGlobPatterns.join(',');
|
70
72
|
if (projectsWithoutPluginCache.has(cacheKey)) {
|
71
73
|
return projectsWithoutPluginCache.get(cacheKey);
|
72
74
|
}
|
73
|
-
const projectFiles = (await (0, workspace_context_1.
|
74
|
-
const { projects } = await (0, project_configuration_utils_1.
|
75
|
+
const projectFiles = (await (0, workspace_context_1.multiGlobWithWorkspaceContext)(root, projectGlobPatterns)) ?? [];
|
76
|
+
const { projects } = await (0, project_configuration_utils_1.createProjectConfigurationsWithPlugins)(root, nxJson, projectFiles, plugins);
|
75
77
|
projectsWithoutPluginCache.set(cacheKey, projects);
|
76
78
|
return projects;
|
77
79
|
}
|
78
|
-
function
|
79
|
-
|
80
|
-
for (const plugin of plugins) {
|
81
|
-
if ('createNodes' in plugin && plugin.createNodes) {
|
82
|
-
globPatterns.push(plugin.createNodes[0]);
|
83
|
-
}
|
84
|
-
}
|
85
|
-
return globPatterns;
|
80
|
+
function getGlobPatternsOfPlugins(plugins) {
|
81
|
+
return plugins.map((p) => p.createNodes[0]);
|
86
82
|
}
|
@@ -10,6 +10,7 @@ export declare function getNxWorkspaceFilesFromContext(workspaceRoot: string, pr
|
|
10
10
|
*/
|
11
11
|
export declare function globWithWorkspaceContextSync(workspaceRoot: string, globs: string[], exclude?: string[]): string[];
|
12
12
|
export declare function globWithWorkspaceContext(workspaceRoot: string, globs: string[], exclude?: string[]): Promise<string[]>;
|
13
|
+
export declare function multiGlobWithWorkspaceContext(workspaceRoot: string, globs: string[], exclude?: string[]): Promise<string[][]>;
|
13
14
|
export declare function hashWithWorkspaceContext(workspaceRoot: string, globs: string[], exclude?: string[]): Promise<string>;
|
14
15
|
export declare function updateContextWithChangedFiles(workspaceRoot: string, createdFiles: string[], updatedFiles: string[], deletedFiles: string[]): Promise<void>;
|
15
16
|
export declare function updateFilesInContext(workspaceRoot: string, updatedFiles: string[], deletedFiles: string[]): Record<string, string>;
|
@@ -4,6 +4,7 @@ exports.setupWorkspaceContext = setupWorkspaceContext;
|
|
4
4
|
exports.getNxWorkspaceFilesFromContext = getNxWorkspaceFilesFromContext;
|
5
5
|
exports.globWithWorkspaceContextSync = globWithWorkspaceContextSync;
|
6
6
|
exports.globWithWorkspaceContext = globWithWorkspaceContext;
|
7
|
+
exports.multiGlobWithWorkspaceContext = multiGlobWithWorkspaceContext;
|
7
8
|
exports.hashWithWorkspaceContext = hashWithWorkspaceContext;
|
8
9
|
exports.updateContextWithChangedFiles = updateContextWithChangedFiles;
|
9
10
|
exports.updateFilesInContext = updateFilesInContext;
|
@@ -50,6 +51,13 @@ async function globWithWorkspaceContext(workspaceRoot, globs, exclude) {
|
|
50
51
|
return client_1.daemonClient.glob(globs, exclude);
|
51
52
|
}
|
52
53
|
}
|
54
|
+
async function multiGlobWithWorkspaceContext(workspaceRoot, globs, exclude) {
|
55
|
+
if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
56
|
+
ensureContextAvailable(workspaceRoot);
|
57
|
+
return workspaceContext.multiGlob(globs, exclude);
|
58
|
+
}
|
59
|
+
return client_1.daemonClient.multiGlob(globs, exclude);
|
60
|
+
}
|
53
61
|
async function hashWithWorkspaceContext(workspaceRoot, globs, exclude) {
|
54
62
|
if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
55
63
|
ensureContextAvailable(workspaceRoot);
|