ansi-to-react
Advanced tools
Comparing version 2.0.6 to 3.0.0
@@ -1,6 +0,4 @@ | ||
const Ansi = require("../src/index"); | ||
const React = require("react"); | ||
const enzyme = require("enzyme"); | ||
import { configure } from "enzyme"; | ||
import Ansi from "../src/index"; | ||
import * as React from "react"; | ||
import { configure, shallow } from "enzyme"; | ||
import Adapter from "enzyme-adapter-react-16"; | ||
@@ -16,3 +14,3 @@ | ||
test("hello world", () => { | ||
const el = enzyme.shallow(React.createElement(Ansi, null, "hello world")); | ||
const el = shallow(React.createElement(Ansi, null, "hello world")); | ||
expect(el).not.toBeNull(); | ||
@@ -23,3 +21,3 @@ expect(el.text()).toBe("hello world"); | ||
test("can color", () => { | ||
const el = enzyme.shallow( | ||
const el = shallow( | ||
React.createElement(Ansi, null, `hello ${GREEN_FG}world`) | ||
@@ -35,3 +33,3 @@ ); | ||
test("can have className", () => { | ||
const el = enzyme.shallow( | ||
const el = shallow( | ||
React.createElement(Ansi, { className: "my-class" }, `hello world`) | ||
@@ -47,3 +45,3 @@ ); | ||
test("can nest", () => { | ||
const el = enzyme.shallow( | ||
const el = shallow( | ||
React.createElement( | ||
@@ -63,3 +61,3 @@ Ansi, | ||
test("can handle carriage symbol", () => { | ||
const el = enzyme.shallow( | ||
const el = shallow( | ||
React.createElement( | ||
@@ -76,3 +74,3 @@ Ansi, | ||
test("can linkify", () => { | ||
const el = enzyme.shallow( | ||
const el = shallow( | ||
React.createElement( | ||
@@ -92,3 +90,3 @@ Ansi, | ||
test("can distinguish URL-ish text", () => { | ||
const el = enzyme.shallow( | ||
const el = shallow( | ||
React.createElement( | ||
@@ -105,3 +103,3 @@ Ansi, | ||
test("can distinguish URL-ish text", () => { | ||
const el = enzyme.shallow( | ||
const el = shallow( | ||
React.createElement( | ||
@@ -108,0 +106,0 @@ Ansi, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _react = require("react"); | ||
var React = _interopRequireWildcard(_react); | ||
var _anser = require("anser"); | ||
var _escapeCarriage = require("escape-carriage"); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
var React = require("react"); | ||
var Anser = require("anser"); | ||
var escapeCarriageReturn = require("escape-carriage"); | ||
/** | ||
@@ -21,4 +31,4 @@ * ansiToJson | ||
function ansiToJSON(input) { | ||
input = escapeCarriageReturn(input); | ||
return Anser.ansiToJson(input, { | ||
input = (0, _escapeCarriage.escapeCarriageReturn)(input); | ||
return (0, _anser.ansiToJson)(input, { | ||
json: true, | ||
@@ -74,2 +84,2 @@ remove_empty: true | ||
module.exports = Ansi; | ||
exports.default = Ansi; |
{ | ||
"name": "ansi-to-react", | ||
"version": "2.0.6", | ||
"version": "3.0.0", | ||
"description": "ANSI to React Elements", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
/* @flow */ | ||
const React = require("react"); | ||
const Anser = require("anser"); | ||
const escapeCarriageReturn = require("escape-carriage"); | ||
import * as React from "react"; | ||
import { ansiToJson } from "anser"; | ||
import { escapeCarriageReturn } from "escape-carriage"; | ||
@@ -18,3 +18,3 @@ /** | ||
input = escapeCarriageReturn(input); | ||
return Anser.ansiToJson(input, { | ||
return ansiToJson(input, { | ||
json: true, | ||
@@ -83,3 +83,3 @@ remove_empty: true | ||
type Props = { | ||
children?: React.Node, | ||
children: React.Node, | ||
className?: string, | ||
@@ -101,2 +101,2 @@ linkify?: boolean | ||
module.exports = Ansi; | ||
export default Ansi; |
Sorry, the diff of this file is not supported yet
11147
50526
255