@tinacms/app 0.0.28 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/appFiles/node_modules/.package-lock.json +10 -10
  2. package/appFiles/node_modules/@babel/generator/lib/generators/base.js.map +1 -1
  3. package/appFiles/node_modules/@babel/generator/lib/generators/classes.js +1 -1
  4. package/appFiles/node_modules/@babel/generator/lib/generators/classes.js.map +1 -1
  5. package/appFiles/node_modules/@babel/generator/lib/generators/expressions.js +9 -15
  6. package/appFiles/node_modules/@babel/generator/lib/generators/expressions.js.map +1 -1
  7. package/appFiles/node_modules/@babel/generator/lib/generators/methods.js +9 -24
  8. package/appFiles/node_modules/@babel/generator/lib/generators/methods.js.map +1 -1
  9. package/appFiles/node_modules/@babel/generator/lib/generators/modules.js +6 -14
  10. package/appFiles/node_modules/@babel/generator/lib/generators/modules.js.map +1 -1
  11. package/appFiles/node_modules/@babel/generator/lib/generators/statements.js +1 -16
  12. package/appFiles/node_modules/@babel/generator/lib/generators/statements.js.map +1 -1
  13. package/appFiles/node_modules/@babel/generator/lib/printer.js +89 -80
  14. package/appFiles/node_modules/@babel/generator/lib/printer.js.map +1 -1
  15. package/appFiles/node_modules/@babel/generator/package.json +3 -3
  16. package/appFiles/node_modules/@babel/parser/lib/index.js +1 -1
  17. package/appFiles/node_modules/@babel/parser/lib/index.js.map +1 -1
  18. package/appFiles/node_modules/@babel/parser/package.json +1 -1
  19. package/appFiles/node_modules/@babel/parser/typings/babel-parser.d.ts +92 -80
  20. package/appFiles/node_modules/@babel/parser/typings/babel-parser.source.d.ts +151 -0
  21. package/appFiles/node_modules/@babel/types/lib/asserts/assertNode.js +0 -3
  22. package/appFiles/node_modules/@babel/types/lib/asserts/assertNode.js.map +1 -1
  23. package/appFiles/node_modules/@babel/types/lib/asserts/generated/index.js +0 -303
  24. package/appFiles/node_modules/@babel/types/lib/asserts/generated/index.js.map +1 -1
  25. package/appFiles/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js +0 -4
  26. package/appFiles/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js.map +1 -1
  27. package/appFiles/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js +0 -11
  28. package/appFiles/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js.map +1 -1
  29. package/appFiles/node_modules/@babel/types/lib/builders/generated/index.js +0 -253
  30. package/appFiles/node_modules/@babel/types/lib/builders/generated/index.js.map +1 -1
  31. package/appFiles/node_modules/@babel/types/lib/builders/generated/uppercase.js +0 -1
  32. package/appFiles/node_modules/@babel/types/lib/builders/generated/uppercase.js.map +1 -1
  33. package/appFiles/node_modules/@babel/types/lib/builders/react/buildChildren.js +0 -7
  34. package/appFiles/node_modules/@babel/types/lib/builders/react/buildChildren.js.map +1 -1
  35. package/appFiles/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js +0 -5
  36. package/appFiles/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js.map +1 -1
  37. package/appFiles/node_modules/@babel/types/lib/builders/validateNode.js +0 -5
  38. package/appFiles/node_modules/@babel/types/lib/builders/validateNode.js.map +1 -1
  39. package/appFiles/node_modules/@babel/types/lib/clone/clone.js +0 -2
  40. package/appFiles/node_modules/@babel/types/lib/clone/clone.js.map +1 -1
  41. package/appFiles/node_modules/@babel/types/lib/clone/cloneDeep.js +0 -2
  42. package/appFiles/node_modules/@babel/types/lib/clone/cloneDeep.js.map +1 -1
  43. package/appFiles/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js +0 -2
  44. package/appFiles/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js.map +1 -1
  45. package/appFiles/node_modules/@babel/types/lib/clone/cloneNode.js +4 -22
  46. package/appFiles/node_modules/@babel/types/lib/clone/cloneNode.js.map +1 -1
  47. package/appFiles/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js +0 -2
  48. package/appFiles/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js.map +1 -1
  49. package/appFiles/node_modules/@babel/types/lib/comments/addComment.js +0 -2
  50. package/appFiles/node_modules/@babel/types/lib/comments/addComment.js.map +1 -1
  51. package/appFiles/node_modules/@babel/types/lib/comments/addComments.js +0 -3
  52. package/appFiles/node_modules/@babel/types/lib/comments/addComments.js.map +1 -1
  53. package/appFiles/node_modules/@babel/types/lib/comments/inheritInnerComments.js +0 -2
  54. package/appFiles/node_modules/@babel/types/lib/comments/inheritInnerComments.js.map +1 -1
  55. package/appFiles/node_modules/@babel/types/lib/comments/inheritLeadingComments.js +0 -2
  56. package/appFiles/node_modules/@babel/types/lib/comments/inheritLeadingComments.js.map +1 -1
  57. package/appFiles/node_modules/@babel/types/lib/comments/inheritTrailingComments.js +0 -2
  58. package/appFiles/node_modules/@babel/types/lib/comments/inheritTrailingComments.js.map +1 -1
  59. package/appFiles/node_modules/@babel/types/lib/comments/inheritsComments.js +0 -4
  60. package/appFiles/node_modules/@babel/types/lib/comments/inheritsComments.js.map +1 -1
  61. package/appFiles/node_modules/@babel/types/lib/comments/removeComments.js +0 -3
  62. package/appFiles/node_modules/@babel/types/lib/comments/removeComments.js.map +1 -1
  63. package/appFiles/node_modules/@babel/types/lib/constants/generated/index.js +0 -1
  64. package/appFiles/node_modules/@babel/types/lib/constants/generated/index.js.map +1 -1
  65. package/appFiles/node_modules/@babel/types/lib/constants/index.js.map +1 -1
  66. package/appFiles/node_modules/@babel/types/lib/converters/ensureBlock.js +0 -2
  67. package/appFiles/node_modules/@babel/types/lib/converters/ensureBlock.js.map +1 -1
  68. package/appFiles/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js +2 -12
  69. package/appFiles/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js.map +1 -1
  70. package/appFiles/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js +0 -2
  71. package/appFiles/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js.map +1 -1
  72. package/appFiles/node_modules/@babel/types/lib/converters/toBlock.js +0 -7
  73. package/appFiles/node_modules/@babel/types/lib/converters/toBlock.js.map +1 -1
  74. package/appFiles/node_modules/@babel/types/lib/converters/toComputedKey.js +2 -4
  75. package/appFiles/node_modules/@babel/types/lib/converters/toComputedKey.js.map +1 -1
  76. package/appFiles/node_modules/@babel/types/lib/converters/toExpression.js +0 -4
  77. package/appFiles/node_modules/@babel/types/lib/converters/toExpression.js.map +1 -1
  78. package/appFiles/node_modules/@babel/types/lib/converters/toIdentifier.js +2 -6
  79. package/appFiles/node_modules/@babel/types/lib/converters/toIdentifier.js.map +1 -1
  80. package/appFiles/node_modules/@babel/types/lib/converters/toKeyAlias.js +0 -7
  81. package/appFiles/node_modules/@babel/types/lib/converters/toKeyAlias.js.map +1 -1
  82. package/appFiles/node_modules/@babel/types/lib/converters/toSequenceExpression.js +0 -3
  83. package/appFiles/node_modules/@babel/types/lib/converters/toSequenceExpression.js.map +1 -1
  84. package/appFiles/node_modules/@babel/types/lib/converters/toStatement.js +1 -7
  85. package/appFiles/node_modules/@babel/types/lib/converters/toStatement.js.map +1 -1
  86. package/appFiles/node_modules/@babel/types/lib/converters/valueToNode.js +2 -18
  87. package/appFiles/node_modules/@babel/types/lib/converters/valueToNode.js.map +1 -1
  88. package/appFiles/node_modules/@babel/types/lib/definitions/core.js +33 -61
  89. package/appFiles/node_modules/@babel/types/lib/definitions/core.js.map +1 -1
  90. package/appFiles/node_modules/@babel/types/lib/definitions/experimental.js +3 -1
  91. package/appFiles/node_modules/@babel/types/lib/definitions/experimental.js.map +1 -1
  92. package/appFiles/node_modules/@babel/types/lib/definitions/flow.js +1 -3
  93. package/appFiles/node_modules/@babel/types/lib/definitions/flow.js.map +1 -1
  94. package/appFiles/node_modules/@babel/types/lib/definitions/index.js +0 -18
  95. package/appFiles/node_modules/@babel/types/lib/definitions/index.js.map +1 -1
  96. package/appFiles/node_modules/@babel/types/lib/definitions/jsx.js +0 -1
  97. package/appFiles/node_modules/@babel/types/lib/definitions/jsx.js.map +1 -1
  98. package/appFiles/node_modules/@babel/types/lib/definitions/misc.js +0 -2
  99. package/appFiles/node_modules/@babel/types/lib/definitions/misc.js.map +1 -1
  100. package/appFiles/node_modules/@babel/types/lib/definitions/placeholders.js +0 -5
  101. package/appFiles/node_modules/@babel/types/lib/definitions/placeholders.js.map +1 -1
  102. package/appFiles/node_modules/@babel/types/lib/definitions/typescript.js +4 -15
  103. package/appFiles/node_modules/@babel/types/lib/definitions/typescript.js.map +1 -1
  104. package/appFiles/node_modules/@babel/types/lib/definitions/utils.js +1 -65
  105. package/appFiles/node_modules/@babel/types/lib/definitions/utils.js.map +1 -1
  106. package/appFiles/node_modules/@babel/types/lib/index.d.ts +0 -1
  107. package/appFiles/node_modules/@babel/types/lib/index.js +1 -75
  108. package/appFiles/node_modules/@babel/types/lib/index.js.map +1 -1
  109. package/appFiles/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js +0 -2
  110. package/appFiles/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js.map +1 -1
  111. package/appFiles/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js +3 -12
  112. package/appFiles/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js.map +1 -1
  113. package/appFiles/node_modules/@babel/types/lib/modifications/inherits.js +0 -4
  114. package/appFiles/node_modules/@babel/types/lib/modifications/inherits.js.map +1 -1
  115. package/appFiles/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js +0 -4
  116. package/appFiles/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js.map +1 -1
  117. package/appFiles/node_modules/@babel/types/lib/modifications/removeProperties.js +3 -8
  118. package/appFiles/node_modules/@babel/types/lib/modifications/removeProperties.js.map +1 -1
  119. package/appFiles/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js +0 -3
  120. package/appFiles/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js.map +1 -1
  121. package/appFiles/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js +1 -10
  122. package/appFiles/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js.map +1 -1
  123. package/appFiles/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js +4 -14
  124. package/appFiles/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js.map +1 -1
  125. package/appFiles/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js +0 -3
  126. package/appFiles/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js.map +1 -1
  127. package/appFiles/node_modules/@babel/types/lib/traverse/traverse.js +0 -7
  128. package/appFiles/node_modules/@babel/types/lib/traverse/traverse.js.map +1 -1
  129. package/appFiles/node_modules/@babel/types/lib/traverse/traverseFast.js +2 -5
  130. package/appFiles/node_modules/@babel/types/lib/traverse/traverseFast.js.map +1 -1
  131. package/appFiles/node_modules/@babel/types/lib/utils/inherit.js +0 -1
  132. package/appFiles/node_modules/@babel/types/lib/utils/inherit.js.map +1 -1
  133. package/appFiles/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js +1 -8
  134. package/appFiles/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js.map +1 -1
  135. package/appFiles/node_modules/@babel/types/lib/utils/shallowEqual.js +2 -4
  136. package/appFiles/node_modules/@babel/types/lib/utils/shallowEqual.js.map +1 -1
  137. package/appFiles/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js +0 -2
  138. package/appFiles/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js.map +1 -1
  139. package/appFiles/node_modules/@babel/types/lib/validators/generated/index.js +0 -906
  140. package/appFiles/node_modules/@babel/types/lib/validators/generated/index.js.map +1 -1
  141. package/appFiles/node_modules/@babel/types/lib/validators/is.js +0 -8
  142. package/appFiles/node_modules/@babel/types/lib/validators/is.js.map +1 -1
  143. package/appFiles/node_modules/@babel/types/lib/validators/isBinding.js +4 -8
  144. package/appFiles/node_modules/@babel/types/lib/validators/isBinding.js.map +1 -1
  145. package/appFiles/node_modules/@babel/types/lib/validators/isBlockScoped.js +0 -3
  146. package/appFiles/node_modules/@babel/types/lib/validators/isBlockScoped.js.map +1 -1
  147. package/appFiles/node_modules/@babel/types/lib/validators/isImmutable.js +0 -5
  148. package/appFiles/node_modules/@babel/types/lib/validators/isImmutable.js.map +1 -1
  149. package/appFiles/node_modules/@babel/types/lib/validators/isLet.js +2 -4
  150. package/appFiles/node_modules/@babel/types/lib/validators/isLet.js.map +1 -1
  151. package/appFiles/node_modules/@babel/types/lib/validators/isNode.js +0 -2
  152. package/appFiles/node_modules/@babel/types/lib/validators/isNode.js.map +1 -1
  153. package/appFiles/node_modules/@babel/types/lib/validators/isNodesEquivalent.js +2 -16
  154. package/appFiles/node_modules/@babel/types/lib/validators/isNodesEquivalent.js.map +1 -1
  155. package/appFiles/node_modules/@babel/types/lib/validators/isPlaceholderType.js +0 -4
  156. package/appFiles/node_modules/@babel/types/lib/validators/isPlaceholderType.js.map +1 -1
  157. package/appFiles/node_modules/@babel/types/lib/validators/isReferenced.js +0 -13
  158. package/appFiles/node_modules/@babel/types/lib/validators/isReferenced.js.map +1 -1
  159. package/appFiles/node_modules/@babel/types/lib/validators/isScope.js +0 -3
  160. package/appFiles/node_modules/@babel/types/lib/validators/isScope.js.map +1 -1
  161. package/appFiles/node_modules/@babel/types/lib/validators/isSpecifierDefault.js +2 -3
  162. package/appFiles/node_modules/@babel/types/lib/validators/isSpecifierDefault.js.map +1 -1
  163. package/appFiles/node_modules/@babel/types/lib/validators/isType.js +1 -5
  164. package/appFiles/node_modules/@babel/types/lib/validators/isType.js.map +1 -1
  165. package/appFiles/node_modules/@babel/types/lib/validators/isValidES3Identifier.js +0 -2
  166. package/appFiles/node_modules/@babel/types/lib/validators/isValidES3Identifier.js.map +1 -1
  167. package/appFiles/node_modules/@babel/types/lib/validators/isValidIdentifier.js +0 -4
  168. package/appFiles/node_modules/@babel/types/lib/validators/isValidIdentifier.js.map +1 -1
  169. package/appFiles/node_modules/@babel/types/lib/validators/isVar.js +2 -4
  170. package/appFiles/node_modules/@babel/types/lib/validators/isVar.js.map +1 -1
  171. package/appFiles/node_modules/@babel/types/lib/validators/matchesPattern.js +0 -8
  172. package/appFiles/node_modules/@babel/types/lib/validators/matchesPattern.js.map +1 -1
  173. package/appFiles/node_modules/@babel/types/lib/validators/react/isCompatTag.js +0 -1
  174. package/appFiles/node_modules/@babel/types/lib/validators/react/isCompatTag.js.map +1 -1
  175. package/appFiles/node_modules/@babel/types/lib/validators/react/isReactComponent.js +0 -2
  176. package/appFiles/node_modules/@babel/types/lib/validators/react/isReactComponent.js.map +1 -1
  177. package/appFiles/node_modules/@babel/types/lib/validators/validate.js +0 -4
  178. package/appFiles/node_modules/@babel/types/lib/validators/validate.js.map +1 -1
  179. package/appFiles/node_modules/@babel/types/package.json +3 -3
  180. package/package.json +4 -4
  181. package/appFiles/node_modules/@babel/types/lib/index.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["isFor","isForStatement","isIfStatement","isStatement","WithStatement","node","word","space","token","print","object","printBlock","IfStatement","test","needsBlock","alternate","getLastStatement","consequent","newline","indent","printAndIndentOnComments","dedent","endsWith","statement","body","ForStatement","inForStatementInitCounter","init","update","WhileStatement","ForXStatement","isForOf","type","await","noIndentInnerCommentsHere","left","right","ForInStatement","ForOfStatement","DoWhileStatement","semicolon","printStatementAfterKeyword","printer","parent","isLabel","printTerminatorless","BreakStatement","label","ContinueStatement","ReturnStatement","argument","ThrowStatement","LabeledStatement","TryStatement","block","handlers","handler","finalizer","CatchClause","param","typeAnnotation","SwitchStatement","discriminant","printSequence","cases","addNewlines","leading","cas","length","SwitchCase","DebuggerStatement","VariableDeclaration","declare","kind","_noLineTerminator","hasInits","declar","declarations","iterator","_","i","printList","separator","undefined","VariableDeclarator","id","definite"],"sources":["../../src/generators/statements.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport type { PrintJoinOptions } from \"../printer\";\nimport {\n isFor,\n isForStatement,\n isIfStatement,\n isStatement,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport * as charCodes from \"charcodes\";\n\nexport function WithStatement(this: Printer, node: t.WithStatement) {\n this.word(\"with\");\n this.space();\n this.token(\"(\");\n this.print(node.object, node);\n this.token(\")\");\n this.printBlock(node);\n}\n\nexport function IfStatement(this: Printer, node: t.IfStatement) {\n this.word(\"if\");\n this.space();\n this.token(\"(\");\n this.print(node.test, node);\n this.token(\")\");\n this.space();\n\n const needsBlock =\n node.alternate && isIfStatement(getLastStatement(node.consequent));\n if (needsBlock) {\n this.token(\"{\");\n this.newline();\n this.indent();\n }\n\n this.printAndIndentOnComments(node.consequent, node);\n\n if (needsBlock) {\n this.dedent();\n this.newline();\n this.token(\"}\");\n }\n\n if (node.alternate) {\n if (this.endsWith(charCodes.rightCurlyBrace)) this.space();\n this.word(\"else\");\n this.space();\n this.printAndIndentOnComments(node.alternate, node);\n }\n}\n\n// Recursively get the last statement.\nfunction getLastStatement(statement: t.Statement): t.Statement {\n // @ts-expect-error: If statement.body is empty or not a Node, isStatement will return false\n const { body } = statement;\n if (isStatement(body) === false) {\n return statement;\n }\n\n return getLastStatement(body);\n}\n\nexport function ForStatement(this: Printer, node: t.ForStatement) {\n this.word(\"for\");\n this.space();\n this.token(\"(\");\n\n this.inForStatementInitCounter++;\n this.print(node.init, node);\n this.inForStatementInitCounter--;\n this.token(\";\");\n\n if (node.test) {\n this.space();\n this.print(node.test, node);\n }\n this.token(\";\");\n\n if (node.update) {\n this.space();\n this.print(node.update, node);\n }\n\n this.token(\")\");\n this.printBlock(node);\n}\n\nexport function WhileStatement(this: Printer, node: t.WhileStatement) {\n this.word(\"while\");\n this.space();\n this.token(\"(\");\n this.print(node.test, node);\n this.token(\")\");\n this.printBlock(node);\n}\n\nfunction ForXStatement(this: Printer, node: t.ForXStatement) {\n this.word(\"for\");\n this.space();\n const isForOf = node.type === \"ForOfStatement\";\n if (isForOf && node.await) {\n this.word(\"await\");\n this.space();\n }\n this.noIndentInnerCommentsHere();\n this.token(\"(\");\n this.print(node.left, node);\n this.space();\n this.word(isForOf ? \"of\" : \"in\");\n this.space();\n this.print(node.right, node);\n this.token(\")\");\n this.printBlock(node);\n}\n\nexport const ForInStatement = ForXStatement;\nexport const ForOfStatement = ForXStatement;\n\nexport function DoWhileStatement(this: Printer, node: t.DoWhileStatement) {\n this.word(\"do\");\n this.space();\n this.print(node.body, node);\n this.space();\n this.word(\"while\");\n this.space();\n this.token(\"(\");\n this.print(node.test, node);\n this.token(\")\");\n this.semicolon();\n}\n\nfunction printStatementAfterKeyword(\n printer: Printer,\n node: t.Node,\n parent: t.Node,\n isLabel: boolean,\n) {\n if (node) {\n printer.space();\n printer.printTerminatorless(node, parent, isLabel);\n }\n\n printer.semicolon();\n}\n\nexport function BreakStatement(this: Printer, node: t.ContinueStatement) {\n this.word(\"break\");\n printStatementAfterKeyword(this, node.label, node, true);\n}\n\nexport function ContinueStatement(this: Printer, node: t.ContinueStatement) {\n this.word(\"continue\");\n printStatementAfterKeyword(this, node.label, node, true);\n}\n\nexport function ReturnStatement(this: Printer, node: t.ReturnStatement) {\n this.word(\"return\");\n printStatementAfterKeyword(this, node.argument, node, false);\n}\n\nexport function ThrowStatement(this: Printer, node: t.ThrowStatement) {\n this.word(\"throw\");\n printStatementAfterKeyword(this, node.argument, node, false);\n}\n\nexport function LabeledStatement(this: Printer, node: t.LabeledStatement) {\n this.print(node.label, node);\n this.token(\":\");\n this.space();\n this.print(node.body, node);\n}\n\nexport function TryStatement(this: Printer, node: t.TryStatement) {\n this.word(\"try\");\n this.space();\n this.print(node.block, node);\n this.space();\n\n // Esprima bug puts the catch clause in a `handlers` array.\n // see https://code.google.com/p/esprima/issues/detail?id=433\n // We run into this from regenerator generated ast.\n // @ts-expect-error todo(flow->ts) should ast node type be updated to support this?\n if (node.handlers) {\n // @ts-expect-error todo(flow->ts) should ast node type be updated to support this?\n this.print(node.handlers[0], node);\n } else {\n this.print(node.handler, node);\n }\n\n if (node.finalizer) {\n this.space();\n this.word(\"finally\");\n this.space();\n this.print(node.finalizer, node);\n }\n}\n\nexport function CatchClause(this: Printer, node: t.CatchClause) {\n this.word(\"catch\");\n this.space();\n if (node.param) {\n this.token(\"(\");\n this.print(node.param, node);\n this.print(node.param.typeAnnotation, node);\n this.token(\")\");\n this.space();\n }\n this.print(node.body, node);\n}\n\nexport function SwitchStatement(this: Printer, node: t.SwitchStatement) {\n this.word(\"switch\");\n this.space();\n this.token(\"(\");\n this.print(node.discriminant, node);\n this.token(\")\");\n this.space();\n this.token(\"{\");\n\n this.printSequence(node.cases, node, {\n indent: true,\n addNewlines(leading, cas) {\n if (!leading && node.cases[node.cases.length - 1] === cas) return -1;\n },\n });\n\n this.token(\"}\");\n}\n\nexport function SwitchCase(this: Printer, node: t.SwitchCase) {\n if (node.test) {\n this.word(\"case\");\n this.space();\n this.print(node.test, node);\n this.token(\":\");\n } else {\n this.word(\"default\");\n this.token(\":\");\n }\n\n if (node.consequent.length) {\n this.newline();\n this.printSequence(node.consequent, node, { indent: true });\n }\n}\n\nexport function DebuggerStatement(this: Printer) {\n this.word(\"debugger\");\n this.semicolon();\n}\n\nexport function VariableDeclaration(\n this: Printer,\n node: t.VariableDeclaration,\n parent: t.Node,\n) {\n if (node.declare) {\n // TS\n this.word(\"declare\");\n this.space();\n }\n\n const { kind } = node;\n this.word(kind);\n const { _noLineTerminator } = this;\n if (kind === \"using\") {\n // ensure no line break after `using`\n this._noLineTerminator = true;\n }\n this.space();\n\n let hasInits = false;\n // don't add whitespace to loop heads\n if (!isFor(parent)) {\n for (const declar of node.declarations) {\n if (declar.init) {\n // has an init so let's split it up over multiple lines\n hasInits = true;\n }\n }\n }\n\n //\n // use a pretty separator when we aren't in compact mode, have initializers and don't have retainLines on\n // this will format declarations like:\n //\n // let foo = \"bar\", bar = \"foo\";\n //\n // into\n //\n // let foo = \"bar\",\n // bar = \"foo\";\n //\n\n let iterator: PrintJoinOptions[\"iterator\"] | undefined;\n if (kind === \"using\") {\n // Ensure no line break between `using` and the first declarator\n iterator = (_, i: number) => {\n if (i === 0) {\n this._noLineTerminator = _noLineTerminator;\n }\n };\n }\n\n this.printList(node.declarations, node, {\n separator: hasInits\n ? function (this: Printer) {\n this.token(\",\");\n this.newline();\n }\n : undefined,\n iterator,\n indent: node.declarations.length > 1 ? true : false,\n });\n\n if (isFor(parent)) {\n // don't give semicolons to these nodes since they'll be inserted in the parent generator\n if (isForStatement(parent)) {\n if (parent.init === node) return;\n } else {\n if (parent.left === node) return;\n }\n }\n\n this.semicolon();\n}\n\nexport function VariableDeclarator(this: Printer, node: t.VariableDeclarator) {\n this.print(node.id, node);\n if (node.definite) this.token(\"!\"); // TS\n // @ts-expect-error todo(flow-ts) Property 'typeAnnotation' does not exist on type 'MemberExpression'.\n this.print(node.id.typeAnnotation, node);\n if (node.init) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.init, node);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAEA;AAKsB;EAJpBA,KAAK;EACLC,cAAc;EACdC,aAAa;EACbC;AAAW;AAKN,SAASC,aAAa,CAAgBC,IAAqB,EAAE;EAClE,IAAI,CAACC,IAAI,CAAC,MAAM,CAAC;EACjB,IAAI,CAACC,KAAK,EAAE;EACZ,IAAI,CAACC,SAAK,IAAK;EACf,IAAI,CAACC,KAAK,CAACJ,IAAI,CAACK,MAAM,EAAEL,IAAI,CAAC;EAC7B,IAAI,CAACG,SAAK,IAAK;EACf,IAAI,CAACG,UAAU,CAACN,IAAI,CAAC;AACvB;AAEO,SAASO,WAAW,CAAgBP,IAAmB,EAAE;EAC9D,IAAI,CAACC,IAAI,CAAC,IAAI,CAAC;EACf,IAAI,CAACC,KAAK,EAAE;EACZ,IAAI,CAACC,SAAK,IAAK;EACf,IAAI,CAACC,KAAK,CAACJ,IAAI,CAACQ,IAAI,EAAER,IAAI,CAAC;EAC3B,IAAI,CAACG,SAAK,IAAK;EACf,IAAI,CAACD,KAAK,EAAE;EAEZ,MAAMO,UAAU,GACdT,IAA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KAAK,EAAE;IACZ,IAAI,CAACC,SAAK,IAAK;IACf,IAAI,CAACD,KAAK,EAAE;IACZ,IAAI,CAACE,KAAK,CAACJ,IAAI,CAACsB,IAAI,EAAEtB,IAAI,CAAC;EAC7B;AACF"}
1
+ {"version":3,"names":["isFor","isForStatement","isIfStatement","isStatement","WithStatement","node","word","space","token","print","object","printBlock","IfStatement","test","needsBlock","alternate","getLastStatement","consequent","newline","indent","printAndIndentOnComments","dedent","endsWith","statement","body","ForStatement","inForStatementInitCounter","init","update","WhileStatement","ForXStatement","isForOf","type","await","noIndentInnerCommentsHere","left","right","ForInStatement","ForOfStatement","DoWhileStatement","semicolon","printStatementAfterKeyword","printer","parent","isLabel","printTerminatorless","BreakStatement","label","ContinueStatement","ReturnStatement","argument","ThrowStatement","LabeledStatement","TryStatement","block","handlers","handler","finalizer","CatchClause","param","typeAnnotation","SwitchStatement","discriminant","printSequence","cases","addNewlines","leading","cas","length","SwitchCase","DebuggerStatement","VariableDeclaration","declare","kind","hasInits","declar","declarations","printList","separator","undefined","VariableDeclarator","id","definite"],"sources":["../../src/generators/statements.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport {\n isFor,\n isForStatement,\n isIfStatement,\n isStatement,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport * as charCodes from \"charcodes\";\n\nexport function WithStatement(this: Printer, node: t.WithStatement) {\n this.word(\"with\");\n this.space();\n this.token(\"(\");\n this.print(node.object, node);\n this.token(\")\");\n this.printBlock(node);\n}\n\nexport function IfStatement(this: Printer, node: t.IfStatement) {\n this.word(\"if\");\n this.space();\n this.token(\"(\");\n this.print(node.test, node);\n this.token(\")\");\n this.space();\n\n const needsBlock =\n node.alternate && isIfStatement(getLastStatement(node.consequent));\n if (needsBlock) {\n this.token(\"{\");\n this.newline();\n this.indent();\n }\n\n this.printAndIndentOnComments(node.consequent, node);\n\n if (needsBlock) {\n this.dedent();\n this.newline();\n this.token(\"}\");\n }\n\n if (node.alternate) {\n if (this.endsWith(charCodes.rightCurlyBrace)) this.space();\n this.word(\"else\");\n this.space();\n this.printAndIndentOnComments(node.alternate, node);\n }\n}\n\n// Recursively get the last statement.\nfunction getLastStatement(statement: t.Statement): t.Statement {\n // @ts-expect-error: If statement.body is empty or not a Node, isStatement will return false\n const { body } = statement;\n if (isStatement(body) === false) {\n return statement;\n }\n\n return getLastStatement(body);\n}\n\nexport function ForStatement(this: Printer, node: t.ForStatement) {\n this.word(\"for\");\n this.space();\n this.token(\"(\");\n\n this.inForStatementInitCounter++;\n this.print(node.init, node);\n this.inForStatementInitCounter--;\n this.token(\";\");\n\n if (node.test) {\n this.space();\n this.print(node.test, node);\n }\n this.token(\";\");\n\n if (node.update) {\n this.space();\n this.print(node.update, node);\n }\n\n this.token(\")\");\n this.printBlock(node);\n}\n\nexport function WhileStatement(this: Printer, node: t.WhileStatement) {\n this.word(\"while\");\n this.space();\n this.token(\"(\");\n this.print(node.test, node);\n this.token(\")\");\n this.printBlock(node);\n}\n\nfunction ForXStatement(this: Printer, node: t.ForXStatement) {\n this.word(\"for\");\n this.space();\n const isForOf = node.type === \"ForOfStatement\";\n if (isForOf && node.await) {\n this.word(\"await\");\n this.space();\n }\n this.noIndentInnerCommentsHere();\n this.token(\"(\");\n this.print(node.left, node);\n this.space();\n this.word(isForOf ? \"of\" : \"in\");\n this.space();\n this.print(node.right, node);\n this.token(\")\");\n this.printBlock(node);\n}\n\nexport const ForInStatement = ForXStatement;\nexport const ForOfStatement = ForXStatement;\n\nexport function DoWhileStatement(this: Printer, node: t.DoWhileStatement) {\n this.word(\"do\");\n this.space();\n this.print(node.body, node);\n this.space();\n this.word(\"while\");\n this.space();\n this.token(\"(\");\n this.print(node.test, node);\n this.token(\")\");\n this.semicolon();\n}\n\nfunction printStatementAfterKeyword(\n printer: Printer,\n node: t.Node,\n parent: t.Node,\n isLabel: boolean,\n) {\n if (node) {\n printer.space();\n printer.printTerminatorless(node, parent, isLabel);\n }\n\n printer.semicolon();\n}\n\nexport function BreakStatement(this: Printer, node: t.ContinueStatement) {\n this.word(\"break\");\n printStatementAfterKeyword(this, node.label, node, true);\n}\n\nexport function ContinueStatement(this: Printer, node: t.ContinueStatement) {\n this.word(\"continue\");\n printStatementAfterKeyword(this, node.label, node, true);\n}\n\nexport function ReturnStatement(this: Printer, node: t.ReturnStatement) {\n this.word(\"return\");\n printStatementAfterKeyword(this, node.argument, node, false);\n}\n\nexport function ThrowStatement(this: Printer, node: t.ThrowStatement) {\n this.word(\"throw\");\n printStatementAfterKeyword(this, node.argument, node, false);\n}\n\nexport function LabeledStatement(this: Printer, node: t.LabeledStatement) {\n this.print(node.label, node);\n this.token(\":\");\n this.space();\n this.print(node.body, node);\n}\n\nexport function TryStatement(this: Printer, node: t.TryStatement) {\n this.word(\"try\");\n this.space();\n this.print(node.block, node);\n this.space();\n\n // Esprima bug puts the catch clause in a `handlers` array.\n // see https://code.google.com/p/esprima/issues/detail?id=433\n // We run into this from regenerator generated ast.\n // @ts-expect-error todo(flow->ts) should ast node type be updated to support this?\n if (node.handlers) {\n // @ts-expect-error todo(flow->ts) should ast node type be updated to support this?\n this.print(node.handlers[0], node);\n } else {\n this.print(node.handler, node);\n }\n\n if (node.finalizer) {\n this.space();\n this.word(\"finally\");\n this.space();\n this.print(node.finalizer, node);\n }\n}\n\nexport function CatchClause(this: Printer, node: t.CatchClause) {\n this.word(\"catch\");\n this.space();\n if (node.param) {\n this.token(\"(\");\n this.print(node.param, node);\n this.print(node.param.typeAnnotation, node);\n this.token(\")\");\n this.space();\n }\n this.print(node.body, node);\n}\n\nexport function SwitchStatement(this: Printer, node: t.SwitchStatement) {\n this.word(\"switch\");\n this.space();\n this.token(\"(\");\n this.print(node.discriminant, node);\n this.token(\")\");\n this.space();\n this.token(\"{\");\n\n this.printSequence(node.cases, node, {\n indent: true,\n addNewlines(leading, cas) {\n if (!leading && node.cases[node.cases.length - 1] === cas) return -1;\n },\n });\n\n this.token(\"}\");\n}\n\nexport function SwitchCase(this: Printer, node: t.SwitchCase) {\n if (node.test) {\n this.word(\"case\");\n this.space();\n this.print(node.test, node);\n this.token(\":\");\n } else {\n this.word(\"default\");\n this.token(\":\");\n }\n\n if (node.consequent.length) {\n this.newline();\n this.printSequence(node.consequent, node, { indent: true });\n }\n}\n\nexport function DebuggerStatement(this: Printer) {\n this.word(\"debugger\");\n this.semicolon();\n}\n\nexport function VariableDeclaration(\n this: Printer,\n node: t.VariableDeclaration,\n parent: t.Node,\n) {\n if (node.declare) {\n // TS\n this.word(\"declare\");\n this.space();\n }\n\n const { kind } = node;\n this.word(kind, kind === \"using\");\n this.space();\n\n let hasInits = false;\n // don't add whitespace to loop heads\n if (!isFor(parent)) {\n for (const declar of node.declarations) {\n if (declar.init) {\n // has an init so let's split it up over multiple lines\n hasInits = true;\n }\n }\n }\n\n //\n // use a pretty separator when we aren't in compact mode, have initializers and don't have retainLines on\n // this will format declarations like:\n //\n // let foo = \"bar\", bar = \"foo\";\n //\n // into\n //\n // let foo = \"bar\",\n // bar = \"foo\";\n //\n\n this.printList(node.declarations, node, {\n separator: hasInits\n ? function (this: Printer) {\n this.token(\",\");\n this.newline();\n }\n : undefined,\n indent: node.declarations.length > 1 ? true : false,\n });\n\n if (isFor(parent)) {\n // don't give semicolons to these nodes since they'll be inserted in the parent generator\n if (isForStatement(parent)) {\n if (parent.init === node) return;\n } else {\n if (parent.left === node) return;\n }\n }\n\n this.semicolon();\n}\n\nexport function VariableDeclarator(this: Printer, node: t.VariableDeclarator) {\n this.print(node.id, node);\n if (node.definite) this.token(\"!\"); // TS\n // @ts-expect-error todo(flow-ts) Property 'typeAnnotation' does not exist on type 'MemberExpression'.\n this.print(node.id.typeAnnotation, node);\n if (node.init) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.init, node);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;AAKsB;EAJpBA,KAAK;EACLC,cAAc;EACdC,aAAa;EACbC;AAAW;AAKN,SAASC,aAAa,CAAgBC,IAAqB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EAAE5E,IAAI,CAAC;EACzB,IAAIA,IAAI,CAAC6E,QAAQ,EAAE,IAAI,CAAC1E,SAAK,IAAK;EAElC,IAAI,CAACC,KAAK,CAACJ,IAAI,CAAC4E,EAAE,CAACrB,cAAc,EAAEvD,IAAI,CAAC;EACxC,IAAIA,IAAI,CAACsB,IAAI,EAAE;IACb,IAAI,CAACpB,KAAK,EAAE;IACZ,IAAI,CAACC,SAAK,IAAK;IACf,IAAI,CAACD,KAAK,EAAE;IACZ,IAAI,CAACE,KAAK,CAACJ,IAAI,CAACsB,IAAI,EAAEtB,IAAI,CAAC;EAC7B;AACF"}
@@ -18,6 +18,8 @@ const SCIENTIFIC_NOTATION = /e/i;
18
18
  const ZERO_DECIMAL_INTEGER = /\.0+$/;
19
19
  const NON_DECIMAL_LITERAL = /^0[box]/;
20
20
  const PURE_ANNOTATION_RE = /^\s*[@#]__PURE__\s*$/;
21
+ const HAS_NEWLINE = /[\n\r\u2028\u2029]/;
22
+ const HAS_BlOCK_COMMENT_END = /\*\//;
21
23
  const {
22
24
  needsParens
23
25
  } = n;
@@ -66,6 +68,7 @@ class Printer {
66
68
  } else {
67
69
  this._queue(59);
68
70
  }
71
+ this._noLineTerminator = false;
69
72
  }
70
73
 
71
74
  rightBrace() {
@@ -87,7 +90,7 @@ class Printer {
87
90
  }
88
91
  }
89
92
 
90
- word(str) {
93
+ word(str, noLineTerminatorAfter = false) {
91
94
  this._maybePrintInnerComments();
92
95
 
93
96
  if (this._endsWithWord || str.charCodeAt(0) === 47 && this.endsWith(47)) {
@@ -96,6 +99,7 @@ class Printer {
96
99
  this._maybeAddAuxComment();
97
100
  this._append(str, false);
98
101
  this._endsWithWord = true;
102
+ this._noLineTerminator = noLineTerminatorAfter;
99
103
  }
100
104
 
101
105
  number(str) {
@@ -116,6 +120,7 @@ class Printer {
116
120
  }
117
121
  this._maybeAddAuxComment();
118
122
  this._append(str, maybeNewline);
123
+ this._noLineTerminator = false;
119
124
  }
120
125
  tokenChar(char) {
121
126
  this._maybePrintInnerComments();
@@ -128,6 +133,7 @@ class Printer {
128
133
  }
129
134
  this._maybeAddAuxComment();
130
135
  this._appendChar(char);
136
+ this._noLineTerminator = false;
131
137
  }
132
138
 
133
139
  newline(i = 1, force) {
@@ -290,19 +296,10 @@ class Printer {
290
296
  _getIndent() {
291
297
  return this._indentRepeat * this._indent;
292
298
  }
293
- ensureNoLineTerminator(fn) {
294
- const {
295
- _noLineTerminator
296
- } = this;
297
- this._noLineTerminator = true;
298
- fn();
299
- this._noLineTerminator = _noLineTerminator;
300
- }
301
299
  printTerminatorless(node, parent, isLabel) {
302
300
  if (isLabel) {
303
- this.ensureNoLineTerminator(() => {
304
- this.print(node, parent);
305
- });
301
+ this._noLineTerminator = true;
302
+ this.print(node, parent);
306
303
  } else {
307
304
  const terminatorState = {
308
305
  printed: false
@@ -316,7 +313,7 @@ class Printer {
316
313
  }
317
314
  }
318
315
  }
319
- print(node, parent, noLineTerminator,
316
+ print(node, parent, noLineTerminatorAfter,
320
317
  trailingCommentsLineOffset, forceParens) {
321
318
  if (!node) return;
322
319
  this._endsWithInnerRaw = false;
@@ -348,14 +345,16 @@ class Printer {
348
345
  this._printLeadingComments(node, parent);
349
346
  const loc = nodeType === "Program" || nodeType === "File" ? null : node.loc;
350
347
  this.exactSource(loc, printMethod.bind(this, node, parent));
351
- if (noLineTerminator && !this._noLineTerminator) {
348
+ if (shouldPrintParens) {
349
+ this._printTrailingComments(node, parent);
350
+ this.tokenChar(41);
351
+ this._noLineTerminator = noLineTerminatorAfter;
352
+ } else if (noLineTerminatorAfter && !this._noLineTerminator) {
352
353
  this._noLineTerminator = true;
353
354
  this._printTrailingComments(node, parent);
354
- this._noLineTerminator = false;
355
355
  } else {
356
356
  this._printTrailingComments(node, parent, trailingCommentsLineOffset);
357
357
  }
358
- if (shouldPrintParens) this.tokenChar(41);
359
358
 
360
359
  this._printStack.pop();
361
360
  format.concise = oldConcise;
@@ -503,10 +502,15 @@ class Printer {
503
502
  this.newline(1);
504
503
  }
505
504
  }
505
+
506
506
  _printComment(comment, skipNewLines) {
507
- if (comment.ignore) return;
508
- if (this._printedComments.has(comment)) return;
509
- if (!this.format.shouldPrintComment(comment.value)) return;
507
+ if (comment.ignore) return false;
508
+ if (this._printedComments.has(comment)) return false;
509
+ const noLineTerminator = this._noLineTerminator;
510
+ if (noLineTerminator && (HAS_NEWLINE.test(comment.value) || HAS_BlOCK_COMMENT_END.test(comment.value))) {
511
+ return true;
512
+ }
513
+ if (!this.format.shouldPrintComment(comment.value)) return false;
510
514
  this._printedComments.add(comment);
511
515
  const isBlockComment = comment.type === "CommentBlock";
512
516
 
@@ -534,7 +538,7 @@ class Printer {
534
538
  }
535
539
  val = val.replace(/\n(?!$)/g, `\n${" ".repeat(indentSize)}`);
536
540
  }
537
- } else if (!this._noLineTerminator) {
541
+ } else if (!noLineTerminator) {
538
542
  val = `//${comment.value}`;
539
543
  } else {
540
544
  val = `/*${comment.value}*/`;
@@ -543,83 +547,88 @@ class Printer {
543
547
  if (this.endsWith(47)) this._space();
544
548
  this.source("start", comment.loc);
545
549
  this._append(val, isBlockComment);
546
- if (!isBlockComment && !this._noLineTerminator) {
550
+ if (!isBlockComment && !noLineTerminator) {
547
551
  this.newline(1, true);
548
552
  }
549
553
  if (printNewLines && skipNewLines !== 3) {
550
554
  this.newline(1);
551
555
  }
556
+ return false;
552
557
  }
553
558
  _printComments(type, comments, node, parent, lineOffset = 0) {
554
- {
555
- const nodeLoc = node.loc;
556
- const len = comments.length;
557
- let hasLoc = !!nodeLoc;
558
- const nodeStartLine = hasLoc ? nodeLoc.start.line : 0;
559
- const nodeEndLine = hasLoc ? nodeLoc.end.line : 0;
560
- let lastLine = 0;
561
- let leadingCommentNewline = 0;
562
- for (let i = 0; i < len; i++) {
563
- const comment = comments[i];
564
- if (hasLoc && comment.loc && !this._printedComments.has(comment)) {
565
- const commentStartLine = comment.loc.start.line;
566
- const commentEndLine = comment.loc.end.line;
567
- if (type === 0) {
568
- let offset = 0;
569
- if (i === 0) {
570
- if (this._buf.hasContent() && (comment.type === "CommentLine" || commentStartLine != commentEndLine)) {
571
- offset = leadingCommentNewline = 1;
572
- }
573
- } else {
574
- offset = commentStartLine - lastLine;
575
- }
576
- lastLine = commentEndLine;
577
- this.newline(offset);
578
- this._printComment(comment, 1);
579
- if (i + 1 === len) {
580
- this.newline(Math.max(nodeStartLine - lastLine, leadingCommentNewline));
581
- lastLine = nodeStartLine;
582
- }
583
- } else if (type === 1) {
584
- const offset = commentStartLine - (i === 0 ? nodeStartLine : lastLine);
585
- lastLine = commentEndLine;
586
- this.newline(offset);
587
- this._printComment(comment, 1);
588
- if (i + 1 === len) {
589
- this.newline(Math.min(1, nodeEndLine - lastLine));
590
- lastLine = nodeEndLine;
559
+ const nodeLoc = node.loc;
560
+ const len = comments.length;
561
+ let hasLoc = !!nodeLoc;
562
+ const nodeStartLine = hasLoc ? nodeLoc.start.line : 0;
563
+ const nodeEndLine = hasLoc ? nodeLoc.end.line : 0;
564
+ let lastLine = 0;
565
+ let leadingCommentNewline = 0;
566
+ const maybeNewline = this._noLineTerminator ? function () {} : this.newline.bind(this);
567
+ for (let i = 0; i < len; i++) {
568
+ const comment = comments[i];
569
+ const printed = this._printedComments.has(comment);
570
+ if (hasLoc && comment.loc && !printed) {
571
+ const commentStartLine = comment.loc.start.line;
572
+ const commentEndLine = comment.loc.end.line;
573
+ if (type === 0) {
574
+ let offset = 0;
575
+ if (i === 0) {
576
+ if (this._buf.hasContent() && (comment.type === "CommentLine" || commentStartLine != commentEndLine)) {
577
+ offset = leadingCommentNewline = 1;
591
578
  }
592
579
  } else {
593
- const offset = commentStartLine - (i === 0 ? nodeEndLine - lineOffset : lastLine);
594
- lastLine = commentEndLine;
595
- this.newline(offset);
596
- this._printComment(comment, 1);
580
+ offset = commentStartLine - lastLine;
581
+ }
582
+ lastLine = commentEndLine;
583
+ maybeNewline(offset);
584
+ this._printComment(comment, 1);
585
+ if (i + 1 === len) {
586
+ maybeNewline(Math.max(nodeStartLine - lastLine, leadingCommentNewline));
587
+ lastLine = nodeStartLine;
588
+ }
589
+ } else if (type === 1) {
590
+ const offset = commentStartLine - (i === 0 ? nodeStartLine : lastLine);
591
+ lastLine = commentEndLine;
592
+ maybeNewline(offset);
593
+ if (this._printComment(comment, 1)) break;
594
+ if (i + 1 === len) {
595
+ maybeNewline(Math.min(1, nodeEndLine - lastLine));
596
+ lastLine = nodeEndLine;
597
597
  }
598
598
  } else {
599
- hasLoc = false;
600
- if (len === 1) {
601
- const singleLine = comment.loc ? comment.loc.start.line === comment.loc.end.line : !comment.value.includes("\n");
602
- const shouldSkipNewline = singleLine && !isStatement(node) && !isClassBody(parent) && !isTSInterfaceBody(parent);
603
- if (type === 0) {
604
- this._printComment(comment, shouldSkipNewline && node.type !== "ObjectExpression" || singleLine && isFunction(parent, {
605
- body: node
606
- }) ? 1 : 0);
607
- } else if (shouldSkipNewline && type === 2) {
608
- this._printComment(comment, 1);
609
- } else {
610
- this._printComment(comment, 0);
599
+ const offset = commentStartLine - (i === 0 ? nodeEndLine - lineOffset : lastLine);
600
+ lastLine = commentEndLine;
601
+ maybeNewline(offset);
602
+ this._printComment(comment, 1);
603
+ }
604
+ } else {
605
+ hasLoc = false;
606
+ if (printed) continue;
607
+ if (len === 1) {
608
+ const singleLine = comment.loc ? comment.loc.start.line === comment.loc.end.line : !HAS_NEWLINE.test(comment.value);
609
+ const shouldSkipNewline = singleLine && !isStatement(node) && !isClassBody(parent) && !isTSInterfaceBody(parent);
610
+ if (type === 0) {
611
+ this._printComment(comment, shouldSkipNewline && node.type !== "ObjectExpression" || singleLine && isFunction(parent, {
612
+ body: node
613
+ }) ? 1 : 0);
614
+ } else if (shouldSkipNewline && type === 2) {
615
+ if (this._printComment(comment, 1)) {
616
+ break;
611
617
  }
612
- } else if (type === 1 && !(node.type === "ObjectExpression" && node.properties.length > 1) && node.type !== "ClassBody" && node.type !== "TSInterfaceBody") {
613
-
614
- this._printComment(comment, i === 0 ? 2 : i === len - 1 ? 3 : 0);
615
618
  } else {
616
619
  this._printComment(comment, 0);
617
620
  }
621
+ } else if (type === 1 && !(node.type === "ObjectExpression" && node.properties.length > 1) && node.type !== "ClassBody" && node.type !== "TSInterfaceBody") {
622
+
623
+ const skippedDueToNewline = this._printComment(comment, i === 0 ? 2 : i === len - 1 ? 3 : 0);
624
+ if (skippedDueToNewline) break;
625
+ } else {
626
+ this._printComment(comment, 0);
618
627
  }
619
628
  }
620
- if (type === 2 && hasLoc && lastLine) {
621
- this._lastCommentLine = lastLine;
622
- }
629
+ }
630
+ if (type === 2 && hasLoc && lastLine) {
631
+ this._lastCommentLine = lastLine;
623
632
  }
624
633
  }
625
634
  }