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

ansi-to-react

Package Overview
Dependencies
Maintainers
18
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansi-to-react - npm Package Compare versions

Comparing version 6.0.8 to 6.0.10

.github/workflows/npm-release.yml

27

lib/index.js

@@ -38,7 +38,7 @@ "use strict";

function ansiToJSON(input, use_classes = false) {
input = escape_carriage_1.escapeCarriageReturn(input);
input = escape_carriage_1.escapeCarriageReturn(fixBackspace(input));
return anser_1.default.ansiToJson(input, {
json: true,
remove_empty: true,
use_classes
use_classes,
});

@@ -101,7 +101,7 @@ }

const content = [];
const linkRegex = /(\s+|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})(\s+|$)/g;
const linkRegex = /(\s+|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g;
let index = 0;
let match;
while ((match = linkRegex.exec(bundle.content)) !== null) {
const [, pre, url, post] = match;
const [, pre, url] = match;
const startIndex = match.index + pre.length;

@@ -117,6 +117,5 @@ if (startIndex > index) {

href,
target: "_blank"
target: "_blank",
}, `${url}`));
const endIndex = linkRegex.lastIndex - post.length;
index = endIndex;
index = linkRegex.lastIndex;
}

@@ -133,1 +132,15 @@ if (index < bundle.content.length) {

exports.default = Ansi;
// This is copied from the Jupyter Classic source code
// notebook/static/base/js/utils.js to handle \b in a way
// that is **compatible with Jupyter classic**. One can
// argue that this behavior is questionable:
// https://stackoverflow.com/questions/55440152/multiple-b-doesnt-work-as-expected-in-jupyter#
function fixBackspace(txt) {
let tmp = txt;
do {
txt = tmp;
// Cancel out anything-but-newline followed by backspace
tmp = txt.replace(/[^\n]\x08/gm, "");
} while (tmp.length < txt.length);
return txt;
}
{
"name": "ansi-to-react",
"version": "6.0.8",
"version": "6.0.10",
"description": "ANSI to React Elements",

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

"build": "tsc -b",
"test": "jest"
"test": "jest",
"semantic-release": "semantic-release"
},

@@ -32,5 +33,7 @@ "repository": "https://github.com/nteract/ansi-to-react",

"devDependencies": {
"@semantic-release/npm": "^7.0.8",
"@types/enzyme": "^3.10.5",
"@types/jest": "^25.1.4",
"@types/react": "^16.9.23",
"conventional-changelog-conventionalcommits": "^4.5.0",
"enzyme": "^3.11.0",

@@ -41,5 +44,17 @@ "enzyme-adapter-react-16": "^1.15.2",

"react-dom": "^16.13.0",
"semantic-release": "^17.2.1",
"ts-jest": "^25.2.1",
"typescript": "^3.8.3"
},
"release": {
"plugins": [
"@semantic-release/npm",
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits"
}
]
]
}
}

@@ -31,3 +31,3 @@ # ansi-to-react

Will render
Will render:

@@ -34,0 +34,0 @@ ```javascript

@@ -18,7 +18,7 @@ import Anser, { AnserJsonEntry } from "anser";

): AnserJsonEntry[] {
input = escapeCarriageReturn(input);
input = escapeCarriageReturn(fixBackspace(input));
return Anser.ansiToJson(input, {
json: true,
remove_empty: true,
use_classes
use_classes,
});

@@ -105,3 +105,3 @@ }

const content: React.ReactNode[] = [];
const linkRegex = /(\s+|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})(\s+|$)/g;
const linkRegex = /(\s+|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g;

@@ -111,3 +111,3 @@ let index = 0;

while ((match = linkRegex.exec(bundle.content)) !== null) {
const [ , pre, url, post ] = match;
const [, pre, url] = match;

@@ -128,3 +128,3 @@ const startIndex = match.index + pre.length;

href,
target: "_blank"
target: "_blank",
},

@@ -135,4 +135,3 @@ `${url}`

const endIndex = linkRegex.lastIndex - post.length;
index = endIndex;
index = linkRegex.lastIndex;
}

@@ -164,1 +163,16 @@

}
// This is copied from the Jupyter Classic source code
// notebook/static/base/js/utils.js to handle \b in a way
// that is **compatible with Jupyter classic**. One can
// argue that this behavior is questionable:
// https://stackoverflow.com/questions/55440152/multiple-b-doesnt-work-as-expected-in-jupyter#
function fixBackspace(txt: string) {
let tmp = txt;
do {
txt = tmp;
// Cancel out anything-but-newline followed by backspace
tmp = txt.replace(/[^\n]\x08/gm, "");
} while (tmp.length < txt.length);
return txt;
}

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