Urara-Blog/node_modules/.pnpm-store/v3/files/a0/3524a40ffd4a796929f9e0125f6c80e843a02599939d927c5c4206ab5da714b5b0837c7b2cafce0ba395e18d64f775e292e3743522dfc8a06bb798fa031120
2022-08-14 01:14:53 +08:00

27 lines
No EOL
544 B
Text

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = annotateAsPure;
var _t = require("@babel/types");
const {
addComment
} = _t;
const PURE_ANNOTATION = "#__PURE__";
const isPureAnnotated = ({
leadingComments
}) => !!leadingComments && leadingComments.some(comment => /[@#]__PURE__/.test(comment.value));
function annotateAsPure(pathOrNode) {
const node = pathOrNode["node"] || pathOrNode;
if (isPureAnnotated(node)) {
return;
}
addComment(node, "leading", PURE_ANNOTATION);
}