babel-plugin-vasille 0.99.2 → 0.99.4

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/README.md CHANGED
@@ -104,8 +104,8 @@ All of these are supported:
104
104
  * [x] `100%` Test Coverage for the JSX library.
105
105
  * [x] Develop the `Vasille Babel Plugin`.
106
106
  * [ ] `100%` Test Coverage fot babel plugin.
107
- * [ ] Add CSS support (define styles in components).
108
- * [ ] Add custom `<input/>` components with 2-way value binding.
107
+ * [x] Add CSS support (define styles in components).
108
+ * [ ] Add custom `input` components with 2-way value binding.
109
109
  * [ ] Add router.
110
110
  * [ ] Develop dev-tools extension for debugging.
111
111
  * [ ] Develop a lot of libraries for the framework.
package/lib/call.js CHANGED
@@ -1,33 +1,6 @@
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 (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.requiresContext = exports.composeOnly = void 0;
27
- exports.calls = calls;
28
- const t = __importStar(require("@babel/types"));
29
- const internal_1 = require("./internal");
30
- exports.composeOnly = [
1
+ import * as t from "@babel/types";
2
+ import { ctx } from "./internal";
3
+ export const composeOnly = [
31
4
  "forward",
32
5
  "watch",
33
6
  "ref",
@@ -38,9 +11,19 @@ exports.composeOnly = [
38
11
  "setModel",
39
12
  "reactiveObject",
40
13
  ];
41
- exports.requiresContext = ["awaited", "forward"];
42
- const requiresContextSet = new Set(exports.requiresContext);
43
- function calls(node, names, internal) {
14
+ export const styleOnly = [
15
+ "theme",
16
+ "dark",
17
+ "mobile",
18
+ "tablet",
19
+ "laptop",
20
+ "prefersDark",
21
+ "prefersLight",
22
+ "webStyleSheet",
23
+ ];
24
+ export const requiresContext = ["awaited", "forward"];
25
+ const requiresContextSet = new Set(requiresContext);
26
+ export function calls(node, names, internal) {
44
27
  const set = new Set(names);
45
28
  const callee = t.isCallExpression(node) ? node.callee : null;
46
29
  if (callee) {
@@ -48,15 +31,16 @@ function calls(node, names, internal) {
48
31
  const mapped = internal.mapping.get(callee.name);
49
32
  if (mapped && set.has(mapped) && internal.stack.get(callee.name) === undefined) {
50
33
  if (requiresContextSet.has(callee.name) && t.isCallExpression(node)) {
51
- node.arguments.unshift(internal_1.ctx);
34
+ node.arguments.unshift(ctx);
52
35
  }
53
36
  return mapped;
54
37
  }
55
38
  return false;
56
39
  }
57
- // The global object is overrided
58
- if (internal.stack.get(internal.global) !== undefined) {
59
- return false;
40
+ const global = internal.stack.get(internal.global) === undefined;
41
+ const cssGlobal = internal.stack.get(internal.cssGlobal) === undefined;
42
+ if (!global && !cssGlobal) {
43
+ return;
60
44
  }
61
45
  const propName = t.isMemberExpression(callee)
62
46
  ? t.isIdentifier(callee.property)
@@ -66,12 +50,15 @@ function calls(node, names, internal) {
66
50
  : null
67
51
  : null;
68
52
  if (t.isMemberExpression(callee) && t.isIdentifier(callee.object) && propName) {
69
- if (callee.object.name === internal.global && set.has(propName)) {
53
+ if (global && callee.object.name === internal.global && set.has(propName)) {
70
54
  if (requiresContextSet.has(callee.object.name) && t.isCallExpression(node)) {
71
- node.arguments.unshift(internal_1.ctx);
55
+ node.arguments.unshift(ctx);
72
56
  }
73
57
  return callee.object.name;
74
58
  }
59
+ if (cssGlobal && callee.object.name === internal.cssGlobal && set.has(propName)) {
60
+ return callee.object.name;
61
+ }
75
62
  }
76
63
  }
77
64
  return false;
@@ -0,0 +1,215 @@
1
+ import * as t from "@babel/types";
2
+ import { calls } from "./call";
3
+ function tryProcessProp(path, pseudo, media, internal) {
4
+ if (t.isObjectMethod(path.node)) {
5
+ throw path.buildCodeFrameError("Object methods not supported here");
6
+ }
7
+ if (t.isSpreadElement(path.node)) {
8
+ throw path.buildCodeFrameError("Spread element not suppored here");
9
+ }
10
+ return processProp(path, pseudo, media, internal);
11
+ }
12
+ const mediaDefaults = ["mobile", "tablet", "laptop", "prefersDark", "prefersLight"];
13
+ function processValue(name, path, pseudo, theme, media, mediaDefault, allowFallback, internal) {
14
+ if (calls(path.node, ["theme"], internal)) {
15
+ const call = path.node;
16
+ if (theme) {
17
+ throw path.buildCodeFrameError("Vasille: Theme seem the be defined twince");
18
+ }
19
+ if (t.isStringLiteral(call.arguments[0])) {
20
+ return processValue(name, path.get("arguments")[1], pseudo, `body.${call.arguments[0].value}`, media, mediaDefault, false, internal);
21
+ }
22
+ else {
23
+ throw path
24
+ .get("arguments")[0]
25
+ .buildCodeFrameError("Vasille: Expected string literal");
26
+ }
27
+ }
28
+ if (calls(path.node, ["dark"], internal)) {
29
+ if (theme) {
30
+ throw path.buildCodeFrameError("Vasille: Theme seem the be defined twince");
31
+ }
32
+ return processValue(name, path.get("arguments")[0], pseudo, `.dark`, media, mediaDefault, false, internal);
33
+ }
34
+ let callee;
35
+ if ((callee = calls(path.node, mediaDefaults, internal))) {
36
+ const index = mediaDefaults.indexOf(callee) + 1;
37
+ if (mediaDefault.includes(index)) {
38
+ return processValue(name, path.get("arguments")[0], pseudo, theme, media, mediaDefault, false, internal);
39
+ }
40
+ return processValue(name, path.get("arguments")[0], pseudo, theme, media, [...mediaDefault, index], false, internal);
41
+ }
42
+ function composeRules(value) {
43
+ return mediaDefault.length
44
+ ? mediaDefault.map(index => {
45
+ return {
46
+ defaultMediaRule: index,
47
+ mediaRule: media,
48
+ pseudo: pseudo,
49
+ theme: theme,
50
+ rule: `${name}:${value}`,
51
+ };
52
+ })
53
+ : [
54
+ {
55
+ defaultMediaRule: 0,
56
+ mediaRule: media,
57
+ pseudo: pseudo,
58
+ theme: theme,
59
+ rule: `${name}:${value}`,
60
+ },
61
+ ];
62
+ }
63
+ if (t.isStringLiteral(path.node)) {
64
+ return composeRules(path.node.value);
65
+ }
66
+ if (t.isNumericLiteral(path.node)) {
67
+ return composeRules(`${path.node.value}px`);
68
+ }
69
+ if (t.isArrayExpression(path.node)) {
70
+ if (path.node.elements.every(item => t.isNumericLiteral(item))) {
71
+ return composeRules(path.node.elements.map(item => `${item.value}px`).join(" "));
72
+ }
73
+ else if (allowFallback) {
74
+ return [
75
+ ...path
76
+ .get("elements")
77
+ .map(path => {
78
+ if (t.isExpression(path.node)) {
79
+ return processValue(name, path, pseudo, theme, media, mediaDefault, false, internal);
80
+ }
81
+ else {
82
+ throw path.buildCodeFrameError("Vasille: Exprected expression");
83
+ }
84
+ })
85
+ .flat(1),
86
+ ];
87
+ }
88
+ else {
89
+ throw path.buildCodeFrameError("Vasille: Only numbers arrays are suppored here");
90
+ }
91
+ }
92
+ throw path.buildCodeFrameError("Vasille: Failed o parse value, it is not a string, number or array");
93
+ }
94
+ function processProp(path, pseudo, media, internal) {
95
+ let name;
96
+ if (t.isIdentifier(path.node.key)) {
97
+ name = path.node.key.name;
98
+ }
99
+ else if (t.isStringLiteral(path.node.key)) {
100
+ name = path.node.key.value;
101
+ }
102
+ else {
103
+ throw path.get("key").buildCodeFrameError("Vasille: Incompaible key, exprect idenifier or string literal");
104
+ }
105
+ if (name.startsWith("@")) {
106
+ if (media || pseudo) {
107
+ throw path.get("key").buildCodeFrameError("Vasille: Media queries allowed inly in the root of style");
108
+ }
109
+ if (t.isObjectExpression(path.node.value)) {
110
+ return path.get("value")
111
+ .get("properties")
112
+ .map(item => {
113
+ return tryProcessProp(item, "", name, internal);
114
+ })
115
+ .flat(1);
116
+ }
117
+ else {
118
+ throw path.get("value").buildCodeFrameError("Vasille: Exprected object expression");
119
+ }
120
+ }
121
+ if (name.startsWith(":")) {
122
+ if (pseudo) {
123
+ throw path.get("key").buildCodeFrameError("Recursive pseudo classes are restriced");
124
+ }
125
+ if (t.isObjectExpression(path.node.value)) {
126
+ return path.get("value")
127
+ .get("properties")
128
+ .map(item => {
129
+ return tryProcessProp(item, name, media, internal);
130
+ })
131
+ .flat(1);
132
+ }
133
+ else {
134
+ throw path.get("value").buildCodeFrameError("Vasille: Exprected object expression");
135
+ }
136
+ }
137
+ return processValue(name, path.get("value"), pseudo, "", media, [], true, internal);
138
+ }
139
+ export function findStyleInNode(path, internal) {
140
+ if (t.isExpressionStatement(path.node)) {
141
+ return findStyleInNode(path.get("expression"), internal);
142
+ }
143
+ if (t.isExportNamedDeclaration(path.node)) {
144
+ return findStyleInNode(path.get("declaration"), internal);
145
+ }
146
+ if (t.isVariableDeclaration(path.node) &&
147
+ path.node.declarations.length === 1 &&
148
+ calls(path.node.declarations[0].init, ["webStyleSheet"], internal)) {
149
+ const call = path.node.declarations[0].init;
150
+ const callPath = path
151
+ .get("declarations")[0]
152
+ .get("init");
153
+ const objPath = callPath.get("arguments")[0];
154
+ if (call.arguments.length !== 1) {
155
+ throw callPath.buildCodeFrameError("Vasille: webStyleSheet function has 1 parameter");
156
+ }
157
+ if (!t.isObjectExpression(call.arguments[0])) {
158
+ throw objPath.buildCodeFrameError("Vasille: expected object expression");
159
+ }
160
+ for (const path of objPath.get("properties")) {
161
+ if (!t.isObjectProperty(path.node)) {
162
+ throw path.buildCodeFrameError("Vasille: Expected object property");
163
+ }
164
+ const prop = path;
165
+ if (!t.isObjectExpression(prop.node.value)) {
166
+ throw prop.get("value").buildCodeFrameError("Vasille: Exprected object expression");
167
+ }
168
+ if (!(t.isIdentifier(prop.node.key) || t.isStringLiteral(prop.node.key))) {
169
+ throw prop.get("key").buildCodeFrameError("Vasille: Expected identifier of string literal");
170
+ }
171
+ const unsorted = [];
172
+ const sorted = {};
173
+ for (const path of prop.get("value").get("properties")) {
174
+ unsorted.push(...tryProcessProp(path, "", "", internal));
175
+ }
176
+ for (const rule of unsorted) {
177
+ if (!sorted[rule.defaultMediaRule]) {
178
+ sorted[rule.defaultMediaRule] = {};
179
+ }
180
+ const defaultMediaRule = sorted[rule.defaultMediaRule];
181
+ if (!defaultMediaRule[rule.mediaRule]) {
182
+ defaultMediaRule[rule.mediaRule] = {};
183
+ }
184
+ const mediaRule = defaultMediaRule[rule.mediaRule];
185
+ if (!mediaRule[rule.theme]) {
186
+ mediaRule[rule.theme] = {};
187
+ }
188
+ const theme = mediaRule[rule.theme];
189
+ if (!theme[rule.pseudo]) {
190
+ theme[rule.pseudo] = [];
191
+ }
192
+ theme[rule.pseudo].push(rule.rule);
193
+ }
194
+ const expressions = [];
195
+ for (const defaultMediaRule in sorted) {
196
+ for (const mediaRule in sorted[defaultMediaRule]) {
197
+ for (const theme in sorted[defaultMediaRule][mediaRule]) {
198
+ for (const pseudo in sorted[defaultMediaRule][mediaRule][theme]) {
199
+ const rulePack = sorted[defaultMediaRule][mediaRule][theme][pseudo].join(";");
200
+ const pseudoPack = pseudo ? `.{}${pseudo}{${rulePack}}` : `.{}{${rulePack}}`;
201
+ const themePack = theme ? `${theme} ${pseudoPack}` : pseudoPack;
202
+ const mediaRulePack = t.stringLiteral(mediaRule ? `${mediaRule}{${themePack}}` : themePack);
203
+ expressions.push(defaultMediaRule !== "0"
204
+ ? t.arrayExpression([t.numericLiteral(parseInt(defaultMediaRule)), mediaRulePack])
205
+ : mediaRulePack);
206
+ }
207
+ }
208
+ }
209
+ }
210
+ prop.get("value").replaceWith(t.arrayExpression(expressions));
211
+ }
212
+ return true;
213
+ }
214
+ return false;
215
+ }
package/lib/expression.js CHANGED
@@ -1,41 +1,6 @@
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 (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.encodeName = encodeName;
27
- exports.checkNode = checkNode;
28
- exports.checkOrIgnoreAllExpressions = checkOrIgnoreAllExpressions;
29
- exports.checkAllExpressions = checkAllExpressions;
30
- exports.checkAllUnknown = checkAllUnknown;
31
- exports.chekOrIgnoreExpression = chekOrIgnoreExpression;
32
- exports.checkExpression = checkExpression;
33
- exports.checkStatements = checkStatements;
34
- exports.checkStatement = checkStatement;
35
- exports.checkFunction = checkFunction;
36
- const t = __importStar(require("@babel/types"));
37
- const internal_1 = require("./internal");
38
- function encodeName(name) {
1
+ import * as t from "@babel/types";
2
+ import { StackedStates } from "./internal";
3
+ export function encodeName(name) {
39
4
  return t.identifier(`Vasille_${name}`);
40
5
  }
41
6
  function addIdentifier(path, search) {
@@ -119,12 +84,12 @@ function meshLValue(path, internal) {
119
84
  });
120
85
  }
121
86
  }
122
- function checkNode(path, internal) {
87
+ export function checkNode(path, internal) {
123
88
  const search = {
124
89
  external: internal,
125
90
  found: new Map(),
126
91
  self: null,
127
- stack: new internal_1.StackedStates(),
92
+ stack: new StackedStates(),
128
93
  };
129
94
  if (t.isIdentifier(path.node)) {
130
95
  const state = internal.stack.get(path.node.name);
@@ -149,19 +114,19 @@ function checkNode(path, internal) {
149
114
  }
150
115
  return search;
151
116
  }
152
- function checkOrIgnoreAllExpressions(nodePaths, search) {
117
+ export function checkOrIgnoreAllExpressions(nodePaths, search) {
153
118
  for (const path of nodePaths) {
154
119
  if (t.isExpression(path.node)) {
155
120
  checkExpression(path, search);
156
121
  }
157
122
  }
158
123
  }
159
- function checkAllExpressions(nodePaths, search) {
124
+ export function checkAllExpressions(nodePaths, search) {
160
125
  for (const path of nodePaths) {
161
126
  checkExpression(path, search);
162
127
  }
163
128
  }
164
- function checkAllUnknown(paths, internal) {
129
+ export function checkAllUnknown(paths, internal) {
165
130
  for (const path of paths) {
166
131
  if (t.isSpreadElement(path.node)) {
167
132
  checkExpression(path.get("argument"), internal);
@@ -171,12 +136,12 @@ function checkAllUnknown(paths, internal) {
171
136
  }
172
137
  }
173
138
  }
174
- function chekOrIgnoreExpression(path, search) {
139
+ export function chekOrIgnoreExpression(path, search) {
175
140
  if (t.isExpression(path.node)) {
176
141
  checkExpression(path, search);
177
142
  }
178
143
  }
179
- function checkExpression(nodePath, search) {
144
+ export function checkExpression(nodePath, search) {
180
145
  const expr = nodePath.node;
181
146
  if (!expr) {
182
147
  return;
@@ -377,7 +342,7 @@ function checkExpression(nodePath, search) {
377
342
  }
378
343
  }
379
344
  }
380
- function checkStatements(paths, search) {
345
+ export function checkStatements(paths, search) {
381
346
  for (const path of paths) {
382
347
  checkStatement(path, search);
383
348
  }
@@ -412,7 +377,7 @@ function ignoreLocals(val, search) {
412
377
  }
413
378
  }
414
379
  }
415
- function checkStatement(path, search) {
380
+ export function checkStatement(path, search) {
416
381
  const statement = path.node;
417
382
  if (!statement) {
418
383
  return;
@@ -540,7 +505,7 @@ function checkStatement(path, search) {
540
505
  }
541
506
  }
542
507
  }
543
- function checkFunction(path, search) {
508
+ export function checkFunction(path, search) {
544
509
  const node = path.node;
545
510
  if (t.isExpression(node.body)) {
546
511
  checkExpression(path.get("body"), search);
package/lib/index.js CHANGED
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const transformer_1 = require("./transformer");
5
- function default_1() {
1
+ import { trProgram } from "./transformer";
2
+ export default function () {
6
3
  return {
7
4
  name: "Vasille",
8
5
  visitor: {
9
6
  Program(path, params) {
10
- (0, transformer_1.trProgram)(path, params.opts.devMode !== false);
7
+ trProgram(path, params.opts.devMode !== false);
11
8
  },
12
9
  },
13
10
  };
package/lib/internal.js CHANGED
@@ -1,31 +1,5 @@
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 (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.ctx = exports.StackedStates = void 0;
27
- const t = __importStar(require("@babel/types"));
28
- class StackedStates {
1
+ import * as t from "@babel/types";
2
+ export class StackedStates {
29
3
  constructor() {
30
4
  this.maps = [];
31
5
  this.push();
@@ -48,5 +22,4 @@ class StackedStates {
48
22
  this.maps[this.maps.length - 1].set(name, state);
49
23
  }
50
24
  }
51
- exports.StackedStates = StackedStates;
52
- exports.ctx = t.identifier("Vasille");
25
+ export const ctx = t.identifier("Vasille");
package/lib/jsx-detect.js CHANGED
@@ -1,33 +1,5 @@
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 (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.exprHasJsx = exprHasJsx;
27
- exports.statementHasJsx = statementHasJsx;
28
- exports.bodyHasJsx = bodyHasJsx;
29
- const t = __importStar(require("@babel/types"));
30
- function exprHasJsx(node) {
1
+ import * as t from "@babel/types";
2
+ export function exprHasJsx(node) {
31
3
  if (t.isBinaryExpression(node)) {
32
4
  return (t.isExpression(node.left) && exprHasJsx(node.left)) || exprHasJsx(node.right);
33
5
  }
@@ -48,7 +20,7 @@ function exprHasJsx(node) {
48
20
  }
49
21
  return t.isJSXElement(node) || t.isJSXFragment(node);
50
22
  }
51
- function statementHasJsx(statement) {
23
+ export function statementHasJsx(statement) {
52
24
  if (t.isExpressionStatement(statement)) {
53
25
  return exprHasJsx(statement.expression);
54
26
  }
@@ -80,7 +52,7 @@ function statementHasJsx(statement) {
80
52
  }
81
53
  return false;
82
54
  }
83
- function bodyHasJsx(node) {
55
+ export function bodyHasJsx(node) {
84
56
  if (t.isExpression(node)) {
85
57
  return exprHasJsx(node);
86
58
  }