nx 21.0.0-beta.1 → 21.0.0-beta.10
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/.eslintrc.json +5 -1
- package/migrations.json +5 -35
- package/package.json +12 -12
- package/release/index.d.ts +1 -1
- package/release/index.js +2 -1
- package/schemas/nx-schema.json +182 -35
- package/schemas/project-schema.json +5 -0
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +3 -0
- package/src/command-line/add/add.js +6 -16
- package/src/command-line/affected/command-object.js +6 -6
- package/src/command-line/examples.js +0 -4
- package/src/command-line/exec/command-object.js +1 -1
- package/src/command-line/generate/generator-utils.js +8 -3
- package/src/command-line/import/import.js +1 -1
- package/src/command-line/init/command-object.js +18 -6
- package/src/command-line/init/configure-plugins.d.ts +6 -7
- package/src/command-line/init/configure-plugins.js +52 -38
- package/src/command-line/init/implementation/add-nx-to-turborepo.d.ts +4 -0
- package/src/command-line/init/implementation/add-nx-to-turborepo.js +49 -0
- package/src/command-line/init/implementation/check-compatible-with-plugins.js +7 -1
- package/src/command-line/init/implementation/deduce-default-base.d.ts +1 -0
- package/src/command-line/init/implementation/deduce-default-base.js +53 -0
- package/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.js +6 -4
- package/src/command-line/init/implementation/react/index.d.ts +1 -1
- package/src/command-line/init/implementation/react/index.js +32 -185
- package/src/command-line/init/implementation/react/write-vite-config.js +19 -3
- package/src/command-line/init/implementation/utils.d.ts +6 -2
- package/src/command-line/init/implementation/utils.js +110 -45
- package/src/command-line/init/init-v1.js +1 -1
- package/src/command-line/init/init-v2.d.ts +1 -0
- package/src/command-line/init/init-v2.js +70 -39
- package/src/command-line/migrate/migrate-ui-api.d.ts +58 -0
- package/src/command-line/migrate/migrate-ui-api.js +227 -0
- package/src/command-line/migrate/migrate.d.ts +16 -3
- package/src/command-line/migrate/migrate.js +113 -83
- package/src/command-line/nx-commands.js +19 -5
- package/src/command-line/register/command-object.d.ts +6 -0
- package/src/command-line/{activate-powerpack → register}/command-object.js +9 -9
- package/src/command-line/register/register.d.ts +2 -0
- package/src/command-line/register/register.js +9 -0
- package/src/command-line/release/changelog.js +18 -15
- package/src/command-line/release/command-object.d.ts +8 -0
- package/src/command-line/release/command-object.js +9 -0
- package/src/command-line/release/config/config.d.ts +8 -7
- package/src/command-line/release/config/config.js +139 -45
- package/src/command-line/release/config/use-legacy-versioning.d.ts +2 -0
- package/src/command-line/release/config/use-legacy-versioning.js +9 -0
- package/src/command-line/release/index.d.ts +4 -0
- package/src/command-line/release/index.js +6 -1
- package/src/command-line/release/plan-check.js +6 -3
- package/src/command-line/release/plan.js +7 -3
- package/src/command-line/release/publish.js +7 -3
- package/src/command-line/release/release.js +8 -3
- package/src/command-line/release/utils/batch-projects-by-generator-config.js +6 -3
- package/src/command-line/release/utils/git.d.ts +3 -2
- package/src/command-line/release/utils/git.js +65 -9
- package/src/command-line/release/utils/github.js +3 -1
- package/src/command-line/release/utils/resolve-semver-specifier.d.ts +2 -1
- package/src/command-line/release/utils/resolve-semver-specifier.js +2 -1
- package/src/command-line/release/utils/semver.d.ts +8 -0
- package/src/command-line/release/utils/semver.js +8 -0
- package/src/command-line/release/utils/shared-legacy.d.ts +25 -0
- package/src/command-line/release/utils/shared-legacy.js +2 -0
- package/src/command-line/release/utils/shared.d.ts +11 -17
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.d.ts +7 -0
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.js +47 -0
- package/src/command-line/release/version/deriver-specifier-from-version-plans.d.ts +8 -0
- package/src/command-line/release/version/deriver-specifier-from-version-plans.js +59 -0
- package/src/command-line/release/version/project-logger.d.ts +8 -0
- package/src/command-line/release/version/project-logger.js +45 -0
- package/src/command-line/release/version/release-group-processor.d.ts +252 -0
- package/src/command-line/release/version/release-group-processor.js +1057 -0
- package/src/command-line/release/version/resolve-current-version.d.ts +32 -0
- package/src/command-line/release/version/resolve-current-version.js +241 -0
- package/src/command-line/release/version/test-utils.d.ts +93 -0
- package/src/command-line/release/version/test-utils.js +415 -0
- package/src/command-line/release/version/topological-sort.d.ts +9 -0
- package/src/command-line/release/version/topological-sort.js +41 -0
- package/src/command-line/release/version/version-actions.d.ts +171 -0
- package/src/command-line/release/version/version-actions.js +195 -0
- package/src/command-line/release/version-legacy.d.ts +46 -0
- package/src/command-line/release/version-legacy.js +453 -0
- package/src/command-line/release/version.d.ts +0 -40
- package/src/command-line/release/version.js +84 -262
- package/src/command-line/repair/repair.js +0 -1
- package/src/command-line/report/report.d.ts +7 -3
- package/src/command-line/report/report.js +52 -18
- package/src/command-line/run/command-object.js +2 -2
- package/src/command-line/run/executor-utils.d.ts +6 -1
- package/src/command-line/run/executor-utils.js +10 -1
- package/src/command-line/run/run.js +2 -2
- package/src/command-line/run-many/command-object.js +2 -2
- package/src/command-line/yargs-utils/shared-options.d.ts +4 -0
- package/src/command-line/yargs-utils/shared-options.js +20 -0
- package/src/config/misc-interfaces.d.ts +11 -1
- package/src/config/nx-json.d.ts +160 -16
- package/src/config/project-graph.d.ts +4 -2
- package/src/config/project-graph.js +8 -0
- package/src/config/workspace-json-project-json.d.ts +2 -2
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/runtime.js +1 -1
- package/src/core/graph/styles.css +2 -2
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/client/client.d.ts +2 -0
- package/src/daemon/client/client.js +15 -0
- package/src/daemon/message-types/glob.d.ts +7 -0
- package/src/daemon/message-types/glob.js +9 -1
- package/src/daemon/message-types/hash-glob.d.ts +6 -0
- package/src/daemon/message-types/hash-glob.js +9 -1
- package/src/daemon/server/handle-glob.d.ts +1 -0
- package/src/daemon/server/handle-glob.js +8 -0
- package/src/daemon/server/handle-hash-glob.d.ts +1 -0
- package/src/daemon/server/handle-hash-glob.js +8 -0
- package/src/daemon/server/logger.js +2 -1
- package/src/daemon/server/server.js +7 -0
- package/src/devkit-internals.d.ts +3 -2
- package/src/devkit-internals.js +5 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +2 -5
- package/src/executors/run-commands/run-commands.impl.js +14 -42
- package/src/executors/run-commands/running-tasks.d.ts +9 -4
- package/src/executors/run-commands/running-tasks.js +103 -30
- package/src/executors/run-script/run-script.impl.js +4 -3
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +8 -0
- package/src/generators/testing-utils/create-tree.js +5 -1
- package/src/migrations/{update-17-0-0/rm-default-collection-npm-scope.d.ts → update-21-0-0/release-version-config-changes.d.ts} +1 -1
- package/src/migrations/update-21-0-0/release-version-config-changes.js +111 -0
- package/src/native/index.d.ts +98 -19
- package/src/native/index.js +16 -2
- package/src/native/native-bindings.js +7 -0
- package/src/native/nx.wasi-browser.js +20 -19
- package/src/native/nx.wasi.cjs +20 -19
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/nx-cloud-tasks-runner-shell.js +3 -3
- package/src/plugins/js/lock-file/lock-file.js +28 -13
- package/src/plugins/js/lock-file/utils/package-json.d.ts +1 -1
- package/src/plugins/js/lock-file/utils/package-json.js +8 -6
- package/src/plugins/js/lock-file/utils/pnpm-normalizer.js +3 -3
- package/src/plugins/js/lock-file/yarn-parser.js +85 -39
- package/src/plugins/js/project-graph/affected/lock-file-changes.js +1 -0
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +1 -1
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +10 -1
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +59 -6
- package/src/plugins/js/utils/packages.js +22 -3
- package/src/plugins/js/utils/register.js +1 -0
- package/src/plugins/js/utils/typescript.js +3 -3
- package/src/plugins/package-json/create-nodes.d.ts +1 -1
- package/src/plugins/package-json/create-nodes.js +4 -2
- package/src/project-graph/affected/locators/project-glob-changes.js +2 -2
- package/src/project-graph/error-types.js +32 -2
- package/src/project-graph/file-utils.d.ts +1 -10
- package/src/project-graph/file-utils.js +2 -77
- package/src/project-graph/plugins/get-plugins.js +2 -1
- package/src/project-graph/plugins/in-process-loader.js +1 -1
- package/src/project-graph/plugins/isolation/plugin-worker.js +12 -6
- package/src/project-graph/plugins/loaded-nx-plugin.d.ts +2 -1
- package/src/project-graph/plugins/public-api.d.ts +1 -1
- package/src/project-graph/plugins/utils.d.ts +2 -2
- package/src/project-graph/plugins/utils.js +2 -2
- package/src/project-graph/project-graph.js +1 -1
- package/src/project-graph/utils/project-configuration-utils.d.ts +3 -3
- package/src/project-graph/utils/project-configuration-utils.js +54 -21
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +1 -1
- package/src/project-graph/utils/retrieve-workspace-files.js +14 -18
- package/src/tasks-runner/batch/batch-messages.d.ts +2 -0
- package/src/tasks-runner/batch/run-batch.js +3 -4
- package/src/tasks-runner/cache.d.ts +20 -6
- package/src/tasks-runner/cache.js +104 -20
- package/src/tasks-runner/create-task-graph.d.ts +0 -1
- package/src/tasks-runner/create-task-graph.js +11 -11
- package/src/tasks-runner/default-tasks-runner.js +5 -14
- package/src/tasks-runner/forked-process-task-runner.d.ts +8 -3
- package/src/tasks-runner/forked-process-task-runner.js +59 -46
- package/src/tasks-runner/init-tasks-runner.d.ts +15 -1
- package/src/tasks-runner/init-tasks-runner.js +62 -2
- package/src/tasks-runner/is-tui-enabled.d.ts +2 -0
- package/src/tasks-runner/is-tui-enabled.js +64 -0
- package/src/tasks-runner/life-cycle.d.ts +14 -3
- package/src/tasks-runner/life-cycle.js +37 -2
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.d.ts +2 -0
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +15 -7
- package/src/tasks-runner/life-cycles/task-history-life-cycle.d.ts +5 -0
- package/src/tasks-runner/life-cycles/task-history-life-cycle.js +35 -5
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.d.ts +18 -0
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +229 -0
- package/src/tasks-runner/pseudo-terminal.d.ts +10 -7
- package/src/tasks-runner/pseudo-terminal.js +37 -35
- package/src/tasks-runner/run-command.d.ts +4 -1
- package/src/tasks-runner/run-command.js +220 -42
- package/src/tasks-runner/running-tasks/node-child-process.js +4 -11
- package/src/tasks-runner/running-tasks/running-task.d.ts +3 -0
- package/src/tasks-runner/running-tasks/shared-running-task.d.ts +14 -0
- package/src/tasks-runner/running-tasks/shared-running-task.js +30 -0
- package/src/tasks-runner/task-env.d.ts +1 -4
- package/src/tasks-runner/task-env.js +2 -0
- package/src/tasks-runner/task-orchestrator.d.ts +26 -10
- package/src/tasks-runner/task-orchestrator.js +212 -57
- package/src/tasks-runner/tasks-runner.d.ts +1 -0
- package/src/tasks-runner/tasks-schedule.d.ts +1 -0
- package/src/tasks-runner/tasks-schedule.js +9 -0
- package/src/tasks-runner/utils.d.ts +2 -2
- package/src/tasks-runner/utils.js +18 -12
- package/src/utils/child-process.d.ts +4 -0
- package/src/utils/child-process.js +23 -30
- package/src/utils/command-line-utils.d.ts +1 -1
- package/src/utils/find-matching-projects.js +2 -2
- package/src/utils/git-utils.d.ts +1 -1
- package/src/utils/git-utils.js +8 -3
- package/src/utils/handle-errors.js +15 -0
- package/src/utils/is-ci.js +4 -1
- package/src/utils/is-using-prettier.d.ts +3 -0
- package/src/utils/is-using-prettier.js +62 -0
- package/src/utils/nx-key.d.ts +7 -0
- package/src/utils/nx-key.js +52 -0
- package/src/utils/package-json.d.ts +1 -1
- package/src/utils/package-json.js +16 -2
- package/src/utils/package-manager.js +2 -2
- package/src/utils/path.js +1 -1
- package/src/utils/require-nx-key.d.ts +1 -0
- package/src/utils/require-nx-key.js +22 -0
- package/src/utils/workspace-context.d.ts +2 -0
- package/src/utils/workspace-context.js +16 -0
- package/src/command-line/activate-powerpack/activate-powerpack.d.ts +0 -2
- package/src/command-line/activate-powerpack/activate-powerpack.js +0 -34
- package/src/command-line/activate-powerpack/command-object.d.ts +0 -6
- package/src/command-line/init/implementation/react/write-craco-config.d.ts +0 -1
- package/src/command-line/init/implementation/react/write-craco-config.js +0 -61
- package/src/migrations/update-17-0-0/move-cache-directory.d.ts +0 -2
- package/src/migrations/update-17-0-0/move-cache-directory.js +0 -35
- package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +0 -72
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.d.ts +0 -2
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +0 -122
- package/src/migrations/update-17-2-0/move-default-base.d.ts +0 -5
- package/src/migrations/update-17-2-0/move-default-base.js +0 -21
- package/src/migrations/update-17-3-0/nx-release-path.d.ts +0 -3
- package/src/migrations/update-17-3-0/nx-release-path.js +0 -47
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +0 -2
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +0 -11
- package/src/utils/powerpack.d.ts +0 -5
- package/src/utils/powerpack.js +0 -33
@@ -4,23 +4,15 @@ exports.TEN_MEGABYTES = exports.DeletedFileChange = exports.WholeFileChange = vo
|
|
4
4
|
exports.isWholeFileChange = isWholeFileChange;
|
5
5
|
exports.isDeletedFileChange = isDeletedFileChange;
|
6
6
|
exports.calculateFileChanges = calculateFileChanges;
|
7
|
-
exports.readWorkspaceConfig = readWorkspaceConfig;
|
8
7
|
exports.defaultFileRead = defaultFileRead;
|
9
8
|
exports.readPackageJson = readPackageJson;
|
10
9
|
const child_process_1 = require("child_process");
|
11
10
|
const fs_1 = require("fs");
|
12
11
|
const path_1 = require("path");
|
13
|
-
const configuration_1 = require("../config/configuration");
|
14
|
-
const workspace_root_1 = require("../utils/workspace-root");
|
15
12
|
const fileutils_1 = require("../utils/fileutils");
|
16
|
-
const json_diff_1 = require("../utils/json-diff");
|
17
|
-
const project_graph_1 = require("./project-graph");
|
18
|
-
const angular_json_1 = require("../adapter/angular-json");
|
19
13
|
const ignore_1 = require("../utils/ignore");
|
20
|
-
const
|
21
|
-
const
|
22
|
-
const workspace_context_1 = require("../utils/workspace-context");
|
23
|
-
const project_json_1 = require("../plugins/project-json/build-nodes/project-json");
|
14
|
+
const json_diff_1 = require("../utils/json-diff");
|
15
|
+
const workspace_root_1 = require("../utils/workspace-root");
|
24
16
|
class WholeFileChange {
|
25
17
|
constructor() {
|
26
18
|
this.type = 'WholeFileChange';
|
@@ -100,34 +92,6 @@ function defaultReadFileAtRevision(file, revision) {
|
|
100
92
|
return '';
|
101
93
|
}
|
102
94
|
}
|
103
|
-
/**
|
104
|
-
* TODO(v21): Remove this function
|
105
|
-
* @deprecated To get projects use {@link retrieveProjectConfigurations} instead. This will be removed in v21.
|
106
|
-
*/
|
107
|
-
function readWorkspaceConfig(opts) {
|
108
|
-
let configuration = null;
|
109
|
-
const root = opts.path || process.cwd();
|
110
|
-
const nxJson = (0, configuration_1.readNxJson)(root);
|
111
|
-
try {
|
112
|
-
const projectGraph = (0, project_graph_1.readCachedProjectGraph)();
|
113
|
-
configuration = {
|
114
|
-
...nxJson,
|
115
|
-
...(0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph),
|
116
|
-
};
|
117
|
-
}
|
118
|
-
catch {
|
119
|
-
configuration = {
|
120
|
-
version: 2,
|
121
|
-
projects: getProjectsSync(root, nxJson),
|
122
|
-
};
|
123
|
-
}
|
124
|
-
if (opts.format === 'angularCli') {
|
125
|
-
return (0, angular_json_1.toOldFormat)(configuration);
|
126
|
-
}
|
127
|
-
else {
|
128
|
-
return configuration;
|
129
|
-
}
|
130
|
-
}
|
131
95
|
function defaultFileRead(filePath) {
|
132
96
|
return (0, fs_1.readFileSync)((0, path_1.join)(workspace_root_1.workspaceRoot, filePath), 'utf-8');
|
133
97
|
}
|
@@ -139,42 +103,3 @@ function readPackageJson(root = workspace_root_1.workspaceRoot) {
|
|
139
103
|
return {}; // if package.json doesn't exist
|
140
104
|
}
|
141
105
|
}
|
142
|
-
/**
|
143
|
-
* TODO(v21): Remove this function.
|
144
|
-
*/
|
145
|
-
function getProjectsSync(root, nxJson) {
|
146
|
-
/**
|
147
|
-
* We can't update projects that come from plugins anyways, so we are going
|
148
|
-
* to ignore them for now. Plugins should add their own add/create/update methods
|
149
|
-
* if they would like to use devkit to update inferred projects.
|
150
|
-
*/
|
151
|
-
const patterns = [
|
152
|
-
'**/project.json',
|
153
|
-
'project.json',
|
154
|
-
...(0, package_json_1.getGlobPatternsFromPackageManagerWorkspaces)(root, fileutils_1.readJsonFile),
|
155
|
-
];
|
156
|
-
const projectFiles = (0, workspace_context_1.globWithWorkspaceContextSync)(root, patterns);
|
157
|
-
const isInPackageJsonWorkspaces = (0, package_json_1.buildPackageJsonWorkspacesMatcher)(root, (f) => (0, fileutils_1.readJsonFile)((0, path_1.join)(root, f)));
|
158
|
-
const rootMap = {};
|
159
|
-
for (const projectFile of projectFiles) {
|
160
|
-
if ((0, path_1.basename)(projectFile) === 'project.json') {
|
161
|
-
const json = (0, fileutils_1.readJsonFile)(projectFile);
|
162
|
-
const config = (0, project_json_1.buildProjectFromProjectJson)(json, projectFile);
|
163
|
-
(0, project_configuration_utils_1.mergeProjectConfigurationIntoRootMap)(rootMap, config, undefined, undefined, true);
|
164
|
-
}
|
165
|
-
else if ((0, path_1.basename)(projectFile) === 'package.json') {
|
166
|
-
const packageJson = (0, fileutils_1.readJsonFile)(projectFile);
|
167
|
-
const config = (0, package_json_1.buildProjectConfigurationFromPackageJson)(packageJson, root, projectFile, nxJson, isInPackageJsonWorkspaces(projectFile));
|
168
|
-
if (!rootMap[config.root]) {
|
169
|
-
(0, project_configuration_utils_1.mergeProjectConfigurationIntoRootMap)(rootMap,
|
170
|
-
// Inferred targets, tags, etc don't show up when running generators
|
171
|
-
// This is to help avoid running into issues when trying to update the workspace
|
172
|
-
{
|
173
|
-
name: config.name,
|
174
|
-
root: config.root,
|
175
|
-
}, undefined, undefined, true);
|
176
|
-
}
|
177
|
-
}
|
178
|
-
}
|
179
|
-
return (0, project_configuration_utils_1.readProjectConfigurationsFromRootMap)(rootMap);
|
180
|
-
}
|
@@ -108,12 +108,13 @@ async function loadSpecifiedNxPlugins(plugins, root = workspace_root_1.workspace
|
|
108
108
|
plugins ??= [];
|
109
109
|
const cleanupFunctions = [];
|
110
110
|
const ret = [
|
111
|
-
await Promise.all(plugins.map(async (plugin) => {
|
111
|
+
await Promise.all(plugins.map(async (plugin, index) => {
|
112
112
|
const pluginPath = typeof plugin === 'string' ? plugin : plugin.plugin;
|
113
113
|
performance.mark(`Load Nx Plugin: ${pluginPath} - start`);
|
114
114
|
const [loadedPluginPromise, cleanup] = await loadingMethod(plugin, root);
|
115
115
|
cleanupFunctions.push(cleanup);
|
116
116
|
const res = await loadedPluginPromise;
|
117
|
+
res.index = index;
|
117
118
|
performance.mark(`Load Nx Plugin: ${pluginPath} - end`);
|
118
119
|
performance.measure(`Load Nx Plugin: ${pluginPath}`, `Load Nx Plugin: ${pluginPath} - start`, `Load Nx Plugin: ${pluginPath} - end`);
|
119
120
|
return res;
|
@@ -25,7 +25,7 @@ function readPluginPackageJson(pluginName, projects, paths = (0, installation_di
|
|
25
25
|
const localPluginPath = (0, resolve_plugin_1.resolveLocalNxPlugin)(pluginName, projects);
|
26
26
|
if (localPluginPath) {
|
27
27
|
const localPluginPackageJson = path.join(localPluginPath.path, 'package.json');
|
28
|
-
if ((0, transpiler_1.pluginTranspilerIsRegistered)()) {
|
28
|
+
if (!(0, transpiler_1.pluginTranspilerIsRegistered)()) {
|
29
29
|
(0, transpiler_1.registerPluginTSTranspiler)();
|
30
30
|
}
|
31
31
|
return {
|
@@ -1,5 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const node_perf_hooks_1 = require("node:perf_hooks");
|
4
|
+
node_perf_hooks_1.performance.mark(`plugin worker ${process.pid} code loading -- start`);
|
3
5
|
const messaging_1 = require("./messaging");
|
4
6
|
const serializable_error_1 = require("../../../utils/serializable-error");
|
5
7
|
const consume_messages_from_socket_1 = require("../../../utils/consume-messages-from-socket");
|
@@ -8,6 +10,8 @@ const fs_1 = require("fs");
|
|
8
10
|
if (process.env.NX_PERF_LOGGING === 'true') {
|
9
11
|
require('../../../utils/perf-logging');
|
10
12
|
}
|
13
|
+
node_perf_hooks_1.performance.mark(`plugin worker ${process.pid} code loading -- end`);
|
14
|
+
node_perf_hooks_1.performance.measure(`plugin worker ${process.pid} code loading`, `plugin worker ${process.pid} code loading -- start`, `plugin worker ${process.pid} code loading -- end`);
|
11
15
|
global.NX_GRAPH_CREATION = true;
|
12
16
|
global.NX_PLUGIN_WORKER = true;
|
13
17
|
let connected = false;
|
@@ -182,12 +186,14 @@ const server = (0, net_1.createServer)((socket) => {
|
|
182
186
|
});
|
183
187
|
});
|
184
188
|
server.listen(socketPath);
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
}
|
189
|
+
if (process.env.NX_PLUGIN_NO_TIMEOUTS !== 'true') {
|
190
|
+
setTimeout(() => {
|
191
|
+
if (!connected) {
|
192
|
+
console.error('The plugin worker is exiting as it was not connected to within 5 seconds.');
|
193
|
+
process.exit(1);
|
194
|
+
}
|
195
|
+
}, 5000).unref();
|
196
|
+
}
|
191
197
|
const exitHandler = (exitCode) => () => {
|
192
198
|
server.close();
|
193
199
|
try {
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import type { ProjectGraph } from '../../config/project-graph';
|
2
|
-
import type
|
2
|
+
import { type PluginConfiguration } from '../../config/nx-json';
|
3
3
|
import type { RawProjectGraphDependency } from '../project-graph-builder';
|
4
4
|
import type { CreateDependenciesContext, CreateMetadataContext, CreateNodesContextV2, CreateNodesResult, NxPluginV2, PostTasksExecutionContext, PreTasksExecutionContext, ProjectsMetadata } from './public-api';
|
5
5
|
export declare class LoadedNxPlugin {
|
6
|
+
index?: number;
|
6
7
|
readonly name: string;
|
7
8
|
readonly createNodes?: [
|
8
9
|
filePattern: string,
|
@@ -68,7 +68,7 @@ export interface CreateDependenciesContext {
|
|
68
68
|
*/
|
69
69
|
readonly externalNodes: ProjectGraph['externalNodes'];
|
70
70
|
/**
|
71
|
-
* The configuration of each project in the workspace.
|
71
|
+
* The configuration of each project in the workspace keyed by project name.
|
72
72
|
*/
|
73
73
|
readonly projects: Record<string, ProjectConfiguration>;
|
74
74
|
/**
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {
|
2
|
-
export declare function createNodesFromFiles<T = unknown>(createNodes:
|
1
|
+
import { CreateNodesContext, CreateNodesContextV2, CreateNodesResult } from './public-api';
|
2
|
+
export declare function createNodesFromFiles<T = unknown>(createNodes: (projectConfigurationFile: string, options: T | undefined, context: CreateNodesContext, idx: number) => CreateNodesResult | Promise<CreateNodesResult>, configFiles: readonly string[], options: T, context: CreateNodesContextV2): Promise<[file: string, value: CreateNodesResult][]>;
|
@@ -5,12 +5,12 @@ const error_types_1 = require("../error-types");
|
|
5
5
|
async function createNodesFromFiles(createNodes, configFiles, options, context) {
|
6
6
|
const results = [];
|
7
7
|
const errors = [];
|
8
|
-
await Promise.all(configFiles.map(async (file) => {
|
8
|
+
await Promise.all(configFiles.map(async (file, idx) => {
|
9
9
|
try {
|
10
10
|
const value = await createNodes(file, options, {
|
11
11
|
...context,
|
12
12
|
configFiles,
|
13
|
-
});
|
13
|
+
}, idx);
|
14
14
|
if (value) {
|
15
15
|
results.push([file, value]);
|
16
16
|
}
|
@@ -35,7 +35,7 @@ export type ConfigurationResult = {
|
|
35
35
|
* @param workspaceFiles A list of non-ignored workspace files
|
36
36
|
* @param plugins The plugins that should be used to infer project configuration
|
37
37
|
*/
|
38
|
-
export declare function
|
38
|
+
export declare function createProjectConfigurationsWithPlugins(root: string, nxJson: NxJsonConfiguration, projectFiles: string[][], // making this parameter allows devkit to pick up newly created projects
|
39
39
|
plugins: LoadedNxPlugin[]): Promise<ConfigurationResult>;
|
40
40
|
export declare function findMatchingConfigFiles(projectFiles: string[], pattern: string, include: string[], exclude: string[]): string[];
|
41
41
|
export declare function readProjectConfigurationsFromRootMap(projectRootMap: Record<string, ProjectConfiguration>): Record<string, ProjectConfiguration>;
|
@@ -66,9 +66,9 @@ export declare function isCompatibleTarget(a: TargetConfiguration, b: TargetConf
|
|
66
66
|
export declare function resolveNxTokensInOptions<T extends Object | Array<unknown>>(object: T, project: ProjectConfiguration, key: string): T;
|
67
67
|
export declare function readTargetDefaultsForTarget(targetName: string, targetDefaults: TargetDefaults, executor?: string): TargetDefaults[string];
|
68
68
|
/**
|
69
|
-
* Expand's `command` syntactic sugar
|
69
|
+
* Expand's `command` syntactic sugar, replaces tokens in options, and adds information from executor schema.
|
70
70
|
* @param target The target to normalize
|
71
71
|
* @param project The project that the target belongs to
|
72
72
|
* @returns The normalized target configuration
|
73
73
|
*/
|
74
|
-
export declare function normalizeTarget(target: TargetConfiguration, project: ProjectConfiguration): TargetConfiguration<any>;
|
74
|
+
export declare function normalizeTarget(target: TargetConfiguration, project: ProjectConfiguration, workspaceRoot: string, projectsMap: Record<string, ProjectConfiguration>): TargetConfiguration<any>;
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.mergeProjectConfigurationIntoRootMap = mergeProjectConfigurationIntoRootMap;
|
4
4
|
exports.mergeMetadata = mergeMetadata;
|
5
|
-
exports.
|
5
|
+
exports.createProjectConfigurationsWithPlugins = createProjectConfigurationsWithPlugins;
|
6
6
|
exports.findMatchingConfigFiles = findMatchingConfigFiles;
|
7
7
|
exports.readProjectConfigurationsFromRootMap = readProjectConfigurationsFromRootMap;
|
8
8
|
exports.validateProject = validateProject;
|
@@ -21,6 +21,7 @@ const perf_hooks_1 = require("perf_hooks");
|
|
21
21
|
const error_types_1 = require("../error-types");
|
22
22
|
const globs_1 = require("../../utils/globs");
|
23
23
|
const delayed_spinner_1 = require("../../utils/delayed-spinner");
|
24
|
+
const executor_utils_1 = require("../../command-line/run/executor-utils");
|
24
25
|
function mergeProjectConfigurationIntoRootMap(projectRootMap, project, configurationSourceMaps, sourceInformation,
|
25
26
|
// This function is used when reading project configuration
|
26
27
|
// in generators, where we don't want to do this.
|
@@ -138,8 +139,20 @@ skipTargetNormalization) {
|
|
138
139
|
const normalizedTarget = skipTargetNormalization
|
139
140
|
? target
|
140
141
|
: resolveCommandSyntacticSugar(target, project.root);
|
141
|
-
|
142
|
-
|
142
|
+
let matchingTargets = [];
|
143
|
+
if ((0, globs_1.isGlobPattern)(targetName)) {
|
144
|
+
// find all targets matching the glob pattern
|
145
|
+
// this will map atomized targets to the glob pattern same as it does for targetDefaults
|
146
|
+
matchingTargets = Object.keys(updatedProjectConfiguration.targets).filter((key) => (0, minimatch_1.minimatch)(key, targetName));
|
147
|
+
}
|
148
|
+
// If no matching targets were found, we can assume that the target name is not (meant to be) a glob pattern
|
149
|
+
if (!matchingTargets.length) {
|
150
|
+
matchingTargets = [targetName];
|
151
|
+
}
|
152
|
+
for (const matchingTargetName of matchingTargets) {
|
153
|
+
const mergedTarget = mergeTargetConfigurations(normalizedTarget, matchingProject.targets?.[matchingTargetName], sourceMap, sourceInformation, `targets.${matchingTargetName}`);
|
154
|
+
updatedProjectConfiguration.targets[matchingTargetName] = mergedTarget;
|
155
|
+
}
|
143
156
|
}
|
144
157
|
}
|
145
158
|
projectRootMap[updatedProjectConfiguration.root] =
|
@@ -222,7 +235,7 @@ function mergeMetadata(sourceMap, sourceInformation, baseSourceMapPath, metadata
|
|
222
235
|
* @param workspaceFiles A list of non-ignored workspace files
|
223
236
|
* @param plugins The plugins that should be used to infer project configuration
|
224
237
|
*/
|
225
|
-
async function
|
238
|
+
async function createProjectConfigurationsWithPlugins(root = workspace_root_1.workspaceRoot, nxJson, projectFiles, // making this parameter allows devkit to pick up newly created projects
|
226
239
|
plugins) {
|
227
240
|
perf_hooks_1.performance.mark('build-project-configs:start');
|
228
241
|
let spinner;
|
@@ -248,12 +261,12 @@ plugins) {
|
|
248
261
|
const results = [];
|
249
262
|
const errors = [];
|
250
263
|
// We iterate over plugins first - this ensures that plugins specified first take precedence.
|
251
|
-
for (const [index, { createNodes: createNodesTuple, include, exclude, name: pluginName },] of plugins.entries()) {
|
264
|
+
for (const [index, { index: pluginIndex, createNodes: createNodesTuple, include, exclude, name: pluginName, },] of plugins.entries()) {
|
252
265
|
const [pattern, createNodes] = createNodesTuple ?? [];
|
253
266
|
if (!pattern) {
|
254
267
|
continue;
|
255
268
|
}
|
256
|
-
const matchingConfigFiles = findMatchingConfigFiles(projectFiles, pattern, include, exclude);
|
269
|
+
const matchingConfigFiles = findMatchingConfigFiles(projectFiles[index], pattern, include, exclude);
|
257
270
|
inProgressPlugins.add(pluginName);
|
258
271
|
let r = createNodes(matchingConfigFiles, {
|
259
272
|
nxJsonConfiguration: nxJson,
|
@@ -265,8 +278,10 @@ plugins) {
|
|
265
278
|
e
|
266
279
|
: // This represents a single plugin erroring out with a hard error.
|
267
280
|
new error_types_1.AggregateCreateNodesError([[null, e]], []);
|
281
|
+
if (pluginIndex !== undefined) {
|
282
|
+
error.pluginIndex = pluginIndex;
|
283
|
+
}
|
268
284
|
(0, error_types_1.formatAggregateCreateNodesError)(error, pluginName);
|
269
|
-
error.pluginIndex = index;
|
270
285
|
// This represents a single plugin erroring out with a hard error.
|
271
286
|
errors.push(error);
|
272
287
|
// The plugin didn't return partial results, so we return an empty array.
|
@@ -280,7 +295,7 @@ plugins) {
|
|
280
295
|
}
|
281
296
|
return Promise.all(results).then((results) => {
|
282
297
|
spinner?.cleanup();
|
283
|
-
const { projectRootMap, externalNodes, rootMap, configurationSourceMaps } = mergeCreateNodesResults(results, nxJson, errors);
|
298
|
+
const { projectRootMap, externalNodes, rootMap, configurationSourceMaps } = mergeCreateNodesResults(results, nxJson, root, errors);
|
284
299
|
perf_hooks_1.performance.mark('build-project-configs:end');
|
285
300
|
perf_hooks_1.performance.measure('build-project-configs', 'build-project-configs:start', 'build-project-configs:end');
|
286
301
|
if (errors.length === 0) {
|
@@ -289,7 +304,7 @@ plugins) {
|
|
289
304
|
externalNodes,
|
290
305
|
projectRootMap: rootMap,
|
291
306
|
sourceMaps: configurationSourceMaps,
|
292
|
-
matchingProjectFiles: projectFiles,
|
307
|
+
matchingProjectFiles: projectFiles.flat(),
|
293
308
|
};
|
294
309
|
}
|
295
310
|
else {
|
@@ -298,18 +313,18 @@ plugins) {
|
|
298
313
|
externalNodes,
|
299
314
|
projectRootMap: rootMap,
|
300
315
|
sourceMaps: configurationSourceMaps,
|
301
|
-
matchingProjectFiles: projectFiles,
|
316
|
+
matchingProjectFiles: projectFiles.flat(),
|
302
317
|
});
|
303
318
|
}
|
304
319
|
});
|
305
320
|
}
|
306
|
-
function mergeCreateNodesResults(results, nxJsonConfiguration, errors) {
|
321
|
+
function mergeCreateNodesResults(results, nxJsonConfiguration, workspaceRoot, errors) {
|
307
322
|
perf_hooks_1.performance.mark('createNodes:merge - start');
|
308
323
|
const projectRootMap = {};
|
309
324
|
const externalNodes = {};
|
310
325
|
const configurationSourceMaps = {};
|
311
326
|
for (const result of results.flat()) {
|
312
|
-
const [pluginName, file, nodes,
|
327
|
+
const [pluginName, file, nodes, pluginIndex] = result;
|
313
328
|
const { projects: projectNodes, externalNodes: pluginExternalNodes } = nodes;
|
314
329
|
const sourceInfo = [file, pluginName];
|
315
330
|
for (const node in projectNodes) {
|
@@ -329,14 +344,14 @@ function mergeCreateNodesResults(results, nxJsonConfiguration, errors) {
|
|
329
344
|
file,
|
330
345
|
pluginName,
|
331
346
|
error,
|
332
|
-
pluginIndex
|
347
|
+
pluginIndex,
|
333
348
|
}));
|
334
349
|
}
|
335
350
|
}
|
336
351
|
Object.assign(externalNodes, pluginExternalNodes);
|
337
352
|
}
|
338
353
|
try {
|
339
|
-
validateAndNormalizeProjectRootMap(projectRootMap, nxJsonConfiguration, configurationSourceMaps);
|
354
|
+
validateAndNormalizeProjectRootMap(workspaceRoot, projectRootMap, nxJsonConfiguration, configurationSourceMaps);
|
340
355
|
}
|
341
356
|
catch (e) {
|
342
357
|
if ((0, error_types_1.isProjectsWithNoNameError)(e) ||
|
@@ -414,7 +429,7 @@ function readProjectConfigurationsFromRootMap(projectRootMap) {
|
|
414
429
|
}
|
415
430
|
return projects;
|
416
431
|
}
|
417
|
-
function validateAndNormalizeProjectRootMap(projectRootMap, nxJsonConfiguration, sourceMaps = {}) {
|
432
|
+
function validateAndNormalizeProjectRootMap(workspaceRoot, projectRootMap, nxJsonConfiguration, sourceMaps = {}) {
|
418
433
|
// Name -> Project, used to validate that all projects have unique names
|
419
434
|
const projects = {};
|
420
435
|
// If there are projects that have the same name, that is an error.
|
@@ -447,7 +462,7 @@ function validateAndNormalizeProjectRootMap(projectRootMap, nxJsonConfiguration,
|
|
447
462
|
throw e;
|
448
463
|
}
|
449
464
|
}
|
450
|
-
normalizeTargets(project, sourceMaps, nxJsonConfiguration);
|
465
|
+
normalizeTargets(project, sourceMaps, nxJsonConfiguration, workspaceRoot, projects);
|
451
466
|
}
|
452
467
|
if (conflicts.size > 0) {
|
453
468
|
throw new error_types_1.MultipleProjectsWithSameNameError(conflicts, projects);
|
@@ -457,15 +472,19 @@ function validateAndNormalizeProjectRootMap(projectRootMap, nxJsonConfiguration,
|
|
457
472
|
}
|
458
473
|
return projectRootMap;
|
459
474
|
}
|
460
|
-
function normalizeTargets(project, sourceMaps, nxJsonConfiguration
|
475
|
+
function normalizeTargets(project, sourceMaps, nxJsonConfiguration, workspaceRoot,
|
476
|
+
/**
|
477
|
+
* Project configurations keyed by project name
|
478
|
+
*/
|
479
|
+
projects) {
|
461
480
|
for (const targetName in project.targets) {
|
462
|
-
project.targets[targetName] = normalizeTarget(project.targets[targetName], project);
|
481
|
+
project.targets[targetName] = normalizeTarget(project.targets[targetName], project, workspaceRoot, projects);
|
463
482
|
const projectSourceMaps = sourceMaps[project.root];
|
464
483
|
const targetConfig = project.targets[targetName];
|
465
484
|
const targetDefaults = deepClone(readTargetDefaultsForTarget(targetName, nxJsonConfiguration.targetDefaults, targetConfig.executor));
|
466
485
|
// We only apply defaults if they exist
|
467
486
|
if (targetDefaults && isCompatibleTarget(targetConfig, targetDefaults)) {
|
468
|
-
project.targets[targetName] = mergeTargetDefaultWithTargetDefinition(targetName, project, normalizeTarget(targetDefaults, project), projectSourceMaps);
|
487
|
+
project.targets[targetName] = mergeTargetDefaultWithTargetDefinition(targetName, project, normalizeTarget(targetDefaults, project, workspaceRoot, projects), projectSourceMaps);
|
469
488
|
}
|
470
489
|
if (
|
471
490
|
// If the target has no executor or command, it doesn't do anything
|
@@ -775,12 +794,12 @@ function resolveCommandSyntacticSugar(target, key) {
|
|
775
794
|
}
|
776
795
|
}
|
777
796
|
/**
|
778
|
-
* Expand's `command` syntactic sugar
|
797
|
+
* Expand's `command` syntactic sugar, replaces tokens in options, and adds information from executor schema.
|
779
798
|
* @param target The target to normalize
|
780
799
|
* @param project The project that the target belongs to
|
781
800
|
* @returns The normalized target configuration
|
782
801
|
*/
|
783
|
-
function normalizeTarget(target, project) {
|
802
|
+
function normalizeTarget(target, project, workspaceRoot, projectsMap) {
|
784
803
|
target = {
|
785
804
|
...target,
|
786
805
|
configurations: {
|
@@ -793,5 +812,19 @@ function normalizeTarget(target, project) {
|
|
793
812
|
target.configurations[configuration] = resolveNxTokensInOptions(target.configurations[configuration], project, `${project.root}:${target}:${configuration}`);
|
794
813
|
}
|
795
814
|
target.parallelism ??= true;
|
815
|
+
if (target.executor && !('continuous' in target)) {
|
816
|
+
try {
|
817
|
+
const [executorNodeModule, executorName] = (0, executor_utils_1.parseExecutor)(target.executor);
|
818
|
+
const { schema } = (0, executor_utils_1.getExecutorInformation)(executorNodeModule, executorName, workspaceRoot, projectsMap);
|
819
|
+
if (schema.continuous) {
|
820
|
+
target.continuous ??= schema.continuous;
|
821
|
+
}
|
822
|
+
}
|
823
|
+
catch (e) {
|
824
|
+
// If the executor is not found, we assume that it is not a valid executor.
|
825
|
+
// This means that we should not set the continuous property.
|
826
|
+
// We could throw an error here, but it would be better to just ignore it.
|
827
|
+
}
|
828
|
+
}
|
796
829
|
return target;
|
797
830
|
}
|
@@ -23,4 +23,4 @@ export declare function retrieveProjectConfigurations(plugins: LoadedNxPlugin[],
|
|
23
23
|
export declare function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot: string, nxJson: NxJsonConfiguration): Promise<ConfigurationResult>;
|
24
24
|
export declare function retrieveProjectConfigurationPaths(root: string, plugins: Array<LoadedNxPlugin>): Promise<string[]>;
|
25
25
|
export declare function retrieveProjectConfigurationsWithoutPluginInference(root: string): Promise<Record<string, ProjectConfiguration>>;
|
26
|
-
export declare function
|
26
|
+
export declare function getGlobPatternsOfPlugins(plugins: Array<LoadedNxPlugin>): string[];
|
@@ -5,7 +5,7 @@ exports.retrieveProjectConfigurations = retrieveProjectConfigurations;
|
|
5
5
|
exports.retrieveProjectConfigurationsWithAngularProjects = retrieveProjectConfigurationsWithAngularProjects;
|
6
6
|
exports.retrieveProjectConfigurationPaths = retrieveProjectConfigurationPaths;
|
7
7
|
exports.retrieveProjectConfigurationsWithoutPluginInference = retrieveProjectConfigurationsWithoutPluginInference;
|
8
|
-
exports.
|
8
|
+
exports.getGlobPatternsOfPlugins = getGlobPatternsOfPlugins;
|
9
9
|
const perf_hooks_1 = require("perf_hooks");
|
10
10
|
const angular_json_1 = require("../../adapter/angular-json");
|
11
11
|
const nx_json_1 = require("../../config/nx-json");
|
@@ -41,9 +41,10 @@ async function retrieveWorkspaceFiles(workspaceRoot, projectRootMap) {
|
|
41
41
|
* Walk through the workspace and return `ProjectConfigurations`. Only use this if the projectFileMap is not needed.
|
42
42
|
*/
|
43
43
|
async function retrieveProjectConfigurations(plugins, workspaceRoot, nxJson) {
|
44
|
-
const
|
45
|
-
const
|
46
|
-
|
44
|
+
const pluginsWithCreateNodes = plugins.filter((p) => !!p.createNodes);
|
45
|
+
const globPatterns = getGlobPatternsOfPlugins(pluginsWithCreateNodes);
|
46
|
+
const pluginConfigFiles = await (0, workspace_context_1.multiGlobWithWorkspaceContext)(workspaceRoot, globPatterns);
|
47
|
+
return (0, project_configuration_utils_1.createProjectConfigurationsWithPlugins)(workspaceRoot, nxJson, pluginConfigFiles, pluginsWithCreateNodes);
|
47
48
|
}
|
48
49
|
async function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot, nxJson) {
|
49
50
|
const pluginsToLoad = nxJson?.plugins ?? [];
|
@@ -56,31 +57,26 @@ async function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot, n
|
|
56
57
|
const res = await retrieveProjectConfigurations(plugins, workspaceRoot, nxJson);
|
57
58
|
return res;
|
58
59
|
}
|
59
|
-
function retrieveProjectConfigurationPaths(root, plugins) {
|
60
|
-
const projectGlobPatterns =
|
61
|
-
|
60
|
+
async function retrieveProjectConfigurationPaths(root, plugins) {
|
61
|
+
const projectGlobPatterns = getGlobPatternsOfPlugins(plugins);
|
62
|
+
const pluginConfigFiles = await (0, workspace_context_1.multiGlobWithWorkspaceContext)(root, projectGlobPatterns);
|
63
|
+
return pluginConfigFiles.flat();
|
62
64
|
}
|
63
65
|
const projectsWithoutPluginCache = new Map();
|
64
66
|
// TODO: This function is called way too often, it should be optimized without this cache
|
65
67
|
async function retrieveProjectConfigurationsWithoutPluginInference(root) {
|
66
68
|
const nxJson = (0, nx_json_1.readNxJson)(root);
|
67
69
|
const plugins = await (0, get_plugins_1.getOnlyDefaultPlugins)(); // only load default plugins
|
68
|
-
const projectGlobPatterns =
|
70
|
+
const projectGlobPatterns = getGlobPatternsOfPlugins(plugins);
|
69
71
|
const cacheKey = root + ',' + projectGlobPatterns.join(',');
|
70
72
|
if (projectsWithoutPluginCache.has(cacheKey)) {
|
71
73
|
return projectsWithoutPluginCache.get(cacheKey);
|
72
74
|
}
|
73
|
-
const projectFiles = (await (0, workspace_context_1.
|
74
|
-
const { projects } = await (0, project_configuration_utils_1.
|
75
|
+
const projectFiles = (await (0, workspace_context_1.multiGlobWithWorkspaceContext)(root, projectGlobPatterns)) ?? [];
|
76
|
+
const { projects } = await (0, project_configuration_utils_1.createProjectConfigurationsWithPlugins)(root, nxJson, projectFiles, plugins);
|
75
77
|
projectsWithoutPluginCache.set(cacheKey, projects);
|
76
78
|
return projects;
|
77
79
|
}
|
78
|
-
function
|
79
|
-
|
80
|
-
for (const plugin of plugins) {
|
81
|
-
if ('createNodes' in plugin && plugin.createNodes) {
|
82
|
-
globPatterns.push(plugin.createNodes[0]);
|
83
|
-
}
|
84
|
-
}
|
85
|
-
return globPatterns;
|
80
|
+
function getGlobPatternsOfPlugins(plugins) {
|
81
|
+
return plugins.map((p) => p.createNodes[0]);
|
86
82
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { TaskResult } from '../../config/misc-interfaces';
|
2
2
|
import type { TaskGraph } from '../../config/task-graph';
|
3
|
+
import type { ProjectGraph } from '../../config/project-graph';
|
3
4
|
export declare enum BatchMessageType {
|
4
5
|
RunTasks = 0,
|
5
6
|
CompleteTask = 1,
|
@@ -18,6 +19,7 @@ export interface BatchTaskResult {
|
|
18
19
|
export interface RunTasksMessage {
|
19
20
|
type: BatchMessageType.RunTasks;
|
20
21
|
executorName: string;
|
22
|
+
projectGraph: ProjectGraph;
|
21
23
|
batchTaskGraph: TaskGraph;
|
22
24
|
fullTaskGraph: TaskGraph;
|
23
25
|
}
|
@@ -8,12 +8,11 @@ const configuration_1 = require("../../config/configuration");
|
|
8
8
|
const async_iterator_1 = require("../../utils/async-iterator");
|
9
9
|
const executor_utils_1 = require("../../command-line/run/executor-utils");
|
10
10
|
function getBatchExecutor(executorName, projects) {
|
11
|
-
const [nodeModule, exportName] =
|
11
|
+
const [nodeModule, exportName] = (0, executor_utils_1.parseExecutor)(executorName);
|
12
12
|
return (0, executor_utils_1.getExecutorInformation)(nodeModule, exportName, workspace_root_1.workspaceRoot, projects);
|
13
13
|
}
|
14
|
-
async function runTasks(executorName, batchTaskGraph, fullTaskGraph) {
|
14
|
+
async function runTasks(executorName, projectGraph, batchTaskGraph, fullTaskGraph) {
|
15
15
|
const input = {};
|
16
|
-
const projectGraph = await (0, project_graph_1.createProjectGraphAsync)();
|
17
16
|
const projectsConfigurations = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
|
18
17
|
const nxJsonConfiguration = (0, configuration_1.readNxJson)();
|
19
18
|
const batchExecutor = getBatchExecutor(executorName, projectsConfigurations.projects);
|
@@ -66,7 +65,7 @@ async function runTasks(executorName, batchTaskGraph, fullTaskGraph) {
|
|
66
65
|
process.on('message', async (message) => {
|
67
66
|
switch (message.type) {
|
68
67
|
case batch_messages_1.BatchMessageType.RunTasks: {
|
69
|
-
const results = await runTasks(message.executorName, message.batchTaskGraph, message.fullTaskGraph);
|
68
|
+
const results = await runTasks(message.executorName, message.projectGraph, message.batchTaskGraph, message.fullTaskGraph);
|
70
69
|
process.send({
|
71
70
|
type: batch_messages_1.BatchMessageType.CompleteBatchExecution,
|
72
71
|
results,
|
@@ -15,6 +15,7 @@ export declare function dbCacheEnabled(nxJson?: NxJsonConfiguration): boolean;
|
|
15
15
|
export declare function getCache(options: DefaultTasksRunnerOptions): DbCache | Cache;
|
16
16
|
export declare class DbCache {
|
17
17
|
private readonly options;
|
18
|
+
private nxJson;
|
18
19
|
private cache;
|
19
20
|
private remoteCache;
|
20
21
|
private remoteCachePromise;
|
@@ -25,18 +26,20 @@ export declare class DbCache {
|
|
25
26
|
});
|
26
27
|
init(): Promise<void>;
|
27
28
|
get(task: Task): Promise<CachedResult | null>;
|
29
|
+
getUsedCacheSpace(): number;
|
28
30
|
private applyRemoteCacheResults;
|
29
31
|
put(task: Task, terminalOutput: string | null, outputs: string[], code: number): Promise<void>;
|
30
|
-
copyFilesFromCache(_: string, cachedResult: CachedResult, outputs: string[]): Promise<
|
32
|
+
copyFilesFromCache(_: string, cachedResult: CachedResult, outputs: string[]): Promise<number>;
|
31
33
|
removeOldCacheRecords(): void;
|
32
34
|
temporaryOutputPath(task: Task): string;
|
33
35
|
private getRemoteCache;
|
34
36
|
private _getRemoteCache;
|
35
|
-
private
|
36
|
-
private
|
37
|
-
private
|
38
|
-
private
|
39
|
-
private
|
37
|
+
private getS3Cache;
|
38
|
+
private getSharedCache;
|
39
|
+
private getGcsCache;
|
40
|
+
private getAzureCache;
|
41
|
+
private getHttpCache;
|
42
|
+
private resolveRemoteCache;
|
40
43
|
private resolvePackage;
|
41
44
|
private assertCacheIsValid;
|
42
45
|
}
|
@@ -66,3 +69,14 @@ export declare class Cache {
|
|
66
69
|
private createCacheDir;
|
67
70
|
private createTerminalOutputsDir;
|
68
71
|
}
|
72
|
+
/**
|
73
|
+
* Converts a string representation of a max cache size to a number.
|
74
|
+
*
|
75
|
+
* e.g. '1GB' -> 1024 * 1024 * 1024
|
76
|
+
* '1MB' -> 1024 * 1024
|
77
|
+
* '1KB' -> 1024
|
78
|
+
*
|
79
|
+
* @param maxCacheSize Max cache size as specified in nx.json
|
80
|
+
*/
|
81
|
+
export declare function parseMaxCacheSize(maxCacheSize: string | number): number | undefined;
|
82
|
+
export declare function formatCacheSize(maxCacheSize: number, decimals?: number): string;
|