babel-plugin-vasille 0.99.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/README.md ADDED
@@ -0,0 +1,122 @@
1
+ # Vasille
2
+
3
+ ![Vasille.js logo](https://gitlab.com/vasille-js/vasille-js/-/raw/v2/doc/img/logo.png)
4
+
5
+ `Vasille Web` is a front-end framework, which is developed to provide the best `developer experience` ever. **Our goal is to keep is as simple as possible.** Developing web applications using Vasille must be *as fast as possible*.
6
+
7
+ [![npm](https://img.shields.io/npm/v/vasille?style=flat-square)](https://www.npmjs.com/package/vasille)
8
+
9
+ ## Table of content
10
+
11
+ * [Installation](#installation)
12
+ * [How to use Vasille](#how-to-use-vasille)
13
+ * [How SAFE is Vasille](#how-safe-is-vasille)
14
+ * [How SIMPLE is Vasille](#how-simple-is-vasille)
15
+ * [How POWERFUL is Vasille](#how-powerful-is-vasille)
16
+ * [Road Map](#road-map)
17
+
18
+
19
+ <hr>
20
+
21
+ ## Installation
22
+
23
+ ```
24
+ npm install vasille-web --save
25
+ ```
26
+
27
+ ## How to use Vasille
28
+
29
+ Create an app from a template
30
+
31
+ ```bash
32
+ $ npx create vasille
33
+ ```
34
+
35
+ Alternative method to create a TypeScript app.
36
+ ```bash
37
+ $ npx degit vasille-js/example-typescript my-project
38
+ ```
39
+
40
+ Alternative method to create a JavaScript app.
41
+ ```bash
42
+ $ npx degit vasille-js/example-javascript my-project
43
+ ```
44
+
45
+ ### Full documentation:
46
+ * [Learn `Vasille` in 5 minutes](https://github.com/vasille-js/vasille-js/blob/v3/doc/V3-API.md)
47
+
48
+ ### Examples
49
+ * [TypeScript Example](https://github.com/vasille-js/example-typescript)
50
+ * [JavaScript Example](https://github.com/vas[README.md](..%2Ftest%2Fmy-app%2FREADME.md)ille-js/example-javascript)
51
+
52
+ <hr>
53
+
54
+ ## How SAFE is Vasille
55
+
56
+ The safe of your application is ensured by
57
+ * `100%` coverage of code by unit tests.
58
+ Each function, each branch is working as designed.
59
+ * OOP, DRY, KISS and SOLID principles are applied.
60
+ * `strong typing` makes your javascript/typescript code safe as C++ code.
61
+ All entities of `vasille` core library are strongly typed, including:
62
+ * data fields & properties.
63
+ * computed properties (function parameters & result).
64
+ * methods.
65
+ * events (defined handlers & event emit).
66
+ * DOM events & DOM operation (attributing, styling, etc.).
67
+ * slots of components.
68
+ * references to children.
69
+ * No asynchronous code, when the line of code is executed, the DOM and reactive things are already synced.
70
+
71
+ ## How SIMPLE is Vasille
72
+
73
+ There is the "Hello World":
74
+ ```typescript jsx
75
+ import { compose, mount } from "vasille-dx";
76
+
77
+ const App = compose(() => {
78
+ <p>Hello world</p>;
79
+ });
80
+
81
+ mount(document.body, App, {});
82
+ ```
83
+
84
+ ## How POWERFUL is Vasille
85
+
86
+ All of these are supported:
87
+ * Components.
88
+ * Reactive values (observables).
89
+ * Inline computed values.
90
+ * Multiline computed values.
91
+ * HTML & SVG tags.
92
+ * Component custom slots.
93
+ * 2-way data binding in components.
94
+ * Logic block (if, else).
95
+ * Loops (array, map, set).
96
+
97
+ <hr>
98
+
99
+ ## Road map
100
+
101
+ * [x] Update the `Vasille Core` library to version 3.0.
102
+ * [x] `100%` Test Coverage for core Library v3.
103
+ * [x] Develop the `Vasille JSX` library.
104
+ * [x] `100%` Test Coverage for the JSX library.
105
+ * [x] Develop the `Vasille Babel Plugin`.
106
+ * [ ] `100%` Test Coverage fot babel plugin.
107
+ * [ ] Add CSS support (define styles in components).
108
+ * [ ] Add custom `<input/>` components with 2-way value binding.
109
+ * [ ] Add router.
110
+ * [ ] Develop dev-tools extension for debugging.
111
+ * [ ] Develop a lot of libraries for the framework.
112
+
113
+ ## Questions
114
+
115
+ If you have questions, feel free to contact the maintainer of the project:
116
+
117
+ * [Author's Email](mailto:vas.lixcode@gmail.com)
118
+ * [Author's Telegram](https://t.me/lixcode)
119
+
120
+ <hr>
121
+
122
+ **Made in Moldova** 🇲🇩
package/lib/call.js ADDED
@@ -0,0 +1,51 @@
1
+ import * as t from "@babel/types";
2
+ import { ctx } from "./internal.js";
3
+ export const composeOnly = [
4
+ "forward",
5
+ "watch",
6
+ "ref",
7
+ "bind",
8
+ "value",
9
+ "arrayModel",
10
+ "mapModel",
11
+ "setModel",
12
+ "reactiveObject",
13
+ ];
14
+ export const requiresContext = ["awaited", "forward"];
15
+ const requiresContextSet = new Set(requiresContext);
16
+ export function calls(node, names, internal) {
17
+ const set = new Set(names);
18
+ const callee = t.isCallExpression(node) ? node.callee : null;
19
+ if (callee) {
20
+ if (t.isIdentifier(callee)) {
21
+ const mapped = internal.mapping.get(callee.name);
22
+ if (mapped && set.has(mapped) && internal.stack.get(callee.name) === undefined) {
23
+ if (requiresContextSet.has(callee.name) && t.isCallExpression(node)) {
24
+ node.arguments.unshift(ctx);
25
+ }
26
+ return mapped;
27
+ }
28
+ return false;
29
+ }
30
+ // The global object is overrided
31
+ if (internal.stack.get(internal.global) !== undefined) {
32
+ return false;
33
+ }
34
+ const propName = t.isMemberExpression(callee)
35
+ ? t.isIdentifier(callee.property)
36
+ ? callee.property.name
37
+ : t.isStringLiteral(callee.property)
38
+ ? callee.property.value
39
+ : null
40
+ : null;
41
+ if (t.isMemberExpression(callee) && t.isIdentifier(callee.object) && propName) {
42
+ if (callee.object.name === internal.global && set.has(propName)) {
43
+ if (requiresContextSet.has(callee.object.name) && t.isCallExpression(node)) {
44
+ node.arguments.unshift(ctx);
45
+ }
46
+ return callee.object.name;
47
+ }
48
+ }
49
+ }
50
+ return false;
51
+ }
@@ -0,0 +1,517 @@
1
+ import * as t from "@babel/types";
2
+ import { StackedStates } from "./internal.js";
3
+ export function encodeName(name) {
4
+ return t.identifier(`Vasille_${name}`);
5
+ }
6
+ function addIdentifier(path, search) {
7
+ if (!search.found.has(path.node.name)) {
8
+ search.found.set(path.node.name, path.node);
9
+ }
10
+ path.replaceWith(encodeName(path.node.name));
11
+ }
12
+ function stringify(node) {
13
+ if (t.isIdentifier(node)) {
14
+ return node.name;
15
+ }
16
+ if (t.isStringLiteral(node)) {
17
+ return node.value;
18
+ }
19
+ if (t.isPrivateName(node)) {
20
+ return node.id.name;
21
+ }
22
+ return "$";
23
+ }
24
+ function extractMemberName(path, search) {
25
+ const names = [];
26
+ let it = path.node;
27
+ while (t.isMemberExpression(it)) {
28
+ const name = stringify(it.property);
29
+ if (name === "$" && it !== path.node) {
30
+ throw path.buildCodeFrameError("Vasille: The reactive/observable value is nested");
31
+ }
32
+ it = it.object;
33
+ names.push();
34
+ }
35
+ names.push(stringify(it));
36
+ if (t.isIdentifier(it) && search.stack.get(it.name) === 1 /* VariableState.Ignored */) {
37
+ throw path.buildCodeFrameError("Vasille: This node cannot be processed, the root of expression is a local variable");
38
+ }
39
+ return names.reverse().join("_");
40
+ }
41
+ function addMemberExpr(path, search) {
42
+ const name = extractMemberName(path, search);
43
+ if (!search.found.has(name)) {
44
+ search.found.set(name, path.node);
45
+ }
46
+ path.replaceWith(encodeName(name));
47
+ }
48
+ function addExternalIValue(path, search) {
49
+ const name = extractMemberName(path, search);
50
+ if (!search.found.has(name)) {
51
+ search.found.set(name, path.node.object);
52
+ }
53
+ path.replaceWith(encodeName(name));
54
+ }
55
+ function meshIdentifier(path, internal) {
56
+ const state = internal.stack.get(path.node.name);
57
+ if (state === 2 /* VariableState.Reactive */ || state === 4 /* VariableState.ReactivePointer */) {
58
+ path.replaceWith(t.memberExpression(path.node, t.identifier("$")));
59
+ }
60
+ }
61
+ function meshMember(path, internal) {
62
+ if (t.isIdentifier(path.node.object) && internal.stack.get(path.node.object.name) === 3 /* VariableState.ReactiveObject */) {
63
+ path.replaceWith(t.memberExpression(path.node, t.identifier("$")));
64
+ }
65
+ }
66
+ function meshLValue(path, internal) {
67
+ if (t.isIdentifier(path.node)) {
68
+ meshIdentifier(path, internal);
69
+ }
70
+ else if (t.isMemberExpression(path.node) || t.isOptionalMemberExpression(path.node)) {
71
+ meshMember(path, internal);
72
+ }
73
+ else {
74
+ path.traverse({
75
+ Identifier(path) {
76
+ meshIdentifier(path, internal);
77
+ },
78
+ MemberExpression(path) {
79
+ meshMember(path, internal);
80
+ },
81
+ OptionalMemberExpression(path) {
82
+ meshMember(path, internal);
83
+ },
84
+ });
85
+ }
86
+ }
87
+ export function checkNode(path, internal) {
88
+ const search = {
89
+ external: internal,
90
+ found: new Map(),
91
+ self: null,
92
+ stack: new StackedStates(),
93
+ };
94
+ if (t.isIdentifier(path.node)) {
95
+ const state = internal.stack.get(path.node.name);
96
+ if (state === 2 /* VariableState.Reactive */ || state == 4 /* VariableState.ReactivePointer */) {
97
+ search.self = path.node;
98
+ }
99
+ }
100
+ if (t.isMemberExpression(path.node)) {
101
+ if (t.isIdentifier(path.node.object) &&
102
+ internal.stack.get(path.node.object.name) === 3 /* VariableState.ReactiveObject */) {
103
+ search.self = path.node;
104
+ }
105
+ if (t.isIdentifier(path.node.property) && path.node.property.name === "$") {
106
+ search.self = path.node.object;
107
+ }
108
+ }
109
+ if (search.self) {
110
+ return search;
111
+ }
112
+ if (t.isExpression(path.node)) {
113
+ checkExpression(path, search);
114
+ }
115
+ return search;
116
+ }
117
+ export function checkOrIgnoreAllExpressions(nodePaths, search) {
118
+ for (const path of nodePaths) {
119
+ if (t.isExpression(path.node)) {
120
+ checkExpression(path, search);
121
+ }
122
+ }
123
+ }
124
+ export function checkAllExpressions(nodePaths, search) {
125
+ for (const path of nodePaths) {
126
+ checkExpression(path, search);
127
+ }
128
+ }
129
+ export function checkAllUnknown(paths, internal) {
130
+ for (const path of paths) {
131
+ if (t.isSpreadElement(path.node)) {
132
+ checkExpression(path.get("argument"), internal);
133
+ }
134
+ else if (t.isExpression(path.node)) {
135
+ checkExpression(path, internal);
136
+ }
137
+ }
138
+ }
139
+ export function chekOrIgnoreExpression(path, search) {
140
+ if (t.isExpression(path.node)) {
141
+ checkExpression(path, search);
142
+ }
143
+ }
144
+ export function checkExpression(nodePath, search) {
145
+ const expr = nodePath.node;
146
+ if (!expr) {
147
+ return;
148
+ }
149
+ switch (expr.type) {
150
+ case "TemplateLiteral": {
151
+ const path = nodePath;
152
+ checkOrIgnoreAllExpressions(path.get("expressions"), search);
153
+ break;
154
+ }
155
+ case "TaggedTemplateExpression": {
156
+ const path = nodePath;
157
+ checkExpression(path.get("quasi"), search);
158
+ break;
159
+ }
160
+ case "Identifier": {
161
+ if (search.stack.get(expr.name) !== 1 /* VariableState.Ignored */) {
162
+ if (search.external.stack.get(expr.name) === 2 /* VariableState.Reactive */) {
163
+ addIdentifier(nodePath, search);
164
+ }
165
+ }
166
+ break;
167
+ }
168
+ case "ArrayExpression": {
169
+ const path = nodePath;
170
+ checkAllUnknown(path.get("elements"), search);
171
+ break;
172
+ }
173
+ case "TupleExpression": {
174
+ const path = nodePath;
175
+ checkAllUnknown(path.get("elements"), search);
176
+ break;
177
+ }
178
+ case "CallExpression": {
179
+ const path = nodePath;
180
+ chekOrIgnoreExpression(path.get("callee"), search);
181
+ checkAllUnknown(path.get("arguments"), search);
182
+ break;
183
+ }
184
+ case "OptionalCallExpression": {
185
+ const path = nodePath;
186
+ checkExpression(path.get("callee"), search);
187
+ checkAllUnknown(path.get("arguments"), search);
188
+ break;
189
+ }
190
+ case "AssignmentExpression": {
191
+ const path = nodePath;
192
+ meshLValue(path.get("left"), search.external);
193
+ checkExpression(path.get("right"), search);
194
+ break;
195
+ }
196
+ case "MemberExpression":
197
+ case "OptionalMemberExpression": {
198
+ const path = nodePath;
199
+ const node = path.node;
200
+ checkExpression(path.get("object"), search);
201
+ chekOrIgnoreExpression(path.get("property"), search);
202
+ if (t.isIdentifier(node.object) && search.external.stack.get(node.object.name) === 3 /* VariableState.ReactiveObject */) {
203
+ addMemberExpr(path, search);
204
+ }
205
+ else if (t.isIdentifier(node.property) && node.property.name === "$") {
206
+ addExternalIValue(path, search);
207
+ }
208
+ break;
209
+ }
210
+ case "BinaryExpression": {
211
+ const path = nodePath;
212
+ chekOrIgnoreExpression(path.get("left"), search);
213
+ checkExpression(path.get("right"), search);
214
+ break;
215
+ }
216
+ case "ConditionalExpression": {
217
+ const path = nodePath;
218
+ checkExpression(path.get("test"), search);
219
+ checkExpression(path.get("consequent"), search);
220
+ checkExpression(path.get("alternate"), search);
221
+ break;
222
+ }
223
+ case "LogicalExpression": {
224
+ const path = nodePath;
225
+ checkExpression(path.get("left"), search);
226
+ checkExpression(path.get("right"), search);
227
+ break;
228
+ }
229
+ case "NewExpression": {
230
+ const path = nodePath;
231
+ chekOrIgnoreExpression(path.get("callee"), search);
232
+ checkAllUnknown(path.get("arguments"), search);
233
+ break;
234
+ }
235
+ case "SequenceExpression": {
236
+ const path = nodePath;
237
+ checkAllExpressions(path.get("expressions"), search);
238
+ break;
239
+ }
240
+ case "ParenthesizedExpression": {
241
+ const path = nodePath;
242
+ checkExpression(path.get("expression"), search);
243
+ break;
244
+ }
245
+ case "UnaryExpression": {
246
+ const path = nodePath;
247
+ checkExpression(path.get("argument"), search);
248
+ break;
249
+ }
250
+ case "UpdateExpression": {
251
+ const path = nodePath;
252
+ checkExpression(path.get("argument"), search);
253
+ break;
254
+ }
255
+ case "YieldExpression": {
256
+ const path = nodePath;
257
+ checkExpression(path.get("argument"), search);
258
+ break;
259
+ }
260
+ case "AwaitExpression": {
261
+ const path = nodePath;
262
+ checkExpression(path.get("argument"), search);
263
+ break;
264
+ }
265
+ case "TypeCastExpression": {
266
+ const path = nodePath;
267
+ checkExpression(path.get("expression"), search);
268
+ break;
269
+ }
270
+ case "BindExpression": {
271
+ const path = nodePath;
272
+ checkExpression(path.get("callee"), search);
273
+ checkExpression(path.get("object"), search);
274
+ break;
275
+ }
276
+ case "PipelineTopicExpression": {
277
+ const path = nodePath;
278
+ checkExpression(path.get("expression"), search);
279
+ break;
280
+ }
281
+ case "PipelineBareFunction": {
282
+ const path = nodePath;
283
+ checkExpression(path.get("callee"), search);
284
+ break;
285
+ }
286
+ case "TSInstantiationExpression": {
287
+ const path = nodePath;
288
+ checkExpression(path.get("expression"), search);
289
+ break;
290
+ }
291
+ case "TSAsExpression": {
292
+ const path = nodePath;
293
+ checkExpression(path.get("expression"), search);
294
+ break;
295
+ }
296
+ case "TSSatisfiesExpression": {
297
+ const path = nodePath;
298
+ checkExpression(path.get("expression"), search);
299
+ break;
300
+ }
301
+ case "TSTypeAssertion": {
302
+ const path = nodePath;
303
+ checkExpression(path.get("expression"), search);
304
+ break;
305
+ }
306
+ case "ObjectExpression": {
307
+ const path = nodePath;
308
+ for (const propPath of path.get("properties")) {
309
+ const prop = propPath.node;
310
+ if (t.isObjectProperty(prop)) {
311
+ const path = propPath;
312
+ const valuePath = path.get("value");
313
+ if (valuePath instanceof Array) {
314
+ checkAllExpressions(valuePath, search);
315
+ }
316
+ else {
317
+ chekOrIgnoreExpression(valuePath, search);
318
+ }
319
+ }
320
+ else if (t.isObjectMethod(prop)) {
321
+ checkFunction(propPath, search);
322
+ }
323
+ else {
324
+ checkAllUnknown([propPath], search);
325
+ }
326
+ }
327
+ break;
328
+ }
329
+ case "FunctionExpression": {
330
+ checkFunction(nodePath, search);
331
+ break;
332
+ }
333
+ case "ArrowFunctionExpression": {
334
+ checkFunction(nodePath, search);
335
+ break;
336
+ }
337
+ case "JSXFragment": {
338
+ throw nodePath.buildCodeFrameError("Vasille: JSX fragment is not allowed here");
339
+ }
340
+ case "JSXElement": {
341
+ throw nodePath.buildCodeFrameError("Vasille: JSX element is not allowed here");
342
+ }
343
+ }
344
+ }
345
+ export function checkStatements(paths, search) {
346
+ for (const path of paths) {
347
+ checkStatement(path, search);
348
+ }
349
+ }
350
+ function ignoreLocals(val, search) {
351
+ if (t.isAssignmentPattern(val)) {
352
+ val = val.left;
353
+ }
354
+ if (t.isIdentifier(val)) {
355
+ search.stack.set(val.name, 1 /* VariableState.Ignored */);
356
+ }
357
+ else if (t.isObjectPattern(val)) {
358
+ for (const prop of val.properties) {
359
+ if (t.isObjectProperty(prop) && t.isIdentifier(prop.value)) {
360
+ search.stack.set(prop.value.name, 1 /* VariableState.Ignored */);
361
+ }
362
+ else if (t.isRestElement(prop) && t.isIdentifier(prop.argument)) {
363
+ search.stack.set(prop.argument.name, 1 /* VariableState.Ignored */);
364
+ }
365
+ }
366
+ }
367
+ else if (t.isArrayPattern(val)) {
368
+ for (const element of val.elements) {
369
+ if (element) {
370
+ ignoreLocals(element, search);
371
+ }
372
+ }
373
+ }
374
+ else if (t.isVariableDeclaration(val)) {
375
+ for (const declarator of val.declarations) {
376
+ ignoreLocals(declarator.id, search);
377
+ }
378
+ }
379
+ }
380
+ export function checkStatement(path, search) {
381
+ const statement = path.node;
382
+ if (!statement) {
383
+ return;
384
+ }
385
+ switch (statement.type) {
386
+ case "BlockStatement":
387
+ search.stack.push();
388
+ checkStatements(path.get("body"), search);
389
+ search.stack.pop();
390
+ break;
391
+ case "DoWhileStatement": {
392
+ const _path = path;
393
+ checkExpression(_path.get("test"), search);
394
+ search.stack.push();
395
+ checkStatement(_path.get("body"), search);
396
+ search.stack.pop();
397
+ break;
398
+ }
399
+ case "ExpressionStatement":
400
+ checkExpression(path.get("expression"), search);
401
+ break;
402
+ case "ForInStatement": {
403
+ const _path = path;
404
+ ignoreLocals(_path.node.left, search);
405
+ checkExpression(_path.get("right"), search);
406
+ checkStatement(_path.get("body"), search);
407
+ break;
408
+ }
409
+ case "ForOfStatement": {
410
+ const _path = path;
411
+ checkExpression(_path.get("right"), search);
412
+ search.stack.push();
413
+ checkStatement(_path.get("body"), search);
414
+ search.stack.pop();
415
+ break;
416
+ }
417
+ case "ForStatement": {
418
+ const _path = path;
419
+ const node = _path.node;
420
+ if (node.init) {
421
+ if (t.isExpression(node.init)) {
422
+ checkExpression(_path.get("init"), search);
423
+ }
424
+ else {
425
+ const variablePath = _path.get("init");
426
+ for (const declarationPath of variablePath.get("declarations")) {
427
+ checkExpression(declarationPath.get("init"), search);
428
+ }
429
+ }
430
+ }
431
+ checkExpression(_path.get("test"), search);
432
+ checkExpression(_path.get("update"), search);
433
+ search.stack.push();
434
+ checkStatement(_path.get("body"), search);
435
+ search.stack.pop();
436
+ break;
437
+ }
438
+ case "FunctionDeclaration":
439
+ checkFunction(path, search);
440
+ break;
441
+ case "IfStatement": {
442
+ const _path = path;
443
+ checkExpression(_path.get("test"), search);
444
+ search.stack.push();
445
+ checkStatement(_path.get("consequent"), search);
446
+ search.stack.pop();
447
+ search.stack.push();
448
+ checkStatement(_path.get("alternate"), search);
449
+ search.stack.pop();
450
+ break;
451
+ }
452
+ case "LabeledStatement":
453
+ search.stack.push();
454
+ checkStatement(path.get("body"), search);
455
+ search.stack.pop();
456
+ break;
457
+ case "ReturnStatement":
458
+ checkExpression(path.get("argument"), search);
459
+ break;
460
+ case "SwitchStatement": {
461
+ const _path = path;
462
+ checkExpression(_path.get("discriminant"), search);
463
+ search.stack.push();
464
+ for (const _case of _path.get("cases")) {
465
+ checkExpression(_case.get("test"), search);
466
+ checkStatements(_case.get("consequent"), search);
467
+ }
468
+ search.stack.pop();
469
+ break;
470
+ }
471
+ case "ThrowStatement":
472
+ checkExpression(path.get("argument"), search);
473
+ break;
474
+ case "TryStatement":
475
+ checkStatement(path.get("block"), search);
476
+ break;
477
+ case "VariableDeclaration": {
478
+ const _path = path;
479
+ for (const declaration of _path.get("declarations")) {
480
+ const expr = declaration.node.init;
481
+ ignoreLocals(declaration.node.id, search);
482
+ checkExpression(declaration.get("init"), search);
483
+ }
484
+ break;
485
+ }
486
+ case "WhileStatement": {
487
+ const _path = path;
488
+ checkExpression(_path.get("test"), search);
489
+ search.stack.push();
490
+ checkStatement(_path.get("body"), search);
491
+ search.stack.pop();
492
+ break;
493
+ }
494
+ case "WithStatement": {
495
+ const _path = path;
496
+ checkExpression(_path.get("object"), search);
497
+ search.stack.push();
498
+ checkStatement(_path.get("body"), search);
499
+ search.stack.pop();
500
+ break;
501
+ }
502
+ case "ExportNamedDeclaration": {
503
+ checkStatement(path.get("declaration"), search);
504
+ break;
505
+ }
506
+ }
507
+ }
508
+ export function checkFunction(path, search) {
509
+ const node = path.node;
510
+ if (t.isExpression(node.body)) {
511
+ checkExpression(path.get("body"), search);
512
+ }
513
+ else {
514
+ const bodyPath = path.get("body");
515
+ checkStatement(bodyPath, search);
516
+ }
517
+ }
package/lib/index.js ADDED
@@ -0,0 +1,11 @@
1
+ import { trProgram } from "./transformer.js";
2
+ export default function () {
3
+ return {
4
+ name: "Vasille",
5
+ visitor: {
6
+ Program(path, params) {
7
+ trProgram(path, params.devMode !== false);
8
+ },
9
+ },
10
+ };
11
+ }