@concordance/react
Advanced tools
Comparing version 1.0.0 to 2.0.0
@@ -19,3 +19,3 @@ 'use strict' | ||
// Plugin-specific version of its serialization output. | ||
exports.serializerVersion = 1 | ||
exports.serializerVersion = 2 | ||
@@ -22,0 +22,0 @@ exports.theme = { |
@@ -7,2 +7,4 @@ 'use strict' | ||
const FRAGMENT_NAME = Symbol.for('react.fragment') | ||
function factory (api, reactTags) { | ||
@@ -96,2 +98,3 @@ const tag = Symbol('@concordance/react.ElementValue') | ||
super(props) | ||
this.isFragment = props.name === FRAGMENT_NAME | ||
this.name = props.name | ||
@@ -111,3 +114,3 @@ this.hasProperties = props.hasProperties | ||
formatName (theme) { | ||
const formatted = api.wrapFromTheme(theme.react.tagName, this.name) | ||
const formatted = api.wrapFromTheme(theme.react.tagName, this.isFragment ? 'React.Fragment' : this.name) | ||
return this.hasTypeFn | ||
@@ -219,3 +222,3 @@ ? formatted + theme.react.functionType | ||
serialize () { | ||
return [this.name, this.hasProperties, this.hasTypeFn, super.serialize()] | ||
return [this.isFragment, this.isFragment ? null : this.name, this.hasProperties, this.hasTypeFn, super.serialize()] | ||
} | ||
@@ -329,6 +332,7 @@ } | ||
constructor (state, recursor) { | ||
super(state[3], recursor) | ||
this.name = state[0] | ||
this.hasProperties = state[1] | ||
this.hasTypeFn = state[2] | ||
super(state[4], recursor) | ||
this.isFragment = state[0] | ||
this.name = this.isFragment ? FRAGMENT_NAME : state[1] | ||
this.hasProperties = state[2] | ||
this.hasTypeFn = state[3] | ||
} | ||
@@ -335,0 +339,0 @@ |
{ | ||
"name": "@concordance/react", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "Compare, format, diff and serialize React trees with Concordance", | ||
@@ -11,11 +11,9 @@ "main": "index.js", | ||
"engines": { | ||
"node": ">=4.5" | ||
"node": ">=6.12.3 <7 || >=8.9.4 <9 || >=10.0.0" | ||
}, | ||
"scripts": { | ||
"build:fixtures": "babel --presets=react,@ava/stage-4 --out-dir=test/fixtures/react --extensions=.jsx test/fixtures/react", | ||
"coverage": "nyc npm test", | ||
"build:fixtures": "babel --presets=module:@babel/preset-react,module:ava/stage-4 --out-dir=test/fixtures/react --extensions=.jsx test/fixtures/react", | ||
"lint": "as-i-preach", | ||
"pretest": "npm run build:fixtures", | ||
"test": "ava", | ||
"posttest": "as-i-preach" | ||
"pretest": "npm run -s build:fixtures", | ||
"test": "npm run -s lint && nyc ava" | ||
}, | ||
@@ -41,12 +39,12 @@ "repository": { | ||
"devDependencies": { | ||
"@novemberborn/as-i-preach": "^10.0.1", | ||
"ava": "^0.19.0", | ||
"babel-cli": "^6.24.1", | ||
"babel-core": "^6.25.0", | ||
"babel-preset-react": "^6.24.1", | ||
"codecov": "^2.1.0", | ||
"concordance": "^1.0.0", | ||
"nyc": "^11.0.1", | ||
"react": "^15.6.1", | ||
"react-test-renderer": "^15.6.1" | ||
"@babel/cli": "^7.1.0", | ||
"@babel/core": "^7.1.0", | ||
"@babel/preset-react": "^7.0.0", | ||
"@novemberborn/as-i-preach": "^10.1.0", | ||
"ava": "1.0.0-beta.8", | ||
"codecov": "^3.1.0", | ||
"concordance": "^4.0.0", | ||
"nyc": "^13.0.1", | ||
"react": "^16.5.2", | ||
"react-test-renderer": "^16.5.2" | ||
}, | ||
@@ -63,11 +61,8 @@ "as-i-preach": { | ||
"ava": { | ||
"source": [ | ||
"!test/**/*.js.snap" | ||
], | ||
"babel": { | ||
"presets": [ | ||
"@ava/stage-4", | ||
"@ava/transform-test-files", | ||
"react" | ||
] | ||
"testOptions": { | ||
"presets": [ | ||
"module:@babel/preset-react" | ||
] | ||
} | ||
} | ||
@@ -74,0 +69,0 @@ }, |
@@ -15,7 +15,5 @@ # @concordance/react | ||
elements, the element type is compared by identity. After deserialization the | ||
element types are compared by function name, taking into account whether | ||
serialization and / or comparison is done using Node.js 4, which has less | ||
reliable support for function names. | ||
element types are compared by function name. | ||
Component elements are formatted with a ⍟ character after the element | ||
name. Properties and children are formatted by [Concordance](https://github.com/concordancejs/concordance). |
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
29902
636
19