babel-plugin-vasille 3.1.1 → 3.2.1

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/jsx.js CHANGED
@@ -1,15 +1,52 @@
1
- import * as t from "@babel/types";
2
- import { ctx } from "./internal.js";
3
- import { exprCall } from "./lib.js";
4
- import { compose, meshExpression } from "./mesh.js";
5
- import { bodyHasJsx } from "./jsx-detect.js";
6
- export function transformJsx(path, internal) {
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.transformJsx = transformJsx;
37
+ exports.transformJsxArray = transformJsxArray;
38
+ const t = __importStar(require("@babel/types"));
39
+ const internal_js_1 = require("./internal.js");
40
+ const lib_js_1 = require("./lib.js");
41
+ const mesh_js_1 = require("./mesh.js");
42
+ const jsx_detect_js_1 = require("./jsx-detect.js");
43
+ function transformJsx(path, internal) {
7
44
  if (t.isJSXElement(path.node)) {
8
45
  return [transformJsxElement(path, internal)];
9
46
  }
10
47
  return transformJsxArray(path.get("children"), internal);
11
48
  }
12
- export function transformJsxArray(paths, internal) {
49
+ function transformJsxArray(paths, internal) {
13
50
  const result = [];
14
51
  for (const path of paths) {
15
52
  if (t.isJSXElement(path.node) || t.isJSXFragment(path.node)) {
@@ -21,8 +58,9 @@ export function transformJsxArray(paths, internal) {
21
58
  .replace(/\n\s+$/m, "")
22
59
  .replace(/^\s*\n\s+/m, "")
23
60
  .replace(/\s*\n\s*/gm, "\n");
24
- const call = t.callExpression(t.memberExpression(ctx, t.identifier("text")), [t.stringLiteral(fixed)]);
61
+ const call = t.callExpression(t.memberExpression(internal_js_1.ctx, t.identifier("text")), [t.stringLiteral(fixed)]);
25
62
  call.loc = path.node.loc;
63
+ /* istanbul ignore else */
26
64
  if (call.loc) {
27
65
  for (const char of path.node.value) {
28
66
  if (!/\s/.test(char)) {
@@ -43,7 +81,7 @@ export function transformJsxArray(paths, internal) {
43
81
  }
44
82
  else if (t.isJSXExpressionContainer(path.node)) {
45
83
  const value = transformJsxExpressionContainer(path, internal, false, false);
46
- const call = t.callExpression(t.memberExpression(ctx, t.identifier("text")), [value]);
84
+ const call = t.callExpression(t.memberExpression(internal_js_1.ctx, t.identifier("text")), [value]);
47
85
  call.loc = value.loc;
48
86
  result.push(t.expressionStatement(call));
49
87
  }
@@ -58,28 +96,29 @@ function transformJsxExpressionContainer(path, internal, acceptSlots, isInternal
58
96
  const loc = expression.loc;
59
97
  if (acceptSlots &&
60
98
  (t.isFunctionExpression(expression) || t.isArrowFunctionExpression(expression)) &&
61
- bodyHasJsx(expression.body)) {
62
- compose(path.get("expression"), internal, isInternalSlot);
99
+ (0, jsx_detect_js_1.bodyHasJsx)(expression.body)) {
100
+ (0, mesh_js_1.compose)(path.get("expression"), internal, isInternalSlot, "slot");
63
101
  if (!isInternalSlot) {
64
102
  if (expression.params.length < 1) {
65
103
  expression.params.push(t.identifier(`_${internal.prefix}`));
66
104
  }
67
- expression.params.push(ctx);
105
+ expression.params.push(internal_js_1.ctx);
68
106
  }
69
107
  else {
70
- expression.params.unshift(ctx);
108
+ expression.params.unshift(internal_js_1.ctx);
71
109
  }
72
110
  expression.loc = loc;
73
111
  return expression;
74
112
  }
75
113
  else if (isInternalSlot && (t.isFunctionExpression(expression) || t.isArrowFunctionExpression(expression))) {
76
- expression.params.unshift(ctx);
114
+ expression.params.unshift(internal_js_1.ctx);
77
115
  }
78
- let call = exprCall(path.get("expression"), expression, internal);
116
+ const exprPath = path.get("expression");
117
+ let call = (0, lib_js_1.exprCall)(exprPath, expression, internal);
79
118
  if (!call && t.isIdentifier(expression) && internal.stack.get(expression.name) === 3 /* VariableState.ReactiveObject */) {
80
119
  call = t.callExpression(t.memberExpression(internal.id, t.identifier("rop")), [expression]);
81
120
  }
82
- const result = call ?? expression;
121
+ const result = call ?? exprPath.node;
83
122
  result.loc = loc;
84
123
  return result;
85
124
  }
@@ -114,12 +153,14 @@ function transformJsxElement(path, internal) {
114
153
  const attr = attrPath.node;
115
154
  if (t.isJSXAttribute(attr)) {
116
155
  const name = attr.name;
156
+ /* istanbul ignore else */
117
157
  if (t.isJSXIdentifier(name)) {
118
158
  if (name.name.startsWith("on")) {
119
159
  if (t.isJSXExpressionContainer(attr.value) && t.isExpression(attr.value.expression)) {
120
160
  const path = attrPath.get("value");
161
+ /* istanbul ignore else */
121
162
  if (t.isExpression(path.node.expression)) {
122
- meshExpression(path.get("expression"), internal);
163
+ (0, mesh_js_1.meshExpression)(path.get("expression"), internal);
123
164
  }
124
165
  events.push(idToProp(name, path.node.expression, 2));
125
166
  }
@@ -131,6 +172,7 @@ function transformJsxElement(path, internal) {
131
172
  }
132
173
  else if (name.name === "class") {
133
174
  // class={[..]}
175
+ /* istanbul ignore else */
134
176
  if (t.isJSXExpressionContainer(attr.value) && t.isArrayExpression(attr.value.expression)) {
135
177
  const valuePath = attrPath.get("value");
136
178
  const arrayExprPath = valuePath.get("expression");
@@ -139,7 +181,7 @@ function transformJsxElement(path, internal) {
139
181
  if (t.isExpression(item)) {
140
182
  // class={[cond && "string"]}
141
183
  if (t.isLogicalExpression(item) && item.operator === "&&" && t.isStringLiteral(item.right)) {
142
- const call = exprCall(elementPath.get("left"), item.left, internal);
184
+ const call = (0, lib_js_1.exprCall)(elementPath.get("left"), item.left, internal);
143
185
  classObject.push(idToProp(item.right, call ?? item.left));
144
186
  }
145
187
  // class={[{..}]}
@@ -148,9 +190,9 @@ function transformJsxElement(path, internal) {
148
190
  // class={[{a: b}]}
149
191
  if (t.isObjectProperty(propPath.node)) {
150
192
  const prop = propPath;
151
- const value = exprCall(prop.get("value"), prop.node.value, internal) ?? prop.node.value;
193
+ const value = (0, lib_js_1.exprCall)(prop.get("value"), prop.node.value, internal) ?? prop.node.value;
152
194
  if (t.isExpression(prop.node.key) && !t.isIdentifier(prop.node.key)) {
153
- meshExpression(prop.get("key"), internal);
195
+ (0, mesh_js_1.meshExpression)(prop.get("key"), internal);
154
196
  }
155
197
  classObject.push(t.objectProperty(prop.node.key, value));
156
198
  }
@@ -170,7 +212,7 @@ function transformJsxElement(path, internal) {
170
212
  }
171
213
  // class={[..]}
172
214
  else {
173
- const call = exprCall(elementPath, item, internal);
215
+ const call = (0, lib_js_1.exprCall)(elementPath, item, internal);
174
216
  classElements.push(call ?? item);
175
217
  }
176
218
  }
@@ -188,15 +230,16 @@ function transformJsxElement(path, internal) {
188
230
  else if (t.isJSXExpressionContainer(attr.value) && t.isTemplateLiteral(attr.value.expression)) {
189
231
  const jsxAttrPath = attrPath;
190
232
  const jsxContainerPath = jsxAttrPath.get("value");
191
- const value = exprCall(jsxContainerPath.get("expression"), attr.value.expression, internal);
233
+ const value = (0, lib_js_1.exprCall)(jsxContainerPath.get("expression"), attr.value.expression, internal);
192
234
  attrs.push(t.objectProperty(t.identifier("class"), value ?? attr.value.expression));
193
235
  if (value) {
194
236
  console.warn(attrPath.buildCodeFrameError("Vasille: This will slow down your application"));
195
237
  }
196
238
  }
197
239
  // class={name}
198
- else if (t.isJSXExpressionContainer(attr.value) && t.isIdentifier(attr.value.expression)) {
199
- attrs.push(t.objectProperty(t.identifier("class"), attr.value.expression));
240
+ else if (t.isJSXExpressionContainer(attr.value) && t.isExpression(attr.value.expression)) {
241
+ const expr = (0, lib_js_1.exprCall)(attrPath.get("value"), attr.value.expression, internal) ?? attr.value.expression;
242
+ attrs.push(t.objectProperty(t.identifier("class"), expr));
200
243
  }
201
244
  // class="a b"
202
245
  else if (t.isStringLiteral(attr.value)) {
@@ -205,6 +248,7 @@ function transformJsxElement(path, internal) {
205
248
  }
206
249
  else if (name.name === "style") {
207
250
  // style={{..}}
251
+ /* istanbul ignore else */
208
252
  if (t.isJSXExpressionContainer(attr.value) && t.isObjectExpression(attr.value.expression)) {
209
253
  const valuePath = attrPath.get("value");
210
254
  const objectPath = valuePath.get("expression");
@@ -212,9 +256,9 @@ function transformJsxElement(path, internal) {
212
256
  // style={{a: b}}
213
257
  if (t.isObjectProperty(propPath.node)) {
214
258
  const prop = propPath;
215
- const value = exprCall(prop.get("value"), prop.node.value, internal) ?? prop.node.value;
259
+ const value = (0, lib_js_1.exprCall)(prop.get("value"), prop.node.value, internal) ?? prop.node.value;
216
260
  if (t.isExpression(prop.node.key) && !t.isIdentifier(prop.node.key)) {
217
- meshExpression(prop.get("key"), internal);
261
+ (0, mesh_js_1.meshExpression)(prop.get("key"), internal);
218
262
  }
219
263
  // style={{a: "b"}} -> static in compile time
220
264
  if (t.isIdentifier(prop.node.key) && t.isStringLiteral(prop.node.value)) {
@@ -265,14 +309,19 @@ function transformJsxElement(path, internal) {
265
309
  const jsxAttrPath = attrPath;
266
310
  const jsxContainerPath = jsxAttrPath.get("value");
267
311
  const literalPath = jsxContainerPath.get("expression");
268
- const value = exprCall(literalPath, attr.value.expression, internal);
312
+ const value = (0, lib_js_1.exprCall)(literalPath, attr.value.expression, internal);
269
313
  attrs.push(t.objectProperty(t.identifier("style"), value ?? attr.value.expression));
270
314
  if (value) {
271
315
  console.warn(attrPath.buildCodeFrameError("Vasille: This will slow down your application"));
272
316
  }
273
317
  }
318
+ else if (t.isJSXExpressionContainer(attr.value) && t.isExpression(attr.value.expression)) {
319
+ const expr = (0, lib_js_1.exprCall)(attrPath.get("value"), attr.value.expression, internal) ?? attr.value.expression;
320
+ attrs.push(t.objectProperty(t.identifier("style"), expr));
321
+ }
274
322
  }
275
323
  else {
324
+ /* istanbul ignore else */
276
325
  if (!attr.value || t.isJSXExpressionContainer(attr.value)) {
277
326
  attrs.push(idToProp(name, t.isExpression(attr.value?.expression) ? attr.value.expression : t.booleanLiteral(true)));
278
327
  }
@@ -283,9 +332,10 @@ function transformJsxElement(path, internal) {
283
332
  }
284
333
  if (t.isJSXNamespacedName(name)) {
285
334
  if (name.namespace.name === "bind") {
335
+ /* istanbul ignore else */
286
336
  if (t.isJSXExpressionContainer(attr.value) || !attr.value) {
287
337
  const value = t.isExpression(attr.value?.expression)
288
- ? exprCall(attrPath.get("value").get("expression"), attr.value.expression, internal)
338
+ ? (0, lib_js_1.exprCall)(attrPath.get("value").get("expression"), attr.value.expression, internal)
289
339
  : undefined;
290
340
  bind.push(idToProp(name.name, value ?? (t.isExpression(attr.value?.expression) ? attr.value.expression : t.booleanLiteral(true))));
291
341
  }
@@ -312,7 +362,7 @@ function transformJsxElement(path, internal) {
312
362
  attrs.push(t.objectProperty(t.identifier("style"), t.stringLiteral(styleStatic.map(([id, value]) => `${id.name}:${value.value}`).join(";"))));
313
363
  }
314
364
  const statements = transformJsxArray(path.get("children"), internal);
315
- const call = t.callExpression(t.memberExpression(ctx, t.identifier("tag")), [
365
+ const call = t.callExpression(t.memberExpression(internal_js_1.ctx, t.identifier("tag")), [
316
366
  t.stringLiteral(name.name),
317
367
  t.objectExpression([
318
368
  ...(attrs.length > 0 ? [t.objectProperty(t.identifier("attr"), t.objectExpression(attrs))] : []),
@@ -328,7 +378,7 @@ function transformJsxElement(path, internal) {
328
378
  : []),
329
379
  ...(styleObject.length > 0 ? [t.objectProperty(t.identifier("style"), t.objectExpression(styleObject))] : []),
330
380
  ]),
331
- ...(statements.length > 0 ? [t.arrowFunctionExpression([ctx], t.blockStatement(statements))] : []),
381
+ ...(statements.length > 0 ? [t.arrowFunctionExpression([internal_js_1.ctx], t.blockStatement(statements))] : []),
332
382
  ]);
333
383
  call.loc = path.node.loc;
334
384
  return t.expressionStatement(call);
@@ -347,6 +397,7 @@ function transformJsxElement(path, internal) {
347
397
  // <A prop=../>
348
398
  if (t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name)) {
349
399
  // <A prop=".."/>
400
+ /* istanbul ignore else */
350
401
  if (t.isStringLiteral(attr.value)) {
351
402
  props.push(idToProp(attr.name, attr.value));
352
403
  }
@@ -386,14 +437,14 @@ function transformJsxElement(path, internal) {
386
437
  else {
387
438
  const statements = transformJsxArray(path.get("children"), internal);
388
439
  if (statements.length > 0) {
389
- const params = [ctx];
440
+ const params = [internal_js_1.ctx];
390
441
  if (!isInternal) {
391
442
  params.unshift(t.identifier(`_${internal.prefix}`));
392
443
  }
393
444
  run = t.arrowFunctionExpression(params, t.blockStatement(statements));
394
445
  }
395
446
  }
396
- const call = t.callExpression(t.identifier(name.name), [ctx, t.objectExpression(props), ...(run ? [run] : [])]);
447
+ const call = t.callExpression(t.identifier(name.name), [t.objectExpression(props), internal_js_1.ctx, ...(run ? [run] : [])]);
397
448
  call.loc = path.node.loc;
398
449
  return t.expressionStatement(call);
399
450
  }
package/lib/lib.js CHANGED
@@ -1,8 +1,54 @@
1
- import * as t from "@babel/types";
2
- import { checkNode, encodeName } from "./expression.js";
3
- import { ctx } from "./internal.js";
4
- import { calls } from "./call.js";
5
- export function named(call, name, internal, argPos) {
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.named = named;
37
+ exports.processCalculateCall = processCalculateCall;
38
+ exports.parseCalculateCall = parseCalculateCall;
39
+ exports.exprCall = exprCall;
40
+ exports.forwardOnlyExpr = forwardOnlyExpr;
41
+ exports.own = own;
42
+ exports.ref = ref;
43
+ exports.reactiveObject = reactiveObject;
44
+ exports.arrayModel = arrayModel;
45
+ exports.setModel = setModel;
46
+ exports.mapModel = mapModel;
47
+ const t = __importStar(require("@babel/types"));
48
+ const expression_js_1 = require("./expression.js");
49
+ const internal_js_1 = require("./internal.js");
50
+ const call_js_1 = require("./call.js");
51
+ function named(call, name, internal, argPos) {
6
52
  if (internal.devMode && !internal.stateOnly && name) {
7
53
  while (argPos && call.arguments.length < argPos) {
8
54
  call.arguments.push(t.buildUndefinedNode());
@@ -11,71 +57,76 @@ export function named(call, name, internal, argPos) {
11
57
  }
12
58
  return call;
13
59
  }
14
- export function parseCalculateCall(path, internal) {
15
- if (t.isCallExpression(path.node) && calls(path.node, ["calculate", "watch"], internal)) {
16
- const call = path.node.arguments[0];
17
- if (path.node.arguments.length !== 1) {
18
- throw path.buildCodeFrameError("Vasille: Incorrect number of arguments");
19
- }
20
- if (t.isFunctionExpression(call) || t.isArrowFunctionExpression(call)) {
21
- if (call.params.length > 0) {
22
- throw path.buildCodeFrameError("Vasille: Argument of calculate cannot have parameters");
23
- }
24
- const exprData = checkNode(path.get("arguments")[0], internal);
25
- call.params = [...exprData.found.keys()].map(name => encodeName(name));
26
- return [call, t.arrayExpression([...exprData.found.values()])];
27
- }
28
- else {
29
- throw path.buildCodeFrameError("Vasille: Argument of calculate must be a function");
60
+ function processCalculateCall(path, internal) {
61
+ const call = path.node.arguments[0];
62
+ if (path.node.arguments.length !== 1) {
63
+ throw path.buildCodeFrameError("Vasille: Incorrect number of arguments");
64
+ }
65
+ if (t.isFunctionExpression(call) || t.isArrowFunctionExpression(call)) {
66
+ if (call.params.length > 0) {
67
+ throw path.buildCodeFrameError("Vasille: Argument of calculate cannot have parameters");
30
68
  }
69
+ const exprData = (0, expression_js_1.checkNode)(path.get("arguments")[0], internal);
70
+ call.params = [...exprData.found.keys()].map(name => (0, expression_js_1.encodeName)(name));
71
+ return [call, t.arrayExpression([...exprData.found.values()])];
72
+ }
73
+ throw path.buildCodeFrameError("Vasille: Argument of calculate must be a function");
74
+ }
75
+ function parseCalculateCall(path, internal) {
76
+ if (t.isCallExpression(path.node) && (0, call_js_1.calls)(path, ["calculate", "watch"], internal)) {
77
+ return processCalculateCall(path, internal);
31
78
  }
32
79
  return null;
33
80
  }
34
- export function exprCall(path, expr, internal, name) {
81
+ function exprCall(path, expr, internal, name) {
35
82
  const calculateCall = parseCalculateCall(path, internal);
36
83
  if (calculateCall) {
37
84
  return named(t.callExpression(internal.stateOnly
38
85
  ? t.memberExpression(internal.id, t.identifier("ex"))
39
- : t.memberExpression(ctx, t.identifier("expr")), calculateCall), name, internal);
86
+ : t.memberExpression(internal_js_1.ctx, t.identifier("expr")), calculateCall), name, internal);
40
87
  }
41
88
  if (t.isCallExpression(expr) &&
42
- calls(expr, ["forward"], internal) &&
89
+ (0, call_js_1.calls)(path, ["forward"], internal) &&
43
90
  expr.arguments.length === 1 &&
44
91
  t.isExpression(expr.arguments[0])) {
45
92
  const data = exprCall(path.get("arguments")[0], expr.arguments[0], internal);
93
+ /* istanbul ignore else */
46
94
  if (data && !t.isCallExpression(data)) {
47
95
  return t.callExpression(t.memberExpression(internal.id, t.identifier("fo")), [data]);
48
96
  }
49
97
  }
50
- const exprData = checkNode(path, internal);
98
+ const exprData = (0, expression_js_1.checkNode)(path, internal);
51
99
  if (exprData.self) {
52
100
  return exprData.self;
53
101
  }
54
- const names = [...exprData.found.keys()].map(name => encodeName(name));
102
+ const names = [...exprData.found.keys()].map(expression_js_1.encodeName);
55
103
  const dependencies = t.arrayExpression([...exprData.found.values()]);
56
- if (names.length > 0 && expr) {
104
+ if (expr !== path.node && names.length === 1 && t.isIdentifier(path.node) && path.node.name === names[0].name) {
105
+ return [...exprData.found.values()][0];
106
+ }
107
+ if (names.length > 0 && path.node) {
57
108
  return named(t.callExpression(internal.stateOnly
58
109
  ? t.memberExpression(internal.id, t.identifier("ex"))
59
- : t.memberExpression(ctx, t.identifier("expr")), [t.arrowFunctionExpression(names, expr), dependencies]), name, internal);
110
+ : t.memberExpression(internal_js_1.ctx, t.identifier("expr")), [t.arrowFunctionExpression(names, path.node), dependencies]), name, internal);
60
111
  }
61
112
  return null;
62
113
  }
63
- export function forwardOnlyExpr(path, expr, internal) {
114
+ function forwardOnlyExpr(path, expr, internal) {
64
115
  const calculateCall = parseCalculateCall(path, internal);
65
116
  if (calculateCall) {
66
117
  return t.callExpression(t.memberExpression(internal.id, t.identifier("ex")), calculateCall);
67
118
  }
68
- const exprData = checkNode(path, internal);
119
+ const exprData = (0, expression_js_1.checkNode)(path, internal);
69
120
  return exprData.self
70
121
  ? t.callExpression(t.memberExpression(internal.id, t.identifier("fo")), [exprData.self])
71
122
  : exprData.found.size > 0 && expr
72
123
  ? t.callExpression(t.memberExpression(internal.id, t.identifier("ex")), [
73
- t.arrowFunctionExpression([...exprData.found.keys()].map(name => encodeName(name)), expr),
124
+ t.arrowFunctionExpression([...exprData.found.keys()].map(name => (0, expression_js_1.encodeName)(name)), expr),
74
125
  t.arrayExpression([...exprData.found.values()]),
75
126
  ])
76
127
  : null;
77
128
  }
78
- export function own(expr, internal, name) {
129
+ function own(expr, internal, name) {
79
130
  if (internal.stateOnly &&
80
131
  t.isCallExpression(expr) &&
81
132
  t.isMemberExpression(expr.callee) &&
@@ -87,22 +138,22 @@ export function own(expr, internal, name) {
87
138
  }
88
139
  return named(t.callExpression(internal.stateOnly
89
140
  ? t.memberExpression(internal.id, t.identifier("fo"))
90
- : t.memberExpression(ctx, t.identifier("own")), [expr]), name, internal);
141
+ : t.memberExpression(internal_js_1.ctx, t.identifier("own")), [expr]), name, internal);
91
142
  }
92
- export function ref(expr, internal, name) {
143
+ function ref(expr, internal, name) {
93
144
  return named(t.callExpression(internal.stateOnly
94
145
  ? t.memberExpression(internal.id, t.identifier("r"))
95
- : t.memberExpression(ctx, t.identifier("ref")), expr ? [expr] : []), name, internal, 1);
146
+ : t.memberExpression(internal_js_1.ctx, t.identifier("ref")), expr ? [expr] : []), name, internal, 1);
96
147
  }
97
- export function reactiveObject(init, internal, name) {
98
- return named(t.callExpression(t.memberExpression(internal.id, t.identifier(internal.stateOnly ? "sro" : "ro")), internal.stateOnly ? [init] : [ctx, init]), name, internal);
148
+ function reactiveObject(init, internal, name) {
149
+ return named(t.callExpression(t.memberExpression(internal.id, t.identifier(internal.stateOnly ? "sro" : "ro")), internal.stateOnly ? [init] : [internal_js_1.ctx, init]), name, internal);
99
150
  }
100
- export function arrayModel(init, internal, name) {
101
- return named(t.callExpression(t.memberExpression(internal.id, t.identifier(internal.stateOnly ? "sam" : "am")), internal.stateOnly ? (init ? [init] : []) : [ctx, ...(init ? [init] : [])]), name, internal, 2);
151
+ function arrayModel(init, internal, name) {
152
+ return named(t.callExpression(t.memberExpression(internal.id, t.identifier(internal.stateOnly ? "sam" : "am")), internal.stateOnly ? (init ? [init] : []) : [internal_js_1.ctx, ...(init ? [init] : [])]), name, internal, 2);
102
153
  }
103
- export function setModel(args, internal, name) {
104
- return named(t.callExpression(t.memberExpression(internal.id, t.identifier(internal.stateOnly ? "ssm" : "sm")), internal.stateOnly ? args : [ctx, ...args]), name, internal);
154
+ function setModel(args, internal, name) {
155
+ return named(t.callExpression(t.memberExpression(internal.id, t.identifier(internal.stateOnly ? "ssm" : "sm")), internal.stateOnly ? args : [internal_js_1.ctx, ...args]), name, internal);
105
156
  }
106
- export function mapModel(args, internal, name) {
107
- return named(t.callExpression(t.memberExpression(internal.id, t.identifier(internal.stateOnly ? "smm" : "mm")), internal.stateOnly ? args : [ctx, ...args]), name, internal);
157
+ function mapModel(args, internal, name) {
158
+ return named(t.callExpression(t.memberExpression(internal.id, t.identifier(internal.stateOnly ? "smm" : "mm")), internal.stateOnly ? args : [internal_js_1.ctx, ...args]), name, internal);
108
159
  }