{"ecosystem":"npm","package":"wrap-ansi","version":null,"bugs":[{"id":206,"ecosystem":"npm","package_name":"wrap-ansi","affected_version":null,"fixed_version":null,"bug_id":"github:18","title":"Setting wordWrap to false does not always result in correct wrapping","description":"With the following piece of text as input\r\n\r\n> 12345678\\n901234567890 12345\r\n\r\nAnd, setting `wordWrap` to false with a character count of `5` currently results in the following output\r\n\r\n> 12345678\r\n> 901234567890\r\n> 12345\r\n\r\nThe reason for this is that [this line](https://github.com/chalk/wrap-ansi/blob/master/index.js#L134)  does not take the `wordWrap` setting into account.\r\n\r\nFix is coming up!","severity":"medium","status":"fixed","source":"github_issues","source_url":"https://github.com/chalk/wrap-ansi/issues/18","labels":["bug"],"created_at":"2026-04-19T04:30:37.093718+00:00","updated_at":"2026-04-19T04:30:37.093718+00:00"},{"id":205,"ecosystem":"npm","package_name":"wrap-ansi","affected_version":null,"fixed_version":null,"bug_id":"github:23","title":"Does not wrap a series of whitespace","description":"<!-- Issuehunt Badges -->\n\n[<img alt=\"Issuehunt badges\" src=\"https://issuehunt.io/r/chalk/wrap-ansi/issues/23/badge.svg\" />](https://issuehunt.io/r/chalk/wrap-ansi/issues/23)\n\n<!-- /Issuehunt Badges -->\n\n```js\r\nwrap('   ', 2, { trim: false })\r\n'   '   // actual\r\n'  \\n ' // expected\r\n```\r\n\r\nAdding `hard` does not change the behaviour.\n<!-- Issuehunt content -->\n\n\n\n> [stroncium](https://issuehunt.io/u/stroncium) earned $40.00 by resolving this issue!\n> - Checkout the [Issuehunt explorer](https://issuehunt.io/r/chalk/wrap-ansi/) to discover more funded issues.\n> - Need some help from other developers? [Add your repositories](https://issuehunt.io/r/new) on Issuehunt to raise funds.\n\n\n<!-- /Issuehunt content-->","severity":"medium","status":"fixed","source":"github_issues","source_url":"https://github.com/chalk/wrap-ansi/issues/23","labels":["bug","help wanted",":gift: Rewarded on Issuehunt"],"created_at":"2026-04-19T04:30:37.093277+00:00","updated_at":"2026-04-19T04:30:37.093277+00:00"},{"id":204,"ecosystem":"npm","package_name":"wrap-ansi","affected_version":"2.1.0","fixed_version":null,"bug_id":"github:24","title":"Difference in output between 2.1.0 and 3.0.1","description":"<!-- Issuehunt Badges -->\n\n[<img alt=\"Issuehunt badges\" src=\"https://issuehunt.io/r/chalk/wrap-ansi/issues/24/badge.svg\" />](https://issuehunt.io/r/chalk/wrap-ansi/issues/24)\n\n<!-- /Issuehunt Badges -->\n\nI have the following minimal test case:\r\n```js\r\n'use strict'\r\n\r\nconst wrap = require('wrap-ansi');\r\nconst chalk = require('chalk');\r\nconst srcString = chalk.blue('  1  2  ');\r\n\r\nconsole.log('\"' + wrap(srcString, 20, {hard: true}) + '\"');\r\nconsole.log('\"' + wrap(srcString, 20, {hard: true, trim: false}) + '\"');\r\n```\r\n\r\nNote that srcString has 2 spaces before, between and after the numbers.\r\n\r\nAgainst v2.1.0:\r\nThe test prints the same output twice (`trim: false` is ignored).  The output is `\"1  2  \"` - both spaces before the '1' were removed.  If color terminal is disabled the spaces after the '2' are also removed.\r\n\r\nAgainst v3.0.1:\r\nThe first line prints with a single space between the numbers, and if color is enabled a single space after the numbers.\r\nThe second line prints the original string if color is enabled, if color is disabled it prints an extra space before the string (3 spaces total before the '1').\r\n\r\nThis was found when trying to update cliui to use v3.0.1.  I don't know what the correct behavior should be.\n<!-- Issuehunt content -->\n\n\n\n> [stroncium](https://issuehunt.io/u/stroncium) earned $40.00 by resolving this issue!\n> - Checkout the [Issuehunt explorer](https://issuehunt.io/r/chalk/wrap-ansi/) to discover more funded issues.\n> - Need some help from other developers? [Add your repositories](https://issuehunt.io/r/new) on Issuehunt to raise funds.\n\n\n<!-- /Issuehunt content-->","severity":"medium","status":"fixed","source":"github_issues","source_url":"https://github.com/chalk/wrap-ansi/issues/24","labels":["bug","help wanted",":gift: Rewarded on Issuehunt"],"created_at":"2026-04-19T04:30:37.092798+00:00","updated_at":"2026-04-19T04:30:37.092798+00:00"},{"id":203,"ecosystem":"npm","package_name":"wrap-ansi","affected_version":null,"fixed_version":null,"bug_id":"github:25","title":"Off by one if trimming is disabled","description":"<!-- Issuehunt Badges -->\n\n[<img alt=\"Issuehunt badges\" src=\"https://issuehunt.io/r/chalk/wrap-ansi/issues/25/badge.svg\" />](https://issuehunt.io/r/chalk/wrap-ansi/issues/25)\n\n<!-- /Issuehunt Badges -->\n\nIf trimming is disabled, and you're wrapping a text a say length 3, and there's a whitespace right where the wrap should occur, the whitespace remains and the line break is appended to it. This results in the line being one char too long:\r\n\r\n```js\r\nconsole.log(JSON.stringify(trim('foo bar', 3)))                // => \"foo\\nbar\"\r\nconsole.log(JSON.stringify(trim('foo bar', 3, {trim: false}))) // => \"foo \\nbar\"\r\n```\n<!-- Issuehunt content -->\n\n\n\n> [stroncium](https://issuehunt.io/u/stroncium) earned $40.00 by resolving this issue!\n> - Checkout the [Issuehunt explorer](https://issuehunt.io/r/chalk/wrap-ansi/) to discover more funded issues.\n> - Need some help from other developers? [Add your repositories](https://issuehunt.io/r/new) on Issuehunt to raise funds.\n\n\n<!-- /Issuehunt content-->","severity":"medium","status":"fixed","source":"github_issues","source_url":"https://github.com/chalk/wrap-ansi/issues/25","labels":["bug","help wanted",":gift: Rewarded on Issuehunt"],"created_at":"2026-04-19T04:30:37.092344+00:00","updated_at":"2026-04-19T04:30:37.092344+00:00"},{"id":202,"ecosystem":"npm","package_name":"wrap-ansi","affected_version":"2.3.0","fixed_version":null,"bug_id":"github:26","title":"Incorrect leading spaces","description":"<!-- Issuehunt Badges -->\n\n[<img alt=\"Issuehunt badges\" src=\"https://issuehunt.io/r/chalk/wrap-ansi/issues/26/badge.svg\" />](https://issuehunt.io/r/chalk/wrap-ansi/issues/26)\n\n<!-- /Issuehunt Badges -->\n\nwith version 2.3.0:\r\n\r\n```js\r\n// 1 leading space\r\nrequire('wrap-ansi')(' a ', process.stdout.columns, {trim: false})\r\n```\r\n\r\nOut:\r\n\r\n```js\r\n// 2 leading spaces\r\n'  a '\r\n```\n<!-- Issuehunt content -->\n\n\n\n> [stroncium](https://issuehunt.io/u/stroncium) earned $80.00 by resolving this issue!\n> - Checkout the [Issuehunt explorer](https://issuehunt.io/r/chalk/wrap-ansi/) to discover more funded issues.\n> - Need some help from other developers? [Add your repositories](https://issuehunt.io/r/new) on Issuehunt to raise funds.\n\n\n<!-- /Issuehunt content-->","severity":"medium","status":"fixed","source":"github_issues","source_url":"https://github.com/chalk/wrap-ansi/issues/26","labels":["bug","help wanted",":gift: Rewarded on Issuehunt"],"created_at":"2026-04-19T04:30:37.091862+00:00","updated_at":"2026-04-19T04:30:37.091862+00:00"},{"id":201,"ecosystem":"npm","package_name":"wrap-ansi","affected_version":null,"fixed_version":null,"bug_id":"github:27","title":"leading space removed when line starts with ansi escape","description":"<!-- Issuehunt Badges -->\n\n[<img alt=\"Issuehunt badges\" src=\"https://issuehunt.io/r/chalk/wrap-ansi/issues/27/badge.svg\" />](https://issuehunt.io/r/chalk/wrap-ansi/issues/27)\n\n<!-- /Issuehunt Badges -->\n\n```js\r\nconst chalk = require('chalk');\r\nconst wrapAnsi = require('wrap-ansi');\r\n\r\nconst s = chalk.bgGreen(` ${chalk.black('OK')} `);\r\nconsole.log(s);\r\nconsole.log(wrapAnsi(s, 100, { trim: false }));\r\n```\r\n\r\n![screen shot 2018-03-27 at 1 34 18 pm](https://user-images.githubusercontent.com/15624/37984190-9b3659be-31c3-11e8-891a-667c5c2a8edf.png)\n<!-- Issuehunt content -->\n\n\n\n> [stroncium](https://issuehunt.io/u/stroncium) earned $60.00 by resolving this issue!\n> - Checkout the [Issuehunt explorer](https://issuehunt.io/r/chalk/wrap-ansi/) to discover more funded issues.\n> - Need some help from other developers? [Add your repositories](https://issuehunt.io/r/new) on Issuehunt to raise funds.\n\n\n<!-- /Issuehunt content-->","severity":"medium","status":"fixed","source":"github_issues","source_url":"https://github.com/chalk/wrap-ansi/issues/27","labels":["bug","help wanted",":gift: Rewarded on Issuehunt"],"created_at":"2026-04-19T04:30:37.091300+00:00","updated_at":"2026-04-19T04:30:37.091300+00:00"},{"id":200,"ecosystem":"npm","package_name":"wrap-ansi","affected_version":null,"fixed_version":null,"bug_id":"github:38","title":"URLs larger than column always begin on new line","description":"I've only noticed this happen with URLs and only with `hard: true`. Even with `wordWrap: false` it still happens as long as `hard: true` is passed.\r\n\r\n---\r\n\r\nNormal 'word':\r\n```javascript\r\n> const wrapAnsi = require('wrap-ansi');\r\n> console.log(wrapAnsi('hi, this IsAReallyLongWordButIDoNotKnowHowItShouldBehave', 32, {hard: true}));\r\n```\r\n```\r\nhi, this IsAReallyLongWordButIDo\r\nNotKnowHowItShouldBehave\r\n```\r\n✅ \r\n\r\n---\r\n\r\nHyperlink:\r\n```javascript\r\n> const wrapAnsi = require('wrap-ansi');\r\n> console.log(wrapAnsi('hi, this https://IsAReallyLongWordButIDoNotKnowHowItShouldBehave.com', 32, {hard: true}));\r\n```\r\n```\r\nhi, this\r\nhttps://IsAReallyLongWordButIDoN\r\notKnowHowItShouldBehave.com\r\n```\r\n❌ ","severity":"medium","status":"fixed","source":"github_issues","source_url":"https://github.com/chalk/wrap-ansi/issues/38","labels":["bug","help wanted"],"created_at":"2026-04-19T04:30:37.090740+00:00","updated_at":"2026-04-19T04:30:37.090740+00:00"},{"id":199,"ecosystem":"npm","package_name":"wrap-ansi","affected_version":null,"fixed_version":null,"bug_id":"github:43","title":"Inconsistant styling for strings with background and foreground.","description":"Something similar to slice-ansi: https://github.com/chalk/slice-ansi/issues/22\r\n\r\nMy use case is wrapping strings to terminal width, and only showing some lines. The following example works as expected:\r\n\r\n```node\r\nvar string = chalk.bgGreen(\"test\");\r\nvar wrapped = wrapAnsi(string, 2, {hard: true, trim: false, wordWrap: false});\r\nvar lines = wrapped.split(\"\\n\");\r\nconsole.log(lines[0])\r\nconsole.log(lines)\r\n```\r\n\r\nYou can see that the background is properly ended for each line, this is the behavior I expect when I try background and foreground:\r\n\r\n```node\r\n[ '\\u001b[42mte\\u001b[49m', '\\u001b[42mst\\u001b[49m' ]\r\n```\r\n\r\nWhen you add a foreground however, the background never stops.\r\n\r\n```node\r\nvar string = chalk.bgGreen.black('test');\r\nvar wrapped = wrapAnsi(string, 2, {hard: true, trim: false, wordWrap: false});\r\nvar lines = wrapped.split(\"\\n\");\r\nconsole.log(lines[0])\r\nconsole.log(lines)\r\n```\r\n\r\nResult:\r\n\r\n![image](https://user-images.githubusercontent.com/39616756/89413463-05142b80-d768-11ea-9f71-d3f9a2faab59.png)\r\n\r\n```node\r\n[\r\n  '\\u001b[42m\\u001b[30mte\\u001b[39m',\r\n  '\\u001b[30mst\\u001b[39m\\u001b[49m'\r\n]\r\n```\r\n\r\nYou can see that the inner ansi style is applied and ended per line, but that the outer style is applied only once. I would expect the behavior to be consistent with the previous example.\r\n\r\nThanks!","severity":"medium","status":"fixed","source":"github_issues","source_url":"https://github.com/chalk/wrap-ansi/issues/43","labels":["bug","help wanted"],"created_at":"2026-04-19T04:30:37.089644+00:00","updated_at":"2026-04-19T04:30:37.089644+00:00"},{"id":198,"ecosystem":"npm","package_name":"wrap-ansi","affected_version":null,"fixed_version":null,"bug_id":"osv:MAL-2025-46983","title":"Malicious code in wrap-ansi (npm)","description":"The package was compromised and malicious code added.\n\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: ghsa-malware (9e58bb76dd73218635e5f6badd1c9693b827a8eb1be48d0bac75d6f8f85d4b53)\nAny computer that has this package installed or running should be considered fully compromised. All secrets and keys stored on that computer should be rotated immediately from a different computer. The package should be removed, but as full control of the computer may have been given to an outside entity, there is no guarantee that removing the package will remove all malicious software resulting from installing it.\n","severity":"medium","status":"open","source":"osv","source_url":"https://www.aikido.dev/blog/npm-debug-and-chalk-packages-compromised","labels":["GHSA-2rv4-jp6r-xgq7"],"created_at":"2026-04-19T04:30:36.496287+00:00","updated_at":"2026-04-19T04:30:36.496287+00:00"}],"total":9,"_cache":"miss"}