babel-plugin-vasille 3.1.0 → 3.1.5

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.
package/lib/call.js CHANGED
@@ -1,6 +1,43 @@
1
- import * as t from "@babel/types";
2
- import { ctx } from "./internal.js";
3
- export const composeOnly = [
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.requiresContext = exports.styleOnly = exports.composeOnly = void 0;
37
+ exports.calls = calls;
38
+ const t = __importStar(require("@babel/types"));
39
+ const internal_js_1 = require("./internal.js");
40
+ exports.composeOnly = [
4
41
  "forward",
5
42
  "watch",
6
43
  "ref",
@@ -12,7 +49,7 @@ export const composeOnly = [
12
49
  "setModel",
13
50
  "reactiveObject",
14
51
  ];
15
- export const styleOnly = [
52
+ exports.styleOnly = [
16
53
  "theme",
17
54
  "dark",
18
55
  "mobile",
@@ -22,9 +59,9 @@ export const styleOnly = [
22
59
  "prefersLight",
23
60
  "styleSheet",
24
61
  ];
25
- export const requiresContext = ["awaited"];
26
- const requiresContextSet = new Set(requiresContext);
27
- export function calls(node, names, internal) {
62
+ exports.requiresContext = ["awaited"];
63
+ const requiresContextSet = new Set(exports.requiresContext);
64
+ function calls(node, names, internal) {
28
65
  const set = new Set(names);
29
66
  const callee = t.isCallExpression(node) ? node.callee : null;
30
67
  if (callee) {
@@ -32,12 +69,12 @@ export function calls(node, names, internal) {
32
69
  const mapped = internal.mapping.get(callee.name);
33
70
  if (mapped && set.has(mapped) && internal.stack.get(callee.name) === undefined) {
34
71
  if (requiresContextSet.has(callee.name) && t.isCallExpression(node)) {
35
- node.arguments.unshift(ctx);
72
+ node.arguments.unshift(internal_js_1.ctx);
36
73
  }
37
- if (mapped === "state") {
74
+ if (mapped === "store") {
38
75
  internal.stateOnly = true;
39
76
  }
40
- if (mapped === "compose" || mapped === "extend") {
77
+ if (mapped === "compose") {
41
78
  internal.stateOnly = false;
42
79
  }
43
80
  return mapped;
@@ -57,7 +94,7 @@ export function calls(node, names, internal) {
57
94
  if (t.isMemberExpression(callee) && t.isIdentifier(callee.object) && propName) {
58
95
  if (global && callee.object.name === internal.global && set.has(propName)) {
59
96
  if (requiresContextSet.has(propName) && t.isCallExpression(node)) {
60
- node.arguments.unshift(ctx);
97
+ node.arguments.unshift(internal_js_1.ctx);
61
98
  }
62
99
  return callee.object.name;
63
100
  }
@@ -1,5 +1,41 @@
1
- import * as t from "@babel/types";
2
- import { calls } from "./call.js";
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.findStyleInNode = findStyleInNode;
37
+ const t = __importStar(require("@babel/types"));
38
+ const call_js_1 = require("./call.js");
3
39
  function tryProcessProp(path, pseudo, media, internal) {
4
40
  if (t.isObjectMethod(path.node)) {
5
41
  throw path.buildCodeFrameError("Vasille: Object methods not supported here");
@@ -11,7 +47,7 @@ function tryProcessProp(path, pseudo, media, internal) {
11
47
  }
12
48
  const mediaDefaults = ["mobile", "tablet", "laptop", "prefersDark", "prefersLight"];
13
49
  function processValue(name, path, pseudo, theme, media, mediaDefault, allowFallback, internal) {
14
- if (calls(path.node, ["theme"], internal)) {
50
+ if ((0, call_js_1.calls)(path.node, ["theme"], internal)) {
15
51
  const call = path.node;
16
52
  if (theme) {
17
53
  throw path.buildCodeFrameError("Vasille: The theme seems the be defined twice");
@@ -25,14 +61,14 @@ function processValue(name, path, pseudo, theme, media, mediaDefault, allowFallb
25
61
  .buildCodeFrameError("Vasille: Expected string literal");
26
62
  }
27
63
  }
28
- if (calls(path.node, ["dark"], internal)) {
64
+ if ((0, call_js_1.calls)(path.node, ["dark"], internal)) {
29
65
  if (theme) {
30
66
  throw path.buildCodeFrameError("Vasille: The theme seem the be defined twice");
31
67
  }
32
68
  return processValue(name, path.get("arguments")[0], pseudo, `.dark`, media, mediaDefault, false, internal);
33
69
  }
34
70
  let callee;
35
- if ((callee = calls(path.node, mediaDefaults, internal))) {
71
+ if ((callee = (0, call_js_1.calls)(path.node, mediaDefaults, internal))) {
36
72
  const index = mediaDefaults.indexOf(callee) + 1;
37
73
  if (mediaDefault.includes(index)) {
38
74
  return processValue(name, path.get("arguments")[0], pseudo, theme, media, mediaDefault, false, internal);
@@ -136,13 +172,13 @@ function processProp(path, pseudo, media, internal) {
136
172
  }
137
173
  return processValue(name, path.get("value"), pseudo, "", media, [], true, internal);
138
174
  }
139
- export function findStyleInNode(path, internal) {
175
+ function findStyleInNode(path, internal) {
140
176
  if (t.isExportNamedDeclaration(path.node)) {
141
177
  return findStyleInNode(path.get("declaration"), internal);
142
178
  }
143
179
  if (t.isVariableDeclaration(path.node) &&
144
180
  path.node.declarations.length === 1 &&
145
- calls(path.node.declarations[0].init, ["styleSheet"], internal)) {
181
+ (0, call_js_1.calls)(path.node.declarations[0].init, ["styleSheet"], internal)) {
146
182
  const call = path.node.declarations[0].init;
147
183
  const callPath = path
148
184
  .get("declarations")[0]
package/lib/expression.js CHANGED
@@ -1,7 +1,56 @@
1
- import * as t from "@babel/types";
2
- import { calls, composeOnly } from "./call.js";
3
- import { VariableScope } from "./internal.js";
4
- export function encodeName(name) {
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.encodeName = encodeName;
37
+ exports.idIsIValue = idIsIValue;
38
+ exports.idIsLocal = idIsLocal;
39
+ exports.memberIsIValue = memberIsIValue;
40
+ exports.nodeIsReactiveObject = nodeIsReactiveObject;
41
+ exports.checkNode = checkNode;
42
+ exports.checkOrIgnoreAllExpressions = checkOrIgnoreAllExpressions;
43
+ exports.checkAllExpressions = checkAllExpressions;
44
+ exports.checkAllUnknown = checkAllUnknown;
45
+ exports.checkOrIgnoreExpression = checkOrIgnoreExpression;
46
+ exports.checkExpression = checkExpression;
47
+ exports.checkStatements = checkStatements;
48
+ exports.checkStatement = checkStatement;
49
+ exports.checkFunction = checkFunction;
50
+ const t = __importStar(require("@babel/types"));
51
+ const call_js_1 = require("./call.js");
52
+ const internal_js_1 = require("./internal.js");
53
+ function encodeName(name) {
5
54
  return t.identifier(`Vasille_${name}`);
6
55
  }
7
56
  function addIdentifier(path, search) {
@@ -36,7 +85,7 @@ function extractMemberName(path, search) {
36
85
  }
37
86
  names.push(stringify(it));
38
87
  if (t.isIdentifier(it) &&
39
- search.stack.get(it.name, VariableScope.Local) === 1 /* VariableState.Ignored */) {
88
+ search.stack.get(it.name, internal_js_1.VariableScope.Local) === 1 /* VariableState.Ignored */) {
40
89
  throw path.buildCodeFrameError("Vasille: This node cannot be processed, the root of expression is a local variable");
41
90
  }
42
91
  return names.reverse().join("_");
@@ -60,15 +109,15 @@ function meshIdentifier(path, internal) {
60
109
  path.replaceWith(t.memberExpression(path.node, t.identifier("$")));
61
110
  }
62
111
  }
63
- export function idIsIValue(path, internal, scope) {
112
+ function idIsIValue(path, internal, scope) {
64
113
  const node = path.node;
65
114
  return (REACTIVE_STATES.includes(internal.stack.get(node.name, scope)) &&
66
115
  (!t.isMemberExpression(path.parent) || path.parent.object === node));
67
116
  }
68
- export function idIsLocal(path, internal) {
69
- return internal.stack.get(path.node.name, VariableScope.Local) !== undefined;
117
+ function idIsLocal(path, internal) {
118
+ return internal.stack.get(path.node.name, internal_js_1.VariableScope.Local) !== undefined;
70
119
  }
71
- export function memberIsIValue(node, internal, scope) {
120
+ function memberIsIValue(node, internal, scope) {
72
121
  return ((t.isIdentifier(node.object) &&
73
122
  (internal.stack.get(node.object.name, scope) === 3 /* VariableState.ReactiveObject */ ||
74
123
  (t.isIdentifier(node.property) &&
@@ -83,7 +132,7 @@ export function memberIsIValue(node, internal, scope) {
83
132
  ((t.isIdentifier(node.object.property) && node.object.property.name.startsWith("$$")) ||
84
133
  (t.isStringLiteral(node.object.property) && node.object.property.value.startsWith("$$")))));
85
134
  }
86
- export function nodeIsReactiveObject(path, internal) {
135
+ function nodeIsReactiveObject(path, internal) {
87
136
  const node = path.node;
88
137
  if (t.isIdentifier(node)) {
89
138
  return internal.stack.get(node.name) === 3 /* VariableState.ReactiveObject */;
@@ -117,7 +166,7 @@ function meshLValue(path, internal) {
117
166
  meshLValue(path.get("argument"), internal);
118
167
  }
119
168
  }
120
- export function checkNode(path, internal) {
169
+ function checkNode(path, internal) {
121
170
  const search = {
122
171
  external: internal,
123
172
  found: new Map(),
@@ -149,19 +198,19 @@ export function checkNode(path, internal) {
149
198
  internal.stack.resetLocalIndex();
150
199
  return search;
151
200
  }
152
- export function checkOrIgnoreAllExpressions(nodePaths, search) {
201
+ function checkOrIgnoreAllExpressions(nodePaths, search) {
153
202
  for (const path of nodePaths) {
154
203
  if (t.isExpression(path.node)) {
155
204
  checkExpression(path, search);
156
205
  }
157
206
  }
158
207
  }
159
- export function checkAllExpressions(nodePaths, search) {
208
+ function checkAllExpressions(nodePaths, search) {
160
209
  for (const path of nodePaths) {
161
210
  checkExpression(path, search);
162
211
  }
163
212
  }
164
- export function checkAllUnknown(paths, internal) {
213
+ function checkAllUnknown(paths, internal) {
165
214
  for (const path of paths) {
166
215
  if (t.isSpreadElement(path.node)) {
167
216
  checkExpression(path.get("argument"), internal);
@@ -171,13 +220,13 @@ export function checkAllUnknown(paths, internal) {
171
220
  }
172
221
  }
173
222
  }
174
- export function checkOrIgnoreExpression(path, search) {
223
+ function checkOrIgnoreExpression(path, search) {
175
224
  if (t.isExpression(path.node)) {
176
225
  checkExpression(path, search);
177
226
  }
178
227
  }
179
228
  const REACTIVE_STATES = [2 /* VariableState.Reactive */, 4 /* VariableState.ReactivePointer */];
180
- export function checkExpression(nodePath, search) {
229
+ function checkExpression(nodePath, search) {
181
230
  const expr = nodePath.node;
182
231
  switch (expr && expr.type) {
183
232
  case "TemplateLiteral": {
@@ -193,7 +242,7 @@ export function checkExpression(nodePath, search) {
193
242
  }
194
243
  case "Identifier": {
195
244
  if (expr && t.isIdentifier(expr)) {
196
- if (idIsIValue(nodePath, search.external, VariableScope.Global) &&
245
+ if (idIsIValue(nodePath, search.external, internal_js_1.VariableScope.Global) &&
197
246
  !idIsLocal(nodePath, search.external)) {
198
247
  addIdentifier(nodePath, search);
199
248
  }
@@ -207,7 +256,7 @@ export function checkExpression(nodePath, search) {
207
256
  }
208
257
  case "CallExpression": {
209
258
  const path = nodePath;
210
- if (calls(path.node, composeOnly, search.external)) {
259
+ if ((0, call_js_1.calls)(path.node, call_js_1.composeOnly, search.external)) {
211
260
  throw path.buildCodeFrameError("Vasille: Usage of hints is restricted here");
212
261
  }
213
262
  checkOrIgnoreExpression(path.get("callee"), search);
@@ -230,7 +279,7 @@ export function checkExpression(nodePath, search) {
230
279
  case "OptionalMemberExpression": {
231
280
  const path = nodePath;
232
281
  const node = path.node;
233
- if (memberIsIValue(node, search.external, VariableScope.Global)) {
282
+ if (memberIsIValue(node, search.external, internal_js_1.VariableScope.Global)) {
234
283
  addMemberExpr(path, search);
235
284
  }
236
285
  else if (t.isIdentifier(node.property) && node.property.name === "$") {
@@ -352,7 +401,7 @@ export function checkExpression(nodePath, search) {
352
401
  }
353
402
  }
354
403
  }
355
- export function checkStatements(paths, search) {
404
+ function checkStatements(paths, search) {
356
405
  for (const path of paths) {
357
406
  checkStatement(path, search);
358
407
  }
@@ -389,7 +438,7 @@ function ignoreLocals(val, search) {
389
438
  }
390
439
  }
391
440
  }
392
- export function checkStatement(path, search) {
441
+ function checkStatement(path, search) {
393
442
  const statement = path.node;
394
443
  if (!statement) {
395
444
  return;
@@ -509,7 +558,7 @@ export function checkStatement(path, search) {
509
558
  }
510
559
  }
511
560
  }
512
- export function checkFunction(path, search) {
561
+ function checkFunction(path, search) {
513
562
  const node = path.node;
514
563
  for (const param of node.params) {
515
564
  ignoreLocals(param, search);
package/lib/index.js CHANGED
@@ -1,10 +1,13 @@
1
- import { trProgram } from "./transformer.js";
2
- export default function () {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = default_1;
4
+ const transformer_js_1 = require("./transformer.js");
5
+ function default_1() {
3
6
  return {
4
7
  name: "Vasille",
5
8
  visitor: {
6
9
  Program(path, params) {
7
- trProgram(path, params.opts.devMode !== false);
10
+ (0, transformer_js_1.trProgram)(path, params.opts.devMode !== false);
8
11
  },
9
12
  },
10
13
  };
package/lib/internal.js CHANGED
@@ -1,11 +1,47 @@
1
- import * as t from "@babel/types";
2
- export var VariableScope;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ctx = exports.StackedStates = exports.VariableScope = void 0;
37
+ const t = __importStar(require("@babel/types"));
38
+ var VariableScope;
3
39
  (function (VariableScope) {
4
40
  VariableScope[VariableScope["Any"] = 0] = "Any";
5
41
  VariableScope[VariableScope["Local"] = 1] = "Local";
6
42
  VariableScope[VariableScope["Global"] = 2] = "Global";
7
- })(VariableScope || (VariableScope = {}));
8
- export class StackedStates {
43
+ })(VariableScope || (exports.VariableScope = VariableScope = {}));
44
+ class StackedStates {
9
45
  constructor() {
10
46
  this.maps = [];
11
47
  this.localIndex = -1;
@@ -37,4 +73,5 @@ export class StackedStates {
37
73
  this.maps[this.maps.length - 1].set(name, state);
38
74
  }
39
75
  }
40
- export const ctx = t.identifier("Vasille");
76
+ exports.StackedStates = StackedStates;
77
+ exports.ctx = t.identifier("Vasille");
package/lib/jsx-detect.js CHANGED
@@ -1,5 +1,43 @@
1
- import * as t from "@babel/types";
2
- export function exprHasJsx(node) {
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.exprHasJsx = exprHasJsx;
37
+ exports.statementHasJsx = statementHasJsx;
38
+ exports.bodyHasJsx = bodyHasJsx;
39
+ const t = __importStar(require("@babel/types"));
40
+ function exprHasJsx(node) {
3
41
  if (t.isBinaryExpression(node)) {
4
42
  return (t.isExpression(node.left) && exprHasJsx(node.left)) || exprHasJsx(node.right);
5
43
  }
@@ -11,7 +49,7 @@ export function exprHasJsx(node) {
11
49
  }
12
50
  return t.isJSXElement(node) || t.isJSXFragment(node);
13
51
  }
14
- export function statementHasJsx(statement) {
52
+ function statementHasJsx(statement) {
15
53
  if (t.isExpressionStatement(statement)) {
16
54
  return exprHasJsx(statement.expression);
17
55
  }
@@ -54,7 +92,7 @@ export function statementHasJsx(statement) {
54
92
  }
55
93
  return false;
56
94
  }
57
- export function bodyHasJsx(node) {
95
+ function bodyHasJsx(node) {
58
96
  if (t.isExpression(node)) {
59
97
  return exprHasJsx(node);
60
98
  }