Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pnpm/default-reporter

Package Overview
Dependencies
Maintainers
3
Versions
349
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnpm/default-reporter - npm Package Compare versions

Comparing version 7.2.5 to 7.3.0

12

CHANGELOG.md
# @pnpm/default-reporter
## 7.3.0
### Minor Changes
- eb82084e1: Color the different output prefixes differently.
- ffddf34a8: Add new reporting option: `streamLifecycleOutput`. When `true`, the output from child processes is printed immediately and is never collapsed.
### Patch Changes
- Updated dependencies [ffddf34a8]
- @pnpm/config@9.1.0
## 7.2.5

@@ -4,0 +16,0 @@

2

lib/index.d.ts

@@ -9,2 +9,3 @@ import { Config } from '@pnpm/config';

logLevel?: LogLevel;
streamLifecycleOutput?: boolean;
throttleProgress?: number;

@@ -24,2 +25,3 @@ outputMaxWidth?: number;

outputMaxWidth?: number;
streamLifecycleOutput?: boolean;
throttleProgress?: number;

@@ -26,0 +28,0 @@ };

9

lib/index.js

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

function toOutput$(opts) {
var _a, _b, _c, _d, _e, _f;
var _a, _b, _c, _d, _e, _f, _g;
opts = opts || {};

@@ -150,6 +150,7 @@ const fetchingProgressPushStream = new zen_push_1.default();

pnpmConfig: opts.context.config,
throttleProgress: (_d = opts.reportingOptions) === null || _d === void 0 ? void 0 : _d.throttleProgress,
width: (_e = opts.reportingOptions) === null || _e === void 0 ? void 0 : _e.outputMaxWidth,
streamLifecycleOutput: (_d = opts.reportingOptions) === null || _d === void 0 ? void 0 : _d.streamLifecycleOutput,
throttleProgress: (_e = opts.reportingOptions) === null || _e === void 0 ? void 0 : _e.throttleProgress,
width: (_f = opts.reportingOptions) === null || _f === void 0 ? void 0 : _f.outputMaxWidth,
});
if ((_f = opts.reportingOptions) === null || _f === void 0 ? void 0 : _f.appendOnly) {
if ((_g = opts.reportingOptions) === null || _g === void 0 ? void 0 : _g.appendOnly) {
return most.join(most.mergeArray(outputs)

@@ -156,0 +157,0 @@ .map((log) => log.map((msg) => msg.msg)));

@@ -28,2 +28,3 @@ import { Config } from '@pnpm/config';

pnpmConfig?: Config;
streamLifecycleOutput?: boolean;
throttleProgress?: number;

@@ -30,0 +31,0 @@ width?: number;

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

reportLifecycleScripts_1.default(log$, {
appendOnly: opts.appendOnly,
appendOnly: opts.appendOnly || opts.streamLifecycleOutput,
cwd,

@@ -27,0 +27,0 @@ width,

@@ -13,2 +13,7 @@ "use strict";

const NODE_MODULES = `${path.sep}node_modules${path.sep}`;
// When streaming processes are spawned, use this color for prefix
const colorWheel = ['cyan', 'magenta', 'blue', 'yellow', 'green', 'red'];
const NUM_COLORS = colorWheel.length;
// Ever-increasing index ensures colors are always sequential
let currentColor = 0;
exports.default = (log$, opts) => {

@@ -18,4 +23,7 @@ // When the reporter is not append-only, the length of output is limited

if (opts.appendOnly) {
return most.of(log$.lifecycle
.map((log) => ({ msg: formatLifecycleHideOverflowForAppendOnly(opts.cwd, log) })));
const streamLifecycleOutput = createStreamLifecycleOutput(opts.cwd);
return log$.lifecycle
.map((log) => most.of({
msg: streamLifecycleOutput(log),
}));
}

@@ -98,3 +106,3 @@ const lifecycleMessages = {};

if (log['script']) {
const prefix = formatLifecycleScriptPrefix(opts.cwd, log.wd, log.stage);
const prefix = `${formatPrefix_1.default(opts.cwd, log.wd)} ${outputConstants_1.hlValue(log.stage)}`;
const maxLineWidth = opts.maxWidth - prefix.length - 2 + ANSI_ESCAPES_LENGTH_OF_PREFIX;

@@ -124,4 +132,9 @@ messageCache.script = `${prefix}$ ${cutLine(log['script'], maxLineWidth)}`;

const ANSI_ESCAPES_LENGTH_OF_PREFIX = outputConstants_1.hlValue(' ').length - 1;
function formatLifecycleHideOverflowForAppendOnly(cwd, logObj) {
const prefix = formatLifecycleScriptPrefix(cwd, logObj.wd, logObj.stage);
function createStreamLifecycleOutput(cwd) {
currentColor = 0;
const colorByPrefix = new Map();
return streamLifecycleOutput.bind(null, colorByPrefix, cwd);
}
function streamLifecycleOutput(colorByPkg, cwd, logObj) {
const prefix = formatLifecycleScriptPrefix(colorByPkg, cwd, logObj.wd, logObj.stage);
if (typeof logObj['exitCode'] === 'number') {

@@ -144,4 +157,10 @@ if (logObj['exitCode'] === 0) {

}
function formatLifecycleScriptPrefix(cwd, wd, stage) {
return `${formatPrefix_1.default(cwd, wd)} ${outputConstants_1.hlValue(stage)}`;
function formatLifecycleScriptPrefix(colorByPkg, cwd, wd, stage) {
if (!colorByPkg.has(wd)) {
const colorName = colorWheel[currentColor % NUM_COLORS];
colorByPkg.set(wd, chalk[colorName]);
currentColor += 1;
}
const color = colorByPkg.get(wd);
return `${color(formatPrefix_1.default(cwd, wd))} ${outputConstants_1.hlValue(stage)}`;
}

@@ -148,0 +167,0 @@ function formatLine(maxWidth, logObj) {

{
"name": "@pnpm/default-reporter",
"version": "7.2.5",
"version": "7.3.0",
"description": "The default reporter of pnpm",

@@ -33,3 +33,3 @@ "main": "lib/index.js",

"dependencies": {
"@pnpm/config": "9.0.0",
"@pnpm/config": "9.1.0",
"@pnpm/core-loggers": "4.0.2",

@@ -36,0 +36,0 @@ "@pnpm/error": "1.2.0",

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