1 |
- {"ast":null,"code":"'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\nexports.printText = exports.printProps = exports.printElementAsLeaf = exports.printElement = exports.printComment = exports.printChildren = void 0;\nvar _escapeHTML = _interopRequireDefault(require('./escapeHTML'));\nfunction _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\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// Return empty string if keys is empty.\nconst printProps = (keys, props, config, indentation, depth, refs, printer) => {\n const indentationNext = indentation + config.indent;\n const colors = config.colors;\n return keys.map(key => {\n const value = props[key];\n let printed = printer(value, config, indentationNext, depth, refs);\n if (typeof value !== 'string') {\n if (printed.indexOf('\\n') !== -1) {\n printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation;\n }\n printed = '{' + printed + '}';\n }\n return config.spacingInner + indentation + colors.prop.open + key + colors.prop.close + '=' + colors.value.open + printed + colors.value.close;\n }).join('');\n}; // Return empty string if children is empty.\n\nexports.printProps = printProps;\nconst printChildren = (children, config, indentation, depth, refs, printer) => children.map(child => config.spacingOuter + indentation + (typeof child === 'string' ? printText(child, config) : printer(child, config, indentation, depth, refs))).join('');\nexports.printChildren = printChildren;\nconst printText = (text, config) => {\n const contentColor = config.colors.content;\n return contentColor.open + (0, _escapeHTML.default)(text) + contentColor.close;\n};\nexports.printText = printText;\nconst printComment = (comment, config) => {\n const commentColor = config.colors.comment;\n return commentColor.open + '<!--' + (0, _escapeHTML.default)(comment) + '-->' + commentColor.close;\n}; // Separate the functions to format props, children, and element,\n// so a plugin could override a particular function, if needed.\n// Too bad, so sad: the traditional (but unnecessary) space\n// in a self-closing tagColor requires a second test of printedProps.\n\nexports.printComment = printComment;\nconst printElement = (type, printedProps, printedChildren, config, indentation) => {\n const tagColor = config.colors.tag;\n return tagColor.open + '<' + type + (printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open) + (printedChildren ? '>' + tagColor.close + printedChildren + config.spacingOuter + indentation + tagColor.open + '</' + type : (printedProps && !config.min ? '' : ' ') + '/') + '>' + tagColor.close;\n};\nexports.printElement = printElement;\nconst printElementAsLeaf = (type, config) => {\n const tagColor = config.colors.tag;\n return tagColor.open + '<' + type + tagColor.close + ' …' + tagColor.open + ' />' + tagColor.close;\n};\nexports.printElementAsLeaf = printElementAsLeaf;","map":{"version":3,"names":["Object","defineProperty","exports","value","printText","printProps","printElementAsLeaf","printElement","printComment","printChildren","_escapeHTML","_interopRequireDefault","require","obj","__esModule","default","keys","props","config","indentation","depth","refs","printer","indentationNext","indent","colors","map","key","printed","indexOf","spacingOuter","spacingInner","prop","open","close","join","children","child","text","contentColor","content","comment","commentColor","type","printedProps","printedChildren","tagColor","tag","min"],"sources":["/Users/max_liu/max_liu/company/tools_auto_pt/node_modules/pretty-format/build/plugins/lib/markup.js"],"sourcesContent":["'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\nexports.printText =\n exports.printProps =\n exports.printElementAsLeaf =\n exports.printElement =\n exports.printComment =\n exports.printChildren =\n void 0;\n\nvar _escapeHTML = _interopRequireDefault(require('./escapeHTML'));\n\nfunction _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {default: obj};\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// Return empty string if keys is empty.\nconst printProps = (keys, props, config, indentation, depth, refs, printer) => {\n const indentationNext = indentation + config.indent;\n const colors = config.colors;\n return keys\n .map(key => {\n const value = props[key];\n let printed = printer(value, config, indentationNext, depth, refs);\n\n if (typeof value !== 'string') {\n if (printed.indexOf('\\n') !== -1) {\n printed =\n config.spacingOuter +\n indentationNext +\n printed +\n config.spacingOuter +\n indentation;\n }\n\n printed = '{' + printed + '}';\n }\n\n return (\n config.spacingInner +\n indentation +\n colors.prop.open +\n key +\n colors.prop.close +\n '=' +\n colors.value.open +\n printed +\n colors.value.close\n );\n })\n .join('');\n}; // Return empty string if children is empty.\n\nexports.printProps = printProps;\n\nconst printChildren = (children, config, indentation, depth, refs, printer) =>\n children\n .map(\n child =>\n config.spacingOuter +\n indentation +\n (typeof child === 'string'\n ? printText(child, config)\n : printer(child, config, indentation, depth, refs))\n )\n .join('');\n\nexports.printChildren = printChildren;\n\nconst printText = (text, config) => {\n const contentColor = config.colors.content;\n return (\n contentColor.open + (0, _escapeHTML.default)(text) + contentColor.close\n );\n};\n\nexports.printText = printText;\n\nconst printComment = (comment, config) => {\n const commentColor = config.colors.comment;\n return (\n commentColor.open +\n '<!--' +\n (0, _escapeHTML.default)(comment) +\n '-->' +\n commentColor.close\n );\n}; // Separate the functions to format props, children, and element,\n// so a plugin could override a particular function, if needed.\n// Too bad, so sad: the traditional (but unnecessary) space\n// in a self-closing tagColor requires a second test of printedProps.\n\nexports.printComment = printComment;\n\nconst printElement = (\n type,\n printedProps,\n printedChildren,\n config,\n indentation\n) => {\n const tagColor = config.colors.tag;\n return (\n tagColor.open +\n '<' +\n type +\n (printedProps &&\n tagColor.close +\n printedProps +\n config.spacingOuter +\n indentation +\n tagColor.open) +\n (printedChildren\n ? '>' +\n tagColor.close +\n printedChildren +\n config.spacingOuter +\n indentation +\n tagColor.open +\n '</' +\n type\n : (printedProps && !config.min ? '' : ' ') + '/') +\n '>' +\n tagColor.close\n );\n};\n\nexports.printElement = printElement;\n\nconst printElementAsLeaf = (type, config) => {\n const tagColor = config.colors.tag;\n return (\n tagColor.open +\n '<' +\n type +\n tagColor.close +\n ' …' +\n tagColor.open +\n ' />' +\n tagColor.close\n );\n};\n\nexports.printElementAsLeaf = printElementAsLeaf;\n"],"mappings":"AAAA,YAAY;;AAEZA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAC3CC,KAAK,EAAE;AACT,CAAC,CAAC;AACFD,OAAO,CAACE,SAAS,GACfF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