1 | (function (global, factory) {
|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
3 | typeof define === 'function' && define.amd ? define(factory) :
|
4 | (global.PresetVue = factory());
|
5 | }(this, (function () { 'use strict';
|
6 |
|
7 | function unwrapExports (x) {
|
8 | return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
9 | }
|
10 |
|
11 | function createCommonjsModule(fn, module) {
|
12 | return module = { exports: {} }, fn(module, module.exports), module.exports;
|
13 | }
|
14 |
|
15 | var ast = createCommonjsModule(function (module) {
|
16 | |
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 | (function () {
|
41 |
|
42 | function isExpression(node) {
|
43 | if (node == null) { return false; }
|
44 | switch (node.type) {
|
45 | case 'ArrayExpression':
|
46 | case 'AssignmentExpression':
|
47 | case 'BinaryExpression':
|
48 | case 'CallExpression':
|
49 | case 'ConditionalExpression':
|
50 | case 'FunctionExpression':
|
51 | case 'Identifier':
|
52 | case 'Literal':
|
53 | case 'LogicalExpression':
|
54 | case 'MemberExpression':
|
55 | case 'NewExpression':
|
56 | case 'ObjectExpression':
|
57 | case 'SequenceExpression':
|
58 | case 'ThisExpression':
|
59 | case 'UnaryExpression':
|
60 | case 'UpdateExpression':
|
61 | return true;
|
62 | }
|
63 | return false;
|
64 | }
|
65 |
|
66 | function isIterationStatement(node) {
|
67 | if (node == null) { return false; }
|
68 | switch (node.type) {
|
69 | case 'DoWhileStatement':
|
70 | case 'ForInStatement':
|
71 | case 'ForStatement':
|
72 | case 'WhileStatement':
|
73 | return true;
|
74 | }
|
75 | return false;
|
76 | }
|
77 |
|
78 | function isStatement(node) {
|
79 | if (node == null) { return false; }
|
80 | switch (node.type) {
|
81 | case 'BlockStatement':
|
82 | case 'BreakStatement':
|
83 | case 'ContinueStatement':
|
84 | case 'DebuggerStatement':
|
85 | case 'DoWhileStatement':
|
86 | case 'EmptyStatement':
|
87 | case 'ExpressionStatement':
|
88 | case 'ForInStatement':
|
89 | case 'ForStatement':
|
90 | case 'IfStatement':
|
91 | case 'LabeledStatement':
|
92 | case 'ReturnStatement':
|
93 | case 'SwitchStatement':
|
94 | case 'ThrowStatement':
|
95 | case 'TryStatement':
|
96 | case 'VariableDeclaration':
|
97 | case 'WhileStatement':
|
98 | case 'WithStatement':
|
99 | return true;
|
100 | }
|
101 | return false;
|
102 | }
|
103 |
|
104 | function isSourceElement(node) {
|
105 | return isStatement(node) || node != null && node.type === 'FunctionDeclaration';
|
106 | }
|
107 |
|
108 | function trailingStatement(node) {
|
109 | switch (node.type) {
|
110 | case 'IfStatement':
|
111 | if (node.alternate != null) {
|
112 | return node.alternate;
|
113 | }
|
114 | return node.consequent;
|
115 |
|
116 | case 'LabeledStatement':
|
117 | case 'ForStatement':
|
118 | case 'ForInStatement':
|
119 | case 'WhileStatement':
|
120 | case 'WithStatement':
|
121 | return node.body;
|
122 | }
|
123 | return null;
|
124 | }
|
125 |
|
126 | function isProblematicIfStatement(node) {
|
127 | var current;
|
128 |
|
129 | if (node.type !== 'IfStatement') {
|
130 | return false;
|
131 | }
|
132 | if (node.alternate == null) {
|
133 | return false;
|
134 | }
|
135 | current = node.consequent;
|
136 | do {
|
137 | if (current.type === 'IfStatement') {
|
138 | if (current.alternate == null) {
|
139 | return true;
|
140 | }
|
141 | }
|
142 | current = trailingStatement(current);
|
143 | } while (current);
|
144 |
|
145 | return false;
|
146 | }
|
147 |
|
148 | module.exports = {
|
149 | isExpression: isExpression,
|
150 | isStatement: isStatement,
|
151 | isIterationStatement: isIterationStatement,
|
152 | isSourceElement: isSourceElement,
|
153 | isProblematicIfStatement: isProblematicIfStatement,
|
154 |
|
155 | trailingStatement: trailingStatement
|
156 | };
|
157 | }());
|
158 |
|
159 | });
|
160 | var ast_1 = ast.isExpression;
|
161 | var ast_2 = ast.isStatement;
|
162 | var ast_3 = ast.isIterationStatement;
|
163 | var ast_4 = ast.isSourceElement;
|
164 | var ast_5 = ast.isProblematicIfStatement;
|
165 | var ast_6 = ast.trailingStatement;
|
166 |
|
167 | var code = createCommonjsModule(function (module) {
|
168 | |
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 | (function () {
|
194 |
|
195 | var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch;
|
196 |
|
197 |
|
198 | ES5Regex = {
|
199 |
|
200 | 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]/,
|
201 |
|
202 | 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]/
|
203 | };
|
204 |
|
205 | ES6Regex = {
|
206 |
|
207 | 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]/,
|
208 |
|
209 | 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]/
|
210 | };
|
211 |
|
212 | function isDecimalDigit(ch) {
|
213 | return 0x30 <= ch && ch <= 0x39;
|
214 | }
|
215 |
|
216 | function isHexDigit(ch) {
|
217 | return 0x30 <= ch && ch <= 0x39 ||
|
218 | 0x61 <= ch && ch <= 0x66 ||
|
219 | 0x41 <= ch && ch <= 0x46;
|
220 | }
|
221 |
|
222 | function isOctalDigit(ch) {
|
223 | return ch >= 0x30 && ch <= 0x37;
|
224 | }
|
225 |
|
226 |
|
227 |
|
228 | NON_ASCII_WHITESPACES = [
|
229 | 0x1680, 0x180E,
|
230 | 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A,
|
231 | 0x202F, 0x205F,
|
232 | 0x3000,
|
233 | 0xFEFF
|
234 | ];
|
235 |
|
236 | function isWhiteSpace(ch) {
|
237 | return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 ||
|
238 | ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0;
|
239 | }
|
240 |
|
241 |
|
242 |
|
243 | function isLineTerminator(ch) {
|
244 | return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029;
|
245 | }
|
246 |
|
247 |
|
248 |
|
249 | function fromCodePoint(cp) {
|
250 | if (cp <= 0xFFFF) { return String.fromCharCode(cp); }
|
251 | var cu1 = String.fromCharCode(Math.floor((cp - 0x10000) / 0x400) + 0xD800);
|
252 | var cu2 = String.fromCharCode(((cp - 0x10000) % 0x400) + 0xDC00);
|
253 | return cu1 + cu2;
|
254 | }
|
255 |
|
256 | IDENTIFIER_START = new Array(0x80);
|
257 | for(ch = 0; ch < 0x80; ++ch) {
|
258 | IDENTIFIER_START[ch] =
|
259 | ch >= 0x61 && ch <= 0x7A ||
|
260 | ch >= 0x41 && ch <= 0x5A ||
|
261 | ch === 0x24 || ch === 0x5F;
|
262 | }
|
263 |
|
264 | IDENTIFIER_PART = new Array(0x80);
|
265 | for(ch = 0; ch < 0x80; ++ch) {
|
266 | IDENTIFIER_PART[ch] =
|
267 | ch >= 0x61 && ch <= 0x7A ||
|
268 | ch >= 0x41 && ch <= 0x5A ||
|
269 | ch >= 0x30 && ch <= 0x39 ||
|
270 | ch === 0x24 || ch === 0x5F;
|
271 | }
|
272 |
|
273 | function isIdentifierStartES5(ch) {
|
274 | return ch < 0x80 ? IDENTIFIER_START[ch] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
|
275 | }
|
276 |
|
277 | function isIdentifierPartES5(ch) {
|
278 | return ch < 0x80 ? IDENTIFIER_PART[ch] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
|
279 | }
|
280 |
|
281 | function isIdentifierStartES6(ch) {
|
282 | return ch < 0x80 ? IDENTIFIER_START[ch] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
|
283 | }
|
284 |
|
285 | function isIdentifierPartES6(ch) {
|
286 | return ch < 0x80 ? IDENTIFIER_PART[ch] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
|
287 | }
|
288 |
|
289 | module.exports = {
|
290 | isDecimalDigit: isDecimalDigit,
|
291 | isHexDigit: isHexDigit,
|
292 | isOctalDigit: isOctalDigit,
|
293 | isWhiteSpace: isWhiteSpace,
|
294 | isLineTerminator: isLineTerminator,
|
295 | isIdentifierStartES5: isIdentifierStartES5,
|
296 | isIdentifierPartES5: isIdentifierPartES5,
|
297 | isIdentifierStartES6: isIdentifierStartES6,
|
298 | isIdentifierPartES6: isIdentifierPartES6
|
299 | };
|
300 | }());
|
301 |
|
302 | });
|
303 | var code_1 = code.isDecimalDigit;
|
304 | var code_2 = code.isHexDigit;
|
305 | var code_3 = code.isOctalDigit;
|
306 | var code_4 = code.isWhiteSpace;
|
307 | var code_5 = code.isLineTerminator;
|
308 | var code_6 = code.isIdentifierStartES5;
|
309 | var code_7 = code.isIdentifierPartES5;
|
310 | var code_8 = code.isIdentifierStartES6;
|
311 | var code_9 = code.isIdentifierPartES6;
|
312 |
|
313 | var keyword = createCommonjsModule(function (module) {
|
314 | |
315 |
|
316 |
|
317 |
|
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 |
|
324 |
|
325 |
|
326 |
|
327 |
|
328 |
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 |
|
338 | (function () {
|
339 |
|
340 | var code$$1 = code;
|
341 |
|
342 | function isStrictModeReservedWordES6(id) {
|
343 | switch (id) {
|
344 | case 'implements':
|
345 | case 'interface':
|
346 | case 'package':
|
347 | case 'private':
|
348 | case 'protected':
|
349 | case 'public':
|
350 | case 'static':
|
351 | case 'let':
|
352 | return true;
|
353 | default:
|
354 | return false;
|
355 | }
|
356 | }
|
357 |
|
358 | function isKeywordES5(id, strict) {
|
359 |
|
360 | if (!strict && id === 'yield') {
|
361 | return false;
|
362 | }
|
363 | return isKeywordES6(id, strict);
|
364 | }
|
365 |
|
366 | function isKeywordES6(id, strict) {
|
367 | if (strict && isStrictModeReservedWordES6(id)) {
|
368 | return true;
|
369 | }
|
370 |
|
371 | switch (id.length) {
|
372 | case 2:
|
373 | return (id === 'if') || (id === 'in') || (id === 'do');
|
374 | case 3:
|
375 | return (id === 'var') || (id === 'for') || (id === 'new') || (id === 'try');
|
376 | case 4:
|
377 | return (id === 'this') || (id === 'else') || (id === 'case') ||
|
378 | (id === 'void') || (id === 'with') || (id === 'enum');
|
379 | case 5:
|
380 | return (id === 'while') || (id === 'break') || (id === 'catch') ||
|
381 | (id === 'throw') || (id === 'const') || (id === 'yield') ||
|
382 | (id === 'class') || (id === 'super');
|
383 | case 6:
|
384 | return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
|
385 | (id === 'switch') || (id === 'export') || (id === 'import');
|
386 | case 7:
|
387 | return (id === 'default') || (id === 'finally') || (id === 'extends');
|
388 | case 8:
|
389 | return (id === 'function') || (id === 'continue') || (id === 'debugger');
|
390 | case 10:
|
391 | return (id === 'instanceof');
|
392 | default:
|
393 | return false;
|
394 | }
|
395 | }
|
396 |
|
397 | function isReservedWordES5(id, strict) {
|
398 | return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict);
|
399 | }
|
400 |
|
401 | function isReservedWordES6(id, strict) {
|
402 | return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict);
|
403 | }
|
404 |
|
405 | function isRestrictedWord(id) {
|
406 | return id === 'eval' || id === 'arguments';
|
407 | }
|
408 |
|
409 | function isIdentifierNameES5(id) {
|
410 | var i, iz, ch;
|
411 |
|
412 | if (id.length === 0) { return false; }
|
413 |
|
414 | ch = id.charCodeAt(0);
|
415 | if (!code$$1.isIdentifierStartES5(ch)) {
|
416 | return false;
|
417 | }
|
418 |
|
419 | for (i = 1, iz = id.length; i < iz; ++i) {
|
420 | ch = id.charCodeAt(i);
|
421 | if (!code$$1.isIdentifierPartES5(ch)) {
|
422 | return false;
|
423 | }
|
424 | }
|
425 | return true;
|
426 | }
|
427 |
|
428 | function decodeUtf16(lead, trail) {
|
429 | return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
|
430 | }
|
431 |
|
432 | function isIdentifierNameES6(id) {
|
433 | var i, iz, ch, lowCh, check;
|
434 |
|
435 | if (id.length === 0) { return false; }
|
436 |
|
437 | check = code$$1.isIdentifierStartES6;
|
438 | for (i = 0, iz = id.length; i < iz; ++i) {
|
439 | ch = id.charCodeAt(i);
|
440 | if (0xD800 <= ch && ch <= 0xDBFF) {
|
441 | ++i;
|
442 | if (i >= iz) { return false; }
|
443 | lowCh = id.charCodeAt(i);
|
444 | if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) {
|
445 | return false;
|
446 | }
|
447 | ch = decodeUtf16(ch, lowCh);
|
448 | }
|
449 | if (!check(ch)) {
|
450 | return false;
|
451 | }
|
452 | check = code$$1.isIdentifierPartES6;
|
453 | }
|
454 | return true;
|
455 | }
|
456 |
|
457 | function isIdentifierES5(id, strict) {
|
458 | return isIdentifierNameES5(id) && !isReservedWordES5(id, strict);
|
459 | }
|
460 |
|
461 | function isIdentifierES6(id, strict) {
|
462 | return isIdentifierNameES6(id) && !isReservedWordES6(id, strict);
|
463 | }
|
464 |
|
465 | module.exports = {
|
466 | isKeywordES5: isKeywordES5,
|
467 | isKeywordES6: isKeywordES6,
|
468 | isReservedWordES5: isReservedWordES5,
|
469 | isReservedWordES6: isReservedWordES6,
|
470 | isRestrictedWord: isRestrictedWord,
|
471 | isIdentifierNameES5: isIdentifierNameES5,
|
472 | isIdentifierNameES6: isIdentifierNameES6,
|
473 | isIdentifierES5: isIdentifierES5,
|
474 | isIdentifierES6: isIdentifierES6
|
475 | };
|
476 | }());
|
477 |
|
478 | });
|
479 | var keyword_1 = keyword.isKeywordES5;
|
480 | var keyword_2 = keyword.isKeywordES6;
|
481 | var keyword_3 = keyword.isReservedWordES5;
|
482 | var keyword_4 = keyword.isReservedWordES6;
|
483 | var keyword_5 = keyword.isRestrictedWord;
|
484 | var keyword_6 = keyword.isIdentifierNameES5;
|
485 | var keyword_7 = keyword.isIdentifierNameES6;
|
486 | var keyword_8 = keyword.isIdentifierES5;
|
487 | var keyword_9 = keyword.isIdentifierES6;
|
488 |
|
489 | var utils = createCommonjsModule(function (module, exports) {
|
490 | |
491 |
|
492 |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 |
|
501 |
|
502 |
|
503 |
|
504 |
|
505 |
|
506 |
|
507 |
|
508 |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 | (function () {
|
516 |
|
517 | exports.ast = ast;
|
518 | exports.code = code;
|
519 | exports.keyword = keyword;
|
520 | }());
|
521 |
|
522 | });
|
523 | var utils_1 = utils.ast;
|
524 | var utils_2 = utils.code;
|
525 | var utils_3 = utils.keyword;
|
526 |
|
527 | var makeMap = function makeMap (str) {
|
528 | var map = Object.create(null);
|
529 | var list = str.split(',');
|
530 | for (var i = 0; i < list.length; i++) {
|
531 | map[list[i]] = true;
|
532 | }
|
533 | return val => map[val]
|
534 | };
|
535 |
|
536 | var isTopLevel = makeMap('class,staticClass,style,key,ref,refInFor,slot,scopedSlots');
|
537 | var isNestable = makeMap('domProps,on,nativeOn,hook');
|
538 | var nestableRE = /^(domProps|on|nativeOn|hook)([\-_A-Z])/;
|
539 | var dirRE = /^v-/;
|
540 | var xlinkRE = /^xlink([A-Z])/;
|
541 |
|
542 | var groupProps = function groupProps (props, t) {
|
543 | var newProps = [];
|
544 | var currentNestedObjects = Object.create(null);
|
545 | props.forEach(function (prop) {
|
546 | var name = prop.key.value || prop.key.name;
|
547 | if (isTopLevel(name)) {
|
548 |
|
549 | newProps.push(prop);
|
550 | } else {
|
551 |
|
552 | var nestMatch = name.match(nestableRE);
|
553 | if (nestMatch) {
|
554 | var prefix = nestMatch[1];
|
555 | var suffix = name.replace(nestableRE, function (_, $1, $2) {
|
556 | return $2 === '-' ? '' : $2.toLowerCase()
|
557 | });
|
558 | var nestedProp = t.objectProperty(t.stringLiteral(suffix), prop.value);
|
559 | var nestedObject = currentNestedObjects[prefix];
|
560 | if (!nestedObject) {
|
561 | nestedObject = currentNestedObjects[prefix] = t.objectProperty(
|
562 | t.identifier(prefix),
|
563 | t.objectExpression([nestedProp])
|
564 | );
|
565 | newProps.push(nestedObject);
|
566 | } else {
|
567 | nestedObject.value.properties.push(nestedProp);
|
568 | }
|
569 | } else if (dirRE.test(name)) {
|
570 |
|
571 | name = name.replace(dirRE, '');
|
572 | var dirs = currentNestedObjects.directives;
|
573 | if (!dirs) {
|
574 | dirs = currentNestedObjects.directives = t.objectProperty(
|
575 | t.identifier('directives'),
|
576 | t.arrayExpression([])
|
577 | );
|
578 | newProps.push(dirs);
|
579 | }
|
580 | dirs.value.elements.push(t.objectExpression([
|
581 | t.objectProperty(
|
582 | t.identifier('name'),
|
583 | t.stringLiteral(name)
|
584 | ),
|
585 | t.objectProperty(
|
586 | t.identifier('value'),
|
587 | prop.value
|
588 | )
|
589 | ]));
|
590 | } else {
|
591 |
|
592 | var attrs = currentNestedObjects.attrs;
|
593 |
|
594 | if (xlinkRE.test(prop.key.name)) {
|
595 | prop.key.name = JSON.stringify(prop.key.name.replace(xlinkRE, function (m, p1) {
|
596 | return 'xlink:' + p1.toLowerCase()
|
597 | }));
|
598 | }
|
599 | if (!attrs) {
|
600 | attrs = currentNestedObjects.attrs = t.objectProperty(
|
601 | t.identifier('attrs'),
|
602 | t.objectExpression([prop])
|
603 | );
|
604 | newProps.push(attrs);
|
605 | } else {
|
606 | attrs.value.properties.push(prop);
|
607 | }
|
608 | }
|
609 | }
|
610 | });
|
611 | return t.objectExpression(newProps)
|
612 | };
|
613 |
|
614 | const acceptValue = ['input','textarea','option','select'];
|
615 | var mustUseProp = (tag, type, attr) => {
|
616 | return (
|
617 | (attr === 'value' && acceptValue.includes(tag)) && type !== 'button' ||
|
618 | (attr === 'selected' && tag === 'option') ||
|
619 | (attr === 'checked' && tag === 'input') ||
|
620 | (attr === 'muted' && tag === 'video')
|
621 | )
|
622 | };
|
623 |
|
624 | var lib = createCommonjsModule(function (module, exports) {
|
625 |
|
626 | exports.__esModule = true;
|
627 |
|
628 | exports.default = function () {
|
629 | return {
|
630 | manipulateOptions: function manipulateOptions(opts, parserOpts) {
|
631 | parserOpts.plugins.push("jsx");
|
632 | }
|
633 | };
|
634 | };
|
635 |
|
636 | module.exports = exports["default"];
|
637 | });
|
638 |
|
639 | unwrapExports(lib);
|
640 |
|
641 | var babelPluginTransformVueJsx = function (babel) {
|
642 | var t = babel.types;
|
643 |
|
644 | return {
|
645 | inherits: lib,
|
646 | visitor: {
|
647 | JSXNamespacedName (path) {
|
648 | throw path.buildCodeFrameError(
|
649 | 'Namespaced tags/attributes are not supported. JSX is not XML.\n' +
|
650 | 'For attributes like xlink:href, use xlinkHref instead.'
|
651 | )
|
652 | },
|
653 | JSXElement: {
|
654 | exit (path, file) {
|
655 |
|
656 | var callExpr = buildElementCall(path.get('openingElement'), file);
|
657 |
|
658 | callExpr.arguments.push(t.arrayExpression(path.node.children));
|
659 | if (callExpr.arguments.length >= 3) {
|
660 | callExpr._prettyCall = true;
|
661 | }
|
662 | path.replaceWith(t.inherits(callExpr, path.node));
|
663 | }
|
664 | },
|
665 | 'Program' (path) {
|
666 | path.traverse({
|
667 | 'ObjectMethod|ClassMethod' (path) {
|
668 | const params = path.get('params');
|
669 |
|
670 | if (params.length && params[0].node.name === 'h') {
|
671 | return
|
672 | }
|
673 |
|
674 | const jsxChecker = {
|
675 | hasJsx: false
|
676 | };
|
677 | path.traverse({
|
678 | JSXElement () {
|
679 | this.hasJsx = true;
|
680 | }
|
681 | }, jsxChecker);
|
682 | if (!jsxChecker.hasJsx) {
|
683 | return
|
684 | }
|
685 | const isRender = path.node.key.name === 'render';
|
686 |
|
687 | path.get('body').unshiftContainer('body', t.variableDeclaration('const', [
|
688 | t.variableDeclarator(
|
689 | t.identifier('h'),
|
690 | (
|
691 | isRender
|
692 | ? t.memberExpression(
|
693 | t.identifier('arguments'),
|
694 | t.numericLiteral(0),
|
695 | true
|
696 | )
|
697 | : t.memberExpression(
|
698 | t.thisExpression(),
|
699 | t.identifier('$createElement')
|
700 | )
|
701 | )
|
702 | )
|
703 | ]));
|
704 | },
|
705 | JSXOpeningElement (path) {
|
706 | const tag = path.get('name').node.name;
|
707 | const attributes = path.get('attributes');
|
708 | const typeAttribute = attributes.find(attributePath => attributePath.node.name && attributePath.node.name.name === 'type');
|
709 | const type = typeAttribute && t.isStringLiteral(typeAttribute.node.value) ? typeAttribute.node.value.value : null;
|
710 |
|
711 | attributes.forEach(attributePath => {
|
712 | const attribute = attributePath.get('name');
|
713 |
|
714 | if (!attribute.node) {
|
715 | return
|
716 | }
|
717 |
|
718 | const attr = attribute.node.name;
|
719 |
|
720 | if (mustUseProp(tag, type, attr) && t.isJSXExpressionContainer(attributePath.node.value)) {
|
721 | attribute.replaceWith(t.JSXIdentifier(`domProps-${attr}`));
|
722 | }
|
723 | });
|
724 | }
|
725 | });
|
726 | }
|
727 | }
|
728 | }
|
729 |
|
730 | function buildElementCall (path, file) {
|
731 | path.parent.children = t.react.buildChildren(path.parent);
|
732 | var tagExpr = convertJSXIdentifier(path.node.name, path.node);
|
733 | var args = [];
|
734 |
|
735 | var tagName;
|
736 | if (t.isIdentifier(tagExpr)) {
|
737 | tagName = tagExpr.name;
|
738 | } else if (t.isLiteral(tagExpr)) {
|
739 | tagName = tagExpr.value;
|
740 | }
|
741 |
|
742 | if (t.react.isCompatTag(tagName)) {
|
743 | args.push(t.stringLiteral(tagName));
|
744 | } else {
|
745 | args.push(tagExpr);
|
746 | }
|
747 |
|
748 | var attribs = path.node.attributes;
|
749 | if (attribs.length) {
|
750 | attribs = buildOpeningElementAttributes(attribs, file);
|
751 | } else {
|
752 | attribs = t.nullLiteral();
|
753 | }
|
754 | args.push(attribs);
|
755 |
|
756 | return t.callExpression(t.identifier('h'), args)
|
757 | }
|
758 |
|
759 | function convertJSXIdentifier (node, parent) {
|
760 | if (t.isJSXIdentifier(node)) {
|
761 | if (node.name === 'this' && t.isReferenced(node, parent)) {
|
762 | return t.thisExpression()
|
763 | } else if (utils.keyword.isIdentifierNameES6(node.name)) {
|
764 | node.type = 'Identifier';
|
765 | } else {
|
766 | return t.stringLiteral(node.name)
|
767 | }
|
768 | } else if (t.isJSXMemberExpression(node)) {
|
769 | return t.memberExpression(
|
770 | convertJSXIdentifier(node.object, node),
|
771 | convertJSXIdentifier(node.property, node)
|
772 | )
|
773 | }
|
774 | return node
|
775 | }
|
776 |
|
777 | |
778 |
|
779 |
|
780 |
|
781 |
|
782 |
|
783 |
|
784 | function buildOpeningElementAttributes (attribs, file) {
|
785 | var _props = [];
|
786 | var objs = [];
|
787 |
|
788 | function pushProps () {
|
789 | if (!_props.length) return
|
790 | objs.push(t.objectExpression(_props));
|
791 | _props = [];
|
792 | }
|
793 |
|
794 | while (attribs.length) {
|
795 | var prop = attribs.shift();
|
796 | if (t.isJSXSpreadAttribute(prop)) {
|
797 | pushProps();
|
798 | prop.argument._isSpread = true;
|
799 | objs.push(prop.argument);
|
800 | } else {
|
801 | _props.push(convertAttribute(prop));
|
802 | }
|
803 | }
|
804 |
|
805 | pushProps();
|
806 |
|
807 | objs = objs.map(function (o) {
|
808 | return o._isSpread ? o : groupProps(o.properties, t)
|
809 | });
|
810 |
|
811 | if (objs.length === 1) {
|
812 |
|
813 | attribs = objs[0];
|
814 | } else if (objs.length) {
|
815 |
|
816 | var helper = file.addImport('babel-helper-vue-jsx-merge-props', 'default', '_mergeJSXProps');
|
817 |
|
818 | attribs = t.callExpression(
|
819 | helper,
|
820 | [t.arrayExpression(objs)]
|
821 | );
|
822 | }
|
823 | return attribs
|
824 | }
|
825 |
|
826 | function convertAttribute (node) {
|
827 | var value = convertAttributeValue(node.value || t.booleanLiteral(true));
|
828 | if (t.isStringLiteral(value) && !t.isJSXExpressionContainer(node.value)) {
|
829 | value.value = value.value.replace(/\n\s+/g, ' ');
|
830 | }
|
831 | if (t.isValidIdentifier(node.name.name)) {
|
832 | node.name.type = 'Identifier';
|
833 | } else {
|
834 | node.name = t.stringLiteral(node.name.name);
|
835 | }
|
836 | return t.inherits(t.objectProperty(node.name, value), node)
|
837 | }
|
838 |
|
839 | function convertAttributeValue (node) {
|
840 | if (t.isJSXExpressionContainer(node)) {
|
841 | return node.expression
|
842 | } else {
|
843 | return node
|
844 | }
|
845 | }
|
846 | };
|
847 |
|
848 | function _interopDefault$1 (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
849 |
|
850 | var syntaxJsx = _interopDefault$1(lib);
|
851 |
|
852 | var groupEventAttributes = (function (t) {
|
853 | return function (obj, attribute) {
|
854 | if (t.isJSXSpreadAttribute(attribute)) {
|
855 | return obj;
|
856 | }
|
857 |
|
858 | var isNamespaced = t.isJSXNamespacedName(attribute.get('name'));
|
859 | var event = (isNamespaced ? attribute.get('name').get('namespace') : attribute.get('name')).get('name').node;
|
860 | var modifiers = isNamespaced ? new Set(attribute.get('name').get('name').get('name').node.split('-')) : new Set();
|
861 |
|
862 | if (event.indexOf('on') !== 0) {
|
863 | return obj;
|
864 | }
|
865 |
|
866 | var value = attribute.get('value');
|
867 |
|
868 | attribute.remove();
|
869 | if (!t.isJSXExpressionContainer(value)) {
|
870 | return obj;
|
871 | }
|
872 |
|
873 | var expression = value.get('expression').node;
|
874 |
|
875 | var eventName = event.substr(2);
|
876 | if (eventName[0] === '-') {
|
877 | eventName = eventName.substr(1);
|
878 | }
|
879 | eventName = eventName[0].toLowerCase() + eventName.substr(1);
|
880 | if (modifiers.has('capture')) {
|
881 | eventName = '!' + eventName;
|
882 | }
|
883 | if (modifiers.has('once')) {
|
884 | eventName = '~' + eventName;
|
885 | }
|
886 |
|
887 | if (!obj[eventName]) {
|
888 | obj[eventName] = [];
|
889 | }
|
890 |
|
891 | obj[eventName].push({ modifiers, expression, attribute });
|
892 |
|
893 | return obj;
|
894 | };
|
895 | });
|
896 |
|
897 | var aliases = {
|
898 | esc: 27,
|
899 | tab: 9,
|
900 | enter: 13,
|
901 | space: 32,
|
902 | up: 38,
|
903 | left: 37,
|
904 | right: 39,
|
905 | down: 40,
|
906 | delete: [8, 46]
|
907 | };
|
908 |
|
909 | var keyModifiers = ['ctrl', 'shift', 'alt', 'meta'];
|
910 |
|
911 | var keyCodeRE = /^k(\d{1,})$/;
|
912 |
|
913 | var generateBindingBody = (function (t, _ref) {
|
914 | var modifiers = _ref.modifiers,
|
915 | expression = _ref.expression;
|
916 |
|
917 | var callStatement = t.expressionStatement(t.callExpression(expression, [t.identifier('$event')]));
|
918 | var result = [];
|
919 | var conditions = [];
|
920 | var keyConditions = [t.unaryExpression('!', t.binaryExpression('in', t.stringLiteral('button'), t.identifier('$event')))];
|
921 |
|
922 | modifiers.forEach(function (modifier) {
|
923 | if (modifier === 'stop') {
|
924 | result.push(t.expressionStatement(t.callExpression(t.memberExpression(t.identifier('$event'), t.identifier('stopPropagation')), [])));
|
925 | } else if (modifier === 'prevent') {
|
926 | result.push(t.expressionStatement(t.callExpression(t.memberExpression(t.identifier('$event'), t.identifier('preventDefault')), [])));
|
927 | } else if (modifier === 'self') {
|
928 | conditions.push(t.binaryExpression('!==', t.memberExpression(t.identifier('$event'), t.identifier('target')), t.memberExpression(t.identifier('$event'), t.identifier('currentTarget'))));
|
929 | } else if (keyModifiers.includes(modifier)) {
|
930 | conditions.push(t.unaryExpression('!', t.memberExpression(t.identifier('$event'), t.identifier(`${modifier}Key`))));
|
931 | } else if (modifier === 'bare') {
|
932 | conditions.push(keyModifiers.filter(function (keyModifier) {
|
933 | return !modifiers.has(keyModifier);
|
934 | }).map(function (keyModifier) {
|
935 | return t.memberExpression(t.identifier('$event'), t.identifier(`${keyModifier}Key`));
|
936 | }).reduce(function (leftCondition, rightCondition) {
|
937 | return t.logicalExpression('||', leftCondition, rightCondition);
|
938 | }));
|
939 | } else if (aliases[modifier]) {
|
940 | keyConditions.push(t.callExpression(t.memberExpression(t.thisExpression(), t.identifier('_k')), [t.memberExpression(t.identifier('$event'), t.identifier('keyCode')), t.stringLiteral(modifier), Array.isArray(aliases[modifier]) ? t.arrayExpression(aliases[modifier].map(function (el) {
|
941 | return t.numericLiteral(el);
|
942 | })) : t.numericLiteral(aliases[modifier])]));
|
943 | } else if (modifier.match(keyCodeRE)) {
|
944 | var keyCode = +modifier.match(keyCodeRE)[1];
|
945 | keyConditions.push(t.binaryExpression('!==', t.memberExpression(t.identifier('$event'), t.identifier('keyCode')), t.numericLiteral(keyCode)));
|
946 | }
|
947 | });
|
948 |
|
949 | if (keyConditions.length > 1) {
|
950 | conditions.push(keyConditions.reduce(function (leftCondition, rightCondition) {
|
951 | return t.logicalExpression('&&', leftCondition, rightCondition);
|
952 | }));
|
953 | }
|
954 |
|
955 | if (conditions.length > 0) {
|
956 | result.push(t.ifStatement(conditions.reduce(function (leftCondition, rightCondition) {
|
957 | return t.logicalExpression('||', leftCondition, rightCondition);
|
958 | }), t.returnStatement(t.nullLiteral())));
|
959 | }
|
960 |
|
961 | result.push(callStatement);
|
962 | return result;
|
963 | });
|
964 |
|
965 | var generateBindingsList = (function (t, bindings) {
|
966 | return bindings.map(function (binding) {
|
967 | return t.arrowFunctionExpression([t.identifier('$event')], t.blockStatement(generateBindingBody(t, binding)));
|
968 | });
|
969 | });
|
970 |
|
971 | var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
972 |
|
973 | var generateSpreadEvent = (function (t) {
|
974 | return function (_ref) {
|
975 | var _ref2 = _slicedToArray(_ref, 2),
|
976 | event = _ref2[0],
|
977 | bindings = _ref2[1];
|
978 |
|
979 | var callbacks = generateBindingsList(t, bindings);
|
980 | return t.objectProperty(t.stringLiteral(event), callbacks.length === 1 ? callbacks[0] : t.arrayExpression(callbacks));
|
981 | };
|
982 | });
|
983 |
|
984 | var index$1 = (function (_ref) {
|
985 | var t = _ref.types;
|
986 | return {
|
987 | inherits: syntaxJsx,
|
988 | visitor: {
|
989 | Program(path) {
|
990 | path.traverse({
|
991 | JSXOpeningElement(path) {
|
992 | var attributes = path.get('attributes');
|
993 | var events = Object.entries(attributes.reduce(groupEventAttributes(t), {}));
|
994 | if (events.length > 0) {
|
995 | path.pushContainer('attributes', t.jSXSpreadAttribute(t.objectExpression([t.objectProperty(t.identifier('on'), t.objectExpression(events.map(generateSpreadEvent(t))))])));
|
996 | }
|
997 | }
|
998 | });
|
999 | }
|
1000 | }
|
1001 | };
|
1002 | });
|
1003 |
|
1004 | var bundle = index$1;
|
1005 |
|
1006 | var htmlTags = [
|
1007 | "a",
|
1008 | "abbr",
|
1009 | "address",
|
1010 | "area",
|
1011 | "article",
|
1012 | "aside",
|
1013 | "audio",
|
1014 | "b",
|
1015 | "base",
|
1016 | "bdi",
|
1017 | "bdo",
|
1018 | "blockquote",
|
1019 | "body",
|
1020 | "br",
|
1021 | "button",
|
1022 | "canvas",
|
1023 | "caption",
|
1024 | "cite",
|
1025 | "code",
|
1026 | "col",
|
1027 | "colgroup",
|
1028 | "data",
|
1029 | "datalist",
|
1030 | "dd",
|
1031 | "del",
|
1032 | "details",
|
1033 | "dfn",
|
1034 | "dialog",
|
1035 | "div",
|
1036 | "dl",
|
1037 | "dt",
|
1038 | "em",
|
1039 | "embed",
|
1040 | "fieldset",
|
1041 | "figcaption",
|
1042 | "figure",
|
1043 | "footer",
|
1044 | "form",
|
1045 | "h1",
|
1046 | "h2",
|
1047 | "h3",
|
1048 | "h4",
|
1049 | "h5",
|
1050 | "h6",
|
1051 | "head",
|
1052 | "header",
|
1053 | "hgroup",
|
1054 | "hr",
|
1055 | "html",
|
1056 | "i",
|
1057 | "iframe",
|
1058 | "img",
|
1059 | "input",
|
1060 | "ins",
|
1061 | "kbd",
|
1062 | "keygen",
|
1063 | "label",
|
1064 | "legend",
|
1065 | "li",
|
1066 | "link",
|
1067 | "main",
|
1068 | "map",
|
1069 | "mark",
|
1070 | "math",
|
1071 | "menu",
|
1072 | "menuitem",
|
1073 | "meta",
|
1074 | "meter",
|
1075 | "nav",
|
1076 | "noscript",
|
1077 | "object",
|
1078 | "ol",
|
1079 | "optgroup",
|
1080 | "option",
|
1081 | "output",
|
1082 | "p",
|
1083 | "param",
|
1084 | "picture",
|
1085 | "pre",
|
1086 | "progress",
|
1087 | "q",
|
1088 | "rb",
|
1089 | "rp",
|
1090 | "rt",
|
1091 | "rtc",
|
1092 | "ruby",
|
1093 | "s",
|
1094 | "samp",
|
1095 | "script",
|
1096 | "section",
|
1097 | "select",
|
1098 | "slot",
|
1099 | "small",
|
1100 | "source",
|
1101 | "span",
|
1102 | "strong",
|
1103 | "style",
|
1104 | "sub",
|
1105 | "summary",
|
1106 | "sup",
|
1107 | "svg",
|
1108 | "table",
|
1109 | "tbody",
|
1110 | "td",
|
1111 | "template",
|
1112 | "textarea",
|
1113 | "tfoot",
|
1114 | "th",
|
1115 | "thead",
|
1116 | "time",
|
1117 | "title",
|
1118 | "tr",
|
1119 | "track",
|
1120 | "u",
|
1121 | "ul",
|
1122 | "var",
|
1123 | "video",
|
1124 | "wbr"
|
1125 | ]
|
1126 | ;
|
1127 |
|
1128 | var htmlTags$1 = Object.freeze({
|
1129 | default: htmlTags
|
1130 | });
|
1131 |
|
1132 | var require$$0 = ( htmlTags$1 && htmlTags ) || htmlTags$1;
|
1133 |
|
1134 | var htmlTags$2 = require$$0;
|
1135 |
|
1136 | var svgTags = [
|
1137 | "a",
|
1138 | "altGlyph",
|
1139 | "altGlyphDef",
|
1140 | "altGlyphItem",
|
1141 | "animate",
|
1142 | "animateColor",
|
1143 | "animateMotion",
|
1144 | "animateTransform",
|
1145 | "circle",
|
1146 | "clipPath",
|
1147 | "color-profile",
|
1148 | "cursor",
|
1149 | "defs",
|
1150 | "desc",
|
1151 | "ellipse",
|
1152 | "feBlend",
|
1153 | "feColorMatrix",
|
1154 | "feComponentTransfer",
|
1155 | "feComposite",
|
1156 | "feConvolveMatrix",
|
1157 | "feDiffuseLighting",
|
1158 | "feDisplacementMap",
|
1159 | "feDistantLight",
|
1160 | "feFlood",
|
1161 | "feFuncA",
|
1162 | "feFuncB",
|
1163 | "feFuncG",
|
1164 | "feFuncR",
|
1165 | "feGaussianBlur",
|
1166 | "feImage",
|
1167 | "feMerge",
|
1168 | "feMergeNode",
|
1169 | "feMorphology",
|
1170 | "feOffset",
|
1171 | "fePointLight",
|
1172 | "feSpecularLighting",
|
1173 | "feSpotLight",
|
1174 | "feTile",
|
1175 | "feTurbulence",
|
1176 | "filter",
|
1177 | "font",
|
1178 | "font-face",
|
1179 | "font-face-format",
|
1180 | "font-face-name",
|
1181 | "font-face-src",
|
1182 | "font-face-uri",
|
1183 | "foreignObject",
|
1184 | "g",
|
1185 | "glyph",
|
1186 | "glyphRef",
|
1187 | "hkern",
|
1188 | "image",
|
1189 | "line",
|
1190 | "linearGradient",
|
1191 | "marker",
|
1192 | "mask",
|
1193 | "metadata",
|
1194 | "missing-glyph",
|
1195 | "mpath",
|
1196 | "path",
|
1197 | "pattern",
|
1198 | "polygon",
|
1199 | "polyline",
|
1200 | "radialGradient",
|
1201 | "rect",
|
1202 | "script",
|
1203 | "set",
|
1204 | "stop",
|
1205 | "style",
|
1206 | "svg",
|
1207 | "switch",
|
1208 | "symbol",
|
1209 | "text",
|
1210 | "textPath",
|
1211 | "title",
|
1212 | "tref",
|
1213 | "tspan",
|
1214 | "use",
|
1215 | "view",
|
1216 | "vkern"
|
1217 | ];
|
1218 |
|
1219 | var svgTags$1 = Object.freeze({
|
1220 | default: svgTags
|
1221 | });
|
1222 |
|
1223 | var require$$0$1 = ( svgTags$1 && svgTags ) || svgTags$1;
|
1224 |
|
1225 | var lib$1 = require$$0$1;
|
1226 |
|
1227 | var allowedModifiers = ['trim', 'number', 'lazy'];
|
1228 | var RANGE_TOKEN = '__r';
|
1229 | var CHECKBOX_RADIO_TOKEN = '__c';
|
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 | var isReservedTag = function isReservedTag(tag) {
|
1236 | return ~htmlTags$2.indexOf(tag) || ~lib$1.indexOf(tag)
|
1237 | };
|
1238 |
|
1239 | var getExpression = function getExpression(t, path) {
|
1240 | return t.isStringLiteral(path.node.value) ? path.node.value : path.node.value.expression
|
1241 | };
|
1242 |
|
1243 | var genValue = function genValue(t, model) {
|
1244 | return t.jSXAttribute(t.jSXIdentifier('domPropsValue'), t.jSXExpressionContainer(model))
|
1245 | };
|
1246 |
|
1247 | var genAssignmentCode = function genAssignmentCode(t, model, assignment) {
|
1248 | if (model.computed) {
|
1249 | var object = model.object,
|
1250 | property = model.property;
|
1251 |
|
1252 | return t.ExpressionStatement(
|
1253 | t.CallExpression(t.MemberExpression(t.ThisExpression(), t.Identifier('$set')), [object, property, assignment])
|
1254 | )
|
1255 | } else {
|
1256 | return t.ExpressionStatement(t.AssignmentExpression('=', model, assignment))
|
1257 | }
|
1258 | };
|
1259 |
|
1260 | var genListener = function genListener(t, event, body) {
|
1261 | return t.jSXAttribute(
|
1262 | t.jSXIdentifier('on' + event),
|
1263 | t.jSXExpressionContainer(t.ArrowFunctionExpression([t.Identifier('$event')], t.BlockStatement(body)))
|
1264 | )
|
1265 | };
|
1266 |
|
1267 | var genSelectModel = function genSelectModel(t, modelAttribute, model, modifier) {
|
1268 | if (modifier && modifier !== 'number') {
|
1269 | throw modelAttribute.get('name').get('name').buildCodeFrameError('you can only use number modifier with <select/ >')
|
1270 | }
|
1271 |
|
1272 | var number = modifier === 'number';
|
1273 |
|
1274 | var valueGetter = t.ConditionalExpression(
|
1275 | t.BinaryExpression('in', t.StringLiteral('_value'), t.Identifier('o')),
|
1276 | t.MemberExpression(t.Identifier('o'), t.Identifier('_value')),
|
1277 | t.MemberExpression(t.Identifier('o'), t.Identifier('value'))
|
1278 | );
|
1279 |
|
1280 | var selectedVal = t.CallExpression(
|
1281 | t.MemberExpression(
|
1282 | t.CallExpression(
|
1283 | t.MemberExpression(
|
1284 | t.MemberExpression(
|
1285 | t.MemberExpression(t.Identifier('Array'), t.Identifier('prototype')),
|
1286 | t.Identifier('filter')
|
1287 | ),
|
1288 | t.Identifier('call')
|
1289 | ),
|
1290 | [
|
1291 | t.MemberExpression(
|
1292 | t.MemberExpression(t.Identifier('$event'), t.Identifier('target')),
|
1293 | t.Identifier('options')
|
1294 | ),
|
1295 | t.ArrowFunctionExpression(
|
1296 | [t.Identifier('o')],
|
1297 | t.MemberExpression(t.Identifier('o'), t.Identifier('selected'))
|
1298 | )
|
1299 | ]
|
1300 | ),
|
1301 | t.Identifier('map')
|
1302 | ),
|
1303 | [
|
1304 | t.ArrowFunctionExpression(
|
1305 | [t.Identifier('o')],
|
1306 | number
|
1307 | ? t.CallExpression(t.MemberExpression(t.ThisExpression(), t.Identifier('_n')), [valueGetter])
|
1308 | : valueGetter
|
1309 | )
|
1310 | ]
|
1311 | );
|
1312 |
|
1313 | var assignment = t.ConditionalExpression(
|
1314 | t.MemberExpression(t.MemberExpression(t.Identifier('$event'), t.Identifier('target')), t.Identifier('multiple')),
|
1315 | t.Identifier('$$selectedVal'),
|
1316 | t.MemberExpression(t.Identifier('$$selectedVal'), t.NumericLiteral(0), true)
|
1317 | );
|
1318 |
|
1319 | var code = t.VariableDeclaration('const', [t.VariableDeclarator(t.Identifier('$$selectedVal'), selectedVal)]);
|
1320 |
|
1321 | return [genValue(t, model), genListener(t, 'Change', [code, genAssignmentCode(t, model, assignment)])]
|
1322 | };
|
1323 |
|
1324 | var genCheckboxModel = function genCheckboxModel(t, modelAttribute, model, modifier, path) {
|
1325 | if (modifier && modifier !== 'number') {
|
1326 | throw modelAttribute
|
1327 | .get('name')
|
1328 | .get('name')
|
1329 | .buildCodeFrameError('you can only use number modifier with input[type="checkbox"]')
|
1330 | }
|
1331 |
|
1332 | var value = t.NullLiteral();
|
1333 | var trueValue = t.BooleanLiteral(true);
|
1334 | var falseValue = t.BooleanLiteral(false);
|
1335 |
|
1336 | path.get('attributes').forEach(function(path) {
|
1337 | if (!path.node.name) {
|
1338 | return
|
1339 | }
|
1340 |
|
1341 | if (path.node.name.name === 'value') {
|
1342 | value = getExpression(t, path);
|
1343 | path.remove();
|
1344 | } else if (path.node.name.name === 'true-value') {
|
1345 | trueValue = getExpression(t, path);
|
1346 | path.remove();
|
1347 | } else if (path.node.name.name === 'false-value') {
|
1348 | falseValue = getExpression(t, path);
|
1349 | path.remove();
|
1350 | }
|
1351 | });
|
1352 |
|
1353 | var checkedProp = t.JSXAttribute(
|
1354 | t.JSXIdentifier('checked'),
|
1355 | t.JSXExpressionContainer(
|
1356 | t.ConditionalExpression(
|
1357 | t.CallExpression(t.MemberExpression(t.Identifier('Array'), t.Identifier('isArray')), [model]),
|
1358 | t.BinaryExpression(
|
1359 | '>',
|
1360 | t.CallExpression(t.MemberExpression(t.ThisExpression(), t.Identifier('_i')), [model, value]),
|
1361 | t.UnaryExpression('-', t.NumericLiteral(1))
|
1362 | ),
|
1363 | t.isBooleanLiteral(trueValue) && trueValue.value === true
|
1364 | ? model
|
1365 | : t.CallExpression(t.MemberExpression(t.ThisExpression(), t.Identifier('_q')), [model, trueValue])
|
1366 | )
|
1367 | )
|
1368 | );
|
1369 |
|
1370 | var handlerProp = t.JSXAttribute(
|
1371 | t.JSXIdentifier('on' + CHECKBOX_RADIO_TOKEN),
|
1372 | t.JSXExpressionContainer(
|
1373 | t.ArrowFunctionExpression(
|
1374 | [t.Identifier('$event')],
|
1375 | t.BlockStatement([
|
1376 | t.VariableDeclaration('const', [
|
1377 | t.VariableDeclarator(t.Identifier('$$a'), model),
|
1378 | t.VariableDeclarator(
|
1379 | t.Identifier('$$el'),
|
1380 | t.MemberExpression(t.Identifier('$event'), t.Identifier('target'))
|
1381 | ),
|
1382 | t.VariableDeclarator(
|
1383 | t.Identifier('$$c'),
|
1384 | t.ConditionalExpression(
|
1385 | t.MemberExpression(t.Identifier('$$el'), t.Identifier('checked')),
|
1386 | trueValue,
|
1387 | falseValue
|
1388 | )
|
1389 | )
|
1390 | ]),
|
1391 | t.IfStatement(
|
1392 | t.CallExpression(t.MemberExpression(t.Identifier('Array'), t.Identifier('isArray')), [t.Identifier('$$a')]),
|
1393 | t.BlockStatement([
|
1394 | t.VariableDeclaration('const', [
|
1395 | t.VariableDeclarator(
|
1396 | t.Identifier('$$v'),
|
1397 | modifier === 'number'
|
1398 | ? t.CallExpression(t.MemberExpression(t.ThisExpression(), t.Identifier('_n')), [value])
|
1399 | : value
|
1400 | ),
|
1401 | t.VariableDeclarator(
|
1402 | t.Identifier('$$i'),
|
1403 | t.CallExpression(t.MemberExpression(t.ThisExpression(), t.Identifier('_i')), [
|
1404 | t.Identifier('$$a'),
|
1405 | t.Identifier('$$v')
|
1406 | ])
|
1407 | )
|
1408 | ]),
|
1409 | t.IfStatement(
|
1410 | t.MemberExpression(t.Identifier('$$el'), t.Identifier('checked')),
|
1411 | t.BlockStatement([
|
1412 | t.ExpressionStatement(
|
1413 | t.LogicalExpression(
|
1414 | '&&',
|
1415 | t.BinaryExpression('<', t.Identifier('$$i'), t.NumericLiteral(0)),
|
1416 | t.AssignmentExpression(
|
1417 | '=',
|
1418 | model,
|
1419 | t.CallExpression(t.MemberExpression(t.Identifier('$$a'), t.Identifier('concat')), [
|
1420 | t.Identifier('$$v')
|
1421 | ])
|
1422 | )
|
1423 | )
|
1424 | )
|
1425 | ]),
|
1426 | t.BlockStatement([
|
1427 | t.ExpressionStatement(
|
1428 | t.LogicalExpression(
|
1429 | '&&',
|
1430 | t.BinaryExpression('>', t.Identifier('$$i'), t.UnaryExpression('-', t.NumericLiteral(1))),
|
1431 | t.AssignmentExpression(
|
1432 | '=',
|
1433 | model,
|
1434 | t.CallExpression(
|
1435 | t.MemberExpression(
|
1436 | t.CallExpression(t.MemberExpression(t.Identifier('$$a'), t.Identifier('slice')), [
|
1437 | t.NumericLiteral(0),
|
1438 | t.Identifier('$$i')
|
1439 | ]),
|
1440 | t.Identifier('concat')
|
1441 | ),
|
1442 | [
|
1443 | t.CallExpression(t.MemberExpression(t.Identifier('$$a'), t.Identifier('slice')), [
|
1444 | t.BinaryExpression('+', t.Identifier('$$i'), t.NumericLiteral(1))
|
1445 | ])
|
1446 | ]
|
1447 | )
|
1448 | )
|
1449 | )
|
1450 | )
|
1451 | ])
|
1452 | )
|
1453 | ]),
|
1454 | t.BlockStatement([genAssignmentCode(t, model, t.Identifier('$$c'))])
|
1455 | )
|
1456 | ])
|
1457 | )
|
1458 | )
|
1459 | );
|
1460 |
|
1461 | return [checkedProp, handlerProp]
|
1462 | };
|
1463 |
|
1464 | var genRadioModel = function genRadioModel(t, modelAttribute, model, modifier, path) {
|
1465 | if (modifier && modifier !== 'number') {
|
1466 | throw modelAttribute
|
1467 | .get('name')
|
1468 | .get('name')
|
1469 | .buildCodeFrameError('you can only use number modifier with input[type="radio"]')
|
1470 | }
|
1471 |
|
1472 | var value = t.BooleanLiteral(true);
|
1473 |
|
1474 | path.get('attributes').forEach(function(path) {
|
1475 | if (!path.node.name) {
|
1476 | return
|
1477 | }
|
1478 |
|
1479 | if (path.node.name.name === 'value') {
|
1480 | value = getExpression(t, path);
|
1481 | path.remove();
|
1482 | }
|
1483 | });
|
1484 |
|
1485 | var checkedProp = t.JSXAttribute(
|
1486 | t.JSXIdentifier('checked'),
|
1487 | t.JSXExpressionContainer(
|
1488 | t.CallExpression(t.MemberExpression(t.ThisExpression(), t.Identifier('_q')), [model, value])
|
1489 | )
|
1490 | );
|
1491 |
|
1492 | var handlerProp = t.JSXAttribute(
|
1493 | t.JSXIdentifier('on' + CHECKBOX_RADIO_TOKEN),
|
1494 | t.JSXExpressionContainer(
|
1495 | t.ArrowFunctionExpression(
|
1496 | [t.Identifier('$event')],
|
1497 | t.BlockStatement([
|
1498 | genAssignmentCode(
|
1499 | t,
|
1500 | model,
|
1501 | modifier === 'number'
|
1502 | ? t.CallExpression(t.MemberExpression(t.ThisExpression(), t.Identifier('_n')), [value])
|
1503 | : value
|
1504 | )
|
1505 | ])
|
1506 | )
|
1507 | )
|
1508 | );
|
1509 |
|
1510 | return [checkedProp, handlerProp]
|
1511 | };
|
1512 |
|
1513 | var genDefaultModel = function genDefaultModel(t, modelAttribute, model, modifier, path, type) {
|
1514 | var needCompositionGuard = modifier !== 'lazy' && type !== 'range';
|
1515 |
|
1516 | var event = modifier === 'lazy' ? 'Change' : type === 'range' ? RANGE_TOKEN : 'Input';
|
1517 |
|
1518 | var valueExpression = t.MemberExpression(
|
1519 | t.MemberExpression(t.Identifier('$event'), t.Identifier('target')),
|
1520 | t.Identifier('value')
|
1521 | );
|
1522 |
|
1523 | if (modifier === 'trim') {
|
1524 | valueExpression = t.CallExpression(t.MemberExpression(valueExpression, t.Identifier('trim')), []);
|
1525 | } else if (modifier === 'number') {
|
1526 | valueExpression = t.CallExpression(t.MemberExpression(t.ThisExpression(), t.Identifier('_n')), [valueExpression]);
|
1527 | }
|
1528 |
|
1529 | var code = genAssignmentCode(t, model, valueExpression);
|
1530 |
|
1531 | if (needCompositionGuard) {
|
1532 | code = t.BlockStatement([
|
1533 | t.IfStatement(
|
1534 | t.MemberExpression(
|
1535 | t.MemberExpression(t.Identifier('$event'), t.Identifier('target')),
|
1536 | t.Identifier('composing')
|
1537 | ),
|
1538 | t.ReturnStatement(null)
|
1539 | ),
|
1540 | code
|
1541 | ]);
|
1542 | } else {
|
1543 | code = t.BlockStatement([code]);
|
1544 | }
|
1545 |
|
1546 | var valueProp = t.JSXAttribute(t.jSXIdentifier('domPropsValue'), t.JSXExpressionContainer(model));
|
1547 |
|
1548 | var handlerProp = t.JSXAttribute(
|
1549 | t.JSXIdentifier('on' + event),
|
1550 | t.JSXExpressionContainer(t.ArrowFunctionExpression([t.Identifier('$event')], code))
|
1551 | );
|
1552 |
|
1553 | var props = [valueProp, handlerProp];
|
1554 |
|
1555 | if (modifier === 'trim' || modifier === 'number') {
|
1556 | props.push(
|
1557 | t.JSXAttribute(
|
1558 | t.JSXIdentifier('onBlur'),
|
1559 | t.JSXExpressionContainer(
|
1560 | t.ArrowFunctionExpression(
|
1561 | [],
|
1562 | t.CallExpression(t.MemberExpression(t.ThisExpression(), t.Identifier('$forceUpdate')), [])
|
1563 | )
|
1564 | )
|
1565 | )
|
1566 | );
|
1567 | }
|
1568 |
|
1569 | return props
|
1570 | };
|
1571 |
|
1572 | var genComponentModel = function genComponentModel(t, modelAttribute, model, modifier, path, type) {
|
1573 | var baseValueExpression = t.Identifier('$$v');
|
1574 | var valueExpression = baseValueExpression;
|
1575 |
|
1576 | if (modifier === 'trim') {
|
1577 | valueExpression = t.CallExpression(t.MemberExpression(valueExpression, t.Identifier('trim')), []);
|
1578 | } else if (modifier === 'number') {
|
1579 | valueExpression = t.CallExpression(t.MemberExpression(t.ThisExpression(), t.Identifier('_n')), [valueExpression]);
|
1580 | }
|
1581 |
|
1582 | var assignment = genAssignmentCode(t, model, valueExpression);
|
1583 |
|
1584 | var valueProp = t.JSXAttribute(t.jSXIdentifier('domPropsValue'), t.JSXExpressionContainer(model));
|
1585 |
|
1586 | var handlerProp = t.JSXAttribute(
|
1587 | t.JSXIdentifier('onChange'),
|
1588 | t.JSXExpressionContainer(t.ArrowFunctionExpression([baseValueExpression], t.BlockStatement([assignment])))
|
1589 | );
|
1590 |
|
1591 | return [valueProp, handlerProp]
|
1592 | };
|
1593 |
|
1594 | var babelPluginJsxVModel = function(babel) {
|
1595 | var t = babel.types;
|
1596 |
|
1597 | return {
|
1598 | inherits: lib,
|
1599 | visitor: {
|
1600 | JSXOpeningElement: function JSXOpeningElement(path) {
|
1601 | var model = null;
|
1602 | var modifier = null;
|
1603 | var modelAttribute = null;
|
1604 | var type = null;
|
1605 | var typePath = null;
|
1606 |
|
1607 | path.get('attributes').forEach(function(path) {
|
1608 | if (!path.node.name) {
|
1609 | return
|
1610 | }
|
1611 |
|
1612 | if (path.node.name.name === 'type') {
|
1613 | type = path.node.value.value;
|
1614 | typePath = path.get('value');
|
1615 | }
|
1616 |
|
1617 | if (t.isJSXIdentifier(path.node.name)) {
|
1618 | if (path.node.name.name !== 'v-model') {
|
1619 | return
|
1620 | }
|
1621 | } else if (t.isJSXNamespacedName(path.node.name)) {
|
1622 | if (path.node.name.namespace.name !== 'v-model') {
|
1623 | return
|
1624 | }
|
1625 |
|
1626 | if (!~allowedModifiers.indexOf(path.node.name.name.name)) {
|
1627 | throw path
|
1628 | .get('name')
|
1629 | .get('name')
|
1630 | .buildCodeFrameError('v-model does not support "' + path.node.name.name.name + '" modifier')
|
1631 | }
|
1632 |
|
1633 | modifier = path.node.name.name.name;
|
1634 | } else {
|
1635 | return
|
1636 | }
|
1637 |
|
1638 | modelAttribute = path;
|
1639 |
|
1640 | if (model) {
|
1641 | throw path.buildCodeFrameError('you can not have multiple v-model directives on a single element')
|
1642 | }
|
1643 |
|
1644 | if (!t.isJSXExpressionContainer(path.node.value)) {
|
1645 | throw path.get('value').buildCodeFrameError('you should use JSX Expression with v-model')
|
1646 | }
|
1647 |
|
1648 | if (!t.isMemberExpression(path.node.value.expression)) {
|
1649 | throw path
|
1650 | .get('value')
|
1651 | .get('expression')
|
1652 | .buildCodeFrameError('you should use MemberExpression with v-model')
|
1653 | }
|
1654 |
|
1655 | model = path.node.value.expression;
|
1656 | });
|
1657 |
|
1658 | if (!model) {
|
1659 | return
|
1660 | }
|
1661 |
|
1662 | var tag = path.node.name.name;
|
1663 |
|
1664 | if (tag === 'input' && typePath && t.isJSXExpressionContainer(typePath.node)) {
|
1665 | throw typePath.buildCodeFrameError('you can not use dynamic type with v-model')
|
1666 | }
|
1667 | if (tag === 'input' && type === 'file') {
|
1668 | throw typePath.buildCodeFrameError('you can not use "file" type with v-model')
|
1669 | }
|
1670 |
|
1671 | var replacement = null;
|
1672 |
|
1673 | if (tag === 'select') {
|
1674 | replacement = genSelectModel(t, modelAttribute, model, modifier);
|
1675 | } else if (tag === 'input' && type === 'checkbox') {
|
1676 | replacement = genCheckboxModel(t, modelAttribute, model, modifier, path);
|
1677 | } else if (tag === 'input' && type === 'radio') {
|
1678 | replacement = genRadioModel(t, modelAttribute, model, modifier, path);
|
1679 | } else if (tag === 'input' || tag === 'textarea') {
|
1680 | replacement = genDefaultModel(t, modelAttribute, model, modifier, path, type);
|
1681 | } else if (!isReservedTag(tag)) {
|
1682 | replacement = genComponentModel(t, modelAttribute, model, modifier, path);
|
1683 | } else {
|
1684 | throw path.buildCodeFrameError('you can not use "' + tag + '" with v-model')
|
1685 | }
|
1686 |
|
1687 | modelAttribute.replaceWithMultiple([
|
1688 | ...replacement,
|
1689 | t.JSXSpreadAttribute(
|
1690 | t.ObjectExpression([
|
1691 | t.ObjectProperty(
|
1692 | t.Identifier('directives'),
|
1693 | t.ArrayExpression([
|
1694 | t.ObjectExpression([
|
1695 | t.ObjectProperty(t.Identifier('name'), t.StringLiteral('model')),
|
1696 | t.ObjectProperty(t.Identifier('value'), model)
|
1697 | ])
|
1698 | ])
|
1699 | )
|
1700 | ])
|
1701 | )
|
1702 | ]);
|
1703 | }
|
1704 | }
|
1705 | }
|
1706 | };
|
1707 |
|
1708 | var index$2 = (function (_) {
|
1709 | var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
1710 | _ref$eventModifiers = _ref.eventModifiers,
|
1711 | eventModifiers = _ref$eventModifiers === void 0 ? true : _ref$eventModifiers,
|
1712 | _ref$vModel = _ref.vModel,
|
1713 | vModel = _ref$vModel === void 0 ? true : _ref$vModel;
|
1714 |
|
1715 | return {
|
1716 | plugins: [eventModifiers && bundle, vModel && babelPluginJsxVModel, babelPluginTransformVueJsx].filter(Boolean)
|
1717 | };
|
1718 | });
|
1719 |
|
1720 | return index$2;
|
1721 |
|
1722 | })));
|