Comparing version 1.1.1 to 1.1.2
@@ -1,5 +0,11 @@ | ||
var getSsrData = function getSsrData() { | ||
return typeof window !== 'undefined' && !!document ? window.__CENTARIUS_SERVER_STATE__ : {}; | ||
import { dataId } from '../core/constants'; | ||
var getSsrData = function getSsrData(defaultDataId) { | ||
if (defaultDataId === void 0) { | ||
defaultDataId = dataId; | ||
} | ||
return typeof window !== 'undefined' && !!document ? eval("(" + document.getElementById(defaultDataId).textContent + ")") : {}; | ||
}; | ||
export default getSsrData; |
@@ -6,11 +6,14 @@ import _extends from "@babel/runtime/helpers/extends"; | ||
import serialize from 'serialize-javascript'; | ||
import { dataId } from '../core/constants'; | ||
var CentariusData = function CentariusData(_ref) { | ||
var data = _ref.data, | ||
rest = _objectWithoutPropertiesLoose(_ref, ["data"]); | ||
var id = _ref.id, | ||
data = _ref.data, | ||
rest = _objectWithoutPropertiesLoose(_ref, ["id", "data"]); | ||
return React.createElement("script", _extends({ | ||
id: id, | ||
type: "application/json", | ||
dangerouslySetInnerHTML: { | ||
__html: "window.__CENTARIUS_SERVER_STATE__=" + serialize(data) | ||
__html: serialize(data) | ||
} | ||
@@ -21,7 +24,9 @@ }, rest)); | ||
CentariusData.propTypes = process.env.NODE_ENV !== "production" ? { | ||
data: PropTypes.any | ||
data: PropTypes.any, | ||
id: PropTypes.string | ||
} : {}; | ||
CentariusData.defaultProps = { | ||
data: {} | ||
data: {}, | ||
id: dataId | ||
}; | ||
export default CentariusData; |
{ | ||
"name": "centarius", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "♥ Sweet React SSR for Everyone ♥", | ||
@@ -68,3 +68,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "bb1e9ac1450674e89ac6da8008e864cece73d2fa" | ||
"gitHead": "f749ee9ace354afcac84057e967c27cd4a378a67" | ||
} |
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
59123
821
1