{"id":299449,"date":"2020-02-28T21:00:12","date_gmt":"2020-02-28T21:00:12","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=299449"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=299449","title":{"rendered":"\u041f\u0438\u0448\u0435\u043c babel \u043f\u043b\u0430\u0433\u0438\u043d, \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e"},"content":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/490456\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/zw\/lk\/0c\/zwlk0cmxn9nytpdecivdw5dgmpa.png\" alt=\"image\"><\/p>\n<p>  <\/p>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u0441 \u0432\u0430\u043c\u0438 \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e\u043c \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 <strong><a href=\"https:\/\/babeljs.io\/docs\/en\/babel-core\" rel=\"nofollow\">babel<\/a><\/strong> \u043f\u043b\u0430\u0433\u0438\u043d. \u0412\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0430\u0432\u043e\u043a, \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438\u043b\u0438 \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438. <\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h3 id=\"chto-takoe-babel\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 babel?<\/h3>\n<p>  <\/p>\n<p>Babel \u044d\u0442\u043e JavaScript \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430 \u043d\u0430 ECMAScript 2015+ \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0439 \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c\u0438 \u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0430\u0440\u044b\u043c\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\u043c\u0438 \u0438\u043b\u0438 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f\u043c\u0438. Babel \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432 \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043f\u043b\u0430\u0433\u0438\u043d.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043c\u044b \u043d\u0430\u0447\u043d\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d, \u043d\u0443\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Abstract_syntax_tree\" rel=\"nofollow\">AST<\/a>(\u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0435 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e).<\/p>\n<p>  <\/p>\n<h3 id=\"chto-takoe-ast\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 AST?<\/h3>\n<p>  <\/p>\n<p>\u042f \u043d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d \u0447\u0442\u043e \u043c\u043e\u0433\u0443 \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u044d\u0442\u043e \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u0443\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0432 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0445 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u0445 \u0438\u0437 \u0421\u0435\u0442\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li><strong><a href=\"https:\/\/medium.com\/basecs\/leveling-up-ones-parsing-game-with-asts-d7a6fc2400ff\" rel=\"nofollow\">Leveling Up One\u2019s Parsing Game With ASTs<\/a><\/strong>\u00a0\u043e\u0442\u00a0<strong><a href=\"https:\/\/twitter.com\/vaidehijoshi\" rel=\"nofollow\">Vaidehi Joshi<\/a><\/strong>\u00a0<em>\u00a0(\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e<\/em>)<\/li>\n<li>\u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u044f:\u00a0<strong><a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%90%D0%B1%D1%81%D1%82%D1%80%D0%B0%D0%BA%D1%82%D0%BD%D0%BE%D0%B5_%D1%81%D0%B8%D0%BD%D1%82%D0%B0%D0%BA%D1%81%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%BE%D0%B5_%D0%B4%D0%B5%D1%80%D0%B5%D0%B2%D0%BE\" rel=\"nofollow\">\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0435 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e<\/a><\/strong><\/li>\n<li><strong><a href=\"https:\/\/blog.bitsrc.io\/what-is-an-abstract-syntax-tree-7502b71bde27\" rel=\"nofollow\">What is an Abstract Syntax Tree<\/a><\/strong>\u00a0\u043e\u0442\u00a0<strong><a href=\"https:\/\/twitter.com\/ngArchangel\" rel=\"nofollow\">Chidume Nnamdi<\/a><\/strong><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0432\u043e\u0434\u044f \u0438\u0442\u043e\u0433, AST \u044d\u0442\u043e \u0434\u0440\u0435\u0432\u043e\u0432\u0438\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u0434\u0430. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 JavaScript, AST JavaScript \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 <a href=\"https:\/\/github.com\/estree\/estree\" rel=\"nofollow\">estree<\/a>. <\/p>\n<p>  <\/p>\n<p>AST \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u0434\u0430. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c AST \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430\u043c \u0432\u0440\u043e\u0434\u0435 babel, \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u043e\u0434 \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u043d\u0435\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043e\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 AST, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u043b\u0430\u0433\u0438\u043d \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u044d\u0442\u0438 \u0437\u043d\u0430\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<h3 id=\"kak-ispolzovat-babel-dlya-preobrazovaniya-koda\">\u041a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c babel \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430?<\/h3>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0438\u0436\u0435, \u044d\u0442\u043e \u043e\u0431\u0449\u0438\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f babel \u0434\u043b\u044f \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">import { parse } from '@babel\/parser'; import traverse from '@babel\/traverse'; import generate from '@babel\/generator';  const code = 'const n = 1';  \/\/ \u043f\u0430\u0440\u0441\u0438\u043c \u043a\u043e\u0434 \u0432 ast const ast = parse(code);  \/\/ \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c ast traverse(ast, {   enter(path) {     \/\/ \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u043c\u0435\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 `n` \u043d\u0430 `x`     if (path.isIdentifier({ name: 'n' })) {       path.node.name = 'x';     }   }, });  \/\/ \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0434 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0438\u0437 ast const output = generate(ast, code); console.log(output.code); \/\/ 'const x = 1;'<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c <code>@babel\/core<\/code> \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430. <code>@babel\/parser<\/code>, <code>@babel\/traverse<\/code>, <code>@babel\/generator<\/code> \u0432\u0441\u0435 \u044d\u0442\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 <code>@babel\/core<\/code> \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e.<\/p>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0434\u0435\u044f \u0432 \u0442\u043e\u043c \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0432\u0430\u0448 \u043a\u043e\u0434 \u0432 AST, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c AST \u0438 \u043f\u043e\u0441\u043b\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437 \u043d\u0435\u0433\u043e \u043a\u043e\u0434.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">\u041a\u043e\u0434 -&gt; AST -&gt; \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u043e\u0435 AST -&gt; \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0435 babel API \u0437\u0430\u043f\u0438\u0441\u0430\u0432 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0448\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">import babel from '@babel\/core';  const code = 'const n = 1';  const output = babel.transformSync(code, {   plugins: [     \/\/ \u043d\u0430\u0448 \u043f\u0435\u0440\u0432\u044b\u0439 babel \u043f\u043b\u0430\u0433\u0438\u043d     function myCustomPlugin() {       return {         visitor: {           Identifier(path) {             \/\/ \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u043c\u0435\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 `n` \u043d\u0430 `x`             if (path.isIdentifier({ name: 'n' })) {               path.node.name = 'x';             }           },         },       };     },   ], });  console.log(output.code); \/\/ 'const x = 1;'<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u043d\u0430\u0448 \u043f\u0435\u0440\u0432\u044b\u0439 babel \u043f\u043b\u0430\u0433\u0438\u043d \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442 \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>n<\/code> \u043d\u0430 <code>x<\/code>, \u0440\u0430\u0437\u0432\u0435 \u043d\u0435 \u043a\u0440\u0443\u0442\u043e?<\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0434\u0435\u043b\u0438\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>myCustomPlugin<\/code> \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0435\u0451. <a href=\"https:\/\/medium.com\/@bretcameron\/how-to-publish-your-first-npm-package-b224296fc57b\" rel=\"nofollow\">\u041e\u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0439\u0442\u0435 npm \u043f\u0430\u043a\u0435\u0442<\/a> \u0438 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0433\u043e\u0440\u0434\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043b\u0438 babel \u043f\u043b\u0430\u0433\u0438\u043d!<\/p>\n<p>  <\/p>\n<p>\u041a \u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0434\u0443\u043c\u0430\u0435\u0442\u0435: &quot;\u0414\u0430, \u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 babel \u043f\u043b\u0430\u0433\u0438\u043d, \u043d\u043e \u044f \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442&#8230;&quot;. \u041d\u0435 \u0432\u043e\u043b\u043d\u0443\u0439\u0442\u0435\u0441\u044c, \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u043c\u0441\u044f \u0433\u043b\u0443\u0431\u0436\u0435 \u0432 \u0442\u043e \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>  <\/p>\n<h3 id=\"1-predstavte-chto-i-vo-chto-vy-hotite-prevratit\">1. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0447\u0442\u043e \u0438 \u0432\u043e \u0447\u0442\u043e \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c<\/h3>\n<p>  <\/p>\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0437\u044b\u0433\u0440\u0430\u0442\u044c \u0441\u0432\u043e\u0435\u0433\u043e \u043a\u043e\u043b\u043b\u0435\u0433\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u043f\u0435\u0440\u0435\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/li>\n<li>\u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0414\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">function greet(name) {   return 'Hello ' + name; }  console.log(greet('tanhauhau')); \/\/ Hello tanhauhau<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">function teerg(eman) {       return 'H' + 'e' + 'l' + 'l' + 'o' + ' ' + eman;     }  console.log(teerg('t' + 'a' + 'n' + 'h' + 'a' + 'u' + 'h' + 'a' + 'u')); \/\/ Hello tanhauhau<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438 <code>console.log<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e \u0447\u0442\u043e \u043a\u043e\u0434 \u0441\u043b\u043e\u0436\u043d\u043e \u0447\u0438\u0442\u0430\u0442\u044c, \u043e\u043d \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. (\u042f \u0432\u0435\u0434\u044c \u043d\u0435 \u0445\u043e\u0447\u0443 \u0441\u043b\u043e\u043c\u0430\u0442\u044c \u043a\u043e\u0434 \u043d\u0430 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435!)<\/p>\n<p>  <\/p>\n<h3 id=\"2-znayte-na-chto-nacelitsya-v-ast\">2. \u0417\u043d\u0430\u0439\u0442\u0435 \u043d\u0430 \u0447\u0442\u043e <em>\u043d\u0430\u0446\u0435\u043b\u0438\u0442\u044c\u0441\u044f<\/em> \u0432 AST<\/h3>\n<p>  <\/p>\n<p>\u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f <strong><a href=\"https:\/\/lihautan.com\/babel-ast-explorer\/#?eyJiYWJlbFNldHRpbmdzIjp7InZlcnNpb24iOiI3LjQuNSJ9LCJ0cmVlU2V0dGluZ3MiOnsiaGlkZUVtcHR5Ijp0cnVlLCJoaWRlTG9jYXRpb24iOnRydWUsImhpZGVUeXBlIjp0cnVlfSwiY29kZSI6ImZ1bmN0aW9uIGdyZWV0KG5hbWUpIHtcbiAgcmV0dXJuICdIZWxsbyAnICsgbmFtZTtcbn1cblxuY29uc29sZS5sb2coZ3JlZXQoJ3RhbmhhdWhhdScpKTsgLy8gSGVsbG8gdGFuaGF1aGF1In0=\" rel=\"nofollow\">babel AST explorer<\/a>,<\/strong> \u043d\u0430\u0432\u0435\u0434\u0438\u0442\u0435 \u043a\u0443\u0440\u0441\u043e\u0440\u043e\u043c \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u0434\u0430 \u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0439\u0442\u0435 \u043a\u0430\u043a \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0432 AST:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/947\/f80\/8d4\/947f808d4e8bffde115cbcd8bb1f77c3.png\" alt=\"https:\/\/lihautan.com\/static\/0cf3ccd0d3c0a243103feadfdf5c1dd9\/bf7ce\/targeting.png\"><\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435 AST, \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0441 \u043d\u0438\u043c \u0447\u0443\u0442\u044c \u0434\u043e\u043b\u044c\u0448\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u043a\u0430\u043a \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0447\u0430\u0441\u0442\u0438 \u0434\u0435\u0440\u0435\u0432\u0430 \u0438 \u043a\u043e\u0434.<\/p>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 <em>\u0446\u0435\u043b\u044c<\/em>:<\/p>\n<p>  <\/p>\n<ul>\n<li><strong>Identifier<\/strong>\u00a0\u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/li>\n<li><strong>StringLiteral<\/strong>\u00a0\u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3 id=\"3-predstavte-kak-vyglyadit-preobrazovannyy-ast\">3. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 AST<\/h3>\n<p>  <\/p>\n<p>\u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u0441\u043d\u043e\u0432\u0430 \u0432 <strong><a href=\"https:\/\/lihautan.com\/babel-ast-explorer\/#?eyJiYWJlbFNldHRpbmdzIjp7InZlcnNpb24iOiI3LjQuNSJ9LCJ0cmVlU2V0dGluZ3MiOnsiaGlkZUVtcHR5Ijp0cnVlLCJoaWRlTG9jYXRpb24iOnRydWUsImhpZGVUeXBlIjp0cnVlfSwiY29kZSI6ImZ1bmN0aW9uIGdyZWV0KG5hbWUpIHtcbiAgcmV0dXJuICdIZWxsbyAnICsgbmFtZTtcbn1cblxuY29uc29sZS5sb2coZ3JlZXQoJ3RhbmhhdWhhdScpKTsgLy8gSGVsbG8gdGFuaGF1aGF1In0=\" rel=\"nofollow\">babel AST explorer<\/a><\/strong>, \u043d\u043e \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0441 \u043a\u043e\u0434\u043e\u043c \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/1a5\/0ab\/d85\/1a50abd859dbcd05f3e1d3154d5b483f.png\" alt=\"https:\/\/lihautan.com\/static\/fa937b7e3d8c6f72f076f4e86d9b60e1\/30a34\/output.png\"><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0438\u0433\u0440\u0430\u0439\u0442\u0435 \u0441 \u044d\u0442\u0438\u043c \u043a\u043e\u0434\u043e\u043c \u0438 \u043f\u043e\u0434\u0443\u043c\u0430\u0439\u0442\u0435 \u043a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 AST \u0434\u0435\u0440\u0435\u0432\u043e \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0435. <\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0447\u0442\u043e <code>'H' + 'e' + 'l' + 'l' + 'o' + ' ' + eman<\/code> \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438(<code>BinaryExpression<\/code>) \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u043c\u0438 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u0430\u043c\u0438(<code>StringLiteral<\/code>)<\/p>\n<p>  <\/p>\n<h3 id=\"4-pishem-kod\">4. \u041f\u0438\u0448\u0435\u043c \u043a\u043e\u0434<\/h3>\n<p>  <\/p>\n<p>\u0412\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u043d\u0430\u0448 \u043a\u043e\u0434 \u0441\u043d\u043e\u0432\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">function myCustomPlugin() {   return {     visitor: {       Identifier(path) {         \/\/ ...       },     },   }; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <a href=\"https:\/\/refactoring.guru\/ru\/design-patterns\/visitor\" rel=\"nofollow\">\u043f\u0430\u0442\u0442\u0435\u0440\u043d \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044f<\/a> \u0442\u0430\u043a \u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043a\u0430\u043a <em>visitor<\/em>.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0445\u043e\u0434\u0430 \u0434\u0435\u0440\u0435\u0432\u0430, babel \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9F%D0%BE%D0%B8%D1%81%D0%BA_%D0%B2_%D0%B3%D0%BB%D1%83%D0%B1%D0%B8%D0%BD%D1%83\" rel=\"nofollow\">\u043f\u043e\u0438\u0441\u043a\u0430 \u0432 \u0433\u043b\u0443\u0431\u0438\u043d\u0443<\/a> \u043e\u0431\u043e\u0439\u0434\u0435\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0443\u0437\u0435\u043b AST \u0434\u0435\u0440\u0435\u0432\u0430. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u043b\u0431\u044d\u043a \u0432 <code>visitor<\/code>, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043a\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0439\u0434\u0435\u043d \u043d\u043e\u0432\u044b\u0439 \u0443\u0437\u0435\u043b, babel \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u043a\u043e\u043b\u0431\u044d\u043a \u0441 \u0442\u0430\u043a\u0438\u043c \u0443\u0437\u043b\u043e\u043c.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043e\u0431\u044a\u0435\u043a\u0442\u0435 <code>visitor<\/code> \u043c\u043e\u0436\u043d\u043e \u0443\u0442\u043e\u0447\u043d\u0438\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u043a\u043e\u0433\u043e \u0443\u0437\u043b\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u043b\u0431\u044d\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">function myCustomPlugin() {   return {     visitor: {       Identifier(path) {         console.log('\u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440');       },       StringLiteral(path) {         console.log('\u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u043b');       },     },   }; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u043a\u043e\u0434 \u0432\u044b\u0448\u0435, \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0432\u044b\u0432\u043e\u0434 <code>\u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440<\/code> \u0438 <code>\u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u043b<\/code> \u0432\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437 \u043a\u043e\u0433\u0434\u0430 babel \u0431\u0443\u0434\u0435\u0442 \u0438\u0445 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">\u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u043b \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u043b<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c, \u0434\u0430\u0432\u0430\u0439 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>Identifer(path) {}<\/code>. \u041e\u043d \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>path<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code>node<\/code>, \u0432 \u0447\u0435\u043c \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u0440\u0430\u0437\u043d\u0438\u0446\u0430?<\/p>\n<p>  <\/p>\n<p>\u0412 babel, <code>path<\/code> \u044d\u0442\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f \u043d\u0430\u0434 \u0443\u0437\u043b\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0442\u0430\u043a\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043a\u0430\u043a \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0443\u0437\u0435\u043b, \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0443 \u0438 \u0442.\u0434. \u041a\u0440\u043e\u043c\u0435 \u044d\u0442\u043e\u0433\u043e <code>path<\/code> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u044b, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <code>replaceWith<\/code>, <code>insertBefore<\/code>, <code>remove<\/code> \u0438 \u043f\u0440\u043e\u0447\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 AST \u0443\u0437\u0435\u043b.<\/p>\n<p>  <\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u043e <code>path<\/code> \u0432 <a href=\"https:\/\/github.com\/jamiebuilds\/babel-handbook\/blob\/master\/translations\/en\/plugin-handbook.md#paths\" rel=\"nofollow\">\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u043f\u043e babel<\/a> \u043e\u0442 <a href=\"https:\/\/jamie.build\/\" rel=\"nofollow\">Jamie Kyle<\/a> <\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d.<\/p>\n<p>  <\/p>\n<h3 id=\"menyaem-poryadok-bukv-imen-peremennyh\">\u041c\u0435\u043d\u044f\u0435\u043c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0431\u0443\u043a\u0432 \u0438\u043c\u0435\u043d \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445<\/h3>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u0432 <strong><a href=\"https:\/\/lihautan.com\/babel-ast-explorer\/#?eyJiYWJlbFNldHRpbmdzIjp7InZlcnNpb24iOiI3LjQuNSJ9LCJ0cmVlU2V0dGluZ3MiOnsiaGlkZUVtcHR5Ijp0cnVlLCJoaWRlTG9jYXRpb24iOnRydWUsImhpZGVUeXBlIjp0cnVlfSwiY29kZSI6ImZ1bmN0aW9uIGdyZWV0KG5hbWUpIHtcbiAgcmV0dXJuICdIZWxsbyAnICsgbmFtZTtcbn1cblxuY29uc29sZS5sb2coZ3JlZXQoJ3RhbmhhdWhhdScpKTsgLy8gSGVsbG8gdGFuaGF1aGF1In0=\" rel=\"nofollow\">babel AST explorer<\/a><\/strong>, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435 <code>name<\/code>, \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u044d\u0442\u043e\u0433\u043e, \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0431\u0443\u043a\u0432 \u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">Identifier(path) {   path.node.name = path.node.name     .split('')     .reverse()     .join(''); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">function teerg(eman) {   return 'Hello ' + eman; }  elosnoc.gol(teerg('tanhauhau')); \/\/ Hello tanhauhau<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u044b \u043f\u043e\u0447\u0442\u0438 \u0434\u043e\u0431\u0438\u043b\u0438\u0441\u044c \u0446\u0435\u043b\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044f \u0442\u043e\u0442 \u0444\u0430\u043a\u0442 \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f console.log \u0442\u0430\u043a \u0436\u0435 \u043f\u043e\u0434\u0432\u0435\u0440\u0433\u043b\u0430\u0441\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c. \u041a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0442\u0438\u0442\u044c?<\/p>\n<p>  <\/p>\n<p>\u0421\u043d\u043e\u0432\u0430 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 AST:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/13f\/50a\/45c\/13f50a45c5f13c5f884daeabe2bf9a68.png\" alt=\"https:\/\/lihautan.com\/static\/487252cc6b3641879b1a606c5f7e6263\/ae92f\/member-expression.png\"><\/p>\n<p>  <\/p>\n<p><code>console.log<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e <code>MemberExpression<\/code>, c <code>object<\/code> \u2014 <code>&quot;console&quot;<\/code> \u0438 <code>property<\/code> \u2014 <code>&quot;log&quot;<\/code><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u0435\u0441\u043b\u0438 \u043d\u0430\u0448 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 <code>MemberExpression<\/code>, \u0442\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0431\u0443\u043a\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">if (   !(     path.parentPath.isMemberExpression() &amp;&amp;     path.parentPath       .get('object')       .isIdentifier({ name: 'console' }) &amp;&amp;     path.parentPath.get('property').isIdentifier({ name: 'log' })   ) ) {  path.node.name = path.node.name    .split('')    .reverse()    .join(''); } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e!<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">function teerg(eman) {   return 'Hello ' + eman; }  console.log(teerg('tanhauhau')); \/\/ Hello tanhauhau<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0447\u0442\u043e <code>Identifier<\/code> \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>console.log<\/code>\u00a0<code>MemberExpression<\/code>? \u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0447\u0442\u043e <code>Identifier.name === 'console' || Identifier.name === 'log'<\/code>?<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0442\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043e\u0434\u043d\u0430\u043a\u043e \u0442\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u043d\u044b\u0435 <code>console<\/code>\u00a0or\u00a0<code>log<\/code> \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const log = 1;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0443\u0437\u043d\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b <code>isMemberExpression<\/code> \u0438 <code>isIdentifier<\/code>? \u0412\u0441\u0435 \u0442\u0438\u043f\u044b \u0443\u0437\u043b\u043e\u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432 <a href=\"https:\/\/babeljs.io\/docs\/en\/babel-types\" rel=\"nofollow\">@babel\/types<\/a> \u0438\u043c\u0435\u044e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u0442\u0438\u043f\u0430 <code>isXxxx<\/code>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>anyTypeAnnotation<\/code> \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 <code>isAnyTypeAnnotation<\/code>. \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u043e\u0432, \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 <a href=\"https:\/\/github.com\/babel\/babel\/blob\/master\/packages\/babel-types\/src\/validators\/generated\/index.js\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c<\/a>.<\/p>\n<p>  <\/p>\n<h3 id=\"transformiruem-stroki\">\u0422\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0438<\/h3>\n<p>  <\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e <code>BinaryExpression<\/code> \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0433\u043e \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u0430.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0443\u0437\u0435\u043b \u0432 AST, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u0438\u0437 <code>[@babel\/types](https:\/\/babeljs.io\/docs\/en\/babel-types)<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">StringLiteral(path) {   const newNode = path.node.value     .split('')     .map(c =&gt; babel.types.stringLiteral(c))     .reduce((prev, curr) =&gt; {       return babel.types.binaryExpression('+', prev, curr);     });   path.replaceWith(newNode); } <\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u044b \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043b\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 <code>StringLiteral<\/code>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 <code>path.node.value<\/code>, c\u0434\u0435\u043b\u0430\u043b\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c <code>StringLiteral<\/code> \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>BinaryExpression<\/code>. \u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0437\u0430\u043c\u0435\u043d\u0438\u043b\u0438 <code>StringLiteral<\/code> \u043d\u043e\u0432\u044b\u043c \u0443\u0437\u043b\u043e\u043c.<\/p>\n<p>  <\/p>\n<p>\u2026\u0418 \u043d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435! \u0417\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e \u0444\u0430\u043a\u0442\u0430 \u0447\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432, \u043c\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0435\u043c\u0441\u044f \u0441 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0441\u0442\u0435\u043a\u0430:<\/p>\n<p>  <\/p>\n<p><code>RangeError: Maximum call stack size exceeded<\/code><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443?<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 <code>StringLiteral<\/code> \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c <code>StringLiteral<\/code>, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u043e\u0436\u0435 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u043e\u0437\u0434\u0430\u0435\u043c <code>StringLiteral<\/code>. \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e \u0447\u0442\u043e \u043c\u044b \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u043e\u0434\u0438\u043d <code>StringLiteral<\/code> \u0434\u0440\u0443\u0433\u0438\u043c <code>StringLiteral<\/code>, babel \u0431\u0443\u0434\u0435\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u044d\u0442\u043e \u0437\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u0443\u0437\u043b\u0430, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0447\u0435\u0433\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u043e\u043b\u0431\u044d\u043a, \u0432\u044b\u0437\u0432\u0430\u0432 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u0443\u044e \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u044e \u0438 \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0435\u043a\u0430. <\/p>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c babel \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043c\u044b \u0437\u0430\u043c\u0435\u043d\u0438\u043b\u0438 <code>StringLiteral<\/code> \u043d\u0430 <code>newNode<\/code>, \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0438\u0441\u043a\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0443\u0437\u043b\u044b?<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>path.skip()<\/code> \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0431\u0445\u043e\u0434 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">StringLiteral(path) {   const newNode = path.node.value     .split('')     .map(c =&gt; babel.types.stringLiteral(c))     .reduce((prev, curr) =&gt; {       return babel.types.binaryExpression('+', prev, curr);     });   path.replaceWith(newNode);   path.skip(); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u2026\u0422\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0435\u043a\u0430!<\/p>\n<p>  <\/p>\n<h3 id=\"itog\">\u0418\u0442\u043e\u0433<\/h3>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043f\u043b\u0430\u0433\u0438\u043d \u0434\u043b\u044f babel:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const babel = require('@babel\/core'); const code = ` function greet(name) {   return 'Hello ' + name; } console.log(greet('tanhauhau')); \/\/ Hello tanhauhau `; const output = babel.transformSync(code, {   plugins: [     function myCustomPlugin() {       return {         visitor: {           StringLiteral(path) {             const concat = path.node.value               .split('')               .map(c =&gt; babel.types.stringLiteral(c))               .reduce((prev, curr) =&gt; {                 return babel.types.binaryExpression('+', prev, curr);               });             path.replaceWith(concat);             path.skip();           },           Identifier(path) {             if (               !(                 path.parentPath.isMemberExpression() &amp;&amp;                 path.parentPath                   .get('object')                   .isIdentifier({ name: 'console' }) &amp;&amp;                 path.parentPath.get('property').isIdentifier({ name: 'log' })               )             ) {               path.node.name = path.node.name                 .split('')                 .reverse()                 .join('');             }           },         },       };     },   ], }); console.log(output.code);<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0448\u0430\u0433\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0447\u0442\u043e \u0438 \u0432\u043e \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0442\u044c<\/li>\n<li>\u041d\u0430\u0448\u043b\u0438 \u043d\u0430 \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u043c <em>\u043d\u0430\u0446\u0435\u043b\u0435\u043d\u044b<\/em> \u0432 AST<\/li>\n<li>\u0423\u0437\u043d\u0430\u043b\u0438 \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u043e\u0435 AST<\/li>\n<li>\u041d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u043a\u043e\u0434<\/li>\n<\/ol>\n<p>  <\/p>\n<h3 id=\"dopolnitelnaya-informaciya\">\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435, <a href=\"https:\/\/github.com\/babel\/babel\/tree\/master\/packages\" rel=\"nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 babel \u043d\u0430 GitHub<\/a> \u043b\u0443\u0447\u0448\u0435\u0435 \u043c\u0435\u0441\u0442\u043e \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e babel.<\/p>\n<p>  <\/p>\n<p>\u0412\u0437\u0433\u043b\u044f\u043d\u0438\u0442\u0435 \u043d\u0430 <a href=\"https:\/\/github.com\/babel\/babel\" rel=\"nofollow\">https:\/\/github.com\/babel\/babel<\/a>, \u0438 \u043d\u0430\u0439\u0434\u0438\u0442\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 <code>babel-plugin-transform-*<\/code> \u0438\u043b\u0438 <code>babel-plugin-proposal-*<\/code>, \u0432\u0441\u0435 \u043e\u043d\u0438 \u0432\u0441\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430\u043c\u0438-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438, \u0441\u0440\u0435\u0434\u0438 \u043d\u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043a\u0430\u043a babel \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 <a href=\"https:\/\/github.com\/babel\/babel\/tree\/master\/packages\/babel-plugin-proposal-nullish-coalescing-operator\" rel=\"nofollow\">nullish coalescing operator<\/a>, <a href=\"https:\/\/github.com\/babel\/babel\/tree\/master\/packages\/babel-plugin-proposal-optional-chaining\" rel=\"nofollow\">optional chaining<\/a> \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435.<\/p>\n<p>  <\/p>\n<h3 id=\"ssylki\">\u0421\u0441\u044b\u043b\u043a\u0438<\/h3>\n<p>  <\/p>\n<ul>\n<li><strong><a href=\"https:\/\/babeljs.io\/docs\/en\/\" rel=\"nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f Babel<\/a><\/strong>\u00a0&amp;\u00a0<strong><a href=\"https:\/\/github.com\/babel\/babel\" rel=\"nofollow\">Github<\/a><\/strong><\/li>\n<li><strong><a href=\"https:\/\/github.com\/jamiebuilds\/babel-handbook\" rel=\"nofollow\">Babel Handbook<\/a><\/strong>\u00a0\u043e\u0442\u00a0<strong><a href=\"https:\/\/jamie.build\/\" rel=\"nofollow\">Jamie Kyle<\/a><\/strong><\/li>\n<li><strong><a href=\"https:\/\/medium.com\/basecs\/leveling-up-ones-parsing-game-with-asts-d7a6fc2400ff\" rel=\"nofollow\">Leveling Up One\u2019s Parsing Game With ASTs<\/a><\/strong>\u00a0\u043e\u0442\u00a0<strong><a href=\"https:\/\/twitter.com\/vaidehijoshi\" rel=\"nofollow\">Vaidehi Joshi<\/a><\/strong><\/li>\n<\/ul>\n<p>  <\/p>\n<hr>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/490456\/\"> https:\/\/habr.com\/ru\/post\/490456\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/490456\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/zw\/lk\/0c\/zwlk0cmxn9nytpdecivdw5dgmpa.png\" alt=\"image\"><\/p>\n<p>  <\/p>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u0441 \u0432\u0430\u043c\u0438 \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e\u043c \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 <strong><a href=\"https:\/\/babeljs.io\/docs\/en\/babel-core\" rel=\"nofollow\">babel<\/a><\/strong> \u043f\u043b\u0430\u0433\u0438\u043d. \u0412\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0430\u0432\u043e\u043a, \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438\u043b\u0438 \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-299449","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/299449","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=299449"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/299449\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=299449"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=299449"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=299449"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}