Socket
Socket
Sign inDemoInstall

nx

Package Overview
Dependencies
Maintainers
8
Versions
1371
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nx - npm Package Compare versions

Comparing version 0.0.0-pr-27652-0a94c12 to 0.0.0-pr-27652-3af8043

src/command-line/login/command-object.d.ts

26

package.json
{
"name": "nx",
"version": "0.0.0-pr-27652-0a94c12",
"version": "0.0.0-pr-27652-3af8043",
"private": false,

@@ -59,3 +59,3 @@ "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",

"jsonc-parser": "3.2.0",
"lines-and-columns": "~2.0.3",
"lines-and-columns": "2.0.3",
"minimatch": "9.0.3",

@@ -75,3 +75,3 @@ "npm-run-path": "^4.0.1",

"ora": "5.3.0",
"@nrwl/tao": "0.0.0-pr-27652-0a94c12"
"@nrwl/tao": "0.0.0-pr-27652-3af8043"
},

@@ -91,12 +91,12 @@ "peerDependencies": {

"optionalDependencies": {
"@nx/nx-darwin-x64": "0.0.0-pr-27652-0a94c12",
"@nx/nx-darwin-arm64": "0.0.0-pr-27652-0a94c12",
"@nx/nx-linux-x64-gnu": "0.0.0-pr-27652-0a94c12",
"@nx/nx-linux-x64-musl": "0.0.0-pr-27652-0a94c12",
"@nx/nx-win32-x64-msvc": "0.0.0-pr-27652-0a94c12",
"@nx/nx-linux-arm64-gnu": "0.0.0-pr-27652-0a94c12",
"@nx/nx-linux-arm64-musl": "0.0.0-pr-27652-0a94c12",
"@nx/nx-linux-arm-gnueabihf": "0.0.0-pr-27652-0a94c12",
"@nx/nx-win32-arm64-msvc": "0.0.0-pr-27652-0a94c12",
"@nx/nx-freebsd-x64": "0.0.0-pr-27652-0a94c12"
"@nx/nx-darwin-x64": "0.0.0-pr-27652-3af8043",
"@nx/nx-darwin-arm64": "0.0.0-pr-27652-3af8043",
"@nx/nx-linux-x64-gnu": "0.0.0-pr-27652-3af8043",
"@nx/nx-linux-x64-musl": "0.0.0-pr-27652-3af8043",
"@nx/nx-win32-x64-msvc": "0.0.0-pr-27652-3af8043",
"@nx/nx-linux-arm64-gnu": "0.0.0-pr-27652-3af8043",
"@nx/nx-linux-arm64-musl": "0.0.0-pr-27652-3af8043",
"@nx/nx-linux-arm-gnueabihf": "0.0.0-pr-27652-3af8043",
"@nx/nx-win32-arm64-msvc": "0.0.0-pr-27652-3af8043",
"@nx/nx-freebsd-x64": "0.0.0-pr-27652-3af8043"
},

@@ -103,0 +103,0 @@ "nx-migrations": {

@@ -285,2 +285,9 @@ {

"description": "Whether to automatically apply sync generator changes when running tasks. If not set, the user will be prompted. If set to `true`, the user will not be prompted and the changes will be applied. If set to `false`, the user will not be prompted and the changes will not be applied."
},
"disabledTaskSyncGenerators": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of registered task sync generators to disable."
}

@@ -287,0 +294,0 @@ },

@@ -63,5 +63,7 @@ "use strict";

if ((0, nx_cloud_utils_1.isNxCloudUsed)(nxJson)) {
const token = process.env.NX_CLOUD_ACCESS_TOKEN || nxJson.nxCloudAccessToken;
const token = process.env.NX_CLOUD_ACCESS_TOKEN ||
nxJson.nxCloudAccessToken ||
nxJson.nxCloudId;
if (!token) {
throw new Error(`Unable to authenticate. Either define accessToken in nx.json or set the NX_CLOUD_ACCESS_TOKEN env variable.`);
throw new Error(`Unable to authenticate. If you are connecting to Nx Cloud locally, set Nx Cloud ID in nx.json. If you are connecting in a CI context, either define accessToken in nx.json or set the NX_CLOUD_ACCESS_TOKEN env variable.`);
}

@@ -72,6 +74,5 @@ const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)(installationSource, token);

bodyLines: [
'If you have not done so already, connect your workspace to your Nx Cloud account:',
`- Connect with Nx Cloud at:
${connectCloudUrl}`,
'If you have not done so already, connect your workspace to your Nx Cloud account with the following URL:',
'',
`${connectCloudUrl}`,
],

@@ -78,0 +79,0 @@ });

@@ -678,4 +678,6 @@ "use strict";

inputs.forEach((input) => {
if (input.startsWith('{workspaceRoot}')) {
workspaceRootInputs.push(input);
// grouped workspace inputs look like workspace:[pattern,otherPattern]
if (input.startsWith('workspace:[')) {
const inputs = input.substring(11, input.length - 1).split(',');
workspaceRootInputs.push(...inputs);
return;

@@ -700,18 +702,3 @@ }

});
const workspaceRootsExpanded = workspaceRootInputs.flatMap((input) => {
const matches = [];
const withoutWorkspaceRoot = input.substring(16);
const matchingFile = allWorkspaceFiles.find((t) => t.file === withoutWorkspaceRoot);
if (matchingFile) {
matches.push(matchingFile.file);
}
else {
allWorkspaceFiles
.filter((f) => (0, minimatch_1.minimatch)(f.file, withoutWorkspaceRoot))
.forEach((f) => {
matches.push(f.file);
});
}
return matches;
});
const workspaceRootsExpanded = getExpandedWorkspaceRoots(workspaceRootInputs, allWorkspaceFiles);
const otherInputsExpanded = otherInputs.map((input) => {

@@ -749,2 +736,32 @@ if (input === 'TsConfig') {

}
function getExpandedWorkspaceRoots(workspaceRootInputs, allWorkspaceFiles) {
const workspaceRootsExpanded = [];
const negativeWRPatterns = [];
const positiveWRPatterns = [];
for (const fileset of workspaceRootInputs) {
if (fileset.startsWith('!')) {
negativeWRPatterns.push(fileset.substring(17));
}
else {
positiveWRPatterns.push(fileset.substring(16));
}
}
for (const pattern of positiveWRPatterns) {
const matchingFile = allWorkspaceFiles.find((t) => t.file === pattern);
if (matchingFile &&
!negativeWRPatterns.some((p) => (0, minimatch_1.minimatch)(matchingFile.file, p))) {
workspaceRootsExpanded.push(matchingFile.file);
}
else {
allWorkspaceFiles
.filter((f) => (0, minimatch_1.minimatch)(f.file, pattern) &&
!negativeWRPatterns.some((p) => (0, minimatch_1.minimatch)(f.file, p)))
.forEach((f) => {
workspaceRootsExpanded.push(f.file);
});
}
}
workspaceRootsExpanded.sort();
return workspaceRootsExpanded;
}
async function createJsonOutput(prunedGraph, rawGraph, projects, targets) {

@@ -751,0 +768,0 @@ const response = {

@@ -9,3 +9,3 @@ "use strict";

command: 'import [sourceRemoteUrl] [destination]',
describe: `Import a project into the current workspace. Install git-filter-repo for faster imports (https://github.com/newren/git-filter-repo).`,
describe: false,
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withVerbose)(yargs

@@ -12,0 +12,0 @@ .positional('sourceRemoteUrl', {

@@ -27,4 +27,6 @@ "use strict";

const command_object_21 = require("./add/command-object");
const command_object_22 = require("./login/command-object");
const command_object_23 = require("./logout/command-object");
const command_objects_1 = require("./deprecated/command-objects");
const command_object_22 = require("./sync/command-object");
const command_object_24 = require("./sync/command-object");
// Ensure that the output takes up the available width of the terminal.

@@ -74,7 +76,9 @@ yargs.wrap(yargs.terminalWidth());

.command(command_object_17.yargsShowCommand)
.command(command_object_22.yargsSyncCommand)
.command(command_object_22.yargsSyncCheckCommand)
.command(command_object_24.yargsSyncCommand)
.command(command_object_24.yargsSyncCheckCommand)
.command(command_object_2.yargsViewLogsCommand)
.command(command_object_18.yargsWatchCommand)
.command(command_object_15.yargsNxInfixCommand)
.command(command_object_22.yargsLoginCommand)
.command(command_object_23.yargsLogoutCommand)
.scriptName('nx')

@@ -81,0 +85,0 @@ .help()

@@ -13,17 +13,19 @@ import type { NxReleaseConfiguration } from '../../config/nx-json';

}
declare const defaultClient: ReleaseClient;
/**
* @public
*/
export declare const releaseChangelog: any;
export declare const releaseChangelog: typeof defaultClient.releaseChangelog;
/**
* @public
*/
export declare const releasePublish: any;
export declare const releasePublish: typeof defaultClient.releasePublish;
/**
* @public
*/
export declare const releaseVersion: any;
export declare const releaseVersion: typeof defaultClient.releaseVersion;
/**
* @public
*/
export declare const release: any;
export declare const release: typeof defaultClient.release;
export {};

@@ -5,2 +5,3 @@ "use strict";

const ora = require("ora");
const nx_json_1 = require("../../config/nx-json");
const project_graph_1 = require("../../project-graph/project-graph");

@@ -14,3 +15,13 @@ const output_1 = require("../../utils/output");

const projectGraph = await (0, project_graph_1.createProjectGraphAsync)();
const syncGenerators = await (0, sync_generators_1.collectAllRegisteredSyncGenerators)(projectGraph);
const nxJson = (0, nx_json_1.readNxJson)();
const syncGenerators = await (0, sync_generators_1.collectAllRegisteredSyncGenerators)(projectGraph, nxJson);
if (!syncGenerators.length) {
output_1.output.success({
title: options.check
? 'The workspace is up to date'
: 'The workspace is already up to date',
bodyLines: ['There are no sync generators to run.'],
});
return 0;
}
const results = await (0, sync_generators_1.getSyncGeneratorChanges)(syncGenerators);

@@ -17,0 +28,0 @@ if (!results.length) {

@@ -289,3 +289,3 @@ import type { ChangelogRenderOptions } from '../../release/changelog-renderer';

* Whether to automatically apply sync generator changes when running tasks.
* If not set, the user will be prompted.
* If not set, the user will be prompted in interactive mode.
* If set to `true`, the user will not be prompted and the changes will be applied.

@@ -295,2 +295,6 @@ * If set to `false`, the user will not be prompted and the changes will not be applied.

applyChanges?: boolean;
/**
* List of registered task sync generators to disable.
*/
disabledTaskSyncGenerators?: string[];
}

@@ -297,0 +301,0 @@ /**

@@ -24,2 +24,3 @@ "use strict";

let storedNxJsonHash;
let storedDisabledTaskSyncGeneratorsHash;
const log = (...messageParts) => {

@@ -111,2 +112,6 @@ logger_1.serverLogger.log('[SYNC]:', ...messageParts);

scheduledGenerators.clear();
if (!registeredSyncGenerators.size) {
// there are no generators to run
return;
}
for (const generator of registeredSyncGenerators) {

@@ -149,7 +154,11 @@ scheduledGenerators.add(generator);

function collectAllRegisteredSyncGenerators(projectGraph) {
const nxJson = (0, nx_json_1.readNxJson)();
const projectGraphHash = hashProjectGraph(projectGraph);
if (storedProjectGraphHash !== projectGraphHash) {
const disabledTaskSyncGeneratorsHash = (0, file_hasher_1.hashArray)(nxJson.sync?.disabledTaskSyncGenerators?.sort() ?? []);
if (projectGraphHash !== storedProjectGraphHash ||
disabledTaskSyncGeneratorsHash !== storedDisabledTaskSyncGeneratorsHash) {
storedProjectGraphHash = projectGraphHash;
storedDisabledTaskSyncGeneratorsHash = disabledTaskSyncGeneratorsHash;
registeredTaskSyncGenerators =
(0, sync_generators_1.collectRegisteredTaskSyncGenerators)(projectGraph);
(0, sync_generators_1.collectEnabledTaskSyncGeneratorsFromProjectGraph)(projectGraph, nxJson);
}

@@ -159,3 +168,2 @@ else {

}
const nxJson = (0, nx_json_1.readNxJson)();
const nxJsonHash = (0, file_hasher_1.hashArray)(nxJson.sync?.globalGenerators?.sort() ?? []);

@@ -162,0 +170,0 @@ if (storedNxJsonHash !== nxJsonHash) {

@@ -19,3 +19,3 @@ "use strict";

(0, task_env_1.unloadDotEnvFile)(path, env);
const result = (0, task_env_1.loadAndExpandDotEnvFile)(path, env);
const result = (0, task_env_1.loadAndExpandDotEnvFile)(path, env, true);
if (result.error) {

@@ -297,10 +297,15 @@ throw result.error;

const localEnv = (0, npm_run_path_1.env)({ cwd: cwd ?? process.cwd() });
const res = {
let res = {
...process.env,
...localEnv,
...env,
};
// env file from envFile option takes priority over process env
if (process.env.NX_LOAD_DOT_ENV_FILES !== 'false') {
loadEnvVars(envFile, res);
}
// env variables from env option takes priority over everything else
res = {
...res,
...env,
};
// need to override PATH to make sure we are using the local node_modules

@@ -307,0 +312,0 @@ if (localEnv.PATH)

@@ -41,3 +41,3 @@ import { NxJsonConfiguration } from '../config/nx-json';

private hashProjectInputs;
private hashRootFileset;
private hashRootFilesets;
private hashProjectConfig;

@@ -44,0 +44,0 @@ private hashTsConfig;

@@ -302,6 +302,6 @@ "use strict";

this.hashTsConfig(projectName),
...[
...workspaceFilesets,
...this.legacyFilesetInputs.map((r) => r.fileset),
].map((fileset) => this.hashRootFileset(fileset)),
...(workspaceFilesets.length
? [this.hashRootFilesets(workspaceFilesets)]
: []),
this.hashRootFilesets(this.legacyFilesetInputs.map((r) => r.fileset)),
...[...notFilesets, ...this.legacyRuntimeInputs].map((r) => r['runtime']

@@ -324,18 +324,36 @@ ? this.hashRuntime(env, r['runtime'])

}
async hashRootFileset(fileset) {
const mapKey = fileset;
const withoutWorkspaceRoot = fileset.substring(16);
async hashRootFilesets(filesets) {
const mapKey = `workspace:[${filesets.join(',')}]`;
if (!this.filesetHashes[mapKey]) {
this.filesetHashes[mapKey] = new Promise(async (res) => {
const parts = [];
const matchingFile = this.allWorkspaceFiles.find((t) => t.file === withoutWorkspaceRoot);
if (matchingFile) {
parts.push(matchingFile.hash);
const negativePatterns = [];
const positivePatterns = [];
for (const fileset of filesets) {
if (fileset.startsWith('!')) {
negativePatterns.push(fileset.substring(17));
}
else {
positivePatterns.push(fileset.substring(16));
}
}
else {
this.allWorkspaceFiles
.filter((f) => (0, minimatch_1.minimatch)(f.file, withoutWorkspaceRoot))
.forEach((f) => {
parts.push(f.hash);
});
for (const fileset of positivePatterns) {
const withoutWorkspaceRoot = fileset;
// Used to shortcut minimatch if not necessary
const matchingFile = this.allWorkspaceFiles.find((t) => t.file === withoutWorkspaceRoot);
// shortcut because there is a direct match
if (matchingFile) {
if (!negativePatterns.some((p) => (0, minimatch_1.minimatch)(matchingFile.file, p))) {
parts.push(matchingFile.hash);
}
// No direct match, check if pattern matched
}
else {
this.allWorkspaceFiles
.filter((f) => (0, minimatch_1.minimatch)(f.file, withoutWorkspaceRoot) &&
!negativePatterns.some((p) => (0, minimatch_1.minimatch)(f.file, p)))
.forEach((f) => {
parts.push(f.hash);
});
}
}

@@ -342,0 +360,0 @@ const value = (0, file_hasher_1.hashArray)(parts);

@@ -14,3 +14,3 @@ import type { CloudTaskRunnerOptions } from './nx-cloud-tasks-runner-shell';

nxCloudTasksRunner: TasksRunner<CloudTaskRunnerOptions>;
remoteCache: RemoteCacheV2;
getRemoteCache: () => RemoteCacheV2;
}

@@ -17,0 +17,0 @@ export declare function verifyOrUpdateNxCloudClient(options: CloudTaskRunnerOptions): Promise<{

@@ -14,8 +14,3 @@ "use strict";

if (!accessToken && !nxCloudId) {
if (process.env.NX_ENABLE_LOGIN === 'true' && !nxCloudId) {
throw new Error(`Unable to authenticate. Please connect your workspace to Nx Cloud to define a valid Nx Cloud Id. If you are in a CI context, please set the NX_CLOUD_ACCESS_TOKEN environment variable or define an access token in your nx.json.`);
}
else {
throw new Error(`Unable to authenticate. Either define accessToken in nx.json or set the NX_CLOUD_ACCESS_TOKEN env variable. If you do not want to use Nx Cloud for this command, either set NX_NO_CLOUD=true, or pass the --no-cloud flag.`);
}
throw new Error(`Unable to authenticate. If you are connecting to Nx Cloud locally, set an Nx Cloud ID in your nx.json with "nx connect". If you are in a CI context, please set the NX_CLOUD_ACCESS_TOKEN environment variable or define an access token in your nx.json.`);
}

@@ -22,0 +17,0 @@ if (options.customProxyConfigPath) {

@@ -84,4 +84,4 @@ "use strict";

const { nxCloudClient } = await (0, update_manager_1.verifyOrUpdateNxCloudClient)(options);
if (nxCloudClient.remoteCache) {
return nxCloudClient.remoteCache;
if (nxCloudClient.getRemoteCache) {
return nxCloudClient.getRemoteCache();
}

@@ -88,0 +88,0 @@ else {

@@ -59,5 +59,5 @@ "use strict";

async function runAllTasks(tasks, options, context) {
const orchestrator = new task_orchestrator_1.TaskOrchestrator(context.hasher, context.initiatingProject, context.projectGraph, context.taskGraph, options, context.nxArgs?.nxBail, context.daemon);
const orchestrator = new task_orchestrator_1.TaskOrchestrator(context.hasher, context.initiatingProject, context.projectGraph, context.taskGraph, options, context.nxArgs?.nxBail, context.daemon, context.nxArgs?.outputStyle);
return orchestrator.run();
}
exports.default = exports.defaultTasksRunner;
import { NxArgs } from '../utils/command-line-utils';
import { Task, TaskGraph } from '../config/task-graph';
import { TaskResult } from './life-cycle';
export declare function initTasksRunner(nxArgs: NxArgs): Promise<{

@@ -10,3 +11,4 @@ invoke: (opts: {

taskGraph: TaskGraph;
taskResults: Record<string, TaskResult>;
}>;
}>;

@@ -55,2 +55,3 @@ "use strict";

taskGraph,
taskResults: lifeCycle.getTaskResults(),
};

@@ -57,0 +58,0 @@ },

import { TaskStatus } from '../tasks-runner';
import type { LifeCycle } from '../life-cycle';
import type { LifeCycle, TaskResult } from '../life-cycle';
import { Task } from '../../config/task-graph';

@@ -8,11 +8,9 @@ export declare class InvokeRunnerTerminalOutputLifeCycle implements LifeCycle {

cachedTasks: Task[];
private taskResults;
constructor(tasks: Task[]);
startCommand(): void;
endCommand(): void;
endTasks(taskResults: {
task: Task;
status: TaskStatus;
code: number;
}[]): void;
endTasks(taskResults: TaskResult[]): void;
printTaskTerminalOutput(task: Task, cacheStatus: TaskStatus, terminalOutput: string): void;
getTaskResults(): Record<string, TaskResult>;
}

@@ -11,2 +11,3 @@ "use strict";

this.cachedTasks = [];
this.taskResults = {};
}

@@ -49,2 +50,3 @@ startCommand() {

for (let t of taskResults) {
this.taskResults[t.task.id] = t;
if (t.status === 'failure') {

@@ -68,3 +70,6 @@ this.failedTasks.push(t.task);

}
getTaskResults() {
return this.taskResults;
}
}
exports.InvokeRunnerTerminalOutputLifeCycle = InvokeRunnerTerminalOutputLifeCycle;

@@ -124,12 +124,3 @@ "use strict";

// collect unique syncGenerators from the tasks
const uniqueSyncGenerators = new Set();
for (const { target } of Object.values(taskGraph.tasks)) {
const { syncGenerators } = projectGraph.nodes[target.project].data.targets[target.target];
if (!syncGenerators) {
continue;
}
for (const generator of syncGenerators) {
uniqueSyncGenerators.add(generator);
}
}
const uniqueSyncGenerators = (0, sync_generators_1.collectEnabledTaskSyncGeneratorsFromTaskGraph)(taskGraph, projectGraph, nxJson);
if (!uniqueSyncGenerators.size) {

@@ -445,3 +436,3 @@ // There are no sync generators registered in the tasks to run

process.env.NX_CLOUD_ACCESS_TOKEN ||
// Nx Cloud Id specified in nxJson
// Nx Cloud ID specified in nxJson
nxJson.nxCloudId;

@@ -448,0 +439,0 @@ return isCloudRunner ? 'nx-cloud' : require.resolve('./default-tasks-runner');

@@ -10,5 +10,5 @@ import { Task } from '../config/task-graph';

* This function loads a .env file and expands the variables in it.
* It is going to override existing environmentVariables.
* @param filename
* @param environmentVariables
* @param filename the .env file to load
* @param environmentVariables the object to load environment variables into
* @param override whether to override existing environment variables
*/

@@ -15,0 +15,0 @@ export declare function loadAndExpandDotEnvFile(filename: string, environmentVariables: NodeJS.ProcessEnv, override?: boolean): import("dotenv-expand").DotenvExpandOutput;

@@ -82,5 +82,5 @@ "use strict";

* This function loads a .env file and expands the variables in it.
* It is going to override existing environmentVariables.
* @param filename
* @param environmentVariables
* @param filename the .env file to load
* @param environmentVariables the object to load environment variables into
* @param override whether to override existing environment variables
*/

@@ -87,0 +87,0 @@ function loadAndExpandDotEnvFile(filename, environmentVariables, override = false) {

@@ -15,2 +15,3 @@ import { TaskHasher } from '../hasher/task-hasher';

private readonly daemon;
private readonly outputStyle;
private cache;

@@ -27,3 +28,3 @@ private forkedProcessTaskRunner;

private bailed;
constructor(hasher: TaskHasher, initiatingProject: string | undefined, projectGraph: ProjectGraph, taskGraph: TaskGraph, options: DefaultTasksRunnerOptions, bail: boolean, daemon: DaemonClient);
constructor(hasher: TaskHasher, initiatingProject: string | undefined, projectGraph: ProjectGraph, taskGraph: TaskGraph, options: DefaultTasksRunnerOptions, bail: boolean, daemon: DaemonClient, outputStyle: string);
run(): Promise<{

@@ -30,0 +31,0 @@ [id: string]: TaskStatus;

@@ -22,3 +22,3 @@ "use strict";

// endregion internal state
constructor(hasher, initiatingProject, projectGraph, taskGraph, options, bail, daemon) {
constructor(hasher, initiatingProject, projectGraph, taskGraph, options, bail, daemon, outputStyle) {
this.hasher = hasher;

@@ -31,2 +31,3 @@ this.initiatingProject = initiatingProject;

this.daemon = daemon;
this.outputStyle = outputStyle;
this.cache = process.env.NX_DB_CACHE === 'true'

@@ -214,3 +215,5 @@ ? new cache_1.DbCache({

const temporaryOutputPath = this.cache.temporaryOutputPath(task);
const streamOutput = (0, utils_1.shouldStreamOutput)(task, this.initiatingProject);
const streamOutput = this.outputStyle === 'static'
? false
: (0, utils_1.shouldStreamOutput)(task, this.initiatingProject);
let env = pipeOutput

@@ -217,0 +220,0 @@ ? (0, task_env_1.getEnvVariablesForTask)(task, taskSpecificEnv, process.env.FORCE_COLOR === undefined

@@ -64,5 +64,7 @@ "use strict";

async getGitFiles(path) {
return (await this.execAsync(`git ls-files ${path}`))
// Use -z to return file names exactly as they are stored in git, separated by NULL (\x00) character.
// This avoids problems with special characters in file names.
return (await this.execAsync(`git ls-files -z ${path}`))
.trim()
.split('\n')
.split('\x00')
.map((s) => s.trim())

@@ -69,0 +71,0 @@ .filter(Boolean);

import type { GeneratorCallback } from '../config/misc-interfaces';
import { type NxJsonConfiguration } from '../config/nx-json';
import type { ProjectGraph } from '../config/project-graph';
import type { TaskGraph } from '../config/task-graph';
import type { ProjectConfiguration } from '../config/workspace-json-project-json';

@@ -18,6 +20,7 @@ import { FsTree, type FileChange, type Tree } from '../generators/tree';

export declare function flushSyncGeneratorChanges(results: SyncGeneratorChangesResult[]): Promise<void>;
export declare function collectAllRegisteredSyncGenerators(projectGraph: ProjectGraph): Promise<string[]>;
export declare function collectAllRegisteredSyncGenerators(projectGraph: ProjectGraph, nxJson: NxJsonConfiguration): Promise<string[]>;
export declare function runSyncGenerator(tree: FsTree, generatorSpecifier: string, projects: Record<string, ProjectConfiguration>): Promise<SyncGeneratorChangesResult>;
export declare function collectRegisteredTaskSyncGenerators(projectGraph: ProjectGraph): Set<string>;
export declare function collectRegisteredGlobalSyncGenerators(nxJson?: import("../config/nx-json").NxJsonConfiguration<string[] | "*">): Set<string>;
export declare function collectEnabledTaskSyncGeneratorsFromProjectGraph(projectGraph: ProjectGraph, nxJson: NxJsonConfiguration): Set<string>;
export declare function collectEnabledTaskSyncGeneratorsFromTaskGraph(taskGraph: TaskGraph, projectGraph: ProjectGraph, nxJson: NxJsonConfiguration): Set<string>;
export declare function collectRegisteredGlobalSyncGenerators(nxJson?: NxJsonConfiguration<string[] | "*">): Set<string>;
export declare function syncGeneratorResultsToMessageLines(results: SyncGeneratorChangesResult[]): string[];

@@ -7,3 +7,4 @@ "use strict";

exports.runSyncGenerator = runSyncGenerator;
exports.collectRegisteredTaskSyncGenerators = collectRegisteredTaskSyncGenerators;
exports.collectEnabledTaskSyncGeneratorsFromProjectGraph = collectEnabledTaskSyncGeneratorsFromProjectGraph;
exports.collectEnabledTaskSyncGeneratorsFromTaskGraph = collectEnabledTaskSyncGeneratorsFromTaskGraph;
exports.collectRegisteredGlobalSyncGenerators = collectRegisteredGlobalSyncGenerators;

@@ -43,6 +44,6 @@ exports.syncGeneratorResultsToMessageLines = syncGeneratorResultsToMessageLines;

}
async function collectAllRegisteredSyncGenerators(projectGraph) {
async function collectAllRegisteredSyncGenerators(projectGraph, nxJson) {
if (!client_1.daemonClient.enabled()) {
return [
...collectRegisteredTaskSyncGenerators(projectGraph),
...collectEnabledTaskSyncGeneratorsFromProjectGraph(projectGraph, nxJson),
...collectRegisteredGlobalSyncGenerators(),

@@ -74,4 +75,5 @@ ];

}
function collectRegisteredTaskSyncGenerators(projectGraph) {
function collectEnabledTaskSyncGeneratorsFromProjectGraph(projectGraph, nxJson) {
const taskSyncGenerators = new Set();
const disabledTaskSyncGenerators = new Set(nxJson.sync?.disabledTaskSyncGenerators ?? []);
for (const { data: { targets }, } of Object.values(projectGraph.nodes)) {

@@ -82,6 +84,26 @@ if (!targets) {

for (const target of Object.values(targets)) {
if (!target.syncGenerators) {
if (!target.syncGenerators?.length) {
continue;
}
for (const generator of target.syncGenerators) {
if (!disabledTaskSyncGenerators.has(generator) &&
!taskSyncGenerators.has(generator)) {
taskSyncGenerators.add(generator);
}
}
}
}
return taskSyncGenerators;
}
function collectEnabledTaskSyncGeneratorsFromTaskGraph(taskGraph, projectGraph, nxJson) {
const taskSyncGenerators = new Set();
const disabledTaskSyncGenerators = new Set(nxJson.sync?.disabledTaskSyncGenerators ?? []);
for (const { target } of Object.values(taskGraph.tasks)) {
const { syncGenerators } = projectGraph.nodes[target.project].data.targets[target.target];
if (!syncGenerators?.length) {
continue;
}
for (const generator of syncGenerators) {
if (!disabledTaskSyncGenerators.has(generator) &&
!taskSyncGenerators.has(generator)) {
taskSyncGenerators.add(generator);

@@ -88,0 +110,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc