2a05b9dacea135f165f34ada5b61b908c9677f86c0c910a2a7acdd245d061bdd.json 10.0 KB

1
  1. {"ast":null,"code":"'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\nexports.test = exports.serialize = exports.default = void 0;\nvar _markup = require('./lib/markup');\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 */\nconst ELEMENT_NODE = 1;\nconst TEXT_NODE = 3;\nconst COMMENT_NODE = 8;\nconst FRAGMENT_NODE = 11;\nconst ELEMENT_REGEXP = /^((HTML|SVG)\\w*)?Element$/;\nconst testHasAttribute = val => {\n try {\n return typeof val.hasAttribute === 'function' && val.hasAttribute('is');\n } catch {\n return false;\n }\n};\nconst testNode = val => {\n const constructorName = val.constructor.name;\n const {\n nodeType,\n tagName\n } = val;\n const isCustomElement = typeof tagName === 'string' && tagName.includes('-') || testHasAttribute(val);\n return nodeType === ELEMENT_NODE && (ELEMENT_REGEXP.test(constructorName) || isCustomElement) || nodeType === TEXT_NODE && constructorName === 'Text' || nodeType === COMMENT_NODE && constructorName === 'Comment' || nodeType === FRAGMENT_NODE && constructorName === 'DocumentFragment';\n};\nconst test = val => {\n var _val$constructor;\n return (val === null || val === void 0 ? void 0 : (_val$constructor = val.constructor) === null || _val$constructor === void 0 ? void 0 : _val$constructor.name) && testNode(val);\n};\nexports.test = test;\nfunction nodeIsText(node) {\n return node.nodeType === TEXT_NODE;\n}\nfunction nodeIsComment(node) {\n return node.nodeType === COMMENT_NODE;\n}\nfunction nodeIsFragment(node) {\n return node.nodeType === FRAGMENT_NODE;\n}\nconst serialize = (node, config, indentation, depth, refs, printer) => {\n if (nodeIsText(node)) {\n return (0, _markup.printText)(node.data, config);\n }\n if (nodeIsComment(node)) {\n return (0, _markup.printComment)(node.data, config);\n }\n const type = nodeIsFragment(node) ? 'DocumentFragment' : node.tagName.toLowerCase();\n if (++depth > config.maxDepth) {\n return (0, _markup.printElementAsLeaf)(type, config);\n }\n return (0, _markup.printElement)(type, (0, _markup.printProps)(nodeIsFragment(node) ? [] : Array.from(node.attributes).map(attr => attr.name).sort(), nodeIsFragment(node) ? {} : Array.from(node.attributes).reduce((props, attribute) => {\n props[attribute.name] = attribute.value;\n return props;\n }, {}), config, indentation + config.indent, depth, refs, printer), (0, _markup.printChildren)(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer), config, indentation);\n};\nexports.serialize = serialize;\nconst plugin = {\n serialize,\n test\n};\nvar _default = plugin;\nexports.default = _default;","map":{"version":3,"names":["Object","defineProperty","exports","value","test","serialize","default","_markup","require","ELEMENT_NODE","TEXT_NODE","COMMENT_NODE","FRAGMENT_NODE","ELEMENT_REGEXP","testHasAttribute","val","hasAttribute","testNode","constructorName","constructor","name","nodeType","tagName","isCustomElement","includes","_val$constructor","nodeIsText","node","nodeIsComment","nodeIsFragment","config","indentation","depth","refs","printer","printText","data","printComment","type","toLowerCase","maxDepth","printElementAsLeaf","printElement","printProps","Array","from","attributes","map","attr","sort","reduce","props","attribute","indent","printChildren","prototype","slice","call","childNodes","children","plugin","_default"],"sources":["/Users/max_liu/max_liu/company/tools_auto_pt/node_modules/pretty-format/build/plugins/DOMElement.js"],"sourcesContent":["'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\nexports.test = exports.serialize = exports.default = void 0;\n\nvar _markup = require('./lib/markup');\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 */\nconst ELEMENT_NODE = 1;\nconst TEXT_NODE = 3;\nconst COMMENT_NODE = 8;\nconst FRAGMENT_NODE = 11;\nconst ELEMENT_REGEXP = /^((HTML|SVG)\\w*)?Element$/;\n\nconst testHasAttribute = val => {\n try {\n return typeof val.hasAttribute === 'function' && val.hasAttribute('is');\n } catch {\n return false;\n }\n};\n\nconst testNode = val => {\n const constructorName = val.constructor.name;\n const {nodeType, tagName} = val;\n const isCustomElement =\n (typeof tagName === 'string' && tagName.includes('-')) ||\n testHasAttribute(val);\n return (\n (nodeType === ELEMENT_NODE &&\n (ELEMENT_REGEXP.test(constructorName) || isCustomElement)) ||\n (nodeType === TEXT_NODE && constructorName === 'Text') ||\n (nodeType === COMMENT_NODE && constructorName === 'Comment') ||\n (nodeType === FRAGMENT_NODE && constructorName === 'DocumentFragment')\n );\n};\n\nconst test = val => {\n var _val$constructor;\n\n return (\n (val === null || val === void 0\n ? void 0\n : (_val$constructor = val.constructor) === null ||\n _val$constructor === void 0\n ? void 0\n : _val$constructor.name) && testNode(val)\n );\n};\n\nexports.test = test;\n\nfunction nodeIsText(node) {\n return node.nodeType === TEXT_NODE;\n}\n\nfunction nodeIsComment(node) {\n return node.nodeType === COMMENT_NODE;\n}\n\nfunction nodeIsFragment(node) {\n return node.nodeType === FRAGMENT_NODE;\n}\n\nconst serialize = (node, config, indentation, depth, refs, printer) => {\n if (nodeIsText(node)) {\n return (0, _markup.printText)(node.data, config);\n }\n\n if (nodeIsComment(node)) {\n return (0, _markup.printComment)(node.data, config);\n }\n\n const type = nodeIsFragment(node)\n ? 'DocumentFragment'\n : node.tagName.toLowerCase();\n\n if (++depth > config.maxDepth) {\n return (0, _markup.printElementAsLeaf)(type, config);\n }\n\n return (0, _markup.printElement)(\n type,\n (0, _markup.printProps)(\n nodeIsFragment(node)\n ? []\n : Array.from(node.attributes)\n .map(attr => attr.name)\n .sort(),\n nodeIsFragment(node)\n ? {}\n : Array.from(node.attributes).reduce((props, attribute) => {\n props[attribute.name] = attribute.value;\n return props;\n }, {}),\n config,\n indentation + config.indent,\n depth,\n refs,\n printer\n ),\n (0, _markup.printChildren)(\n Array.prototype.slice.call(node.childNodes || node.children),\n config,\n indentation + config.indent,\n depth,\n refs,\n printer\n ),\n config,\n indentation\n );\n};\n\nexports.serialize = serialize;\nconst plugin = {\n serialize,\n test\n};\nvar _default = plugin;\nexports.default = _default;\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