├── .gitignore ├── .travis.yml ├── MANIFEST.in ├── README.md ├── babeljs ├── __init__.py ├── jscontext.py ├── source.py ├── static │ ├── babeljs │ │ ├── babel-plugin-transform-vue-jsx.min.js │ │ └── browser.js │ └── regenerator │ │ └── runtime.js └── transformer.py ├── setup.cfg ├── setup.py ├── test-requirements.txt ├── tests ├── __init__.py ├── files │ ├── jquery.js │ ├── large.js │ ├── result-test_vue_jsx.js │ ├── test.js │ └── test_vue_jsx.js └── test_transformer.py └── tox.ini /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io 2 | 3 | ### Python ### 4 | # Byte-compiled / optimized / DLL files 5 | __pycache__/ 6 | *.py[cod] 7 | 8 | # C extensions 9 | *.so 10 | 11 | # Distribution / packaging 12 | .Python 13 | env/ 14 | build/ 15 | develop-eggs/ 16 | dist/ 17 | downloads/ 18 | eggs/ 19 | .eggs/ 20 | lib/ 21 | lib64/ 22 | parts/ 23 | sdist/ 24 | var/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .coverage 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | 47 | # Translations 48 | *.mo 49 | *.pot 50 | 51 | # Django stuff: 52 | *.log 53 | 54 | # Sphinx documentation 55 | docs/_build/ 56 | 57 | # PyBuilder 58 | target/ 59 | 60 | .idea 61 | .venv 62 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - "2.7" 4 | 5 | install: "pip install -r test-requirements.txt" 6 | 7 | script: py.test tests 8 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.md 2 | graft babeljs 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | PyBabeljs 2 | ============ 3 | 4 | [![Build Status](https://api.travis-ci.org/yetone/babeljs-python.svg?branch=master)](https://travis-ci.org/yetone/babeljs-python) 5 | 6 | PyBabeljs is a python bindings to [Babel](https://babeljs.io/). 7 | 8 | ## Installation 9 | 10 | $ pip install PyBabeljs 11 | 12 | ## Usage 13 | 14 | ```python 15 | from babeljs import transformer 16 | 17 | transformer.transform_string('const a = () => 233') 18 | transformer.transform('path/to/test.js') 19 | ``` 20 | 21 | ## License 22 | 23 | MIT 24 | -------------------------------------------------------------------------------- /babeljs/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = 'yetone' 2 | 3 | VERSION = '0.0.8' 4 | -------------------------------------------------------------------------------- /babeljs/jscontext.py: -------------------------------------------------------------------------------- 1 | try: 2 | from py_mini_racer import py_mini_racer 3 | except ImportError: 4 | py_mini_racer = None 5 | 6 | try: 7 | from shutil import which 8 | except ImportError: 9 | from distutils.spawn import find_executable as which 10 | 11 | import subprocess 12 | import json 13 | import tempfile 14 | import os 15 | 16 | 17 | if py_mini_racer: 18 | ContextException = py_mini_racer.MiniRacerBaseException 19 | else: 20 | class ContextException(Exception): 21 | pass 22 | 23 | 24 | class NodeException(ContextException): 25 | pass 26 | 27 | 28 | def get_context(runtime='auto'): 29 | if runtime not in ('auto', 'miniracer', 'node'): 30 | raise ContextException('Unknown runtime: %s' % runtime) 31 | 32 | if runtime == 'auto': 33 | # Assume node if py_mini_racer is not installed 34 | if py_mini_racer is not None: 35 | runtime = 'miniracer' 36 | else: 37 | runtime = 'node' 38 | 39 | if runtime == 'miniracer': 40 | if py_mini_racer is None: 41 | raise ContextException("PyMiniRacer requested but not installed!") 42 | return py_mini_racer.MiniRacer() 43 | else: 44 | return MinimalNodeWrapper() 45 | 46 | 47 | class MinimalNodeWrapper(object): 48 | """ 49 | Bare-minimum node wrapper providing an API like MiniRacer. 50 | """ 51 | 52 | RESULT_FLAG = '__result__' 53 | 54 | def __init__(self): 55 | self.code = "" 56 | self.executable = None 57 | 58 | for name in ('node', 'nodejs'): 59 | if which(name): 60 | self.executable = name 61 | break 62 | 63 | if not self.executable: 64 | raise NodeException("Node.js requested but not installed!") 65 | 66 | def eval(self, code): 67 | # Note: Proper eval would actually execute code and return last result, 68 | # but we don't need that in this case. 69 | self.code += code 70 | 71 | def call(self, function, *args): 72 | # Dump "eval" code to file, run node, and parse result. Makes some 73 | # assumptions about code structure, which are safe in this case. 74 | 75 | self.code += """ 76 | console.log( 77 | "{flag}", 78 | JSON.stringify({function}({args})) 79 | ); 80 | """.format( 81 | flag=self.RESULT_FLAG, 82 | function=function, 83 | args=", ".join( 84 | json.dumps(arg) 85 | for arg in args 86 | ), 87 | ) 88 | 89 | with tempfile.NamedTemporaryFile( 90 | mode='w', 91 | suffix='.js', 92 | delete=False 93 | ) as f: 94 | f.write(self.code) 95 | 96 | try: 97 | result = subprocess.check_output( 98 | [self.executable, f.name], 99 | stderr=subprocess.STDOUT, 100 | ) 101 | except subprocess.CalledProcessError: 102 | result = None 103 | 104 | try: 105 | os.remove(f.name) 106 | except OSError: 107 | pass 108 | 109 | if not result: 110 | raise NodeException("Compilation Failed") 111 | 112 | result_lines = result.decode('utf-8').strip().split('\n') 113 | last_line = result_lines[-1] 114 | if not last_line.startswith(self.RESULT_FLAG): 115 | raise NodeException("Compilation Failed: %s" % last_line) 116 | 117 | last_line = last_line[len(self.RESULT_FLAG) + 1:] 118 | return json.loads(last_line) 119 | -------------------------------------------------------------------------------- /babeljs/source.py: -------------------------------------------------------------------------------- 1 | __author__ = 'yetone' 2 | 3 | from os.path import abspath, dirname, join, isfile 4 | 5 | 6 | ROOT = abspath(join(dirname(__file__), 'static')) 7 | EXTERNAL_PLUGINS = ( 8 | 'transform-vue-jsx', 9 | ) 10 | 11 | 12 | def get_abspath(js_file): 13 | path = join(ROOT, js_file) 14 | if isfile(path): 15 | return path 16 | else: 17 | raise IOError('%s: Could not find specified file.' % path) 18 | -------------------------------------------------------------------------------- /babeljs/static/babeljs/babel-plugin-transform-vue-jsx.min.js: -------------------------------------------------------------------------------- 1 | !function(u,D){"object"==typeof exports&&"object"==typeof module?module.exports=D():"function"==typeof define&&define.amd?define([],D):"object"==typeof exports?exports["babel-plugin-transform-vue-jsx"]=D():u["babel-plugin-transform-vue-jsx"]=D()}(this,function(){return function(u){function D(F){if(A[F])return A[F].exports;var C=A[F]={exports:{},id:F,loaded:!1};return u[F].call(C.exports,C,C.exports,D),C.loaded=!0,C.exports}var A={};return D.m=u,D.c=A,D.p="",D(0)}([function(u,D,A){"use strict";var F=A(7),C=A(2);u.exports=function(u){function D(u,D){u.parent.children=r.react.buildChildren(u.parent);var A,F=E(u.node.name,u.node),C=[];r.isIdentifier(F)?A=F.name:r.isLiteral(F)&&(A=F.value),r.react.isCompatTag(A)?C.push(r.stringLiteral(A)):C.push(F);var e=u.node.attributes;return e=e.length?B(e,D):r.nullLiteral(),C.push(e),r.callExpression(r.identifier("h"),C)}function E(u,D){if(r.isJSXIdentifier(u)){if("this"===u.name&&r.isReferenced(u,D))return r.thisExpression();if(!F.keyword.isIdentifierNameES6(u.name))return r.stringLiteral(u.name);u.type="Identifier"}else if(r.isJSXMemberExpression(u))return r.memberExpression(E(u.object,u),E(u.property,u));return u}function B(u,D){function A(){F.length&&(E.push(r.objectExpression(F)),F=[])}for(var F=[],E=[];u.length;){var B=u.shift();r.isJSXSpreadAttribute(B)?(A(),B.argument._isSpread=!0,E.push(B.argument)):F.push(e(B))}if(A(),E=E.map(function(u){return u._isSpread?u:C(u.properties,r)}),1===E.length)u=E[0];else if(E.length){var t=D.addImport("babel-helper-vue-jsx-merge-props","default","_mergeJSXProps");u=r.callExpression(t,[r.arrayExpression(E)])}return u}function e(u){var D=t(u.value||r.booleanLiteral(!0));return r.isStringLiteral(D)&&!r.isJSXExpressionContainer(u.value)&&(D.value=D.value.replace(/\n\s+/g," ")),r.isValidIdentifier(u.name.name)?u.name.type="Identifier":u.name=r.stringLiteral(u.name.name),r.inherits(r.objectProperty(u.name,D),u)}function t(u){return r.isJSXExpressionContainer(u)?u.expression:u}var r=u.types;return{inherits:A(4),visitor:{JSXNamespacedName:function(u){throw u.buildCodeFrameError("Namespaced tags/attributes are not supported. JSX is not XML.\nFor attributes like xlink:href, use xlinkHref instead.")},JSXElement:{exit:function(u,A){var F=D(u.get("openingElement"),A);F.arguments.push(r.arrayExpression(u.node.children)),F.arguments.length>=3&&(F._prettyCall=!0),u.replaceWith(r.inherits(F,u.node))}},Program:function(u){u.traverse({"ObjectMethod|ClassMethod":function(u){var D=u.get("params");if(!D.length||"h"!==D[0].node.name){var A={hasJsx:!1};u.traverse({JSXElement:function(){this.hasJsx=!0}},A),A.hasJsx&&u.get("body").unshiftContainer("body",r.variableDeclaration("const",[r.variableDeclarator(r.identifier("h"),r.memberExpression(r.thisExpression(),r.identifier("$createElement")))]))}}})}}}}},function(u,D){!function(){"use strict";function D(u){return 48<=u&&u<=57}function A(u){return 48<=u&&u<=57||97<=u&&u<=102||65<=u&&u<=70}function F(u){return u>=48&&u<=55}function C(u){return 32===u||9===u||11===u||12===u||160===u||u>=5760&&a.indexOf(u)>=0}function E(u){return 10===u||13===u||8232===u||8233===u}function B(u){if(u<=65535)return String.fromCharCode(u);var D=String.fromCharCode(Math.floor((u-65536)/1024)+55296),A=String.fromCharCode((u-65536)%1024+56320);return D+A}function e(u){return u<128?o[u]:s.NonAsciiIdentifierStart.test(B(u))}function t(u){return u<128?c[u]:s.NonAsciiIdentifierPart.test(B(u))}function r(u){return u<128?o[u]:i.NonAsciiIdentifierStart.test(B(u))}function n(u){return u<128?c[u]:i.NonAsciiIdentifierPart.test(B(u))}var i,s,a,o,c,f;for(s={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,NonAsciiIdentifierPart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/},i={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDE00-\uDE11\uDE13-\uDE2B\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDE00-\uDE2F\uDE44\uDE80-\uDEAA]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDD0-\uDDDA\uDE00-\uDE11\uDE13-\uDE37\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF01-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},a=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],o=new Array(128),f=0;f<128;++f)o[f]=f>=97&&f<=122||f>=65&&f<=90||36===f||95===f;for(c=new Array(128),f=0;f<128;++f)c[f]=f>=97&&f<=122||f>=65&&f<=90||f>=48&&f<=57||36===f||95===f;u.exports={isDecimalDigit:D,isHexDigit:A,isOctalDigit:F,isWhiteSpace:C,isLineTerminator:E,isIdentifierStartES5:e,isIdentifierPartES5:t,isIdentifierStartES6:r,isIdentifierPartES6:n}}()},function(u,D,A){"use strict";var F=A(3),C=F("class,staticClass,style,key,ref,refInFor,slot,scopedSlots"),E=(F("domProps,on,nativeOn,hook"),/^(domProps|on|nativeOn|hook)([\-A-Z])/),B=/^v-/,e=/^xlink([A-Z])/;u.exports=function(u,D){var A=[],F=Object.create(null);return u.forEach(function(u){var t=u.key.value||u.key.name;if(C(t))A.push(u);else{var r=t.match(E);if(r){var n=r[1],i=t.replace(E,function(u,D,A){return"-"===A?"":A.toLowerCase()}),s=D.objectProperty(D.stringLiteral(i),u.value),a=F[n];a?a.value.properties.push(s):(a=F[n]=D.objectProperty(D.identifier(n),D.objectExpression([s])),A.push(a))}else if(B.test(t)){t=t.replace(B,"");var o=F.directives;o||(o=F.directives=D.objectProperty(D.identifier("directives"),D.arrayExpression([])),A.push(o)),o.value.elements.push(D.objectExpression([D.objectProperty(D.identifier("name"),D.stringLiteral(t)),D.objectProperty(D.identifier("value"),u.value)]))}else{var c=F.attrs;e.test(u.key.name)&&(u.key.name=JSON.stringify(u.key.name.replace(e,function(u,D){return"xlink:"+D.toLowerCase()}))),c?c.value.properties.push(u):(c=F.attrs=D.objectProperty(D.identifier("attrs"),D.objectExpression([u])),A.push(c))}}}),D.objectExpression(A)}},function(u,D){"use strict";u.exports=function(u){for(var D=Object.create(null),A=u.split(","),F=0;F=A)return!1;if(C=u.charCodeAt(D),!(56320<=C&&C<=57343))return!1;F=r(F,C)}if(!E(F))return!1;E=a.isIdentifierPartES6}return!0}function i(u,D){return t(u)&&!E(u,D)}function s(u,D){return n(u)&&!B(u,D)}var a=A(1);u.exports={isKeywordES5:F,isKeywordES6:C,isReservedWordES5:E,isReservedWordES6:B,isRestrictedWord:e,isIdentifierNameES5:t,isIdentifierNameES6:n,isIdentifierES5:i,isIdentifierES6:s}}()},function(u,D,A){!function(){"use strict";D.ast=A(5),D.code=A(1),D.keyword=A(6)}()}])}); -------------------------------------------------------------------------------- /babeljs/static/regenerator/runtime.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * https://raw.github.com/facebook/regenerator/master/LICENSE file. An 7 | * additional grant of patent rights can be found in the PATENTS file in 8 | * the same directory. 9 | */ 10 | 11 | !(function(global) { 12 | "use strict"; 13 | 14 | var hasOwn = Object.prototype.hasOwnProperty; 15 | var undefined; // More compressible than void 0. 16 | var $Symbol = typeof Symbol === "function" ? Symbol : {}; 17 | var iteratorSymbol = $Symbol.iterator || "@@iterator"; 18 | var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; 19 | 20 | var inModule = typeof module === "object"; 21 | var runtime = global.regeneratorRuntime; 22 | if (runtime) { 23 | if (inModule) { 24 | // If regeneratorRuntime is defined globally and we're in a module, 25 | // make the exports object identical to regeneratorRuntime. 26 | module.exports = runtime; 27 | } 28 | // Don't bother evaluating the rest of this file if the runtime was 29 | // already defined globally. 30 | return; 31 | } 32 | 33 | // Define the runtime globally (as expected by generated code) as either 34 | // module.exports (if we're in a module) or a new, empty object. 35 | runtime = global.regeneratorRuntime = inModule ? module.exports : {}; 36 | 37 | function wrap(innerFn, outerFn, self, tryLocsList) { 38 | // If outerFn provided, then outerFn.prototype instanceof Generator. 39 | var generator = Object.create((outerFn || Generator).prototype); 40 | var context = new Context(tryLocsList || []); 41 | 42 | // The ._invoke method unifies the implementations of the .next, 43 | // .throw, and .return methods. 44 | generator._invoke = makeInvokeMethod(innerFn, self, context); 45 | 46 | return generator; 47 | } 48 | runtime.wrap = wrap; 49 | 50 | // Try/catch helper to minimize deoptimizations. Returns a completion 51 | // record like context.tryEntries[i].completion. This interface could 52 | // have been (and was previously) designed to take a closure to be 53 | // invoked without arguments, but in all the cases we care about we 54 | // already have an existing method we want to call, so there's no need 55 | // to create a new function object. We can even get away with assuming 56 | // the method takes exactly one argument, since that happens to be true 57 | // in every case, so we don't have to touch the arguments object. The 58 | // only additional allocation required is the completion record, which 59 | // has a stable shape and so hopefully should be cheap to allocate. 60 | function tryCatch(fn, obj, arg) { 61 | try { 62 | return { type: "normal", arg: fn.call(obj, arg) }; 63 | } catch (err) { 64 | return { type: "throw", arg: err }; 65 | } 66 | } 67 | 68 | var GenStateSuspendedStart = "suspendedStart"; 69 | var GenStateSuspendedYield = "suspendedYield"; 70 | var GenStateExecuting = "executing"; 71 | var GenStateCompleted = "completed"; 72 | 73 | // Returning this object from the innerFn has the same effect as 74 | // breaking out of the dispatch switch statement. 75 | var ContinueSentinel = {}; 76 | 77 | // Dummy constructor functions that we use as the .constructor and 78 | // .constructor.prototype properties for functions that return Generator 79 | // objects. For full spec compliance, you may wish to configure your 80 | // minifier not to mangle the names of these two functions. 81 | function Generator() {} 82 | function GeneratorFunction() {} 83 | function GeneratorFunctionPrototype() {} 84 | 85 | var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype; 86 | GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; 87 | GeneratorFunctionPrototype.constructor = GeneratorFunction; 88 | GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; 89 | 90 | // Helper for defining the .next, .throw, and .return methods of the 91 | // Iterator interface in terms of a single ._invoke method. 92 | function defineIteratorMethods(prototype) { 93 | ["next", "throw", "return"].forEach(function(method) { 94 | prototype[method] = function(arg) { 95 | return this._invoke(method, arg); 96 | }; 97 | }); 98 | } 99 | 100 | runtime.isGeneratorFunction = function(genFun) { 101 | var ctor = typeof genFun === "function" && genFun.constructor; 102 | return ctor 103 | ? ctor === GeneratorFunction || 104 | // For the native GeneratorFunction constructor, the best we can 105 | // do is to check its .name property. 106 | (ctor.displayName || ctor.name) === "GeneratorFunction" 107 | : false; 108 | }; 109 | 110 | runtime.mark = function(genFun) { 111 | if (Object.setPrototypeOf) { 112 | Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); 113 | } else { 114 | genFun.__proto__ = GeneratorFunctionPrototype; 115 | if (!(toStringTagSymbol in genFun)) { 116 | genFun[toStringTagSymbol] = "GeneratorFunction"; 117 | } 118 | } 119 | genFun.prototype = Object.create(Gp); 120 | return genFun; 121 | }; 122 | 123 | // Within the body of any async function, `await x` is transformed to 124 | // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test 125 | // `value instanceof AwaitArgument` to determine if the yielded value is 126 | // meant to be awaited. Some may consider the name of this method too 127 | // cutesy, but they are curmudgeons. 128 | runtime.awrap = function(arg) { 129 | return new AwaitArgument(arg); 130 | }; 131 | 132 | function AwaitArgument(arg) { 133 | this.arg = arg; 134 | } 135 | 136 | function AsyncIterator(generator) { 137 | function invoke(method, arg, resolve, reject) { 138 | var record = tryCatch(generator[method], generator, arg); 139 | if (record.type === "throw") { 140 | reject(record.arg); 141 | } else { 142 | var result = record.arg; 143 | var value = result.value; 144 | if (value instanceof AwaitArgument) { 145 | return Promise.resolve(value.arg).then(function(value) { 146 | invoke("next", value, resolve, reject); 147 | }, function(err) { 148 | invoke("throw", err, resolve, reject); 149 | }); 150 | } 151 | 152 | return Promise.resolve(value).then(function(unwrapped) { 153 | // When a yielded Promise is resolved, its final value becomes 154 | // the .value of the Promise<{value,done}> result for the 155 | // current iteration. If the Promise is rejected, however, the 156 | // result for this iteration will be rejected with the same 157 | // reason. Note that rejections of yielded Promises are not 158 | // thrown back into the generator function, as is the case 159 | // when an awaited Promise is rejected. This difference in 160 | // behavior between yield and await is important, because it 161 | // allows the consumer to decide what to do with the yielded 162 | // rejection (swallow it and continue, manually .throw it back 163 | // into the generator, abandon iteration, whatever). With 164 | // await, by contrast, there is no opportunity to examine the 165 | // rejection reason outside the generator function, so the 166 | // only option is to throw it from the await expression, and 167 | // let the generator function handle the exception. 168 | result.value = unwrapped; 169 | resolve(result); 170 | }, reject); 171 | } 172 | } 173 | 174 | if (typeof process === "object" && process.domain) { 175 | invoke = process.domain.bind(invoke); 176 | } 177 | 178 | var previousPromise; 179 | 180 | function enqueue(method, arg) { 181 | function callInvokeWithMethodAndArg() { 182 | return new Promise(function(resolve, reject) { 183 | invoke(method, arg, resolve, reject); 184 | }); 185 | } 186 | 187 | return previousPromise = 188 | // If enqueue has been called before, then we want to wait until 189 | // all previous Promises have been resolved before calling invoke, 190 | // so that results are always delivered in the correct order. If 191 | // enqueue has not been called before, then it is important to 192 | // call invoke immediately, without waiting on a callback to fire, 193 | // so that the async generator function has the opportunity to do 194 | // any necessary setup in a predictable way. This predictability 195 | // is why the Promise constructor synchronously invokes its 196 | // executor callback, and why async functions synchronously 197 | // execute code before the first await. Since we implement simple 198 | // async functions in terms of async generators, it is especially 199 | // important to get this right, even though it requires care. 200 | previousPromise ? previousPromise.then( 201 | callInvokeWithMethodAndArg, 202 | // Avoid propagating failures to Promises returned by later 203 | // invocations of the iterator. 204 | callInvokeWithMethodAndArg 205 | ) : callInvokeWithMethodAndArg(); 206 | } 207 | 208 | // Define the unified helper method that is used to implement .next, 209 | // .throw, and .return (see defineIteratorMethods). 210 | this._invoke = enqueue; 211 | } 212 | 213 | defineIteratorMethods(AsyncIterator.prototype); 214 | 215 | // Note that simple async functions are implemented on top of 216 | // AsyncIterator objects; they just return a Promise for the value of 217 | // the final result produced by the iterator. 218 | runtime.async = function(innerFn, outerFn, self, tryLocsList) { 219 | var iter = new AsyncIterator( 220 | wrap(innerFn, outerFn, self, tryLocsList) 221 | ); 222 | 223 | return runtime.isGeneratorFunction(outerFn) 224 | ? iter // If outerFn is a generator, return the full iterator. 225 | : iter.next().then(function(result) { 226 | return result.done ? result.value : iter.next(); 227 | }); 228 | }; 229 | 230 | function makeInvokeMethod(innerFn, self, context) { 231 | var state = GenStateSuspendedStart; 232 | 233 | return function invoke(method, arg) { 234 | if (state === GenStateExecuting) { 235 | throw new Error("Generator is already running"); 236 | } 237 | 238 | if (state === GenStateCompleted) { 239 | if (method === "throw") { 240 | throw arg; 241 | } 242 | 243 | // Be forgiving, per 25.3.3.3.3 of the spec: 244 | // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume 245 | return doneResult(); 246 | } 247 | 248 | while (true) { 249 | var delegate = context.delegate; 250 | if (delegate) { 251 | if (method === "return" || 252 | (method === "throw" && delegate.iterator[method] === undefined)) { 253 | // A return or throw (when the delegate iterator has no throw 254 | // method) always terminates the yield* loop. 255 | context.delegate = null; 256 | 257 | // If the delegate iterator has a return method, give it a 258 | // chance to clean up. 259 | var returnMethod = delegate.iterator["return"]; 260 | if (returnMethod) { 261 | var record = tryCatch(returnMethod, delegate.iterator, arg); 262 | if (record.type === "throw") { 263 | // If the return method threw an exception, let that 264 | // exception prevail over the original return or throw. 265 | method = "throw"; 266 | arg = record.arg; 267 | continue; 268 | } 269 | } 270 | 271 | if (method === "return") { 272 | // Continue with the outer return, now that the delegate 273 | // iterator has been terminated. 274 | continue; 275 | } 276 | } 277 | 278 | var record = tryCatch( 279 | delegate.iterator[method], 280 | delegate.iterator, 281 | arg 282 | ); 283 | 284 | if (record.type === "throw") { 285 | context.delegate = null; 286 | 287 | // Like returning generator.throw(uncaught), but without the 288 | // overhead of an extra function call. 289 | method = "throw"; 290 | arg = record.arg; 291 | continue; 292 | } 293 | 294 | // Delegate generator ran and handled its own exceptions so 295 | // regardless of what the method was, we continue as if it is 296 | // "next" with an undefined arg. 297 | method = "next"; 298 | arg = undefined; 299 | 300 | var info = record.arg; 301 | if (info.done) { 302 | context[delegate.resultName] = info.value; 303 | context.next = delegate.nextLoc; 304 | } else { 305 | state = GenStateSuspendedYield; 306 | return info; 307 | } 308 | 309 | context.delegate = null; 310 | } 311 | 312 | if (method === "next") { 313 | if (state === GenStateSuspendedYield) { 314 | context.sent = arg; 315 | } else { 316 | context.sent = undefined; 317 | } 318 | 319 | } else if (method === "throw") { 320 | if (state === GenStateSuspendedStart) { 321 | state = GenStateCompleted; 322 | throw arg; 323 | } 324 | 325 | if (context.dispatchException(arg)) { 326 | // If the dispatched exception was caught by a catch block, 327 | // then let that catch block handle the exception normally. 328 | method = "next"; 329 | arg = undefined; 330 | } 331 | 332 | } else if (method === "return") { 333 | context.abrupt("return", arg); 334 | } 335 | 336 | state = GenStateExecuting; 337 | 338 | var record = tryCatch(innerFn, self, context); 339 | if (record.type === "normal") { 340 | // If an exception is thrown from innerFn, we leave state === 341 | // GenStateExecuting and loop back for another invocation. 342 | state = context.done 343 | ? GenStateCompleted 344 | : GenStateSuspendedYield; 345 | 346 | var info = { 347 | value: record.arg, 348 | done: context.done 349 | }; 350 | 351 | if (record.arg === ContinueSentinel) { 352 | if (context.delegate && method === "next") { 353 | // Deliberately forget the last sent value so that we don't 354 | // accidentally pass it on to the delegate. 355 | arg = undefined; 356 | } 357 | } else { 358 | return info; 359 | } 360 | 361 | } else if (record.type === "throw") { 362 | state = GenStateCompleted; 363 | // Dispatch the exception by looping back around to the 364 | // context.dispatchException(arg) call above. 365 | method = "throw"; 366 | arg = record.arg; 367 | } 368 | } 369 | }; 370 | } 371 | 372 | // Define Generator.prototype.{next,throw,return} in terms of the 373 | // unified ._invoke helper method. 374 | defineIteratorMethods(Gp); 375 | 376 | Gp[iteratorSymbol] = function() { 377 | return this; 378 | }; 379 | 380 | Gp[toStringTagSymbol] = "Generator"; 381 | 382 | Gp.toString = function() { 383 | return "[object Generator]"; 384 | }; 385 | 386 | function pushTryEntry(locs) { 387 | var entry = { tryLoc: locs[0] }; 388 | 389 | if (1 in locs) { 390 | entry.catchLoc = locs[1]; 391 | } 392 | 393 | if (2 in locs) { 394 | entry.finallyLoc = locs[2]; 395 | entry.afterLoc = locs[3]; 396 | } 397 | 398 | this.tryEntries.push(entry); 399 | } 400 | 401 | function resetTryEntry(entry) { 402 | var record = entry.completion || {}; 403 | record.type = "normal"; 404 | delete record.arg; 405 | entry.completion = record; 406 | } 407 | 408 | function Context(tryLocsList) { 409 | // The root entry object (effectively a try statement without a catch 410 | // or a finally block) gives us a place to store values thrown from 411 | // locations where there is no enclosing try statement. 412 | this.tryEntries = [{ tryLoc: "root" }]; 413 | tryLocsList.forEach(pushTryEntry, this); 414 | this.reset(true); 415 | } 416 | 417 | runtime.keys = function(object) { 418 | var keys = []; 419 | for (var key in object) { 420 | keys.push(key); 421 | } 422 | keys.reverse(); 423 | 424 | // Rather than returning an object with a next method, we keep 425 | // things simple and return the next function itself. 426 | return function next() { 427 | while (keys.length) { 428 | var key = keys.pop(); 429 | if (key in object) { 430 | next.value = key; 431 | next.done = false; 432 | return next; 433 | } 434 | } 435 | 436 | // To avoid creating an additional object, we just hang the .value 437 | // and .done properties off the next function object itself. This 438 | // also ensures that the minifier will not anonymize the function. 439 | next.done = true; 440 | return next; 441 | }; 442 | }; 443 | 444 | function values(iterable) { 445 | if (iterable) { 446 | var iteratorMethod = iterable[iteratorSymbol]; 447 | if (iteratorMethod) { 448 | return iteratorMethod.call(iterable); 449 | } 450 | 451 | if (typeof iterable.next === "function") { 452 | return iterable; 453 | } 454 | 455 | if (!isNaN(iterable.length)) { 456 | var i = -1, next = function next() { 457 | while (++i < iterable.length) { 458 | if (hasOwn.call(iterable, i)) { 459 | next.value = iterable[i]; 460 | next.done = false; 461 | return next; 462 | } 463 | } 464 | 465 | next.value = undefined; 466 | next.done = true; 467 | 468 | return next; 469 | }; 470 | 471 | return next.next = next; 472 | } 473 | } 474 | 475 | // Return an iterator with no values. 476 | return { next: doneResult }; 477 | } 478 | runtime.values = values; 479 | 480 | function doneResult() { 481 | return { value: undefined, done: true }; 482 | } 483 | 484 | Context.prototype = { 485 | constructor: Context, 486 | 487 | reset: function(skipTempReset) { 488 | this.prev = 0; 489 | this.next = 0; 490 | this.sent = undefined; 491 | this.done = false; 492 | this.delegate = null; 493 | 494 | this.tryEntries.forEach(resetTryEntry); 495 | 496 | if (!skipTempReset) { 497 | for (var name in this) { 498 | // Not sure about the optimal order of these conditions: 499 | if (name.charAt(0) === "t" && 500 | hasOwn.call(this, name) && 501 | !isNaN(+name.slice(1))) { 502 | this[name] = undefined; 503 | } 504 | } 505 | } 506 | }, 507 | 508 | stop: function() { 509 | this.done = true; 510 | 511 | var rootEntry = this.tryEntries[0]; 512 | var rootRecord = rootEntry.completion; 513 | if (rootRecord.type === "throw") { 514 | throw rootRecord.arg; 515 | } 516 | 517 | return this.rval; 518 | }, 519 | 520 | dispatchException: function(exception) { 521 | if (this.done) { 522 | throw exception; 523 | } 524 | 525 | var context = this; 526 | function handle(loc, caught) { 527 | record.type = "throw"; 528 | record.arg = exception; 529 | context.next = loc; 530 | return !!caught; 531 | } 532 | 533 | for (var i = this.tryEntries.length - 1; i >= 0; --i) { 534 | var entry = this.tryEntries[i]; 535 | var record = entry.completion; 536 | 537 | if (entry.tryLoc === "root") { 538 | // Exception thrown outside of any try block that could handle 539 | // it, so set the completion value of the entire function to 540 | // throw the exception. 541 | return handle("end"); 542 | } 543 | 544 | if (entry.tryLoc <= this.prev) { 545 | var hasCatch = hasOwn.call(entry, "catchLoc"); 546 | var hasFinally = hasOwn.call(entry, "finallyLoc"); 547 | 548 | if (hasCatch && hasFinally) { 549 | if (this.prev < entry.catchLoc) { 550 | return handle(entry.catchLoc, true); 551 | } else if (this.prev < entry.finallyLoc) { 552 | return handle(entry.finallyLoc); 553 | } 554 | 555 | } else if (hasCatch) { 556 | if (this.prev < entry.catchLoc) { 557 | return handle(entry.catchLoc, true); 558 | } 559 | 560 | } else if (hasFinally) { 561 | if (this.prev < entry.finallyLoc) { 562 | return handle(entry.finallyLoc); 563 | } 564 | 565 | } else { 566 | throw new Error("try statement without catch or finally"); 567 | } 568 | } 569 | } 570 | }, 571 | 572 | abrupt: function(type, arg) { 573 | for (var i = this.tryEntries.length - 1; i >= 0; --i) { 574 | var entry = this.tryEntries[i]; 575 | if (entry.tryLoc <= this.prev && 576 | hasOwn.call(entry, "finallyLoc") && 577 | this.prev < entry.finallyLoc) { 578 | var finallyEntry = entry; 579 | break; 580 | } 581 | } 582 | 583 | if (finallyEntry && 584 | (type === "break" || 585 | type === "continue") && 586 | finallyEntry.tryLoc <= arg && 587 | arg <= finallyEntry.finallyLoc) { 588 | // Ignore the finally entry if control is not jumping to a 589 | // location outside the try/catch block. 590 | finallyEntry = null; 591 | } 592 | 593 | var record = finallyEntry ? finallyEntry.completion : {}; 594 | record.type = type; 595 | record.arg = arg; 596 | 597 | if (finallyEntry) { 598 | this.next = finallyEntry.finallyLoc; 599 | } else { 600 | this.complete(record); 601 | } 602 | 603 | return ContinueSentinel; 604 | }, 605 | 606 | complete: function(record, afterLoc) { 607 | if (record.type === "throw") { 608 | throw record.arg; 609 | } 610 | 611 | if (record.type === "break" || 612 | record.type === "continue") { 613 | this.next = record.arg; 614 | } else if (record.type === "return") { 615 | this.rval = record.arg; 616 | this.next = "end"; 617 | } else if (record.type === "normal" && afterLoc) { 618 | this.next = afterLoc; 619 | } 620 | }, 621 | 622 | finish: function(finallyLoc) { 623 | for (var i = this.tryEntries.length - 1; i >= 0; --i) { 624 | var entry = this.tryEntries[i]; 625 | if (entry.finallyLoc === finallyLoc) { 626 | this.complete(entry.completion, entry.afterLoc); 627 | resetTryEntry(entry); 628 | return ContinueSentinel; 629 | } 630 | } 631 | }, 632 | 633 | "catch": function(tryLoc) { 634 | for (var i = this.tryEntries.length - 1; i >= 0; --i) { 635 | var entry = this.tryEntries[i]; 636 | if (entry.tryLoc === tryLoc) { 637 | var record = entry.completion; 638 | if (record.type === "throw") { 639 | var thrown = record.arg; 640 | resetTryEntry(entry); 641 | } 642 | return thrown; 643 | } 644 | } 645 | 646 | // The context.catch method must only be called with a location 647 | // argument that corresponds to a known catch block. 648 | throw new Error("illegal catch attempt"); 649 | }, 650 | 651 | delegateYield: function(iterable, resultName, nextLoc) { 652 | this.delegate = { 653 | iterator: values(iterable), 654 | resultName: resultName, 655 | nextLoc: nextLoc 656 | }; 657 | 658 | return ContinueSentinel; 659 | } 660 | }; 661 | })( 662 | // Among the various tricks for obtaining a reference to the global 663 | // object, this seems to be the most reliable technique that does not 664 | // use indirect eval (which violates Content Security Policy). 665 | typeof global === "object" ? global : 666 | typeof window === "object" ? window : 667 | typeof self === "object" ? self : this 668 | ); 669 | -------------------------------------------------------------------------------- /babeljs/transformer.py: -------------------------------------------------------------------------------- 1 | from .jscontext import get_context, ContextException 2 | from babeljs.source import get_abspath, EXTERNAL_PLUGINS 3 | 4 | 5 | class TransformError(Exception): 6 | pass 7 | 8 | 9 | class Transformer(object): 10 | 11 | def __init__(self, runtime='auto', **_opts): 12 | self.runtime = runtime 13 | opts = { 14 | 'ast': False, 15 | 'presets': ['es2015', 'stage-0', 'react'] 16 | } 17 | opts.update(_opts) 18 | plugins = opts.get('plugins', []) 19 | 20 | babel_path = get_abspath('babeljs/browser.js') 21 | 22 | codes = [] 23 | with open(babel_path) as f: 24 | codes.append(f.read()) 25 | codes.append(""" 26 | var babel; 27 | if (typeof Babel != 'undefined') 28 | babel = Babel; 29 | else 30 | babel = module.exports; 31 | """) 32 | 33 | codes.append(""" 34 | if (typeof console == 'undefined') { 35 | console = {}; 36 | ['log', 'error', 'warn', 'info', 'debug'].forEach( 37 | function(key) { 38 | console[key] = function() {}; 39 | } 40 | ); 41 | } 42 | """) 43 | 44 | for plugin in plugins: 45 | if plugin in EXTERNAL_PLUGINS: 46 | plugin_path = get_abspath( 47 | 'babeljs/babel-plugin-{}.min.js'.format(plugin) 48 | ) 49 | with open(plugin_path) as f: 50 | codes.append(f.read()) 51 | codes.append(""" 52 | babel.registerPlugin( 53 | "{}", 54 | this["babel-plugin-{}"] || module.exports 55 | ); 56 | """.format(plugin, plugin)) 57 | try: 58 | self.opts = opts 59 | self.context = get_context(self.runtime) 60 | self.context.eval(''.join(codes)) 61 | except: 62 | raise TransformError() 63 | 64 | def transform_string(self, js_content, **_opts): 65 | opts = dict(self.opts, **_opts) 66 | try: 67 | result = self.context.call('babel.transform', js_content, opts) 68 | return result['code'] 69 | except ContextException as e: 70 | raise TransformError(e.args[0]) 71 | 72 | def transform(self, js_path, **opts): 73 | with open(js_path, 'r') as f: 74 | return self.transform_string(f.read(), **opts) 75 | 76 | 77 | def transform(js_path, **opts): 78 | return Transformer(**opts).transform(js_path) 79 | 80 | 81 | def transform_string(js_content, **opts): 82 | return Transformer(**opts).transform_string(js_content) 83 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [tool:pytest] 2 | norecursedirs = build/ *.egg .tox 3 | addopts = 4 | --verbose 5 | --tb short 6 | --capture no 7 | # show extra test summary info as specified by chars (f)ailed, (E)error, (s)skipped, (x)failed, (X)passed. 8 | -rfEsxX 9 | --cov babeljs --cov-report xml --cov-report term-missing 10 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, find_packages 2 | from babeljs import VERSION 3 | 4 | version = VERSION 5 | 6 | setup( 7 | name='PyBabeljs', 8 | version=version, 9 | keywords=('babel', 'babeljs', 'ES', 'JavaScript', 10 | 'ES2015', 'ES2016', 'ES2017'), 11 | description='The python binding for babel compiler', 12 | url='http://github.com/yetone/babeljs-python', 13 | license='MIT License', 14 | author='yetone', 15 | author_email='i@yetone.net', 16 | packages=find_packages(exclude=['tests']), 17 | platforms='any', 18 | include_package_data=True, 19 | tests_require=( 20 | 'pytest', 21 | 'py-mini-racer', 22 | ) 23 | ) 24 | -------------------------------------------------------------------------------- /test-requirements.txt: -------------------------------------------------------------------------------- 1 | pytest 2 | pytest-cov 3 | py-mini-racer 4 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = 'yetone' 2 | -------------------------------------------------------------------------------- /tests/files/result-test_vue_jsx.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | var _class; 6 | 7 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8 | 9 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 10 | 11 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 12 | 13 | var App = Component(_class = function (_Vue) { 14 | _inherits(App, _Vue); 15 | 16 | function App() { 17 | _classCallCheck(this, App); 18 | 19 | return _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).apply(this, arguments)); 20 | } 21 | 22 | _createClass(App, [{ 23 | key: "computed", 24 | get: function get() { 25 | var h = this.$createElement; 26 | 27 | return h( 28 | "div", 29 | { 30 | attrs: { id: "foo" } 31 | }, 32 | ["bar"] 33 | ); 34 | } 35 | }]); 36 | 37 | return App; 38 | }(Vue)) || _class; -------------------------------------------------------------------------------- /tests/files/test.js: -------------------------------------------------------------------------------- 1 | let a = 1; 2 | -------------------------------------------------------------------------------- /tests/files/test_vue_jsx.js: -------------------------------------------------------------------------------- 1 | @Component 2 | class App extends Vue { 3 | get computed () { 4 | return
bar
5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tests/test_transformer.py: -------------------------------------------------------------------------------- 1 | from os import path 2 | from unittest import TestCase 3 | 4 | from babeljs import transformer 5 | from timeit import default_timer 6 | from collections import OrderedDict 7 | 8 | 9 | ROOT = path.abspath(path.join(path.dirname(__file__), 'files')) 10 | 11 | 12 | timings = OrderedDict() 13 | 14 | 15 | class TestInvalidRuntime(TestCase): 16 | def test_invalid_runtime(self): 17 | with self.assertRaises(transformer.TransformError): 18 | transformer.transform_string("var a;", runtime='nonexistent') 19 | 20 | 21 | class TestMiniRacer(TestCase): 22 | runtime = 'miniracer' 23 | 24 | def setUp(self): 25 | self.start_time = default_timer() 26 | 27 | def tearDown(self): 28 | timings[self.id()] = default_timer() - self.start_time 29 | 30 | def test_transform_string(self): 31 | code = transformer.transform_string(''' 32 | const a = () => 233; 33 | const b =
; 34 | ''', runtime=self.runtime) 35 | self.assertEqual( 36 | '"use strict";\n\nvar a = function a() {\n return 233;\n};' 37 | '\nvar b = React.createElement("div", null);', 38 | code 39 | ) 40 | 41 | def test_transform(self): 42 | js_path = path.join(ROOT, 'test.js') 43 | code = transformer.transform(js_path, runtime=self.runtime) 44 | self.assertEqual('"use strict";\n\nvar a = 1;', code) 45 | 46 | def test_transform_vue_jsx(self): 47 | js_path = path.join(ROOT, 'test_vue_jsx.js') 48 | code = transformer.transform( 49 | js_path, 50 | runtime=self.runtime, 51 | **{ 52 | 'presets': ['es2015', 'stage-0'], 53 | 'plugins': ['transform-decorators-legacy', 'transform-vue-jsx'] 54 | } 55 | ) 56 | with open(path.join(ROOT, 'result-test_vue_jsx.js'), 'r') as f: 57 | expected_code = f.read() 58 | self.assertEqual(expected_code, code) 59 | 60 | def test_invalid_js(self): 61 | with self.assertRaises(transformer.TransformError): 62 | transformer.transform_string(''' 63 | invalid CODE; test(] / 64 | ''', runtime=self.runtime) 65 | 66 | def test_large_file(self): 67 | js_path = path.join(ROOT, 'large.js') 68 | code = transformer.transform(js_path, runtime=self.runtime) 69 | self.assertEqual( 70 | code[:22], 71 | '"use strict";var foo="' 72 | ) 73 | 74 | def test_jquery(self): 75 | js_path = path.join(ROOT, 'jquery.js') 76 | transformer.transform(js_path, runtime=self.runtime) 77 | 78 | @classmethod 79 | def tearDownClass(cls): 80 | compare_timings() 81 | 82 | 83 | class TestNode(TestMiniRacer): 84 | runtime = 'node' 85 | 86 | 87 | def compare_timings(): 88 | timing_header = False 89 | for test_id in timings: 90 | if 'MiniRacer' not in test_id: 91 | continue 92 | node_test_id = test_id.replace('MiniRacer', 'Node') 93 | if node_test_id not in timings: 94 | continue 95 | 96 | if not timing_header: 97 | timing_header = True 98 | print() 99 | print() 100 | print("PyMiniRacer speedup over Node.js subprocess:") 101 | 102 | name = test_id.split('.')[-1] 103 | label = name[:25] + (" " * (25 - len(name))) 104 | mini_racer_time = timings[test_id] 105 | node_time = timings[node_test_id] 106 | 107 | rel_s = mini_racer_time - node_time 108 | rel_pct = rel_s / node_time * 100 109 | if rel_pct > 0: 110 | msg = "{test_label}: {rel_pct}% slower (+{rel_ms}ms)" 111 | else: 112 | msg = "{test_label}: {rel_pct}% faster (-{rel_ms}ms)" 113 | 114 | print(msg.format( 115 | test_label=label, 116 | rel_pct=abs(round(rel_pct, 2)), 117 | rel_ms=abs(round(rel_s * 1000)) 118 | )) 119 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | skipsdist = True 3 | envlist = py27, py34, py35 4 | 5 | [testenv] 6 | deps = 7 | wheel>=0.26.0 8 | commands = 9 | pip install -e . -r test-requirements.txt 10 | py.test tests/ 11 | --------------------------------------------------------------------------------