nx 20.4.0-canary.20250108-7f2693a → 20.4.0-canary.20250110-cbfc6fe
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/command-line/run/run-one.js +37 -13
- package/src/command-line/show/project.js +21 -3
- package/src/devkit-internals.d.ts +1 -1
- package/src/devkit-internals.js +2 -2
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/update-manager.js +13 -1
- package/src/project-graph/build-project-graph.d.ts +1 -1
- package/src/project-graph/plugins/get-plugins.d.ts +3 -3
- package/src/project-graph/plugins/get-plugins.js +112 -12
- package/src/project-graph/plugins/in-process-loader.d.ts +10 -0
- package/src/project-graph/plugins/in-process-loader.js +60 -0
- package/src/project-graph/plugins/index.d.ts +2 -1
- package/src/project-graph/plugins/index.js +4 -3
- package/src/project-graph/plugins/isolation/index.d.ts +2 -2
- package/src/project-graph/plugins/isolation/messaging.d.ts +1 -1
- package/src/project-graph/plugins/isolation/plugin-pool.d.ts +1 -1
- package/src/project-graph/plugins/isolation/plugin-pool.js +2 -2
- package/src/project-graph/plugins/isolation/plugin-worker.js +1 -2
- package/src/project-graph/plugins/load-resolved-plugin.d.ts +1 -1
- package/src/project-graph/plugins/load-resolved-plugin.js +2 -2
- package/src/project-graph/plugins/{internal-api.d.ts → loaded-nx-plugin.d.ts} +4 -10
- package/src/project-graph/plugins/loaded-nx-plugin.js +57 -0
- package/src/project-graph/plugins/resolve-plugin.d.ts +15 -0
- package/src/project-graph/plugins/{loader.js → resolve-plugin.js} +60 -149
- package/src/project-graph/plugins/transpiler.d.ts +8 -0
- package/src/project-graph/plugins/transpiler.js +47 -0
- package/src/project-graph/utils/project-configuration-utils.d.ts +1 -1
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +1 -1
- package/src/utils/find-matching-projects.js +11 -0
- package/src/utils/plugins/plugin-capabilities.js +2 -2
- package/src/project-graph/plugins/internal-api.js +0 -135
- package/src/project-graph/plugins/loader.d.ts +0 -30
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "20.4.0-canary.
|
3
|
+
"version": "20.4.0-canary.20250110-cbfc6fe",
|
4
4
|
"private": false,
|
5
5
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
6
6
|
"repository": {
|
@@ -82,16 +82,16 @@
|
|
82
82
|
}
|
83
83
|
},
|
84
84
|
"optionalDependencies": {
|
85
|
-
"@nx/nx-darwin-arm64": "20.4.0-canary.
|
86
|
-
"@nx/nx-darwin-x64": "20.4.0-canary.
|
87
|
-
"@nx/nx-freebsd-x64": "20.4.0-canary.
|
88
|
-
"@nx/nx-linux-arm-gnueabihf": "20.4.0-canary.
|
89
|
-
"@nx/nx-linux-arm64-gnu": "20.4.0-canary.
|
90
|
-
"@nx/nx-linux-arm64-musl": "20.4.0-canary.
|
91
|
-
"@nx/nx-linux-x64-gnu": "20.4.0-canary.
|
92
|
-
"@nx/nx-linux-x64-musl": "20.4.0-canary.
|
93
|
-
"@nx/nx-win32-arm64-msvc": "20.4.0-canary.
|
94
|
-
"@nx/nx-win32-x64-msvc": "20.4.0-canary.
|
85
|
+
"@nx/nx-darwin-arm64": "20.4.0-canary.20250110-cbfc6fe",
|
86
|
+
"@nx/nx-darwin-x64": "20.4.0-canary.20250110-cbfc6fe",
|
87
|
+
"@nx/nx-freebsd-x64": "20.4.0-canary.20250110-cbfc6fe",
|
88
|
+
"@nx/nx-linux-arm-gnueabihf": "20.4.0-canary.20250110-cbfc6fe",
|
89
|
+
"@nx/nx-linux-arm64-gnu": "20.4.0-canary.20250110-cbfc6fe",
|
90
|
+
"@nx/nx-linux-arm64-musl": "20.4.0-canary.20250110-cbfc6fe",
|
91
|
+
"@nx/nx-linux-x64-gnu": "20.4.0-canary.20250110-cbfc6fe",
|
92
|
+
"@nx/nx-linux-x64-musl": "20.4.0-canary.20250110-cbfc6fe",
|
93
|
+
"@nx/nx-win32-arm64-msvc": "20.4.0-canary.20250110-cbfc6fe",
|
94
|
+
"@nx/nx-win32-x64-msvc": "20.4.0-canary.20250110-cbfc6fe"
|
95
95
|
},
|
96
96
|
"nx-migrations": {
|
97
97
|
"migrations": "./migrations.json",
|
@@ -12,6 +12,7 @@ const output_1 = require("../../utils/output");
|
|
12
12
|
const configuration_1 = require("../../config/configuration");
|
13
13
|
const calculate_default_project_name_1 = require("../../config/calculate-default-project-name");
|
14
14
|
const graph_1 = require("../graph/graph");
|
15
|
+
const find_matching_projects_1 = require("../../utils/find-matching-projects");
|
15
16
|
async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
|
16
17
|
excludeTaskDependencies: args.excludeTaskDependencies,
|
17
18
|
loadDotEnvFiles: process.env.NX_LOAD_DOT_ENV_FILES !== 'false',
|
@@ -31,7 +32,7 @@ async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
|
|
31
32
|
process.exit(0);
|
32
33
|
}
|
33
34
|
await (0, connect_to_nx_cloud_1.connectToNxCloudIfExplicitlyAsked)(nxArgs);
|
34
|
-
const { projects } = getProjects(projectGraph, opts.project);
|
35
|
+
const { projects, projectName } = getProjects(projectGraph, opts.project);
|
35
36
|
if (nxArgs.graph) {
|
36
37
|
const projectNames = projects.map((t) => t.name);
|
37
38
|
const file = (0, command_line_utils_1.readGraphFileFromGraphArg)(nxArgs);
|
@@ -45,22 +46,45 @@ async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
|
|
45
46
|
}, projectNames);
|
46
47
|
}
|
47
48
|
else {
|
48
|
-
const status = await (0, run_command_1.runCommand)(projects, projectGraph, { nxJson }, nxArgs, overrides,
|
49
|
+
const status = await (0, run_command_1.runCommand)(projects, projectGraph, { nxJson }, nxArgs, overrides, projectName, extraTargetDependencies, extraOptions);
|
49
50
|
process.exit(status);
|
50
51
|
}
|
51
52
|
}
|
52
|
-
function getProjects(projectGraph,
|
53
|
-
if (
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
function getProjects(projectGraph, projectName) {
|
54
|
+
if (projectGraph.nodes[projectName]) {
|
55
|
+
return {
|
56
|
+
projectName: projectName,
|
57
|
+
projects: [projectGraph.nodes[projectName]],
|
58
|
+
projectsMap: {
|
59
|
+
[projectName]: projectGraph.nodes[projectName],
|
60
|
+
},
|
61
|
+
};
|
58
62
|
}
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
63
|
+
else {
|
64
|
+
const projects = (0, find_matching_projects_1.findMatchingProjects)([projectName], projectGraph.nodes);
|
65
|
+
if (projects.length === 1) {
|
66
|
+
const projectName = projects[0];
|
67
|
+
const project = projectGraph.nodes[projectName];
|
68
|
+
return {
|
69
|
+
projectName,
|
70
|
+
projects: [project],
|
71
|
+
projectsMap: {
|
72
|
+
[project.data.name]: project,
|
73
|
+
},
|
74
|
+
};
|
75
|
+
}
|
76
|
+
else if (projects.length > 1) {
|
77
|
+
output_1.output.error({
|
78
|
+
title: `Multiple projects matched:`,
|
79
|
+
bodyLines: projects.length > 100 ? [...projects.slice(0, 100), '...'] : projects,
|
80
|
+
});
|
81
|
+
process.exit(1);
|
82
|
+
}
|
83
|
+
}
|
84
|
+
output_1.output.error({
|
85
|
+
title: `Cannot find project '${projectName}'`,
|
86
|
+
});
|
87
|
+
process.exit(1);
|
64
88
|
}
|
65
89
|
const targetAliases = {
|
66
90
|
b: 'build',
|
@@ -4,14 +4,32 @@ exports.showProjectHandler = showProjectHandler;
|
|
4
4
|
const output_1 = require("../../utils/output");
|
5
5
|
const project_graph_1 = require("../../project-graph/project-graph");
|
6
6
|
const graph_1 = require("../graph/graph");
|
7
|
+
const find_matching_projects_1 = require("../../utils/find-matching-projects");
|
7
8
|
async function showProjectHandler(args) {
|
8
9
|
performance.mark('code-loading:end');
|
9
10
|
performance.measure('code-loading', 'init-local', 'code-loading:end');
|
10
11
|
const graph = await (0, project_graph_1.createProjectGraphAsync)();
|
11
|
-
|
12
|
+
let node = graph.nodes[args.projectName];
|
12
13
|
if (!node) {
|
13
|
-
|
14
|
-
|
14
|
+
const projects = (0, find_matching_projects_1.findMatchingProjects)([args.projectName], graph.nodes);
|
15
|
+
if (projects.length === 1) {
|
16
|
+
const projectName = projects[0];
|
17
|
+
node = graph.nodes[projectName];
|
18
|
+
}
|
19
|
+
else if (projects.length > 1) {
|
20
|
+
output_1.output.error({
|
21
|
+
title: `Multiple projects matched:`,
|
22
|
+
bodyLines: projects.length > 100 ? [...projects.slice(0, 100), '...'] : projects,
|
23
|
+
});
|
24
|
+
console.log(`Multiple projects matched:\n ${(projects.length > 100
|
25
|
+
? [...projects.slice(0, 100), '...']
|
26
|
+
: projects).join(' \n')}`);
|
27
|
+
process.exit(1);
|
28
|
+
}
|
29
|
+
else {
|
30
|
+
console.log(`Could not find project ${args.projectName}`);
|
31
|
+
process.exit(1);
|
32
|
+
}
|
15
33
|
}
|
16
34
|
if (args.json) {
|
17
35
|
console.log(JSON.stringify(node.data));
|
@@ -20,7 +20,7 @@ export { hashObject } from './hasher/file-hasher';
|
|
20
20
|
export { hashWithWorkspaceContext } from './utils/workspace-context';
|
21
21
|
export { createProjectRootMappingsFromProjectConfigurations, findProjectForPath, } from './project-graph/utils/find-project-for-path';
|
22
22
|
export { retrieveProjectConfigurations } from './project-graph/utils/retrieve-workspace-files';
|
23
|
-
export { LoadedNxPlugin } from './project-graph/plugins/
|
23
|
+
export { LoadedNxPlugin } from './project-graph/plugins/loaded-nx-plugin';
|
24
24
|
export * from './project-graph/error-types';
|
25
25
|
export { registerTsProject } from './plugins/js/utils/register';
|
26
26
|
export { interpolate } from './tasks-runner/utils';
|
package/src/devkit-internals.js
CHANGED
@@ -43,8 +43,8 @@ Object.defineProperty(exports, "createProjectRootMappingsFromProjectConfiguratio
|
|
43
43
|
Object.defineProperty(exports, "findProjectForPath", { enumerable: true, get: function () { return find_project_for_path_1.findProjectForPath; } });
|
44
44
|
var retrieve_workspace_files_2 = require("./project-graph/utils/retrieve-workspace-files");
|
45
45
|
Object.defineProperty(exports, "retrieveProjectConfigurations", { enumerable: true, get: function () { return retrieve_workspace_files_2.retrieveProjectConfigurations; } });
|
46
|
-
var
|
47
|
-
Object.defineProperty(exports, "LoadedNxPlugin", { enumerable: true, get: function () { return
|
46
|
+
var loaded_nx_plugin_1 = require("./project-graph/plugins/loaded-nx-plugin");
|
47
|
+
Object.defineProperty(exports, "LoadedNxPlugin", { enumerable: true, get: function () { return loaded_nx_plugin_1.LoadedNxPlugin; } });
|
48
48
|
tslib_1.__exportStar(require("./project-graph/error-types"), exports);
|
49
49
|
var register_1 = require("./plugins/js/utils/register");
|
50
50
|
Object.defineProperty(exports, "registerTsProject", { enumerable: true, get: function () { return register_1.registerTsProject; } });
|
Binary file
|
@@ -10,6 +10,7 @@ const debug_logger_1 = require("./debug-logger");
|
|
10
10
|
const tar = require("tar-stream");
|
11
11
|
const cache_directory_1 = require("../utils/cache-directory");
|
12
12
|
const crypto_1 = require("crypto");
|
13
|
+
const workspace_root_1 = require("../utils/workspace-root");
|
13
14
|
class NxCloudEnterpriseOutdatedError extends Error {
|
14
15
|
constructor(url) {
|
15
16
|
super(`Nx Cloud instance hosted at ${url} is outdated`);
|
@@ -83,7 +84,18 @@ async function verifyOrUpdateNxCloudClient(options) {
|
|
83
84
|
nxCloudClient: require(currentBundle.fullPath),
|
84
85
|
};
|
85
86
|
}
|
86
|
-
|
87
|
+
function getBundleInstallDefaultLocation() {
|
88
|
+
const legacyPath = (0, path_1.join)(workspace_root_1.workspaceRoot, 'node_modules', '.cache', 'nx', 'cloud');
|
89
|
+
// this legacy path is used when the nx-cloud package is installed.
|
90
|
+
// make sure to reuse it so that we don't `require` different the client bundles
|
91
|
+
if ((0, fs_1.existsSync)(legacyPath)) {
|
92
|
+
return legacyPath;
|
93
|
+
}
|
94
|
+
else {
|
95
|
+
return (0, path_1.join)(cache_directory_1.cacheDir, 'cloud');
|
96
|
+
}
|
97
|
+
}
|
98
|
+
const runnerBundleInstallDirectory = getBundleInstallDefaultLocation();
|
87
99
|
function getLatestInstalledRunnerBundle() {
|
88
100
|
if (!(0, fs_1.existsSync)(runnerBundleInstallDirectory)) {
|
89
101
|
(0, fs_1.mkdirSync)(runnerBundleInstallDirectory, { recursive: true });
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { FileData } from './file-utils';
|
2
2
|
import { FileMapCache } from './nx-deps-cache';
|
3
|
-
import { LoadedNxPlugin } from './plugins/
|
3
|
+
import type { LoadedNxPlugin } from './plugins/loaded-nx-plugin';
|
4
4
|
import { CreateMetadataContext } from './plugins';
|
5
5
|
import { FileMap, ProjectGraph, ProjectGraphExternalNode } from '../config/project-graph';
|
6
6
|
import { ProjectConfiguration } from '../config/workspace-json-project-json';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { LoadedNxPlugin } from './
|
2
|
-
export declare function getPlugins(): Promise<LoadedNxPlugin[]>;
|
3
|
-
export declare function getOnlyDefaultPlugins(): Promise<LoadedNxPlugin[]>;
|
1
|
+
import type { LoadedNxPlugin } from './loaded-nx-plugin';
|
2
|
+
export declare function getPlugins(root?: string): Promise<LoadedNxPlugin[]>;
|
3
|
+
export declare function getOnlyDefaultPlugins(root?: string): Promise<LoadedNxPlugin[]>;
|
4
4
|
export declare function cleanupPlugins(): void;
|
@@ -3,16 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getPlugins = getPlugins;
|
4
4
|
exports.getOnlyDefaultPlugins = getOnlyDefaultPlugins;
|
5
5
|
exports.cleanupPlugins = cleanupPlugins;
|
6
|
-
const
|
6
|
+
const node_path_1 = require("node:path");
|
7
|
+
const angular_json_1 = require("../../adapter/angular-json");
|
7
8
|
const nx_json_1 = require("../../config/nx-json");
|
8
|
-
const
|
9
|
+
const file_hasher_1 = require("../../hasher/file-hasher");
|
10
|
+
const native_1 = require("../../native");
|
9
11
|
const workspace_root_1 = require("../../utils/workspace-root");
|
12
|
+
const isolation_1 = require("./isolation");
|
13
|
+
const in_process_loader_1 = require("./in-process-loader");
|
14
|
+
const transpiler_1 = require("./transpiler");
|
15
|
+
/**
|
16
|
+
* Stuff for specified NX Plugins.
|
17
|
+
*/
|
10
18
|
let currentPluginsConfigurationHash;
|
11
19
|
let loadedPlugins;
|
12
20
|
let pendingPluginsPromise;
|
13
21
|
let cleanup;
|
14
|
-
async function getPlugins() {
|
15
|
-
const pluginsConfiguration = (0, nx_json_1.readNxJson)().plugins ?? [];
|
22
|
+
async function getPlugins(root = workspace_root_1.workspaceRoot) {
|
23
|
+
const pluginsConfiguration = (0, nx_json_1.readNxJson)(root).plugins ?? [];
|
16
24
|
const pluginsConfigurationHash = (0, file_hasher_1.hashObject)(pluginsConfiguration);
|
17
25
|
// If the plugins configuration has not changed, reuse the current plugins
|
18
26
|
if (loadedPlugins &&
|
@@ -24,17 +32,23 @@ async function getPlugins() {
|
|
24
32
|
pendingPluginsPromise = undefined;
|
25
33
|
cleanup();
|
26
34
|
}
|
27
|
-
pendingPluginsPromise ??= (
|
35
|
+
pendingPluginsPromise ??= loadSpecifiedNxPlugins(pluginsConfiguration, root);
|
28
36
|
currentPluginsConfigurationHash = pluginsConfigurationHash;
|
29
|
-
const [result, cleanupFn] = await
|
37
|
+
const [[result, cleanupFn], defaultPlugins] = await Promise.all([
|
38
|
+
pendingPluginsPromise,
|
39
|
+
getOnlyDefaultPlugins(root),
|
40
|
+
]);
|
30
41
|
cleanup = cleanupFn;
|
31
|
-
loadedPlugins = result;
|
32
|
-
return
|
42
|
+
loadedPlugins = result.concat(defaultPlugins);
|
43
|
+
return loadedPlugins;
|
33
44
|
}
|
45
|
+
/**
|
46
|
+
* Stuff for default NX Plugins.
|
47
|
+
*/
|
34
48
|
let loadedDefaultPlugins;
|
35
49
|
let cleanupDefaultPlugins;
|
36
50
|
let pendingDefaultPluginPromise;
|
37
|
-
async function getOnlyDefaultPlugins() {
|
51
|
+
async function getOnlyDefaultPlugins(root = workspace_root_1.workspaceRoot) {
|
38
52
|
// If the plugins configuration has not changed, reuse the current plugins
|
39
53
|
if (loadedDefaultPlugins) {
|
40
54
|
return loadedPlugins;
|
@@ -44,7 +58,7 @@ async function getOnlyDefaultPlugins() {
|
|
44
58
|
pendingDefaultPluginPromise = undefined;
|
45
59
|
cleanupDefaultPlugins();
|
46
60
|
}
|
47
|
-
pendingDefaultPluginPromise ??= (
|
61
|
+
pendingDefaultPluginPromise ??= loadDefaultNxPlugins(workspace_root_1.workspaceRoot);
|
48
62
|
const [result, cleanupFn] = await pendingDefaultPluginPromise;
|
49
63
|
cleanupDefaultPlugins = cleanupFn;
|
50
64
|
loadedPlugins = result;
|
@@ -53,6 +67,92 @@ async function getOnlyDefaultPlugins() {
|
|
53
67
|
function cleanupPlugins() {
|
54
68
|
pendingPluginsPromise = undefined;
|
55
69
|
pendingDefaultPluginPromise = undefined;
|
56
|
-
cleanup();
|
57
|
-
cleanupDefaultPlugins();
|
70
|
+
cleanup?.();
|
71
|
+
cleanupDefaultPlugins?.();
|
72
|
+
}
|
73
|
+
/**
|
74
|
+
* Stuff for generic loading
|
75
|
+
*/
|
76
|
+
function isIsolationEnabled() {
|
77
|
+
// Explicitly enabled, regardless of further conditions
|
78
|
+
if (process.env.NX_ISOLATE_PLUGINS === 'true') {
|
79
|
+
return true;
|
80
|
+
}
|
81
|
+
if (
|
82
|
+
// Explicitly disabled
|
83
|
+
process.env.NX_ISOLATE_PLUGINS === 'false' ||
|
84
|
+
// Isolation is disabled on WASM builds currently.
|
85
|
+
native_1.IS_WASM) {
|
86
|
+
return false;
|
87
|
+
}
|
88
|
+
// Default value
|
89
|
+
return true;
|
90
|
+
}
|
91
|
+
const loadingMethod = isIsolationEnabled()
|
92
|
+
? isolation_1.loadNxPluginInIsolation
|
93
|
+
: in_process_loader_1.loadNxPlugin;
|
94
|
+
async function loadDefaultNxPlugins(root = workspace_root_1.workspaceRoot) {
|
95
|
+
performance.mark('loadDefaultNxPlugins:start');
|
96
|
+
const plugins = getDefaultPlugins(root);
|
97
|
+
const cleanupFunctions = [];
|
98
|
+
const ret = [
|
99
|
+
await Promise.all(plugins.map(async (plugin) => {
|
100
|
+
performance.mark(`Load Nx Plugin: ${plugin} - start`);
|
101
|
+
const [loadedPluginPromise, cleanup] = await loadingMethod(plugin, root);
|
102
|
+
cleanupFunctions.push(cleanup);
|
103
|
+
const res = await loadedPluginPromise;
|
104
|
+
performance.mark(`Load Nx Plugin: ${plugin} - end`);
|
105
|
+
performance.measure(`Load Nx Plugin: ${plugin}`, `Load Nx Plugin: ${plugin} - start`, `Load Nx Plugin: ${plugin} - end`);
|
106
|
+
return res;
|
107
|
+
})),
|
108
|
+
() => {
|
109
|
+
for (const fn of cleanupFunctions) {
|
110
|
+
fn();
|
111
|
+
}
|
112
|
+
if ((0, transpiler_1.pluginTranspilerIsRegistered)()) {
|
113
|
+
(0, transpiler_1.cleanupPluginTSTranspiler)();
|
114
|
+
}
|
115
|
+
},
|
116
|
+
];
|
117
|
+
performance.mark('loadDefaultNxPlugins:end');
|
118
|
+
performance.measure('loadDefaultNxPlugins', 'loadDefaultNxPlugins:start', 'loadDefaultNxPlugins:end');
|
119
|
+
return ret;
|
120
|
+
}
|
121
|
+
async function loadSpecifiedNxPlugins(plugins, root = workspace_root_1.workspaceRoot) {
|
122
|
+
performance.mark('loadSpecifiedNxPlugins:start');
|
123
|
+
plugins ??= [];
|
124
|
+
const cleanupFunctions = [];
|
125
|
+
const ret = [
|
126
|
+
await Promise.all(plugins.map(async (plugin) => {
|
127
|
+
const pluginPath = typeof plugin === 'string' ? plugin : plugin.plugin;
|
128
|
+
performance.mark(`Load Nx Plugin: ${pluginPath} - start`);
|
129
|
+
const [loadedPluginPromise, cleanup] = await loadingMethod(plugin, root);
|
130
|
+
cleanupFunctions.push(cleanup);
|
131
|
+
const res = await loadedPluginPromise;
|
132
|
+
performance.mark(`Load Nx Plugin: ${pluginPath} - end`);
|
133
|
+
performance.measure(`Load Nx Plugin: ${pluginPath}`, `Load Nx Plugin: ${pluginPath} - start`, `Load Nx Plugin: ${pluginPath} - end`);
|
134
|
+
return res;
|
135
|
+
})),
|
136
|
+
() => {
|
137
|
+
for (const fn of cleanupFunctions) {
|
138
|
+
fn();
|
139
|
+
}
|
140
|
+
if ((0, transpiler_1.pluginTranspilerIsRegistered)()) {
|
141
|
+
(0, transpiler_1.cleanupPluginTSTranspiler)();
|
142
|
+
}
|
143
|
+
},
|
144
|
+
];
|
145
|
+
performance.mark('loadSpecifiedNxPlugins:end');
|
146
|
+
performance.measure('loadSpecifiedNxPlugins', 'loadSpecifiedNxPlugins:start', 'loadSpecifiedNxPlugins:end');
|
147
|
+
return ret;
|
148
|
+
}
|
149
|
+
function getDefaultPlugins(root) {
|
150
|
+
return [
|
151
|
+
(0, node_path_1.join)(__dirname, '../../plugins/js'),
|
152
|
+
...((0, angular_json_1.shouldMergeAngularProjects)(root, false)
|
153
|
+
? [(0, node_path_1.join)(__dirname, '../../adapter/angular-json')]
|
154
|
+
: []),
|
155
|
+
(0, node_path_1.join)(__dirname, '../../plugins/package-json'),
|
156
|
+
(0, node_path_1.join)(__dirname, '../../plugins/project-json/build-nodes/project-json'),
|
157
|
+
];
|
58
158
|
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { ProjectConfiguration } from '../../config/workspace-json-project-json';
|
2
|
+
import { PackageJson } from '../../utils/package-json';
|
3
|
+
import type { PluginConfiguration } from '../../config/nx-json';
|
4
|
+
import type { LoadedNxPlugin } from './loaded-nx-plugin';
|
5
|
+
export declare function readPluginPackageJson(pluginName: string, projects: Record<string, ProjectConfiguration>, paths?: string[]): {
|
6
|
+
path: string;
|
7
|
+
json: PackageJson;
|
8
|
+
};
|
9
|
+
export declare function loadNxPlugin(plugin: PluginConfiguration, root: string): readonly [Promise<LoadedNxPlugin>, () => void];
|
10
|
+
export declare function loadNxPluginAsync(pluginConfiguration: PluginConfiguration, paths: string[], root: string): Promise<LoadedNxPlugin>;
|
@@ -0,0 +1,60 @@
|
|
1
|
+
"use strict";
|
2
|
+
// This file contains methods and utilities that should **only** be used by the plugin worker.
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.readPluginPackageJson = readPluginPackageJson;
|
5
|
+
exports.loadNxPlugin = loadNxPlugin;
|
6
|
+
exports.loadNxPluginAsync = loadNxPluginAsync;
|
7
|
+
const installation_directory_1 = require("../../utils/installation-directory");
|
8
|
+
const package_json_1 = require("../../utils/package-json");
|
9
|
+
const fileutils_1 = require("../../utils/fileutils");
|
10
|
+
const error_types_1 = require("../error-types");
|
11
|
+
const path = require("node:path/posix");
|
12
|
+
const load_resolved_plugin_1 = require("./load-resolved-plugin");
|
13
|
+
const resolve_plugin_1 = require("./resolve-plugin");
|
14
|
+
const transpiler_1 = require("./transpiler");
|
15
|
+
function readPluginPackageJson(pluginName, projects, paths = (0, installation_directory_1.getNxRequirePaths)()) {
|
16
|
+
try {
|
17
|
+
const result = (0, package_json_1.readModulePackageJsonWithoutFallbacks)(pluginName, paths);
|
18
|
+
return {
|
19
|
+
json: result.packageJson,
|
20
|
+
path: result.path,
|
21
|
+
};
|
22
|
+
}
|
23
|
+
catch (e) {
|
24
|
+
if (e.code === 'MODULE_NOT_FOUND') {
|
25
|
+
const localPluginPath = (0, resolve_plugin_1.resolveLocalNxPlugin)(pluginName, projects);
|
26
|
+
if (localPluginPath) {
|
27
|
+
const localPluginPackageJson = path.join(localPluginPath.path, 'package.json');
|
28
|
+
if ((0, transpiler_1.pluginTranspilerIsRegistered)()) {
|
29
|
+
(0, transpiler_1.registerPluginTSTranspiler)();
|
30
|
+
}
|
31
|
+
return {
|
32
|
+
path: localPluginPackageJson,
|
33
|
+
json: (0, fileutils_1.readJsonFile)(localPluginPackageJson),
|
34
|
+
};
|
35
|
+
}
|
36
|
+
}
|
37
|
+
throw e;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
function loadNxPlugin(plugin, root) {
|
41
|
+
return [
|
42
|
+
loadNxPluginAsync(plugin, (0, installation_directory_1.getNxRequirePaths)(root), root),
|
43
|
+
() => { },
|
44
|
+
];
|
45
|
+
}
|
46
|
+
async function loadNxPluginAsync(pluginConfiguration, paths, root) {
|
47
|
+
const moduleName = typeof pluginConfiguration === 'string'
|
48
|
+
? pluginConfiguration
|
49
|
+
: pluginConfiguration.plugin;
|
50
|
+
try {
|
51
|
+
const { pluginPath, name, shouldRegisterTSTranspiler } = await (0, resolve_plugin_1.resolveNxPlugin)(moduleName, root, paths);
|
52
|
+
if (shouldRegisterTSTranspiler) {
|
53
|
+
(0, transpiler_1.registerPluginTSTranspiler)();
|
54
|
+
}
|
55
|
+
return (0, load_resolved_plugin_1.loadResolvedNxPluginAsync)(pluginConfiguration, pluginPath, name);
|
56
|
+
}
|
57
|
+
catch (e) {
|
58
|
+
throw new error_types_1.LoadPluginError(moduleName, e);
|
59
|
+
}
|
60
|
+
}
|
@@ -1,3 +1,4 @@
|
|
1
1
|
export * from './public-api';
|
2
|
-
export { readPluginPackageJson
|
2
|
+
export { readPluginPackageJson } from './in-process-loader';
|
3
|
+
export { registerPluginTSTranspiler } from './transpiler';
|
3
4
|
export { createNodesFromFiles } from './utils';
|
@@ -4,8 +4,9 @@ exports.createNodesFromFiles = exports.registerPluginTSTranspiler = exports.read
|
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
tslib_1.__exportStar(require("./public-api"), exports);
|
6
6
|
// export * from './get-plugins';
|
7
|
-
var
|
8
|
-
Object.defineProperty(exports, "readPluginPackageJson", { enumerable: true, get: function () { return
|
9
|
-
|
7
|
+
var in_process_loader_1 = require("./in-process-loader");
|
8
|
+
Object.defineProperty(exports, "readPluginPackageJson", { enumerable: true, get: function () { return in_process_loader_1.readPluginPackageJson; } });
|
9
|
+
var transpiler_1 = require("./transpiler");
|
10
|
+
Object.defineProperty(exports, "registerPluginTSTranspiler", { enumerable: true, get: function () { return transpiler_1.registerPluginTSTranspiler; } });
|
10
11
|
var utils_1 = require("./utils");
|
11
12
|
Object.defineProperty(exports, "createNodesFromFiles", { enumerable: true, get: function () { return utils_1.createNodesFromFiles; } });
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { PluginConfiguration } from '../../../config/nx-json';
|
2
|
-
import { LoadedNxPlugin } from '../
|
1
|
+
import type { PluginConfiguration } from '../../../config/nx-json';
|
2
|
+
import type { LoadedNxPlugin } from '../loaded-nx-plugin';
|
3
3
|
export declare function loadNxPluginInIsolation(plugin: PluginConfiguration, root?: string): Promise<readonly [Promise<LoadedNxPlugin>, () => void]>;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { ProjectGraph } from '../../../config/project-graph';
|
2
2
|
import { PluginConfiguration } from '../../../config/nx-json';
|
3
3
|
import { CreateDependenciesContext, CreateMetadataContext, CreateNodesContextV2 } from '../public-api';
|
4
|
-
import { LoadedNxPlugin } from '../
|
4
|
+
import type { LoadedNxPlugin } from '../loaded-nx-plugin';
|
5
5
|
import { Serializable } from 'child_process';
|
6
6
|
import { Socket } from 'net';
|
7
7
|
export interface PluginWorkerLoadMessage {
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { PluginConfiguration } from '../../../config/nx-json';
|
2
|
-
import { LoadedNxPlugin } from '../
|
2
|
+
import type { LoadedNxPlugin } from '../loaded-nx-plugin';
|
3
3
|
export declare function loadRemoteNxPlugin(plugin: PluginConfiguration, root: string): Promise<[Promise<LoadedNxPlugin>, () => void]>;
|
@@ -8,7 +8,7 @@ const socket_utils_1 = require("../../../daemon/socket-utils");
|
|
8
8
|
const consume_messages_from_socket_1 = require("../../../utils/consume-messages-from-socket");
|
9
9
|
const messaging_1 = require("./messaging");
|
10
10
|
const installation_directory_1 = require("../../../utils/installation-directory");
|
11
|
-
const
|
11
|
+
const resolve_plugin_1 = require("../resolve-plugin");
|
12
12
|
const cleanupFunctions = new Set();
|
13
13
|
const pluginNames = new Map();
|
14
14
|
const PLUGIN_TIMEOUT_HINT_TEXT = 'As a last resort, you can set NX_PLUGIN_NO_TIMEOUTS=true to bypass this timeout.';
|
@@ -31,7 +31,7 @@ async function loadRemoteNxPlugin(plugin, root) {
|
|
31
31
|
return [nxPluginWorkerCache.get(cacheKey), () => { }];
|
32
32
|
}
|
33
33
|
const moduleName = typeof plugin === 'string' ? plugin : plugin.plugin;
|
34
|
-
const { name, pluginPath, shouldRegisterTSTranspiler } = await (0,
|
34
|
+
const { name, pluginPath, shouldRegisterTSTranspiler } = await (0, resolve_plugin_1.resolveNxPlugin)(moduleName, root, (0, installation_directory_1.getNxRequirePaths)(root));
|
35
35
|
const { worker, socket } = await startPluginWorker();
|
36
36
|
const pendingPromises = new Map();
|
37
37
|
const exitHandler = createWorkerExitHandler(worker, pendingPromises);
|
@@ -5,7 +5,6 @@ const serializable_error_1 = require("../../../utils/serializable-error");
|
|
5
5
|
const consume_messages_from_socket_1 = require("../../../utils/consume-messages-from-socket");
|
6
6
|
const net_1 = require("net");
|
7
7
|
const fs_1 = require("fs");
|
8
|
-
const loader_1 = require("../loader");
|
9
8
|
if (process.env.NX_PERF_LOGGING === 'true') {
|
10
9
|
require('../../../utils/perf-logging');
|
11
10
|
}
|
@@ -38,7 +37,7 @@ const server = (0, net_1.createServer)((socket) => {
|
|
38
37
|
// Register the ts-transpiler if we are pointing to a
|
39
38
|
// plain ts file that's not part of a plugin project
|
40
39
|
if (shouldRegisterTSTranspiler) {
|
41
|
-
(
|
40
|
+
require('../transpiler').registerPluginTSTranspiler();
|
42
41
|
}
|
43
42
|
plugin = await loadResolvedNxPluginAsync(pluginConfiguration, pluginPath, name);
|
44
43
|
return {
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import type { PluginConfiguration } from '../../config/nx-json';
|
2
|
-
import { LoadedNxPlugin } from './
|
2
|
+
import { LoadedNxPlugin } from './loaded-nx-plugin';
|
3
3
|
export declare function loadResolvedNxPluginAsync(pluginConfiguration: PluginConfiguration, pluginPath: string, name: string): Promise<LoadedNxPlugin>;
|
@@ -1,11 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.loadResolvedNxPluginAsync = loadResolvedNxPluginAsync;
|
4
|
-
const
|
4
|
+
const loaded_nx_plugin_1 = require("./loaded-nx-plugin");
|
5
5
|
async function loadResolvedNxPluginAsync(pluginConfiguration, pluginPath, name) {
|
6
6
|
const plugin = await importPluginModule(pluginPath);
|
7
7
|
plugin.name ??= name;
|
8
|
-
return new
|
8
|
+
return new loaded_nx_plugin_1.LoadedNxPlugin(plugin, pluginConfiguration);
|
9
9
|
}
|
10
10
|
async function importPluginModule(pluginPath) {
|
11
11
|
const m = await Promise.resolve(`${pluginPath}`).then(s => require(s));
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
1
|
+
import type { ProjectGraph } from '../../config/project-graph';
|
2
|
+
import type { PluginConfiguration } from '../../config/nx-json';
|
3
|
+
import type { RawProjectGraphDependency } from '../project-graph-builder';
|
4
|
+
import type { CreateDependenciesContext, CreateMetadataContext, CreateNodesContextV2, CreateNodesResult, NxPluginV2, ProjectsMetadata } from './public-api';
|
5
5
|
export declare class LoadedNxPlugin {
|
6
6
|
readonly name: string;
|
7
7
|
readonly createNodes?: [
|
@@ -19,9 +19,3 @@ export type CreateNodesResultWithContext = CreateNodesResult & {
|
|
19
19
|
file: string;
|
20
20
|
pluginName: string;
|
21
21
|
};
|
22
|
-
/**
|
23
|
-
* Use `getPlugins` instead.
|
24
|
-
* @deprecated Do not use this. Use `getPlugins` instead.
|
25
|
-
*/
|
26
|
-
export declare function loadNxPlugins(plugins: PluginConfiguration[], root?: string): Promise<readonly [LoadedNxPlugin[], () => void]>;
|
27
|
-
export declare function getDefaultPlugins(root: string): Promise<string[]>;
|
@@ -0,0 +1,57 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.LoadedNxPlugin = void 0;
|
4
|
+
const error_types_1 = require("../error-types");
|
5
|
+
const utils_1 = require("./utils");
|
6
|
+
class LoadedNxPlugin {
|
7
|
+
constructor(plugin, pluginDefinition) {
|
8
|
+
this.name = plugin.name;
|
9
|
+
if (typeof pluginDefinition !== 'string') {
|
10
|
+
this.options = pluginDefinition.options;
|
11
|
+
this.include = pluginDefinition.include;
|
12
|
+
this.exclude = pluginDefinition.exclude;
|
13
|
+
}
|
14
|
+
if (plugin.createNodes && !plugin.createNodesV2) {
|
15
|
+
this.createNodes = [
|
16
|
+
plugin.createNodes[0],
|
17
|
+
(configFiles, context) => (0, utils_1.createNodesFromFiles)(plugin.createNodes[1], configFiles, this.options, context).then((results) => results.map((r) => [this.name, r[0], r[1]])),
|
18
|
+
];
|
19
|
+
}
|
20
|
+
if (plugin.createNodesV2) {
|
21
|
+
this.createNodes = [
|
22
|
+
plugin.createNodesV2[0],
|
23
|
+
async (configFiles, context) => {
|
24
|
+
const result = await plugin.createNodesV2[1](configFiles, this.options, context);
|
25
|
+
return result.map((r) => [this.name, r[0], r[1]]);
|
26
|
+
},
|
27
|
+
];
|
28
|
+
}
|
29
|
+
if (this.createNodes) {
|
30
|
+
const inner = this.createNodes[1];
|
31
|
+
this.createNodes[1] = async (...args) => {
|
32
|
+
performance.mark(`${plugin.name}:createNodes - start`);
|
33
|
+
try {
|
34
|
+
return await inner(...args);
|
35
|
+
}
|
36
|
+
catch (e) {
|
37
|
+
if ((0, error_types_1.isAggregateCreateNodesError)(e)) {
|
38
|
+
throw e;
|
39
|
+
}
|
40
|
+
// The underlying plugin errored out. We can't know any partial results.
|
41
|
+
throw new error_types_1.AggregateCreateNodesError([[null, e]], []);
|
42
|
+
}
|
43
|
+
finally {
|
44
|
+
performance.mark(`${plugin.name}:createNodes - end`);
|
45
|
+
performance.measure(`${plugin.name}:createNodes`, `${plugin.name}:createNodes - start`, `${plugin.name}:createNodes - end`);
|
46
|
+
}
|
47
|
+
};
|
48
|
+
}
|
49
|
+
if (plugin.createDependencies) {
|
50
|
+
this.createDependencies = async (context) => plugin.createDependencies(this.options, context);
|
51
|
+
}
|
52
|
+
if (plugin.createMetadata) {
|
53
|
+
this.createMetadata = async (graph, context) => plugin.createMetadata(graph, this.options, context);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
exports.LoadedNxPlugin = LoadedNxPlugin;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { ProjectConfiguration } from '../../config/workspace-json-project-json';
|
2
|
+
export declare function resolveNxPlugin(moduleName: string, root: string, paths: string[]): Promise<{
|
3
|
+
pluginPath: string;
|
4
|
+
name: any;
|
5
|
+
shouldRegisterTSTranspiler: boolean;
|
6
|
+
}>;
|
7
|
+
export declare function resolveLocalNxPlugin(importPath: string, projects: Record<string, ProjectConfiguration>, root?: string): {
|
8
|
+
path: string;
|
9
|
+
projectConfig: ProjectConfiguration;
|
10
|
+
} | null;
|
11
|
+
export declare function getPluginPathAndName(moduleName: string, paths: string[], projects: Record<string, ProjectConfiguration>, root: string): {
|
12
|
+
pluginPath: string;
|
13
|
+
name: any;
|
14
|
+
shouldRegisterTSTranspiler: boolean;
|
15
|
+
};
|
@@ -1,135 +1,29 @@
|
|
1
1
|
"use strict";
|
2
|
-
// This file contains methods and utilities that should **only** be used by the plugin worker.
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.
|
5
|
-
exports.readPluginPackageJson = readPluginPackageJson;
|
3
|
+
exports.resolveNxPlugin = resolveNxPlugin;
|
6
4
|
exports.resolveLocalNxPlugin = resolveLocalNxPlugin;
|
7
|
-
exports.registerPluginTSTranspiler = registerPluginTSTranspiler;
|
8
5
|
exports.getPluginPathAndName = getPluginPathAndName;
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
const posix_1 = require("node:path/posix");
|
13
|
-
const installation_directory_1 = require("../../utils/installation-directory");
|
14
|
-
const package_json_1 = require("../../utils/package-json");
|
6
|
+
const path = require("node:path");
|
7
|
+
const node_fs_1 = require("node:fs");
|
8
|
+
const packages_1 = require("../../plugins/js/utils/packages");
|
15
9
|
const fileutils_1 = require("../../utils/fileutils");
|
10
|
+
const logger_1 = require("../../utils/logger");
|
11
|
+
const path_1 = require("../../utils/path");
|
16
12
|
const workspace_root_1 = require("../../utils/workspace-root");
|
17
|
-
const node_fs_1 = require("node:fs");
|
18
|
-
const register_1 = require("../../plugins/js/utils/register");
|
19
13
|
const find_project_for_path_1 = require("../utils/find-project-for-path");
|
20
|
-
const path_1 = require("../../utils/path");
|
21
|
-
const logger_1 = require("../../utils/logger");
|
22
|
-
const node_path_1 = require("node:path");
|
23
14
|
const retrieve_workspace_files_1 = require("../utils/retrieve-workspace-files");
|
24
|
-
|
25
|
-
|
26
|
-
const typescript_1 = require("../../plugins/js/utils/typescript");
|
27
|
-
const load_resolved_plugin_1 = require("./load-resolved-plugin");
|
28
|
-
const packages_1 = require("../../plugins/js/utils/packages");
|
29
|
-
function readPluginPackageJson(pluginName, projects, paths = (0, installation_directory_1.getNxRequirePaths)()) {
|
15
|
+
let projectsWithoutInference;
|
16
|
+
async function resolveNxPlugin(moduleName, root, paths) {
|
30
17
|
try {
|
31
|
-
|
32
|
-
return {
|
33
|
-
json: result.packageJson,
|
34
|
-
path: result.path,
|
35
|
-
};
|
36
|
-
}
|
37
|
-
catch (e) {
|
38
|
-
if (e.code === 'MODULE_NOT_FOUND') {
|
39
|
-
const localPluginPath = resolveLocalNxPlugin(pluginName, projects);
|
40
|
-
if (localPluginPath) {
|
41
|
-
const localPluginPackageJson = path.join(localPluginPath.path, 'package.json');
|
42
|
-
if (!exports.unregisterPluginTSTranspiler) {
|
43
|
-
registerPluginTSTranspiler();
|
44
|
-
}
|
45
|
-
return {
|
46
|
-
path: localPluginPackageJson,
|
47
|
-
json: (0, fileutils_1.readJsonFile)(localPluginPackageJson),
|
48
|
-
};
|
49
|
-
}
|
50
|
-
}
|
51
|
-
throw e;
|
52
|
-
}
|
53
|
-
}
|
54
|
-
function resolveLocalNxPlugin(importPath, projects, root = workspace_root_1.workspaceRoot) {
|
55
|
-
return lookupLocalPlugin(importPath, projects, root);
|
56
|
-
}
|
57
|
-
exports.unregisterPluginTSTranspiler = null;
|
58
|
-
/**
|
59
|
-
* Register swc-node or ts-node if they are not currently registered
|
60
|
-
* with some default settings which work well for Nx plugins.
|
61
|
-
*/
|
62
|
-
function registerPluginTSTranspiler() {
|
63
|
-
// Get the first tsconfig that matches the allowed set
|
64
|
-
const tsConfigName = [
|
65
|
-
(0, posix_1.join)(workspace_root_1.workspaceRoot, 'tsconfig.base.json'),
|
66
|
-
(0, posix_1.join)(workspace_root_1.workspaceRoot, 'tsconfig.json'),
|
67
|
-
].find((x) => (0, node_fs_1.existsSync)(x));
|
68
|
-
if (!tsConfigName) {
|
69
|
-
return;
|
70
|
-
}
|
71
|
-
const tsConfig = tsConfigName
|
72
|
-
? (0, typescript_1.readTsConfig)(tsConfigName)
|
73
|
-
: {};
|
74
|
-
const cleanupFns = [
|
75
|
-
(0, register_1.registerTsConfigPaths)(tsConfigName),
|
76
|
-
(0, register_1.registerTranspiler)({
|
77
|
-
experimentalDecorators: true,
|
78
|
-
emitDecoratorMetadata: true,
|
79
|
-
...tsConfig.options,
|
80
|
-
}, tsConfig.raw),
|
81
|
-
];
|
82
|
-
exports.unregisterPluginTSTranspiler = () => {
|
83
|
-
cleanupFns.forEach((fn) => fn?.());
|
84
|
-
};
|
85
|
-
}
|
86
|
-
function lookupLocalPlugin(importPath, projects, root = workspace_root_1.workspaceRoot) {
|
87
|
-
const projectConfig = findNxProjectForImportPath(importPath, projects, root);
|
88
|
-
if (!projectConfig) {
|
89
|
-
return null;
|
90
|
-
}
|
91
|
-
return { path: path.join(root, projectConfig.root), projectConfig };
|
92
|
-
}
|
93
|
-
let packageEntryPointsToProjectMap;
|
94
|
-
function findNxProjectForImportPath(importPath, projects, root = workspace_root_1.workspaceRoot) {
|
95
|
-
const tsConfigPaths = readTsConfigPaths(root);
|
96
|
-
const possibleTsPaths = tsConfigPaths[importPath]?.map((p) => (0, path_1.normalizePath)(path.relative(root, path.join(root, p)))) ?? [];
|
97
|
-
const projectRootMappings = new Map();
|
98
|
-
if (possibleTsPaths.length) {
|
99
|
-
const projectNameMap = new Map();
|
100
|
-
for (const projectRoot in projects) {
|
101
|
-
const project = projects[projectRoot];
|
102
|
-
projectRootMappings.set(project.root, project.name);
|
103
|
-
projectNameMap.set(project.name, project);
|
104
|
-
}
|
105
|
-
for (const tsConfigPath of possibleTsPaths) {
|
106
|
-
const nxProject = (0, find_project_for_path_1.findProjectForPath)(tsConfigPath, projectRootMappings);
|
107
|
-
if (nxProject) {
|
108
|
-
return projectNameMap.get(nxProject);
|
109
|
-
}
|
110
|
-
}
|
111
|
-
}
|
112
|
-
packageEntryPointsToProjectMap ??=
|
113
|
-
(0, packages_1.getPackageEntryPointsToProjectMap)(projects);
|
114
|
-
if (packageEntryPointsToProjectMap[importPath]) {
|
115
|
-
return packageEntryPointsToProjectMap[importPath];
|
18
|
+
require.resolve(moduleName);
|
116
19
|
}
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
function readTsConfigPaths(root = workspace_root_1.workspaceRoot) {
|
122
|
-
if (!tsconfigPaths) {
|
123
|
-
const tsconfigPath = ['tsconfig.base.json', 'tsconfig.json']
|
124
|
-
.map((x) => path.join(root, x))
|
125
|
-
.filter((x) => (0, node_fs_1.existsSync)(x))[0];
|
126
|
-
if (!tsconfigPath) {
|
127
|
-
throw new Error('unable to find tsconfig.base.json or tsconfig.json');
|
128
|
-
}
|
129
|
-
const { compilerOptions } = (0, fileutils_1.readJsonFile)(tsconfigPath);
|
130
|
-
tsconfigPaths = compilerOptions?.paths;
|
20
|
+
catch {
|
21
|
+
// If a plugin cannot be resolved, we will need projects to resolve it
|
22
|
+
projectsWithoutInference ??=
|
23
|
+
await (0, retrieve_workspace_files_1.retrieveProjectConfigurationsWithoutPluginInference)(root);
|
131
24
|
}
|
132
|
-
|
25
|
+
const { pluginPath, name, shouldRegisterTSTranspiler } = getPluginPathAndName(moduleName, paths, projectsWithoutInference, root);
|
26
|
+
return { pluginPath, name, shouldRegisterTSTranspiler };
|
133
27
|
}
|
134
28
|
function readPluginMainFromProjectConfiguration(plugin) {
|
135
29
|
const { main } = Object.values(plugin.targets).find((x) => [
|
@@ -144,6 +38,9 @@ function readPluginMainFromProjectConfiguration(plugin) {
|
|
144
38
|
{};
|
145
39
|
return main;
|
146
40
|
}
|
41
|
+
function resolveLocalNxPlugin(importPath, projects, root = workspace_root_1.workspaceRoot) {
|
42
|
+
return lookupLocalPlugin(importPath, projects, root);
|
43
|
+
}
|
147
44
|
function getPluginPathAndName(moduleName, paths, projects, root) {
|
148
45
|
let pluginPath;
|
149
46
|
let shouldRegisterTSTranspiler = false;
|
@@ -172,43 +69,57 @@ function getPluginPathAndName(moduleName, paths, projects, root) {
|
|
172
69
|
}
|
173
70
|
}
|
174
71
|
const packageJsonPath = path.join(pluginPath, 'package.json');
|
175
|
-
const { name } = !['.ts', '.js'].some((x) =>
|
72
|
+
const { name } = !['.ts', '.js'].some((x) => path.extname(moduleName) === x) && // Not trying to point to a ts or js file
|
176
73
|
(0, node_fs_1.existsSync)(packageJsonPath) // plugin has a package.json
|
177
74
|
? (0, fileutils_1.readJsonFile)(packageJsonPath) // read name from package.json
|
178
75
|
: { name: moduleName };
|
179
76
|
return { pluginPath, name, shouldRegisterTSTranspiler };
|
180
77
|
}
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
78
|
+
function lookupLocalPlugin(importPath, projects, root = workspace_root_1.workspaceRoot) {
|
79
|
+
const projectConfig = findNxProjectForImportPath(importPath, projects, root);
|
80
|
+
if (!projectConfig) {
|
81
|
+
return null;
|
82
|
+
}
|
83
|
+
return { path: path.join(root, projectConfig.root), projectConfig };
|
187
84
|
}
|
188
|
-
|
189
|
-
|
190
|
-
|
85
|
+
let packageEntryPointsToProjectMap;
|
86
|
+
function findNxProjectForImportPath(importPath, projects, root = workspace_root_1.workspaceRoot) {
|
87
|
+
const tsConfigPaths = readTsConfigPaths(root);
|
88
|
+
const possibleTsPaths = tsConfigPaths[importPath]?.map((p) => (0, path_1.normalizePath)(path.relative(root, path.join(root, p)))) ?? [];
|
89
|
+
const projectRootMappings = new Map();
|
90
|
+
if (possibleTsPaths.length) {
|
91
|
+
const projectNameMap = new Map();
|
92
|
+
for (const projectRoot in projects) {
|
93
|
+
const project = projects[projectRoot];
|
94
|
+
projectRootMappings.set(project.root, project.name);
|
95
|
+
projectNameMap.set(project.name, project);
|
96
|
+
}
|
97
|
+
for (const tsConfigPath of possibleTsPaths) {
|
98
|
+
const nxProject = (0, find_project_for_path_1.findProjectForPath)(tsConfigPath, projectRootMappings);
|
99
|
+
if (nxProject) {
|
100
|
+
return projectNameMap.get(nxProject);
|
101
|
+
}
|
102
|
+
}
|
191
103
|
}
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
104
|
+
packageEntryPointsToProjectMap ??=
|
105
|
+
(0, packages_1.getPackageEntryPointsToProjectMap)(projects);
|
106
|
+
if (packageEntryPointsToProjectMap[importPath]) {
|
107
|
+
return packageEntryPointsToProjectMap[importPath];
|
196
108
|
}
|
197
|
-
|
198
|
-
|
109
|
+
logger_1.logger.verbose('Unable to find local plugin', possibleTsPaths, projectRootMappings);
|
110
|
+
throw new Error('Unable to resolve local plugin with import path ' + importPath);
|
199
111
|
}
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
if (
|
207
|
-
|
112
|
+
let tsconfigPaths;
|
113
|
+
function readTsConfigPaths(root = workspace_root_1.workspaceRoot) {
|
114
|
+
if (!tsconfigPaths) {
|
115
|
+
const tsconfigPath = ['tsconfig.base.json', 'tsconfig.json']
|
116
|
+
.map((x) => path.join(root, x))
|
117
|
+
.filter((x) => (0, node_fs_1.existsSync)(x))[0];
|
118
|
+
if (!tsconfigPath) {
|
119
|
+
throw new Error('unable to find tsconfig.base.json or tsconfig.json');
|
208
120
|
}
|
209
|
-
|
210
|
-
|
211
|
-
catch (e) {
|
212
|
-
throw new error_types_1.LoadPluginError(moduleName, e);
|
121
|
+
const { compilerOptions } = (0, fileutils_1.readJsonFile)(tsconfigPath);
|
122
|
+
tsconfigPaths = compilerOptions?.paths;
|
213
123
|
}
|
124
|
+
return tsconfigPaths ?? {};
|
214
125
|
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export declare let unregisterPluginTSTranspiler: (() => void) | null;
|
2
|
+
/**
|
3
|
+
* Register swc-node or ts-node if they are not currently registered
|
4
|
+
* with some default settings which work well for Nx plugins.
|
5
|
+
*/
|
6
|
+
export declare function registerPluginTSTranspiler(): void;
|
7
|
+
export declare function pluginTranspilerIsRegistered(): boolean;
|
8
|
+
export declare function cleanupPluginTSTranspiler(): void;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.unregisterPluginTSTranspiler = void 0;
|
4
|
+
exports.registerPluginTSTranspiler = registerPluginTSTranspiler;
|
5
|
+
exports.pluginTranspilerIsRegistered = pluginTranspilerIsRegistered;
|
6
|
+
exports.cleanupPluginTSTranspiler = cleanupPluginTSTranspiler;
|
7
|
+
const node_fs_1 = require("node:fs");
|
8
|
+
const posix_1 = require("node:path/posix");
|
9
|
+
const workspace_root_1 = require("../../utils/workspace-root");
|
10
|
+
const register_1 = require("../../plugins/js/utils/register");
|
11
|
+
const typescript_1 = require("../../plugins/js/utils/typescript");
|
12
|
+
exports.unregisterPluginTSTranspiler = null;
|
13
|
+
/**
|
14
|
+
* Register swc-node or ts-node if they are not currently registered
|
15
|
+
* with some default settings which work well for Nx plugins.
|
16
|
+
*/
|
17
|
+
function registerPluginTSTranspiler() {
|
18
|
+
// Get the first tsconfig that matches the allowed set
|
19
|
+
const tsConfigName = [
|
20
|
+
(0, posix_1.join)(workspace_root_1.workspaceRoot, 'tsconfig.base.json'),
|
21
|
+
(0, posix_1.join)(workspace_root_1.workspaceRoot, 'tsconfig.json'),
|
22
|
+
].find((x) => (0, node_fs_1.existsSync)(x));
|
23
|
+
if (!tsConfigName) {
|
24
|
+
return;
|
25
|
+
}
|
26
|
+
const tsConfig = tsConfigName
|
27
|
+
? (0, typescript_1.readTsConfig)(tsConfigName)
|
28
|
+
: {};
|
29
|
+
const cleanupFns = [
|
30
|
+
(0, register_1.registerTsConfigPaths)(tsConfigName),
|
31
|
+
(0, register_1.registerTranspiler)({
|
32
|
+
experimentalDecorators: true,
|
33
|
+
emitDecoratorMetadata: true,
|
34
|
+
...tsConfig.options,
|
35
|
+
}, tsConfig.raw),
|
36
|
+
];
|
37
|
+
exports.unregisterPluginTSTranspiler = () => {
|
38
|
+
cleanupFns.forEach((fn) => fn?.());
|
39
|
+
};
|
40
|
+
}
|
41
|
+
function pluginTranspilerIsRegistered() {
|
42
|
+
return exports.unregisterPluginTSTranspiler !== null;
|
43
|
+
}
|
44
|
+
function cleanupPluginTSTranspiler() {
|
45
|
+
(0, exports.unregisterPluginTSTranspiler)?.();
|
46
|
+
exports.unregisterPluginTSTranspiler = null;
|
47
|
+
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { NxJsonConfiguration, TargetDefaults } from '../../config/nx-json';
|
2
2
|
import { ProjectGraphExternalNode } from '../../config/project-graph';
|
3
3
|
import { ProjectConfiguration, ProjectMetadata, TargetConfiguration, TargetMetadata } from '../../config/workspace-json-project-json';
|
4
|
-
import { LoadedNxPlugin } from '../plugins/
|
4
|
+
import { LoadedNxPlugin } from '../plugins/loaded-nx-plugin';
|
5
5
|
export type SourceInformation = [file: string | null, plugin: string];
|
6
6
|
export type ConfigurationSourceMaps = Record<string, Record<string, SourceInformation>>;
|
7
7
|
export declare function mergeProjectConfigurationIntoRootMap(projectRootMap: Record<string, ProjectConfiguration>, project: ProjectConfiguration, configurationSourceMaps?: ConfigurationSourceMaps, sourceInformation?: SourceInformation, skipTargetNormalization?: boolean): void;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { ProjectConfiguration } from '../../config/workspace-json-project-json';
|
2
2
|
import { NxJsonConfiguration } from '../../config/nx-json';
|
3
3
|
import { ConfigurationResult } from './project-configuration-utils';
|
4
|
-
import { LoadedNxPlugin } from '../plugins/
|
4
|
+
import { LoadedNxPlugin } from '../plugins/loaded-nx-plugin';
|
5
5
|
/**
|
6
6
|
* Walks the workspace directory to create the `projectFileMap`, `ProjectConfigurations` and `allWorkspaceFiles`
|
7
7
|
* @throws
|
@@ -112,6 +112,17 @@ function addMatchingProjectsByName(projectNames, projects, pattern, matchedProje
|
|
112
112
|
return;
|
113
113
|
}
|
114
114
|
if (!(0, globs_1.isGlobPattern)(pattern.value)) {
|
115
|
+
// Custom regex that is basically \b without underscores, so "foo" pattern matches "foo_bar".
|
116
|
+
const regex = new RegExp(`(?<![a-zA-Z0-9])${pattern.value}(?![a-zA-Z0-9])`, 'i');
|
117
|
+
const matchingProjects = Object.keys(projects).filter((name) => regex.test(name));
|
118
|
+
for (const projectName of matchingProjects) {
|
119
|
+
if (pattern.exclude) {
|
120
|
+
matchedProjects.delete(projectName);
|
121
|
+
}
|
122
|
+
else {
|
123
|
+
matchedProjects.add(projectName);
|
124
|
+
}
|
125
|
+
}
|
115
126
|
return;
|
116
127
|
}
|
117
128
|
const matchedProjectNames = (0, exports.getMatchingStringsWithCache)(pattern.value, projectNames);
|
@@ -5,7 +5,7 @@ const path_1 = require("path");
|
|
5
5
|
const fileutils_1 = require("../fileutils");
|
6
6
|
const installation_directory_1 = require("../installation-directory");
|
7
7
|
const plugins_1 = require("../../project-graph/plugins");
|
8
|
-
const
|
8
|
+
const in_process_loader_1 = require("../../project-graph/plugins/in-process-loader");
|
9
9
|
function tryGetCollection(packageJsonPath, collectionFile, propName) {
|
10
10
|
if (!collectionFile) {
|
11
11
|
return null;
|
@@ -61,7 +61,7 @@ async function tryGetModule(packageJson, workspaceRoot) {
|
|
61
61
|
packageJson['nx-migrations'] ??
|
62
62
|
packageJson['schematics'] ??
|
63
63
|
packageJson['builders']) {
|
64
|
-
const [pluginPromise] = (0,
|
64
|
+
const [pluginPromise] = (0, in_process_loader_1.loadNxPlugin)(packageJson.name, workspaceRoot);
|
65
65
|
return await pluginPromise;
|
66
66
|
}
|
67
67
|
else {
|
@@ -1,135 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
// This file contains the bits and bobs of the internal API for loading and interacting with Nx plugins.
|
3
|
-
// For the public API, used by plugin authors, see `./public-api.ts`.
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
5
|
-
exports.LoadedNxPlugin = void 0;
|
6
|
-
exports.loadNxPlugins = loadNxPlugins;
|
7
|
-
exports.getDefaultPlugins = getDefaultPlugins;
|
8
|
-
const path_1 = require("path");
|
9
|
-
const workspace_root_1 = require("../../utils/workspace-root");
|
10
|
-
const angular_json_1 = require("../../adapter/angular-json");
|
11
|
-
const isolation_1 = require("./isolation");
|
12
|
-
const loader_1 = require("./loader");
|
13
|
-
const utils_1 = require("./utils");
|
14
|
-
const error_types_1 = require("../error-types");
|
15
|
-
const native_1 = require("../../native");
|
16
|
-
class LoadedNxPlugin {
|
17
|
-
constructor(plugin, pluginDefinition) {
|
18
|
-
this.name = plugin.name;
|
19
|
-
if (typeof pluginDefinition !== 'string') {
|
20
|
-
this.options = pluginDefinition.options;
|
21
|
-
this.include = pluginDefinition.include;
|
22
|
-
this.exclude = pluginDefinition.exclude;
|
23
|
-
}
|
24
|
-
if (plugin.createNodes && !plugin.createNodesV2) {
|
25
|
-
this.createNodes = [
|
26
|
-
plugin.createNodes[0],
|
27
|
-
(configFiles, context) => (0, utils_1.createNodesFromFiles)(plugin.createNodes[1], configFiles, this.options, context).then((results) => results.map((r) => [this.name, r[0], r[1]])),
|
28
|
-
];
|
29
|
-
}
|
30
|
-
if (plugin.createNodesV2) {
|
31
|
-
this.createNodes = [
|
32
|
-
plugin.createNodesV2[0],
|
33
|
-
async (configFiles, context) => {
|
34
|
-
const result = await plugin.createNodesV2[1](configFiles, this.options, context);
|
35
|
-
return result.map((r) => [this.name, r[0], r[1]]);
|
36
|
-
},
|
37
|
-
];
|
38
|
-
}
|
39
|
-
if (this.createNodes) {
|
40
|
-
const inner = this.createNodes[1];
|
41
|
-
this.createNodes[1] = async (...args) => {
|
42
|
-
performance.mark(`${plugin.name}:createNodes - start`);
|
43
|
-
try {
|
44
|
-
return await inner(...args);
|
45
|
-
}
|
46
|
-
catch (e) {
|
47
|
-
if ((0, error_types_1.isAggregateCreateNodesError)(e)) {
|
48
|
-
throw e;
|
49
|
-
}
|
50
|
-
// The underlying plugin errored out. We can't know any partial results.
|
51
|
-
throw new error_types_1.AggregateCreateNodesError([[null, e]], []);
|
52
|
-
}
|
53
|
-
finally {
|
54
|
-
performance.mark(`${plugin.name}:createNodes - end`);
|
55
|
-
performance.measure(`${plugin.name}:createNodes`, `${plugin.name}:createNodes - start`, `${plugin.name}:createNodes - end`);
|
56
|
-
}
|
57
|
-
};
|
58
|
-
}
|
59
|
-
if (plugin.createDependencies) {
|
60
|
-
this.createDependencies = async (context) => plugin.createDependencies(this.options, context);
|
61
|
-
}
|
62
|
-
if (plugin.createMetadata) {
|
63
|
-
this.createMetadata = async (graph, context) => plugin.createMetadata(graph, this.options, context);
|
64
|
-
}
|
65
|
-
}
|
66
|
-
}
|
67
|
-
exports.LoadedNxPlugin = LoadedNxPlugin;
|
68
|
-
function isIsolationEnabled() {
|
69
|
-
// Explicitly enabled, regardless of further conditions
|
70
|
-
if (process.env.NX_ISOLATE_PLUGINS === 'true') {
|
71
|
-
return true;
|
72
|
-
}
|
73
|
-
if (
|
74
|
-
// Explicitly disabled
|
75
|
-
process.env.NX_ISOLATE_PLUGINS === 'false' ||
|
76
|
-
// Isolation is disabled on WASM builds currently.
|
77
|
-
native_1.IS_WASM) {
|
78
|
-
return false;
|
79
|
-
}
|
80
|
-
// Default value
|
81
|
-
return true;
|
82
|
-
}
|
83
|
-
/**
|
84
|
-
* Use `getPlugins` instead.
|
85
|
-
* @deprecated Do not use this. Use `getPlugins` instead.
|
86
|
-
*/
|
87
|
-
async function loadNxPlugins(plugins, root = workspace_root_1.workspaceRoot) {
|
88
|
-
performance.mark('loadNxPlugins:start');
|
89
|
-
const loadingMethod = isIsolationEnabled()
|
90
|
-
? isolation_1.loadNxPluginInIsolation
|
91
|
-
: loader_1.loadNxPlugin;
|
92
|
-
plugins = await normalizePlugins(plugins, root);
|
93
|
-
const cleanupFunctions = [];
|
94
|
-
const ret = [
|
95
|
-
await Promise.all(plugins.map(async (plugin) => {
|
96
|
-
const pluginPath = typeof plugin === 'string' ? plugin : plugin.plugin;
|
97
|
-
performance.mark(`Load Nx Plugin: ${pluginPath} - start`);
|
98
|
-
const [loadedPluginPromise, cleanup] = await loadingMethod(plugin, root);
|
99
|
-
cleanupFunctions.push(cleanup);
|
100
|
-
const res = await loadedPluginPromise;
|
101
|
-
performance.mark(`Load Nx Plugin: ${pluginPath} - end`);
|
102
|
-
performance.measure(`Load Nx Plugin: ${pluginPath}`, `Load Nx Plugin: ${pluginPath} - start`, `Load Nx Plugin: ${pluginPath} - end`);
|
103
|
-
return res;
|
104
|
-
})),
|
105
|
-
() => {
|
106
|
-
for (const fn of cleanupFunctions) {
|
107
|
-
fn();
|
108
|
-
}
|
109
|
-
if (loader_1.unregisterPluginTSTranspiler) {
|
110
|
-
(0, loader_1.unregisterPluginTSTranspiler)();
|
111
|
-
}
|
112
|
-
},
|
113
|
-
];
|
114
|
-
performance.mark('loadNxPlugins:end');
|
115
|
-
performance.measure('loadNxPlugins', 'loadNxPlugins:start', 'loadNxPlugins:end');
|
116
|
-
return ret;
|
117
|
-
}
|
118
|
-
async function normalizePlugins(plugins, root) {
|
119
|
-
plugins ??= [];
|
120
|
-
return [
|
121
|
-
...plugins,
|
122
|
-
// Most of the nx core node plugins go on the end, s.t. it overwrites any other plugins
|
123
|
-
...(await getDefaultPlugins(root)),
|
124
|
-
];
|
125
|
-
}
|
126
|
-
async function getDefaultPlugins(root) {
|
127
|
-
return [
|
128
|
-
(0, path_1.join)(__dirname, '../../plugins/js'),
|
129
|
-
...((0, angular_json_1.shouldMergeAngularProjects)(root, false)
|
130
|
-
? [(0, path_1.join)(__dirname, '../../adapter/angular-json')]
|
131
|
-
: []),
|
132
|
-
(0, path_1.join)(__dirname, '../../plugins/package-json'),
|
133
|
-
(0, path_1.join)(__dirname, '../../plugins/project-json/build-nodes/project-json'),
|
134
|
-
];
|
135
|
-
}
|
@@ -1,30 +0,0 @@
|
|
1
|
-
import { ProjectConfiguration } from '../../config/workspace-json-project-json';
|
2
|
-
import { PackageJson } from '../../utils/package-json';
|
3
|
-
import type { PluginConfiguration } from '../../config/nx-json';
|
4
|
-
import { LoadedNxPlugin } from './internal-api';
|
5
|
-
export declare function readPluginPackageJson(pluginName: string, projects: Record<string, ProjectConfiguration>, paths?: string[]): {
|
6
|
-
path: string;
|
7
|
-
json: PackageJson;
|
8
|
-
};
|
9
|
-
export declare function resolveLocalNxPlugin(importPath: string, projects: Record<string, ProjectConfiguration>, root?: string): {
|
10
|
-
path: string;
|
11
|
-
projectConfig: ProjectConfiguration;
|
12
|
-
} | null;
|
13
|
-
export declare let unregisterPluginTSTranspiler: (() => void) | null;
|
14
|
-
/**
|
15
|
-
* Register swc-node or ts-node if they are not currently registered
|
16
|
-
* with some default settings which work well for Nx plugins.
|
17
|
-
*/
|
18
|
-
export declare function registerPluginTSTranspiler(): void;
|
19
|
-
export declare function getPluginPathAndName(moduleName: string, paths: string[], projects: Record<string, ProjectConfiguration>, root: string): {
|
20
|
-
pluginPath: string;
|
21
|
-
name: any;
|
22
|
-
shouldRegisterTSTranspiler: boolean;
|
23
|
-
};
|
24
|
-
export declare function loadNxPlugin(plugin: PluginConfiguration, root: string): readonly [Promise<LoadedNxPlugin>, () => void];
|
25
|
-
export declare function resolveNxPlugin(moduleName: string, root: string, paths: string[]): Promise<{
|
26
|
-
pluginPath: string;
|
27
|
-
name: any;
|
28
|
-
shouldRegisterTSTranspiler: boolean;
|
29
|
-
}>;
|
30
|
-
export declare function loadNxPluginAsync(pluginConfiguration: PluginConfiguration, paths: string[], root: string): Promise<LoadedNxPlugin>;
|