Socket
Socket
Sign inDemoInstall

nx

Package Overview
Dependencies
Maintainers
8
Versions
1357
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.5.6 to 19.5.7

24

package.json
{
"name": "nx",
"version": "19.5.6",
"version": "19.5.7",
"private": false,

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

"ora": "5.3.0",
"@nrwl/tao": "19.5.6"
"@nrwl/tao": "19.5.7"
},

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

"optionalDependencies": {
"@nx/nx-darwin-x64": "19.5.6",
"@nx/nx-darwin-arm64": "19.5.6",
"@nx/nx-linux-x64-gnu": "19.5.6",
"@nx/nx-linux-x64-musl": "19.5.6",
"@nx/nx-win32-x64-msvc": "19.5.6",
"@nx/nx-linux-arm64-gnu": "19.5.6",
"@nx/nx-linux-arm64-musl": "19.5.6",
"@nx/nx-linux-arm-gnueabihf": "19.5.6",
"@nx/nx-win32-arm64-msvc": "19.5.6",
"@nx/nx-freebsd-x64": "19.5.6"
"@nx/nx-darwin-x64": "19.5.7",
"@nx/nx-darwin-arm64": "19.5.7",
"@nx/nx-linux-x64-gnu": "19.5.7",
"@nx/nx-linux-x64-musl": "19.5.7",
"@nx/nx-win32-x64-msvc": "19.5.7",
"@nx/nx-linux-arm64-gnu": "19.5.7",
"@nx/nx-linux-arm64-musl": "19.5.7",
"@nx/nx-linux-arm-gnueabihf": "19.5.7",
"@nx/nx-win32-arm64-msvc": "19.5.7",
"@nx/nx-freebsd-x64": "19.5.7"
},

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

export declare const allowedProjectExtensions: readonly ["tags", "implicitDependencies", "configFilePath", "$schema", "generators", "namedInputs", "name", "files", "root", "sourceRoot", "projectType", "release", "includedScripts", "metadata"];
export declare const allowedWorkspaceExtensions: readonly ["implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins"];
export declare const allowedWorkspaceExtensions: readonly ["implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins", "neverConnectToCloud"];

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

'useInferencePlugins',
'neverConnectToCloud',
];

@@ -65,0 +66,0 @@ if (!patched) {

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

const nxJson = (0, configuration_1.readNxJson)();
const installationSource = process.env.NX_CONSOLE
? 'nx-console'
: 'nx-connect';
if ((0, nx_cloud_utils_1.isNxCloudUsed)(nxJson)) {

@@ -64,3 +67,3 @@ const token = process.env.NX_CLOUD_ACCESS_TOKEN || nxJson.nxCloudAccessToken;

}
const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)('nx-connect', token);
const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)(installationSource, token);
output_1.output.log({

@@ -78,3 +81,3 @@ title: '✔ This workspace already has Nx Cloud set up',

const token = await connectWorkspaceToCloud({
installationSource: command ?? 'nx-connect',
installationSource: command ?? installationSource,
});

@@ -81,0 +84,0 @@ const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)('nx-connect', token);

@@ -407,2 +407,6 @@ import type { ChangelogRenderOptions } from '../../release/changelog-renderer';

useInferencePlugins?: boolean;
/**
* Set this to false to disable connection to Nx Cloud
*/
neverConnectToCloud?: boolean;
}

@@ -409,0 +413,0 @@ export type PluginConfiguration = string | ExpandedPluginConfiguration;

import { Tree } from '../../../generators/tree';
import { NxJsonConfiguration } from '../../../config/nx-json';
export declare function printSuccessMessage(token: string | undefined, installationSource: string, usesGithub: boolean): Promise<string>;

@@ -10,3 +11,4 @@ export interface ConnectToNxCloudOptions {

}
export declare function connectToNxCloud(tree: Tree, schema: ConnectToNxCloudOptions): Promise<string>;
export default connectToNxCloud;
export declare function connectToNxCloud(tree: Tree, schema: ConnectToNxCloudOptions, nxJson?: NxJsonConfiguration<string[] | "*">): Promise<string>;
declare function connectToNxCloudGenerator(tree: Tree, options: ConnectToNxCloudOptions): Promise<void>;
export default connectToNxCloudGenerator;

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

const get_cloud_options_1 = require("../../utilities/get-cloud-options");
const path_1 = require("path");
function printCloudConnectionDisabledMessage() {

@@ -72,16 +73,17 @@ output_1.output.error({

}
function addNxCloudOptionsToNxJson(tree, nxJson, token) {
nxJson ??= {
extends: 'nx/presets/npm.json',
};
nxJson.nxCloudAccessToken = token;
const overrideUrl = process.env.NX_CLOUD_API || process.env.NRWL_API;
if (overrideUrl) {
nxJson.nxCloudUrl = overrideUrl;
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;
});
}
(0, nx_json_1.updateNxJson)(tree, nxJson);
}
async function connectToNxCloud(tree, schema) {
async function connectToNxCloud(tree, schema, nxJson = (0, nx_json_1.readNxJson)(tree)) {
schema.installationSource ??= 'user';
const nxJson = (0, nx_json_1.readNxJson)(tree);
if (nxJson?.neverConnectToCloud) {

@@ -96,5 +98,7 @@ printCloudConnectionDisabledMessage();

// if user is using github and is running nx-connect
if (!(usesGithub && schema.installationSource === 'nx-connect')) {
if (!(usesGithub &&
(schema.installationSource === 'nx-connect' ||
schema.installationSource === 'nx-console'))) {
responseFromCreateNxCloudWorkspace = await createNxCloudWorkspace(getRootPackageName(tree), schema.installationSource, getNxInitDate());
addNxCloudOptionsToNxJson(tree, nxJson, responseFromCreateNxCloudWorkspace?.token);
addNxCloudOptionsToNxJson(tree, responseFromCreateNxCloudWorkspace?.token, schema.directory);
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {

@@ -107,2 +111,5 @@ silent: schema.hideFormatLogs,

}
exports.default = connectToNxCloud;
async function connectToNxCloudGenerator(tree, options) {
await connectToNxCloud(tree, options);
}
exports.default = connectToNxCloudGenerator;
import { CloudTaskRunnerOptions } from '../nx-cloud-tasks-runner-shell';
export declare function getCloudOptions(): CloudTaskRunnerOptions;
export declare function getCloudOptions(directory?: string): CloudTaskRunnerOptions;
export declare function getCloudUrl(): string;
export declare function removeTrailingSlash(apiUrl: string): string;

@@ -8,4 +8,5 @@ "use strict";

const run_command_1 = require("../../tasks-runner/run-command");
function getCloudOptions() {
const nxJson = (0, nx_json_1.readNxJson)();
const workspace_root_1 = require("../../utils/workspace-root");
function getCloudOptions(directory = workspace_root_1.workspaceRoot) {
const nxJson = (0, nx_json_1.readNxJson)(directory);
// TODO: The default is not always cloud? But it's not handled at the moment

@@ -12,0 +13,0 @@ return (0, run_command_1.getRunnerOptions)('default', nxJson, {}, true);

@@ -144,5 +144,10 @@ "use strict";

const npmProjectKey = `npm:${externalPackageJson.name}@${version}`;
const matchingExternalNode = this.npmProjects[npmProjectKey];
let matchingExternalNode = this.npmProjects[npmProjectKey];
if (!matchingExternalNode) {
return null;
// check if it's a package alias, where the resolved package key is used as the version
const aliasNpmProjectKey = `npm:${packageName}@${npmProjectKey}`;
matchingExternalNode = this.npmProjects[aliasNpmProjectKey];
if (!matchingExternalNode) {
return null;
}
}

@@ -149,0 +154,0 @@ this.npmResolutionCache.set(npmImportForProject, matchingExternalNode.name);

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

for (const target of Object.keys(siblingProjectJson?.targets ?? {})) {
delete packageJson.scripts?.[target];
const { executor, command, options } = siblingProjectJson.targets[target];
if (
// will use run-commands, different target
command ||
// Either uses a different executor or runs a different script
(executor &&
(executor !== 'nx:run-script' || options?.script !== target))) {
delete packageJson.scripts?.[target];
}
}

@@ -96,0 +104,0 @@ }

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

const pluginNames = new Map();
const MAX_MESSAGE_WAIT = 1000 * 60 * 5; // 5 minutes
const PLUGIN_TIMEOUT_HINT_TEXT = 'As a last resort, you can set NX_PLUGIN_NO_TIMEOUTS=true to bypass this timeout.';
const MINUTES = 10;
const MAX_MESSAGE_WAIT = process.env.NX_PLUGIN_NO_TIMEOUTS === 'true'
? undefined
: 1000 * 60 * MINUTES; // 10 minutes
const nxPluginWorkerCache = (global['nxPluginWorkerCache'] ??= new Map());

@@ -40,7 +44,10 @@ async function loadRemoteNxPlugin(plugin, root) {

// logger.verbose(`[plugin-worker] started worker: ${worker.pid}`);
const loadTimeout = setTimeout(() => {
rej(new Error('Plugin worker timed out when loading plugin:' + plugin));
}, MAX_MESSAGE_WAIT);
const loadTimeout = MAX_MESSAGE_WAIT
? setTimeout(() => {
rej(new Error(`Loading "${plugin}" timed out after ${MINUTES} minutes. ${PLUGIN_TIMEOUT_HINT_TEXT}`));
}, MAX_MESSAGE_WAIT)
: undefined;
socket.on('data', (0, consume_messages_from_socket_1.consumeMessagesFromSocket)(createWorkerHandler(worker, pendingPromises, (val) => {
clearTimeout(loadTimeout);
if (loadTimeout)
clearTimeout(loadTimeout);
res(val);

@@ -95,2 +102,5 @@ }, rej, socket)));

});
}, {
plugin: pluginName,
operation: 'createNodes',
});

@@ -108,2 +118,5 @@ },

});
}, {
plugin: pluginName,
operation: 'createDependencies',
});

@@ -120,2 +133,5 @@ }

});
}, {
operation: 'processProjectGraph',
plugin: pluginName,
});

@@ -132,2 +148,5 @@ }

});
}, {
plugin: pluginName,
operation: 'createMetadata',
});

@@ -201,3 +220,3 @@ }

process.on('SIGTERM', exitHandler);
function registerPendingPromise(tx, pending, callback) {
function registerPendingPromise(tx, pending, callback, context) {
let resolver, rejector, timeout;

@@ -207,9 +226,12 @@ const promise = new Promise((res, rej) => {

resolver = res;
timeout = setTimeout(() => {
rej(new Error(`Plugin worker timed out when processing message ${tx}`));
}, MAX_MESSAGE_WAIT);
timeout = MAX_MESSAGE_WAIT
? setTimeout(() => {
rej(new Error(`${context.plugin} timed out after ${MINUTES} minutes during ${context.operation}. ${PLUGIN_TIMEOUT_HINT_TEXT}`));
}, MAX_MESSAGE_WAIT)
: undefined;
callback();
}).finally(() => {
pending.delete(tx);
clearTimeout(timeout);
if (timeout)
clearTimeout(timeout);
});

@@ -216,0 +238,0 @@ pending.set(tx, {

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

try {
const p = (0, child_process_1.spawn)('node', [scriptPath, `"${this.cachePath}"`], {
const p = (0, child_process_1.spawn)('node', [scriptPath, `${this.cachePath}`], {
stdio: 'ignore',

@@ -31,0 +31,0 @@ detached: true,

@@ -80,6 +80,3 @@ "use strict";

const patternResultCache = new WeakMap();
function expandWildcardTargetConfiguration(dependencyConfig, allTargetNames) {
if (!(0, globs_1.isGlobPattern)(dependencyConfig.target)) {
return [dependencyConfig];
}
function findMatchingTargets(pattern, allTargetNames) {
let cache = patternResultCache.get(allTargetNames);

@@ -90,14 +87,21 @@ if (!cache) {

}
const cachedResult = cache.get(dependencyConfig.target);
const cachedResult = cache.get(pattern);
if (cachedResult) {
return cachedResult;
}
const matcher = minimatch_1.minimatch.filter(dependencyConfig.target);
const matcher = minimatch_1.minimatch.filter(pattern);
const matchingTargets = allTargetNames.filter((t) => matcher(t));
const result = matchingTargets.map((t) => ({
...dependencyConfig,
cache.set(pattern, matchingTargets);
return matchingTargets;
}
function expandWildcardTargetConfiguration(dependencyConfig, allTargetNames) {
if (!(0, globs_1.isGlobPattern)(dependencyConfig.target)) {
return [dependencyConfig];
}
const matchingTargets = findMatchingTargets(dependencyConfig.target, allTargetNames);
return matchingTargets.map((t) => ({
target: t,
projects: dependencyConfig.projects,
dependencies: dependencyConfig.dependencies,
}));
cache.set(dependencyConfig.target, result);
return result;
}

@@ -104,0 +108,0 @@ function readProjectAndTargetFromTargetString(targetString, projects) {

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