nx 18.3.0-canary.20240406-a9e554f → 18.3.0-canary.20240410-7a7cbec
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/bin/post-install.js +7 -5
- package/package.json +12 -12
- package/src/adapter/angular-json.d.ts +2 -1
- package/src/adapter/angular-json.js +1 -0
- 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/nx-json.d.ts +2 -1
- package/src/config/schema-utils.js +2 -2
- package/src/daemon/server/plugins.d.ts +3 -0
- package/src/daemon/server/plugins.js +22 -0
- package/src/daemon/server/project-graph-incremental-recomputation.js +10 -9
- package/src/daemon/server/shutdown-utils.js +2 -0
- package/src/devkit-exports.d.ts +3 -2
- package/src/executors/run-commands/run-commands.impl.js +1 -1
- package/src/executors/utils/convert-nx-executor.js +4 -1
- package/src/generators/utils/project-configuration.js +2 -2
- package/src/migrations/update-15-1-0/set-project-names.js +4 -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/package-json-workspaces/create-nodes.d.ts +2 -2
- package/src/plugins/package-json-workspaces/create-nodes.js +24 -31
- package/src/plugins/package-json-workspaces/index.d.ts +1 -0
- package/src/plugins/package-json-workspaces/index.js +2 -0
- package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.d.ts +2 -1
- package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.js +1 -0
- package/src/plugins/project-json/build-nodes/project-json.d.ts +2 -1
- package/src/plugins/project-json/build-nodes/project-json.js +1 -0
- package/src/plugins/target-defaults/symbols.d.ts +17 -0
- package/src/plugins/target-defaults/symbols.js +20 -0
- package/src/plugins/target-defaults/target-defaults-plugin.d.ts +2 -18
- package/src/plugins/target-defaults/target-defaults-plugin.js +5 -20
- package/src/project-graph/affected/locators/project-glob-changes.js +3 -3
- package/src/project-graph/build-project-graph.d.ts +2 -1
- package/src/project-graph/build-project-graph.js +11 -13
- package/src/project-graph/error-types.d.ts +34 -0
- package/src/project-graph/error-types.js +65 -0
- package/src/project-graph/file-utils.js +3 -3
- package/src/project-graph/plugins/index.d.ts +2 -0
- package/src/project-graph/plugins/index.js +8 -0
- package/src/project-graph/plugins/internal-api.d.ts +28 -0
- package/src/project-graph/plugins/internal-api.js +85 -0
- package/src/project-graph/plugins/isolation/index.d.ts +3 -0
- package/src/project-graph/plugins/isolation/index.js +16 -0
- package/src/project-graph/plugins/isolation/messaging.d.ts +94 -0
- package/src/project-graph/plugins/isolation/messaging.js +23 -0
- package/src/project-graph/plugins/isolation/plugin-pool.d.ts +3 -0
- package/src/project-graph/plugins/isolation/plugin-pool.js +189 -0
- package/src/project-graph/plugins/isolation/plugin-worker.d.ts +1 -0
- package/src/project-graph/plugins/isolation/plugin-worker.js +81 -0
- package/src/project-graph/plugins/loader.d.ts +24 -0
- package/src/project-graph/plugins/loader.js +206 -0
- package/src/{utils/nx-plugin.d.ts → project-graph/plugins/public-api.d.ts} +8 -44
- package/src/project-graph/plugins/public-api.js +4 -0
- package/src/project-graph/plugins/utils.d.ts +7 -0
- package/src/project-graph/plugins/utils.js +88 -0
- package/src/project-graph/project-graph-builder.d.ts +1 -1
- package/src/project-graph/project-graph.d.ts +3 -2
- package/src/project-graph/project-graph.js +9 -7
- package/src/project-graph/utils/normalize-project-nodes.d.ts +1 -1
- package/src/project-graph/utils/project-configuration-utils.d.ts +3 -26
- package/src/project-graph/utils/project-configuration-utils.js +29 -97
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +8 -7
- package/src/project-graph/utils/retrieve-workspace-files.js +18 -21
- package/src/utils/logger.d.ts +1 -0
- package/src/utils/logger.js +5 -0
- package/src/utils/nx-plugin.deprecated.d.ts +2 -2
- package/src/utils/nx-plugin.deprecated.js +5 -7
- package/src/utils/plugins/plugin-capabilities.d.ts +1 -1
- package/src/utils/plugins/plugin-capabilities.js +18 -12
- package/src/utils/nx-plugin.js +0 -309
@@ -1,15 +1,16 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.listPluginCapabilities = exports.getPluginCapabilities = void 0;
|
4
|
-
const workspace_root_1 = require("../workspace-root");
|
5
4
|
const chalk = require("chalk");
|
6
5
|
const path_1 = require("path");
|
7
|
-
const
|
8
|
-
const
|
6
|
+
const plugins_1 = require("../../project-graph/plugins");
|
7
|
+
const loader_1 = require("../../project-graph/plugins/loader");
|
9
8
|
const fileutils_1 = require("../fileutils");
|
10
|
-
const package_manager_1 = require("../package-manager");
|
11
|
-
const nx_plugin_1 = require("../nx-plugin");
|
12
9
|
const installation_directory_1 = require("../installation-directory");
|
10
|
+
const output_1 = require("../output");
|
11
|
+
const package_manager_1 = require("../package-manager");
|
12
|
+
const workspace_root_1 = require("../workspace-root");
|
13
|
+
const shared_1 = require("./shared");
|
13
14
|
function tryGetCollection(packageJsonPath, collectionFile, propName) {
|
14
15
|
if (!collectionFile) {
|
15
16
|
return null;
|
@@ -24,9 +25,9 @@ function tryGetCollection(packageJsonPath, collectionFile, propName) {
|
|
24
25
|
}
|
25
26
|
async function getPluginCapabilities(workspaceRoot, pluginName, projects, includeRuntimeCapabilities = false) {
|
26
27
|
try {
|
27
|
-
const { json: packageJson, path: packageJsonPath } = await (0,
|
28
|
+
const { json: packageJson, path: packageJsonPath } = await (0, plugins_1.readPluginPackageJson)(pluginName, projects, (0, installation_directory_1.getNxRequirePaths)(workspaceRoot));
|
28
29
|
const pluginModule = includeRuntimeCapabilities
|
29
|
-
? await tryGetModule(packageJson, workspaceRoot
|
30
|
+
? await tryGetModule(packageJson, workspaceRoot)
|
30
31
|
: {};
|
31
32
|
return {
|
32
33
|
name: pluginName,
|
@@ -56,17 +57,22 @@ async function getPluginCapabilities(workspaceRoot, pluginName, projects, includ
|
|
56
57
|
}
|
57
58
|
}
|
58
59
|
exports.getPluginCapabilities = getPluginCapabilities;
|
59
|
-
async function tryGetModule(packageJson, workspaceRoot
|
60
|
+
async function tryGetModule(packageJson, workspaceRoot) {
|
60
61
|
try {
|
61
|
-
|
62
|
+
if (packageJson.generators ??
|
62
63
|
packageJson.executors ??
|
63
64
|
packageJson['nx-migrations'] ??
|
64
65
|
packageJson['schematics'] ??
|
65
|
-
packageJson['builders'])
|
66
|
-
|
67
|
-
|
66
|
+
packageJson['builders']) {
|
67
|
+
const [pluginPromise] = (0, loader_1.loadNxPlugin)(packageJson.name, workspaceRoot);
|
68
|
+
const plugin = await pluginPromise;
|
69
|
+
return plugin;
|
70
|
+
}
|
71
|
+
else {
|
72
|
+
return {
|
68
73
|
name: packageJson.name,
|
69
74
|
};
|
75
|
+
}
|
70
76
|
}
|
71
77
|
catch {
|
72
78
|
return null;
|
package/src/utils/nx-plugin.js
DELETED
@@ -1,309 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getDefaultPlugins = exports.unregisterPluginTSTranspiler = exports.registerPluginTSTranspiler = exports.resolveLocalNxPlugin = exports.readPluginPackageJson = exports.isNxPluginV1 = exports.isNxPluginV2 = exports.ensurePluginIsV2 = exports.loadNxPlugins = exports.loadNxPluginAsync = exports.getPluginPathAndName = exports.nxPluginCache = void 0;
|
4
|
-
const tslib_1 = require("tslib");
|
5
|
-
const fs_1 = require("fs");
|
6
|
-
const path = require("path");
|
7
|
-
const workspaces_1 = require("../config/workspaces");
|
8
|
-
const workspace_root_1 = require("./workspace-root");
|
9
|
-
const fileutils_1 = require("../utils/fileutils");
|
10
|
-
const package_json_1 = require("./package-json");
|
11
|
-
const register_1 = require("../plugins/js/utils/register");
|
12
|
-
const logger_1 = require("./logger");
|
13
|
-
const find_project_for_path_1 = require("../project-graph/utils/find-project-for-path");
|
14
|
-
const path_1 = require("./path");
|
15
|
-
const path_2 = require("path");
|
16
|
-
const installation_directory_1 = require("./installation-directory");
|
17
|
-
const typescript_1 = require("../plugins/js/utils/typescript");
|
18
|
-
const nx_json_1 = require("../config/nx-json");
|
19
|
-
const globs_1 = require("./globs");
|
20
|
-
const angular_json_1 = require("../adapter/angular-json");
|
21
|
-
const package_json_workspaces_1 = require("../plugins/package-json-workspaces");
|
22
|
-
const project_json_1 = require("../plugins/project-json/build-nodes/project-json");
|
23
|
-
const package_json_next_to_project_json_1 = require("../plugins/project-json/build-nodes/package-json-next-to-project-json");
|
24
|
-
const retrieve_workspace_files_1 = require("../project-graph/utils/retrieve-workspace-files");
|
25
|
-
const target_defaults_plugin_1 = require("../plugins/target-defaults/target-defaults-plugin");
|
26
|
-
tslib_1.__exportStar(require("./nx-plugin.deprecated"), exports);
|
27
|
-
// Short lived cache (cleared between cmd runs)
|
28
|
-
// holding resolved nx plugin objects.
|
29
|
-
// Allows loadNxPlugins to be called multiple times w/o
|
30
|
-
// executing resolution mulitple times.
|
31
|
-
exports.nxPluginCache = new Map();
|
32
|
-
function getPluginPathAndName(moduleName, paths, projects, root) {
|
33
|
-
let pluginPath;
|
34
|
-
try {
|
35
|
-
pluginPath = require.resolve(moduleName, {
|
36
|
-
paths,
|
37
|
-
});
|
38
|
-
}
|
39
|
-
catch (e) {
|
40
|
-
if (e.code === 'MODULE_NOT_FOUND') {
|
41
|
-
const plugin = resolveLocalNxPlugin(moduleName, (0, nx_json_1.readNxJson)(root), projects, root);
|
42
|
-
if (plugin) {
|
43
|
-
const main = readPluginMainFromProjectConfiguration(plugin.projectConfig);
|
44
|
-
pluginPath = main ? path.join(root, main) : plugin.path;
|
45
|
-
}
|
46
|
-
else {
|
47
|
-
logger_1.logger.error(`Plugin listed in \`nx.json\` not found: ${moduleName}`);
|
48
|
-
throw e;
|
49
|
-
}
|
50
|
-
}
|
51
|
-
else {
|
52
|
-
throw e;
|
53
|
-
}
|
54
|
-
}
|
55
|
-
const packageJsonPath = path.join(pluginPath, 'package.json');
|
56
|
-
const extension = path.extname(pluginPath);
|
57
|
-
// Register the ts-transpiler if we are pointing to a
|
58
|
-
// plain ts file that's not part of a plugin project
|
59
|
-
if (extension === '.ts' && !tsNodeAndPathsUnregisterCallback) {
|
60
|
-
registerPluginTSTranspiler();
|
61
|
-
}
|
62
|
-
const { name } = !['.ts', '.js'].some((x) => x === extension) && // Not trying to point to a ts or js file
|
63
|
-
(0, fs_1.existsSync)(packageJsonPath) // plugin has a package.json
|
64
|
-
? (0, fileutils_1.readJsonFile)(packageJsonPath) // read name from package.json
|
65
|
-
: { name: moduleName };
|
66
|
-
return { pluginPath, name };
|
67
|
-
}
|
68
|
-
exports.getPluginPathAndName = getPluginPathAndName;
|
69
|
-
async function loadNxPluginAsync(pluginConfiguration, paths, projects, root) {
|
70
|
-
const { plugin: moduleName, options } = typeof pluginConfiguration === 'object'
|
71
|
-
? pluginConfiguration
|
72
|
-
: { plugin: pluginConfiguration, options: undefined };
|
73
|
-
let pluginModule = exports.nxPluginCache.get(moduleName);
|
74
|
-
const include = typeof pluginConfiguration === 'object'
|
75
|
-
? pluginConfiguration.include
|
76
|
-
: undefined;
|
77
|
-
const exclude = typeof pluginConfiguration === 'object'
|
78
|
-
? pluginConfiguration.exclude
|
79
|
-
: undefined;
|
80
|
-
if (pluginModule) {
|
81
|
-
return {
|
82
|
-
plugin: pluginModule,
|
83
|
-
options,
|
84
|
-
include,
|
85
|
-
exclude,
|
86
|
-
};
|
87
|
-
}
|
88
|
-
performance.mark(`Load Nx Plugin: ${moduleName} - start`);
|
89
|
-
let { pluginPath, name } = await getPluginPathAndName(moduleName, paths, projects, root);
|
90
|
-
const plugin = ensurePluginIsV2((await Promise.resolve(`${pluginPath}`).then(s => require(s))));
|
91
|
-
plugin.name ??= name;
|
92
|
-
exports.nxPluginCache.set(moduleName, plugin);
|
93
|
-
performance.mark(`Load Nx Plugin: ${moduleName} - end`);
|
94
|
-
performance.measure(`Load Nx Plugin: ${moduleName}`, `Load Nx Plugin: ${moduleName} - start`, `Load Nx Plugin: ${moduleName} - end`);
|
95
|
-
return {
|
96
|
-
plugin,
|
97
|
-
options,
|
98
|
-
include,
|
99
|
-
exclude,
|
100
|
-
};
|
101
|
-
}
|
102
|
-
exports.loadNxPluginAsync = loadNxPluginAsync;
|
103
|
-
async function loadNxPlugins(plugins, paths = (0, installation_directory_1.getNxRequirePaths)(), root = workspace_root_1.workspaceRoot, projects) {
|
104
|
-
const result = [
|
105
|
-
{ plugin: package_json_next_to_project_json_1.PackageJsonProjectsNextToProjectJsonPlugin },
|
106
|
-
];
|
107
|
-
plugins ??= [];
|
108
|
-
// When loading plugins for `createNodes`, we don't know what projects exist yet.
|
109
|
-
// Try resolving plugins
|
110
|
-
for (const plugin of plugins) {
|
111
|
-
try {
|
112
|
-
require.resolve(typeof plugin === 'string' ? plugin : plugin.plugin);
|
113
|
-
}
|
114
|
-
catch {
|
115
|
-
// If a plugin cannot be resolved, we will need projects to resolve it
|
116
|
-
projects ??= await (0, retrieve_workspace_files_1.retrieveProjectConfigurationsWithoutPluginInference)(root);
|
117
|
-
break;
|
118
|
-
}
|
119
|
-
}
|
120
|
-
for (const plugin of plugins) {
|
121
|
-
result.push(await loadNxPluginAsync(plugin, paths, projects, root));
|
122
|
-
}
|
123
|
-
// We push the nx core node plugins onto the end, s.t. it overwrites any other plugins
|
124
|
-
result.push(...(await getDefaultPlugins(root)));
|
125
|
-
return result;
|
126
|
-
}
|
127
|
-
exports.loadNxPlugins = loadNxPlugins;
|
128
|
-
function ensurePluginIsV2(plugin) {
|
129
|
-
if (isNxPluginV2(plugin)) {
|
130
|
-
return plugin;
|
131
|
-
}
|
132
|
-
if (isNxPluginV1(plugin) && plugin.projectFilePatterns) {
|
133
|
-
return {
|
134
|
-
...plugin,
|
135
|
-
createNodes: [
|
136
|
-
`*/**/${(0, globs_1.combineGlobPatterns)(plugin.projectFilePatterns)}`,
|
137
|
-
(configFilePath) => {
|
138
|
-
const root = (0, path_2.dirname)(configFilePath);
|
139
|
-
return {
|
140
|
-
projects: {
|
141
|
-
[root]: {
|
142
|
-
name: (0, workspaces_1.toProjectName)(configFilePath),
|
143
|
-
root,
|
144
|
-
targets: plugin.registerProjectTargets?.(configFilePath),
|
145
|
-
},
|
146
|
-
},
|
147
|
-
};
|
148
|
-
},
|
149
|
-
],
|
150
|
-
};
|
151
|
-
}
|
152
|
-
return plugin;
|
153
|
-
}
|
154
|
-
exports.ensurePluginIsV2 = ensurePluginIsV2;
|
155
|
-
function isNxPluginV2(plugin) {
|
156
|
-
return 'createNodes' in plugin || 'createDependencies' in plugin;
|
157
|
-
}
|
158
|
-
exports.isNxPluginV2 = isNxPluginV2;
|
159
|
-
function isNxPluginV1(plugin) {
|
160
|
-
return 'processProjectGraph' in plugin || 'projectFilePatterns' in plugin;
|
161
|
-
}
|
162
|
-
exports.isNxPluginV1 = isNxPluginV1;
|
163
|
-
function readPluginPackageJson(pluginName, projects, paths = (0, installation_directory_1.getNxRequirePaths)()) {
|
164
|
-
try {
|
165
|
-
const result = (0, package_json_1.readModulePackageJsonWithoutFallbacks)(pluginName, paths);
|
166
|
-
return {
|
167
|
-
json: result.packageJson,
|
168
|
-
path: result.path,
|
169
|
-
};
|
170
|
-
}
|
171
|
-
catch (e) {
|
172
|
-
if (e.code === 'MODULE_NOT_FOUND') {
|
173
|
-
const nxJson = (0, nx_json_1.readNxJson)();
|
174
|
-
const localPluginPath = resolveLocalNxPlugin(pluginName, nxJson, projects);
|
175
|
-
if (localPluginPath) {
|
176
|
-
const localPluginPackageJson = path.join(localPluginPath.path, 'package.json');
|
177
|
-
return {
|
178
|
-
path: localPluginPackageJson,
|
179
|
-
json: (0, fileutils_1.readJsonFile)(localPluginPackageJson),
|
180
|
-
};
|
181
|
-
}
|
182
|
-
}
|
183
|
-
throw e;
|
184
|
-
}
|
185
|
-
}
|
186
|
-
exports.readPluginPackageJson = readPluginPackageJson;
|
187
|
-
/**
|
188
|
-
* Builds a plugin package and returns the path to output
|
189
|
-
* @param importPath What is the import path that refers to a potential plugin?
|
190
|
-
* @returns The path to the built plugin, or null if it doesn't exist
|
191
|
-
*/
|
192
|
-
const localPluginCache = {};
|
193
|
-
function resolveLocalNxPlugin(importPath, nxJsonConfiguration, projects, root = workspace_root_1.workspaceRoot) {
|
194
|
-
localPluginCache[importPath] ??= lookupLocalPlugin(importPath, nxJsonConfiguration, projects, root);
|
195
|
-
return localPluginCache[importPath];
|
196
|
-
}
|
197
|
-
exports.resolveLocalNxPlugin = resolveLocalNxPlugin;
|
198
|
-
let tsNodeAndPathsUnregisterCallback = undefined;
|
199
|
-
/**
|
200
|
-
* Register swc-node or ts-node if they are not currently registered
|
201
|
-
* with some default settings which work well for Nx plugins.
|
202
|
-
*/
|
203
|
-
function registerPluginTSTranspiler() {
|
204
|
-
if (!tsNodeAndPathsUnregisterCallback) {
|
205
|
-
// nx-ignore-next-line
|
206
|
-
const ts = require('typescript');
|
207
|
-
// Get the first tsconfig that matches the allowed set
|
208
|
-
const tsConfigName = [
|
209
|
-
(0, path_2.join)(workspace_root_1.workspaceRoot, 'tsconfig.base.json'),
|
210
|
-
(0, path_2.join)(workspace_root_1.workspaceRoot, 'tsconfig.json'),
|
211
|
-
].find((x) => (0, fs_1.existsSync)(x));
|
212
|
-
const tsConfig = tsConfigName
|
213
|
-
? (0, typescript_1.readTsConfig)(tsConfigName)
|
214
|
-
: {};
|
215
|
-
const unregisterTsConfigPaths = (0, register_1.registerTsConfigPaths)(tsConfigName);
|
216
|
-
const unregisterTranspiler = (0, register_1.registerTranspiler)({
|
217
|
-
experimentalDecorators: true,
|
218
|
-
emitDecoratorMetadata: true,
|
219
|
-
...tsConfig.options,
|
220
|
-
});
|
221
|
-
tsNodeAndPathsUnregisterCallback = () => {
|
222
|
-
unregisterTsConfigPaths();
|
223
|
-
unregisterTranspiler();
|
224
|
-
};
|
225
|
-
}
|
226
|
-
}
|
227
|
-
exports.registerPluginTSTranspiler = registerPluginTSTranspiler;
|
228
|
-
/**
|
229
|
-
* Unregister the ts-node transpiler if it is registered
|
230
|
-
*/
|
231
|
-
function unregisterPluginTSTranspiler() {
|
232
|
-
if (tsNodeAndPathsUnregisterCallback) {
|
233
|
-
tsNodeAndPathsUnregisterCallback();
|
234
|
-
tsNodeAndPathsUnregisterCallback = undefined;
|
235
|
-
}
|
236
|
-
}
|
237
|
-
exports.unregisterPluginTSTranspiler = unregisterPluginTSTranspiler;
|
238
|
-
function lookupLocalPlugin(importPath, nxJsonConfiguration, projects, root = workspace_root_1.workspaceRoot) {
|
239
|
-
const plugin = findNxProjectForImportPath(importPath, projects, root);
|
240
|
-
if (!plugin) {
|
241
|
-
return null;
|
242
|
-
}
|
243
|
-
if (!tsNodeAndPathsUnregisterCallback) {
|
244
|
-
registerPluginTSTranspiler();
|
245
|
-
}
|
246
|
-
const projectConfig = projects[plugin];
|
247
|
-
return { path: path.join(root, projectConfig.root), projectConfig };
|
248
|
-
}
|
249
|
-
function findNxProjectForImportPath(importPath, projects, root = workspace_root_1.workspaceRoot) {
|
250
|
-
const tsConfigPaths = readTsConfigPaths(root);
|
251
|
-
const possiblePaths = tsConfigPaths[importPath]?.map((p) => (0, path_1.normalizePath)(path.relative(root, path.join(root, p))));
|
252
|
-
if (possiblePaths?.length) {
|
253
|
-
const projectRootMappings = (0, find_project_for_path_1.createProjectRootMappingsFromProjectConfigurations)(projects);
|
254
|
-
for (const tsConfigPath of possiblePaths) {
|
255
|
-
const nxProject = (0, find_project_for_path_1.findProjectForPath)(tsConfigPath, projectRootMappings);
|
256
|
-
if (nxProject) {
|
257
|
-
return nxProject;
|
258
|
-
}
|
259
|
-
}
|
260
|
-
if (process.env.NX_VERBOSE_LOGGING) {
|
261
|
-
console.log('Unable to find local plugin', possiblePaths, projectRootMappings);
|
262
|
-
}
|
263
|
-
throw new Error('Unable to resolve local plugin with import path ' + importPath);
|
264
|
-
}
|
265
|
-
}
|
266
|
-
let tsconfigPaths;
|
267
|
-
function readTsConfigPaths(root = workspace_root_1.workspaceRoot) {
|
268
|
-
if (!tsconfigPaths) {
|
269
|
-
const tsconfigPath = ['tsconfig.base.json', 'tsconfig.json']
|
270
|
-
.map((x) => path.join(root, x))
|
271
|
-
.filter((x) => (0, fs_1.existsSync)(x))[0];
|
272
|
-
if (!tsconfigPath) {
|
273
|
-
throw new Error('unable to find tsconfig.base.json or tsconfig.json');
|
274
|
-
}
|
275
|
-
const { compilerOptions } = (0, fileutils_1.readJsonFile)(tsconfigPath);
|
276
|
-
tsconfigPaths = compilerOptions?.paths;
|
277
|
-
}
|
278
|
-
return tsconfigPaths ?? {};
|
279
|
-
}
|
280
|
-
function readPluginMainFromProjectConfiguration(plugin) {
|
281
|
-
const { main } = Object.values(plugin.targets).find((x) => [
|
282
|
-
'@nx/js:tsc',
|
283
|
-
'@nrwl/js:tsc',
|
284
|
-
'@nx/js:swc',
|
285
|
-
'@nrwl/js:swc',
|
286
|
-
'@nx/node:package',
|
287
|
-
'@nrwl/node:package',
|
288
|
-
].includes(x.executor))?.options ||
|
289
|
-
plugin.targets?.build?.options ||
|
290
|
-
{};
|
291
|
-
return main;
|
292
|
-
}
|
293
|
-
async function getDefaultPlugins(root) {
|
294
|
-
const plugins = [
|
295
|
-
await Promise.resolve().then(() => require('../plugins/js')),
|
296
|
-
target_defaults_plugin_1.TargetDefaultsPlugin,
|
297
|
-
...((0, angular_json_1.shouldMergeAngularProjects)(root, false)
|
298
|
-
? [
|
299
|
-
await Promise.resolve().then(() => require('../adapter/angular-json')).then((m) => m.NxAngularJsonPlugin),
|
300
|
-
]
|
301
|
-
: []),
|
302
|
-
(0, package_json_workspaces_1.getNxPackageJsonWorkspacesPlugin)(root),
|
303
|
-
project_json_1.ProjectJsonProjectsPlugin,
|
304
|
-
];
|
305
|
-
return plugins.map((p) => ({
|
306
|
-
plugin: p,
|
307
|
-
}));
|
308
|
-
}
|
309
|
-
exports.getDefaultPlugins = getDefaultPlugins;
|