babel-plugin-vasille 0.99.4 → 3.1.0

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-detect.js CHANGED
@@ -9,15 +9,6 @@ export function exprHasJsx(node) {
9
9
  if (t.isLogicalExpression(node)) {
10
10
  return exprHasJsx(node.left) || exprHasJsx(node.right);
11
11
  }
12
- if (t.isSequenceExpression(node)) {
13
- return node.expressions.some(item => exprHasJsx(item));
14
- }
15
- if (t.isParenthesizedExpression(node)) {
16
- return exprHasJsx(node.expression);
17
- }
18
- if (t.isDoExpression(node)) {
19
- return bodyHasJsx(node.body);
20
- }
21
12
  return t.isJSXElement(node) || t.isJSXFragment(node);
22
13
  }
23
14
  export function statementHasJsx(statement) {
@@ -50,6 +41,17 @@ export function statementHasJsx(statement) {
50
41
  if (t.isReturnStatement(statement)) {
51
42
  return !!statement.argument && exprHasJsx(statement.argument);
52
43
  }
44
+ if (t.isTryStatement(statement)) {
45
+ return (statementHasJsx(statement.block) ||
46
+ (!!statement.handler && statementHasJsx(statement.handler.body)) ||
47
+ (!!statement.finalizer && statementHasJsx(statement.finalizer)));
48
+ }
49
+ if (t.isIfStatement(statement)) {
50
+ return statementHasJsx(statement.consequent) || (!!statement.alternate && statementHasJsx(statement.alternate));
51
+ }
52
+ if (t.isForStatement(statement)) {
53
+ return statementHasJsx(statement.body);
54
+ }
53
55
  return false;
54
56
  }
55
57
  export function bodyHasJsx(node) {
package/lib/jsx.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as t from "@babel/types";
2
- import { ctx } from "./internal";
3
- import { exprCall } from "./lib";
4
- import { compose, meshExpression } from "./mesh";
5
- import { bodyHasJsx } from "./jsx-detect";
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
6
  export function transformJsx(path, internal) {
7
7
  if (t.isJSXElement(path.node)) {
8
8
  return [transformJsxElement(path, internal)];
@@ -54,37 +54,32 @@ export function transformJsxArray(paths, internal) {
54
54
  return result;
55
55
  }
56
56
  function transformJsxExpressionContainer(path, internal, acceptSlots, isInternalSlot) {
57
- if (!t.isExpression(path.node.expression)) {
58
- return t.booleanLiteral(true);
59
- }
60
- const loc = path.node.expression.loc;
57
+ const expression = path.node.expression;
58
+ const loc = expression.loc;
61
59
  if (acceptSlots &&
62
- (t.isFunctionExpression(path.node.expression) || t.isArrowFunctionExpression(path.node.expression)) &&
63
- bodyHasJsx(path.node.expression.body)) {
60
+ (t.isFunctionExpression(expression) || t.isArrowFunctionExpression(expression)) &&
61
+ bodyHasJsx(expression.body)) {
64
62
  compose(path.get("expression"), internal, isInternalSlot);
65
63
  if (!isInternalSlot) {
66
- if (path.node.expression.params.length < 1) {
67
- path.node.expression.params.push(t.identifier(internal.prefix));
64
+ if (expression.params.length < 1) {
65
+ expression.params.push(t.identifier(`_${internal.prefix}`));
68
66
  }
69
- path.node.expression.params.push(ctx);
67
+ expression.params.push(ctx);
70
68
  }
71
69
  else {
72
- path.node.expression.params.unshift(ctx);
70
+ expression.params.unshift(ctx);
73
71
  }
74
- path.node.expression.loc = loc;
75
- return path.node.expression;
72
+ expression.loc = loc;
73
+ return expression;
76
74
  }
77
- else if (isInternalSlot &&
78
- (t.isFunctionExpression(path.node.expression) || t.isArrowFunctionExpression(path.node.expression))) {
79
- path.node.expression.params.unshift(ctx);
75
+ else if (isInternalSlot && (t.isFunctionExpression(expression) || t.isArrowFunctionExpression(expression))) {
76
+ expression.params.unshift(ctx);
80
77
  }
81
- let call = exprCall(path.get("expression"), path.node.expression, internal);
82
- if (!call &&
83
- t.isIdentifier(path.node.expression) &&
84
- internal.stack.get(path.node.expression.name) === 3 /* VariableState.ReactiveObject */) {
85
- call = t.callExpression(t.memberExpression(internal.id, t.identifier("rop")), [path.node.expression]);
78
+ let call = exprCall(path.get("expression"), expression, internal);
79
+ if (!call && t.isIdentifier(expression) && internal.stack.get(expression.name) === 3 /* VariableState.ReactiveObject */) {
80
+ call = t.callExpression(t.memberExpression(internal.id, t.identifier("rop")), [expression]);
86
81
  }
87
- const result = call !== null && call !== void 0 ? call : path.node.expression;
82
+ const result = call ?? expression;
88
83
  result.loc = loc;
89
84
  return result;
90
85
  }
@@ -104,7 +99,6 @@ function idToProp(id, value, from) {
104
99
  return t.objectProperty(expr, value);
105
100
  }
106
101
  function transformJsxElement(path, internal) {
107
- var _a, _b;
108
102
  const name = path.node.openingElement.name;
109
103
  if (t.isJSXIdentifier(name) && name.name[0].toLowerCase() === name.name[0]) {
110
104
  const opening = path.get("openingElement");
@@ -146,7 +140,7 @@ function transformJsxElement(path, internal) {
146
140
  // class={[cond && "string"]}
147
141
  if (t.isLogicalExpression(item) && item.operator === "&&" && t.isStringLiteral(item.right)) {
148
142
  const call = exprCall(elementPath.get("left"), item.left, internal);
149
- classObject.push(idToProp(item.right, call !== null && call !== void 0 ? call : item.left));
143
+ classObject.push(idToProp(item.right, call ?? item.left));
150
144
  }
151
145
  // class={[{..}]}
152
146
  else if (t.isObjectExpression(item)) {
@@ -154,7 +148,7 @@ function transformJsxElement(path, internal) {
154
148
  // class={[{a: b}]}
155
149
  if (t.isObjectProperty(propPath.node)) {
156
150
  const prop = propPath;
157
- const value = (_a = exprCall(prop.get("value"), prop.node.value, internal)) !== null && _a !== void 0 ? _a : prop.node.value;
151
+ const value = exprCall(prop.get("value"), prop.node.value, internal) ?? prop.node.value;
158
152
  if (t.isExpression(prop.node.key) && !t.isIdentifier(prop.node.key)) {
159
153
  meshExpression(prop.get("key"), internal);
160
154
  }
@@ -166,7 +160,7 @@ function transformJsxElement(path, internal) {
166
160
  }
167
161
  // class={[{a(){}}]}
168
162
  else {
169
- throw propPath.buildCodeFrameError("Vasille: Methods are not alllowed here");
163
+ throw propPath.buildCodeFrameError("Vasille: Methods are not allowed here");
170
164
  }
171
165
  }
172
166
  }
@@ -177,7 +171,7 @@ function transformJsxElement(path, internal) {
177
171
  // class={[..]}
178
172
  else {
179
173
  const call = exprCall(elementPath, item, internal);
180
- classElements.push(call !== null && call !== void 0 ? call : item);
174
+ classElements.push(call ?? item);
181
175
  }
182
176
  }
183
177
  // class={[...array]}
@@ -195,19 +189,19 @@ function transformJsxElement(path, internal) {
195
189
  const jsxAttrPath = attrPath;
196
190
  const jsxContainerPath = jsxAttrPath.get("value");
197
191
  const value = exprCall(jsxContainerPath.get("expression"), attr.value.expression, internal);
198
- attrs.push(t.objectProperty(t.identifier("class"), value !== null && value !== void 0 ? value : attr.value.expression));
192
+ attrs.push(t.objectProperty(t.identifier("class"), value ?? attr.value.expression));
199
193
  if (value) {
200
194
  console.warn(attrPath.buildCodeFrameError("Vasille: This will slow down your application"));
201
195
  }
202
196
  }
197
+ // 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));
200
+ }
203
201
  // class="a b"
204
202
  else if (t.isStringLiteral(attr.value)) {
205
203
  classStatic.push(attr.value);
206
204
  }
207
- // class=<div/>
208
- else {
209
- throw attrPath.buildCodeFrameError('Vasille: Value of "class" attribute must be an array expression');
210
- }
211
205
  }
212
206
  else if (name.name === "style") {
213
207
  // style={{..}}
@@ -218,7 +212,7 @@ function transformJsxElement(path, internal) {
218
212
  // style={{a: b}}
219
213
  if (t.isObjectProperty(propPath.node)) {
220
214
  const prop = propPath;
221
- const value = (_b = exprCall(prop.get("value"), prop.node.value, internal)) !== null && _b !== void 0 ? _b : prop.node.value;
215
+ const value = exprCall(prop.get("value"), prop.node.value, internal) ?? prop.node.value;
222
216
  if (t.isExpression(prop.node.key) && !t.isIdentifier(prop.node.key)) {
223
217
  meshExpression(prop.get("key"), internal);
224
218
  }
@@ -254,10 +248,14 @@ function transformJsxElement(path, internal) {
254
248
  }
255
249
  // style={{a(){}}}
256
250
  else {
257
- throw propPath.buildCodeFrameError("Vasille: Methods are not alllowed here");
251
+ throw propPath.buildCodeFrameError("Vasille: Methods are not allowed here");
258
252
  }
259
253
  }
260
254
  }
255
+ // style=".."
256
+ else if (t.isStringLiteral(attr.value)) {
257
+ attrs.push(t.objectProperty(t.identifier("style"), attr.value));
258
+ }
261
259
  // style={".."}
262
260
  else if (t.isJSXExpressionContainer(attr.value) && t.isStringLiteral(attr.value.expression)) {
263
261
  attrs.push(t.objectProperty(t.identifier("style"), attr.value.expression));
@@ -268,42 +266,32 @@ function transformJsxElement(path, internal) {
268
266
  const jsxContainerPath = jsxAttrPath.get("value");
269
267
  const literalPath = jsxContainerPath.get("expression");
270
268
  const value = exprCall(literalPath, attr.value.expression, internal);
271
- attrs.push(t.objectProperty(t.identifier("style"), value !== null && value !== void 0 ? value : attr.value.expression));
269
+ attrs.push(t.objectProperty(t.identifier("style"), value ?? attr.value.expression));
272
270
  if (value) {
273
271
  console.warn(attrPath.buildCodeFrameError("Vasille: This will slow down your application"));
274
272
  }
275
273
  }
276
- // style=<div/>
277
- else {
278
- throw attrPath.buildCodeFrameError('Vasille: Value of "style" attribute must be an object expression');
279
- }
280
274
  }
281
275
  else {
282
- if (t.isJSXExpressionContainer(attr.value)) {
283
- attrs.push(idToProp(name, t.isExpression(attr.value.expression) ? attr.value.expression : t.booleanLiteral(true)));
276
+ if (!attr.value || t.isJSXExpressionContainer(attr.value)) {
277
+ attrs.push(idToProp(name, t.isExpression(attr.value?.expression) ? attr.value.expression : t.booleanLiteral(true)));
284
278
  }
285
279
  else if (t.isStringLiteral(attr.value)) {
286
280
  attrs.push(idToProp(name, attr.value));
287
281
  }
288
- else {
289
- throw attrPath.buildCodeFrameError("Vasille: Value of bind must be an expression or string");
290
- }
291
282
  }
292
283
  }
293
284
  if (t.isJSXNamespacedName(name)) {
294
285
  if (name.namespace.name === "bind") {
295
- if (t.isJSXExpressionContainer(attr.value)) {
296
- const value = t.isExpression(attr.value.expression)
297
- ? exprCall(attrPath.get("value"), attr.value.expression, internal)
286
+ if (t.isJSXExpressionContainer(attr.value) || !attr.value) {
287
+ const value = t.isExpression(attr.value?.expression)
288
+ ? exprCall(attrPath.get("value").get("expression"), attr.value.expression, internal)
298
289
  : undefined;
299
- bind.push(idToProp(name.name, value !== null && value !== void 0 ? value : (t.isExpression(attr.value.expression) ? attr.value.expression : t.booleanLiteral(true))));
290
+ bind.push(idToProp(name.name, value ?? (t.isExpression(attr.value?.expression) ? attr.value.expression : t.booleanLiteral(true))));
300
291
  }
301
292
  else if (t.isStringLiteral(attr.value)) {
302
293
  bind.push(idToProp(name.name, attr.value));
303
294
  }
304
- else {
305
- throw attrPath.buildCodeFrameError("Vasille: Value of bind must be an expression or string");
306
- }
307
295
  }
308
296
  else {
309
297
  throw attrPath.buildCodeFrameError("Vasille: only bind namespace is supported");
@@ -368,8 +356,8 @@ function transformJsxElement(path, internal) {
368
356
  const value = transformJsxExpressionContainer(attrPath.get("value"), internal, !isSystem || attr.name.name === "slot", isSystem && attr.name.name === "slot");
369
357
  props.push(idToProp(attr.name, value));
370
358
  }
371
- else {
372
- throw attrPath.buildCodeFrameError("Vasille: JSX Elements/Fragments are not supported here");
359
+ else if (!attr.value) {
360
+ props.push(idToProp(attr.name, t.booleanLiteral(true)));
373
361
  }
374
362
  }
375
363
  // <A {...arg}/>
@@ -381,22 +369,33 @@ function transformJsxElement(path, internal) {
381
369
  throw attrPath.buildCodeFrameError("Vasille: Namespaced attributes names are not supported");
382
370
  }
383
371
  }
384
- if (element.children.length === 1 &&
385
- t.isJSXExpressionContainer(element.children[0]) &&
386
- (t.isFunctionExpression(element.children[0].expression) ||
387
- t.isArrowFunctionExpression(element.children[0].expression))) {
388
- run = element.children[0].expression;
389
- run.params.push(ctx);
372
+ const filteredChildren = element.children.filter(item => {
373
+ if (!t.isJSXText(item)) {
374
+ return true;
375
+ }
376
+ return !!item.value.trim();
377
+ });
378
+ const isInternal = internal.mapping.has(name.name);
379
+ if (filteredChildren.length === 1 &&
380
+ t.isJSXExpressionContainer(filteredChildren[0]) &&
381
+ (t.isFunctionExpression(filteredChildren[0].expression) ||
382
+ t.isArrowFunctionExpression(filteredChildren[0].expression))) {
383
+ transformJsxExpressionContainer(path.get("children")[element.children.indexOf(filteredChildren[0])], internal, true, isInternal);
384
+ run = filteredChildren[0].expression;
390
385
  }
391
386
  else {
392
387
  const statements = transformJsxArray(path.get("children"), internal);
393
388
  if (statements.length > 0) {
394
- run = t.arrowFunctionExpression([ctx], t.blockStatement(statements));
389
+ const params = [ctx];
390
+ if (!isInternal) {
391
+ params.unshift(t.identifier(`_${internal.prefix}`));
392
+ }
393
+ run = t.arrowFunctionExpression(params, t.blockStatement(statements));
395
394
  }
396
395
  }
397
396
  const call = t.callExpression(t.identifier(name.name), [ctx, t.objectExpression(props), ...(run ? [run] : [])]);
398
397
  call.loc = path.node.loc;
399
398
  return t.expressionStatement(call);
400
399
  }
401
- throw path.buildCodeFrameError("Vasille: Unsupported tag detected, html lowercase tagnames and components are accepted");
400
+ throw path.buildCodeFrameError("Vasille: Unsupported tag detected, html lowercase tag names and components are accepted");
402
401
  }
package/lib/lib.js CHANGED
@@ -1,19 +1,29 @@
1
1
  import * as t from "@babel/types";
2
- import { checkNode, encodeName } from "./expression";
3
- import { ctx } from "./internal";
4
- import { calls } from "./call";
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) {
6
+ if (internal.devMode && !internal.stateOnly && name) {
7
+ while (argPos && call.arguments.length < argPos) {
8
+ call.arguments.push(t.buildUndefinedNode());
9
+ }
10
+ call.arguments.push(...(typeof name === "string" ? [t.stringLiteral(name)] : name.map(item => t.stringLiteral(item))));
11
+ }
12
+ return call;
13
+ }
5
14
  export function parseCalculateCall(path, internal) {
6
15
  if (t.isCallExpression(path.node) && calls(path.node, ["calculate", "watch"], internal)) {
16
+ const call = path.node.arguments[0];
7
17
  if (path.node.arguments.length !== 1) {
8
18
  throw path.buildCodeFrameError("Vasille: Incorrect number of arguments");
9
19
  }
10
- if (t.isFunctionExpression(path.node.arguments[0]) || t.isArrowFunctionExpression(path.node.arguments[0])) {
11
- if (path.node.arguments[0].params.length > 0) {
20
+ if (t.isFunctionExpression(call) || t.isArrowFunctionExpression(call)) {
21
+ if (call.params.length > 0) {
12
22
  throw path.buildCodeFrameError("Vasille: Argument of calculate cannot have parameters");
13
23
  }
14
24
  const exprData = checkNode(path.get("arguments")[0], internal);
15
- path.node.arguments[0].params = [...exprData.found.keys()].map(name => encodeName(name));
16
- return [path.node.arguments[0], ...exprData.found.values()];
25
+ call.params = [...exprData.found.keys()].map(name => encodeName(name));
26
+ return [call, t.arrayExpression([...exprData.found.values()])];
17
27
  }
18
28
  else {
19
29
  throw path.buildCodeFrameError("Vasille: Argument of calculate must be a function");
@@ -21,41 +31,36 @@ export function parseCalculateCall(path, internal) {
21
31
  }
22
32
  return null;
23
33
  }
24
- export function exprCall(path, expr, internal) {
34
+ export function exprCall(path, expr, internal, name) {
25
35
  const calculateCall = parseCalculateCall(path, internal);
26
36
  if (calculateCall) {
27
- return t.callExpression(t.memberExpression(ctx, t.identifier("expr")), calculateCall);
37
+ return named(t.callExpression(internal.stateOnly
38
+ ? t.memberExpression(internal.id, t.identifier("ex"))
39
+ : t.memberExpression(ctx, t.identifier("expr")), calculateCall), name, internal);
40
+ }
41
+ if (t.isCallExpression(expr) &&
42
+ calls(expr, ["forward"], internal) &&
43
+ expr.arguments.length === 1 &&
44
+ t.isExpression(expr.arguments[0])) {
45
+ const data = exprCall(path.get("arguments")[0], expr.arguments[0], internal);
46
+ if (data && !t.isCallExpression(data)) {
47
+ return t.callExpression(t.memberExpression(internal.id, t.identifier("fo")), [data]);
48
+ }
28
49
  }
29
50
  const exprData = checkNode(path, internal);
30
- return exprData.self
31
- ? exprData.self
32
- : exprData.found.size > 0 && expr
33
- ? t.callExpression(t.memberExpression(ctx, t.identifier("expr")), [
34
- t.arrowFunctionExpression([...exprData.found.keys()].map(name => encodeName(name)), expr),
35
- ...exprData.found.values(),
36
- ])
37
- : null;
51
+ if (exprData.self) {
52
+ return exprData.self;
53
+ }
54
+ const names = [...exprData.found.keys()].map(name => encodeName(name));
55
+ const dependencies = t.arrayExpression([...exprData.found.values()]);
56
+ if (names.length > 0 && expr) {
57
+ return named(t.callExpression(internal.stateOnly
58
+ ? t.memberExpression(internal.id, t.identifier("ex"))
59
+ : t.memberExpression(ctx, t.identifier("expr")), [t.arrowFunctionExpression(names, expr), dependencies]), name, internal);
60
+ }
61
+ return null;
38
62
  }
39
63
  export function forwardOnlyExpr(path, expr, internal) {
40
- if (t.isCallExpression(path.node) && calls(path.node, ["calculate"], internal)) {
41
- if (path.node.arguments.length !== 1) {
42
- throw path.buildCodeFrameError("Vasille: Incorrect number of arguments");
43
- }
44
- if (t.isFunctionExpression(path.node.arguments[0]) || t.isArrowFunctionExpression(path.node.arguments[0])) {
45
- if (path.node.arguments[0].params.length > 0) {
46
- throw path.buildCodeFrameError("Vasille: Argument of calculate cannot have parameters");
47
- }
48
- const exprData = checkNode(path.get("arguments")[0], internal);
49
- path.node.arguments[0].params = [...exprData.found.keys()].map(name => encodeName(name));
50
- return t.callExpression(t.memberExpression(internal.id, t.identifier("ex")), [
51
- path.node.arguments[0],
52
- ...exprData.found.values(),
53
- ]);
54
- }
55
- else {
56
- throw path.buildCodeFrameError("Vasille: Argument of calculate must be a function");
57
- }
58
- }
59
64
  const calculateCall = parseCalculateCall(path, internal);
60
65
  if (calculateCall) {
61
66
  return t.callExpression(t.memberExpression(internal.id, t.identifier("ex")), calculateCall);
@@ -66,25 +71,38 @@ export function forwardOnlyExpr(path, expr, internal) {
66
71
  : exprData.found.size > 0 && expr
67
72
  ? t.callExpression(t.memberExpression(internal.id, t.identifier("ex")), [
68
73
  t.arrowFunctionExpression([...exprData.found.keys()].map(name => encodeName(name)), expr),
69
- ...exprData.found.values(),
74
+ t.arrayExpression([...exprData.found.values()]),
70
75
  ])
71
76
  : null;
72
77
  }
73
- export function own(expr) {
74
- return t.callExpression(t.memberExpression(ctx, t.identifier("own")), [expr]);
78
+ export function own(expr, internal, name) {
79
+ if (internal.stateOnly &&
80
+ t.isCallExpression(expr) &&
81
+ t.isMemberExpression(expr.callee) &&
82
+ t.isIdentifier(expr.callee.property) &&
83
+ expr.callee.property.name === "fo" &&
84
+ t.isIdentifier(expr.callee.object) &&
85
+ expr.callee.object === internal.id) {
86
+ return expr;
87
+ }
88
+ return named(t.callExpression(internal.stateOnly
89
+ ? t.memberExpression(internal.id, t.identifier("fo"))
90
+ : t.memberExpression(ctx, t.identifier("own")), [expr]), name, internal);
75
91
  }
76
- export function ref(expr) {
77
- return t.callExpression(t.memberExpression(ctx, t.identifier("ref")), expr ? [expr] : []);
92
+ export function ref(expr, internal, name) {
93
+ return named(t.callExpression(internal.stateOnly
94
+ ? t.memberExpression(internal.id, t.identifier("r"))
95
+ : t.memberExpression(ctx, t.identifier("ref")), expr ? [expr] : []), name, internal, 1);
78
96
  }
79
- export function reactiveObject(init, internal) {
80
- return t.callExpression(t.memberExpression(internal.id, t.identifier("ro")), [ctx, init]);
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);
81
99
  }
82
- export function arrayModel(init, internal) {
83
- return t.callExpression(t.memberExpression(internal.id, t.identifier("am")), [ctx, ...(init ? [init] : [])]);
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);
84
102
  }
85
- export function setModel(args, internal) {
86
- return t.callExpression(t.memberExpression(internal.id, t.identifier("sm")), [ctx, ...args]);
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);
87
105
  }
88
- export function mapModel(args, internal) {
89
- return t.callExpression(t.memberExpression(internal.id, t.identifier("mm")), [ctx, ...args]);
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);
90
108
  }