nx 20.0.12 → 20.0.13
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +11 -11
- package/src/command-line/release/utils/git.js +25 -2
- package/src/core/graph/main.js +1 -1
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/project-graph/plugins/internal-api.d.ts +0 -4
- package/src/project-graph/plugins/internal-api.js +1 -6
- package/src/project-graph/plugins/isolation/messaging.d.ts +1 -5
- package/src/project-graph/plugins/isolation/plugin-pool.js +0 -22
- package/src/project-graph/plugins/isolation/plugin-worker.js +16 -15
- package/src/utils/assert-workspace-validity.js +4 -0
- package/src/utils/find-matching-projects.js +2 -1
Binary file
|
@@ -18,9 +18,5 @@ export type CreateNodesResultWithContext = CreateNodesResult & {
|
|
18
18
|
file: string;
|
19
19
|
pluginName: string;
|
20
20
|
};
|
21
|
-
export declare const nxPluginCache: Map<unknown, [
|
22
|
-
Promise<LoadedNxPlugin>,
|
23
|
-
() => void
|
24
|
-
]>;
|
25
21
|
export declare function loadNxPlugins(plugins: PluginConfiguration[], root?: string): Promise<readonly [LoadedNxPlugin[], () => void]>;
|
26
22
|
export declare function getDefaultPlugins(root: string): Promise<string[]>;
|
@@ -2,7 +2,7 @@
|
|
2
2
|
// This file contains the bits and bobs of the internal API for loading and interacting with Nx plugins.
|
3
3
|
// For the public API, used by plugin authors, see `./public-api.ts`.
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
5
|
-
exports.
|
5
|
+
exports.LoadedNxPlugin = void 0;
|
6
6
|
exports.loadNxPlugins = loadNxPlugins;
|
7
7
|
exports.getDefaultPlugins = getDefaultPlugins;
|
8
8
|
const path_1 = require("path");
|
@@ -65,11 +65,6 @@ class LoadedNxPlugin {
|
|
65
65
|
}
|
66
66
|
}
|
67
67
|
exports.LoadedNxPlugin = LoadedNxPlugin;
|
68
|
-
// Short lived cache (cleared between cmd runs)
|
69
|
-
// holding resolved nx plugin objects.
|
70
|
-
// Allows loaded plugins to not be reloaded when
|
71
|
-
// referenced multiple times.
|
72
|
-
exports.nxPluginCache = new Map();
|
73
68
|
function isIsolationEnabled() {
|
74
69
|
// Explicitly enabled, regardless of further conditions
|
75
70
|
if (process.env.NX_ISOLATE_PLUGINS === 'true') {
|
@@ -86,11 +86,7 @@ export interface PluginCreateMetadataResult {
|
|
86
86
|
tx: string;
|
87
87
|
};
|
88
88
|
}
|
89
|
-
export
|
90
|
-
type: 'shutdown';
|
91
|
-
payload: {};
|
92
|
-
}
|
93
|
-
export type PluginWorkerMessage = PluginWorkerLoadMessage | PluginWorkerShutdownMessage | PluginWorkerCreateNodesMessage | PluginCreateDependenciesMessage | PluginCreateMetadataMessage;
|
89
|
+
export type PluginWorkerMessage = PluginWorkerLoadMessage | PluginWorkerCreateNodesMessage | PluginCreateDependenciesMessage | PluginCreateMetadataMessage;
|
94
90
|
export type PluginWorkerResult = PluginWorkerLoadResult | PluginWorkerCreateNodesResult | PluginCreateDependenciesResult | PluginCreateMetadataResult;
|
95
91
|
export declare function isPluginWorkerMessage(message: Serializable): message is PluginWorkerMessage;
|
96
92
|
export declare function isPluginWorkerResult(message: Serializable): message is PluginWorkerResult;
|
@@ -4,12 +4,8 @@ exports.loadRemoteNxPlugin = loadRemoteNxPlugin;
|
|
4
4
|
const child_process_1 = require("child_process");
|
5
5
|
const path = require("path");
|
6
6
|
const net_1 = require("net");
|
7
|
-
// TODO (@AgentEnder): After scoped verbose logging is implemented, re-add verbose logs here.
|
8
|
-
// import { logger } from '../../utils/logger';
|
9
|
-
const internal_api_1 = require("../internal-api");
|
10
7
|
const socket_utils_1 = require("../../../daemon/socket-utils");
|
11
8
|
const consume_messages_from_socket_1 = require("../../../utils/consume-messages-from-socket");
|
12
|
-
const exit_codes_1 = require("../../../utils/exit-codes");
|
13
9
|
const messaging_1 = require("./messaging");
|
14
10
|
const cleanupFunctions = new Set();
|
15
11
|
const pluginNames = new Map();
|
@@ -29,7 +25,6 @@ async function loadRemoteNxPlugin(plugin, root) {
|
|
29
25
|
const exitHandler = createWorkerExitHandler(worker, pendingPromises);
|
30
26
|
const cleanupFunction = () => {
|
31
27
|
worker.off('exit', exitHandler);
|
32
|
-
shutdownPluginWorker(socket);
|
33
28
|
socket.destroy();
|
34
29
|
nxPluginWorkerCache.delete(cacheKey);
|
35
30
|
};
|
@@ -55,9 +50,6 @@ async function loadRemoteNxPlugin(plugin, root) {
|
|
55
50
|
nxPluginWorkerCache.set(cacheKey, pluginPromise);
|
56
51
|
return [pluginPromise, cleanupFunction];
|
57
52
|
}
|
58
|
-
function shutdownPluginWorker(socket) {
|
59
|
-
(0, messaging_1.sendMessageOverSocket)(socket, { type: 'shutdown', payload: {} });
|
60
|
-
}
|
61
53
|
/**
|
62
54
|
* Creates a message handler for the given worker.
|
63
55
|
* @param worker Instance of plugin-worker
|
@@ -172,20 +164,6 @@ function createWorkerExitHandler(worker, pendingPromises) {
|
|
172
164
|
}
|
173
165
|
};
|
174
166
|
}
|
175
|
-
let cleanedUp = false;
|
176
|
-
const exitHandler = () => {
|
177
|
-
internal_api_1.nxPluginCache.clear();
|
178
|
-
for (const fn of cleanupFunctions) {
|
179
|
-
fn();
|
180
|
-
}
|
181
|
-
cleanedUp = true;
|
182
|
-
};
|
183
|
-
process.on('exit', exitHandler);
|
184
|
-
process.on('SIGINT', () => {
|
185
|
-
exitHandler();
|
186
|
-
process.exit((0, exit_codes_1.signalToCode)('SIGINT'));
|
187
|
-
});
|
188
|
-
process.on('SIGTERM', exitHandler);
|
189
167
|
function registerPendingPromise(tx, pending, callback, context) {
|
190
168
|
let resolver, rejector, timeout;
|
191
169
|
const promise = new Promise((res, rej) => {
|
@@ -49,21 +49,6 @@ const server = (0, net_1.createServer)((socket) => {
|
|
49
49
|
};
|
50
50
|
}
|
51
51
|
},
|
52
|
-
shutdown: async () => {
|
53
|
-
// Stops accepting new connections, but existing connections are
|
54
|
-
// not closed immediately.
|
55
|
-
server.close(() => {
|
56
|
-
try {
|
57
|
-
(0, fs_1.unlinkSync)(socketPath);
|
58
|
-
}
|
59
|
-
catch (e) { }
|
60
|
-
process.exit(0);
|
61
|
-
});
|
62
|
-
// Closes existing connection.
|
63
|
-
socket.end();
|
64
|
-
// Destroys the socket once it's fully closed.
|
65
|
-
socket.destroySoon();
|
66
|
-
},
|
67
52
|
createNodes: async ({ configFiles, context, tx }) => {
|
68
53
|
try {
|
69
54
|
const result = await plugin.createNodes[1](configFiles, context);
|
@@ -123,6 +108,22 @@ const server = (0, net_1.createServer)((socket) => {
|
|
123
108
|
},
|
124
109
|
});
|
125
110
|
}));
|
111
|
+
// There should only ever be one host -> worker connection
|
112
|
+
// since the worker is spawned per host process. As such,
|
113
|
+
// we can safely close the worker when the host disconnects.
|
114
|
+
socket.on('end', () => {
|
115
|
+
// Stops accepting new connections, but existing connections are
|
116
|
+
// not closed immediately.
|
117
|
+
server.close(() => {
|
118
|
+
try {
|
119
|
+
(0, fs_1.unlinkSync)(socketPath);
|
120
|
+
}
|
121
|
+
catch (e) { }
|
122
|
+
process.exit(0);
|
123
|
+
});
|
124
|
+
// Destroys the socket once it's fully closed.
|
125
|
+
socket.destroySoon();
|
126
|
+
});
|
126
127
|
});
|
127
128
|
server.listen(socketPath);
|
128
129
|
const exitHandler = (exitCode) => () => {
|
@@ -75,6 +75,10 @@ function detectAndSetInvalidProjectGlobValues(map, sourceName, desiredImplicitDe
|
|
75
75
|
const projectName = implicit.startsWith('!')
|
76
76
|
? implicit.substring(1)
|
77
77
|
: implicit;
|
78
|
+
// Do not error on cross-workspace implicit dependency references
|
79
|
+
if (projectName.startsWith('nx-cloud:')) {
|
80
|
+
return false;
|
81
|
+
}
|
78
82
|
return !(projectConfigurations[projectName] ||
|
79
83
|
(0, find_matching_projects_1.findMatchingProjects)([implicit], projects).length);
|
80
84
|
});
|
@@ -33,7 +33,8 @@ function findMatchingProjects(patterns = [], projects) {
|
|
33
33
|
patterns.unshift('*');
|
34
34
|
}
|
35
35
|
for (const stringPattern of patterns) {
|
36
|
-
|
36
|
+
// Do not waste time attempting to look up cross-workspace references which will never match
|
37
|
+
if (!stringPattern.length || stringPattern.startsWith('nx-cloud:')) {
|
37
38
|
continue;
|
38
39
|
}
|
39
40
|
const pattern = parseStringPattern(stringPattern, projects);
|