@nx/devkit 24.0.0-beta.2 → 24.0.0-beta.4
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/internal.d.ts +5 -2
- package/dist/internal.js +15 -7
- package/dist/src/generators/e2e-web-server-info-utils.d.ts +1 -1
- package/dist/src/generators/e2e-web-server-info-utils.js +1 -15
- package/dist/src/generators/plugin-migrations/remove-executors.d.ts +9 -0
- package/dist/src/generators/plugin-migrations/remove-executors.js +111 -0
- package/dist/src/utils/ignore-server-inputs-directive.d.ts +5 -0
- package/dist/src/utils/ignore-server-inputs-directive.js +12 -0
- package/dist/src/utils/nx-directives.d.ts +2 -1
- package/dist/src/utils/nx-directives.js +4 -3
- package/dist/src/utils/split-shell-args.d.ts +7 -0
- package/dist/src/utils/split-shell-args.js +190 -0
- package/dist/src/utils/test-file-directives.d.ts +7 -9
- package/dist/src/utils/test-file-directives.js +21 -38
- package/package.json +2 -2
- package/dist/src/utils/ultracache-directive.d.ts +0 -8
- package/dist/src/utils/ultracache-directive.js +0 -19
package/dist/internal.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { signalToCode, createProjectRootMappingsFromProjectConfigurations, PluginCache, safeWriteFileCache, emitPluginWorkerLog, resolveImplementation, resolveSchema, ImplementationResolutionError, SchemaResolutionError, resolvePrompt, PromptResolutionError, acknowledgeBuildScripts, createCliOptions, createOverrides, isAiAgent, getCatalogManager, getDaemonClientEnvGeneration, getAppliedDaemonClientEnv, applyDaemonEnvFromClient, getGraphTimeDotEnvForTask, hashDaemonClientEnv, } from 'nx/src/devkit-internals';
|
|
1
|
+
export { signalToCode, createProjectRootMappingsFromProjectConfigurations, PluginCache, safeWriteFileCache, emitPluginWorkerLog, resolveImplementation, resolveSchema, ImplementationResolutionError, SchemaResolutionError, resolvePrompt, PromptResolutionError, acknowledgeBuildScripts, acknowledgeDeclaredBuildScripts, createCliOptions, createOverrides, isAiAgent, getCatalogManager, getDaemonClientEnvGeneration, getAppliedDaemonClientEnv, applyDaemonEnvFromClient, getGraphTimeDotEnvForTask, hashDaemonClientEnv, resolveStartupHost, } from 'nx/src/devkit-internals';
|
|
2
2
|
export { detectFormatterInTree, prettierConfigFiles, oxfmtConfigFiles, } from 'nx/src/devkit-internals';
|
|
3
3
|
export type { FormatterType } from 'nx/src/devkit-internals';
|
|
4
4
|
export { determineArtifactNameAndDirectoryOptions, getRelativeCwd, type FileExtensionType, } from './src/generators/artifact-name-and-directory-utils';
|
|
@@ -21,11 +21,14 @@ export { loadConfigFile, clearRequireCache } from './src/utils/config-utils';
|
|
|
21
21
|
export { isRequireEsmRaceError, retryOnRequireEsmRace, } from './src/utils/require-esm-race';
|
|
22
22
|
export { findPluginForConfigFile } from './src/utils/find-plugin-for-config-file';
|
|
23
23
|
export { getNamedInputs } from './src/utils/get-named-inputs';
|
|
24
|
+
export { parseNxDirectives } from './src/utils/nx-directives';
|
|
24
25
|
export { applyTestFileDirectives } from './src/utils/test-file-directives';
|
|
25
|
-
export {
|
|
26
|
+
export { hasIgnoreServerInputsDirective } from './src/utils/ignore-server-inputs-directive';
|
|
26
27
|
export { logShowProjectCommand } from './src/utils/log-show-project-command';
|
|
27
28
|
export { eachValueFrom } from './src/utils/rxjs-for-await';
|
|
28
29
|
export { checkAndCleanWithSemver } from './src/utils/semver';
|
|
30
|
+
export { splitShellArgs } from './src/utils/split-shell-args';
|
|
29
31
|
export { camelize, capitalize, classify, dasherize, } from './src/utils/string-utils';
|
|
30
32
|
export { runCommandsExecutor, type TaskResult, type Agent, type BatchExecutorTaskResult, BatchFunctionRunner, type BatchResults, type CLIErrorMessageConfig, type CLINoteMessageConfig, type CLISuccessMessageConfig, type CLIWarnMessageConfig, Cache, type CachedResult, type Change, type ChangedFile, CompositeLifeCycle, DeletedFileChange, confirmationPrompt, type FileChange, type FileDataDependency, type FileMapCache, type FinalConfigForProject, FsTree, type GeneratorInformation, type InputDefinition, type JsonInput, LARGE_BUFFER, type LifeCycle, LockFileChange, NX_PREFIX, type NormalizedTargetDependencyConfig, type NxCloudOnBoardingStatus, type NxReleaseVersionConfiguration, type PackageJson, type PackageJsonDependencySection, type PackageManagerCommands, type ProjectRootMappings, RemoteCacheV2, type RunCommandsOptions, SyncError, type SyncGeneratorResult, TEN_MEGABYTES, TargetProjectLocator, type TaskMetadata, type TaskStatus, type TaskWithCachedResult, type TasksRunner, type UnregisterCallback, WholeFileChange, buildPackageJsonPatterns, buildPackageJsonWorkspacesMatcher, buildProjectGraphAndSourceMapsWithoutDaemon, calculateFileChanges, calculateReverseDeps, codeFrameColumns, combineGlobPatterns, connectToNxCloud, createDirectory, createLockFile, createNxCloudOnboardingURL, createNxCloudOnboardingURLForWelcomeApp, createPackageJson, createProjectGraphAndSourceMapsAsync, createProjectRootMappings, createRunManyDynamicOutputRenderer, createTargetDefaultsResults, createTaskId, daemonClient, deduceDefaultBase, defaultFileRead, deriveGroupNameFromTarget, directoryExists, dropEmptyPeerDependencySections, expandDependencyConfigSyntaxSugar, expandInitiatingTasksThroughNoop, expandWildcardTargetConfiguration, fileDataDepTarget, fileDataDepType, fileExists, filterUsingGlobPatterns, findAllProjectNodeDependencies, findInstalledPlugins, findMatchingConfigFiles, findMatchingProjects, findMatchingTargetNames, findProjectForPath, findProjectsNpmDependencies, forceRegisterEsmLoader, generatePrunedDeployOutput, getCliPath, getCustomHasher, getDependencyConfigs, getEnvFilesForTask, getEnvPathsForTask, getExecutorForTask, getExecutorInformation, getExecutorNameForTask, getFilesInDirectoryUsingContext, getGeneratorInformation, getGlobPatternsFromPackageManagerWorkspaces, getLastValueFromAsyncIterableIterator, getLatestCommitSha, getLockFileName, getNxCloudAppOnBoardingUrl, getNxCloudUrl, getNxRequirePaths, getOutputs, getPrintableCommandArgsForTask, getRelativeProjectJsonSchemaPath, getSerializedArgsForTask, getSourceDirOfDependentProjects, getTargetConfigurationForTask, getTargetInputs, getUnparsedOverrideArgs, getWorkspacePackagesFromGraph, globWithWorkspaceContext, handleImport, handleProjectGraphError, hashFile, hashObject, hashWithWorkspaceContext, interpolate, isBuiltinModuleImport, isCI, isCacheableTask, isDeletedFileChange, isLockFileChange, isNpmProject, isNxCloudUsed, isProjectGraphExternalNode, isProjectGraphProjectNode, isRelativePath, isWholeFileChange, killChildOnHostExit, killProcessTreeGraceful, loadTsFile, mergeTargetConfigurations, movePeerDependencyToDependencies, multiselectPrompt, normalizeDependencyConfigDefinition, normalizeDependencyConfigProjects, normalizeTargetDependencyWithStringProjects, nxVersion, orange, parseExecutor, parseVersionFromPackageManagerField, preventRecursionInGraphConstruction, quoteShellArg, readCachedProjectConfiguration, readFileIfExisting, readFileMapCache, readModulePackageJson, readNxJsonFromDisk, readNxMigrateConfig, readPackageJson, readProjectAndTargetFromTargetString, registerTsConfigPaths, registerTsProject, relocatePrunedLocalPathSpec, removeTasksFromTaskGraph, requireWithTsconfigFallback, resetWorkspaceContext, resolveCommandSyntacticSugar, runNxSync, safeExecFileSync, safeSpawn, selectPrompt, setWorkspaceRoot, setupAiAgentsGenerator, setupWorkspaceContext, shouldStreamOutput, toNewFormat, toOldFormat, transformLegacyOutputs, textPrompt, unparse, validateOutputs, warnUnshippableLocalPathSpec, workspaceDataDirectory, workspaceRootInner, } from 'nx/src/devkit-internals';
|
|
31
33
|
export type { AfterAllProjectsVersioned } from 'nx/release';
|
|
34
|
+
export { migrateRemovedExecutors } from './src/generators/plugin-migrations/remove-executors';
|
package/dist/internal.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.workspaceRootInner = exports.workspaceDataDirectory = exports.warnUnshippableLocalPathSpec = exports.validateOutputs = exports.unparse = exports.textPrompt = exports.transformLegacyOutputs = exports.toOldFormat = exports.toNewFormat = exports.shouldStreamOutput = exports.setupWorkspaceContext = exports.setupAiAgentsGenerator = exports.setWorkspaceRoot = exports.selectPrompt = exports.safeSpawn = exports.safeExecFileSync = exports.runNxSync = exports.resolveCommandSyntacticSugar = exports.resetWorkspaceContext = exports.requireWithTsconfigFallback = exports.removeTasksFromTaskGraph = void 0;
|
|
3
|
+
exports.addPlugin = exports.upsertTargetDefault = exports.updateTargetDefault = exports.readTargetDefaultsForTarget = exports.findTargetDefault = exports.addE2eCiTargetDefaults = exports.addBuildTargetDefaults = exports.isInteractive = exports.resolveImportPath = exports.ensureRootProjectName = exports.determineProjectNameAndRootOptions = exports.toProjectRelativePath = exports.deleteMatchingProperties = exports.processTargetOutputs = exports.NoTargetsToMigrateError = exports.migrateProjectExecutorsToPluginV1 = exports.migrateProjectExecutorsToPlugin = exports.openBatchConversionSession = exports.finalizeBatchConversion = exports.AggregatedLog = exports.forEachExecutorOptions = exports.getE2EWebServerInfo = exports.getRelativeCwd = exports.determineArtifactNameAndDirectoryOptions = exports.oxfmtConfigFiles = exports.prettierConfigFiles = exports.detectFormatterInTree = exports.resolveStartupHost = exports.hashDaemonClientEnv = exports.getGraphTimeDotEnvForTask = exports.applyDaemonEnvFromClient = exports.getAppliedDaemonClientEnv = exports.getDaemonClientEnvGeneration = exports.getCatalogManager = exports.isAiAgent = exports.createOverrides = exports.createCliOptions = exports.acknowledgeDeclaredBuildScripts = exports.acknowledgeBuildScripts = exports.PromptResolutionError = exports.resolvePrompt = exports.SchemaResolutionError = exports.ImplementationResolutionError = exports.resolveSchema = exports.resolveImplementation = exports.emitPluginWorkerLog = exports.safeWriteFileCache = exports.PluginCache = exports.createProjectRootMappingsFromProjectConfigurations = exports.signalToCode = void 0;
|
|
4
|
+
exports.codeFrameColumns = exports.calculateReverseDeps = exports.calculateFileChanges = exports.buildProjectGraphAndSourceMapsWithoutDaemon = exports.buildPackageJsonWorkspacesMatcher = exports.buildPackageJsonPatterns = exports.WholeFileChange = exports.TargetProjectLocator = exports.TEN_MEGABYTES = exports.SyncError = exports.RemoteCacheV2 = exports.NX_PREFIX = exports.LockFileChange = exports.LARGE_BUFFER = exports.FsTree = exports.confirmationPrompt = exports.DeletedFileChange = exports.CompositeLifeCycle = exports.Cache = exports.BatchFunctionRunner = exports.runCommandsExecutor = exports.dasherize = exports.classify = exports.capitalize = exports.camelize = exports.splitShellArgs = exports.checkAndCleanWithSemver = exports.eachValueFrom = exports.logShowProjectCommand = exports.hasIgnoreServerInputsDirective = exports.applyTestFileDirectives = exports.parseNxDirectives = exports.getNamedInputs = exports.findPluginForConfigFile = exports.retryOnRequireEsmRace = exports.isRequireEsmRaceError = exports.clearRequireCache = exports.loadConfigFile = exports.calculateHashesForCreateNodes = exports.calculateHashForCreateNodes = exports.mapAsyncIterable = exports.combineAsyncIterables = exports.createAsyncIterable = exports.getSatisfyingInstalledPackageVersion = exports.getResolvedPackageVersion = exports.assertSupportedPackageVersion = exports.assertSupportedInstalledPackageVersion = exports.getInstalledPackageVersionFromTree = exports.getInstalledPackageVersion = exports.getDeclaredPackageVersion = void 0;
|
|
5
|
+
exports.getNxCloudUrl = exports.getNxCloudAppOnBoardingUrl = exports.getLockFileName = exports.getLatestCommitSha = exports.getLastValueFromAsyncIterableIterator = exports.getGlobPatternsFromPackageManagerWorkspaces = exports.getGeneratorInformation = exports.getFilesInDirectoryUsingContext = exports.getExecutorNameForTask = exports.getExecutorInformation = exports.getExecutorForTask = exports.getEnvPathsForTask = exports.getEnvFilesForTask = exports.getDependencyConfigs = exports.getCustomHasher = exports.getCliPath = exports.generatePrunedDeployOutput = exports.forceRegisterEsmLoader = exports.findProjectsNpmDependencies = exports.findProjectForPath = exports.findMatchingTargetNames = exports.findMatchingProjects = exports.findMatchingConfigFiles = exports.findInstalledPlugins = exports.findAllProjectNodeDependencies = exports.filterUsingGlobPatterns = exports.fileExists = exports.fileDataDepType = exports.fileDataDepTarget = exports.expandWildcardTargetConfiguration = exports.expandInitiatingTasksThroughNoop = exports.expandDependencyConfigSyntaxSugar = exports.dropEmptyPeerDependencySections = exports.directoryExists = exports.deriveGroupNameFromTarget = exports.defaultFileRead = exports.deduceDefaultBase = exports.daemonClient = exports.createTaskId = exports.createTargetDefaultsResults = exports.createRunManyDynamicOutputRenderer = exports.createProjectRootMappings = exports.createProjectGraphAndSourceMapsAsync = exports.createPackageJson = exports.createNxCloudOnboardingURLForWelcomeApp = exports.createNxCloudOnboardingURL = exports.createLockFile = exports.createDirectory = exports.connectToNxCloud = exports.combineGlobPatterns = void 0;
|
|
6
|
+
exports.readPackageJson = exports.readNxMigrateConfig = exports.readNxJsonFromDisk = exports.readModulePackageJson = exports.readFileMapCache = exports.readFileIfExisting = exports.readCachedProjectConfiguration = exports.quoteShellArg = exports.preventRecursionInGraphConstruction = exports.parseVersionFromPackageManagerField = exports.parseExecutor = exports.orange = exports.nxVersion = exports.normalizeTargetDependencyWithStringProjects = exports.normalizeDependencyConfigProjects = exports.normalizeDependencyConfigDefinition = exports.multiselectPrompt = exports.movePeerDependencyToDependencies = exports.mergeTargetConfigurations = exports.loadTsFile = exports.killProcessTreeGraceful = exports.killChildOnHostExit = exports.isWholeFileChange = exports.isRelativePath = exports.isProjectGraphProjectNode = exports.isProjectGraphExternalNode = exports.isNxCloudUsed = exports.isNpmProject = exports.isLockFileChange = exports.isDeletedFileChange = exports.isCacheableTask = exports.isCI = exports.isBuiltinModuleImport = exports.interpolate = exports.hashWithWorkspaceContext = exports.hashObject = exports.hashFile = exports.handleProjectGraphError = exports.handleImport = exports.globWithWorkspaceContext = exports.getWorkspacePackagesFromGraph = exports.getUnparsedOverrideArgs = exports.getTargetInputs = exports.getTargetConfigurationForTask = exports.getSourceDirOfDependentProjects = exports.getSerializedArgsForTask = exports.getRelativeProjectJsonSchemaPath = exports.getPrintableCommandArgsForTask = exports.getOutputs = exports.getNxRequirePaths = void 0;
|
|
7
|
+
exports.migrateRemovedExecutors = exports.workspaceRootInner = exports.workspaceDataDirectory = exports.warnUnshippableLocalPathSpec = exports.validateOutputs = exports.unparse = exports.textPrompt = exports.transformLegacyOutputs = exports.toOldFormat = exports.toNewFormat = exports.shouldStreamOutput = exports.setupWorkspaceContext = exports.setupAiAgentsGenerator = exports.setWorkspaceRoot = exports.selectPrompt = exports.safeSpawn = exports.safeExecFileSync = exports.runNxSync = exports.resolveCommandSyntacticSugar = exports.resetWorkspaceContext = exports.requireWithTsconfigFallback = exports.removeTasksFromTaskGraph = exports.relocatePrunedLocalPathSpec = exports.registerTsProject = exports.registerTsConfigPaths = exports.readProjectAndTargetFromTargetString = void 0;
|
|
8
8
|
var devkit_internals_1 = require("nx/src/devkit-internals");
|
|
9
9
|
Object.defineProperty(exports, "signalToCode", { enumerable: true, get: function () { return devkit_internals_1.signalToCode; } });
|
|
10
10
|
Object.defineProperty(exports, "createProjectRootMappingsFromProjectConfigurations", { enumerable: true, get: function () { return devkit_internals_1.createProjectRootMappingsFromProjectConfigurations; } });
|
|
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "SchemaResolutionError", { enumerable: true, get:
|
|
|
18
18
|
Object.defineProperty(exports, "resolvePrompt", { enumerable: true, get: function () { return devkit_internals_1.resolvePrompt; } });
|
|
19
19
|
Object.defineProperty(exports, "PromptResolutionError", { enumerable: true, get: function () { return devkit_internals_1.PromptResolutionError; } });
|
|
20
20
|
Object.defineProperty(exports, "acknowledgeBuildScripts", { enumerable: true, get: function () { return devkit_internals_1.acknowledgeBuildScripts; } });
|
|
21
|
+
Object.defineProperty(exports, "acknowledgeDeclaredBuildScripts", { enumerable: true, get: function () { return devkit_internals_1.acknowledgeDeclaredBuildScripts; } });
|
|
21
22
|
Object.defineProperty(exports, "createCliOptions", { enumerable: true, get: function () { return devkit_internals_1.createCliOptions; } });
|
|
22
23
|
Object.defineProperty(exports, "createOverrides", { enumerable: true, get: function () { return devkit_internals_1.createOverrides; } });
|
|
23
24
|
Object.defineProperty(exports, "isAiAgent", { enumerable: true, get: function () { return devkit_internals_1.isAiAgent; } });
|
|
@@ -32,6 +33,7 @@ Object.defineProperty(exports, "getAppliedDaemonClientEnv", { enumerable: true,
|
|
|
32
33
|
Object.defineProperty(exports, "applyDaemonEnvFromClient", { enumerable: true, get: function () { return devkit_internals_1.applyDaemonEnvFromClient; } });
|
|
33
34
|
Object.defineProperty(exports, "getGraphTimeDotEnvForTask", { enumerable: true, get: function () { return devkit_internals_1.getGraphTimeDotEnvForTask; } });
|
|
34
35
|
Object.defineProperty(exports, "hashDaemonClientEnv", { enumerable: true, get: function () { return devkit_internals_1.hashDaemonClientEnv; } });
|
|
36
|
+
Object.defineProperty(exports, "resolveStartupHost", { enumerable: true, get: function () { return devkit_internals_1.resolveStartupHost; } });
|
|
35
37
|
// Formatter detection and setup. `@nx/js` needs these to write and detect a
|
|
36
38
|
// workspace's formatter config, and it depends on `@nx/devkit` rather than on
|
|
37
39
|
// `nx`, so this is its declared route to them. Against an older nx they arrive
|
|
@@ -106,16 +108,20 @@ var find_plugin_for_config_file_1 = require("./src/utils/find-plugin-for-config-
|
|
|
106
108
|
Object.defineProperty(exports, "findPluginForConfigFile", { enumerable: true, get: function () { return find_plugin_for_config_file_1.findPluginForConfigFile; } });
|
|
107
109
|
var get_named_inputs_1 = require("./src/utils/get-named-inputs");
|
|
108
110
|
Object.defineProperty(exports, "getNamedInputs", { enumerable: true, get: function () { return get_named_inputs_1.getNamedInputs; } });
|
|
111
|
+
var nx_directives_1 = require("./src/utils/nx-directives");
|
|
112
|
+
Object.defineProperty(exports, "parseNxDirectives", { enumerable: true, get: function () { return nx_directives_1.parseNxDirectives; } });
|
|
109
113
|
var test_file_directives_1 = require("./src/utils/test-file-directives");
|
|
110
114
|
Object.defineProperty(exports, "applyTestFileDirectives", { enumerable: true, get: function () { return test_file_directives_1.applyTestFileDirectives; } });
|
|
111
|
-
var
|
|
112
|
-
Object.defineProperty(exports, "
|
|
115
|
+
var ignore_server_inputs_directive_1 = require("./src/utils/ignore-server-inputs-directive");
|
|
116
|
+
Object.defineProperty(exports, "hasIgnoreServerInputsDirective", { enumerable: true, get: function () { return ignore_server_inputs_directive_1.hasIgnoreServerInputsDirective; } });
|
|
113
117
|
var log_show_project_command_1 = require("./src/utils/log-show-project-command");
|
|
114
118
|
Object.defineProperty(exports, "logShowProjectCommand", { enumerable: true, get: function () { return log_show_project_command_1.logShowProjectCommand; } });
|
|
115
119
|
var rxjs_for_await_1 = require("./src/utils/rxjs-for-await");
|
|
116
120
|
Object.defineProperty(exports, "eachValueFrom", { enumerable: true, get: function () { return rxjs_for_await_1.eachValueFrom; } });
|
|
117
121
|
var semver_1 = require("./src/utils/semver");
|
|
118
122
|
Object.defineProperty(exports, "checkAndCleanWithSemver", { enumerable: true, get: function () { return semver_1.checkAndCleanWithSemver; } });
|
|
123
|
+
var split_shell_args_1 = require("./src/utils/split-shell-args");
|
|
124
|
+
Object.defineProperty(exports, "splitShellArgs", { enumerable: true, get: function () { return split_shell_args_1.splitShellArgs; } });
|
|
119
125
|
var string_utils_1 = require("./src/utils/string-utils");
|
|
120
126
|
Object.defineProperty(exports, "camelize", { enumerable: true, get: function () { return string_utils_1.camelize; } });
|
|
121
127
|
Object.defineProperty(exports, "capitalize", { enumerable: true, get: function () { return string_utils_1.capitalize; } });
|
|
@@ -269,3 +275,5 @@ Object.defineProperty(exports, "validateOutputs", { enumerable: true, get: funct
|
|
|
269
275
|
Object.defineProperty(exports, "warnUnshippableLocalPathSpec", { enumerable: true, get: function () { return devkit_internals_3.warnUnshippableLocalPathSpec; } });
|
|
270
276
|
Object.defineProperty(exports, "workspaceDataDirectory", { enumerable: true, get: function () { return devkit_internals_3.workspaceDataDirectory; } });
|
|
271
277
|
Object.defineProperty(exports, "workspaceRootInner", { enumerable: true, get: function () { return devkit_internals_3.workspaceRootInner; } });
|
|
278
|
+
var remove_executors_1 = require("./src/generators/plugin-migrations/remove-executors");
|
|
279
|
+
Object.defineProperty(exports, "migrateRemovedExecutors", { enumerable: true, get: function () { return remove_executors_1.migrateRemovedExecutors; } });
|
|
@@ -25,5 +25,5 @@ export interface E2EWebServerDetails {
|
|
|
25
25
|
e2eCiBaseUrl: string;
|
|
26
26
|
e2eDevServerTarget: string;
|
|
27
27
|
}
|
|
28
|
-
export declare function getE2EWebServerInfo(tree: Tree, projectName: string, pluginOptions: E2EWebServerPluginOptions, defaultValues: E2EWebServerDefaultValues
|
|
28
|
+
export declare function getE2EWebServerInfo(tree: Tree, projectName: string, pluginOptions: E2EWebServerPluginOptions, defaultValues: E2EWebServerDefaultValues): Promise<E2EWebServerDetails>;
|
|
29
29
|
export {};
|
|
@@ -4,22 +4,8 @@ exports.getE2EWebServerInfo = getE2EWebServerInfo;
|
|
|
4
4
|
const devkit_exports_1 = require("nx/src/devkit-exports");
|
|
5
5
|
const target_defaults_utils_1 = require("./target-defaults-utils");
|
|
6
6
|
const find_plugin_for_config_file_1 = require("../utils/find-plugin-for-config-file");
|
|
7
|
-
async function getE2EWebServerInfo(tree, projectName, pluginOptions, defaultValues
|
|
7
|
+
async function getE2EWebServerInfo(tree, projectName, pluginOptions, defaultValues) {
|
|
8
8
|
const pm = (0, devkit_exports_1.getPackageManagerCommand)((0, devkit_exports_1.detectPackageManager)(tree.root));
|
|
9
|
-
if (isPluginBeingAdded) {
|
|
10
|
-
return await getE2EWebServerInfoForPlugin(tree, projectName, pluginOptions, defaultValues, pm);
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
return {
|
|
14
|
-
e2eWebServerAddress: defaultValues.defaultE2EWebServerAddress,
|
|
15
|
-
e2eWebServerCommand: `${pm.exec} nx run ${projectName}:${defaultValues.defaultServeTargetName}`,
|
|
16
|
-
e2eCiWebServerCommand: `${pm.exec} nx run ${projectName}:${defaultValues.defaultServeStaticTargetName}`,
|
|
17
|
-
e2eCiBaseUrl: defaultValues.defaultE2ECiBaseUrl,
|
|
18
|
-
e2eDevServerTarget: `${projectName}:${defaultValues.defaultServeTargetName}`,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
async function getE2EWebServerInfoForPlugin(tree, projectName, pluginOptions, defaultValues, pm) {
|
|
23
9
|
const foundPlugin = await (0, find_plugin_for_config_file_1.findPluginForConfigFile)(tree, pluginOptions.plugin, pluginOptions.configFilePath);
|
|
24
10
|
if (!foundPlugin ||
|
|
25
11
|
typeof foundPlugin === 'string' ||
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Tree } from 'nx/src/devkit-exports';
|
|
2
|
+
/** The prompt completes conversions the generator cannot safely automate. */
|
|
3
|
+
export declare function migrateRemovedExecutors(tree: Tree, executors: string[], convert: (tree: Tree, options: {
|
|
4
|
+
skipFormat: boolean;
|
|
5
|
+
}) => Promise<unknown>): Promise<{
|
|
6
|
+
nextSteps?: string[];
|
|
7
|
+
agentContext?: string[];
|
|
8
|
+
skipAgentic?: boolean;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.migrateRemovedExecutors = migrateRemovedExecutors;
|
|
4
|
+
const devkit_exports_1 = require("nx/src/devkit-exports");
|
|
5
|
+
const format_files_1 = require("../format-files");
|
|
6
|
+
const executor_to_plugin_migrator_1 = require("./executor-to-plugin-migrator");
|
|
7
|
+
/** The prompt completes conversions the generator cannot safely automate. */
|
|
8
|
+
async function migrateRemovedExecutors(tree, executors, convert) {
|
|
9
|
+
const removed = new Set(executors);
|
|
10
|
+
const defaults = (0, devkit_exports_1.readNxJson)(tree)?.targetDefaults ?? {};
|
|
11
|
+
const relevantDefaults = filterDefaults(defaults, removed);
|
|
12
|
+
const agentContext = [];
|
|
13
|
+
const nextSteps = [];
|
|
14
|
+
let projects;
|
|
15
|
+
try {
|
|
16
|
+
projects = (0, devkit_exports_1.getProjects)(tree);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
const message = `Project discovery failed: ${String(error)}. Repair configuration loading, then run convert-to-inferred and complete this migration.`;
|
|
20
|
+
return { nextSteps: [message], agentContext: [message] };
|
|
21
|
+
}
|
|
22
|
+
const affected = [...projects].filter(([, project]) => Object.values(project.targets ?? {}).some((target) => removed.has(target.executor)));
|
|
23
|
+
if (!affected.length && !Object.keys(relevantDefaults).length) {
|
|
24
|
+
return { skipAgentic: true };
|
|
25
|
+
}
|
|
26
|
+
// Capture options before converters remove them, including executor defaults.
|
|
27
|
+
agentContext.push(`Pre-migration targetDefaults: ${JSON.stringify(defaults)}`);
|
|
28
|
+
for (const [name, project] of affected) {
|
|
29
|
+
agentContext.push(`Pre-migration project ${name}: ${JSON.stringify(project)}`);
|
|
30
|
+
}
|
|
31
|
+
if (affected.length) {
|
|
32
|
+
try {
|
|
33
|
+
// Migration runner installs changed dependencies after flushing the Tree.
|
|
34
|
+
// Generator callbacks can install too early here, so leave them to it.
|
|
35
|
+
await convert(tree, { skipFormat: true });
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
// Thrown when the converter skipped every target; the re-scan below
|
|
39
|
+
// names them.
|
|
40
|
+
if (!(error instanceof executor_to_plugin_migrator_1.NoTargetsToMigrateError)) {
|
|
41
|
+
const message = `Could not convert targets using removed executors: ${String(error)}. Inspect any partial edits before retrying.`;
|
|
42
|
+
devkit_exports_1.logger.warn(message);
|
|
43
|
+
nextSteps.push(message);
|
|
44
|
+
agentContext.push(`Conversion needs repair: ${String(error)}. Inspect any partial edits before retrying.`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Converters skip targets they cannot convert safely, with a warning, and
|
|
49
|
+
// some ignore `@nrwl` aliases. Re-scan so those are named rather than
|
|
50
|
+
// inferred from silence.
|
|
51
|
+
const leftovers = [];
|
|
52
|
+
const usedExecutors = new Set();
|
|
53
|
+
for (const [name, project] of (0, devkit_exports_1.getProjects)(tree)) {
|
|
54
|
+
for (const [targetName, target] of Object.entries(project.targets ?? {})) {
|
|
55
|
+
if (removed.has(target.executor)) {
|
|
56
|
+
leftovers.push(`${name}:${targetName} (${target.executor})`);
|
|
57
|
+
usedExecutors.add(target.executor);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (leftovers.length) {
|
|
62
|
+
const message = `These targets still use removed executors: ${leftovers.join(', ')}. Replace each one before running them.`;
|
|
63
|
+
devkit_exports_1.logger.warn(message);
|
|
64
|
+
nextSteps.push(message);
|
|
65
|
+
agentContext.push(`Still using removed executors after conversion: ${leftovers.join(', ')}. Replace each one; the converter could not.`);
|
|
66
|
+
}
|
|
67
|
+
removeDeadExecutorDefaults(tree, removed, usedExecutors);
|
|
68
|
+
// Targets that inherit the executor from targetDefaults declare none
|
|
69
|
+
// themselves, so the scans above cannot see them.
|
|
70
|
+
const defaultNames = Object.keys(filterDefaults((0, devkit_exports_1.readNxJson)(tree)?.targetDefaults ?? {}, removed));
|
|
71
|
+
if (defaultNames.length) {
|
|
72
|
+
const message = `These nx.json targetDefaults still use removed executors: ${defaultNames.join(', ')}. Move the options that still apply to the inferred targets, then remove them.`;
|
|
73
|
+
devkit_exports_1.logger.warn(message);
|
|
74
|
+
nextSteps.push(message);
|
|
75
|
+
agentContext.push(message);
|
|
76
|
+
}
|
|
77
|
+
agentContext.push(`Finish conversion of ${executors.join(', ')} to inference plugins. Inspect remaining executor references, including targetDefaults and package.json targets. Preserve all original options and configurations recorded above. A converter returning successfully does not prove every target was converted.`, 'Before completing this migration, run an uncached project graph and verify migrated targets are inferred. Graph validation is mandatory. Run relevant builds/tests by default; honor the user choosing to skip expensive task validation and report those tasks as unverified.');
|
|
78
|
+
await (0, format_files_1.formatFiles)(tree);
|
|
79
|
+
return nextSteps.length ? { nextSteps, agentContext } : { agentContext };
|
|
80
|
+
}
|
|
81
|
+
// The converters merge an unfiltered executor-keyed default into every target
|
|
82
|
+
// they convert, so the entry is dead once no target resolves to the executor.
|
|
83
|
+
function removeDeadExecutorDefaults(tree, removed, usedExecutors) {
|
|
84
|
+
const nxJson = (0, devkit_exports_1.readNxJson)(tree);
|
|
85
|
+
if (!nxJson?.targetDefaults) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const liveExecutors = new Set(usedExecutors);
|
|
89
|
+
// A target-name default that sets the executor hands it to the targets
|
|
90
|
+
// inheriting from it, which the executor-keyed default still configures.
|
|
91
|
+
for (const value of Object.values(nxJson.targetDefaults)) {
|
|
92
|
+
for (const entry of Array.isArray(value) ? value : [value]) {
|
|
93
|
+
if (entry?.executor) {
|
|
94
|
+
liveExecutors.add(entry.executor);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const before = JSON.stringify(nxJson.targetDefaults);
|
|
99
|
+
for (const executor of removed) {
|
|
100
|
+
if (!liveExecutors.has(executor)) {
|
|
101
|
+
(0, executor_to_plugin_migrator_1.removeDeadExecutorTargetDefault)(nxJson, executor);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (JSON.stringify(nxJson.targetDefaults) !== before) {
|
|
105
|
+
(0, devkit_exports_1.updateNxJson)(tree, nxJson);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function filterDefaults(defaults, removed) {
|
|
109
|
+
return Object.fromEntries(Object.entries(defaults).filter(([name, value]) => removed.has(name) ||
|
|
110
|
+
(Array.isArray(value) ? value : [value]).some((entry) => removed.has(entry.executor) || removed.has(entry.filter?.executor))));
|
|
111
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasIgnoreServerInputsDirective = hasIgnoreServerInputsDirective;
|
|
4
|
+
const nx_directives_1 = require("./nx-directives");
|
|
5
|
+
/**
|
|
6
|
+
* Whether the comment block that opens `content` has a bare
|
|
7
|
+
* `@nx-ignore-server-inputs` directive. False when one there has a value.
|
|
8
|
+
*/
|
|
9
|
+
function hasIgnoreServerInputsDirective(content) {
|
|
10
|
+
const values = (0, nx_directives_1.parseNxDirectives)(content).get('ignore-server-inputs');
|
|
11
|
+
return values !== undefined && values.every((value) => value === '');
|
|
12
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `@nx-<name>: <value>` directives in the comment block that opens a file,
|
|
3
|
-
* by name, with their trimmed values in order.
|
|
3
|
+
* by name, with their trimmed values in order. A bare `@nx-<name>` has the
|
|
4
|
+
* value `''`. Reading stops at the first line
|
|
4
5
|
* that is not blank, a shebang or a comment.
|
|
5
6
|
*/
|
|
6
7
|
export declare function parseNxDirectives(content: string): Map<string, string[]>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseNxDirectives = parseNxDirectives;
|
|
4
|
-
const DIRECTIVE = /^@nx-([\w-]+)
|
|
4
|
+
const DIRECTIVE = /^@nx-([\w-]+)(?::(.*))?$/;
|
|
5
5
|
/**
|
|
6
6
|
* The `@nx-<name>: <value>` directives in the comment block that opens a file,
|
|
7
|
-
* by name, with their trimmed values in order.
|
|
7
|
+
* by name, with their trimmed values in order. A bare `@nx-<name>` has the
|
|
8
|
+
* value `''`. Reading stops at the first line
|
|
8
9
|
* that is not blank, a shebang or a comment.
|
|
9
10
|
*/
|
|
10
11
|
function parseNxDirectives(content) {
|
|
@@ -45,7 +46,7 @@ function parseNxDirectives(content) {
|
|
|
45
46
|
}
|
|
46
47
|
const match = line.trim().match(DIRECTIVE);
|
|
47
48
|
if (match) {
|
|
48
|
-
const [, name, value] = match;
|
|
49
|
+
const [, name, value = ''] = match;
|
|
49
50
|
const values = directives.get(name);
|
|
50
51
|
if (values) {
|
|
51
52
|
values.push(value.trim());
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits a string into the words a command gets when a shell runs it, as
|
|
3
|
+
* run-commands does: with POSIX sh rules, or on Windows with cmd.exe and the C
|
|
4
|
+
* runtime's argv rules. Variables expand from `process.env`; command
|
|
5
|
+
* substitution and globs stay literal.
|
|
6
|
+
*/
|
|
7
|
+
export declare function splitShellArgs(value: string): string[];
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.splitShellArgs = splitShellArgs;
|
|
4
|
+
/**
|
|
5
|
+
* Splits a string into the words a command gets when a shell runs it, as
|
|
6
|
+
* run-commands does: with POSIX sh rules, or on Windows with cmd.exe and the C
|
|
7
|
+
* runtime's argv rules. Variables expand from `process.env`; command
|
|
8
|
+
* substitution and globs stay literal.
|
|
9
|
+
*/
|
|
10
|
+
function splitShellArgs(value) {
|
|
11
|
+
return process.platform === 'win32'
|
|
12
|
+
? splitWindowsArgs(applyCmdRules(value))
|
|
13
|
+
: splitPosixArgs(value);
|
|
14
|
+
}
|
|
15
|
+
function splitPosixArgs(value) {
|
|
16
|
+
const words = [];
|
|
17
|
+
let word;
|
|
18
|
+
let quote;
|
|
19
|
+
// An unquoted expansion splits into words on whitespace
|
|
20
|
+
const appendUnquoted = (text) => text.split(/[ \t\n]+/).forEach((part, index) => {
|
|
21
|
+
if (index > 0 && word !== undefined) {
|
|
22
|
+
words.push(word);
|
|
23
|
+
word = undefined;
|
|
24
|
+
}
|
|
25
|
+
if (part)
|
|
26
|
+
word = (word ?? '') + part;
|
|
27
|
+
});
|
|
28
|
+
for (let i = 0; i < value.length; i++) {
|
|
29
|
+
const char = value[i];
|
|
30
|
+
if (quote === "'") {
|
|
31
|
+
if (char === "'")
|
|
32
|
+
quote = undefined;
|
|
33
|
+
else
|
|
34
|
+
word += char;
|
|
35
|
+
}
|
|
36
|
+
else if (char === '\\' && value[i + 1] === '\n') {
|
|
37
|
+
i++;
|
|
38
|
+
}
|
|
39
|
+
else if (char === '$' && expandPosixVariable(value, i)) {
|
|
40
|
+
const expansion = expandPosixVariable(value, i);
|
|
41
|
+
if (quote)
|
|
42
|
+
word += expansion.value;
|
|
43
|
+
else
|
|
44
|
+
appendUnquoted(expansion.value);
|
|
45
|
+
i = expansion.end;
|
|
46
|
+
}
|
|
47
|
+
else if (quote === '"') {
|
|
48
|
+
if (char === '"') {
|
|
49
|
+
quote = undefined;
|
|
50
|
+
}
|
|
51
|
+
else if (char === '\\' && '"\\$`'.includes(value[i + 1])) {
|
|
52
|
+
word += value[++i];
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
word += char;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else if (/[ \t\n]/.test(char)) {
|
|
59
|
+
if (word !== undefined)
|
|
60
|
+
words.push(word);
|
|
61
|
+
word = undefined;
|
|
62
|
+
}
|
|
63
|
+
else if (char === '"' || char === "'") {
|
|
64
|
+
quote = char;
|
|
65
|
+
word ??= '';
|
|
66
|
+
}
|
|
67
|
+
else if (char === '\\' && i + 1 < value.length) {
|
|
68
|
+
word = (word ?? '') + value[++i];
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
word = (word ?? '') + char;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (word !== undefined)
|
|
75
|
+
words.push(word);
|
|
76
|
+
return words;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Expands `$NAME`, `${NAME}`, `${NAME-default}` and `${NAME:-default}` at
|
|
80
|
+
* `start`, returning the value and the index of its last character. Returns
|
|
81
|
+
* undefined for anything else, which stays literal.
|
|
82
|
+
*/
|
|
83
|
+
function expandPosixVariable(value, start) {
|
|
84
|
+
const name = value.slice(start + 1).match(/^[A-Za-z_][A-Za-z0-9_]*/)?.[0];
|
|
85
|
+
if (name) {
|
|
86
|
+
return { value: process.env[name] ?? '', end: start + name.length };
|
|
87
|
+
}
|
|
88
|
+
if (value[start + 1] !== '{')
|
|
89
|
+
return undefined;
|
|
90
|
+
let depth = 0;
|
|
91
|
+
for (let i = start + 1; i < value.length; i++) {
|
|
92
|
+
if (value[i] === '{')
|
|
93
|
+
depth++;
|
|
94
|
+
else if (value[i] === '}' && --depth === 0) {
|
|
95
|
+
const match = value
|
|
96
|
+
.slice(start + 2, i)
|
|
97
|
+
.match(/^([A-Za-z_][A-Za-z0-9_]*)(?:(:?)-(.*))?$/s);
|
|
98
|
+
if (!match)
|
|
99
|
+
return undefined;
|
|
100
|
+
const [, braced, colon, fallback] = match;
|
|
101
|
+
const env = process.env[braced];
|
|
102
|
+
const useFallback = fallback !== undefined && (colon ? !env : env === undefined);
|
|
103
|
+
return {
|
|
104
|
+
value: useFallback ? expandPosixText(fallback) : (env ?? ''),
|
|
105
|
+
end: i,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
function expandPosixText(text) {
|
|
112
|
+
let result = '';
|
|
113
|
+
for (let i = 0; i < text.length; i++) {
|
|
114
|
+
const expansion = text[i] === '$' && expandPosixVariable(text, i);
|
|
115
|
+
if (expansion) {
|
|
116
|
+
result += expansion.value;
|
|
117
|
+
i = expansion.end;
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
result += text[i];
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
// cmd.exe expands defined %NAME% variables, then drops each ^ outside double
|
|
126
|
+
// quotes and keeps the character after it
|
|
127
|
+
function applyCmdRules(value) {
|
|
128
|
+
const expanded = value.replace(/%([^%\s]+)%/g, (match, name) => process.env[name] ?? match);
|
|
129
|
+
let result = '';
|
|
130
|
+
let quoted = false;
|
|
131
|
+
for (let i = 0; i < expanded.length; i++) {
|
|
132
|
+
const char = expanded[i];
|
|
133
|
+
if (char === '^' && !quoted && i + 1 < expanded.length) {
|
|
134
|
+
result += expanded[++i];
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
if (char === '"')
|
|
138
|
+
quoted = !quoted;
|
|
139
|
+
result += char;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
// Backslashes are literal unless they precede a double quote, and single
|
|
145
|
+
// quotes are literal
|
|
146
|
+
function splitWindowsArgs(value) {
|
|
147
|
+
const words = [];
|
|
148
|
+
let word;
|
|
149
|
+
let quoted = false;
|
|
150
|
+
for (let i = 0; i < value.length; i++) {
|
|
151
|
+
const char = value[i];
|
|
152
|
+
if (char === '\\') {
|
|
153
|
+
let count = 1;
|
|
154
|
+
while (value[i + count] === '\\')
|
|
155
|
+
count++;
|
|
156
|
+
i += count - 1;
|
|
157
|
+
if (value[i + 1] === '"') {
|
|
158
|
+
word = (word ?? '') + '\\'.repeat(Math.floor(count / 2));
|
|
159
|
+
if (count % 2 === 1) {
|
|
160
|
+
word += '"';
|
|
161
|
+
i++;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
word = (word ?? '') + '\\'.repeat(count);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
else if (char === '"') {
|
|
169
|
+
if (quoted && value[i + 1] === '"') {
|
|
170
|
+
word += '"';
|
|
171
|
+
i++;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
quoted = !quoted;
|
|
175
|
+
word ??= '';
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
else if (!quoted && (char === ' ' || char === '\t')) {
|
|
179
|
+
if (word !== undefined)
|
|
180
|
+
words.push(word);
|
|
181
|
+
word = undefined;
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
word = (word ?? '') + char;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (word !== undefined)
|
|
188
|
+
words.push(word);
|
|
189
|
+
return words;
|
|
190
|
+
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { TargetConfiguration } from 'nx/src/devkit-exports';
|
|
2
|
-
declare const TEST_FILE_DIRECTIVES: readonly ['depends-on', 'ultracache'];
|
|
3
|
-
/** An `@nx-<name>` directive a plugin can apply to a test file's target. */
|
|
4
|
-
type TestFileDirective = (typeof TEST_FILE_DIRECTIVES)[number];
|
|
5
2
|
/**
|
|
6
|
-
* `target` with the `@nx
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* warning.
|
|
3
|
+
* `target` with the `@nx-depends-on` and `@nx-ignore-server-inputs`
|
|
4
|
+
* directives of a workspace-relative test file applied. A directive that lists
|
|
5
|
+
* no projects, has a value it does not take, or is not supported
|
|
6
|
+
* (`ignoreServerInputs: false`) is skipped with a warning.
|
|
10
7
|
*/
|
|
11
|
-
export declare function applyTestFileDirectives(target: TargetConfiguration, workspaceRoot: string, file: string,
|
|
12
|
-
|
|
8
|
+
export declare function applyTestFileDirectives(target: TargetConfiguration, workspaceRoot: string, file: string, options: {
|
|
9
|
+
ignoreServerInputs: boolean;
|
|
10
|
+
}): TargetConfiguration;
|
|
@@ -6,54 +6,37 @@ const node_path_1 = require("node:path");
|
|
|
6
6
|
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
7
7
|
const nx_directives_1 = require("./nx-directives");
|
|
8
8
|
const test_file_depends_on_1 = require("./test-file-depends-on");
|
|
9
|
-
const ultracache_directive_1 = require("./ultracache-directive");
|
|
10
9
|
const without_server_inputs_1 = require("./without-server-inputs");
|
|
11
|
-
const TEST_FILE_DIRECTIVES = ['depends-on', 'ultracache'];
|
|
12
10
|
/**
|
|
13
|
-
* `target` with the `@nx
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* warning.
|
|
11
|
+
* `target` with the `@nx-depends-on` and `@nx-ignore-server-inputs`
|
|
12
|
+
* directives of a workspace-relative test file applied. A directive that lists
|
|
13
|
+
* no projects, has a value it does not take, or is not supported
|
|
14
|
+
* (`ignoreServerInputs: false`) is skipped with a warning.
|
|
17
15
|
*/
|
|
18
|
-
function applyTestFileDirectives(target, workspaceRoot, file,
|
|
16
|
+
function applyTestFileDirectives(target, workspaceRoot, file, options) {
|
|
19
17
|
const directives = (0, nx_directives_1.parseNxDirectives)((0, node_fs_1.readFileSync)((0, node_path_1.join)(workspaceRoot, file), 'utf-8'));
|
|
20
18
|
let result = target;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
const dependsOn = directives.get('depends-on');
|
|
20
|
+
if (dependsOn !== undefined) {
|
|
21
|
+
const projects = (0, test_file_depends_on_1.dependsOnProjects)(dependsOn);
|
|
22
|
+
if (projects.length === 0) {
|
|
23
|
+
(0, devkit_internals_1.emitPluginWorkerLog)('warn', `${file}: "@nx-depends-on:" lists no projects, so Nx ignores it. List the projects the test depends on, separated by commas.`);
|
|
25
24
|
}
|
|
26
|
-
|
|
27
|
-
(0,
|
|
28
|
-
continue;
|
|
25
|
+
else {
|
|
26
|
+
result = (0, test_file_depends_on_1.scopeTestTargetToProjects)(result, projects);
|
|
29
27
|
}
|
|
30
|
-
result = applyDirective(result, directive, values, file);
|
|
31
28
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
case 'depends-on': {
|
|
37
|
-
const projects = (0, test_file_depends_on_1.dependsOnProjects)(values);
|
|
38
|
-
if (projects.length === 0) {
|
|
39
|
-
(0, devkit_internals_1.emitPluginWorkerLog)('warn', `${file}: "@nx-depends-on:" lists no projects, so Nx ignores it. List the projects the test depends on, separated by commas.`);
|
|
40
|
-
return target;
|
|
41
|
-
}
|
|
42
|
-
return (0, test_file_depends_on_1.scopeTestTargetToProjects)(target, projects);
|
|
29
|
+
const ignoreServerInputs = directives.get('ignore-server-inputs');
|
|
30
|
+
if (ignoreServerInputs !== undefined) {
|
|
31
|
+
if (!options.ignoreServerInputs) {
|
|
32
|
+
(0, devkit_internals_1.emitPluginWorkerLog)('warn', `${file}: "@nx-ignore-server-inputs" is not supported in this test file, so Nx ignores it.`);
|
|
43
33
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (unsupported !== undefined) {
|
|
47
|
-
(0, devkit_internals_1.emitPluginWorkerLog)('warn', `${file}: "@nx-ultracache:${unsupported && ` ${unsupported}`}" is not supported, so Nx ignores "@nx-ultracache" in this file. Use "@nx-ultracache: imports".`);
|
|
48
|
-
return target;
|
|
49
|
-
}
|
|
50
|
-
return target.dependsOn
|
|
51
|
-
? { ...target, dependsOn: (0, without_server_inputs_1.withoutServerInputs)(target.dependsOn) }
|
|
52
|
-
: target;
|
|
34
|
+
else if (ignoreServerInputs.some((value) => value !== '')) {
|
|
35
|
+
(0, devkit_internals_1.emitPluginWorkerLog)('warn', `${file}: "@nx-ignore-server-inputs" takes no value, so Nx ignores it. Write "// @nx-ignore-server-inputs" alone.`);
|
|
53
36
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
throw new Error(`Unhandled test file directive: ${unhandled}`);
|
|
37
|
+
else if (result.dependsOn) {
|
|
38
|
+
result = { ...result, dependsOn: (0, without_server_inputs_1.withoutServerInputs)(result.dependsOn) };
|
|
57
39
|
}
|
|
58
40
|
}
|
|
41
|
+
return result;
|
|
59
42
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/devkit",
|
|
3
|
-
"version": "24.0.0-beta.
|
|
3
|
+
"version": "24.0.0-beta.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"jest": "30.3.0",
|
|
70
|
-
"nx": "24.0.0-beta.
|
|
70
|
+
"nx": "24.0.0-beta.4"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"nx": ">= 23 <= 25 || ^24.0.0-0"
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Whether the comment block that opens `content` has an
|
|
3
|
-
* `@nx-ultracache: imports` directive. False when any `@nx-ultracache` value
|
|
4
|
-
* there is unsupported.
|
|
5
|
-
*/
|
|
6
|
-
export declare function hasUltracacheImportsDirective(content: string): boolean;
|
|
7
|
-
/** The first of the `@nx-ultracache` values that is not supported. */
|
|
8
|
-
export declare function findUnsupportedUltracacheValue(values: string[]): string | undefined;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasUltracacheImportsDirective = hasUltracacheImportsDirective;
|
|
4
|
-
exports.findUnsupportedUltracacheValue = findUnsupportedUltracacheValue;
|
|
5
|
-
const nx_directives_1 = require("./nx-directives");
|
|
6
|
-
const IMPORTS = 'imports';
|
|
7
|
-
/**
|
|
8
|
-
* Whether the comment block that opens `content` has an
|
|
9
|
-
* `@nx-ultracache: imports` directive. False when any `@nx-ultracache` value
|
|
10
|
-
* there is unsupported.
|
|
11
|
-
*/
|
|
12
|
-
function hasUltracacheImportsDirective(content) {
|
|
13
|
-
const values = (0, nx_directives_1.parseNxDirectives)(content).get('ultracache');
|
|
14
|
-
return (values !== undefined && findUnsupportedUltracacheValue(values) === undefined);
|
|
15
|
-
}
|
|
16
|
-
/** The first of the `@nx-ultracache` values that is not supported. */
|
|
17
|
-
function findUnsupportedUltracacheValue(values) {
|
|
18
|
-
return values.find((value) => value !== IMPORTS);
|
|
19
|
-
}
|