nx 24.1.0-beta.0 → 24.1.0-beta.2
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/dist/bin/init-local.js +2 -4
- package/dist/bin/nx-cloud.js +2 -1
- package/dist/bin/nx.js +12 -14
- package/dist/bin/run-executor.js +5 -0
- package/dist/src/adapter/compat.d.ts +1 -1
- package/dist/src/adapter/compat.js +1 -0
- package/dist/src/command-line/completion/scripts/bash.sh +9 -2
- package/dist/src/command-line/completion/scripts/fish.fish +10 -2
- package/dist/src/command-line/completion/scripts/zsh.zsh +8 -2
- package/dist/src/command-line/completion/scripts.js +18 -8
- package/dist/src/command-line/conformance/command-object.d.ts +3 -0
- package/dist/src/command-line/conformance/command-object.js +66 -0
- package/dist/src/command-line/generate/generate.js +2 -4
- package/dist/src/command-line/generate/generator-utils.d.ts +1 -0
- package/dist/src/command-line/generate/generator-utils.js +9 -0
- package/dist/src/command-line/import/import.js +26 -2
- package/dist/src/command-line/import/utils/ai-output.d.ts +9 -1
- package/dist/src/command-line/import/utils/ai-output.js +20 -1
- package/dist/src/command-line/nx-commands.d.ts +1 -1
- package/dist/src/command-line/nx-commands.js +82 -132
- package/dist/src/command-line/release/command-object.d.ts +1 -0
- package/dist/src/command-line/release/command-object.js +4 -0
- package/dist/src/command-line/release/release.js +6 -4
- package/dist/src/command-line/release/utils/repository-git-tags.js +3 -3
- package/dist/src/command-line/release/utils/resolve-nx-json-error-message.js +2 -24
- package/dist/src/command-line/report/report.js +1 -1
- package/dist/src/command-line/reset/reset.js +51 -2
- package/dist/src/config/nx-json.d.ts +117 -0
- package/dist/src/config/workspace-json-project-json.d.ts +6 -7
- package/dist/src/daemon/client/daemon-environment.js +15 -0
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +13 -20
- package/dist/src/devkit-exports.d.ts +1 -1
- package/dist/src/devkit-internals.d.ts +14 -7
- package/dist/src/devkit-internals.js +29 -4
- package/dist/src/executors/run-commands/run-commands.impl.d.ts +1 -1
- package/dist/src/executors/run-commands/run-commands.impl.js +35 -13
- package/dist/src/generators/utils/glob.js +3 -3
- package/dist/src/hasher/hash-task.d.ts +3 -1
- package/dist/src/hasher/hash-task.js +3 -2
- package/dist/src/migrations/update-24-1-0/replace-powerpack-conformance.d.ts +4 -0
- package/dist/src/migrations/update-24-1-0/replace-powerpack-conformance.js +117 -0
- package/dist/src/migrations/update-24-1-0/replace-powerpack-conformance.md +38 -0
- package/dist/src/native/index.d.ts +6 -8
- package/dist/src/native/index.js +18 -0
- package/dist/src/native/native-bindings.js +1 -0
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/native/transform-objects.d.ts +2 -0
- package/dist/src/native/transform-objects.js +15 -0
- package/dist/src/plugins/js/index.js +24 -9
- package/dist/src/plugins/js/lock-file/bun-parser.d.ts +75 -4
- package/dist/src/plugins/js/lock-file/bun-parser.js +976 -142
- package/dist/src/plugins/js/lock-file/lock-file-names.d.ts +6 -0
- package/dist/src/plugins/js/lock-file/lock-file-names.js +16 -0
- package/dist/src/plugins/js/lock-file/lock-file.d.ts +33 -14
- package/dist/src/plugins/js/lock-file/lock-file.js +213 -74
- package/dist/src/plugins/js/lock-file/npm-parser.d.ts +1 -0
- package/dist/src/plugins/js/lock-file/npm-parser.js +66 -2
- package/dist/src/plugins/js/lock-file/pnpm-parser.d.ts +5 -1
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +107 -54
- package/dist/src/plugins/js/lock-file/pruned-output.d.ts +52 -10
- package/dist/src/plugins/js/lock-file/pruned-output.js +132 -66
- package/dist/src/plugins/js/lock-file/utils/local-path-hashes.d.ts +27 -0
- package/dist/src/plugins/js/lock-file/utils/local-path-hashes.js +155 -0
- package/dist/src/plugins/js/lock-file/utils/package-json.d.ts +1 -1
- package/dist/src/plugins/js/lock-file/utils/package-json.js +2 -1
- package/dist/src/plugins/js/package-json/create-package-json.d.ts +1 -0
- package/dist/src/plugins/js/package-json/create-package-json.js +197 -8
- package/dist/src/plugins/js/project-graph/affected/npm-packages.js +50 -2
- package/dist/src/plugins/js/project-graph/build-dependencies/build-dependencies.d.ts +1 -1
- package/dist/src/plugins/js/project-graph/build-dependencies/build-dependencies.js +2 -2
- package/dist/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.js +16 -9
- package/dist/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +17 -28
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +52 -1
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +336 -28
- package/dist/src/plugins/js/utils/register.js +13 -6
- package/dist/src/project-graph/build-project-graph.js +5 -2
- package/dist/src/project-graph/error-types.d.ts +2 -2
- package/dist/src/project-graph/error-types.js +2 -2
- package/dist/src/project-graph/nx-deps-cache.d.ts +3 -2
- package/dist/src/project-graph/nx-deps-cache.js +8 -2
- package/dist/src/project-graph/utils/project-graph-paths.d.ts +8 -0
- package/dist/src/project-graph/utils/project-graph-paths.js +170 -0
- package/dist/src/tasks-runner/batch/run-batch.js +3 -13
- package/dist/src/tasks-runner/cache.js +19 -18
- package/dist/src/tasks-runner/init-tasks-runner.js +23 -17
- package/dist/src/tasks-runner/run-command.js +6 -3
- package/dist/src/tasks-runner/task-orchestrator.d.ts +1 -0
- package/dist/src/tasks-runner/task-orchestrator.js +29 -4
- package/dist/src/tasks-runner/tasks-schedule.js +1 -1
- package/dist/src/tasks-runner/utils.d.ts +2 -1
- package/dist/src/tasks-runner/utils.js +2 -1
- package/dist/src/utils/child-process.js +2 -1
- package/dist/src/utils/find-matching-projects.js +7 -9
- package/dist/src/utils/find-workspace-root.js +2 -4
- package/dist/src/utils/git-utils.d.ts +5 -0
- package/dist/src/utils/git-utils.js +23 -1
- package/dist/src/utils/handle-import.js +14 -2
- package/dist/src/utils/installation-directory.d.ts +16 -0
- package/dist/src/utils/installation-directory.js +96 -2
- package/dist/src/utils/json.d.ts +7 -0
- package/dist/src/utils/json.js +32 -0
- package/dist/src/utils/nx-key.js +11 -8
- package/dist/src/utils/output.d.ts +5 -0
- package/dist/src/utils/output.js +11 -4
- package/dist/src/utils/owned-private-dir.d.ts +10 -0
- package/dist/src/utils/owned-private-dir.js +28 -0
- package/dist/src/utils/package-json.d.ts +7 -0
- package/dist/src/utils/package-json.js +9 -0
- package/dist/src/utils/require-nx-key.js +6 -4
- package/dist/src/utils/workspace-root.d.ts +12 -0
- package/dist/src/utils/workspace-root.js +56 -7
- package/migrations.json +6 -0
- package/package.json +15 -12
- package/schemas/nx-schema.json +75 -9
- package/schemas/project-schema.json +5 -0
|
@@ -82,7 +82,7 @@ function kickOffRecompute() {
|
|
|
82
82
|
// Plugin set we just loaded may already be stale vs disk.
|
|
83
83
|
if (isStale(myPluginsHash))
|
|
84
84
|
return chainToSuccessor(myPromise);
|
|
85
|
-
const result = await processFilesAndCreateAndSerializeProjectGraph(plugins);
|
|
85
|
+
const result = await processFilesAndCreateAndSerializeProjectGraph(plugins, myPromise);
|
|
86
86
|
// Compute may have run against plugins that are now stale.
|
|
87
87
|
if (isStale(myPluginsHash))
|
|
88
88
|
return chainToSuccessor(myPromise);
|
|
@@ -111,16 +111,17 @@ function kickOffRecompute() {
|
|
|
111
111
|
function isStale(expectedHash) {
|
|
112
112
|
return readNxJsonPluginsHash() !== expectedHash;
|
|
113
113
|
}
|
|
114
|
-
/**
|
|
115
|
-
* Starts a successor recompute only when this IIFE is still the cached one.
|
|
116
|
-
* If a newer recompute already replaced the cached pointer, that newer
|
|
117
|
-
* recompute will produce the fresh result and we just need to return the
|
|
118
|
-
* pointer so awaiters chain onto it.
|
|
119
|
-
*/
|
|
120
114
|
function chainToSuccessor(myPromise) {
|
|
121
115
|
logger_1.serverLogger.log('Discarding stale recompute result (nx.json plugins changed mid-compute).');
|
|
122
|
-
|
|
116
|
+
return successorOf(myPromise);
|
|
117
|
+
}
|
|
118
|
+
// Kicks a successor unless a newer computation holds the cache: a cleared
|
|
119
|
+
// cache leaves nothing to chain to, and our own promise would await itself.
|
|
120
|
+
function successorOf(myPromise) {
|
|
121
|
+
if (!cachedSerializedProjectGraphPromise ||
|
|
122
|
+
cachedSerializedProjectGraphPromise === myPromise) {
|
|
123
123
|
kickOffRecompute();
|
|
124
|
+
}
|
|
124
125
|
return cachedSerializedProjectGraphPromise;
|
|
125
126
|
}
|
|
126
127
|
function readNxJsonPluginsHash() {
|
|
@@ -403,7 +404,7 @@ function invalidateGraphCache() {
|
|
|
403
404
|
function getRecomputationGeneration() {
|
|
404
405
|
return recomputationGeneration;
|
|
405
406
|
}
|
|
406
|
-
async function processFilesAndCreateAndSerializeProjectGraph(separatedPlugins) {
|
|
407
|
+
async function processFilesAndCreateAndSerializeProjectGraph(separatedPlugins, myPromise) {
|
|
407
408
|
const plugins = [
|
|
408
409
|
...separatedPlugins.specifiedPlugins,
|
|
409
410
|
...separatedPlugins.defaultPlugins,
|
|
@@ -417,23 +418,15 @@ async function processFilesAndCreateAndSerializeProjectGraph(separatedPlugins) {
|
|
|
417
418
|
// forced. A callback landing after this claim re-records and re-queues, and
|
|
418
419
|
// its stamp then marks this computation stale at the drain.
|
|
419
420
|
(0, dotenv_graph_changes_1.clearDotEnvFileHashes)();
|
|
420
|
-
//
|
|
421
|
-
//
|
|
422
|
-
// unwrap chain our caller onto the newer compute's result; pass
|
|
421
|
+
// The generation moved past ours. Returning the cached promise lets the
|
|
422
|
+
// async unwrap chain our caller onto a newer compute's result; pass
|
|
423
423
|
// notifyAbort=true when the graph-phase counters still need balancing.
|
|
424
424
|
const chainToLatest = (notifyAbort) => {
|
|
425
425
|
if (myGeneration === recomputationGeneration)
|
|
426
426
|
return null;
|
|
427
427
|
if (notifyAbort)
|
|
428
428
|
notifyPluginsGraphAborted(plugins);
|
|
429
|
-
|
|
430
|
-
// there is nothing to chain to. Returning undefined lets `if (stale)
|
|
431
|
-
// return stale` fall through and the compute commits stale data.
|
|
432
|
-
// Kick off a successor so we always have a real promise to chain to.
|
|
433
|
-
if (!cachedSerializedProjectGraphPromise) {
|
|
434
|
-
kickOffRecompute();
|
|
435
|
-
}
|
|
436
|
-
return cachedSerializedProjectGraphPromise;
|
|
429
|
+
return successorOf(myPromise);
|
|
437
430
|
};
|
|
438
431
|
try {
|
|
439
432
|
const updatedFilesSnapshot = new Map(collectedUpdatedFiles);
|
|
@@ -29,7 +29,7 @@ export type { TaskResult, TaskResults } from './tasks-runner/life-cycle';
|
|
|
29
29
|
/**
|
|
30
30
|
* @category Workspace
|
|
31
31
|
*/
|
|
32
|
-
export type { ExpandedPluginConfiguration, ImplicitDependencyEntry, ImplicitJsonSubsetDependency, NxAffectedConfig, NxJsonConfiguration, PluginConfiguration, TargetDefaults, TargetDefaultEntry, TargetDefaultValue, TargetDefaultArrayEntry, TargetDefaultFilter, } from './config/nx-json';
|
|
32
|
+
export type { ExpandedPluginConfiguration, ImplicitDependencyEntry, ImplicitJsonSubsetDependency, NxAffectedConfig, NxConformanceConfiguration, NxOwnersConfiguration, NxJsonConfiguration, PluginConfiguration, TargetDefaults, TargetDefaultEntry, TargetDefaultValue, TargetDefaultArrayEntry, TargetDefaultFilter, } from './config/nx-json';
|
|
33
33
|
/**
|
|
34
34
|
* @category Logger
|
|
35
35
|
*/
|
|
@@ -56,6 +56,9 @@ export { formatFilesWithOxfmt, oxfmtConfigFiles, } from './utils/formatters/oxfm
|
|
|
56
56
|
export { readYamlFile } from './utils/fileutils';
|
|
57
57
|
export { globalSpinner } from './utils/spinner';
|
|
58
58
|
export { signalToCode } from './utils/exit-codes';
|
|
59
|
+
export { handleErrors } from './utils/handle-errors';
|
|
60
|
+
export { computeJsonLineNumbers } from './utils/json';
|
|
61
|
+
export { checkCircularPath, circularPathHasPair, expandIgnoredCircularDependencies, findFilesInCircularPath, findFilesWithDynamicImports, getPath, pathExists, } from './project-graph/utils/project-graph-paths';
|
|
59
62
|
export { handleImport } from './utils/handle-import';
|
|
60
63
|
export { PluginCache, safeWriteFileCache } from './utils/plugin-cache-utils';
|
|
61
64
|
export { emitPluginWorkerLog } from './project-graph/plugins/isolation/worker-streaming';
|
|
@@ -82,18 +85,19 @@ export type { ChangedFile, UnregisterCallback } from './daemon/client/client';
|
|
|
82
85
|
export { daemonClient } from './daemon/client/client';
|
|
83
86
|
export type { RunCommandsOptions } from './executors/run-commands/run-commands.impl';
|
|
84
87
|
export { LARGE_BUFFER, interpolateArgsIntoCommand, normalizeArgs as normalizeRunCommandsArgs, } from './executors/run-commands/run-commands.impl';
|
|
85
|
-
export { FsTree } from './generators/tree';
|
|
88
|
+
export { FsTree, flushChanges } from './generators/tree';
|
|
86
89
|
export { getRelativeProjectJsonSchemaPath } from './generators/utils/project-configuration';
|
|
87
90
|
export { hashFile } from './hasher/file-hasher';
|
|
88
91
|
export { filterUsingGlobPatterns, getTargetInputs } from './hasher/task-hasher';
|
|
89
92
|
export type { JsonInput } from './native';
|
|
90
|
-
export { isAiAgent, killProcessTreeGraceful, readShebangHeaders, } from './native';
|
|
93
|
+
export { isAiAgent, killProcessTreeGraceful, readShebangHeaders, unmatchedProjectPatterns, } from './native';
|
|
94
|
+
export { transformProjectGraphForProjectMatching } from './native/transform-objects';
|
|
91
95
|
export { killChildOnHostExit } from './utils/kill-child-on-host-exit';
|
|
92
96
|
export { connectToNxCloud } from './nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud';
|
|
93
97
|
export type { NxCloudOnBoardingStatus } from './nx-cloud/models/onboarding-status';
|
|
94
98
|
export { createNxCloudOnboardingURLForWelcomeApp, getNxCloudAppOnBoardingUrl, } from './nx-cloud/utilities/onboarding';
|
|
95
99
|
export { createNxCloudOnboardingURL } from './nx-cloud/utilities/url-shorten';
|
|
96
|
-
export { createLockFile, generatePrunedDeployOutput, getLockFileName, } from './plugins/js/lock-file/lock-file';
|
|
100
|
+
export { createLockFile, generatePrunedDeployOutput, getLockFileName, hasTextBunLockfile, } from './plugins/js/lock-file/lock-file';
|
|
97
101
|
export { createPackageJson, findProjectsNpmDependencies, } from './plugins/js/package-json/create-package-json';
|
|
98
102
|
export { TargetProjectLocator, isBuiltinModuleImport, } from './plugins/js/project-graph/build-dependencies/target-project-locator';
|
|
99
103
|
export { getWorkspacePackagesFromGraph } from './plugins/js/utils/get-workspace-packages-from-graph';
|
|
@@ -103,10 +107,12 @@ export { buildPackageJsonPatterns, buildPackageJsonWorkspacesMatcher, } from './
|
|
|
103
107
|
export type { Change, FileChange } from './project-graph/file-utils';
|
|
104
108
|
export { DeletedFileChange, LockFileChange, TEN_MEGABYTES, WholeFileChange, calculateFileChanges, defaultFileRead, isDeletedFileChange, isLockFileChange, isWholeFileChange, readPackageJson, } from './project-graph/file-utils';
|
|
105
109
|
export type { FileMapCache } from './project-graph/nx-deps-cache';
|
|
106
|
-
export { readFileMapCache } from './project-graph/nx-deps-cache';
|
|
110
|
+
export { readFileMapCache, readSourceMapsCache, } from './project-graph/nx-deps-cache';
|
|
111
|
+
export { findClosestMatches } from './utils/string-similarity';
|
|
107
112
|
export { isNpmProject } from './project-graph/operators';
|
|
108
113
|
export { buildProjectGraphAndSourceMapsWithoutDaemon, createProjectGraphAndSourceMapsAsync, handleProjectGraphError, preventRecursionInGraphConstruction, readCachedProjectConfiguration, } from './project-graph/project-graph';
|
|
109
114
|
export type { ProjectRootMappings } from './project-graph/utils/find-project-for-path';
|
|
115
|
+
export { createFileMapUsingProjectGraph } from './project-graph/file-map-utils';
|
|
110
116
|
export type { BatchResults } from './tasks-runner/batch/batch-messages';
|
|
111
117
|
export type { CachedResult, TaskWithCachedResult } from './tasks-runner/cache';
|
|
112
118
|
export { Cache } from './tasks-runner/cache';
|
|
@@ -123,16 +129,16 @@ export { runNxSync } from './utils/child-process';
|
|
|
123
129
|
export { codeFrameColumns } from './utils/code-frames';
|
|
124
130
|
export { deduceDefaultBase } from './utils/default-base';
|
|
125
131
|
export { createDirectory, directoryExists, fileExists, isRelativePath, readFileIfExisting, } from './utils/fileutils';
|
|
126
|
-
export { getLatestCommitSha } from './utils/git-utils';
|
|
132
|
+
export { getLatestCommitSha, getVcsRemoteInfo } from './utils/git-utils';
|
|
127
133
|
export { combineGlobPatterns, isGlobPattern } from './utils/globs';
|
|
128
|
-
export { getNxRequirePaths } from './utils/installation-directory';
|
|
134
|
+
export { getNxRequirePaths, resolveInstalledPackage, } from './utils/installation-directory';
|
|
129
135
|
export { NX_PREFIX } from './utils/logger';
|
|
130
136
|
export type { CLIErrorMessageConfig, CLINoteMessageConfig, CLISuccessMessageConfig, CLIWarnMessageConfig, } from './utils/output';
|
|
131
137
|
export { orange } from './utils/output';
|
|
132
138
|
export { getNxCloudUrl, isNxCloudUsed } from './utils/nx-cloud-utils';
|
|
133
139
|
export type { PackageJson, PackageJsonDependencySection, } from './utils/package-json';
|
|
134
140
|
export { readNxMigrateConfig } from './utils/package-json';
|
|
135
|
-
export { dropEmptyPeerDependencySections, movePeerDependencyToDependencies, relocatePrunedLocalPathSpec, warnUnshippableLocalPathSpec, } from './plugins/js/lock-file/pruned-output';
|
|
141
|
+
export { dropEmptyPeerDependencySections, movePeerDependencyToDependencies, relocatePrunedLocalPathSpec, resolveWorkspaceModuleDependency, warnUnshippableLocalPathSpec, } from './plugins/js/lock-file/pruned-output';
|
|
136
142
|
export type { PackageManagerCommands } from './utils/package-manager';
|
|
137
143
|
export { deriveGroupNameFromTarget } from './utils/plugins/atomizer-utils';
|
|
138
144
|
export { findInstalledPlugins } from './utils/plugins/installed-plugins';
|
|
@@ -145,3 +151,4 @@ export { getFilesInDirectoryUsingContext, globWithWorkspaceContext, resetWorkspa
|
|
|
145
151
|
export { setWorkspaceRoot, workspaceRootInner } from './utils/workspace-root';
|
|
146
152
|
export { safeExecFileSync, safeSpawn } from './utils/safe-spawn';
|
|
147
153
|
export { resolveStartupHost } from './tasks-runner/readiness/startup-host';
|
|
154
|
+
export type { ProjectMetadata } from './config/workspace-json-project-json';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hashDaemonClientEnv = exports.getEnvPathsForTask = exports.getGraphTimeDotEnvForTask = exports.getEnvFilesForTask = exports.interpolate = exports.requireWithTsconfigFallback = exports.isTsEsmNamedExportLinkageError = exports.isRequireInEsmScopeError = exports.forceRegisterEsmLoader = exports.loadTsFile = exports.registerTsProject = exports.LoadedNxPlugin = exports.retrieveProjectConfigurations = exports.findProjectForPath = exports.createProjectRootMappings = exports.createProjectRootMappingsFromProjectConfigurations = exports.hashMultiGlobWithWorkspaceContext = exports.hashWithWorkspaceContext = exports.hashObject = exports.splitByColons = exports.installPackageToTmpAsync = exports.installPackageToTmp = exports.readModulePackageJson = exports.stripIndent = exports.sortObjectByKeys = exports.combineOptionsForExecutor = exports.confirmationPrompt = exports.textPrompt = exports.multiselectPrompt = exports.selectPrompt = exports.splitTarget = exports.createPrettierIgnoreChecker = exports.createOxfmtIgnoreChecker = exports.createGitIgnoreChecker = exports.readTargetDefaultsForTarget = exports.createTargetDefaultsResults = exports.findMatchingProjects = exports.findMatchingConfigFiles = exports.readProjectConfigurationsFromRootMap = exports.findMatchingTargetNames = exports.resolveNxTokensInOptions = exports.resolveCommandSyntacticSugar = exports.mergeTargetConfigurations = exports.retrieveProjectConfigurationsWithAngularProjects = exports.calculateDefaultProjectName = exports.readNxJsonFromDisk = exports.parseExecutor = exports.getExecutorInformation = exports.parseVersionFromPackageManagerField = exports.createTempNpmDirectory = void 0;
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.resolveStartupHost = exports.safeSpawn = exports.safeExecFileSync = exports.workspaceRootInner = exports.setWorkspaceRoot = void 0;
|
|
4
|
+
exports.isProjectGraphProjectNode = exports.isProjectGraphExternalNode = exports.fileDataDepType = exports.fileDataDepTarget = exports.BatchFunctionRunner = exports.getGeneratorInformation = exports.setupAiAgentsGenerator = exports.toOldFormat = exports.toNewFormat = exports.runCommandsExecutor = exports.acknowledgeDeclaredBuildScripts = exports.acknowledgeBuildScripts = exports.getCatalogDependenciesFromPackageJson = exports.getCatalogManager = exports.checkFilesAreOutputs = exports.checkFilesAreInputs = exports.PromptResolutionError = exports.resolvePrompt = exports.SchemaResolutionError = exports.ImplementationResolutionError = exports.resolveSchema = exports.resolveImplementation = exports.emitPluginWorkerLog = exports.safeWriteFileCache = exports.PluginCache = exports.handleImport = exports.pathExists = exports.getPath = exports.findFilesWithDynamicImports = exports.findFilesInCircularPath = exports.expandIgnoredCircularDependencies = exports.circularPathHasPair = exports.checkCircularPath = exports.computeJsonLineNumbers = exports.handleErrors = exports.signalToCode = exports.globalSpinner = exports.readYamlFile = exports.oxfmtConfigFiles = exports.formatFilesWithOxfmt = exports.detectFormatterInTree = exports.detectFormatter = exports.prettierConfigFiles = exports.isUsingPrettierInTree = exports.createOverrides = exports.createCliOptions = exports.isCI = exports.applyDaemonEnvFromClient = exports.getAppliedDaemonClientEnv = exports.getDaemonClientEnvGeneration = void 0;
|
|
5
|
+
exports.handleProjectGraphError = exports.createProjectGraphAndSourceMapsAsync = exports.buildProjectGraphAndSourceMapsWithoutDaemon = exports.isNpmProject = exports.findClosestMatches = exports.readSourceMapsCache = exports.readFileMapCache = exports.readPackageJson = exports.isWholeFileChange = exports.isLockFileChange = exports.isDeletedFileChange = exports.defaultFileRead = exports.calculateFileChanges = exports.WholeFileChange = exports.TEN_MEGABYTES = exports.LockFileChange = exports.DeletedFileChange = exports.buildPackageJsonWorkspacesMatcher = exports.buildPackageJsonPatterns = exports.getGlobPatternsFromPackageManagerWorkspaces = exports.registerTsConfigPaths = exports.getWorkspacePackagesFromGraph = exports.isBuiltinModuleImport = exports.TargetProjectLocator = exports.findProjectsNpmDependencies = exports.createPackageJson = exports.hasTextBunLockfile = exports.getLockFileName = exports.generatePrunedDeployOutput = exports.createLockFile = exports.createNxCloudOnboardingURL = exports.getNxCloudAppOnBoardingUrl = exports.createNxCloudOnboardingURLForWelcomeApp = exports.connectToNxCloud = exports.killChildOnHostExit = exports.transformProjectGraphForProjectMatching = exports.unmatchedProjectPatterns = exports.readShebangHeaders = exports.killProcessTreeGraceful = exports.isAiAgent = exports.getTargetInputs = exports.filterUsingGlobPatterns = exports.hashFile = exports.getRelativeProjectJsonSchemaPath = exports.flushChanges = exports.FsTree = exports.normalizeRunCommandsArgs = exports.interpolateArgsIntoCommand = exports.LARGE_BUFFER = exports.daemonClient = void 0;
|
|
6
|
+
exports.orange = exports.NX_PREFIX = exports.resolveInstalledPackage = exports.getNxRequirePaths = exports.isGlobPattern = exports.combineGlobPatterns = exports.getVcsRemoteInfo = exports.getLatestCommitSha = exports.readFileIfExisting = exports.isRelativePath = exports.fileExists = exports.directoryExists = exports.createDirectory = exports.deduceDefaultBase = exports.codeFrameColumns = exports.runNxSync = exports.workspaceDataDirectory = exports.getLastValueFromAsyncIterableIterator = exports.validateOutputs = exports.unparse = exports.transformLegacyOutputs = exports.shouldStreamOutput = exports.removeTasksFromTaskGraph = exports.readProjectAndTargetFromTargetString = exports.normalizeTargetDependencyWithStringProjects = exports.normalizeDependencyConfigProjects = exports.normalizeDependencyConfigDefinition = exports.isCacheableTask = exports.getUnparsedOverrideArgs = exports.getTargetConfigurationForTask = exports.getSerializedArgsForTask = exports.getPrintableCommandArgsForTask = exports.getOutputs = exports.getExecutorNameForTask = exports.getExecutorForTask = exports.getDependencyConfigs = exports.getCustomHasher = exports.getCliPath = exports.expandWildcardTargetConfiguration = exports.expandInitiatingTasksThroughNoop = exports.expandDependencyConfigSyntaxSugar = exports.createTaskId = exports.calculateReverseDeps = exports.createRunManyDynamicOutputRenderer = exports.CompositeLifeCycle = exports.RemoteCacheV2 = exports.Cache = exports.createFileMapUsingProjectGraph = exports.readCachedProjectConfiguration = exports.preventRecursionInGraphConstruction = void 0;
|
|
7
|
+
exports.resolveStartupHost = exports.safeSpawn = exports.safeExecFileSync = exports.workspaceRootInner = exports.setWorkspaceRoot = exports.setupWorkspaceContext = exports.resetWorkspaceContext = exports.globWithWorkspaceContext = exports.getFilesInDirectoryUsingContext = exports.nxVersion = exports.SyncError = exports.quoteShellArg = exports.getSourceDirOfDependentProjects = exports.findAllProjectNodeDependencies = exports.findInstalledPlugins = exports.deriveGroupNameFromTarget = exports.warnUnshippableLocalPathSpec = exports.resolveWorkspaceModuleDependency = exports.relocatePrunedLocalPathSpec = exports.movePeerDependencyToDependencies = exports.dropEmptyPeerDependencySections = exports.readNxMigrateConfig = exports.isNxCloudUsed = exports.getNxCloudUrl = void 0;
|
|
8
8
|
const tslib_1 = require("tslib");
|
|
9
9
|
/**
|
|
10
10
|
* Note to developers: STOP! These are nx internals, not part of the public
|
|
@@ -133,6 +133,18 @@ var spinner_1 = require("./utils/spinner");
|
|
|
133
133
|
Object.defineProperty(exports, "globalSpinner", { enumerable: true, get: function () { return spinner_1.globalSpinner; } });
|
|
134
134
|
var exit_codes_1 = require("./utils/exit-codes");
|
|
135
135
|
Object.defineProperty(exports, "signalToCode", { enumerable: true, get: function () { return exit_codes_1.signalToCode; } });
|
|
136
|
+
var handle_errors_1 = require("./utils/handle-errors");
|
|
137
|
+
Object.defineProperty(exports, "handleErrors", { enumerable: true, get: function () { return handle_errors_1.handleErrors; } });
|
|
138
|
+
var json_1 = require("./utils/json");
|
|
139
|
+
Object.defineProperty(exports, "computeJsonLineNumbers", { enumerable: true, get: function () { return json_1.computeJsonLineNumbers; } });
|
|
140
|
+
var project_graph_paths_1 = require("./project-graph/utils/project-graph-paths");
|
|
141
|
+
Object.defineProperty(exports, "checkCircularPath", { enumerable: true, get: function () { return project_graph_paths_1.checkCircularPath; } });
|
|
142
|
+
Object.defineProperty(exports, "circularPathHasPair", { enumerable: true, get: function () { return project_graph_paths_1.circularPathHasPair; } });
|
|
143
|
+
Object.defineProperty(exports, "expandIgnoredCircularDependencies", { enumerable: true, get: function () { return project_graph_paths_1.expandIgnoredCircularDependencies; } });
|
|
144
|
+
Object.defineProperty(exports, "findFilesInCircularPath", { enumerable: true, get: function () { return project_graph_paths_1.findFilesInCircularPath; } });
|
|
145
|
+
Object.defineProperty(exports, "findFilesWithDynamicImports", { enumerable: true, get: function () { return project_graph_paths_1.findFilesWithDynamicImports; } });
|
|
146
|
+
Object.defineProperty(exports, "getPath", { enumerable: true, get: function () { return project_graph_paths_1.getPath; } });
|
|
147
|
+
Object.defineProperty(exports, "pathExists", { enumerable: true, get: function () { return project_graph_paths_1.pathExists; } });
|
|
136
148
|
var handle_import_1 = require("./utils/handle-import");
|
|
137
149
|
Object.defineProperty(exports, "handleImport", { enumerable: true, get: function () { return handle_import_1.handleImport; } });
|
|
138
150
|
var plugin_cache_utils_1 = require("./utils/plugin-cache-utils");
|
|
@@ -182,6 +194,7 @@ Object.defineProperty(exports, "interpolateArgsIntoCommand", { enumerable: true,
|
|
|
182
194
|
Object.defineProperty(exports, "normalizeRunCommandsArgs", { enumerable: true, get: function () { return run_commands_impl_2.normalizeArgs; } });
|
|
183
195
|
var tree_1 = require("./generators/tree");
|
|
184
196
|
Object.defineProperty(exports, "FsTree", { enumerable: true, get: function () { return tree_1.FsTree; } });
|
|
197
|
+
Object.defineProperty(exports, "flushChanges", { enumerable: true, get: function () { return tree_1.flushChanges; } });
|
|
185
198
|
var project_configuration_1 = require("./generators/utils/project-configuration");
|
|
186
199
|
Object.defineProperty(exports, "getRelativeProjectJsonSchemaPath", { enumerable: true, get: function () { return project_configuration_1.getRelativeProjectJsonSchemaPath; } });
|
|
187
200
|
var file_hasher_2 = require("./hasher/file-hasher");
|
|
@@ -193,6 +206,9 @@ var native_1 = require("./native");
|
|
|
193
206
|
Object.defineProperty(exports, "isAiAgent", { enumerable: true, get: function () { return native_1.isAiAgent; } });
|
|
194
207
|
Object.defineProperty(exports, "killProcessTreeGraceful", { enumerable: true, get: function () { return native_1.killProcessTreeGraceful; } });
|
|
195
208
|
Object.defineProperty(exports, "readShebangHeaders", { enumerable: true, get: function () { return native_1.readShebangHeaders; } });
|
|
209
|
+
Object.defineProperty(exports, "unmatchedProjectPatterns", { enumerable: true, get: function () { return native_1.unmatchedProjectPatterns; } });
|
|
210
|
+
var transform_objects_1 = require("./native/transform-objects");
|
|
211
|
+
Object.defineProperty(exports, "transformProjectGraphForProjectMatching", { enumerable: true, get: function () { return transform_objects_1.transformProjectGraphForProjectMatching; } });
|
|
196
212
|
var kill_child_on_host_exit_1 = require("./utils/kill-child-on-host-exit");
|
|
197
213
|
Object.defineProperty(exports, "killChildOnHostExit", { enumerable: true, get: function () { return kill_child_on_host_exit_1.killChildOnHostExit; } });
|
|
198
214
|
var connect_to_nx_cloud_1 = require("./nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud");
|
|
@@ -206,6 +222,7 @@ var lock_file_1 = require("./plugins/js/lock-file/lock-file");
|
|
|
206
222
|
Object.defineProperty(exports, "createLockFile", { enumerable: true, get: function () { return lock_file_1.createLockFile; } });
|
|
207
223
|
Object.defineProperty(exports, "generatePrunedDeployOutput", { enumerable: true, get: function () { return lock_file_1.generatePrunedDeployOutput; } });
|
|
208
224
|
Object.defineProperty(exports, "getLockFileName", { enumerable: true, get: function () { return lock_file_1.getLockFileName; } });
|
|
225
|
+
Object.defineProperty(exports, "hasTextBunLockfile", { enumerable: true, get: function () { return lock_file_1.hasTextBunLockfile; } });
|
|
209
226
|
var create_package_json_1 = require("./plugins/js/package-json/create-package-json");
|
|
210
227
|
Object.defineProperty(exports, "createPackageJson", { enumerable: true, get: function () { return create_package_json_1.createPackageJson; } });
|
|
211
228
|
Object.defineProperty(exports, "findProjectsNpmDependencies", { enumerable: true, get: function () { return create_package_json_1.findProjectsNpmDependencies; } });
|
|
@@ -234,6 +251,9 @@ Object.defineProperty(exports, "isWholeFileChange", { enumerable: true, get: fun
|
|
|
234
251
|
Object.defineProperty(exports, "readPackageJson", { enumerable: true, get: function () { return file_utils_1.readPackageJson; } });
|
|
235
252
|
var nx_deps_cache_1 = require("./project-graph/nx-deps-cache");
|
|
236
253
|
Object.defineProperty(exports, "readFileMapCache", { enumerable: true, get: function () { return nx_deps_cache_1.readFileMapCache; } });
|
|
254
|
+
Object.defineProperty(exports, "readSourceMapsCache", { enumerable: true, get: function () { return nx_deps_cache_1.readSourceMapsCache; } });
|
|
255
|
+
var string_similarity_1 = require("./utils/string-similarity");
|
|
256
|
+
Object.defineProperty(exports, "findClosestMatches", { enumerable: true, get: function () { return string_similarity_1.findClosestMatches; } });
|
|
237
257
|
var operators_1 = require("./project-graph/operators");
|
|
238
258
|
Object.defineProperty(exports, "isNpmProject", { enumerable: true, get: function () { return operators_1.isNpmProject; } });
|
|
239
259
|
var project_graph_2 = require("./project-graph/project-graph");
|
|
@@ -242,6 +262,8 @@ Object.defineProperty(exports, "createProjectGraphAndSourceMapsAsync", { enumera
|
|
|
242
262
|
Object.defineProperty(exports, "handleProjectGraphError", { enumerable: true, get: function () { return project_graph_2.handleProjectGraphError; } });
|
|
243
263
|
Object.defineProperty(exports, "preventRecursionInGraphConstruction", { enumerable: true, get: function () { return project_graph_2.preventRecursionInGraphConstruction; } });
|
|
244
264
|
Object.defineProperty(exports, "readCachedProjectConfiguration", { enumerable: true, get: function () { return project_graph_2.readCachedProjectConfiguration; } });
|
|
265
|
+
var file_map_utils_1 = require("./project-graph/file-map-utils");
|
|
266
|
+
Object.defineProperty(exports, "createFileMapUsingProjectGraph", { enumerable: true, get: function () { return file_map_utils_1.createFileMapUsingProjectGraph; } });
|
|
245
267
|
var cache_1 = require("./tasks-runner/cache");
|
|
246
268
|
Object.defineProperty(exports, "Cache", { enumerable: true, get: function () { return cache_1.Cache; } });
|
|
247
269
|
var default_tasks_runner_1 = require("./tasks-runner/default-tasks-runner");
|
|
@@ -295,11 +317,13 @@ Object.defineProperty(exports, "isRelativePath", { enumerable: true, get: functi
|
|
|
295
317
|
Object.defineProperty(exports, "readFileIfExisting", { enumerable: true, get: function () { return fileutils_2.readFileIfExisting; } });
|
|
296
318
|
var git_utils_1 = require("./utils/git-utils");
|
|
297
319
|
Object.defineProperty(exports, "getLatestCommitSha", { enumerable: true, get: function () { return git_utils_1.getLatestCommitSha; } });
|
|
320
|
+
Object.defineProperty(exports, "getVcsRemoteInfo", { enumerable: true, get: function () { return git_utils_1.getVcsRemoteInfo; } });
|
|
298
321
|
var globs_1 = require("./utils/globs");
|
|
299
322
|
Object.defineProperty(exports, "combineGlobPatterns", { enumerable: true, get: function () { return globs_1.combineGlobPatterns; } });
|
|
300
323
|
Object.defineProperty(exports, "isGlobPattern", { enumerable: true, get: function () { return globs_1.isGlobPattern; } });
|
|
301
324
|
var installation_directory_1 = require("./utils/installation-directory");
|
|
302
325
|
Object.defineProperty(exports, "getNxRequirePaths", { enumerable: true, get: function () { return installation_directory_1.getNxRequirePaths; } });
|
|
326
|
+
Object.defineProperty(exports, "resolveInstalledPackage", { enumerable: true, get: function () { return installation_directory_1.resolveInstalledPackage; } });
|
|
303
327
|
var logger_2 = require("./utils/logger");
|
|
304
328
|
Object.defineProperty(exports, "NX_PREFIX", { enumerable: true, get: function () { return logger_2.NX_PREFIX; } });
|
|
305
329
|
var output_1 = require("./utils/output");
|
|
@@ -313,6 +337,7 @@ var pruned_output_1 = require("./plugins/js/lock-file/pruned-output");
|
|
|
313
337
|
Object.defineProperty(exports, "dropEmptyPeerDependencySections", { enumerable: true, get: function () { return pruned_output_1.dropEmptyPeerDependencySections; } });
|
|
314
338
|
Object.defineProperty(exports, "movePeerDependencyToDependencies", { enumerable: true, get: function () { return pruned_output_1.movePeerDependencyToDependencies; } });
|
|
315
339
|
Object.defineProperty(exports, "relocatePrunedLocalPathSpec", { enumerable: true, get: function () { return pruned_output_1.relocatePrunedLocalPathSpec; } });
|
|
340
|
+
Object.defineProperty(exports, "resolveWorkspaceModuleDependency", { enumerable: true, get: function () { return pruned_output_1.resolveWorkspaceModuleDependency; } });
|
|
316
341
|
Object.defineProperty(exports, "warnUnshippableLocalPathSpec", { enumerable: true, get: function () { return pruned_output_1.warnUnshippableLocalPathSpec; } });
|
|
317
342
|
// Sourced from the leaf module rather than ./utils/plugins: the barrel index
|
|
318
343
|
// pulls output.ts and core-plugins.ts into the eager closure for a function that
|
|
@@ -56,7 +56,7 @@ export default function (options: RunCommandsOptions, context: ExecutorContext):
|
|
|
56
56
|
success: boolean;
|
|
57
57
|
terminalOutput: string;
|
|
58
58
|
}>;
|
|
59
|
-
export declare function runCommands(options: RunCommandsOptions, context: ExecutorContext, task?: Pick<Task, 'id' | 'ultracache' | 'continuous'>, baseEnv?: NodeJS.ProcessEnv): Promise<NoopChildProcess | ParallelRunningTasks | import("../../tasks-runner/pseudo-terminal").PseudoTtyProcess | SeriallyRunningTasks>;
|
|
59
|
+
export declare function runCommands(options: RunCommandsOptions, context: ExecutorContext, task?: Pick<Task, 'id' | 'ultracache' | 'continuous'>, baseEnv?: NodeJS.ProcessEnv, warn?: (message: string) => void): Promise<NoopChildProcess | ParallelRunningTasks | import("../../tasks-runner/pseudo-terminal").PseudoTtyProcess | SeriallyRunningTasks>;
|
|
60
60
|
/** The options `interpolateArgsIntoCommand` reads, from the task's options. */
|
|
61
61
|
export declare function normalizeArgs(options: RunCommandsOptions): Pick<NormalizedRunCommandsOptions, 'args' | 'parsedArgs' | '__unparsed__' | 'unknownOptions' | 'unparsedCommandArgs'>;
|
|
62
62
|
export declare function interpolateArgsIntoCommand(command: string, opts: Pick<NormalizedRunCommandsOptions, 'args' | 'parsedArgs' | '__unparsed__' | 'unknownOptions' | 'unparsedCommandArgs'>, forwardAllArgs: boolean, env?: () => NodeJS.ProcessEnv): string;
|
|
@@ -13,6 +13,7 @@ const tokens_1 = require("../../tasks-runner/tokens");
|
|
|
13
13
|
const utils_1 = require("../../tasks-runner/utils");
|
|
14
14
|
const noop_child_process_1 = require("../../tasks-runner/running-tasks/noop-child-process");
|
|
15
15
|
const running_tasks_1 = require("./running-tasks");
|
|
16
|
+
const logger_1 = require("../../utils/logger");
|
|
16
17
|
const shell_quoting_1 = require("../../utils/shell-quoting");
|
|
17
18
|
exports.LARGE_BUFFER = 1024 * 1000000;
|
|
18
19
|
const propKeys = [
|
|
@@ -23,6 +24,7 @@ const propKeys = [
|
|
|
23
24
|
'parallel',
|
|
24
25
|
'no-parallel',
|
|
25
26
|
'readyWhen',
|
|
27
|
+
'readyWhenStatus',
|
|
26
28
|
'cwd',
|
|
27
29
|
'args',
|
|
28
30
|
'envFile',
|
|
@@ -42,9 +44,13 @@ async function default_1(options, context) {
|
|
|
42
44
|
success: results.code === 0,
|
|
43
45
|
};
|
|
44
46
|
}
|
|
45
|
-
async function runCommands(options, context, task, baseEnv) {
|
|
47
|
+
async function runCommands(options, context, task, baseEnv, warn = (message) => logger_1.logger.warn(message)) {
|
|
48
|
+
// The orchestrator's in-process path passes the task with a stub context,
|
|
49
|
+
// so prefer it.
|
|
50
|
+
const resolvedTaskId = task?.id ??
|
|
51
|
+
(0, utils_1.createTaskId)(context.projectName, context.targetName, context.configurationName);
|
|
46
52
|
let env;
|
|
47
|
-
const normalized = normalizeOptions(options, () => (env ??= (0, running_tasks_1.processEnv)(options.color, (0, running_tasks_1.calculateCwd)(options.cwd, context), options.env ?? {}, options.envFile, baseEnv)));
|
|
53
|
+
const normalized = normalizeOptions(options, () => (env ??= (0, running_tasks_1.processEnv)(options.color, (0, running_tasks_1.calculateCwd)(options.cwd, context), options.env ?? {}, options.envFile, baseEnv)), resolvedTaskId, warn);
|
|
48
54
|
if (normalized.readyWhenStatus.length && !normalized.parallel) {
|
|
49
55
|
throw new Error('ERROR: Bad executor config for run-commands - "readyWhen" can only be used when "parallel=true".');
|
|
50
56
|
}
|
|
@@ -65,13 +71,9 @@ async function runCommands(options, context, task, baseEnv) {
|
|
|
65
71
|
normalized.usePty;
|
|
66
72
|
const tuiEnabled = (0, is_tui_enabled_1.isTuiEnabled)();
|
|
67
73
|
try {
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
//
|
|
71
|
-
// and only then is the config unknowable, which counts as tracked and
|
|
72
|
-
// discrete.
|
|
73
|
-
const resolvedTaskId = task?.id ??
|
|
74
|
-
(0, utils_1.createTaskId)(context.projectName, context.targetName, context.configurationName);
|
|
74
|
+
// `runExecutor` can name a target the task graph does not hold, hence the
|
|
75
|
+
// project lookup; `convert-nx-executor` has neither graph, and only then
|
|
76
|
+
// is the config unknowable, which counts as tracked and discrete.
|
|
75
77
|
// `projectGraph` is typed as present, but `convert-nx-executor` passes
|
|
76
78
|
// null for both graphs.
|
|
77
79
|
const targetConfiguration = context.projectName && context.targetName
|
|
@@ -101,7 +103,7 @@ async function runCommands(options, context, task, baseEnv) {
|
|
|
101
103
|
throw new Error(`ERROR: Something went wrong in run-commands - ${e.message}`);
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
|
-
function normalizeOptions(options, env) {
|
|
106
|
+
function normalizeOptions(options, env, taskId, warn) {
|
|
105
107
|
if (options.readyWhen && typeof options.readyWhen === 'string') {
|
|
106
108
|
options.readyWhenStatus = [
|
|
107
109
|
{ stringToMatch: options.readyWhen, found: false },
|
|
@@ -128,10 +130,21 @@ function normalizeOptions(options, env) {
|
|
|
128
130
|
options.commands = options.commands.map((c) => typeof c === 'string' ? { command: c } : c);
|
|
129
131
|
}
|
|
130
132
|
Object.assign(options, normalizeArgs(options));
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
const normalized = options;
|
|
134
|
+
let forwardsUnknownOptions = false;
|
|
135
|
+
normalized.commands.forEach((c) => {
|
|
136
|
+
const forwardAllArgs = c.forwardAllArgs ?? options.forwardAllArgs ?? true;
|
|
137
|
+
forwardsUnknownOptions ||=
|
|
138
|
+
c.command.indexOf('{args.') === -1 &&
|
|
139
|
+
(c.command.indexOf('{args}') > -1 || forwardAllArgs);
|
|
140
|
+
c.command = interpolateArgsIntoCommand(c.command, normalized, forwardAllArgs, env);
|
|
133
141
|
});
|
|
134
|
-
|
|
142
|
+
if (forwardsUnknownOptions) {
|
|
143
|
+
for (const option of droppedUnknownOptions(normalized)) {
|
|
144
|
+
warn(`Option "${option}" was not forwarded to the command for ${taskId} because its value is an object or array. Use "args" to pass extra values to the command.`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return normalized;
|
|
135
148
|
}
|
|
136
149
|
/** The options `interpolateArgsIntoCommand` reads, from the task's options. */
|
|
137
150
|
function normalizeArgs(options) {
|
|
@@ -205,6 +218,15 @@ function interpolateArgsIntoCommand(command, opts, forwardAllArgs, env = () => p
|
|
|
205
218
|
return command;
|
|
206
219
|
}
|
|
207
220
|
}
|
|
221
|
+
// `null` unsets an option, so it is skipped without a warning. A dotted flag
|
|
222
|
+
// such as `--a.b=1` reaches the command through `__unparsed__`.
|
|
223
|
+
function droppedUnknownOptions(opts) {
|
|
224
|
+
const unparsedKeys = Object.keys(opts.unparsedCommandArgs ?? {});
|
|
225
|
+
return Object.keys(opts.unknownOptions ?? {}).filter((k) => typeof opts.unknownOptions[k] === 'object' &&
|
|
226
|
+
opts.unknownOptions[k] !== null &&
|
|
227
|
+
opts.parsedArgs[k] === opts.unknownOptions[k] &&
|
|
228
|
+
!unparsedKeys.some((u) => u.startsWith(`${k}.`)));
|
|
229
|
+
}
|
|
208
230
|
function unknownOptionsToArgsArray(opts) {
|
|
209
231
|
return Object.keys(opts.unknownOptions ?? {})
|
|
210
232
|
.filter((k) => typeof opts.unknownOptions[k] !== 'object' &&
|
|
@@ -33,12 +33,12 @@ async function globAsync(tree, patterns) {
|
|
|
33
33
|
function combineGlobResultsWithTree(tree, patterns, results) {
|
|
34
34
|
const matches = new Set(results);
|
|
35
35
|
const combinedGlob = (0, globs_1.combineGlobPatterns)(patterns);
|
|
36
|
-
const matcher = minimatch_1.
|
|
37
|
-
if (
|
|
36
|
+
const matcher = new minimatch_1.Minimatch(combinedGlob);
|
|
37
|
+
if (matcher.set.length === 0) {
|
|
38
38
|
throw new Error('Invalid glob pattern: ' + combinedGlob);
|
|
39
39
|
}
|
|
40
40
|
for (const change of tree.listChanges()) {
|
|
41
|
-
if (change.type !== 'UPDATE' && matcher.
|
|
41
|
+
if (change.type !== 'UPDATE' && matcher.match(change.path)) {
|
|
42
42
|
if (change.type === 'CREATE') {
|
|
43
43
|
matches.add(change.path);
|
|
44
44
|
}
|
|
@@ -4,7 +4,9 @@ import { Task, TaskGraph } from '../config/task-graph';
|
|
|
4
4
|
import { type UltracacheConfigurations, TaskDetails } from '../native';
|
|
5
5
|
import { TaskHasher } from './task-hasher';
|
|
6
6
|
export declare function getTaskDetails(): TaskDetails | null;
|
|
7
|
-
export declare function hashTasksThatDoNotDependOnOutputsOfOtherTasks(hasher: TaskHasher, projectGraph: ProjectGraph, taskGraph: TaskGraph, nxJson: NxJsonConfiguration, tasksDetails: TaskDetails | null, ultracacheConfigurations?: UltracacheConfigurations
|
|
7
|
+
export declare function hashTasksThatDoNotDependOnOutputsOfOtherTasks(hasher: TaskHasher, projectGraph: ProjectGraph, taskGraph: TaskGraph, nxJson: NxJsonConfiguration, tasksDetails: TaskDetails | null, ultracacheConfigurations?: UltracacheConfigurations,
|
|
8
|
+
/** The tasks to hash; an agent runs a few tasks of a larger task graph. */
|
|
9
|
+
tasks?: Task[]): Promise<Set<string>>;
|
|
8
10
|
export declare function hashTask(hasher: TaskHasher, projectGraph: ProjectGraph, taskGraph: TaskGraph, task: Task, env: NodeJS.ProcessEnv, taskDetails: TaskDetails | null): Promise<void>;
|
|
9
11
|
/**
|
|
10
12
|
* Batch-hash `tasks`. `perTaskEnvs` must contain an entry keyed by
|
|
@@ -24,7 +24,9 @@ function getTaskDetails() {
|
|
|
24
24
|
}
|
|
25
25
|
return taskDetails;
|
|
26
26
|
}
|
|
27
|
-
async function hashTasksThatDoNotDependOnOutputsOfOtherTasks(hasher, projectGraph, taskGraph, nxJson, tasksDetails, ultracacheConfigurations
|
|
27
|
+
async function hashTasksThatDoNotDependOnOutputsOfOtherTasks(hasher, projectGraph, taskGraph, nxJson, tasksDetails, ultracacheConfigurations,
|
|
28
|
+
/** The tasks to hash; an agent runs a few tasks of a larger task graph. */
|
|
29
|
+
tasks = Object.values(taskGraph.tasks)) {
|
|
28
30
|
performance.mark('hashMultipleTasks:start');
|
|
29
31
|
const projects = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph).projects;
|
|
30
32
|
// An Ultracache configuration can make a task depend on producer outputs its declared
|
|
@@ -32,7 +34,6 @@ async function hashTasksThatDoNotDependOnOutputsOfOtherTasks(hasher, projectGrap
|
|
|
32
34
|
const deferredByConfiguration = ultracacheConfigurations
|
|
33
35
|
? new Set((0, native_1.getUltracacheDeferredTaskIds)(ultracacheConfigurations, taskGraph))
|
|
34
36
|
: null;
|
|
35
|
-
const tasks = Object.values(taskGraph.tasks);
|
|
36
37
|
// TODO(v25): remove custom hasher support (NXC-5052).
|
|
37
38
|
const tasksWithHashers = await Promise.all(tasks.map(async (task) => {
|
|
38
39
|
const customHasher = (0, utils_1.getCustomHasher)(task, projects);
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = replacePowerpackConformance;
|
|
4
|
+
const format_changed_files_1 = require("../../generators/internal-utils/format-changed-files");
|
|
5
|
+
const json_1 = require("../../generators/utils/json");
|
|
6
|
+
const nx_json_1 = require("../../generators/utils/nx-json");
|
|
7
|
+
const project_configuration_1 = require("../../generators/utils/project-configuration");
|
|
8
|
+
const target_defaults_1 = require("../../project-graph/utils/project-configuration/target-defaults");
|
|
9
|
+
const ignore_1 = require("../../utils/ignore");
|
|
10
|
+
const versions_1 = require("../../utils/versions");
|
|
11
|
+
const POWERPACK_CONFORMANCE = '@nx/powerpack-conformance';
|
|
12
|
+
const CONFORMANCE = '@nx/conformance';
|
|
13
|
+
const OWNERS = '@nx/owners';
|
|
14
|
+
const BUNDLE_RULES_EXECUTOR = '@nx/conformance:bundle-rules';
|
|
15
|
+
const ESBUILD_VERSION = '^0.25.0';
|
|
16
|
+
const DEPENDENCY_FIELDS = [
|
|
17
|
+
'dependencies',
|
|
18
|
+
'devDependencies',
|
|
19
|
+
'peerDependencies',
|
|
20
|
+
'optionalDependencies',
|
|
21
|
+
];
|
|
22
|
+
const SOURCE_FILE = /\.[cm]?[jt]sx?$/;
|
|
23
|
+
// A quoted `@nx/powerpack-conformance` specifier, executor or rule, e.g.
|
|
24
|
+
// `"@nx/powerpack-conformance:bundle-rules"` or `'@nx/powerpack-conformance/ensure-owners'`
|
|
25
|
+
const SPECIFIER = /(["'`])@nx\/powerpack-conformance([:/][^"'`]*)?\1/g;
|
|
26
|
+
async function replacePowerpackConformance(tree) {
|
|
27
|
+
if (!tree.exists('package.json') ||
|
|
28
|
+
!declaresDependency((0, json_1.readJson)(tree, 'package.json'), POWERPACK_CONFORMANCE)) {
|
|
29
|
+
return { skipAgentic: true };
|
|
30
|
+
}
|
|
31
|
+
let movedEnsureOwners = false;
|
|
32
|
+
const rewrite = (content) => content.replace(SPECIFIER, (_, quote, rest = '') => {
|
|
33
|
+
if (rest === '/ensure-owners') {
|
|
34
|
+
movedEnsureOwners = true;
|
|
35
|
+
return `${quote}${OWNERS}/ensure-owners${quote}`;
|
|
36
|
+
}
|
|
37
|
+
return `${quote}${CONFORMANCE}${rest}${quote}`;
|
|
38
|
+
});
|
|
39
|
+
for (const path of filesToRewrite(tree)) {
|
|
40
|
+
if (path === 'package.json' || path.endsWith('/package.json')) {
|
|
41
|
+
(0, json_1.updateJson)(tree, path, replaceDependency);
|
|
42
|
+
}
|
|
43
|
+
const content = tree.read(path, 'utf-8');
|
|
44
|
+
const updated = rewrite(content);
|
|
45
|
+
if (updated !== content) {
|
|
46
|
+
tree.write(path, updated);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
(0, json_1.updateJson)(tree, 'package.json', (json) => {
|
|
50
|
+
if (movedEnsureOwners && !declaresDependency(json, OWNERS)) {
|
|
51
|
+
addDevDependency(json, OWNERS, versions_1.nxVersion);
|
|
52
|
+
}
|
|
53
|
+
if (usesBundleRules(tree) && !declaresDependency(json, 'esbuild')) {
|
|
54
|
+
addDevDependency(json, 'esbuild', ESBUILD_VERSION);
|
|
55
|
+
}
|
|
56
|
+
return json;
|
|
57
|
+
});
|
|
58
|
+
await (0, format_changed_files_1.formatChangedFiles)(tree);
|
|
59
|
+
return { skipAgentic: true };
|
|
60
|
+
}
|
|
61
|
+
function filesToRewrite(tree) {
|
|
62
|
+
const isIgnored = (0, ignore_1.createGitIgnoreChecker)(tree);
|
|
63
|
+
const files = [];
|
|
64
|
+
const visit = (dir) => {
|
|
65
|
+
for (const child of tree.children(dir)) {
|
|
66
|
+
const path = dir ? `${dir}/${child}` : child;
|
|
67
|
+
if (tree.isFile(path)) {
|
|
68
|
+
if ((child === 'package.json' ||
|
|
69
|
+
child === 'project.json' ||
|
|
70
|
+
child === 'nx.json' ||
|
|
71
|
+
SOURCE_FILE.test(child)) &&
|
|
72
|
+
!isIgnored.isIgnoredFile(path)) {
|
|
73
|
+
files.push(path);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else if (!isIgnored.isIgnoredDirectory(path)) {
|
|
77
|
+
visit(path);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
visit('');
|
|
82
|
+
return files;
|
|
83
|
+
}
|
|
84
|
+
// Swaps the dependency for @nx/conformance at the current Nx version, since the
|
|
85
|
+
// two packages were versioned separately
|
|
86
|
+
function replaceDependency(json) {
|
|
87
|
+
for (const field of DEPENDENCY_FIELDS) {
|
|
88
|
+
const dependencies = json[field];
|
|
89
|
+
if (!dependencies?.[POWERPACK_CONFORMANCE]) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
delete dependencies[POWERPACK_CONFORMANCE];
|
|
93
|
+
if (!declaresDependency(json, CONFORMANCE)) {
|
|
94
|
+
dependencies[CONFORMANCE] = versions_1.nxVersion;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return json;
|
|
98
|
+
}
|
|
99
|
+
function declaresDependency(json, name) {
|
|
100
|
+
return DEPENDENCY_FIELDS.some((field) => Boolean(json[field]?.[name]));
|
|
101
|
+
}
|
|
102
|
+
function addDevDependency(json, name, version) {
|
|
103
|
+
json.devDependencies = { ...json.devDependencies, [name]: version };
|
|
104
|
+
}
|
|
105
|
+
function usesBundleRules(tree) {
|
|
106
|
+
const targetDefaults = (0, nx_json_1.readNxJson)(tree)?.targetDefaults;
|
|
107
|
+
for (const [, project] of (0, project_configuration_1.getProjects)(tree)) {
|
|
108
|
+
for (const [targetName, target] of Object.entries(project.targets ?? {})) {
|
|
109
|
+
const executor = target.executor ??
|
|
110
|
+
(0, target_defaults_1.readTargetDefaultsForTarget)(targetName, targetDefaults)?.executor;
|
|
111
|
+
if (executor === BUNDLE_RULES_EXECUTOR) {
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#### Replace @nx/powerpack-conformance with @nx/conformance
|
|
2
|
+
|
|
3
|
+
`nx conformance` and `nx conformance:check` now load `@nx/conformance` only. `@nx/powerpack-conformance` was a wrapper around `@nx/conformance`, so this migration replaces it.
|
|
4
|
+
|
|
5
|
+
When the root `package.json` declares `@nx/powerpack-conformance`, the migration:
|
|
6
|
+
|
|
7
|
+
- Replaces `@nx/powerpack-conformance` with `@nx/conformance` in every `package.json`.
|
|
8
|
+
- Rewrites `@nx/powerpack-conformance` rule specifiers, executors, generator defaults and imports in `nx.json`, `project.json`, `package.json` and source files to `@nx/conformance`.
|
|
9
|
+
- Rewrites `@nx/powerpack-conformance/ensure-owners` to `@nx/owners/ensure-owners`, which moved to `@nx/owners`, and adds `@nx/owners`.
|
|
10
|
+
- Adds `esbuild` when a project uses the `@nx/conformance:bundle-rules` executor, since `@nx/conformance` lists it only as an optional peer dependency.
|
|
11
|
+
|
|
12
|
+
#### Sample code changes
|
|
13
|
+
|
|
14
|
+
##### Before
|
|
15
|
+
|
|
16
|
+
```json title="nx.json"
|
|
17
|
+
{
|
|
18
|
+
"conformance": {
|
|
19
|
+
"rules": [
|
|
20
|
+
{ "rule": "@nx/powerpack-conformance/enforce-project-boundaries" },
|
|
21
|
+
{ "rule": "@nx/powerpack-conformance/ensure-owners" }
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
##### After
|
|
28
|
+
|
|
29
|
+
```json title="nx.json"
|
|
30
|
+
{
|
|
31
|
+
"conformance": {
|
|
32
|
+
"rules": [
|
|
33
|
+
{ "rule": "@nx/conformance/enforce-project-boundaries" },
|
|
34
|
+
{ "rule": "@nx/owners/ensure-owners" }
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|