react-anchorify-text
Advanced tools
Comparing version 2.2.0 to 2.3.0
## Change Log | ||
### Ver 2.3.0 | ||
* Update `Babel` from 6.x to 7.x. | ||
### Ver 2.2.0 | ||
@@ -4,0 +7,0 @@ * Update `React` from 15.x to 16.x. |
@@ -38,5 +38,12 @@ // Karma configuration | ||
['babelify', { | ||
presets : [ | ||
'env', | ||
'react' | ||
presets: [ | ||
['@babel/env',{ 'useBuiltIns': 'usage'}], | ||
'@babel/react' | ||
], | ||
plugins: [ | ||
['@babel/plugin-proposal-decorators', { 'legacy': true }], | ||
'@babel/plugin-proposal-function-sent', | ||
'@babel/plugin-proposal-export-namespace-from', | ||
'@babel/plugin-proposal-numeric-separator', | ||
'@babel/plugin-proposal-throw-expressions' | ||
] | ||
@@ -43,0 +50,0 @@ } |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,30 +6,51 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = void 0; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
require("core-js/modules/es7.symbol.async-iterator"); | ||
var _react = require('react'); | ||
require("core-js/modules/es6.symbol"); | ||
var _react2 = _interopRequireDefault(_react); | ||
require("core-js/modules/es6.object.define-property"); | ||
var _propTypes = require('prop-types'); | ||
require("core-js/modules/es6.object.create"); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
require("core-js/modules/es6.object.set-prototype-of"); | ||
var _linkifyIt = require('linkify-it'); | ||
require("core-js/modules/web.dom.iterable"); | ||
var _linkifyIt2 = _interopRequireDefault(_linkifyIt); | ||
require("core-js/modules/es6.array.for-each"); | ||
var _tlds = require('tlds'); | ||
require("core-js/modules/es6.regexp.match"); | ||
var _tlds2 = _interopRequireDefault(_tlds); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _linkifyIt = _interopRequireDefault(require("linkify-it")); | ||
var _tlds = _interopRequireDefault(require("tlds")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
var AnchorifyText = function (_React$Component) { | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
var AnchorifyText = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
_inherits(AnchorifyText, _React$Component); | ||
@@ -40,24 +61,22 @@ | ||
return _possibleConstructorReturn(this, (AnchorifyText.__proto__ || Object.getPrototypeOf(AnchorifyText)).call(this, props)); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(AnchorifyText).call(this, props)); | ||
} | ||
_createClass(AnchorifyText, [{ | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
var content = this.anchorify(this.props.text); | ||
return _react2.default.createElement( | ||
'span', | ||
null, | ||
content | ||
); | ||
return _react.default.createElement("span", null, content); | ||
} | ||
}, { | ||
key: 'anchorify', | ||
key: "anchorify", | ||
value: function anchorify(text) { | ||
var _this2 = this; | ||
var _this = this; | ||
var matches = this.props.linkify.match(text); | ||
if (matches === null) { | ||
return text; | ||
} | ||
var last = 0; | ||
@@ -68,27 +87,32 @@ var result = []; | ||
var keyMatch = 'anchorify-text-match' + i; | ||
if (last < match.index) { | ||
result.push(_react2.default.createElement( | ||
'span', | ||
{ key: keyBefore }, | ||
text.slice(last, match.index) | ||
)); | ||
result.push(_react.default.createElement("span", { | ||
key: keyBefore | ||
}, text.slice(last, match.index))); | ||
} | ||
if (_react2.default.Children.count(_this2.props.children) === 1) { | ||
result.push(_react2.default.cloneElement(_this2.props.children, { url: match.url, key: keyMatch, match: match })); | ||
if (_react.default.Children.count(_this.props.children) === 1) { | ||
result.push(_react.default.cloneElement(_this.props.children, { | ||
url: match.url, | ||
key: keyMatch, | ||
match: match | ||
})); | ||
} else { | ||
result.push(_react2.default.createElement( | ||
'a', | ||
{ key: keyMatch, href: match.url, target: _this2.props.target }, | ||
match.raw | ||
)); | ||
result.push(_react.default.createElement("a", { | ||
key: keyMatch, | ||
href: match.url, | ||
target: _this.props.target | ||
}, match.raw)); | ||
} | ||
last = match.lastIndex; | ||
}); | ||
if (last < text.length) { | ||
result.push(_react2.default.createElement( | ||
'span', | ||
{ key: 'anchorify-text-last' }, | ||
text.slice(last) | ||
)); | ||
result.push(_react.default.createElement("span", { | ||
key: 'anchorify-text-last' | ||
}, text.slice(last))); | ||
} | ||
return result; | ||
@@ -99,15 +123,14 @@ } | ||
return AnchorifyText; | ||
}(_react2.default.Component); | ||
}(_react.default.Component); | ||
AnchorifyText.propTypes = { | ||
text: _propTypes2.default.string.isRequired, | ||
linkify: _propTypes2.default.object, | ||
target: _propTypes2.default.string | ||
text: _propTypes.default.string.isRequired, | ||
linkify: _propTypes.default.object, | ||
target: _propTypes.default.string | ||
}; | ||
AnchorifyText.defaultProps = { | ||
linkify: new _linkifyIt2.default().tlds(_tlds2.default), | ||
linkify: new _linkifyIt.default().tlds(_tlds.default), | ||
target: '_blank' | ||
}; | ||
exports.default = AnchorifyText; | ||
var _default = AnchorifyText; | ||
exports.default = _default; |
@@ -1,13 +0,15 @@ | ||
'use strict'; | ||
"use strict"; | ||
require("core-js/modules/es6.object.define-property"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _AnchorifyText = require('./components/AnchorifyText'); | ||
var _AnchorifyText = _interopRequireDefault(require("./components/AnchorifyText")); | ||
var _AnchorifyText2 = _interopRequireDefault(_AnchorifyText); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.default = _AnchorifyText2.default; | ||
var _default = _AnchorifyText.default; | ||
exports.default = _default; |
{ | ||
"name": "react-anchorify-text", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "React component which render text with anchored url(s)", | ||
@@ -33,37 +33,42 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"babel-cli": "^6.3.17", | ||
"babel-core": "^6.3.26", | ||
"babel-eslint": "^8.0.2", | ||
"babel-preset-react": "^6.3.13", | ||
"babelify": "^8.0.0", | ||
"browser-sync": "^2.9.12", | ||
"browserify": "^14.4.0", | ||
"chai": "^4.0.1", | ||
"eslint": "^4.12.1", | ||
"eslint-plugin-react": "^7.0.1", | ||
"karma": "^1.7.0", | ||
"karma-browserify": "^5.1.1", | ||
"@babel/cli": "^7.1.0", | ||
"@babel/core": "^7.1.0", | ||
"@babel/plugin-proposal-decorators": "^7.1.0", | ||
"@babel/plugin-proposal-export-namespace-from": "^7.0.0", | ||
"@babel/plugin-proposal-function-sent": "^7.1.0", | ||
"@babel/plugin-proposal-numeric-separator": "^7.0.0", | ||
"@babel/plugin-proposal-throw-expressions": "^7.0.0", | ||
"@babel/preset-env": "^7.1.0", | ||
"@babel/preset-react": "^7.0.0", | ||
"babel-eslint": "^9.0.0", | ||
"babelify": "^10.0.0", | ||
"browser-sync": "^2.24.7", | ||
"browserify": "^16.2.2", | ||
"chai": "^4.1.2", | ||
"eslint": "^5.6.0", | ||
"eslint-plugin-react": "^7.11.1", | ||
"karma": "^3.0.0", | ||
"karma-browserify": "^5.3.0", | ||
"karma-chai": "^0.1.0", | ||
"karma-chrome-launcher": "^2.1.1", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-cli": "1.0.1", | ||
"karma-firefox-launcher": "^1.0.1", | ||
"karma-firefox-launcher": "^1.1.0", | ||
"karma-mocha": "^1.3.0", | ||
"karma-safari-launcher": "^1.0.0", | ||
"karma-spec-reporter": "0.0.31", | ||
"mocha": "^4.0.1", | ||
"react": "^16.2.0", | ||
"react-addons-test-utils": "^15.5.1", | ||
"react-dom": "^16.2.0", | ||
"rimraf": "^2.5.0", | ||
"watchify": "^3.6.0" | ||
"karma-spec-reporter": "0.0.32", | ||
"mocha": "^5.2.0", | ||
"react": "^16.5.2", | ||
"react-addons-test-utils": "^15.6.2", | ||
"react-dom": "^16.5.2", | ||
"rimraf": "^2.6.2", | ||
"watchify": "^3.11.0" | ||
}, | ||
"dependencies": { | ||
"babel-preset-env": "^1.6.1", | ||
"linkify-it": "^2.0.0", | ||
"prop-types": "^15.5.10", | ||
"tlds": "^1.145.0" | ||
"linkify-it": "^2.0.3", | ||
"prop-types": "^15.6.2", | ||
"tlds": "^1.203.1" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.2.0", | ||
"react-dom": "^16.2.0" | ||
"react": "^16.5.2", | ||
"react-dom": "^16.5.2" | ||
}, | ||
@@ -77,4 +82,11 @@ "browserify": { | ||
"presets": [ | ||
"env", | ||
"react" | ||
["@babel/env",{ "useBuiltIns": "usage"}], | ||
"@babel/react" | ||
], | ||
"plugins": [ | ||
["@babel/plugin-proposal-decorators", { "legacy": true }], | ||
"@babel/plugin-proposal-function-sent", | ||
"@babel/plugin-proposal-export-namespace-from", | ||
"@babel/plugin-proposal-numeric-separator", | ||
"@babel/plugin-proposal-throw-expressions" | ||
] | ||
@@ -81,0 +93,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
212247
5
372
31
18
+ Addedjs-tokens@4.0.0(transitive)
- Removedbabel-preset-env@^1.6.1
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedbabel-code-frame@6.26.0(transitive)
- Removedbabel-helper-builder-binary-assignment-operator-visitor@6.24.1(transitive)
- Removedbabel-helper-call-delegate@6.24.1(transitive)
- Removedbabel-helper-define-map@6.26.0(transitive)
- Removedbabel-helper-explode-assignable-expression@6.24.1(transitive)
- Removedbabel-helper-function-name@6.24.1(transitive)
- Removedbabel-helper-get-function-arity@6.24.1(transitive)
- Removedbabel-helper-hoist-variables@6.24.1(transitive)
- Removedbabel-helper-optimise-call-expression@6.24.1(transitive)
- Removedbabel-helper-regex@6.26.0(transitive)
- Removedbabel-helper-remap-async-to-generator@6.24.1(transitive)
- Removedbabel-helper-replace-supers@6.24.1(transitive)
- Removedbabel-messages@6.23.0(transitive)
- Removedbabel-plugin-check-es2015-constants@6.22.0(transitive)
- Removedbabel-plugin-syntax-async-functions@6.13.0(transitive)
- Removedbabel-plugin-syntax-exponentiation-operator@6.13.0(transitive)
- Removedbabel-plugin-syntax-trailing-function-commas@6.22.0(transitive)
- Removedbabel-plugin-transform-async-to-generator@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-arrow-functions@6.22.0(transitive)
- Removedbabel-plugin-transform-es2015-block-scoped-functions@6.22.0(transitive)
- Removedbabel-plugin-transform-es2015-block-scoping@6.26.0(transitive)
- Removedbabel-plugin-transform-es2015-classes@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-computed-properties@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-destructuring@6.23.0(transitive)
- Removedbabel-plugin-transform-es2015-duplicate-keys@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-for-of@6.23.0(transitive)
- Removedbabel-plugin-transform-es2015-function-name@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-literals@6.22.0(transitive)
- Removedbabel-plugin-transform-es2015-modules-amd@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-modules-commonjs@6.26.2(transitive)
- Removedbabel-plugin-transform-es2015-modules-systemjs@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-modules-umd@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-object-super@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-parameters@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-shorthand-properties@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-spread@6.22.0(transitive)
- Removedbabel-plugin-transform-es2015-sticky-regex@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-template-literals@6.22.0(transitive)
- Removedbabel-plugin-transform-es2015-typeof-symbol@6.23.0(transitive)
- Removedbabel-plugin-transform-es2015-unicode-regex@6.24.1(transitive)
- Removedbabel-plugin-transform-exponentiation-operator@6.24.1(transitive)
- Removedbabel-plugin-transform-regenerator@6.26.0(transitive)
- Removedbabel-plugin-transform-strict-mode@6.24.1(transitive)
- Removedbabel-preset-env@1.7.0(transitive)
- Removedbabel-runtime@6.26.0(transitive)
- Removedbabel-template@6.26.0(transitive)
- Removedbabel-traverse@6.26.0(transitive)
- Removedbabel-types@6.26.0(transitive)
- Removedbabylon@6.18.0(transitive)
- Removedbrowserslist@3.2.8(transitive)
- Removedcaniuse-lite@1.0.30001684(transitive)
- Removedchalk@1.1.3(transitive)
- Removedcore-js@2.6.12(transitive)
- Removeddebug@2.6.9(transitive)
- Removedelectron-to-chromium@1.5.67(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedesutils@2.0.3(transitive)
- Removedglobals@9.18.0(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedinvariant@2.2.4(transitive)
- Removedjs-tokens@3.0.2(transitive)
- Removedjsesc@0.5.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removedms@2.0.0(transitive)
- Removedprivate@0.1.8(transitive)
- Removedregenerate@1.4.2(transitive)
- Removedregenerator-runtime@0.11.1(transitive)
- Removedregenerator-transform@0.10.1(transitive)
- Removedregexpu-core@2.0.0(transitive)
- Removedregjsgen@0.2.0(transitive)
- Removedregjsparser@0.1.5(transitive)
- Removedsemver@5.7.2(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedsupports-color@2.0.0(transitive)
- Removedto-fast-properties@1.0.3(transitive)
Updatedlinkify-it@^2.0.3
Updatedprop-types@^15.6.2
Updatedtlds@^1.203.1