main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
574 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
---|
| 4 | value: true
|
---|
| 5 | });
|
---|
| 6 | exports.default = annotateAsPure;
|
---|
| 7 | var _t = require("@babel/types");
|
---|
| 8 | const {
|
---|
| 9 | addComment
|
---|
| 10 | } = _t;
|
---|
| 11 | const PURE_ANNOTATION = "#__PURE__";
|
---|
| 12 | const isPureAnnotated = ({
|
---|
| 13 | leadingComments
|
---|
| 14 | }) => !!leadingComments && leadingComments.some(comment => /[@#]__PURE__/.test(comment.value));
|
---|
| 15 | function annotateAsPure(pathOrNode) {
|
---|
| 16 | const node = pathOrNode["node"] || pathOrNode;
|
---|
| 17 | if (isPureAnnotated(node)) {
|
---|
| 18 | return;
|
---|
| 19 | }
|
---|
| 20 | addComment(node, "leading", PURE_ANNOTATION);
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | //# sourceMappingURL=index.js.map
|
---|
Note:
See
TracBrowser
for help on using the repository browser.