nx 18.1.0-canary.20240308-46592d7 → 18.1.0-canary.20240312-9520aa2
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 +12 -12
- package/src/adapter/angular-json.d.ts +1 -2
- package/src/adapter/angular-json.js +0 -1
- package/src/adapter/ngcli-adapter.js +3 -3
- package/src/command-line/generate/generator-utils.js +2 -2
- package/src/command-line/run/executor-utils.js +2 -2
- package/src/config/schema-utils.js +2 -2
- package/src/daemon/server/project-graph-incremental-recomputation.js +1 -0
- package/src/devkit-exports.d.ts +1 -2
- package/src/devkit-internals.d.ts +0 -1
- package/src/devkit-internals.js +1 -3
- package/src/generators/utils/project-configuration.js +2 -2
- package/src/migrations/update-15-1-0/set-project-names.js +2 -4
- package/src/migrations/update-17-2-0/move-default-base.d.ts +1 -1
- package/src/migrations/update-17-2-0/move-default-base.js +2 -2
- package/src/plugins/js/index.d.ts +1 -1
- package/src/plugins/js/lock-file/lock-file.d.ts +1 -1
- package/src/plugins/js/lock-file/npm-parser.d.ts +1 -1
- package/src/plugins/js/lock-file/pnpm-parser.d.ts +1 -1
- package/src/plugins/js/lock-file/yarn-parser.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/build-dependencies.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.d.ts +1 -1
- package/src/plugins/js/utils/register.js +3 -1
- package/src/plugins/package-json-workspaces/create-nodes.d.ts +2 -2
- package/src/plugins/package-json-workspaces/create-nodes.js +31 -24
- package/src/plugins/package-json-workspaces/index.d.ts +0 -1
- package/src/plugins/package-json-workspaces/index.js +0 -2
- package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.d.ts +1 -2
- package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.js +0 -1
- package/src/plugins/project-json/build-nodes/project-json.d.ts +1 -2
- package/src/plugins/project-json/build-nodes/project-json.js +0 -1
- package/src/plugins/target-defaults/target-defaults-plugin.d.ts +1 -2
- package/src/plugins/target-defaults/target-defaults-plugin.js +0 -1
- package/src/project-graph/affected/locators/project-glob-changes.js +3 -2
- package/src/project-graph/build-project-graph.js +8 -11
- package/src/project-graph/file-utils.js +3 -3
- package/src/project-graph/project-graph-builder.d.ts +1 -1
- package/src/project-graph/project-graph.js +3 -0
- package/src/project-graph/utils/normalize-project-nodes.d.ts +1 -1
- package/src/project-graph/utils/project-configuration-utils.d.ts +2 -2
- package/src/project-graph/utils/project-configuration-utils.js +54 -13
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +4 -8
- package/src/project-graph/utils/retrieve-workspace-files.js +15 -17
- package/src/utils/logger.d.ts +0 -1
- package/src/utils/logger.js +0 -5
- package/src/{project-graph/plugins/public-api.d.ts → utils/nx-plugin.d.ts} +41 -7
- package/src/utils/nx-plugin.deprecated.d.ts +2 -4
- package/src/utils/nx-plugin.deprecated.js +4 -4
- package/src/utils/nx-plugin.js +293 -0
- package/src/utils/plugins/plugin-capabilities.d.ts +1 -1
- package/src/utils/plugins/plugin-capabilities.js +7 -8
- package/src/project-graph/plugins/index.d.ts +0 -2
- package/src/project-graph/plugins/index.js +0 -8
- package/src/project-graph/plugins/internal-api.d.ts +0 -18
- package/src/project-graph/plugins/internal-api.js +0 -48
- package/src/project-graph/plugins/messaging.d.ts +0 -94
- package/src/project-graph/plugins/messaging.js +0 -23
- package/src/project-graph/plugins/plugin-pool.d.ts +0 -4
- package/src/project-graph/plugins/plugin-pool.js +0 -213
- package/src/project-graph/plugins/plugin-worker.d.ts +0 -1
- package/src/project-graph/plugins/plugin-worker.js +0 -115
- package/src/project-graph/plugins/public-api.js +0 -4
- package/src/project-graph/plugins/utils.d.ts +0 -9
- package/src/project-graph/plugins/utils.js +0 -55
- package/src/project-graph/plugins/worker-api.d.ts +0 -26
- package/src/project-graph/plugins/worker-api.js +0 -177
@@ -12,6 +12,7 @@ const workspace_root_1 = require("../utils/workspace-root");
|
|
12
12
|
const perf_hooks_1 = require("perf_hooks");
|
13
13
|
const retrieve_workspace_files_1 = require("./utils/retrieve-workspace-files");
|
14
14
|
const nx_json_1 = require("../config/nx-json");
|
15
|
+
const nx_plugin_1 = require("../utils/nx-plugin");
|
15
16
|
/**
|
16
17
|
* Synchronously reads the latest cached copy of the workspace's ProjectGraph.
|
17
18
|
* @throws {Error} if there is no cached ProjectGraph to read from
|
@@ -65,6 +66,7 @@ function readProjectsConfigurationFromProjectGraph(projectGraph) {
|
|
65
66
|
}
|
66
67
|
exports.readProjectsConfigurationFromProjectGraph = readProjectsConfigurationFromProjectGraph;
|
67
68
|
async function buildProjectGraphAndSourceMapsWithoutDaemon() {
|
69
|
+
// Set this globally to allow plugins to know if they are being called from the project graph creation
|
68
70
|
global.NX_GRAPH_CREATION = true;
|
69
71
|
const nxJson = (0, nx_json_1.readNxJson)();
|
70
72
|
perf_hooks_1.performance.mark('retrieve-project-configurations:start');
|
@@ -77,6 +79,7 @@ async function buildProjectGraphAndSourceMapsWithoutDaemon() {
|
|
77
79
|
perf_hooks_1.performance.mark('build-project-graph-using-project-file-map:start');
|
78
80
|
const projectGraph = (await (0, build_project_graph_1.buildProjectGraphUsingProjectFileMap)(projects, externalNodes, fileMap, allWorkspaceFiles, rustReferences, cacheEnabled ? (0, nx_deps_cache_1.readFileMapCache)() : null, cacheEnabled)).projectGraph;
|
79
81
|
perf_hooks_1.performance.mark('build-project-graph-using-project-file-map:end');
|
82
|
+
(0, nx_plugin_1.unregisterPluginTSTranspiler)();
|
80
83
|
delete global.NX_GRAPH_CREATION;
|
81
84
|
return { projectGraph, sourceMaps };
|
82
85
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { ProjectGraphProjectNode } from '../../config/project-graph';
|
2
2
|
import { ProjectGraphBuilder } from '../project-graph-builder';
|
3
3
|
import { ProjectConfiguration, TargetConfiguration } from '../../config/workspace-json-project-json';
|
4
|
-
import { CreateDependenciesContext } from '
|
4
|
+
import { CreateDependenciesContext } from '../../utils/nx-plugin';
|
5
5
|
export declare function normalizeProjectNodes(ctx: CreateDependenciesContext, builder: ProjectGraphBuilder): Promise<void>;
|
6
6
|
/**
|
7
7
|
* Apply target defaults and normalization
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { NxJsonConfiguration, TargetDefaults } from '../../config/nx-json';
|
2
2
|
import { ProjectGraphExternalNode } from '../../config/project-graph';
|
3
3
|
import { ProjectConfiguration, TargetConfiguration } from '../../config/workspace-json-project-json';
|
4
|
+
import { LoadedNxPlugin } from '../../utils/nx-plugin';
|
4
5
|
import { ONLY_MODIFIES_EXISTING_TARGET } from '../../plugins/target-defaults/target-defaults-plugin';
|
5
|
-
import { RemotePlugin } from '../plugins/internal-api';
|
6
6
|
export type SourceInformation = [file: string, plugin: string];
|
7
7
|
export type ConfigurationSourceMaps = Record<string, Record<string, SourceInformation>>;
|
8
8
|
export declare function mergeProjectConfigurationIntoRootMap(projectRootMap: Map<string, ProjectConfiguration>, project: ProjectConfiguration & {
|
@@ -25,7 +25,7 @@ export type ConfigurationResult = {
|
|
25
25
|
* @param root The workspace root
|
26
26
|
*/
|
27
27
|
export declare function buildProjectsConfigurationsFromProjectPathsAndPlugins(nxJson: NxJsonConfiguration, projectFiles: string[], // making this parameter allows devkit to pick up newly created projects
|
28
|
-
plugins:
|
28
|
+
plugins: LoadedNxPlugin[], root?: string): Promise<ConfigurationResult>;
|
29
29
|
export declare function readProjectConfigurationsFromRootMap(projectRootMap: Map<string, ProjectConfiguration>): Record<string, ProjectConfiguration>;
|
30
30
|
/**
|
31
31
|
* Merges two targets.
|
@@ -7,8 +7,6 @@ const workspace_root_1 = require("../../utils/workspace-root");
|
|
7
7
|
const target_defaults_plugin_1 = require("../../plugins/target-defaults/target-defaults-plugin");
|
8
8
|
const minimatch_1 = require("minimatch");
|
9
9
|
const path_1 = require("path");
|
10
|
-
const utils_1 = require("../plugins/utils");
|
11
|
-
const plugin_pool_1 = require("../plugins/plugin-pool");
|
12
10
|
function mergeProjectConfigurationIntoRootMap(projectRootMap, project, configurationSourceMaps, sourceInformation,
|
13
11
|
// This function is used when reading project configuration
|
14
12
|
// in generators, where we don't want to do this.
|
@@ -134,25 +132,54 @@ function buildProjectsConfigurationsFromProjectPathsAndPlugins(nxJson, projectFi
|
|
134
132
|
plugins, root = workspace_root_1.workspaceRoot) {
|
135
133
|
const results = [];
|
136
134
|
// We iterate over plugins first - this ensures that plugins specified first take precedence.
|
137
|
-
for (const plugin of plugins) {
|
135
|
+
for (const { plugin, options } of plugins) {
|
138
136
|
const [pattern, createNodes] = plugin.createNodes ?? [];
|
137
|
+
const pluginResults = [];
|
138
|
+
performance.mark(`${plugin.name}:createNodes - start`);
|
139
139
|
if (!pattern) {
|
140
140
|
continue;
|
141
141
|
}
|
142
|
-
const matchedFiles = [];
|
143
|
-
performance.mark(`${plugin.name}:createNodes - start`);
|
144
142
|
for (const file of projectFiles) {
|
143
|
+
performance.mark(`${plugin.name}:createNodes:${file} - start`);
|
145
144
|
if ((0, minimatch_1.minimatch)(file, pattern, { dot: true })) {
|
146
|
-
|
145
|
+
try {
|
146
|
+
let r = createNodes(file, options, {
|
147
|
+
nxJsonConfiguration: nxJson,
|
148
|
+
workspaceRoot: root,
|
149
|
+
});
|
150
|
+
if (r instanceof Promise) {
|
151
|
+
pluginResults.push(r
|
152
|
+
.catch((e) => {
|
153
|
+
performance.mark(`${plugin.name}:createNodes:${file} - end`);
|
154
|
+
throw new CreateNodesError(`Unable to create nodes for ${file} using plugin ${plugin.name}.`, e);
|
155
|
+
})
|
156
|
+
.then((r) => {
|
157
|
+
performance.mark(`${plugin.name}:createNodes:${file} - end`);
|
158
|
+
performance.measure(`${plugin.name}:createNodes:${file}`, `${plugin.name}:createNodes:${file} - start`, `${plugin.name}:createNodes:${file} - end`);
|
159
|
+
return { ...r, file, pluginName: plugin.name };
|
160
|
+
}));
|
161
|
+
}
|
162
|
+
else {
|
163
|
+
performance.mark(`${plugin.name}:createNodes:${file} - end`);
|
164
|
+
performance.measure(`${plugin.name}:createNodes:${file}`, `${plugin.name}:createNodes:${file} - start`, `${plugin.name}:createNodes:${file} - end`);
|
165
|
+
pluginResults.push({
|
166
|
+
...r,
|
167
|
+
file,
|
168
|
+
pluginName: plugin.name,
|
169
|
+
});
|
170
|
+
}
|
171
|
+
}
|
172
|
+
catch (e) {
|
173
|
+
throw new CreateNodesError(`Unable to create nodes for ${file} using plugin ${plugin.name}.`, e);
|
174
|
+
}
|
147
175
|
}
|
148
176
|
}
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
177
|
+
// If there are no promises (counter undefined) or all promises have resolved (counter === 0)
|
178
|
+
results.push(Promise.all(pluginResults).then((results) => {
|
179
|
+
performance.mark(`${plugin.name}:createNodes - end`);
|
180
|
+
performance.measure(`${plugin.name}:createNodes`, `${plugin.name}:createNodes - start`, `${plugin.name}:createNodes - end`);
|
181
|
+
return results;
|
154
182
|
}));
|
155
|
-
results.push(r);
|
156
183
|
}
|
157
184
|
return Promise.all(results).then((results) => {
|
158
185
|
performance.mark('createNodes:merge - start');
|
@@ -174,7 +201,7 @@ plugins, root = workspace_root_1.workspaceRoot) {
|
|
174
201
|
mergeProjectConfigurationIntoRootMap(projectRootMap, project, configurationSourceMaps, sourceInfo);
|
175
202
|
}
|
176
203
|
catch (e) {
|
177
|
-
throw new
|
204
|
+
throw new CreateNodesError(`Unable to merge project information for "${project.root}" from ${result.file} using plugin ${result.pluginName}.`, e);
|
178
205
|
}
|
179
206
|
}
|
180
207
|
Object.assign(externalNodes, pluginExternalNodes);
|
@@ -234,6 +261,20 @@ function readProjectConfigurationsFromRootMap(projectRootMap) {
|
|
234
261
|
return projects;
|
235
262
|
}
|
236
263
|
exports.readProjectConfigurationsFromRootMap = readProjectConfigurationsFromRootMap;
|
264
|
+
class CreateNodesError extends Error {
|
265
|
+
constructor(msg, cause) {
|
266
|
+
const message = `${msg} ${!cause
|
267
|
+
? ''
|
268
|
+
: cause instanceof Error
|
269
|
+
? `\n\n\t Inner Error: ${cause.stack}`
|
270
|
+
: cause}`;
|
271
|
+
// These errors are thrown during a JS callback which is invoked via rust.
|
272
|
+
// The errors messaging gets lost in the rust -> js -> rust transition, but
|
273
|
+
// logging the error here will ensure that it is visible in the console.
|
274
|
+
console.error(message);
|
275
|
+
super(message, { cause });
|
276
|
+
}
|
277
|
+
}
|
237
278
|
/**
|
238
279
|
* Merges two targets.
|
239
280
|
*
|
@@ -2,7 +2,7 @@ import { ProjectConfiguration } from '../../config/workspace-json-project-json';
|
|
2
2
|
import { NxJsonConfiguration } from '../../config/nx-json';
|
3
3
|
import { ProjectGraphExternalNode } from '../../config/project-graph';
|
4
4
|
import { ConfigurationSourceMaps } from './project-configuration-utils';
|
5
|
-
import {
|
5
|
+
import { LoadedNxPlugin } from '../../utils/nx-plugin';
|
6
6
|
/**
|
7
7
|
* Walks the workspace directory to create the `projectFileMap`, `ProjectConfigurations` and `allWorkspaceFiles`
|
8
8
|
* @throws
|
@@ -31,11 +31,7 @@ export type RetrievedGraphNodes = {
|
|
31
31
|
sourceMaps: ConfigurationSourceMaps;
|
32
32
|
projectRootMap: Record<string, string>;
|
33
33
|
};
|
34
|
-
export declare function retrieveProjectConfigurationPaths(root: string, plugins:
|
34
|
+
export declare function retrieveProjectConfigurationPaths(root: string, plugins: LoadedNxPlugin[]): string[];
|
35
35
|
export declare function retrieveProjectConfigurationsWithoutPluginInference(root: string): Promise<Record<string, ProjectConfiguration>>;
|
36
|
-
export declare function createProjectConfigurations(workspaceRoot: string, nxJson: NxJsonConfiguration, configFiles: string[], plugins:
|
37
|
-
|
38
|
-
createNodes?: readonly [string, ...unknown[]];
|
39
|
-
}>;
|
40
|
-
export declare function configurationGlobs(plugins: PluginGlobsOnly): string[];
|
41
|
-
export {};
|
36
|
+
export declare function createProjectConfigurations(workspaceRoot: string, nxJson: NxJsonConfiguration, configFiles: string[], plugins: LoadedNxPlugin[]): Promise<RetrievedGraphNodes>;
|
37
|
+
export declare function configurationGlobs(plugins: LoadedNxPlugin[]): string[];
|
@@ -2,14 +2,15 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.configurationGlobs = exports.createProjectConfigurations = exports.retrieveProjectConfigurationsWithoutPluginInference = exports.retrieveProjectConfigurationPaths = exports.retrieveProjectConfigurationsWithAngularProjects = exports.retrieveProjectConfigurations = exports.retrieveWorkspaceFiles = void 0;
|
4
4
|
const perf_hooks_1 = require("perf_hooks");
|
5
|
+
const installation_directory_1 = require("../../utils/installation-directory");
|
5
6
|
const angular_json_1 = require("../../adapter/angular-json");
|
6
7
|
const nx_json_1 = require("../../config/nx-json");
|
8
|
+
const package_json_workspaces_1 = require("../../plugins/package-json-workspaces");
|
7
9
|
const project_configuration_utils_1 = require("./project-configuration-utils");
|
8
|
-
const
|
10
|
+
const nx_plugin_1 = require("../../utils/nx-plugin");
|
11
|
+
const project_json_1 = require("../../plugins/project-json/build-nodes/project-json");
|
9
12
|
const workspace_context_1 = require("../../utils/workspace-context");
|
10
13
|
const build_all_workspace_files_1 = require("./build-all-workspace-files");
|
11
|
-
const path_1 = require("path");
|
12
|
-
const plugin_pool_1 = require("../plugins/plugin-pool");
|
13
14
|
/**
|
14
15
|
* Walks the workspace directory to create the `projectFileMap`, `ProjectConfigurations` and `allWorkspaceFiles`
|
15
16
|
* @throws
|
@@ -41,22 +42,16 @@ exports.retrieveWorkspaceFiles = retrieveWorkspaceFiles;
|
|
41
42
|
* @param nxJson
|
42
43
|
*/
|
43
44
|
async function retrieveProjectConfigurations(workspaceRoot, nxJson) {
|
44
|
-
const plugins = await (0,
|
45
|
-
|
46
|
-
if (!global.NX_GRAPH_CREATION) {
|
47
|
-
await (0, plugin_pool_1.shutdownPluginWorkers)();
|
48
|
-
}
|
49
|
-
return projects;
|
45
|
+
const plugins = await (0, nx_plugin_1.loadNxPlugins)(nxJson?.plugins ?? [], (0, installation_directory_1.getNxRequirePaths)(workspaceRoot), workspaceRoot);
|
46
|
+
return _retrieveProjectConfigurations(workspaceRoot, nxJson, plugins);
|
50
47
|
}
|
51
48
|
exports.retrieveProjectConfigurations = retrieveProjectConfigurations;
|
52
49
|
async function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot, nxJson) {
|
53
|
-
const
|
50
|
+
const plugins = await (0, nx_plugin_1.loadNxPlugins)(nxJson?.plugins ?? [], (0, installation_directory_1.getNxRequirePaths)(workspaceRoot), workspaceRoot);
|
54
51
|
if ((0, angular_json_1.shouldMergeAngularProjects)(workspaceRoot, true) &&
|
55
|
-
!
|
56
|
-
|
57
|
-
pluginsToLoad.push((0, path_1.join)(__dirname, '../../adapter/angular-json'));
|
52
|
+
!plugins.some((p) => p.plugin.name === angular_json_1.NX_ANGULAR_JSON_PLUGIN_NAME)) {
|
53
|
+
plugins.push({ plugin: angular_json_1.NxAngularJsonPlugin });
|
58
54
|
}
|
59
|
-
const plugins = await (0, internal_api_1.loadNxPlugins)(nxJson?.plugins ?? [], workspaceRoot);
|
60
55
|
return _retrieveProjectConfigurations(workspaceRoot, nxJson, plugins);
|
61
56
|
}
|
62
57
|
exports.retrieveProjectConfigurationsWithAngularProjects = retrieveProjectConfigurationsWithAngularProjects;
|
@@ -74,14 +69,17 @@ const projectsWithoutPluginCache = new Map();
|
|
74
69
|
// TODO: This function is called way too often, it should be optimized without this cache
|
75
70
|
async function retrieveProjectConfigurationsWithoutPluginInference(root) {
|
76
71
|
const nxJson = (0, nx_json_1.readNxJson)(root);
|
77
|
-
const plugins = await (0,
|
72
|
+
const plugins = await (0, nx_plugin_1.getDefaultPlugins)(root);
|
78
73
|
const projectGlobPatterns = retrieveProjectConfigurationPaths(root, plugins);
|
79
74
|
const cacheKey = root + ',' + projectGlobPatterns.join(',');
|
80
75
|
if (projectsWithoutPluginCache.has(cacheKey)) {
|
81
76
|
return projectsWithoutPluginCache.get(cacheKey);
|
82
77
|
}
|
83
78
|
const projectFiles = (0, workspace_context_1.globWithWorkspaceContext)(root, projectGlobPatterns);
|
84
|
-
const { projects } = await createProjectConfigurations(root, nxJson, projectFiles,
|
79
|
+
const { projects } = await createProjectConfigurations(root, nxJson, projectFiles, [
|
80
|
+
{ plugin: (0, package_json_workspaces_1.getNxPackageJsonWorkspacesPlugin)(root) },
|
81
|
+
{ plugin: project_json_1.ProjectJsonProjectsPlugin },
|
82
|
+
]);
|
85
83
|
projectsWithoutPluginCache.set(cacheKey, projects);
|
86
84
|
return projects;
|
87
85
|
}
|
@@ -101,7 +99,7 @@ async function createProjectConfigurations(workspaceRoot, nxJson, configFiles, p
|
|
101
99
|
exports.createProjectConfigurations = createProjectConfigurations;
|
102
100
|
function configurationGlobs(plugins) {
|
103
101
|
const globPatterns = [];
|
104
|
-
for (const plugin of plugins) {
|
102
|
+
for (const { plugin } of plugins) {
|
105
103
|
if (plugin.createNodes) {
|
106
104
|
globPatterns.push(plugin.createNodes[0]);
|
107
105
|
}
|
package/src/utils/logger.d.ts
CHANGED
package/src/utils/logger.js
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import { ProjectConfiguration } from '
|
4
|
-
import { NxJsonConfiguration } from '
|
5
|
-
import {
|
1
|
+
import { FileMap, ProjectGraph, ProjectGraphExternalNode } from '../config/project-graph';
|
2
|
+
import { PackageJson } from './package-json';
|
3
|
+
import { ProjectConfiguration } from '../config/workspace-json-project-json';
|
4
|
+
import { NxJsonConfiguration, PluginConfiguration } from '../config/nx-json';
|
5
|
+
import { NxPluginV1 } from './nx-plugin.deprecated';
|
6
|
+
import { RawProjectGraphDependency } from '../project-graph/project-graph-builder';
|
6
7
|
/**
|
7
8
|
* Context for {@link CreateNodesFunction}
|
8
9
|
*/
|
@@ -15,7 +16,6 @@ export interface CreateNodesContext {
|
|
15
16
|
* Used for creating nodes for the {@link ProjectGraph}
|
16
17
|
*/
|
17
18
|
export type CreateNodesFunction<T = unknown> = (projectConfigurationFile: string, options: T | undefined, context: CreateNodesContext) => CreateNodesResult | Promise<CreateNodesResult>;
|
18
|
-
export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
19
19
|
export interface CreateNodesResult {
|
20
20
|
/**
|
21
21
|
* A map of project root -> project configuration
|
@@ -73,13 +73,47 @@ export type NxPluginV2<TOptions = unknown> = {
|
|
73
73
|
* Provides a file pattern and function that retrieves configuration info from
|
74
74
|
* those files. e.g. { '**\/*.csproj': buildProjectsFromCsProjFile }
|
75
75
|
*/
|
76
|
-
createNodes?: CreateNodes
|
76
|
+
createNodes?: CreateNodes;
|
77
77
|
/**
|
78
78
|
* Provides a function to analyze files to create dependencies for the {@link ProjectGraph}
|
79
79
|
*/
|
80
80
|
createDependencies?: CreateDependencies<TOptions>;
|
81
81
|
};
|
82
|
+
export * from './nx-plugin.deprecated';
|
82
83
|
/**
|
83
84
|
* A plugin for Nx
|
84
85
|
*/
|
85
86
|
export type NxPlugin = NxPluginV1 | NxPluginV2;
|
87
|
+
export type LoadedNxPlugin = {
|
88
|
+
plugin: NxPluginV2 & Pick<NxPluginV1, 'processProjectGraph'>;
|
89
|
+
options?: unknown;
|
90
|
+
};
|
91
|
+
export declare const nxPluginCache: Map<string, LoadedNxPlugin['plugin']>;
|
92
|
+
export declare function getPluginPathAndName(moduleName: string, paths: string[], projects: Record<string, ProjectConfiguration>, root: string): {
|
93
|
+
pluginPath: string;
|
94
|
+
name: any;
|
95
|
+
};
|
96
|
+
export declare function loadNxPluginAsync(pluginConfiguration: PluginConfiguration, paths: string[], projects: Record<string, ProjectConfiguration>, root: string): Promise<LoadedNxPlugin>;
|
97
|
+
export declare function loadNxPlugins(plugins: PluginConfiguration[], paths?: string[], root?: string, projects?: Record<string, ProjectConfiguration>): Promise<LoadedNxPlugin[]>;
|
98
|
+
export declare function ensurePluginIsV2(plugin: NxPlugin): NxPluginV2;
|
99
|
+
export declare function isNxPluginV2(plugin: NxPlugin): plugin is NxPluginV2;
|
100
|
+
export declare function isNxPluginV1(plugin: NxPlugin): plugin is NxPluginV1;
|
101
|
+
export declare function readPluginPackageJson(pluginName: string, projects: Record<string, ProjectConfiguration>, paths?: string[]): {
|
102
|
+
path: string;
|
103
|
+
json: PackageJson;
|
104
|
+
};
|
105
|
+
export declare function resolveLocalNxPlugin(importPath: string, nxJsonConfiguration: NxJsonConfiguration, projects: Record<string, ProjectConfiguration>, root?: string): {
|
106
|
+
path: string;
|
107
|
+
projectConfig: ProjectConfiguration;
|
108
|
+
} | null;
|
109
|
+
/**
|
110
|
+
* Register swc-node or ts-node if they are not currently registered
|
111
|
+
* with some default settings which work well for Nx plugins.
|
112
|
+
*/
|
113
|
+
export declare function registerPluginTSTranspiler(): void;
|
114
|
+
/**
|
115
|
+
* Unregister the ts-node transpiler if it is registered
|
116
|
+
*/
|
117
|
+
export declare function unregisterPluginTSTranspiler(): void;
|
118
|
+
export declare function getDefaultPlugins(root: string): Promise<LoadedNxPlugin[]>;
|
119
|
+
type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { ProjectGraphProcessor } from '../config/project-graph';
|
2
2
|
import { TargetConfiguration } from '../config/workspace-json-project-json';
|
3
|
-
import {
|
3
|
+
import { LoadedNxPlugin } from './nx-plugin';
|
4
4
|
/**
|
5
5
|
* @deprecated Add targets to the projects in a {@link CreateNodes} function instead. This will be removed in Nx 19
|
6
6
|
*/
|
@@ -28,6 +28,4 @@ export type NxPluginV1 = {
|
|
28
28
|
/**
|
29
29
|
* @todo(@agentender) v19: Remove this fn when we remove readWorkspaceConfig
|
30
30
|
*/
|
31
|
-
export declare function getDefaultPluginsSync(root: string):
|
32
|
-
plugin: NxPluginV2;
|
33
|
-
}[];
|
31
|
+
export declare function getDefaultPluginsSync(root: string): LoadedNxPlugin[];
|
@@ -4,7 +4,7 @@ exports.getDefaultPluginsSync = void 0;
|
|
4
4
|
const angular_json_1 = require("../adapter/angular-json");
|
5
5
|
const project_json_1 = require("../plugins/project-json/build-nodes/project-json");
|
6
6
|
const target_defaults_plugin_1 = require("../plugins/target-defaults/target-defaults-plugin");
|
7
|
-
const
|
7
|
+
const package_json_workspaces_1 = require("../plugins/package-json-workspaces");
|
8
8
|
/**
|
9
9
|
* @todo(@agentender) v19: Remove this fn when we remove readWorkspaceConfig
|
10
10
|
*/
|
@@ -14,9 +14,9 @@ function getDefaultPluginsSync(root) {
|
|
14
14
|
...((0, angular_json_1.shouldMergeAngularProjects)(root, false)
|
15
15
|
? [require('../adapter/angular-json').NxAngularJsonPlugin]
|
16
16
|
: []),
|
17
|
-
target_defaults_plugin_1.
|
18
|
-
|
19
|
-
project_json_1.
|
17
|
+
target_defaults_plugin_1.TargetDefaultsPlugin,
|
18
|
+
(0, package_json_workspaces_1.getNxPackageJsonWorkspacesPlugin)(root),
|
19
|
+
project_json_1.ProjectJsonProjectsPlugin,
|
20
20
|
];
|
21
21
|
return plugins.map((p) => ({
|
22
22
|
plugin: p,
|