challenge-algorithms-v2.0-D.../node_modules/@babel/traverse/lib/path/comments.js.map

1 line
2.6 KiB
Plaintext
Raw Normal View History

2022-10-27 19:56:30 +00:00
{"version":3,"names":["addComment","_addComment","addComments","_addComments","shareCommentsWithSiblings","key","node","trailing","trailingComments","leading","leadingComments","prev","getSibling","next","hasPrev","Boolean","hasNext","type","content","line","comments"],"sources":["../../src/path/comments.ts"],"sourcesContent":["// This file contains methods responsible for dealing with comments.\nimport type * as t from \"@babel/types\";\nimport type NodePath from \"./index\";\nimport {\n addComment as _addComment,\n addComments as _addComments,\n} from \"@babel/types\";\n\n/**\n * Share comments amongst siblings.\n */\n\nexport function shareCommentsWithSiblings(this: NodePath) {\n // NOTE: this assumes numbered keys\n if (typeof this.key === \"string\") return;\n\n const node = this.node;\n if (!node) return;\n\n const trailing = node.trailingComments;\n const leading = node.leadingComments;\n if (!trailing && !leading) return;\n\n const prev = this.getSibling(this.key - 1);\n const next = this.getSibling(this.key + 1);\n const hasPrev = Boolean(prev.node);\n const hasNext = Boolean(next.node);\n if (hasPrev && !hasNext) {\n prev.addComments(\"trailing\", trailing);\n } else if (hasNext && !hasPrev) {\n next.addComments(\"leading\", leading);\n }\n}\n\nexport function addComment(\n this: NodePath,\n type: t.CommentTypeShorthand,\n content: string,\n line?: boolean,\n) {\n _addComment(this.node, type, content, line);\n}\n\n/**\n * Give node `comments` of the specified `type`.\n */\n\nexport function addComments(\n this: NodePath,\n type: t.CommentTypeShorthand,\n comments: t.Comment[],\n) {\n _addComments(this.node, type, comments);\n}\n"],"mappings":";;;;;;;;;AAGA;;;EACEA,U,EAAcC,W;EACdC,W,EAAeC;;;AAOV,SAASC,yBAAT,GAAmD;EAExD,IAAI,OAAO,KAAKC,GAAZ,KAAoB,QAAxB,EAAkC;EAElC,MAAMC,IAAI,GAAG,KAAKA,IAAlB;EACA,IAAI,CAACA,IAAL,EAAW;EAEX,MAAMC,QAAQ,GAAGD,IAAI,CAACE,gBAAtB;EACA,MAAMC,OAAO,GAAGH,IAAI,CAACI,eAArB;EACA,IAAI,CAACH,QAAD,IAAa,CAACE,OAAlB,EAA2B;EAE3B,MAAME,IAAI,GAAG,KAAKC,UAAL,CAAgB,KAAKP,GAAL,GAAW,CAA3B,CAAb;EACA,MAAMQ,IAAI,GAAG,KAAKD,UAAL,CAAgB,KAAKP,GAAL,GAAW,CAA3B,CAAb;EACA,MAAMS,OAAO,GAAGC,OAAO,CAACJ,IAAI,CAACL,IAAN,CAAvB;EACA,MAAMU,OAAO,GAAGD,OAAO,CAACF,IAAI,CAACP,IAAN,CAAvB;;EACA,IAAIQ,OAAO,IAAI,CAACE,OAAhB,EAAyB;IACvBL,IAAI,CAACT,WAAL,CAAiB,UAAjB,EAA6BK,QAA7B;EACD,CAFD,MAEO,IAAIS,OAAO,IAAI,CAACF,OAAhB,EAAyB;IAC9BD,IAAI,CAACX,WAAL,CAAiB,SAAjB,EAA4BO,OAA5B;EACD;AACF;;AAEM,SAAST,UAAT,CAELiB,IAFK,EAGLC,OAHK,EAILC,IAJK,EAKL;EACAlB,WAAW,CAAC,KAAKK,IAAN,EAAYW,IAAZ,EAAkBC,OAAlB,EAA2BC,IAA3B,CAAX;AACD;;AAMM,SAASjB,WAAT,CAELe,IAFK,EAGLG,QAHK,EAIL;EACAjB,YAAY,CAAC,KAAKG,IAAN,EAAYW,IAAZ,EAAkBG,QAAlB,CAAZ;AACD"}