nx
Advanced tools
Comparing version 19.5.0-canary.20240712-0b0db78 to 19.5.0-canary.20240713-6f50d9f
{ | ||
"name": "nx", | ||
"version": "19.5.0-canary.20240712-0b0db78", | ||
"version": "19.5.0-canary.20240713-6f50d9f", | ||
"private": false, | ||
@@ -74,3 +74,3 @@ "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.", | ||
"ora": "5.3.0", | ||
"@nrwl/tao": "19.5.0-canary.20240712-0b0db78" | ||
"@nrwl/tao": "19.5.0-canary.20240713-6f50d9f" | ||
}, | ||
@@ -90,12 +90,12 @@ "peerDependencies": { | ||
"optionalDependencies": { | ||
"@nx/nx-darwin-x64": "19.5.0-canary.20240712-0b0db78", | ||
"@nx/nx-darwin-arm64": "19.5.0-canary.20240712-0b0db78", | ||
"@nx/nx-linux-x64-gnu": "19.5.0-canary.20240712-0b0db78", | ||
"@nx/nx-linux-x64-musl": "19.5.0-canary.20240712-0b0db78", | ||
"@nx/nx-win32-x64-msvc": "19.5.0-canary.20240712-0b0db78", | ||
"@nx/nx-linux-arm64-gnu": "19.5.0-canary.20240712-0b0db78", | ||
"@nx/nx-linux-arm64-musl": "19.5.0-canary.20240712-0b0db78", | ||
"@nx/nx-linux-arm-gnueabihf": "19.5.0-canary.20240712-0b0db78", | ||
"@nx/nx-win32-arm64-msvc": "19.5.0-canary.20240712-0b0db78", | ||
"@nx/nx-freebsd-x64": "19.5.0-canary.20240712-0b0db78" | ||
"@nx/nx-darwin-x64": "19.5.0-canary.20240713-6f50d9f", | ||
"@nx/nx-darwin-arm64": "19.5.0-canary.20240713-6f50d9f", | ||
"@nx/nx-linux-x64-gnu": "19.5.0-canary.20240713-6f50d9f", | ||
"@nx/nx-linux-x64-musl": "19.5.0-canary.20240713-6f50d9f", | ||
"@nx/nx-win32-x64-msvc": "19.5.0-canary.20240713-6f50d9f", | ||
"@nx/nx-linux-arm64-gnu": "19.5.0-canary.20240713-6f50d9f", | ||
"@nx/nx-linux-arm64-musl": "19.5.0-canary.20240713-6f50d9f", | ||
"@nx/nx-linux-arm-gnueabihf": "19.5.0-canary.20240713-6f50d9f", | ||
"@nx/nx-win32-arm64-msvc": "19.5.0-canary.20240713-6f50d9f", | ||
"@nx/nx-freebsd-x64": "19.5.0-canary.20240713-6f50d9f" | ||
}, | ||
@@ -102,0 +102,0 @@ "nx-migrations": { |
@@ -7,2 +7,23 @@ { | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"description": "Project's name. Optional if specified in workspace.json" | ||
}, | ||
"root": { | ||
"type": "string", | ||
"description": "Project's location relative to the root of the workspace" | ||
}, | ||
"sourceRoot": { | ||
"type": "string", | ||
"description": "The location of project's sources relative to the root of the workspace" | ||
}, | ||
"projectType": { | ||
"type": "string", | ||
"description": "Type of project supported", | ||
"enum": ["library", "application"] | ||
}, | ||
"generators": { | ||
"type": "object", | ||
"description": "List of default values used by generators" | ||
}, | ||
"namedInputs": { | ||
@@ -116,2 +137,7 @@ "type": "object", | ||
"description": "Specifies if the given target should be cacheable" | ||
}, | ||
"parallelism": { | ||
"type": "boolean", | ||
"default": true, | ||
"description": "Whether this target can be run in parallel with other tasks" | ||
} | ||
@@ -118,0 +144,0 @@ } |
@@ -781,4 +781,4 @@ "use strict"; | ||
return (0, node_child_process_1.execSync)(command, { | ||
cwd: (0, path_1.join)(workspace_root_1.workspaceRoot, project.data.root), | ||
cwd: target.options?.cwd ?? workspace_root_1.workspaceRoot, | ||
}).toString(); | ||
} |
@@ -83,2 +83,6 @@ /** | ||
cache?: boolean; | ||
/** | ||
* Determines if a given task should be parallelizable. | ||
*/ | ||
parallelism: boolean; | ||
} | ||
@@ -85,0 +89,0 @@ /** |
@@ -215,2 +215,7 @@ import type { NxJsonConfiguration, NxReleaseVersionConfiguration } from './nx-json'; | ||
metadata?: TargetMetadata; | ||
/** | ||
* Whether this target can be run in parallel with other tasks | ||
* Default is true | ||
*/ | ||
parallelism?: boolean; | ||
} |
@@ -188,2 +188,3 @@ /* auto-generated by NAPI-RS */ | ||
configurations?: string | ||
parallelism?: boolean | ||
} | ||
@@ -190,0 +191,0 @@ |
@@ -17,2 +17,3 @@ "use strict"; | ||
configurations: JSON.stringify(targetConfig.configurations), | ||
parallelism: targetConfig.parallelism, | ||
}; | ||
@@ -19,0 +20,0 @@ } |
@@ -21,2 +21,3 @@ "use strict"; | ||
const error_types_1 = require("../error-types"); | ||
const globs_1 = require("../../utils/globs"); | ||
function mergeProjectConfigurationIntoRootMap(projectRootMap, project, configurationSourceMaps, sourceInformation, | ||
@@ -713,6 +714,19 @@ // This function is used when reading project configuration | ||
} | ||
else { | ||
else if (targetDefaults?.[targetName]) { | ||
// If the executor is not defined, the only key we have is the target name. | ||
return targetDefaults?.[targetName]; | ||
} | ||
let matchingTargetDefaultKey = null; | ||
for (const key in targetDefaults ?? {}) { | ||
if ((0, globs_1.isGlobPattern)(key) && (0, minimatch_1.minimatch)(targetName, key)) { | ||
if (!matchingTargetDefaultKey || | ||
matchingTargetDefaultKey.length < key.length) { | ||
matchingTargetDefaultKey = key; | ||
} | ||
} | ||
} | ||
if (matchingTargetDefaultKey) { | ||
return targetDefaults[matchingTargetDefaultKey]; | ||
} | ||
return {}; | ||
} | ||
@@ -759,3 +773,4 @@ function createRootMap(projectRootMap) { | ||
} | ||
target.parallelism ??= true; | ||
return target; | ||
} |
@@ -159,2 +159,3 @@ "use strict"; | ||
cache: project.data.targets[target].cache, | ||
parallelism: project.data.targets[target].parallelism ?? true, | ||
}; | ||
@@ -161,0 +162,0 @@ } |
@@ -17,2 +17,3 @@ import { DefaultTasksRunnerOptions } from './default-tasks-runner'; | ||
private scheduledTasks; | ||
private runningTasks; | ||
private completedTasks; | ||
@@ -19,0 +20,0 @@ private scheduleRequestsExecutionChain; |
@@ -17,2 +17,3 @@ "use strict"; | ||
this.scheduledTasks = []; | ||
this.runningTasks = new Set(); | ||
this.completedTasks = new Set(); | ||
@@ -35,2 +36,3 @@ this.scheduleRequestsExecutionChain = Promise.resolve(); | ||
this.completedTasks.add(taskId); | ||
this.runningTasks.delete(taskId); | ||
} | ||
@@ -89,2 +91,3 @@ this.notScheduledTaskGraph = (0, utils_1.removeTasksFromTaskGraph)(this.notScheduledTaskGraph, taskIds); | ||
}); | ||
this.runningTasks.add(taskId); | ||
} | ||
@@ -108,3 +111,3 @@ async scheduleBatches() { | ||
async processTaskForBatches(batches, task, rootExecutorName, isRoot) { | ||
if (!this.canBatchTaskBeScheduled(task.id, batches[rootExecutorName])) { | ||
if (!this.canBatchTaskBeScheduled(task, batches[rootExecutorName])) { | ||
return; | ||
@@ -138,10 +141,31 @@ } | ||
} | ||
canBatchTaskBeScheduled(taskId, batchTaskGraph) { | ||
canBatchTaskBeScheduled(task, batchTaskGraph) { | ||
// task self needs to have parallelism true | ||
// all deps have either completed or belong to the same batch | ||
return this.taskGraph.dependencies[taskId].every((id) => this.completedTasks.has(id) || !!batchTaskGraph?.tasks[id]); | ||
return (task.parallelism === true && | ||
this.taskGraph.dependencies[task.id].every((id) => this.completedTasks.has(id) || !!batchTaskGraph?.tasks[id])); | ||
} | ||
canBeScheduled(taskId) { | ||
return this.taskGraph.dependencies[taskId].every((id) => this.completedTasks.has(id)); | ||
const hasDependenciesCompleted = this.taskGraph.dependencies[taskId].every((id) => this.completedTasks.has(id)); | ||
// if dependencies have not completed, cannot schedule | ||
if (!hasDependenciesCompleted) { | ||
return false; | ||
} | ||
// if there are no running tasks, can schedule anything | ||
if (this.runningTasks.size === 0) { | ||
return true; | ||
} | ||
const runningTasksNotSupportParallelism = Array.from(this.runningTasks).some((taskId) => { | ||
return this.taskGraph.tasks[taskId].parallelism === false; | ||
}); | ||
if (runningTasksNotSupportParallelism) { | ||
// if any running tasks do not support parallelism, no other tasks can be scheduled | ||
return false; | ||
} | ||
else { | ||
// if all running tasks support parallelism, can only schedule task with parallelism | ||
return this.taskGraph.tasks[taskId].parallelism === true; | ||
} | ||
} | ||
} | ||
exports.TasksSchedule = TasksSchedule; |
@@ -39,2 +39,3 @@ "use strict"; | ||
const minimatch_1 = require("minimatch"); | ||
const globs_1 = require("../utils/globs"); | ||
function getDependencyConfigs({ project, target }, extraTargetDependencies, projectGraph, allTargetNames) { | ||
@@ -81,3 +82,3 @@ const dependencyConfigs = (projectGraph.nodes[project].data?.targets[target]?.dependsOn ?? | ||
function expandWildcardTargetConfiguration(dependencyConfig, allTargetNames) { | ||
if (!find_matching_projects_1.GLOB_CHARACTERS.some((char) => dependencyConfig.target.includes(char))) { | ||
if (!(0, globs_1.isGlobPattern)(dependencyConfig.target)) { | ||
return [dependencyConfig]; | ||
@@ -84,0 +85,0 @@ } |
import type { ProjectGraphProjectNode } from '../config/project-graph'; | ||
/** | ||
* The presence of these characters in a string indicates that it might be a glob pattern. | ||
*/ | ||
export declare const GLOB_CHARACTERS: string[]; | ||
/** | ||
* Find matching project names given a list of potential project names or globs. | ||
@@ -8,0 +4,0 @@ * |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getMatchingStringsWithCache = exports.GLOB_CHARACTERS = void 0; | ||
exports.getMatchingStringsWithCache = void 0; | ||
exports.findMatchingProjects = findMatchingProjects; | ||
const minimatch_1 = require("minimatch"); | ||
const globs_1 = require("./globs"); | ||
const validPatternTypes = [ | ||
@@ -13,6 +14,2 @@ 'name', // Pattern is based on the project's name | ||
/** | ||
* The presence of these characters in a string indicates that it might be a glob pattern. | ||
*/ | ||
exports.GLOB_CHARACTERS = ['*', '|', '{', '}', '(', ')']; | ||
/** | ||
* Find matching project names given a list of potential project names or globs. | ||
@@ -117,3 +114,3 @@ * | ||
} | ||
if (!exports.GLOB_CHARACTERS.some((c) => pattern.value.includes(c))) { | ||
if (!(0, globs_1.isGlobPattern)(pattern.value)) { | ||
return; | ||
@@ -143,3 +140,3 @@ } | ||
} | ||
if (!exports.GLOB_CHARACTERS.some((c) => pattern.value.includes(c))) { | ||
if (!(0, globs_1.isGlobPattern)(pattern.value)) { | ||
continue; | ||
@@ -146,0 +143,0 @@ } |
export declare function combineGlobPatterns(...patterns: (string | string[])[]): string; | ||
export declare const GLOB_CHARACTERS: Set<string>; | ||
export declare function isGlobPattern(pattern: string): boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GLOB_CHARACTERS = void 0; | ||
exports.combineGlobPatterns = combineGlobPatterns; | ||
exports.isGlobPattern = isGlobPattern; | ||
function combineGlobPatterns(...patterns) { | ||
@@ -8,1 +10,10 @@ const p = patterns.flat(); | ||
} | ||
exports.GLOB_CHARACTERS = new Set(['*', '|', '{', '}', '(', ')', '[']); | ||
function isGlobPattern(pattern) { | ||
for (const c of pattern) { | ||
if (exports.GLOB_CHARACTERS.has(c)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7164872
49017
+ Added@nrwl/tao@19.5.0-canary.20240713-6f50d9f(transitive)
+ Added@nx/nx-darwin-arm64@19.5.0-canary.20240713-6f50d9f(transitive)
+ Added@nx/nx-darwin-x64@19.5.0-canary.20240713-6f50d9f(transitive)
+ Added@nx/nx-freebsd-x64@19.5.0-canary.20240713-6f50d9f(transitive)
+ Added@nx/nx-linux-arm-gnueabihf@19.5.0-canary.20240713-6f50d9f(transitive)
+ Added@nx/nx-linux-arm64-gnu@19.5.0-canary.20240713-6f50d9f(transitive)
+ Added@nx/nx-linux-arm64-musl@19.5.0-canary.20240713-6f50d9f(transitive)
+ Added@nx/nx-linux-x64-gnu@19.5.0-canary.20240713-6f50d9f(transitive)
+ Added@nx/nx-linux-x64-musl@19.5.0-canary.20240713-6f50d9f(transitive)
+ Added@nx/nx-win32-arm64-msvc@19.5.0-canary.20240713-6f50d9f(transitive)
+ Added@nx/nx-win32-x64-msvc@19.5.0-canary.20240713-6f50d9f(transitive)
- Removed@nrwl/tao@19.5.0-canary.20240712-0b0db78(transitive)
- Removed@nx/nx-darwin-arm64@19.5.0-canary.20240712-0b0db78(transitive)
- Removed@nx/nx-darwin-x64@19.5.0-canary.20240712-0b0db78(transitive)
- Removed@nx/nx-freebsd-x64@19.5.0-canary.20240712-0b0db78(transitive)
- Removed@nx/nx-linux-arm-gnueabihf@19.5.0-canary.20240712-0b0db78(transitive)
- Removed@nx/nx-linux-arm64-gnu@19.5.0-canary.20240712-0b0db78(transitive)
- Removed@nx/nx-linux-arm64-musl@19.5.0-canary.20240712-0b0db78(transitive)
- Removed@nx/nx-linux-x64-gnu@19.5.0-canary.20240712-0b0db78(transitive)
- Removed@nx/nx-linux-x64-musl@19.5.0-canary.20240712-0b0db78(transitive)
- Removed@nx/nx-win32-arm64-msvc@19.5.0-canary.20240712-0b0db78(transitive)
- Removed@nx/nx-win32-x64-msvc@19.5.0-canary.20240712-0b0db78(transitive)