You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
6.8 KiB
1 line
6.8 KiB
1 month ago
|
{"version":3,"names":["JSXAttribute","node","print","name","value","token","JSXIdentifier","word","JSXNamespacedName","namespace","JSXMemberExpression","object","property","JSXSpreadAttribute","argument","rightBrace","JSXExpressionContainer","expression","JSXSpreadChild","JSXText","raw","getPossibleRaw","undefined","JSXElement","open","openingElement","selfClosing","indent","child","children","dedent","closingElement","spaceSeparator","space","JSXOpeningElement","typeParameters","attributes","length","printJoin","separator","JSXClosingElement","JSXEmptyExpression","printInnerComments","JSXFragment","openingFragment","closingFragment","JSXOpeningFragment","JSXClosingFragment"],"sources":["../../src/generators/jsx.ts"],"sourcesContent":["import type Printer from \"../printer.ts\";\nimport type * as t from \"@babel/types\";\n\nexport function JSXAttribute(this: Printer, node: t.JSXAttribute) {\n this.print(node.name);\n if (node.value) {\n this.token(\"=\");\n this.print(node.value);\n }\n}\n\nexport function JSXIdentifier(this: Printer, node: t.JSXIdentifier) {\n this.word(node.name);\n}\n\nexport function JSXNamespacedName(this: Printer, node: t.JSXNamespacedName) {\n this.print(node.namespace);\n this.token(\":\");\n this.print(node.name);\n}\n\nexport function JSXMemberExpression(\n this: Printer,\n node: t.JSXMemberExpression,\n) {\n this.print(node.object);\n this.token(\".\");\n this.print(node.property);\n}\n\nexport function JSXSpreadAttribute(this: Printer, node: t.JSXSpreadAttribute) {\n this.token(\"{\");\n this.token(\"...\");\n this.print(node.argument);\n this.rightBrace(node);\n}\n\nexport function JSXExpressionContainer(\n this: Printer,\n node: t.JSXExpressionContainer,\n) {\n this.token(\"{\");\n this.print(node.expression);\n this.rightBrace(node);\n}\n\nexport function JSXSpreadChild(this: Printer, node: t.JSXSpreadChild) {\n this.token(\"{\");\n this.token(\"...\");\n this.print(node.expression);\n this.rightBrace(node);\n}\n\nexport function JSXText(this: Printer, node: t.JSXText) {\n const raw = this.getPossibleRaw(node);\n\n if (raw !== undefined) {\n this.token(raw, true);\n } else {\n this.token(node.value, true);\n }\n}\n\nexport function JSXElement(this: Printer, node: t.JSXElement) {\n const open = node.openingElement;\n this.print(open);\n if (open.selfClosing) return;\n\n this.indent();\n for (const child of node.children) {\n this.print(child);\n }\n this.dedent();\n\n this.print(node.closingElement);\n}\n\nfunction spaceSeparator(this: Printer) {\n this.space();\n}\n\nexport function JSXOpeningElement(this: Printer, node: t.JSXOpeningElement) {\n this.token(\"<\");\n this.print(node.name);\n this.print(node.typeParameters); // TS\n if (node.attributes.length > 0) {\n this.space();\n this.printJoin(node.attributes, { separator: spaceSeparator });\n }\n if (node.selfClosing) {\n this.space();\n this.token(\"/>\");\n } else {\n this.token(\">\");\n }\n}\n\nexport function JSXClosingElement(this: Printer, node: t.JSXClosingElement) {\n this.token(\"</\");\n this.print(node.name);\n this.token(\">\");\n}\n\nexport function JSXEmptyExpression(this: Printer) {\n // This node is empty, so forcefully print its inner comments.\n this.printInnerComments();\n}\n\nexport function JSXFragment(this: Printer, node: t.JSXFragment) {\n this.print(node.openingFragment);\n\n this.indent();\n for (const child of node.children) {\n this.print(child);\n }\n this.dedent();\n\n this.print(node.closingFragment);\n}\n\nexport function JSXOpeningFragment(this: Printer) {\n this.token(\"<\");\n this.token(\">\");\n}\n\nexport function JSXClosingFragment(this: Printer) {\n this.token(\"</\");\n this.token(\">\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAGO,SAASA,YAAYA,CAAgBC,IAAoB,EAAE;EAChE,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,IAAI,CAAC;EACrB,IAAIF,IAAI,CAACG,KAAK,EAAE;IACd,IAAI,CAACC,SAAK,GAAI,CAAC;IACf,IAAI,CAACH,KAAK,CAACD,IAAI,CAACG,KAAK,CAAC;EACxB;AACF;AAEO,SAASE,aAAaA,CAAgBL,IAAqB,EAAE;EAClE,IAAI,CAACM,IAAI,CAACN,IAAI,CAACE
|