babel-plugin-vasille 5.1.1 → 5.1.3
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/communication.js +2 -0
- package/lib/expression.js +10 -10
- package/lib/index.js +2 -0
- package/lib/jsx.js +16 -22
- package/lib/lib.js +4 -4
- package/lib/mesh.js +16 -12
- package/lib/operators.js +90 -0
- package/lib/transformer.js +29 -2
- package/package.json +6 -4
- package/types/call.d.ts +14 -0
- package/types/communication.d.ts +11 -0
- package/types/css-transformer.d.ts +3 -0
- package/types/expression.d.ts +27 -0
- package/types/index.d.ts +19 -0
- package/types/internal.d.ts +55 -0
- package/types/jsx-detect.d.ts +3 -0
- package/types/jsx.d.ts +11 -0
- package/types/lib.d.ts +30 -0
- package/types/mesh.d.ts +19 -0
- package/types/operators.d.ts +25 -0
- package/types/order-check.d.ts +3 -0
- package/types/process-types.d.ts +15 -0
- package/types/router.d.ts +2 -0
- package/types/transformer.d.ts +16 -0
- package/types/utils.d.ts +2 -0
package/lib/expression.js
CHANGED
|
@@ -54,6 +54,7 @@ const lib_1 = require("./lib");
|
|
|
54
54
|
const mesh_1 = require("./mesh");
|
|
55
55
|
const router_1 = require("./router");
|
|
56
56
|
const utils_1 = require("./utils");
|
|
57
|
+
const operators_1 = require("./operators");
|
|
57
58
|
function insertName(name, search) {
|
|
58
59
|
const id = t.identifier(name);
|
|
59
60
|
search?.inserted.add(id);
|
|
@@ -69,7 +70,8 @@ function addExpression(path, search) {
|
|
|
69
70
|
let it = path.node;
|
|
70
71
|
while (t.isMemberExpression(it) || t.isIdentifier(it)) {
|
|
71
72
|
const name = (0, utils_1.stringify)(t.isMemberExpression(it) ? it.property : it);
|
|
72
|
-
|
|
73
|
+
const computed = t.isMemberExpression(it) ? it.computed : false;
|
|
74
|
+
if (it !== path.node && name.startsWith("$") && !computed) {
|
|
73
75
|
(0, lib_1.err)(lib_1.Errors.RulesOfVasille, path, "The reactive/observable value is nested", search.external, null);
|
|
74
76
|
}
|
|
75
77
|
it = t.isMemberExpression(it) ? it.object : null;
|
|
@@ -95,10 +97,11 @@ function meshIdentifier(path) {
|
|
|
95
97
|
}
|
|
96
98
|
function idIsIValue(path) {
|
|
97
99
|
const node = path.node;
|
|
98
|
-
return node.name.startsWith("$") &&
|
|
100
|
+
return (node.name.startsWith("$") &&
|
|
101
|
+
(!(t.isMemberExpression(path.parent) && !path.parent.computed) || path.parent.object === node));
|
|
99
102
|
}
|
|
100
103
|
function memberIsIValue(node) {
|
|
101
|
-
return ((t.isIdentifier(node.property) && node.property.name.startsWith("$")) ||
|
|
104
|
+
return ((t.isIdentifier(node.property) && node.property.name.startsWith("$") && !node.computed) ||
|
|
102
105
|
(t.isStringLiteral(node.property) && node.property.value.startsWith("$")));
|
|
103
106
|
}
|
|
104
107
|
function memberIsIValueInExpr(path, search) {
|
|
@@ -191,6 +194,9 @@ function checkNode(path, internal, area, name) {
|
|
|
191
194
|
path.replaceWith((0, lib_1.ref)(refValue, internal, area, name));
|
|
192
195
|
search.self = path.node;
|
|
193
196
|
}
|
|
197
|
+
if (path.isTSAsExpression() || path.isTSSatisfiesExpression()) {
|
|
198
|
+
return checkNode(path.get("expression"), internal, area, name);
|
|
199
|
+
}
|
|
194
200
|
if (search.self) {
|
|
195
201
|
return search;
|
|
196
202
|
}
|
|
@@ -302,13 +308,7 @@ function checkExpression(nodePath, search) {
|
|
|
302
308
|
const left = path.get("left");
|
|
303
309
|
const right = path.get("right");
|
|
304
310
|
if (left.isMemberExpression() && !exprIsSure(left, search.external)) {
|
|
305
|
-
|
|
306
|
-
(0, mesh_1.meshExpression)(left.get("object"), search.external);
|
|
307
|
-
checkExpression(right, search);
|
|
308
|
-
/* istanbul ignore else */
|
|
309
|
-
if (!t.isPrivateName(property)) {
|
|
310
|
-
path.replaceWith(search.external.set(left.node.object, !left.node.computed && t.isIdentifier(property) ? t.stringLiteral(property.name) : property, right.node, path.node));
|
|
311
|
-
}
|
|
311
|
+
(0, operators_1.meshAssigment)(path, left, right, left.node.property, search.external);
|
|
312
312
|
}
|
|
313
313
|
else {
|
|
314
314
|
meshLValue(left, search.external);
|
package/lib/index.js
CHANGED
|
@@ -14,6 +14,8 @@ function default_1() {
|
|
|
14
14
|
headTag: !!params.opts.headTag,
|
|
15
15
|
bodyTag: !!params.opts.bodyTag,
|
|
16
16
|
shadow: !!params.opts.shadow,
|
|
17
|
+
throwAtFirstError: !!params.opts.throwAtFirstError,
|
|
18
|
+
reporter: typeof params.opts.reporter === "function" ? params.opts.reporter : undefined,
|
|
17
19
|
});
|
|
18
20
|
},
|
|
19
21
|
},
|
package/lib/jsx.js
CHANGED
|
@@ -48,18 +48,21 @@ function transformJsx(path, conditions, internal) {
|
|
|
48
48
|
}
|
|
49
49
|
return transformJsxArray(path.get("children"), internal);
|
|
50
50
|
}
|
|
51
|
+
function textIsSpacesOnly(node) {
|
|
52
|
+
return t.isJSXText(node) && /^\s+$/.test(node.value) && node.value !== " ";
|
|
53
|
+
}
|
|
51
54
|
function transformJsxArray(paths, internal) {
|
|
52
55
|
const result = [];
|
|
53
56
|
const conditions = { cases: null };
|
|
54
57
|
paths.forEach(path => {
|
|
55
|
-
if (!path.isJSXElement() && !(path.
|
|
58
|
+
if (!path.isJSXElement() && !textIsSpacesOnly(path.node)) {
|
|
56
59
|
result.push(...processConditions(conditions, internal));
|
|
57
60
|
}
|
|
58
61
|
if (path.isJSXElement() || path.isJSXFragment()) {
|
|
59
62
|
result.push(...transformJsx(path, conditions, internal));
|
|
60
63
|
}
|
|
61
64
|
else if (path.isJSXText()) {
|
|
62
|
-
if (
|
|
65
|
+
if (!textIsSpacesOnly(path.node)) {
|
|
63
66
|
const fixed = path.node.value
|
|
64
67
|
.replace(/\n\s+$/m, "")
|
|
65
68
|
.replace(/^\s*\n\s+/m, "")
|
|
@@ -284,7 +287,7 @@ function transformJsxElement(path, conditions, internal) {
|
|
|
284
287
|
}
|
|
285
288
|
}
|
|
286
289
|
else {
|
|
287
|
-
(0, lib_js_1.err)(lib_js_1.Errors.TokenNotSupported,
|
|
290
|
+
(0, lib_js_1.err)(lib_js_1.Errors.TokenNotSupported, attrPath, "Expected event handler", internal);
|
|
288
291
|
}
|
|
289
292
|
}
|
|
290
293
|
else if (name.name === "class") {
|
|
@@ -349,7 +352,7 @@ function transformJsxElement(path, conditions, internal) {
|
|
|
349
352
|
// class={`a ${b}`}
|
|
350
353
|
else if (expressionPath && expressionPath.isExpression()) {
|
|
351
354
|
if ((0, lib_js_1.exprCall)(expressionPath, expressionPath.node, internal, { strong: true }, expressionPath.node)) {
|
|
352
|
-
|
|
355
|
+
internal.reportError("This will slow down your application", attrPath.node);
|
|
353
356
|
}
|
|
354
357
|
attrs.push(t.objectProperty(t.identifier("class"), expressionPath.node));
|
|
355
358
|
}
|
|
@@ -427,7 +430,7 @@ function transformJsxElement(path, conditions, internal) {
|
|
|
427
430
|
/* istanbul ignore else */
|
|
428
431
|
if (expressionPath && expressionPath.isExpression()) {
|
|
429
432
|
if ((0, lib_js_1.exprCall)(expressionPath, expressionPath.node, internal, { strong: true }, expressionPath.node)) {
|
|
430
|
-
|
|
433
|
+
internal.reportError("This will slow down your application", attrPath.node);
|
|
431
434
|
}
|
|
432
435
|
attrs.push(t.objectProperty(t.identifier("style"), expressionPath.node));
|
|
433
436
|
}
|
|
@@ -561,26 +564,16 @@ function transformJsxElement(path, conditions, internal) {
|
|
|
561
564
|
if (!t.isJSXText(item)) {
|
|
562
565
|
return true;
|
|
563
566
|
}
|
|
564
|
-
return
|
|
567
|
+
return !textIsSpacesOnly(item);
|
|
565
568
|
});
|
|
566
569
|
const isInternal = internal.mapping.has(name.name);
|
|
567
|
-
|
|
568
|
-
if (
|
|
569
|
-
|
|
570
|
-
(
|
|
571
|
-
t.
|
|
572
|
-
transformJsxExpressionContainer(path.get("children")[element.children.indexOf(filteredChildren[0])], internal, true, isInternal, false, true);
|
|
573
|
-
run = filteredChildren[0].expression;
|
|
574
|
-
}
|
|
575
|
-
else {
|
|
576
|
-
const statements = transformJsxArray(path.get("children"), internal);
|
|
577
|
-
if (statements.length > 0) {
|
|
578
|
-
const params = [internal_js_1.ctx];
|
|
579
|
-
if (!isInternal) {
|
|
580
|
-
params.unshift(t.identifier(`_${internal.prefix}`));
|
|
581
|
-
}
|
|
582
|
-
run = t.arrowFunctionExpression(params, t.blockStatement(statements));
|
|
570
|
+
const statements = transformJsxArray(path.get("children"), internal);
|
|
571
|
+
if (statements.length > 0) {
|
|
572
|
+
const params = [internal_js_1.ctx];
|
|
573
|
+
if (!isInternal) {
|
|
574
|
+
params.unshift(t.identifier(`_${internal.prefix}`));
|
|
583
575
|
}
|
|
576
|
+
run = t.arrowFunctionExpression(params, t.blockStatement(statements));
|
|
584
577
|
}
|
|
585
578
|
const ret = [];
|
|
586
579
|
const filter = (v) => {
|
|
@@ -601,6 +594,7 @@ function transformJsxElement(path, conditions, internal) {
|
|
|
601
594
|
(0, lib_js_1.err)(lib_js_1.Errors.RulesOfVasille, path, "Malformed JSX If tag is missing", internal);
|
|
602
595
|
}
|
|
603
596
|
if (mapped === "If" || mapped === "ElseIf") {
|
|
597
|
+
/* istanbul ignore else */
|
|
604
598
|
if (t.isExpression(condition) && (t.isFunctionExpression(slot) || t.isArrowFunctionExpression(slot))) {
|
|
605
599
|
if (!conditions.cases) {
|
|
606
600
|
conditions.cases = [{ condition, slot }];
|
package/lib/lib.js
CHANGED
|
@@ -68,10 +68,7 @@ function err(e, node, content, internal, ret) {
|
|
|
68
68
|
Error.stackTraceLimit = 0;
|
|
69
69
|
const error = node.buildCodeFrameError(`Vasille[${e}]{${Errors[e]}}: ${content}`, Error);
|
|
70
70
|
Error.stackTraceLimit = limit;
|
|
71
|
-
|
|
72
|
-
internal.firstError = error;
|
|
73
|
-
}
|
|
74
|
-
console.log(error);
|
|
71
|
+
internal.reportError(`${Errors[e]}: ${content}`, node.node, error);
|
|
75
72
|
return ret;
|
|
76
73
|
}
|
|
77
74
|
function processCalculateCall(path, internal, area, name) {
|
|
@@ -115,6 +112,9 @@ function bindCall(path, expr, data, internal, name) {
|
|
|
115
112
|
return false;
|
|
116
113
|
}
|
|
117
114
|
function exprCall(path, expr, internal, opts, area) {
|
|
115
|
+
if (path.isTSAsExpression() || path.isTSSatisfiesExpression()) {
|
|
116
|
+
return exprCall(path.get("expression"), path.node.expression, internal, opts, area);
|
|
117
|
+
}
|
|
118
118
|
if (parseCalculateCall(path, internal, area, opts.name)) {
|
|
119
119
|
return true;
|
|
120
120
|
}
|
package/lib/mesh.js
CHANGED
|
@@ -61,6 +61,7 @@ const router_1 = require("./router");
|
|
|
61
61
|
const utils_1 = require("./utils");
|
|
62
62
|
const transformer_1 = require("./transformer");
|
|
63
63
|
const process_types_1 = require("./process-types");
|
|
64
|
+
const operators_1 = require("./operators");
|
|
64
65
|
function meshOrIgnoreAllExpressions(nodePaths, internal) {
|
|
65
66
|
for (const path of nodePaths) {
|
|
66
67
|
/* istanbul ignore else */
|
|
@@ -285,12 +286,7 @@ function meshExpression(nodePath, internal) {
|
|
|
285
286
|
property.name[0] === "$" &&
|
|
286
287
|
t.isThisExpression(left.node.object) &&
|
|
287
288
|
((right.isIdentifier() && (0, expression_js_1.idIsIValue)(right)) || (right.isMemberExpression() && (0, expression_js_1.memberIsIValue)(right.node))))) {
|
|
288
|
-
|
|
289
|
-
meshExpression(right, internal);
|
|
290
|
-
/* istanbul ignore else */
|
|
291
|
-
if (!t.isPrivateName(property)) {
|
|
292
|
-
path.replaceWith(internal.set(left.node.object, !left.node.computed && t.isIdentifier(property) ? t.stringLiteral(property.name) : property, right.node, path.node));
|
|
293
|
-
}
|
|
289
|
+
(0, operators_1.meshAssigment)(path, left, right, property, internal);
|
|
294
290
|
}
|
|
295
291
|
}
|
|
296
292
|
else if (internal.devLayer &&
|
|
@@ -309,9 +305,10 @@ function meshExpression(nodePath, internal) {
|
|
|
309
305
|
const path = nodePath;
|
|
310
306
|
const node = path.node;
|
|
311
307
|
const property = path.node.property;
|
|
308
|
+
const propertyPath = path.get("property");
|
|
312
309
|
meshExpression(path.get("object"), internal);
|
|
313
|
-
if (t.isExpression(property) && !
|
|
314
|
-
meshOrIgnoreExpression(
|
|
310
|
+
if (t.isExpression(property) && (!propertyPath.isIdentifier() || (node.computed && (0, expression_js_1.idIsIValue)(propertyPath)))) {
|
|
311
|
+
meshOrIgnoreExpression(propertyPath, internal);
|
|
315
312
|
}
|
|
316
313
|
if ((0, expression_js_1.memberIsIValue)(node)) {
|
|
317
314
|
if (!(0, expression_js_1.nodeIsMeshed)(path)) {
|
|
@@ -1113,6 +1110,15 @@ function composeStatement(path, internal) {
|
|
|
1113
1110
|
}
|
|
1114
1111
|
meshInit = false;
|
|
1115
1112
|
}
|
|
1113
|
+
else if ((0, call_js_1.calls)(declaration.get("init"), call_js_1.dependencyInjections, internal)) {
|
|
1114
|
+
const callPath = declaration.get("init");
|
|
1115
|
+
callPath.node.arguments.unshift(internal_js_1.ctx);
|
|
1116
|
+
meshAllUnknown(callPath.get("arguments"), internal);
|
|
1117
|
+
meshInit = false;
|
|
1118
|
+
if (t.isIdentifier(id)) {
|
|
1119
|
+
(0, lib_js_1.checkNonReactiveName)(declaration.get("id"), internal);
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1116
1122
|
else if (t.isIdentifier(id)) {
|
|
1117
1123
|
const idPath = declaration.get("id");
|
|
1118
1124
|
internal.stack.set(id.name, {});
|
|
@@ -1130,9 +1136,6 @@ function composeStatement(path, internal) {
|
|
|
1130
1136
|
const argument = init.arguments[0];
|
|
1131
1137
|
const isReactive = (0, lib_js_1.exprCall)(initPath, initPath.node, internal, { name: idName(), strong: true }, declaration.node);
|
|
1132
1138
|
meshInit = !isReactive;
|
|
1133
|
-
if (!isReactive) {
|
|
1134
|
-
declaration.get("init").replaceWith((0, lib_js_1.ref)(argument, internal, declaration.node, idName()));
|
|
1135
|
-
}
|
|
1136
1139
|
(0, lib_js_1.checkReactiveName)(idPath, internal);
|
|
1137
1140
|
}
|
|
1138
1141
|
// let y = ref(2)
|
|
@@ -1190,7 +1193,8 @@ function composeStatement(path, internal) {
|
|
|
1190
1193
|
else if (kind === "const" &&
|
|
1191
1194
|
(initPath.isOptionalMemberExpression() || initPath.isMemberExpression()) &&
|
|
1192
1195
|
initPath.node.computed &&
|
|
1193
|
-
t.isIdentifier(initPath.node.property)
|
|
1196
|
+
t.isIdentifier(initPath.node.property) &&
|
|
1197
|
+
!(0, expression_js_1.idIsIValue)(initPath.get("property"))) {
|
|
1194
1198
|
const path = initPath;
|
|
1195
1199
|
const property = path.get("property");
|
|
1196
1200
|
meshExpression(path.get("object"), internal);
|
package/lib/operators.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
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.assignmentToBinaryOperator = assignmentToBinaryOperator;
|
|
37
|
+
exports.assignmentToLogicalOperator = assignmentToLogicalOperator;
|
|
38
|
+
exports.meshAssigment = meshAssigment;
|
|
39
|
+
const internal_1 = require("./internal");
|
|
40
|
+
const mesh_1 = require("./mesh");
|
|
41
|
+
const t = __importStar(require("@babel/types"));
|
|
42
|
+
const assigmentToBinaryMap = {
|
|
43
|
+
"+=": "+",
|
|
44
|
+
"-=": "-",
|
|
45
|
+
"/=": "/",
|
|
46
|
+
"%=": "%",
|
|
47
|
+
"*=": "*",
|
|
48
|
+
"**=": "**",
|
|
49
|
+
"&=": "&",
|
|
50
|
+
"|=": "|",
|
|
51
|
+
">>=": ">>",
|
|
52
|
+
">>>=": ">>>",
|
|
53
|
+
"<<=": "<<",
|
|
54
|
+
"^=": "^",
|
|
55
|
+
};
|
|
56
|
+
const assigmentToLogicalMap = {
|
|
57
|
+
"&&=": "&&",
|
|
58
|
+
"||=": "||",
|
|
59
|
+
"??=": "??",
|
|
60
|
+
};
|
|
61
|
+
function assignmentToBinaryOperator(operator) {
|
|
62
|
+
if (operator in assigmentToBinaryMap) {
|
|
63
|
+
return assigmentToBinaryMap[operator];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function assignmentToLogicalOperator(operator) {
|
|
67
|
+
if (operator in assigmentToLogicalMap) {
|
|
68
|
+
return assigmentToLogicalMap[operator];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function meshAssigment(path, left, right, property, internal) {
|
|
72
|
+
const binary = assignmentToBinaryOperator(path.node.operator);
|
|
73
|
+
const logical = assignmentToLogicalOperator(path.node.operator);
|
|
74
|
+
(0, mesh_1.meshExpression)(left.get("object"), internal);
|
|
75
|
+
(0, mesh_1.meshExpression)(right, internal);
|
|
76
|
+
/* istanbul ignore else */
|
|
77
|
+
if (!t.isPrivateName(property)) {
|
|
78
|
+
let replaceWith = right.node;
|
|
79
|
+
if (logical || binary) {
|
|
80
|
+
const meshedLeft = t.optionalMemberExpression(left.node, internal_1.V, false, true);
|
|
81
|
+
if (binary) {
|
|
82
|
+
replaceWith = t.binaryExpression(binary, meshedLeft, right.node);
|
|
83
|
+
}
|
|
84
|
+
if (logical) {
|
|
85
|
+
replaceWith = t.logicalExpression(logical, meshedLeft, right.node);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
path.replaceWith(internal.set(left.node.object, !left.node.computed && t.isIdentifier(property) ? t.stringLiteral(property.name) : property, replaceWith, path.node));
|
|
89
|
+
}
|
|
90
|
+
}
|
package/lib/transformer.js
CHANGED
|
@@ -207,6 +207,7 @@ function transformProgram(path, filename, opts) {
|
|
|
207
207
|
}
|
|
208
208
|
return t.callExpression(t.identifier(ids[key]), args);
|
|
209
209
|
}
|
|
210
|
+
const reports = [];
|
|
210
211
|
const internal = {
|
|
211
212
|
stack: new internal_js_1.StackedStates(),
|
|
212
213
|
mapping: new Map(),
|
|
@@ -330,6 +331,27 @@ function transformProgram(path, filename, opts) {
|
|
|
330
331
|
used.add("earlyInspector");
|
|
331
332
|
return t.identifier(ids["earlyInspector"]);
|
|
332
333
|
},
|
|
334
|
+
reportError(message, node, e) {
|
|
335
|
+
const pos = node.loc;
|
|
336
|
+
/* istanbul ignore else */
|
|
337
|
+
if (pos) {
|
|
338
|
+
reports.push({
|
|
339
|
+
message: message,
|
|
340
|
+
from: [pos.start.line, pos.start.column],
|
|
341
|
+
to: [pos.end.line, pos.end.column],
|
|
342
|
+
class: e ? "error" : "warning",
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
if (e) {
|
|
346
|
+
if (opts.throwAtFirstError) {
|
|
347
|
+
throw e;
|
|
348
|
+
}
|
|
349
|
+
console.error(e);
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
console.warn(message);
|
|
353
|
+
}
|
|
354
|
+
},
|
|
333
355
|
};
|
|
334
356
|
function getCtx() {
|
|
335
357
|
if (internal.isComposing)
|
|
@@ -369,8 +391,13 @@ function transformProgram(path, filename, opts) {
|
|
|
369
391
|
}
|
|
370
392
|
}
|
|
371
393
|
updateImports(path, internal, ids, used);
|
|
372
|
-
|
|
373
|
-
|
|
394
|
+
opts.reporter?.({
|
|
395
|
+
filePath: filename,
|
|
396
|
+
reports: reports,
|
|
397
|
+
});
|
|
398
|
+
if (reports.some(item => item.class === "error")) {
|
|
399
|
+
throw new Error("Compilation failed");
|
|
400
|
+
}
|
|
374
401
|
if (opts.devLayer) {
|
|
375
402
|
path.node.body.unshift(t.variableDeclaration("const", [t.variableDeclarator(filePathId, t.stringLiteral(internal.steelFilePath))]));
|
|
376
403
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-plugin-vasille",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.3",
|
|
4
4
|
"description": "Convert Vasille Meta Language code to pure JavaScript",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -8,11 +8,13 @@
|
|
|
8
8
|
"import": "./lib/index.js",
|
|
9
9
|
"browser": "./lib/index.js",
|
|
10
10
|
"node": "./lib/index.js",
|
|
11
|
-
"require": "./lib/index.js"
|
|
11
|
+
"require": "./lib/index.js",
|
|
12
|
+
"types": "./types/index.d.ts"
|
|
12
13
|
},
|
|
13
14
|
"scripts": {
|
|
14
15
|
"prepack": "cp -f ../README.md ./README.md",
|
|
15
16
|
"prettier": "prettier src test/**/*.ts* test/*.ts --write",
|
|
17
|
+
"prebuild": "rm -rf lib types",
|
|
16
18
|
"build": "tsc --build tsconfig-build.json",
|
|
17
19
|
"tsc-tests": "tsc --build test/tsconfig.json",
|
|
18
20
|
"test": "jest",
|
|
@@ -26,7 +28,7 @@
|
|
|
26
28
|
"babel"
|
|
27
29
|
],
|
|
28
30
|
"author": "lixcode",
|
|
29
|
-
"license": "
|
|
31
|
+
"license": "LGPL-2.1-only",
|
|
30
32
|
"bugs": {
|
|
31
33
|
"url": "https://github.com/vasille-js/vasille-js/issues"
|
|
32
34
|
},
|
|
@@ -39,7 +41,7 @@
|
|
|
39
41
|
"@types/babel__core": "^7.20.5",
|
|
40
42
|
"@types/jest": "^30.0.0",
|
|
41
43
|
"@types/jsdom": "^21.1.7",
|
|
42
|
-
"@types/node": "^
|
|
44
|
+
"@types/node": "^25.6.0",
|
|
43
45
|
"cross-env": "^10.0.0",
|
|
44
46
|
"jest": "^30.0.5",
|
|
45
47
|
"jsdom": "^26.1.0",
|
package/types/call.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NodePath, types } from "@babel/core";
|
|
2
|
+
import { Internal } from "./internal.js";
|
|
3
|
+
export type FnNames = "compose" | "view" | "component" | "store" | "model" | "screen" | "page" | "modal" | "prompt" | "awaited" | "calculate" | "forward" | "watch" | "ref" | "bind" | "raw" | "arrayModel" | "setModel" | "mapModel" | "beforeMount" | "afterMount" | "beforeDestroy" | "router" | "theme" | "dark" | "mobile" | "tablet" | "laptop" | "prefersDark" | "prefersLight" | "styleSheet" | "share" | "receive" | "impute";
|
|
4
|
+
export declare const composeFunctions: ["compose", "store", "model", "view", "component", "page", "modal", "prompt", "screen"];
|
|
5
|
+
export declare const refFunctions: ["ref"];
|
|
6
|
+
export declare const asyncFunctions: ["awaited"];
|
|
7
|
+
export declare const bindFunctions: ["watch", "calculate", "bind"];
|
|
8
|
+
export declare const modelFunctions: ["arrayModel", "mapModel", "setModel"];
|
|
9
|
+
export declare const composeOnly: ["router", "beforeMount", "afterMount", "beforeDestroy"];
|
|
10
|
+
export declare const styleOnly: ["theme", "dark", "mobile", "tablet", "laptop", "prefersDark", "prefersLight", "styleSheet"];
|
|
11
|
+
export declare const dependencyInjections: ["share", "receive", "impute"];
|
|
12
|
+
export declare const hintFunctions: FnNames[];
|
|
13
|
+
export declare function calls(path: NodePath<types.CallExpression>, names: FnNames[], internal: Internal): boolean;
|
|
14
|
+
export declare function calls(path: NodePath<types.Expression | null | undefined>, names: FnNames[], internal: Internal): path is NodePath<types.CallExpression>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface CompilationErrorReport {
|
|
2
|
+
from: [number, number];
|
|
3
|
+
to: [number, number];
|
|
4
|
+
message: string;
|
|
5
|
+
class: "error" | "warning";
|
|
6
|
+
}
|
|
7
|
+
export interface CompilationErrorReports {
|
|
8
|
+
filePath: string;
|
|
9
|
+
reports: CompilationErrorReport[];
|
|
10
|
+
}
|
|
11
|
+
export type CompilationErrorReporter = (reports: CompilationErrorReports) => void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { NodePath, types } from "@babel/core";
|
|
2
|
+
import { Internal, StackedStates } from "./internal.js";
|
|
3
|
+
export interface Dependency {
|
|
4
|
+
node: types.Expression;
|
|
5
|
+
paramName: types.Identifier;
|
|
6
|
+
}
|
|
7
|
+
export interface Search {
|
|
8
|
+
found: Map<string, Dependency>;
|
|
9
|
+
external: Internal;
|
|
10
|
+
self: types.Expression | null;
|
|
11
|
+
inserted: Set<types.Expression>;
|
|
12
|
+
stack: StackedStates;
|
|
13
|
+
}
|
|
14
|
+
export declare function nodeIsMeshed(path: NodePath<types.Node | null | undefined>): boolean;
|
|
15
|
+
export declare function idIsIValue(path: NodePath<types.Identifier>): boolean;
|
|
16
|
+
export declare function memberIsIValue(node: types.MemberExpression | types.OptionalMemberExpression): boolean;
|
|
17
|
+
export declare function memberIsIValueInExpr(path: NodePath<types.MemberExpression | types.OptionalMemberExpression>, search: Search): boolean;
|
|
18
|
+
export declare function exprIsSure(path: NodePath<types.Expression | null | undefined>, internal: Internal): boolean | 1;
|
|
19
|
+
export declare function checkNode(path: NodePath<types.Node | null | undefined>, internal: Internal, area: types.Node, name?: string): Search;
|
|
20
|
+
export declare function checkOrIgnoreAllExpressions<T extends types.Node>(nodePaths: NodePath<types.Expression | null | T>[], search: Search): void;
|
|
21
|
+
export declare function checkAllExpressions(nodePaths: NodePath<types.Expression | null>[], search: Search): void;
|
|
22
|
+
export declare function checkAllUnknown(paths: NodePath<types.SpreadElement | types.ArgumentPlaceholder | types.Expression | null>[], internal: Search): void;
|
|
23
|
+
export declare function checkOrIgnoreExpression<T extends types.Node>(path: NodePath<types.Expression | null | undefined | T>, search: Search): void;
|
|
24
|
+
export declare function checkExpression(nodePath: NodePath<types.Expression | null | undefined>, search: Search): void;
|
|
25
|
+
export declare function checkStatements(paths: NodePath<types.Statement>[], search: Search): void;
|
|
26
|
+
export declare function checkStatement(path: NodePath<types.Statement | null | undefined>, search: Search): void;
|
|
27
|
+
export declare function checkFunction(path: NodePath<types.ArrowFunctionExpression | types.FunctionExpression | types.FunctionDeclaration | types.ObjectMethod>, search: Search): void;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as Babel from "@babel/core";
|
|
2
|
+
export default function (): Babel.PluginObj<{
|
|
3
|
+
file: {
|
|
4
|
+
opts: {
|
|
5
|
+
filename: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
opts: {
|
|
9
|
+
devLayer: unknown;
|
|
10
|
+
strictFolders: unknown;
|
|
11
|
+
replaceWeb: unknown;
|
|
12
|
+
headTag: unknown;
|
|
13
|
+
bodyTag: unknown;
|
|
14
|
+
shadow: unknown;
|
|
15
|
+
throwAtFirstError: unknown;
|
|
16
|
+
reporter: unknown;
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
19
|
+
export type { CompilationErrorReporter, CompilationErrorReport, CompilationErrorReports } from "./communication";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { NodePath, types } from "@babel/core";
|
|
2
|
+
import { TSTypeElement } from "@babel/types";
|
|
3
|
+
export type VariableState = Record<string, 1>;
|
|
4
|
+
export declare class StackedStates {
|
|
5
|
+
private maps;
|
|
6
|
+
private checkingIndex;
|
|
7
|
+
constructor();
|
|
8
|
+
push(startChecking?: boolean): void;
|
|
9
|
+
pop(): void;
|
|
10
|
+
get(name: string, checkingContextOnly?: boolean): VariableState | undefined;
|
|
11
|
+
set(name: string, state: VariableState): void;
|
|
12
|
+
}
|
|
13
|
+
export interface Internal {
|
|
14
|
+
mapping: Map<string, string>;
|
|
15
|
+
interfaces: Map<string, TSTypeElement[]>;
|
|
16
|
+
componentsImports: Map<string, string>;
|
|
17
|
+
stack: StackedStates;
|
|
18
|
+
global: string;
|
|
19
|
+
prefix: string;
|
|
20
|
+
importStatement: NodePath<types.ImportDeclaration> | null;
|
|
21
|
+
stateOnly: boolean;
|
|
22
|
+
isComposing?: boolean;
|
|
23
|
+
isFunctionParsing?: boolean;
|
|
24
|
+
filename: string;
|
|
25
|
+
steelFilePath: string;
|
|
26
|
+
devLayer: boolean;
|
|
27
|
+
strictFolders: boolean;
|
|
28
|
+
stylesConnected: boolean;
|
|
29
|
+
replaceWeb: string;
|
|
30
|
+
headTag?: boolean;
|
|
31
|
+
bodyTag?: boolean;
|
|
32
|
+
shadow?: boolean;
|
|
33
|
+
reportError(message: string, node: types.Node, e?: Error): void;
|
|
34
|
+
ref(arg: types.Expression | null, area: types.Node, name: string | undefined): types.Expression;
|
|
35
|
+
expr(func: types.Expression, values: types.Expression[], codes: string[], area: types.Node, name: string | undefined): types.Expression;
|
|
36
|
+
setModel(arg: types.Expression | types.SpreadElement | types.ArgumentPlaceholder | null, usage: types.Node, name: string | undefined): types.Expression;
|
|
37
|
+
mapModel(arg: types.Expression | types.SpreadElement | types.ArgumentPlaceholder | null, usage: types.Node, name: string | undefined): types.Expression;
|
|
38
|
+
arrayModel(arg: types.Expression | types.SpreadElement | types.ArgumentPlaceholder | null, usage: types.Node, name: string | undefined): types.Expression;
|
|
39
|
+
ensure(arg: types.MemberExpression | types.OptionalMemberExpression, area: types.Node): types.Expression;
|
|
40
|
+
match(name: types.Expression, arg: types.Expression, area: types.Node): types.CallExpression;
|
|
41
|
+
set(obj: types.Expression, field: types.Expression, value: types.Expression, area: types.Node): types.CallExpression;
|
|
42
|
+
Switch(arg: types.ObjectExpression): types.CallExpression;
|
|
43
|
+
safe(arg: types.FunctionExpression | types.ArrowFunctionExpression): types.CallExpression;
|
|
44
|
+
updateIValue(assign: types.AssignmentExpression, left: types.Expression, right: types.Expression): types.Expression;
|
|
45
|
+
wrapFunctionBody(fn: types.FunctionDeclaration | types.ObjectMethod | types.ClassMethod | types.ClassPrivateMethod): void;
|
|
46
|
+
setupPosition(target: types.Expression, area: types.Node): types.Expression;
|
|
47
|
+
wrapFunction(fn: types.FunctionExpression | types.ArrowFunctionExpression): types.Node;
|
|
48
|
+
shareStateById(value: types.Expression, name: string): types.Expression;
|
|
49
|
+
positionedText(text: types.Expression, area: types.Node): types.Expression;
|
|
50
|
+
earlyInspector(): types.Expression;
|
|
51
|
+
}
|
|
52
|
+
export declare const ctx: types.Identifier;
|
|
53
|
+
export declare const runner: types.MemberExpression;
|
|
54
|
+
export declare const inspector: types.MemberExpression;
|
|
55
|
+
export declare const V: types.Identifier;
|
package/types/jsx.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NodePath, types } from "@babel/core";
|
|
2
|
+
import { Internal } from "./internal.js";
|
|
3
|
+
export interface ConditionCollection {
|
|
4
|
+
cases: {
|
|
5
|
+
condition: types.Expression;
|
|
6
|
+
slot: types.FunctionExpression | types.ArrowFunctionExpression;
|
|
7
|
+
}[] | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function transformJsx(path: NodePath<types.JSXElement | types.JSXFragment>, conditions: ConditionCollection, internal: Internal): types.Statement[];
|
|
10
|
+
export declare function transformJsxArray(paths: NodePath<types.JSXText | types.JSXExpressionContainer | types.JSXSpreadChild | types.JSXElement | types.JSXFragment>[], internal: Internal): types.Statement[];
|
|
11
|
+
export declare function processConditions(conditions: ConditionCollection, internal: Internal, _default?: types.FunctionExpression | types.ArrowFunctionExpression): types.Statement[];
|
package/types/lib.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { NodePath, types } from "@babel/core";
|
|
2
|
+
import { Identifier } from "@babel/types";
|
|
3
|
+
import { Dependency } from "./expression.js";
|
|
4
|
+
import { Internal } from "./internal.js";
|
|
5
|
+
export declare enum Errors {
|
|
6
|
+
IncorrectArguments = 1,
|
|
7
|
+
IncompatibleContext = 2,
|
|
8
|
+
TokenNotSupported = 3,
|
|
9
|
+
Dilemma = 4,
|
|
10
|
+
ParserError = 5,
|
|
11
|
+
RulesOfVasille = 6
|
|
12
|
+
}
|
|
13
|
+
export declare function err(e: Errors, node: NodePath<unknown>, content: string, internal: Internal, ret?: undefined): void;
|
|
14
|
+
export declare function err<T>(e: Errors, node: NodePath<unknown>, content: string, internal: Internal, ret: T): T;
|
|
15
|
+
export declare function processCalculateCall(path: NodePath<types.CallExpression>, internal: Internal, area: types.Node, name: string | undefined): boolean;
|
|
16
|
+
export declare function parseCalculateCall(path: NodePath<types.Expression | null | undefined>, internal: Internal, area: types.Node, name: string | undefined): boolean;
|
|
17
|
+
export declare function bindCall(path: NodePath<types.Expression | null | undefined>, expr: types.Expression | null | undefined, data: Map<string, Dependency>, internal: Internal, name?: string): boolean;
|
|
18
|
+
export declare function exprCall(path: NodePath<types.Expression | null | undefined>, expr: types.Expression | null | undefined, internal: Internal, opts: {
|
|
19
|
+
name?: string;
|
|
20
|
+
strong?: boolean;
|
|
21
|
+
}, area: types.Node): boolean;
|
|
22
|
+
export declare function ref(expr: types.Node | null | undefined, internal: Internal, area: types.Node, name?: string): types.Expression;
|
|
23
|
+
export declare function arrayModel(args: types.CallExpression["arguments"], usage: types.Node, internal: Internal, name?: string): types.Expression;
|
|
24
|
+
export declare function setModel(args: types.CallExpression["arguments"], usage: types.Node, internal: Internal, name?: string): types.Expression;
|
|
25
|
+
export declare function mapModel(args: types.CallExpression["arguments"], usage: types.Node, internal: Internal, name?: string): types.Expression;
|
|
26
|
+
export declare function processModelCall(path: NodePath<types.CallExpression | types.NewExpression>, usage: types.Node, type: "Map" | "Set" | "Array", isConst: boolean, internal: Internal, name?: string): void;
|
|
27
|
+
export declare function checkReactiveName(idPath: NodePath<unknown>, internal: Internal): void;
|
|
28
|
+
export declare function checkNonReactiveName(idPath: NodePath<Identifier>, internal: Internal): void;
|
|
29
|
+
export declare function toKebabCase(name: string): string;
|
|
30
|
+
export declare function nameIsRestricted(name: string): boolean;
|
package/types/mesh.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NodePath, types } from "@babel/core";
|
|
2
|
+
import { Internal, VariableState } from "./internal.js";
|
|
3
|
+
export declare function meshOrIgnoreAllExpressions<T extends types.Node>(nodePaths: NodePath<types.Expression | null | T>[], internal: Internal): void;
|
|
4
|
+
export declare function meshAllExpressions(nodePaths: NodePath<types.Expression | null>[], internal: Internal): void;
|
|
5
|
+
export declare function meshComposeCall(name: string | null | undefined, path: NodePath<types.Node | null | undefined>, internal: Internal, isExported?: boolean): void;
|
|
6
|
+
export declare function meshAllUnknown(paths: NodePath<types.SpreadElement | types.ArgumentPlaceholder | types.Expression | null>[], internal: Internal): void;
|
|
7
|
+
export declare function meshLValue(path: NodePath<types.LVal | types.Expression | types.VoidPattern | null | undefined>, internal: Internal): void;
|
|
8
|
+
export declare function meshOrIgnoreExpression<T extends types.Node>(path: NodePath<types.Expression | types.VoidPattern | null | undefined | T>, internal: Internal): void;
|
|
9
|
+
export declare function meshExpression(nodePath: NodePath<types.Expression | null | undefined>, internal: Internal): void;
|
|
10
|
+
export declare function meshStatements(paths: NodePath<types.Statement>[], internal: Internal): void;
|
|
11
|
+
export declare function ignoreParams(path: NodePath<types.LVal | types.VoidPattern | null | undefined>, internal: Internal, allowReactiveId: false | ("id" | "array")[]): void;
|
|
12
|
+
export declare function reactiveArrayPattern(path: NodePath<types.LVal | types.OptionalMemberExpression | types.VoidPattern>, internal: Internal): void;
|
|
13
|
+
export declare function processObjectExpression(path: NodePath<types.ObjectExpression>, internal: Internal): VariableState;
|
|
14
|
+
export declare function meshStatement(path: NodePath<types.Statement | null | undefined>, internal: Internal): void;
|
|
15
|
+
export declare function meshFunction(path: NodePath<types.ArrowFunctionExpression | types.FunctionExpression | types.FunctionDeclaration | types.ObjectMethod | types.ClassMethod | types.ClassPrivateMethod>, internal: Internal): void;
|
|
16
|
+
export declare function composeExpression(path: NodePath<types.Expression | null | undefined>, internal: Internal): void;
|
|
17
|
+
export declare function composeStatements(paths: NodePath<types.Statement | null | undefined>[], internal: Internal): void;
|
|
18
|
+
export declare function composeStatement(path: NodePath<types.Statement | null | undefined>, internal: Internal): void;
|
|
19
|
+
export declare function compose(path: NodePath<types.ArrowFunctionExpression | types.FunctionExpression>, internal: Internal, isInternalSlot: boolean, isSlot: boolean): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { NodePath, types } from "@babel/core";
|
|
2
|
+
import { Internal } from "./internal";
|
|
3
|
+
declare const assigmentToBinaryMap: {
|
|
4
|
+
readonly "+=": "+";
|
|
5
|
+
readonly "-=": "-";
|
|
6
|
+
readonly "/=": "/";
|
|
7
|
+
readonly "%=": "%";
|
|
8
|
+
readonly "*=": "*";
|
|
9
|
+
readonly "**=": "**";
|
|
10
|
+
readonly "&=": "&";
|
|
11
|
+
readonly "|=": "|";
|
|
12
|
+
readonly ">>=": ">>";
|
|
13
|
+
readonly ">>>=": ">>>";
|
|
14
|
+
readonly "<<=": "<<";
|
|
15
|
+
readonly "^=": "^";
|
|
16
|
+
};
|
|
17
|
+
declare const assigmentToLogicalMap: {
|
|
18
|
+
readonly "&&=": "&&";
|
|
19
|
+
readonly "||=": "||";
|
|
20
|
+
readonly "??=": "??";
|
|
21
|
+
};
|
|
22
|
+
export declare function assignmentToBinaryOperator(operator: string): (typeof assigmentToBinaryMap)[keyof typeof assigmentToBinaryMap] | undefined;
|
|
23
|
+
export declare function assignmentToLogicalOperator(operator: string): (typeof assigmentToLogicalMap)[keyof typeof assigmentToLogicalMap] | undefined;
|
|
24
|
+
export declare function meshAssigment(path: NodePath<types.AssignmentExpression>, left: NodePath<types.MemberExpression>, right: NodePath<types.Expression>, property: types.PrivateName | types.Expression, internal: Internal): void;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { types } from "@babel/core";
|
|
2
|
+
import { TSTypeElement } from "@babel/types";
|
|
3
|
+
import { Internal } from "./internal";
|
|
4
|
+
declare const any = 0;
|
|
5
|
+
declare const string = 1;
|
|
6
|
+
declare const number = 2;
|
|
7
|
+
declare const boolean = 3;
|
|
8
|
+
type PropType = typeof string | typeof number | typeof boolean | typeof any;
|
|
9
|
+
export declare function registerInterface(name: string, members: TSTypeElement[], internal: Internal): void;
|
|
10
|
+
export declare function processUnion(type: types.TSUnionType): PropType;
|
|
11
|
+
export declare function processType(type: types.TSType): PropType;
|
|
12
|
+
export declare function processSignatures(members: TSTypeElement[]): types.ObjectExpression;
|
|
13
|
+
export declare function processTypeLiteral(literal: types.TSTypeLiteral): types.ObjectExpression;
|
|
14
|
+
export declare function processReference(id: types.TSTypeReference, internal: Internal): types.ObjectExpression | undefined;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NodePath, types } from "@babel/core";
|
|
2
|
+
import { Internal } from "./internal.js";
|
|
3
|
+
import { CompilationErrorReporter } from "./communication";
|
|
4
|
+
export interface TransformerOptions {
|
|
5
|
+
devLayer: boolean;
|
|
6
|
+
strictFolders: boolean;
|
|
7
|
+
replaceWeb: string | undefined;
|
|
8
|
+
headTag: boolean;
|
|
9
|
+
bodyTag: boolean;
|
|
10
|
+
shadow: boolean;
|
|
11
|
+
reporter: CompilationErrorReporter | undefined;
|
|
12
|
+
throwAtFirstError: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function nodeToStaticPosition(node: types.Node): types.ArrayExpression;
|
|
15
|
+
export declare function transformProgram(path: NodePath<types.Program>, filename: string, opts: TransformerOptions): void;
|
|
16
|
+
export declare function inspectorOf(internal: Internal): types.Expression;
|
package/types/utils.d.ts
ADDED