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 19.7.0-canary.20240828-13170da to 19.7.0-canary.20240829-0ef6892

24

package.json
{
"name": "nx",
"version": "19.7.0-canary.20240828-13170da",
"version": "19.7.0-canary.20240829-0ef6892",
"private": false,

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

"ora": "5.3.0",
"@nrwl/tao": "19.7.0-canary.20240828-13170da"
"@nrwl/tao": "19.7.0-canary.20240829-0ef6892"
},

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

"optionalDependencies": {
"@nx/nx-darwin-x64": "19.7.0-canary.20240828-13170da",
"@nx/nx-darwin-arm64": "19.7.0-canary.20240828-13170da",
"@nx/nx-linux-x64-gnu": "19.7.0-canary.20240828-13170da",
"@nx/nx-linux-x64-musl": "19.7.0-canary.20240828-13170da",
"@nx/nx-win32-x64-msvc": "19.7.0-canary.20240828-13170da",
"@nx/nx-linux-arm64-gnu": "19.7.0-canary.20240828-13170da",
"@nx/nx-linux-arm64-musl": "19.7.0-canary.20240828-13170da",
"@nx/nx-linux-arm-gnueabihf": "19.7.0-canary.20240828-13170da",
"@nx/nx-win32-arm64-msvc": "19.7.0-canary.20240828-13170da",
"@nx/nx-freebsd-x64": "19.7.0-canary.20240828-13170da"
"@nx/nx-darwin-x64": "19.7.0-canary.20240829-0ef6892",
"@nx/nx-darwin-arm64": "19.7.0-canary.20240829-0ef6892",
"@nx/nx-linux-x64-gnu": "19.7.0-canary.20240829-0ef6892",
"@nx/nx-linux-x64-musl": "19.7.0-canary.20240829-0ef6892",
"@nx/nx-win32-x64-msvc": "19.7.0-canary.20240829-0ef6892",
"@nx/nx-linux-arm64-gnu": "19.7.0-canary.20240829-0ef6892",
"@nx/nx-linux-arm64-musl": "19.7.0-canary.20240829-0ef6892",
"@nx/nx-linux-arm-gnueabihf": "19.7.0-canary.20240829-0ef6892",
"@nx/nx-win32-arm64-msvc": "19.7.0-canary.20240829-0ef6892",
"@nx/nx-freebsd-x64": "19.7.0-canary.20240829-0ef6892"
},

@@ -102,0 +102,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 @@ },

@@ -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) {

@@ -45,14 +45,2 @@ "use strict";

}
async function createNxCloudWorkspaceV1(workspaceName, installationSource, nxInitDate) {
const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
const response = await require('axios').post(`${apiUrl}/nx-cloud/create-org-and-workspace`, {
workspaceName,
installationSource,
nxInitDate,
});
if (response.data.message) {
throw new Error(response.data.message);
}
return response.data;
}
async function createNxCloudWorkspaceV2(workspaceName, installationSource, nxInitDate) {

@@ -85,15 +73,2 @@ const apiUrl = (0, get_cloud_options_1.getCloudUrl)();

}
function addNxCloudOptionsToNxJson(tree, token, directory = '') {
const nxJsonPath = (0, path_1.join)(directory, 'nx.json');
if (tree.exists(nxJsonPath)) {
(0, json_1.updateJson)(tree, (0, path_1.join)(directory, 'nx.json'), (nxJson) => {
const overrideUrl = process.env.NX_CLOUD_API || process.env.NRWL_API;
if (overrideUrl) {
nxJson.nxCloudUrl = overrideUrl;
}
nxJson.nxCloudAccessToken = token;
return nxJson;
});
}
}
function addNxCloudIdToNxJson(tree, nxCloudId, directory = '') {

@@ -120,3 +95,2 @@ const nxJsonPath = (0, path_1.join)(directory, 'nx.json');

const usesGithub = schema.github ?? (await (0, url_shorten_1.repoUsesGithub)(schema.github));
let responseFromCreateNxCloudWorkspaceV1;
let responseFromCreateNxCloudWorkspaceV2;

@@ -126,18 +100,8 @@ // do NOT create Nx Cloud token (createNxCloudWorkspace)

if (!(usesGithub && schema.installationSource === 'nx-connect')) {
if (process.env.NX_ENABLE_LOGIN === 'true') {
responseFromCreateNxCloudWorkspaceV2 = await createNxCloudWorkspaceV2(getRootPackageName(tree), schema.installationSource, getNxInitDate());
addNxCloudIdToNxJson(tree, responseFromCreateNxCloudWorkspaceV2?.nxCloudId, schema.directory);
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
silent: schema.hideFormatLogs,
});
return responseFromCreateNxCloudWorkspaceV2.nxCloudId;
}
else {
responseFromCreateNxCloudWorkspaceV1 = await createNxCloudWorkspaceV1(getRootPackageName(tree), schema.installationSource, getNxInitDate());
addNxCloudOptionsToNxJson(tree, responseFromCreateNxCloudWorkspaceV1?.token, schema.directory);
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
silent: schema.hideFormatLogs,
});
return responseFromCreateNxCloudWorkspaceV1.token;
}
responseFromCreateNxCloudWorkspaceV2 = await createNxCloudWorkspaceV2(getRootPackageName(tree), schema.installationSource, getNxInitDate());
addNxCloudIdToNxJson(tree, responseFromCreateNxCloudWorkspaceV2?.nxCloudId, schema.directory);
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
silent: schema.hideFormatLogs,
});
return responseFromCreateNxCloudWorkspaceV2.nxCloudId;
}

@@ -144,0 +108,0 @@ }

@@ -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<{

@@ -21,2 +21,9 @@ "use strict";

...node_module_1.builtinModules.map((x) => `node:${x}`),
// These are missing in the builtinModules list
// See: https://github.com/nodejs/node/issues/42785
// TODO(v20): We should be safe to use `isBuiltin` function instead of keep the set here (https://nodejs.org/api/module.html#moduleisbuiltinmodulename)
'test',
'node:test',
'node:sea',
'node:sqlite',
]);

@@ -269,3 +276,3 @@ function isBuiltinModuleImport(importExpr) {

let dir = (0, node_path_1.dirname)(pathOfFileInPackage);
while (dir !== (0, node_path_1.parse)(dir).root) {
while (dir !== (0, node_path_1.dirname)(dir)) {
const packageJsonPath = (0, node_path_1.join)(dir, 'package.json');

@@ -272,0 +279,0 @@ try {

@@ -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 {

@@ -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) {

@@ -136,0 +127,0 @@ // There are no sync generators registered in the tasks to run

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 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