|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.2 KB
|
| Rev | Line | |
|---|
| [9af201e] | 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.default = void 0;
|
|---|
| 7 | var _helperPluginUtils = require("@babel/helper-plugin-utils");
|
|---|
| 8 | var _core = require("@babel/core");
|
|---|
| 9 | var _default = exports.default = (0, _helperPluginUtils.declare)(api => {
|
|---|
| 10 | api.assertVersion(7);
|
|---|
| 11 | function transformStatementList(parentPath, paths) {
|
|---|
| 12 | ;
|
|---|
| 13 | for (const path of paths) {
|
|---|
| 14 | if (!path.isFunctionDeclaration()) continue;
|
|---|
| 15 | ;
|
|---|
| 16 | const func = path.node;
|
|---|
| 17 | const declar = _core.types.variableDeclaration("let", [_core.types.variableDeclarator(func.id, _core.types.toExpression(func))]);
|
|---|
| 18 | declar._blockHoist = 2;
|
|---|
| 19 | func.id = null;
|
|---|
| 20 | path.replaceWith(declar);
|
|---|
| 21 | }
|
|---|
| 22 | }
|
|---|
| 23 | return {
|
|---|
| 24 | name: "transform-block-scoped-functions",
|
|---|
| 25 | visitor: {
|
|---|
| 26 | BlockStatement(path) {
|
|---|
| 27 | const {
|
|---|
| 28 | node,
|
|---|
| 29 | parent
|
|---|
| 30 | } = path;
|
|---|
| 31 | if (_core.types.isFunction(parent, {
|
|---|
| 32 | body: node
|
|---|
| 33 | }) || _core.types.isExportDeclaration(parent)) {
|
|---|
| 34 | return;
|
|---|
| 35 | }
|
|---|
| 36 | transformStatementList(path, path.get("body"));
|
|---|
| 37 | },
|
|---|
| 38 | SwitchCase(path) {
|
|---|
| 39 | transformStatementList(path, path.get("consequent"));
|
|---|
| 40 | }
|
|---|
| 41 | }
|
|---|
| 42 | };
|
|---|
| 43 | });
|
|---|
| 44 |
|
|---|
| 45 | //# sourceMappingURL=index.js.map
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.