1 line
1.3 KiB
Plaintext
1 line
1.3 KiB
Plaintext
{"version":3,"names":["_t","require","addComment","PURE_ANNOTATION","isPureAnnotated","leadingComments","some","comment","test","value","annotateAsPure","pathOrNode","node"],"sources":["../src/index.ts"],"sourcesContent":["import { addComment, type Node } from \"@babel/types\";\nimport type { NodePath } from \"@babel/traverse\";\n\nconst PURE_ANNOTATION = \"#__PURE__\";\n\nconst isPureAnnotated = ({ leadingComments }: Node): boolean =>\n !!leadingComments &&\n leadingComments.some(comment => /[@#]__PURE__/.test(comment.value));\n\nexport default function annotateAsPure(pathOrNode: Node | NodePath): void {\n const node =\n // @ts-expect-error Node will not have `node` property\n (pathOrNode[\"node\"] || pathOrNode) as Node;\n if (isPureAnnotated(node)) {\n return;\n }\n addComment(node, \"leading\", PURE_ANNOTATION);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAAqD;EAA5CC;AAAU,IAAAF,EAAA;AAGnB,MAAMG,eAAe,GAAG,WAAW;AAEnC,MAAMC,eAAe,GAAGA,CAAC;EAAEC;AAAsB,CAAC,KAChD,CAAC,CAACA,eAAe,IACjBA,eAAe,CAACC,IAAI,CAACC,OAAO,IAAI,cAAc,CAACC,IAAI,CAACD,OAAO,CAACE,KAAK,CAAC,CAAC;AAEtD,SAASC,cAAcA,CAACC,UAA2B,EAAQ;EACxE,MAAMC,IAAI,GAEPD,UAAU,CAAC,MAAM,CAAC,IAAIA,UAAmB;EAC5C,IAAIP,eAAe,CAACQ,IAAI,CAAC,EAAE;IACzB;EACF;EACAV,UAAU,CAACU,IAAI,EAAE,SAAS,EAAET,eAAe,CAAC;AAC9C"} |