Socket
Socket
Sign inDemoInstall

nx

Package Overview
Dependencies
140
Maintainers
0
Versions
1216
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 19.4.0-canary.20240622-963f753 to 19.4.0-canary.20240626-3a2e8d4

src/daemon/message-types/task-history.d.ts

24

package.json
{
"name": "nx",
"version": "19.4.0-canary.20240622-963f753",
"version": "19.4.0-canary.20240626-3a2e8d4",
"private": false,

@@ -73,3 +73,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.4.0-canary.20240622-963f753"
"@nrwl/tao": "19.4.0-canary.20240626-3a2e8d4"
},

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

"optionalDependencies": {
"@nx/nx-darwin-x64": "19.4.0-canary.20240622-963f753",
"@nx/nx-darwin-arm64": "19.4.0-canary.20240622-963f753",
"@nx/nx-linux-x64-gnu": "19.4.0-canary.20240622-963f753",
"@nx/nx-linux-x64-musl": "19.4.0-canary.20240622-963f753",
"@nx/nx-win32-x64-msvc": "19.4.0-canary.20240622-963f753",
"@nx/nx-linux-arm64-gnu": "19.4.0-canary.20240622-963f753",
"@nx/nx-linux-arm64-musl": "19.4.0-canary.20240622-963f753",
"@nx/nx-linux-arm-gnueabihf": "19.4.0-canary.20240622-963f753",
"@nx/nx-win32-arm64-msvc": "19.4.0-canary.20240622-963f753",
"@nx/nx-freebsd-x64": "19.4.0-canary.20240622-963f753"
"@nx/nx-darwin-x64": "19.4.0-canary.20240626-3a2e8d4",
"@nx/nx-darwin-arm64": "19.4.0-canary.20240626-3a2e8d4",
"@nx/nx-linux-x64-gnu": "19.4.0-canary.20240626-3a2e8d4",
"@nx/nx-linux-x64-musl": "19.4.0-canary.20240626-3a2e8d4",
"@nx/nx-win32-x64-msvc": "19.4.0-canary.20240626-3a2e8d4",
"@nx/nx-linux-arm64-gnu": "19.4.0-canary.20240626-3a2e8d4",
"@nx/nx-linux-arm64-musl": "19.4.0-canary.20240626-3a2e8d4",
"@nx/nx-linux-arm-gnueabihf": "19.4.0-canary.20240626-3a2e8d4",
"@nx/nx-win32-arm64-msvc": "19.4.0-canary.20240626-3a2e8d4",
"@nx/nx-freebsd-x64": "19.4.0-canary.20240626-3a2e8d4"
},

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

@@ -57,2 +57,8 @@ import { ChangelogChange } from '../../src/command-line/release/changelog';

/**
* If authors is enabled, controls whether or not to try to map the authors to their GitHub usernames
* using https://ungh.cc (from https://github.com/unjs/ungh) and the email addresses found in the commits.
* Defaults to true.
*/
mapAuthorsToGitHubUsernames?: boolean;
/**
* Whether or not the commit references (such as commit and/or PR links) should be included in the changelog.

@@ -59,0 +65,0 @@ * Defaults to true.

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

// Try to map authors to github usernames
if (repoSlug) {
if (repoSlug && changelogRenderOptions.mapAuthorsToGitHubUsernames) {
await Promise.all([..._authors.keys()].map(async (authorName) => {

@@ -151,0 +151,0 @@ const meta = _authors.get(authorName);

@@ -77,8 +77,7 @@ "use strict";

let contents = host.read('.gitignore', 'utf-8') ?? '';
if (!contents.includes('.nx/installation')) {
contents = [contents, '.nx/installation'].join('\n');
}
if (!contents.includes('.nx/cache')) {
contents = [contents, '.nx/cache'].join('\n');
}
['.nx/installation', '.nx/cache', '.nx/workspace-data'].forEach((file) => {
if (!contents.includes(file)) {
contents = [contents, file].join('\n');
}
});
host.write('.gitignore', contents);

@@ -85,0 +84,0 @@ }

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

for (const project of releaseGroup.projects) {
const dependentProjects = (projectsVersionData[project]?.dependentProjects || [])
// If the project does not have any changes, do not process its dependents
if (!projectsVersionData[project] ||
projectsVersionData[project].newVersion === null) {
continue;
}
const dependentProjects = (projectsVersionData[project].dependentProjects || [])
.map((dep) => {

@@ -228,0 +233,0 @@ return {

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

authors: true,
mapAuthorsToGitHubUsernames: true,
commitReferences: true,

@@ -127,2 +128,3 @@ versionTitleDate: true,

authors: true,
mapAuthorsToGitHubUsernames: true,
commitReferences: true,

@@ -158,2 +160,3 @@ versionTitleDate: true,

authors: true,
mapAuthorsToGitHubUsernames: true,
commitReferences: true,

@@ -160,0 +163,0 @@ versionTitleDate: true,

@@ -9,2 +9,3 @@ /// <reference types="node" />

import { NxWorkspaceFiles } from '../../native';
import { TaskRun } from '../../utils/task-history';
export type UnregisterCallback = () => void;

@@ -55,2 +56,6 @@ export type ChangedFile = {

hashGlob(globs: string[], exclude?: string[]): Promise<string>;
getTaskHistoryForHashes(hashes: string[]): Promise<{
[hash: string]: TaskRun[];
}>;
writeTaskRunsToHistory(taskRuns: TaskRun[]): Promise<void>;
isServerAvailable(): Promise<boolean>;

@@ -57,0 +62,0 @@ private sendToDaemonViaQueue;

@@ -224,2 +224,16 @@ "use strict";

}
getTaskHistoryForHashes(hashes) {
const message = {
type: 'GET_TASK_HISTORY_FOR_HASHES',
hashes,
};
return this.sendToDaemonViaQueue(message);
}
writeTaskRunsToHistory(taskRuns) {
const message = {
type: 'WRITE_TASK_RUNS_TO_HISTORY',
taskRuns,
};
return this.sendMessageToDaemon(message);
}
async isServerAvailable() {

@@ -226,0 +240,0 @@ return new Promise((resolve) => {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cleanupPlugins = exports.getPlugins = void 0;
const file_hasher_1 = require("../../hasher/file-hasher");
const nx_json_1 = require("../../config/nx-json");
const internal_api_1 = require("../../project-graph/plugins/internal-api");
const workspace_root_1 = require("../../utils/workspace-root");
let currentPluginsConfigurationHash;
let loadedPlugins;
let cleanup;
async function getPlugins() {
if (loadedPlugins) {
const pluginsConfiguration = (0, nx_json_1.readNxJson)().plugins ?? [];
const pluginsConfigurationHash = (0, file_hasher_1.hashObject)(pluginsConfiguration);
// If the plugins configuration has not changed, reuse the current plugins
if (loadedPlugins &&
pluginsConfigurationHash === currentPluginsConfigurationHash) {
return loadedPlugins;
}
const pluginsConfiguration = (0, nx_json_1.readNxJson)().plugins ?? [];
// Cleanup current plugins before loading new ones
if (cleanup) {
cleanup();
}
currentPluginsConfigurationHash = pluginsConfigurationHash;
const [result, cleanupFn] = await (0, internal_api_1.loadNxPlugins)(pluginsConfiguration, workspace_root_1.workspaceRoot);

@@ -15,0 +25,0 @@ cleanup = cleanupFn;

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

const handle_hash_glob_1 = require("./handle-hash-glob");
const task_history_1 = require("../message-types/task-history");
const handle_get_task_history_1 = require("./handle-get-task-history");
const handle_write_task_runs_to_history_1 = require("./handle-write-task-runs-to-history");
let performanceObserver;

@@ -125,2 +128,8 @@ let workspaceWatcherError;

}
else if ((0, task_history_1.isHandleGetTaskHistoryForHashesMessage)(payload)) {
await handleResult(socket, 'GET_TASK_HISTORY_FOR_HASHES', () => (0, handle_get_task_history_1.handleGetTaskHistoryForHashes)(payload.hashes));
}
else if ((0, task_history_1.isHandleWriteTaskRunsToHistoryMessage)(payload)) {
await handleResult(socket, 'WRITE_TASK_RUNS_TO_HISTORY', () => (0, handle_write_task_runs_to_history_1.handleWriteTaskRunsToHistory)(payload.taskRuns));
}
else {

@@ -127,0 +136,0 @@ await (0, shutdown_utils_1.respondWithErrorAndExit)(socket, `Invalid payload from the client`, new Error(`Unsupported payload sent to daemon server: ${unparsedPayload}`));

import { PluginConfiguration } from '../../../config/nx-json';
import { LoadedNxPlugin } from '../internal-api';
export declare function loadNxPluginInIsolation(plugin: PluginConfiguration, root?: string): [Promise<LoadedNxPlugin>, () => void];
export declare function loadNxPluginInIsolation(plugin: PluginConfiguration, root?: string): readonly [Promise<LoadedNxPlugin>, () => void];

@@ -13,9 +13,16 @@ "use strict";

if (remotePluginCache.has(cacheKey)) {
return [remotePluginCache.get(cacheKey), () => { }];
return remotePluginCache.get(cacheKey);
}
const loadingPlugin = (0, plugin_pool_1.loadRemoteNxPlugin)(plugin, root);
remotePluginCache.set(cacheKey, loadingPlugin);
const [loadingPlugin, cleanup] = (0, plugin_pool_1.loadRemoteNxPlugin)(plugin, root);
// We clean up plugin workers when Nx process completes.
return [loadingPlugin, () => { }];
const val = [
loadingPlugin,
() => {
cleanup();
remotePluginCache.delete(cacheKey);
},
];
remotePluginCache.set(cacheKey, val);
return val;
}
exports.loadNxPluginInIsolation = loadNxPluginInIsolation;
import { PluginConfiguration } from '../../../config/nx-json';
import { LoadedNxPlugin } from '../internal-api';
export declare function loadRemoteNxPlugin(plugin: PluginConfiguration, root: string): Promise<LoadedNxPlugin>;
export declare function loadRemoteNxPlugin(plugin: PluginConfiguration, root: string): [Promise<LoadedNxPlugin>, () => void];

@@ -45,6 +45,12 @@ "use strict";

cleanupFunctions.add(cleanupFunction);
return new Promise((res, rej) => {
worker.on('message', createWorkerHandler(worker, pendingPromises, res, rej));
worker.on('exit', exitHandler);
});
return [
new Promise((res, rej) => {
worker.on('message', createWorkerHandler(worker, pendingPromises, res, rej));
worker.on('exit', exitHandler);
}),
() => {
cleanupFunction();
cleanupFunctions.delete(cleanupFunction);
},
];
}

@@ -51,0 +57,0 @@ exports.loadRemoteNxPlugin = loadRemoteNxPlugin;

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

finally {
cleanup();
// When plugins are isolated we don't clean them up during
// a single run of the CLI. They are cleaned up when the CLI
// process exits. Cleaning them here could cause issues if pending
// promises are not resolved.
if (process.env.NX_ISOLATE_PLUGINS !== 'true') {
cleanup();
}
}

@@ -116,0 +122,0 @@ const { projectGraph, projectFileMapCache } = projectGraphResult;

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

for (const result of results.flat()) {
const [file, pluginName, nodes] = result;
const [pluginName, file, nodes] = result;
const { projects: projectNodes, externalNodes: pluginExternalNodes } = nodes;

@@ -299,0 +299,0 @@ const sourceInfo = [file, pluginName];

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

}
options.lifeCycle.startCommand();
await options.lifeCycle.startCommand();
try {

@@ -22,3 +22,3 @@ return await runAllTasks(tasks, options, context);

finally {
options.lifeCycle.endCommand();
await options.lifeCycle.endCommand();
}

@@ -25,0 +25,0 @@ };

@@ -13,5 +13,5 @@ import { TaskStatus } from './tasks-runner';

export interface LifeCycle {
startCommand?(): void;
endCommand?(): void;
scheduleTask?(task: Task): void;
startCommand?(): void | Promise<void>;
endCommand?(): void | Promise<void>;
scheduleTask?(task: Task): void | Promise<void>;
/**

@@ -29,4 +29,4 @@ * @deprecated use startTasks

endTask?(task: Task, code: number): void;
startTasks?(task: Task[], metadata: TaskMetadata): void;
endTasks?(taskResults: TaskResult[], metadata: TaskMetadata): void;
startTasks?(task: Task[], metadata: TaskMetadata): void | Promise<void>;
endTasks?(taskResults: TaskResult[], metadata: TaskMetadata): void | Promise<void>;
printTaskTerminalOutput?(task: Task, status: TaskStatus, output: string): void;

@@ -37,10 +37,10 @@ }

constructor(lifeCycles: LifeCycle[]);
startCommand(): void;
endCommand(): void;
scheduleTask(task: Task): void;
startCommand(): Promise<void>;
endCommand(): Promise<void>;
scheduleTask(task: Task): Promise<void>;
startTask(task: Task): void;
endTask(task: Task, code: number): void;
startTasks(tasks: Task[], metadata: TaskMetadata): void;
endTasks(taskResults: TaskResult[], metadata: TaskMetadata): void;
startTasks(tasks: Task[], metadata: TaskMetadata): Promise<void>;
endTasks(taskResults: TaskResult[], metadata: TaskMetadata): Promise<void>;
printTaskTerminalOutput(task: Task, status: TaskStatus, output: string): void;
}

@@ -8,20 +8,20 @@ "use strict";

}
startCommand() {
async startCommand() {
for (let l of this.lifeCycles) {
if (l.startCommand) {
l.startCommand();
await l.startCommand();
}
}
}
endCommand() {
async endCommand() {
for (let l of this.lifeCycles) {
if (l.endCommand) {
l.endCommand();
await l.endCommand();
}
}
}
scheduleTask(task) {
async scheduleTask(task) {
for (let l of this.lifeCycles) {
if (l.scheduleTask) {
l.scheduleTask(task);
await l.scheduleTask(task);
}

@@ -44,6 +44,6 @@ }

}
startTasks(tasks, metadata) {
async startTasks(tasks, metadata) {
for (let l of this.lifeCycles) {
if (l.startTasks) {
l.startTasks(tasks, metadata);
await l.startTasks(tasks, metadata);
}

@@ -55,6 +55,6 @@ else if (l.startTask) {

}
endTasks(taskResults, metadata) {
async endTasks(taskResults, metadata) {
for (let l of this.lifeCycles) {
if (l.endTasks) {
l.endTasks(taskResults, metadata);
await l.endTasks(taskResults, metadata);
}

@@ -61,0 +61,0 @@ else if (l.endTask) {

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

const dynamic_run_one_terminal_output_life_cycle_1 = require("./life-cycles/dynamic-run-one-terminal-output-life-cycle");
const nx_json_1 = require("../config/nx-json");
const create_task_graph_1 = require("./create-task-graph");

@@ -25,2 +26,4 @@ const task_graph_utils_1 = require("./task-graph-utils");

const create_task_hasher_1 = require("../hasher/create-task-hasher");
const task_history_life_cycle_1 = require("./life-cycles/task-history-life-cycle");
const nx_cloud_utils_1 = require("../utils/nx-cloud-utils");
async function getTerminalOutputLifeCycle(initiatingProject, projectNames, tasks, nxArgs, nxJson, overrides) {

@@ -208,2 +211,5 @@ const { runnerOptions } = getRunner(nxArgs, nxJson);

}
if (!(0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)())) {
lifeCycles.push(new task_history_life_cycle_1.TaskHistoryLifeCycle());
}
return lifeCycles;

@@ -210,0 +216,0 @@ }

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

}
this.options.lifeCycle.scheduleTask(task);
await this.options.lifeCycle.scheduleTask(task);
return taskSpecificEnv;

@@ -100,3 +100,3 @@ }

}
this.options.lifeCycle.scheduleTask(task);
await this.options.lifeCycle.scheduleTask(task);
}));

@@ -317,3 +317,3 @@ }

async preRunSteps(tasks, metadata) {
this.options.lifeCycle.startTasks(tasks, metadata);
await this.options.lifeCycle.startTasks(tasks, metadata);
}

@@ -348,3 +348,3 @@ async postRunSteps(tasks, results, doNotSkipCache, { groupId }) {

}
this.options.lifeCycle.endTasks(results.map((result) => {
await this.options.lifeCycle.endTasks(results.map((result) => {
const code = result.status === 'success' ||

@@ -351,0 +351,0 @@ result.status === 'local-cache' ||

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

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc