nx 18.1.0-canary.20240309-235ca8c → 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/bin/post-install.js +5 -7
- 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 +7 -8
- package/src/daemon/server/shutdown-utils.js +0 -2
- package/src/devkit-exports.d.ts +1 -2
- package/src/executors/utils/convert-nx-executor.js +1 -4
- package/src/generators/utils/project-configuration.js +2 -2
- package/src/migrations/update-15-1-0/set-project-names.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 -3
- package/src/project-graph/build-project-graph.d.ts +1 -2
- package/src/project-graph/build-project-graph.js +13 -12
- 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 +15 -19
- 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 +55 -11
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +8 -6
- package/src/project-graph/utils/retrieve-workspace-files.js +21 -18
- 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 +9 -10
- package/src/daemon/server/plugins.d.ts +0 -3
- package/src/daemon/server/plugins.js +0 -22
- 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 -22
- package/src/project-graph/plugins/internal-api.js +0 -64
- 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 -3
- package/src/project-graph/plugins/plugin-pool.js +0 -189
- package/src/project-graph/plugins/plugin-worker.d.ts +0 -1
- package/src/project-graph/plugins/plugin-worker.js +0 -101
- 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 -28
- package/src/project-graph/plugins/worker-api.js +0 -195
package/bin/post-install.js
CHANGED
@@ -12,10 +12,10 @@ const nx_cloud_utils_1 = require("../src/utils/nx-cloud-utils");
|
|
12
12
|
const nx_json_1 = require("../src/config/nx-json");
|
13
13
|
const workspace_context_1 = require("../src/utils/workspace-context");
|
14
14
|
(async () => {
|
15
|
-
const start = new Date();
|
16
15
|
try {
|
17
16
|
(0, workspace_context_1.setupWorkspaceContext)(workspace_root_1.workspaceRoot);
|
18
17
|
if (isMainNxPackage() && (0, fileutils_1.fileExists)((0, path_1.join)(workspace_root_1.workspaceRoot, 'nx.json'))) {
|
18
|
+
const b = new Date();
|
19
19
|
(0, assert_supported_platform_1.assertSupportedPlatform)();
|
20
20
|
try {
|
21
21
|
await client_1.daemonClient.stop();
|
@@ -34,6 +34,10 @@ const workspace_context_1 = require("../src/utils/workspace-context");
|
|
34
34
|
}
|
35
35
|
});
|
36
36
|
}));
|
37
|
+
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
38
|
+
const a = new Date();
|
39
|
+
console.log(`Nx postinstall steps took ${a.getTime() - b.getTime()}ms`);
|
40
|
+
}
|
37
41
|
}
|
38
42
|
}
|
39
43
|
catch (e) {
|
@@ -41,12 +45,6 @@ const workspace_context_1 = require("../src/utils/workspace-context");
|
|
41
45
|
console.log(e);
|
42
46
|
}
|
43
47
|
}
|
44
|
-
finally {
|
45
|
-
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
46
|
-
const end = new Date();
|
47
|
-
console.log(`Nx postinstall steps took ${end.getTime() - start.getTime()}ms`);
|
48
|
-
}
|
49
|
-
}
|
50
48
|
})();
|
51
49
|
function isMainNxPackage() {
|
52
50
|
const mainNxPath = require.resolve('nx', {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "18.1.0-canary.
|
3
|
+
"version": "18.1.0-canary.20240312-9520aa2",
|
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": {
|
@@ -66,7 +66,7 @@
|
|
66
66
|
"yargs-parser": "21.1.1",
|
67
67
|
"node-machine-id": "1.1.12",
|
68
68
|
"ora": "5.3.0",
|
69
|
-
"@nrwl/tao": "18.1.0-canary.
|
69
|
+
"@nrwl/tao": "18.1.0-canary.20240312-9520aa2"
|
70
70
|
},
|
71
71
|
"peerDependencies": {
|
72
72
|
"@swc-node/register": "^1.8.0",
|
@@ -81,16 +81,16 @@
|
|
81
81
|
}
|
82
82
|
},
|
83
83
|
"optionalDependencies": {
|
84
|
-
"@nx/nx-darwin-x64": "18.1.0-canary.
|
85
|
-
"@nx/nx-darwin-arm64": "18.1.0-canary.
|
86
|
-
"@nx/nx-linux-x64-gnu": "18.1.0-canary.
|
87
|
-
"@nx/nx-linux-x64-musl": "18.1.0-canary.
|
88
|
-
"@nx/nx-win32-x64-msvc": "18.1.0-canary.
|
89
|
-
"@nx/nx-linux-arm64-gnu": "18.1.0-canary.
|
90
|
-
"@nx/nx-linux-arm64-musl": "18.1.0-canary.
|
91
|
-
"@nx/nx-linux-arm-gnueabihf": "18.1.0-canary.
|
92
|
-
"@nx/nx-win32-arm64-msvc": "18.1.0-canary.
|
93
|
-
"@nx/nx-freebsd-x64": "18.1.0-canary.
|
84
|
+
"@nx/nx-darwin-x64": "18.1.0-canary.20240312-9520aa2",
|
85
|
+
"@nx/nx-darwin-arm64": "18.1.0-canary.20240312-9520aa2",
|
86
|
+
"@nx/nx-linux-x64-gnu": "18.1.0-canary.20240312-9520aa2",
|
87
|
+
"@nx/nx-linux-x64-musl": "18.1.0-canary.20240312-9520aa2",
|
88
|
+
"@nx/nx-win32-x64-msvc": "18.1.0-canary.20240312-9520aa2",
|
89
|
+
"@nx/nx-linux-arm64-gnu": "18.1.0-canary.20240312-9520aa2",
|
90
|
+
"@nx/nx-linux-arm64-musl": "18.1.0-canary.20240312-9520aa2",
|
91
|
+
"@nx/nx-linux-arm-gnueabihf": "18.1.0-canary.20240312-9520aa2",
|
92
|
+
"@nx/nx-win32-arm64-msvc": "18.1.0-canary.20240312-9520aa2",
|
93
|
+
"@nx/nx-freebsd-x64": "18.1.0-canary.20240312-9520aa2"
|
94
94
|
},
|
95
95
|
"nx-migrations": {
|
96
96
|
"migrations": "./migrations.json",
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import { ProjectsConfigurations } from '../config/workspace-json-project-json';
|
2
|
-
import { NxPluginV2 } from '../
|
2
|
+
import { NxPluginV2 } from '../utils/nx-plugin';
|
3
3
|
export declare const NX_ANGULAR_JSON_PLUGIN_NAME = "nx-angular-json-plugin";
|
4
4
|
export declare const NxAngularJsonPlugin: NxPluginV2;
|
5
|
-
export default NxAngularJsonPlugin;
|
6
5
|
export declare function shouldMergeAngularProjects(root: string, includeProjectsFromAngularJson: boolean): boolean;
|
7
6
|
export declare function isAngularPluginInstalled(): boolean;
|
8
7
|
export declare function toNewFormat(w: any): ProjectsConfigurations;
|
@@ -14,7 +14,6 @@ exports.NxAngularJsonPlugin = {
|
|
14
14
|
}),
|
15
15
|
],
|
16
16
|
};
|
17
|
-
exports.default = exports.NxAngularJsonPlugin;
|
18
17
|
function shouldMergeAngularProjects(root, includeProjectsFromAngularJson) {
|
19
18
|
if ((0, fs_1.existsSync)(path.join(root, 'angular.json')) &&
|
20
19
|
// Include projects from angular.json if explicitly required.
|
@@ -19,7 +19,7 @@ const package_json_1 = require("../utils/package-json");
|
|
19
19
|
const package_manager_1 = require("../utils/package-manager");
|
20
20
|
const angular_json_1 = require("./angular-json");
|
21
21
|
const executor_utils_1 = require("../command-line/run/executor-utils");
|
22
|
-
const
|
22
|
+
const nx_plugin_1 = require("../utils/nx-plugin");
|
23
23
|
const schema_utils_1 = require("../config/schema-utils");
|
24
24
|
async function createBuilderContext(builderInfo, context) {
|
25
25
|
require('./compat');
|
@@ -146,7 +146,7 @@ function createNodeModulesEngineHost(resolvePaths, projects) {
|
|
146
146
|
collectionFilePath = require.resolve(name, { paths });
|
147
147
|
}
|
148
148
|
else {
|
149
|
-
const { json: { generators, schematics }, path: packageJsonPath, } = (0,
|
149
|
+
const { json: { generators, schematics }, path: packageJsonPath, } = (0, nx_plugin_1.readPluginPackageJson)(name, projects, paths);
|
150
150
|
if (!schematics && !generators) {
|
151
151
|
throw new Error(`The "${name}" package does not support Nx generators or Angular Devkit schematics.`);
|
152
152
|
}
|
@@ -802,7 +802,7 @@ async function getWrappedWorkspaceNodeModulesArchitectHost(workspace, root, proj
|
|
802
802
|
};
|
803
803
|
}
|
804
804
|
readExecutorsJson(nodeModule, builder) {
|
805
|
-
const { json: packageJson, path: packageJsonPath } = (0,
|
805
|
+
const { json: packageJson, path: packageJsonPath } = (0, nx_plugin_1.readPluginPackageJson)(nodeModule, this.projects, this.root ? [this.root, __dirname] : [__dirname]);
|
806
806
|
const executorsFile = packageJson.executors ?? packageJson.builders;
|
807
807
|
if (!executorsFile) {
|
808
808
|
throw new Error(`The "${nodeModule}" package does not support Nx executors or Angular Devkit Builders.`);
|
@@ -4,7 +4,7 @@ exports.readGeneratorsJson = exports.getGeneratorInformation = void 0;
|
|
4
4
|
const path_1 = require("path");
|
5
5
|
const schema_utils_1 = require("../../config/schema-utils");
|
6
6
|
const fileutils_1 = require("../../utils/fileutils");
|
7
|
-
const
|
7
|
+
const nx_plugin_1 = require("../../utils/nx-plugin");
|
8
8
|
function getGeneratorInformation(collectionName, generatorName, root, projects) {
|
9
9
|
try {
|
10
10
|
const { generatorsFilePath, generatorsJson, resolvedCollectionName, normalizedGeneratorName, } = readGeneratorsJson(collectionName, generatorName, root, projects);
|
@@ -48,7 +48,7 @@ function readGeneratorsJson(collectionName, generator, root, projects) {
|
|
48
48
|
});
|
49
49
|
}
|
50
50
|
else {
|
51
|
-
const { json: packageJson, path: packageJsonPath } = (0,
|
51
|
+
const { json: packageJson, path: packageJsonPath } = (0, nx_plugin_1.readPluginPackageJson)(collectionName, projects, root ? [root, __dirname] : [__dirname]);
|
52
52
|
const generatorsFile = packageJson.generators ?? packageJson.schematics;
|
53
53
|
if (!generatorsFile) {
|
54
54
|
throw new Error(`The "${collectionName}" package does not support Nx generators.`);
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.getExecutorInformation = exports.normalizeExecutorSchema = void 0;
|
4
4
|
const path_1 = require("path");
|
5
|
-
const
|
5
|
+
const nx_plugin_1 = require("../../utils/nx-plugin");
|
6
6
|
const fileutils_1 = require("../../utils/fileutils");
|
7
7
|
const schema_utils_1 = require("../../config/schema-utils");
|
8
8
|
const installation_directory_1 = require("../../utils/installation-directory");
|
@@ -55,7 +55,7 @@ function getExecutorInformation(nodeModule, executor, root, projects) {
|
|
55
55
|
}
|
56
56
|
exports.getExecutorInformation = getExecutorInformation;
|
57
57
|
function readExecutorJson(nodeModule, executor, root, projects) {
|
58
|
-
const { json: packageJson, path: packageJsonPath } = (0,
|
58
|
+
const { json: packageJson, path: packageJsonPath } = (0, nx_plugin_1.readPluginPackageJson)(nodeModule, projects, root
|
59
59
|
? [root, __dirname, process.cwd(), ...(0, installation_directory_1.getNxRequirePaths)()]
|
60
60
|
: [__dirname, process.cwd(), ...(0, installation_directory_1.getNxRequirePaths)()]);
|
61
61
|
const executorsFile = packageJson.executors ?? packageJson.builders;
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveSchema = exports.resolveImplementation = exports.getImplementationFactory = void 0;
|
4
4
|
const fs_1 = require("fs");
|
5
5
|
const path_1 = require("path");
|
6
|
-
const
|
6
|
+
const nx_plugin_1 = require("../utils/nx-plugin");
|
7
7
|
/**
|
8
8
|
* This function is used to get the implementation factory of an executor or generator.
|
9
9
|
* @param implementation path to the implementation
|
@@ -15,7 +15,7 @@ function getImplementationFactory(implementation, directory) {
|
|
15
15
|
return () => {
|
16
16
|
const modulePath = resolveImplementation(implementationModulePath, directory);
|
17
17
|
if ((0, path_1.extname)(modulePath) === '.ts') {
|
18
|
-
(0,
|
18
|
+
(0, nx_plugin_1.registerPluginTSTranspiler)();
|
19
19
|
}
|
20
20
|
const module = require(modulePath);
|
21
21
|
return implementationExportName
|
@@ -13,7 +13,6 @@ const workspace_context_1 = require("../../utils/workspace-context");
|
|
13
13
|
const workspace_root_1 = require("../../utils/workspace-root");
|
14
14
|
const file_watcher_sockets_1 = require("./file-watching/file-watcher-sockets");
|
15
15
|
const logger_1 = require("./logger");
|
16
|
-
const plugins_1 = require("./plugins");
|
17
16
|
let cachedSerializedProjectGraphPromise;
|
18
17
|
const collectedUpdatedFiles = new Set();
|
19
18
|
const collectedDeletedFiles = new Set();
|
@@ -31,16 +30,15 @@ async function getCachedSerializedProjectGraphPromise() {
|
|
31
30
|
// reset the wait time
|
32
31
|
waitPeriod = 100;
|
33
32
|
await resetInternalStateIfNxDepsMissing();
|
34
|
-
const plugins = await (0, plugins_1.getPlugins)();
|
35
33
|
if (collectedUpdatedFiles.size == 0 && collectedDeletedFiles.size == 0) {
|
36
34
|
if (!cachedSerializedProjectGraphPromise) {
|
37
35
|
cachedSerializedProjectGraphPromise =
|
38
|
-
processFilesAndCreateAndSerializeProjectGraph(
|
36
|
+
processFilesAndCreateAndSerializeProjectGraph();
|
39
37
|
}
|
40
38
|
}
|
41
39
|
else {
|
42
40
|
cachedSerializedProjectGraphPromise =
|
43
|
-
processFilesAndCreateAndSerializeProjectGraph(
|
41
|
+
processFilesAndCreateAndSerializeProjectGraph();
|
44
42
|
}
|
45
43
|
return await cachedSerializedProjectGraphPromise;
|
46
44
|
}
|
@@ -79,7 +77,7 @@ function addUpdatedAndDeletedFiles(createdFiles, updatedFiles, deletedFiles) {
|
|
79
77
|
waitPeriod = waitPeriod * 2;
|
80
78
|
}
|
81
79
|
cachedSerializedProjectGraphPromise =
|
82
|
-
processFilesAndCreateAndSerializeProjectGraph(
|
80
|
+
processFilesAndCreateAndSerializeProjectGraph();
|
83
81
|
await cachedSerializedProjectGraphPromise;
|
84
82
|
if (createdFiles.length > 0) {
|
85
83
|
(0, file_watcher_sockets_1.notifyFileWatcherSockets)(createdFiles, null, null);
|
@@ -127,7 +125,7 @@ async function processCollectedUpdatedAndDeletedFiles({ projects, externalNodes,
|
|
127
125
|
throw e;
|
128
126
|
}
|
129
127
|
}
|
130
|
-
async function processFilesAndCreateAndSerializeProjectGraph(
|
128
|
+
async function processFilesAndCreateAndSerializeProjectGraph() {
|
131
129
|
try {
|
132
130
|
perf_hooks_1.performance.mark('hash-watched-changes-start');
|
133
131
|
const updatedFiles = [...collectedUpdatedFiles.values()];
|
@@ -139,8 +137,9 @@ async function processFilesAndCreateAndSerializeProjectGraph(plugins) {
|
|
139
137
|
logger_1.serverLogger.requestLog([...updatedFiles.values()]);
|
140
138
|
logger_1.serverLogger.requestLog([...deletedFiles]);
|
141
139
|
const nxJson = (0, nx_json_1.readNxJson)(workspace_root_1.workspaceRoot);
|
140
|
+
// Set this globally to allow plugins to know if they are being called from the project graph creation
|
142
141
|
global.NX_GRAPH_CREATION = true;
|
143
|
-
const graphNodes = await (0, retrieve_workspace_files_1.retrieveProjectConfigurations)(
|
142
|
+
const graphNodes = await (0, retrieve_workspace_files_1.retrieveProjectConfigurations)(workspace_root_1.workspaceRoot, nxJson);
|
144
143
|
await processCollectedUpdatedAndDeletedFiles(graphNodes, updatedFileHashes, deletedFiles);
|
145
144
|
const g = createAndSerializeProjectGraph(graphNodes);
|
146
145
|
delete global.NX_GRAPH_CREATION;
|
@@ -177,7 +176,7 @@ async function createAndSerializeProjectGraph({ projects, sourceMaps, }) {
|
|
177
176
|
const fileMap = copyFileMap(exports.fileMapWithFiles.fileMap);
|
178
177
|
const allWorkspaceFiles = copyFileData(exports.fileMapWithFiles.allWorkspaceFiles);
|
179
178
|
const rustReferences = exports.fileMapWithFiles.rustReferences;
|
180
|
-
const { projectGraph, projectFileMapCache } = await (0, build_project_graph_1.buildProjectGraphUsingProjectFileMap)(projects, knownExternalNodes, fileMap, allWorkspaceFiles, rustReferences, exports.currentProjectFileMapCache || (0, nx_deps_cache_1.readFileMapCache)(), true
|
179
|
+
const { projectGraph, projectFileMapCache } = await (0, build_project_graph_1.buildProjectGraphUsingProjectFileMap)(projects, knownExternalNodes, fileMap, allWorkspaceFiles, rustReferences, exports.currentProjectFileMapCache || (0, nx_deps_cache_1.readFileMapCache)(), true);
|
181
180
|
exports.currentProjectFileMapCache = projectFileMapCache;
|
182
181
|
exports.currentProjectGraph = projectGraph;
|
183
182
|
perf_hooks_1.performance.mark('create-project-graph-end');
|
@@ -5,7 +5,6 @@ const workspace_root_1 = require("../../utils/workspace-root");
|
|
5
5
|
const logger_1 = require("./logger");
|
6
6
|
const socket_utils_1 = require("../socket-utils");
|
7
7
|
const cache_1 = require("../cache");
|
8
|
-
const plugins_1 = require("./plugins");
|
9
8
|
exports.SERVER_INACTIVITY_TIMEOUT_MS = 10800000; // 10800000 ms = 3 hours
|
10
9
|
let watcherInstance;
|
11
10
|
function storeWatcherInstance(instance) {
|
@@ -29,7 +28,6 @@ async function handleServerProcessTermination({ server, reason, }) {
|
|
29
28
|
try {
|
30
29
|
server.close();
|
31
30
|
(0, cache_1.deleteDaemonJsonProcessCache)();
|
32
|
-
(0, plugins_1.cleanupPlugins)();
|
33
31
|
if (watcherInstance) {
|
34
32
|
await watcherInstance.stop();
|
35
33
|
logger_1.serverLogger.watcherLog(`Stopping the watcher for ${workspace_root_1.workspaceRoot} (sources)`);
|
package/src/devkit-exports.d.ts
CHANGED
@@ -19,8 +19,7 @@ export type { Generator, GeneratorCallback, Executor, ExecutorContext, TaskGraph
|
|
19
19
|
*/
|
20
20
|
export { Workspaces } from './config/workspaces';
|
21
21
|
export { workspaceLayout } from './config/configuration';
|
22
|
-
export type { NxPlugin, NxPluginV2, CreateNodes, CreateNodesFunction, CreateNodesResult, CreateNodesContext, CreateDependencies, CreateDependenciesContext, } from './
|
23
|
-
export type { NxPluginV1, ProjectTargetConfigurator, } from './utils/nx-plugin.deprecated';
|
22
|
+
export type { NxPlugin, NxPluginV1, NxPluginV2, ProjectTargetConfigurator, CreateNodes, CreateNodesFunction, CreateNodesResult, CreateNodesContext, CreateDependencies, CreateDependenciesContext, } from './utils/nx-plugin';
|
24
23
|
/**
|
25
24
|
* @category Workspace
|
26
25
|
*/
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.convertNxExecutor = void 0;
|
7
7
|
const nx_json_1 = require("../../config/nx-json");
|
8
8
|
const retrieve_workspace_files_1 = require("../../project-graph/utils/retrieve-workspace-files");
|
9
|
-
const internal_api_1 = require("../../project-graph/plugins/internal-api");
|
10
9
|
/**
|
11
10
|
* Convert an Nx Executor into an Angular Devkit Builder
|
12
11
|
*
|
@@ -16,12 +15,10 @@ function convertNxExecutor(executor) {
|
|
16
15
|
const builderFunction = (options, builderContext) => {
|
17
16
|
const promise = async () => {
|
18
17
|
const nxJsonConfiguration = (0, nx_json_1.readNxJson)(builderContext.workspaceRoot);
|
19
|
-
const [plugins, cleanup] = await (0, internal_api_1.loadNxPluginsInIsolation)(nxJsonConfiguration.plugins, builderContext.workspaceRoot);
|
20
18
|
const projectsConfigurations = {
|
21
19
|
version: 2,
|
22
|
-
projects: (await (0, retrieve_workspace_files_1.retrieveProjectConfigurations)(
|
20
|
+
projects: (await (0, retrieve_workspace_files_1.retrieveProjectConfigurations)(builderContext.workspaceRoot, nxJsonConfiguration)).projects,
|
23
21
|
};
|
24
|
-
cleanup();
|
25
22
|
const context = {
|
26
23
|
root: builderContext.workspaceRoot,
|
27
24
|
projectName: builderContext.target.project,
|
@@ -136,8 +136,8 @@ function readAndCombineAllProjectConfigurations(tree) {
|
|
136
136
|
...(0, package_json_workspaces_1.getGlobPatternsFromPackageManagerWorkspaces)(tree.root, (p) => (0, json_1.readJson)(tree, p, { expectComments: true })),
|
137
137
|
];
|
138
138
|
const projectGlobPatterns = (0, retrieve_workspace_files_1.configurationGlobs)([
|
139
|
-
project_json_1.ProjectJsonProjectsPlugin,
|
140
|
-
{
|
139
|
+
{ plugin: project_json_1.ProjectJsonProjectsPlugin },
|
140
|
+
{ plugin: (0, package_json_workspaces_1.getNxPackageJsonWorkspacesPlugin)(tree.root) },
|
141
141
|
]);
|
142
142
|
const globbedFiles = (0, workspace_context_1.globWithWorkspaceContext)(tree.root, projectGlobPatterns);
|
143
143
|
const createdFiles = findCreatedProjectFiles(tree, patterns);
|
@@ -5,10 +5,10 @@ const path_1 = require("path");
|
|
5
5
|
const json_1 = require("../../generators/utils/json");
|
6
6
|
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
7
7
|
const retrieve_workspace_files_1 = require("../../project-graph/utils/retrieve-workspace-files");
|
8
|
-
const
|
8
|
+
const nx_plugin_1 = require("../../utils/nx-plugin");
|
9
9
|
async function default_1(tree) {
|
10
10
|
const nxJson = (0, nx_json_1.readNxJson)(tree);
|
11
|
-
const projectFiles = (0, retrieve_workspace_files_1.retrieveProjectConfigurationPaths)(tree.root,
|
11
|
+
const projectFiles = await (0, retrieve_workspace_files_1.retrieveProjectConfigurationPaths)(tree.root, await (0, nx_plugin_1.loadNxPlugins)(nxJson?.plugins));
|
12
12
|
const projectJsons = projectFiles.filter((f) => f.endsWith('project.json'));
|
13
13
|
for (let f of projectJsons) {
|
14
14
|
const projectJson = (0, json_1.readJson)(tree, f);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { CreateDependencies, CreateNodes } from '../../
|
1
|
+
import { CreateDependencies, CreateNodes } from '../../utils/nx-plugin';
|
2
2
|
export declare const name = "nx/js/dependencies-and-lockfile";
|
3
3
|
export declare const createNodes: CreateNodes;
|
4
4
|
export declare const createDependencies: CreateDependencies;
|
@@ -6,7 +6,7 @@ import { PackageManager } from '../../../utils/package-manager';
|
|
6
6
|
import { ProjectGraph, ProjectGraphExternalNode } from '../../../config/project-graph';
|
7
7
|
import { RawProjectGraphDependency } from '../../../project-graph/project-graph-builder';
|
8
8
|
import { PackageJson } from '../../../utils/package-json';
|
9
|
-
import { CreateDependenciesContext } from '../../../
|
9
|
+
import { CreateDependenciesContext } from '../../../utils/nx-plugin';
|
10
10
|
export declare const LOCKFILES: string[];
|
11
11
|
/**
|
12
12
|
* Parses lock file and maps dependencies and metadata to {@link LockFileGraph}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { NormalizedPackageJson } from './utils/package-json';
|
2
2
|
import { RawProjectGraphDependency } from '../../../project-graph/project-graph-builder';
|
3
3
|
import { ProjectGraph, ProjectGraphExternalNode } from '../../../config/project-graph';
|
4
|
-
import { CreateDependenciesContext } from '../../../
|
4
|
+
import { CreateDependenciesContext } from '../../../utils/nx-plugin';
|
5
5
|
export declare function getNpmLockfileNodes(lockFileContent: string, lockFileHash: string): Record<string, ProjectGraphExternalNode>;
|
6
6
|
export declare function getNpmLockfileDependencies(lockFileContent: string, lockFileHash: string, ctx: CreateDependenciesContext): RawProjectGraphDependency[];
|
7
7
|
export declare function stringifyNpmLockfile(graph: ProjectGraph, rootLockFileContent: string, packageJson: NormalizedPackageJson): string;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { NormalizedPackageJson } from './utils/package-json';
|
2
2
|
import { RawProjectGraphDependency } from '../../../project-graph/project-graph-builder';
|
3
3
|
import { ProjectGraph, ProjectGraphExternalNode } from '../../../config/project-graph';
|
4
|
-
import { CreateDependenciesContext } from '../../../
|
4
|
+
import { CreateDependenciesContext } from '../../../utils/nx-plugin';
|
5
5
|
export declare function getPnpmLockfileNodes(lockFileContent: string, lockFileHash: string): Record<string, ProjectGraphExternalNode>;
|
6
6
|
export declare function getPnpmLockfileDependencies(lockFileContent: string, lockFileHash: string, ctx: CreateDependenciesContext): RawProjectGraphDependency[];
|
7
7
|
export declare function stringifyPnpmLockfile(graph: ProjectGraph, rootLockFileContent: string, packageJson: NormalizedPackageJson): string;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { NormalizedPackageJson } from './utils/package-json';
|
2
2
|
import { RawProjectGraphDependency } from '../../../project-graph/project-graph-builder';
|
3
3
|
import { ProjectGraph, ProjectGraphExternalNode } from '../../../config/project-graph';
|
4
|
-
import { CreateDependenciesContext } from '../../../
|
4
|
+
import { CreateDependenciesContext } from '../../../utils/nx-plugin';
|
5
5
|
export declare function getYarnLockfileNodes(lockFileContent: string, lockFileHash: string, packageJson: NormalizedPackageJson): Record<string, ProjectGraphExternalNode>;
|
6
6
|
export declare function getYarnLockfileDependencies(lockFileContent: string, lockFileHash: string, ctx: CreateDependenciesContext): RawProjectGraphDependency[];
|
7
7
|
export declare function stringifyYarnLockfile(graph: ProjectGraph, rootLockFileContent: string, packageJson: NormalizedPackageJson): string;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { CreateDependenciesContext } from '../../../../
|
1
|
+
import { CreateDependenciesContext } from '../../../../utils/nx-plugin';
|
2
2
|
import { RawProjectGraphDependency } from '../../../../project-graph/project-graph-builder';
|
3
3
|
export declare function buildExplicitDependencies(jsPluginConfig: {
|
4
4
|
analyzeSourceFiles?: boolean;
|
package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.d.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
import { CreateDependenciesContext } from '../../../../
|
1
|
+
import { CreateDependenciesContext } from '../../../../utils/nx-plugin';
|
2
2
|
import { RawProjectGraphDependency } from '../../../../project-graph/project-graph-builder';
|
3
3
|
export declare function buildExplicitPackageJsonDependencies(ctx: CreateDependenciesContext): RawProjectGraphDependency[];
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { CreateDependenciesContext } from '../../../../
|
1
|
+
import { CreateDependenciesContext } from '../../../../utils/nx-plugin';
|
2
2
|
import { RawProjectGraphDependency } from '../../../../project-graph/project-graph-builder';
|
3
3
|
export declare function buildExplicitTypeScriptDependencies(ctx: CreateDependenciesContext): RawProjectGraphDependency[];
|
@@ -67,7 +67,9 @@ function getTranspiler(compilerOptions) {
|
|
67
67
|
}
|
68
68
|
compilerOptions.lib = ['es2021'];
|
69
69
|
compilerOptions.module = ts.ModuleKind.CommonJS;
|
70
|
-
|
70
|
+
// use NodeJs module resolution until support for TS 4.x is dropped and then
|
71
|
+
// we can switch to Node10
|
72
|
+
compilerOptions.moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
71
73
|
compilerOptions.target = ts.ScriptTarget.ES2021;
|
72
74
|
compilerOptions.inlineSourceMap = true;
|
73
75
|
compilerOptions.skipLibCheck = true;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { NxJsonConfiguration } from '../../config/nx-json';
|
2
2
|
import { ProjectConfiguration } from '../../config/workspace-json-project-json';
|
3
|
+
import { NxPluginV2 } from '../../utils/nx-plugin';
|
3
4
|
import { PackageJson } from '../../utils/package-json';
|
4
|
-
|
5
|
-
export declare const createNodes: CreateNodes;
|
5
|
+
export declare function getNxPackageJsonWorkspacesPlugin(root: string): NxPluginV2;
|
6
6
|
export declare function createNodeFromPackageJson(pkgJsonPath: string, root: string): {
|
7
7
|
projects: {
|
8
8
|
[x: string]: ProjectConfiguration & {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getGlobPatternsFromPackageManagerWorkspaces = exports.buildProjectConfigurationFromPackageJson = exports.createNodeFromPackageJson = exports.
|
3
|
+
exports.getGlobPatternsFromPackageManagerWorkspaces = exports.buildProjectConfigurationFromPackageJson = exports.createNodeFromPackageJson = exports.getNxPackageJsonWorkspacesPlugin = void 0;
|
4
4
|
const minimatch_1 = require("minimatch");
|
5
5
|
const node_fs_1 = require("node:fs");
|
6
6
|
const node_path_1 = require("node:path");
|
@@ -12,30 +12,37 @@ const logger_1 = require("../../utils/logger");
|
|
12
12
|
const output_1 = require("../../utils/output");
|
13
13
|
const package_json_1 = require("../../utils/package-json");
|
14
14
|
const path_1 = require("../../utils/path");
|
15
|
-
|
16
|
-
const readJson = (f) => (0, fileutils_1.readJsonFile)((0, node_path_1.join)(
|
17
|
-
const patterns = getGlobPatternsFromPackageManagerWorkspaces(
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
//
|
24
|
-
|
25
|
-
//
|
26
|
-
(positivePatterns.length ===
|
27
|
-
|
15
|
+
function getNxPackageJsonWorkspacesPlugin(root) {
|
16
|
+
const readJson = (f) => (0, fileutils_1.readJsonFile)((0, node_path_1.join)(root, f));
|
17
|
+
const patterns = getGlobPatternsFromPackageManagerWorkspaces(root, readJson);
|
18
|
+
// If the user only specified a negative pattern, we should find all package.json
|
19
|
+
// files and only return those that don't match a negative pattern.
|
20
|
+
const negativePatterns = patterns.filter((p) => p.startsWith('!'));
|
21
|
+
let positivePatterns = patterns.filter((p) => !p.startsWith('!'));
|
22
|
+
if (
|
23
|
+
// There are some negative patterns
|
24
|
+
negativePatterns.length > 0 &&
|
25
|
+
// No positive patterns
|
26
|
+
(positivePatterns.length === 0 ||
|
27
|
+
// Or only a single positive pattern that is the default coming from root package
|
28
|
+
(positivePatterns.length === 1 && positivePatterns[0] === 'package.json'))) {
|
29
|
+
positivePatterns.push('**/package.json');
|
30
|
+
}
|
31
|
+
return {
|
32
|
+
name: 'nx/core/package-json-workspaces',
|
33
|
+
createNodes: [
|
34
|
+
(0, globs_1.combineGlobPatterns)(positivePatterns),
|
35
|
+
(p) => {
|
36
|
+
if (!negativePatterns.some((negative) => (0, minimatch_1.minimatch)(p, negative))) {
|
37
|
+
return createNodeFromPackageJson(p, root);
|
38
|
+
}
|
39
|
+
// A negative pattern matched, so we should not create a node for this package.json
|
40
|
+
return {};
|
41
|
+
},
|
42
|
+
],
|
43
|
+
};
|
28
44
|
}
|
29
|
-
exports.
|
30
|
-
(0, globs_1.combineGlobPatterns)(positivePatterns),
|
31
|
-
(p, _, { workspaceRoot }) => {
|
32
|
-
if (!negativePatterns.some((negative) => (0, minimatch_1.minimatch)(p, negative))) {
|
33
|
-
return createNodeFromPackageJson(p, workspaceRoot);
|
34
|
-
}
|
35
|
-
// A negative pattern matched, so we should not create a node for this package.json
|
36
|
-
return {};
|
37
|
-
},
|
38
|
-
];
|
45
|
+
exports.getNxPackageJsonWorkspacesPlugin = getNxPackageJsonWorkspacesPlugin;
|
39
46
|
function createNodeFromPackageJson(pkgJsonPath, root) {
|
40
47
|
const json = (0, fileutils_1.readJsonFile)((0, node_path_1.join)(root, pkgJsonPath));
|
41
48
|
const project = buildProjectConfigurationFromPackageJson(json, pkgJsonPath, (0, nx_json_1.readNxJson)(root));
|
@@ -24,7 +24,6 @@ exports.PackageJsonProjectsNextToProjectJsonPlugin = {
|
|
24
24
|
},
|
25
25
|
],
|
26
26
|
};
|
27
|
-
exports.default = exports.PackageJsonProjectsNextToProjectJsonPlugin;
|
28
27
|
function createProjectFromPackageJsonNextToProjectJson(projectJsonPath, workspaceRoot) {
|
29
28
|
const root = (0, path_1.dirname)(projectJsonPath);
|
30
29
|
const packageJsonPath = (0, path_1.join)(workspaceRoot, root, 'package.json');
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { ProjectConfiguration } from '../../../config/workspace-json-project-json';
|
2
|
-
import { NxPluginV2 } from '../../../
|
2
|
+
import { NxPluginV2 } from '../../../utils/nx-plugin';
|
3
3
|
export declare const ProjectJsonProjectsPlugin: NxPluginV2;
|
4
|
-
export default ProjectJsonProjectsPlugin;
|
5
4
|
export declare function buildProjectFromProjectJson(json: Partial<ProjectConfiguration>, path: string): ProjectConfiguration;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { TargetConfiguration } from '../../config/workspace-json-project-json';
|
2
|
-
import { NxPluginV2 } from '../../
|
2
|
+
import { NxPluginV2 } from '../../utils/nx-plugin';
|
3
3
|
/**
|
4
4
|
* This marks that a target provides information which should modify a target already registered
|
5
5
|
* on the project via other plugins. If the target has not already been registered, and this symbol is true,
|
@@ -18,7 +18,6 @@ export declare const ONLY_MODIFIES_EXISTING_TARGET = "NX_ONLY_MODIFIES_EXISTING_
|
|
18
18
|
*/
|
19
19
|
export declare const OVERRIDE_SOURCE_FILE = "NX_OVERRIDE_SOURCE_FILE";
|
20
20
|
export declare const TargetDefaultsPlugin: NxPluginV2;
|
21
|
-
export default TargetDefaultsPlugin;
|
22
21
|
/**
|
23
22
|
* This fn gets target info that would make a target uniquely compatible
|
24
23
|
* with what is described by project.json or package.json. As the merge process
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTouchedProjectsFromProjectGlobChanges = void 0;
|
4
4
|
const minimatch_1 = require("minimatch");
|
5
5
|
const workspace_root_1 = require("../../../utils/workspace-root");
|
6
|
+
const installation_directory_1 = require("../../../utils/installation-directory");
|
6
7
|
const path_1 = require("path");
|
7
8
|
const fs_1 = require("fs");
|
8
9
|
const retrieve_workspace_files_1 = require("../../utils/retrieve-workspace-files");
|
9
|
-
const
|
10
|
+
const nx_plugin_1 = require("../../../utils/nx-plugin");
|
10
11
|
const globs_1 = require("../../../utils/globs");
|
11
12
|
const getTouchedProjectsFromProjectGlobChanges = async (touchedFiles, projectGraphNodes, nxJson) => {
|
12
|
-
const
|
13
|
-
const globPattern = (0, globs_1.combineGlobPatterns)((0, retrieve_workspace_files_1.configurationGlobs)(plugins.map((p) => p.plugin)));
|
13
|
+
const globPattern = (0, globs_1.combineGlobPatterns)((0, retrieve_workspace_files_1.configurationGlobs)(await (0, nx_plugin_1.loadNxPlugins)(nxJson?.plugins, (0, installation_directory_1.getNxRequirePaths)(workspace_root_1.workspaceRoot), workspace_root_1.workspaceRoot)));
|
14
14
|
const touchedProjects = new Set();
|
15
15
|
for (const touchedFile of touchedFiles) {
|
16
16
|
const isProjectFile = (0, minimatch_1.minimatch)(touchedFile.file, globPattern, {
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { FileData } from './file-utils';
|
2
2
|
import { FileMapCache } from './nx-deps-cache';
|
3
|
-
import { RemotePlugin } from './plugins/internal-api';
|
4
3
|
import { FileMap, ProjectGraph, ProjectGraphExternalNode } from '../config/project-graph';
|
5
4
|
import { ProjectConfiguration } from '../config/workspace-json-project-json';
|
6
5
|
import { NxWorkspaceFilesExternals } from '../native';
|
@@ -9,7 +8,7 @@ export declare function getFileMap(): {
|
|
9
8
|
allWorkspaceFiles: FileData[];
|
10
9
|
rustReferences: NxWorkspaceFilesExternals | null;
|
11
10
|
};
|
12
|
-
export declare function buildProjectGraphUsingProjectFileMap(projects: Record<string, ProjectConfiguration>, externalNodes: Record<string, ProjectGraphExternalNode>, fileMap: FileMap, allWorkspaceFiles: FileData[], rustReferences: NxWorkspaceFilesExternals, fileMapCache: FileMapCache | null, shouldWriteCache: boolean
|
11
|
+
export declare function buildProjectGraphUsingProjectFileMap(projects: Record<string, ProjectConfiguration>, externalNodes: Record<string, ProjectGraphExternalNode>, fileMap: FileMap, allWorkspaceFiles: FileData[], rustReferences: NxWorkspaceFilesExternals, fileMapCache: FileMapCache | null, shouldWriteCache: boolean): Promise<{
|
13
12
|
projectGraph: ProjectGraph;
|
14
13
|
projectFileMapCache: FileMapCache;
|
15
14
|
}>;
|