Socket
Socket
Sign inDemoInstall

boxen

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

boxen - npm Package Compare versions

Comparing version 7.1.1 to 8.0.0

50

index.js

@@ -184,22 +184,6 @@ import process from 'node:process';

lines = lines.map(line => paddingLeft + line + paddingRight);
lines = lines.map(line => {
if (width - stringWidth(line) > 0) {
switch (textAlignment) {
case 'center': {
return line + PAD.repeat(width - stringWidth(line));
}
const newLine = paddingLeft + line + paddingRight;
case 'right': {
return line + PAD.repeat(width - stringWidth(line));
}
default: {
return line + PAD.repeat(width - stringWidth(line));
}
}
}
return line;
return newLine + PAD.repeat(width - stringWidth(newLine));
});

@@ -226,7 +210,7 @@

const colorizeBorder = border => {
const newBorder = options.borderColor ? getColorFn(options.borderColor)(border) : border;
const newBorder = options.borderColor ? getColorFunction(options.borderColor)(border) : border;
return options.dimBorder ? chalk.dim(newBorder) : newBorder;
};
const colorizeContent = content => options.backgroundColor ? getBGColorFn(options.backgroundColor)(content) : content;
const colorizeContent = content => options.backgroundColor ? getBGColorFunction(options.backgroundColor)(content) : content;

@@ -279,20 +263,12 @@ const chars = getBorderChars(options.borderStyle);

if (!options.width) {
options.width = newDimensions[0];
}
options.width ||= newDimensions[0];
if (!options.height) {
options.height = newDimensions[1];
}
options.height ||= newDimensions[1];
}
// If width is provided, make sure it's not below 1
if (options.width) {
options.width = Math.max(1, options.width - getBorderWidth(options.borderStyle));
}
options.width &&= Math.max(1, options.width - getBorderWidth(options.borderStyle));
// If height is provided, make sure it's not below 1
if (options.height) {
options.height = Math.max(1, options.height - getBorderWidth(options.borderStyle));
}
options.height &&= Math.max(1, options.height - getBorderWidth(options.borderStyle));

@@ -316,5 +292,3 @@ return options;

options.title = options.title.slice(0, Math.max(0, options.width - 2));
if (options.title) {
options.title = formatTitle(options.title, options.borderStyle);
}
options.title &&= formatTitle(options.title, options.borderStyle);
} else if (options.title) {

@@ -334,3 +308,3 @@ options.title = options.title.slice(0, Math.max(0, maxWidth - 2));

// If fixed width is provided, use it or content width as reference
options.width = options.width ? options.width : widest;
options.width ||= widest;

@@ -370,4 +344,4 @@ if (!widthOverride) {

const isColorValid = color => typeof color === 'string' && (chalk[color] ?? isHex(color));
const getColorFn = color => isHex(color) ? chalk.hex(color) : chalk[color];
const getBGColorFn = color => isHex(color) ? chalk.bgHex(color) : chalk[camelCase(['bg', color])];
const getColorFunction = color => isHex(color) ? chalk.hex(color) : chalk[color];
const getBGColorFunction = color => isHex(color) ? chalk.bgHex(color) : chalk[camelCase(['bg', color])];

@@ -374,0 +348,0 @@ export default function boxen(text, options) {

{
"name": "boxen",
"version": "7.1.1",
"version": "8.0.0",
"description": "Create boxes in the terminal",

@@ -14,5 +14,9 @@ "license": "MIT",

"type": "module",
"exports": "./index.js",
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
},
"sideEffects": false,
"engines": {
"node": ">=14.16"
"node": ">=18"
},

@@ -40,15 +44,15 @@ "scripts": {

"ansi-align": "^3.0.1",
"camelcase": "^7.0.1",
"chalk": "^5.2.0",
"cli-boxes": "^3.0.0",
"string-width": "^5.1.2",
"type-fest": "^2.13.0",
"widest-line": "^4.0.1",
"wrap-ansi": "^8.1.0"
"camelcase": "^8.0.0",
"chalk": "^5.3.0",
"cli-boxes": "^4.0.0",
"string-width": "^7.2.0",
"type-fest": "^4.21.0",
"widest-line": "^5.0.0",
"wrap-ansi": "^9.0.0"
},
"devDependencies": {
"ava": "^5.2.0",
"nyc": "^15.1.0",
"tsd": "^0.28.1",
"xo": "^0.54.2"
"ava": "^6.1.3",
"nyc": "^17.0.0",
"tsd": "^0.31.1",
"xo": "^0.58.0"
},

@@ -64,4 +68,2 @@ "ava": {

"rules": {
"@typescript-eslint/no-redundant-type-constituents": "off",
"unicorn/prefer-logical-operator-over-ternary": "off",
"@typescript-eslint/no-unsafe-assignment": "off"

@@ -68,0 +70,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