react-element-to-jsx-string
Advanced tools
Comparing version
@@ -0,1 +1,11 @@ | ||
<a name="13.2.0"></a> | ||
# [13.2.0](https://github.com/algolia/react-element-to-jsx-string/compare/v13.1.0...v13.2.0) (2018-03-14) | ||
### Bug Fixes | ||
* **deps:** update dependency stringify-object to v3.2.2 ([b1a4c5e](https://github.com/algolia/react-element-to-jsx-string/commit/b1a4c5e)) | ||
<a name="13.1.0"></a> | ||
@@ -2,0 +12,0 @@ # [13.1.0](https://github.com/algolia/react-element-to-jsx-string/compare/v13.0.0...v13.1.0) (2017-11-15) |
@@ -151,3 +151,3 @@ 'use strict'; | ||
out += childrens.reduce(_mergeSiblingPlainStringChildrenReducer2.default, []).map(formatOneChildren(inline, newLvl, options)).join('\n' + (0, _spacer2.default)(newLvl, tabStop)); | ||
out += childrens.reduce(_mergeSiblingPlainStringChildrenReducer2.default, []).map(formatOneChildren(inline, newLvl, options)).join(!inline ? '\n' + (0, _spacer2.default)(newLvl, tabStop) : ''); | ||
@@ -154,0 +154,0 @@ if (!inline) { |
@@ -11,6 +11,9 @@ 'use strict'; | ||
var _formatReactFragmentNode = require('./formatReactFragmentNode'); | ||
var _formatReactFragmentNode2 = _interopRequireDefault(_formatReactFragmentNode); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var jsxStopChars = ['<', '>', '{', '}']; | ||
var shouldBeEscaped = function shouldBeEscaped(s) { | ||
@@ -56,4 +59,8 @@ return jsxStopChars.some(function (jsxStopChar) { | ||
if (node.type === 'ReactFragment') { | ||
return (0, _formatReactFragmentNode2.default)(node, inline, lvl, options); | ||
} | ||
throw new TypeError('Unknow format type "' + node.type + '"'); | ||
}; | ||
//# sourceMappingURL=formatTreeNode.js.map |
@@ -30,2 +30,4 @@ 'use strict'; | ||
useBooleanShorthandSyntax = _ref$useBooleanShorth === undefined ? true : _ref$useBooleanShorth, | ||
_ref$useFragmentShort = _ref.useFragmentShortSyntax, | ||
useFragmentShortSyntax = _ref$useFragmentShort === undefined ? true : _ref$useFragmentShort, | ||
_ref$sortProps = _ref.sortProps, | ||
@@ -47,2 +49,3 @@ sortProps = _ref$sortProps === undefined ? true : _ref$sortProps, | ||
useBooleanShorthandSyntax: useBooleanShorthandSyntax, | ||
useFragmentShortSyntax: useFragmentShortSyntax, | ||
sortProps: sortProps, | ||
@@ -49,0 +52,0 @@ maxInlineAttributesLineLength: maxInlineAttributesLineLength, |
@@ -17,2 +17,4 @@ 'use strict'; | ||
var supportFragment = Boolean(_react.Fragment); | ||
var getReactElementDisplayName = function getReactElementDisplayName(element) { | ||
@@ -75,2 +77,6 @@ return element.type.displayName || element.type.name || ( // function name | ||
if (supportFragment && element.type === _react.Fragment) { | ||
return (0, _tree.createReactFragmentTreeNode)(key, childrens); | ||
} | ||
return (0, _tree.createReactElementTreeNode)(displayName, props, defaultProps, childrens); | ||
@@ -77,0 +83,0 @@ }; |
@@ -32,2 +32,10 @@ 'use strict'; | ||
}; | ||
var createReactFragmentTreeNode = exports.createReactFragmentTreeNode = function createReactFragmentTreeNode(key, childrens) { | ||
return { | ||
type: 'ReactFragment', | ||
key: key, | ||
childrens: childrens | ||
}; | ||
}; | ||
//# sourceMappingURL=tree.js.map |
{ | ||
"name": "react-element-to-jsx-string", | ||
"version": "13.1.0", | ||
"version": "13.2.0", | ||
"description": "Turn a ReactElement into the corresponding JSX string.", | ||
@@ -8,3 +8,3 @@ "main": "dist/index.js", | ||
"build": "babel ./src/ --ignore=*.spec.js --source-maps --out-dir ./dist/ && flow-copy-source -v --ignore=*.spec.js src/ dist/", | ||
"lint": "node_modules/.bin/eslint .", | ||
"lint": "eslint .", | ||
"lint:fix": "npm run lint -- --fix", | ||
@@ -15,10 +15,11 @@ "flow": "flow", | ||
"prebuild": "mkdir -p dist && rm -rf ./dist/*", | ||
"prettier:fix": "prettier --write --single-quote --trailing-comma es5 \"{src/**/*.js,package.json}\"", | ||
"test": "jest && npm run lint && npm run flow", | ||
"prettier:fix": "prettier --write \"**/*.{js,json}\"", | ||
"test": "jest", | ||
"test:watch": "jest --watch", | ||
"release": "./release.sh" | ||
"release": "./release.sh", | ||
"smoke": "node tests/smoke/run" | ||
}, | ||
"lint-staged": { | ||
"*.js": [ | ||
"prettier --write --single-quote --trailing-comma es5", | ||
"prettier --write \"**/*.{js,json}\"", | ||
"git add" | ||
@@ -33,13 +34,8 @@ ] | ||
"repository": "algolia/react-element-to-jsx-string", | ||
"renovate": { | ||
"semanticCommits": true, | ||
"rebaseStalePrs": true, | ||
"automerge": "minor" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "4.3.0", | ||
"@commitlint/config-angular": "4.3.0", | ||
"@commitlint/cli": "5.2.8", | ||
"@commitlint/config-angular": "5.1.1", | ||
"babel-cli": "6.26.0", | ||
"babel-eslint": "8.0.2", | ||
"babel-jest": "21.2.0", | ||
"babel-eslint": "8.2.2", | ||
"babel-jest": "22.2.2", | ||
"babel-preset-es2015": "6.24.1", | ||
@@ -50,23 +46,22 @@ "babel-preset-flow": "6.23.0", | ||
"babel-register": "6.26.0", | ||
"conventional-changelog-cli": "1.3.5", | ||
"doctoc": "1.3.0", | ||
"eslint": "4.11.0", | ||
"eslint-config-algolia": "12.0.0", | ||
"eslint-config-prettier": "2.7.0", | ||
"eslint-plugin-import": "2.8.0", | ||
"eslint-plugin-jest": "21.3.2", | ||
"eslint-plugin-prettier": "2.3.1", | ||
"eslint-plugin-react": "7.4.0", | ||
"expect": "21.2.1", | ||
"flow-bin": "0.59.0", | ||
"flow-copy-source": "1.2.1", | ||
"conventional-changelog-cli": "1.3.16", | ||
"doctoc": "1.3.1", | ||
"eslint": "4.18.2", | ||
"eslint-config-algolia": "13.1.0", | ||
"eslint-config-prettier": "2.9.0", | ||
"eslint-plugin-import": "2.9.0", | ||
"eslint-plugin-jest": "21.14.0", | ||
"eslint-plugin-prettier": "2.6.0", | ||
"eslint-plugin-react": "7.7.0", | ||
"expect": "22.3.0", | ||
"flow-bin": "0.67.1", | ||
"flow-copy-source": "1.3.0", | ||
"husky": "0.14.3", | ||
"jest": "21.2.1", | ||
"jest": "22.3.0", | ||
"json": "9.0.6", | ||
"lint-staged": "5.0.0", | ||
"lint-staged": "7.0.0", | ||
"mversion": "1.10.1", | ||
"prettier": "1.8.2", | ||
"react": "16.1.1", | ||
"react-dom": "16.1.1", | ||
"react-test-renderer": "16.1.1" | ||
"react": "16.2.0", | ||
"react-test-renderer": "16.2.0" | ||
}, | ||
@@ -78,4 +73,4 @@ "peerDependencies": { | ||
"is-plain-object": "2.0.4", | ||
"stringify-object": "3.2.1" | ||
"stringify-object": "3.2.2" | ||
} | ||
} |
@@ -119,2 +119,14 @@ # react-element-to-jsx-string | ||
**options.useFragmentShortSyntax: boolean, default true** | ||
If true, fragment will be represented with the JSX short syntax `<>...</>` (when possible). | ||
If false, fragment will always be represented with the JSX explicit syntax `<React.Fragment>...</React.Fragment>`. | ||
According to [the specs](https://reactjs.org/docs/fragments.html): | ||
- A keyed fragment will always use the explicit syntax: `<React.Fragment key={...}>...</React.Fragment>` | ||
- An empty fragment will always use the explicit syntax: `<React.Fragment />` | ||
Note: to use fragment you must use React >= 16.2 | ||
## Environment requirements | ||
@@ -121,0 +133,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
589266
11.33%30
-3.23%73
12.31%695
22.14%165
7.84%2
100%2
Infinity%+ Added
- Removed
Updated