babel-plugin-vasille 5.0.1 → 5.0.2

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/expression.js CHANGED
@@ -33,6 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.nodeIsMeshed = nodeIsMeshed;
36
37
  exports.idIsIValue = idIsIValue;
37
38
  exports.memberIsIValue = memberIsIValue;
38
39
  exports.memberIsIValueInExpr = memberIsIValueInExpr;
@@ -83,9 +84,13 @@ function addExpression(path, search) {
83
84
  path.replaceWith(found.paramName);
84
85
  }
85
86
  }
87
+ function nodeIsMeshed(path) {
88
+ const parent = path.parent;
89
+ return (t.isMemberExpression(parent) || t.isOptionalMemberExpression(parent)) && parent.property === internal_js_1.V;
90
+ }
86
91
  function meshIdentifier(path) {
87
- if (idIsIValue(path)) {
88
- path.replaceWith(t.memberExpression(path.node, t.identifier("V")));
92
+ if (idIsIValue(path) && !nodeIsMeshed(path)) {
93
+ path.replaceWith(t.memberExpression(path.node, internal_js_1.V));
89
94
  }
90
95
  }
91
96
  function idIsIValue(path) {
@@ -131,8 +136,8 @@ function exprIsSure(path, internal) {
131
136
  return (reactivityData && reactivityData[propPath]) || t.isMemberExpression(path.parent);
132
137
  }
133
138
  function meshMember(path) {
134
- if (memberIsIValue(path.node)) {
135
- path.replaceWith(t.memberExpression(path.node, t.identifier("V"), false, true));
139
+ if (memberIsIValue(path.node) && !nodeIsMeshed(path)) {
140
+ path.replaceWith(t.memberExpression(path.node, internal_js_1.V, false, true));
136
141
  }
137
142
  }
138
143
  function meshLValue(path, internal) {
package/lib/internal.js CHANGED
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.inspector = exports.runner = exports.ctx = exports.StackedStates = void 0;
36
+ exports.V = exports.inspector = exports.runner = exports.ctx = exports.StackedStates = void 0;
37
37
  const t = __importStar(require("@babel/types"));
38
38
  class StackedStates {
39
39
  maps = [];
@@ -66,3 +66,4 @@ exports.StackedStates = StackedStates;
66
66
  exports.ctx = t.identifier("Vasille");
67
67
  exports.runner = t.memberExpression(exports.ctx, t.identifier("runner"));
68
68
  exports.inspector = t.memberExpression(exports.runner, t.identifier("inspector"));
69
+ exports.V = t.identifier("V");
package/lib/mesh.js CHANGED
@@ -125,8 +125,8 @@ function meshExpression(nodePath, internal) {
125
125
  break;
126
126
  }
127
127
  case "Identifier": {
128
- if ((0, expression_js_1.idIsIValue)(nodePath)) {
129
- nodePath.replaceWith(t.memberExpression(expr, t.identifier("V")));
128
+ if ((0, expression_js_1.idIsIValue)(nodePath) && !(0, expression_js_1.nodeIsMeshed)(nodePath)) {
129
+ nodePath.replaceWith(t.memberExpression(expr, internal_js_1.V));
130
130
  }
131
131
  break;
132
132
  }
@@ -265,12 +265,12 @@ function meshExpression(nodePath, internal) {
265
265
  if (t.isExpression(property) && !t.isIdentifier(property)) {
266
266
  meshOrIgnoreExpression(path.get("property"), internal);
267
267
  }
268
- if ((0, expression_js_1.memberIsIValue)(node)) {
268
+ if ((0, expression_js_1.memberIsIValue)(node) && !(0, expression_js_1.nodeIsMeshed)(path)) {
269
269
  if ((0, expression_js_1.exprIsSure)(path, internal)) {
270
- path.replaceWith(t.memberExpression(path.node, t.identifier("V")));
270
+ path.replaceWith(t.memberExpression(path.node, internal_js_1.V));
271
271
  }
272
272
  else {
273
- path.replaceWith(t.optionalMemberExpression(path.node, t.identifier("V"), false, true));
273
+ path.replaceWith(t.optionalMemberExpression(path.node, internal_js_1.V, false, true));
274
274
  }
275
275
  }
276
276
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babel-plugin-vasille",
3
- "version": "5.0.1",
3
+ "version": "5.0.2",
4
4
  "description": "Convert Vasille Meta Language code to pure JavaScript",
5
5
  "main": "lib/index.js",
6
6
  "type": "commonjs",