1 |
- {"ast":null,"code":"'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\nexports.default = exports.test = exports.serialize = void 0;\n\nvar ReactIs = _interopRequireWildcard(require('react-is'));\n\nvar _markup = require('./lib/markup');\n\nfunction _getRequireWildcardCache() {\n if (typeof WeakMap !== 'function') return null;\n var cache = new WeakMap();\n\n _getRequireWildcardCache = function () {\n return cache;\n };\n\n return cache;\n}\n\nfunction _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n }\n\n if (obj === null || typeof obj !== 'object' && typeof obj !== 'function') {\n return {\n default: obj\n };\n }\n\n var cache = _getRequireWildcardCache();\n\n if (cache && cache.has(obj)) {\n return cache.get(obj);\n }\n\n var newObj = {};\n var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;\n\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;\n\n if (desc && (desc.get || desc.set)) {\n Object.defineProperty(newObj, key, desc);\n } else {\n newObj[key] = obj[key];\n }\n }\n }\n\n newObj.default = obj;\n\n if (cache) {\n cache.set(obj, newObj);\n }\n\n return newObj;\n}\n/**\n * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n// Given element.props.children, or subtree during recursive traversal,\n// return flattened array of children.\n\n\nconst getChildren = (arg, children = []) => {\n if (Array.isArray(arg)) {\n arg.forEach(item => {\n getChildren(item, children);\n });\n } else if (arg != null && arg !== false) {\n children.push(arg);\n }\n\n return children;\n};\n\nconst getType = element => {\n const type = element.type;\n\n if (typeof type === 'string') {\n return type;\n }\n\n if (typeof type === 'function') {\n return type.displayName || type.name || 'Unknown';\n }\n\n if (ReactIs.isFragment(element)) {\n return 'React.Fragment';\n }\n\n if (ReactIs.isSuspense(element)) {\n return 'React.Suspense';\n }\n\n if (typeof type === 'object' && type !== null) {\n if (ReactIs.isContextProvider(element)) {\n return 'Context.Provider';\n }\n\n if (ReactIs.isContextConsumer(element)) {\n return 'Context.Consumer';\n }\n\n if (ReactIs.isForwardRef(element)) {\n if (type.displayName) {\n return type.displayName;\n }\n\n const functionName = type.render.displayName || type.render.name || '';\n return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';\n }\n\n if (ReactIs.isMemo(element)) {\n const functionName = type.displayName || type.type.displayName || type.type.name || '';\n return functionName !== '' ? 'Memo(' + functionName + ')' : 'Memo';\n }\n }\n\n return 'UNDEFINED';\n};\n\nconst getPropKeys = element => {\n const {\n props\n } = element;\n return Object.keys(props).filter(key => key !== 'children' && props[key] !== undefined).sort();\n};\n\nconst serialize = (element, config, indentation, depth, refs, printer) => ++depth > config.maxDepth ? (0, _markup.printElementAsLeaf)(getType(element), config) : (0, _markup.printElement)(getType(element), (0, _markup.printProps)(getPropKeys(element), element.props, config, indentation + config.indent, depth, refs, printer), (0, _markup.printChildren)(getChildren(element.props.children), config, indentation + config.indent, depth, refs, printer), config, indentation);\n\nexports.serialize = serialize;\n\nconst test = val => val && ReactIs.isElement(val);\n\nexports.test = test;\nconst plugin = {\n serialize,\n test\n};\nvar _default = plugin;\nexports.default = _default;","map":{"version":3,"sources":["/Users/jane/Documents/Курс Front-end/HW8/myproject/node_modules/pretty-format/build/plugins/ReactElement.js"],"names":["Object","defineProperty","exports","value","default","test","serialize","ReactIs","_interopRequireWildcard","require","_markup","_getRequireWildcardCache","WeakMap","cache","obj","__esModule","has","get","newObj","hasPropertyDescriptor","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","getChildren","arg","children","Array","isArray","forEach","item","push","getType","element","type","displayName","name","isFragment","isSuspense","isContextProvider","isContextConsumer","isForwardRef","functionName","render","isMemo","getPropKeys","props","keys","filter","undefined","sort","config","indentation","depth","refs","printer","maxDepth","printElementAsLeaf","printElement","printProps","indent","printChildren","val","isElement","plugin","_default"],"mappings":"AAAA;;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D,MAAf;AACAjE,OAAO,CAACE,OAAR,GAAkBgE,QAAlB","sourcesContent":["'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\nexports.default = exports.test = exports.serialize = void 0;\n\nvar ReactIs = _interopRequireWildcard(require('react-is'));\n\nvar _markup = require('./lib/markup');\n\nfunction _getRequireWildcardCache() {\n if (typeof WeakMap !== 'function') return null;\n var cache = new WeakMap();\n _getRequireWildcardCache = function () {\n return cache;\n };\n return cache;\n}\n\nfunction _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n }\n if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {\n return {default: obj};\n }\n var cache = _getRequireWildcardCache();\n if (cache && cache.has(obj)) {\n return cache.get(obj);\n }\n var newObj = {};\n var hasPropertyDescriptor =\n Object.defineProperty && Object.getOwnPropertyDescriptor;\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n var desc = hasPropertyDescriptor\n ? Object.getOwnPropertyDescriptor(obj, key)\n : null;\n if (desc && (desc.get || desc.set)) {\n Object.defineProperty(newObj, key, desc);\n } else {\n newObj[key] = obj[key];\n }\n }\n }\n newObj.default = obj;\n if (cache) {\n cache.set(obj, newObj);\n }\n return newObj;\n}\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n// Given element.props.children, or subtree during recursive traversal,\n// return flattened array of children.\nconst getChildren = (arg, children = []) => {\n if (Array.isArray(arg)) {\n arg.forEach(item => {\n getChildren(item, children);\n });\n } else if (arg != null && arg !== false) {\n children.push(arg);\n }\n\n return children;\n};\n\nconst getType = element => {\n const type = element.type;\n\n if (typeof type === 'string') {\n return type;\n }\n\n if (typeof type === 'function') {\n return type.displayName || type.name || 'Unknown';\n }\n\n if (ReactIs.isFragment(element)) {\n return 'React.Fragment';\n }\n\n if (ReactIs.isSuspense(element)) {\n return 'React.Suspense';\n }\n\n if (typeof type === 'object' && type !== null) {\n if (ReactIs.isContextProvider(element)) {\n return 'Context.Provider';\n }\n\n if (ReactIs.isContextConsumer(element)) {\n return 'Context.Consumer';\n }\n\n if (ReactIs.isForwardRef(element)) {\n if (type.displayName) {\n return type.displayName;\n }\n\n const functionName = type.render.displayName || type.render.name || '';\n return functionName !== ''\n ? 'ForwardRef(' + functionName + ')'\n : 'ForwardRef';\n }\n\n if (ReactIs.isMemo(element)) {\n const functionName =\n type.displayName || type.type.displayName || type.type.name || '';\n return functionName !== '' ? 'Memo(' + functionName + ')' : 'Memo';\n }\n }\n\n return 'UNDEFINED';\n};\n\nconst getPropKeys = element => {\n const {props} = element;\n return Object.keys(props)\n .filter(key => key !== 'children' && props[key] !== undefined)\n .sort();\n};\n\nconst serialize = (element, config, indentation, depth, refs, printer) =>\n ++depth > config.maxDepth\n ? (0, _markup.printElementAsLeaf)(getType(element), config)\n : (0, _markup.printElement)(\n getType(element),\n (0, _markup.printProps)(\n getPropKeys(element),\n element.props,\n config,\n indentation + config.indent,\n depth,\n refs,\n printer\n ),\n (0, _markup.printChildren)(\n getChildren(element.props.children),\n config,\n indentation + config.indent,\n depth,\n refs,\n printer\n ),\n config,\n indentation\n );\n\nexports.serialize = serialize;\n\nconst test = val => val && ReactIs.isElement(val);\n\nexports.test = test;\nconst plugin = {\n serialize,\n test\n};\nvar _default = plugin;\nexports.default = _default;\n"]},"metadata":{},"sourceType":"script"}
|