babel-schmooze-sprockets 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/console +14 -0
- data/bin/export-external-helpers +3 -0
- data/bin/setup +6 -0
- data/bin/update-npm-deps +8 -0
- data/examples/myapp/Gemfile +4 -5
- data/examples/myapp/Gemfile.lock +69 -93
- data/examples/myapp/app/assets/javascripts/code/hello.es6 +5 -1
- data/examples/myapp/app/views/layouts/application.html.erb +1 -0
- data/examples/myapp/app/views/site/home.html.erb +0 -1
- data/lib/babel-schmooze-sprockets/babel_processor.rb +6 -4
- data/lib/babel-schmooze-sprockets/engine.rb +1 -4
- data/lib/babel-schmooze-sprockets/version.rb +1 -1
- data/node_modules/amdefine/package.json +8 -1
- data/node_modules/babel-core/node_modules/babel-runtime/package.json +9 -5
- data/node_modules/babel-core/node_modules/babel-traverse/.npmignore +3 -0
- data/node_modules/babel-core/node_modules/babel-traverse/README.md +1 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/cache.js +20 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/context.js +219 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/hub.js +19 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/index.js +250 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/path/ancestry.js +317 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/path/comments.js +55 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/path/context.js +297 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/path/conversion.js +48 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/path/evaluation.js +406 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/path/family.js +168 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/path/index.js +245 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/path/inference/index.js +151 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/path/inference/inferer-reference.js +225 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/path/inference/inferers.js +198 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/path/introspection.js +518 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/path/lib/hoister.js +166 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/path/lib/removal-hooks.js +64 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/path/lib/virtual-types.js +141 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/path/modification.js +293 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/path/removal.js +72 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/path/replacement.js +302 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/scope/binding.js +105 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/scope/index.js +1222 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/scope/lib/renamer.js +154 -0
- data/node_modules/babel-core/node_modules/babel-traverse/lib/visitors.js +360 -0
- data/node_modules/babel-core/node_modules/babel-traverse/package.json +107 -0
- data/node_modules/babel-core/node_modules/core-js/package.json +20 -2
- data/node_modules/babel-core/package.json +31 -24
- data/node_modules/babel-generator/lib/buffer.js +69 -70
- data/node_modules/babel-generator/lib/generators/base.js +16 -12
- data/node_modules/babel-generator/lib/generators/classes.js +28 -19
- data/node_modules/babel-generator/lib/generators/expressions.js +76 -99
- data/node_modules/babel-generator/lib/generators/flow.js +178 -119
- data/node_modules/babel-generator/lib/generators/jsx.js +38 -29
- data/node_modules/babel-generator/lib/generators/methods.js +34 -25
- data/node_modules/babel-generator/lib/generators/modules.js +67 -40
- data/node_modules/babel-generator/lib/generators/statements.js +93 -76
- data/node_modules/babel-generator/lib/generators/template-literals.js +12 -11
- data/node_modules/babel-generator/lib/generators/types.js +56 -49
- data/node_modules/babel-generator/lib/index.js +52 -39
- data/node_modules/babel-generator/lib/node/index.js +12 -18
- data/node_modules/babel-generator/lib/node/parentheses.js +23 -27
- data/node_modules/babel-generator/lib/node/whitespace.js +20 -26
- data/node_modules/babel-generator/lib/position.js +5 -5
- data/node_modules/babel-generator/lib/printer.js +52 -81
- data/node_modules/babel-generator/lib/source-map.js +9 -11
- data/node_modules/babel-generator/lib/whitespace.js +13 -13
- data/node_modules/babel-generator/node_modules/babel-runtime/package.json +19 -6
- data/node_modules/babel-generator/node_modules/babel-types/.npmignore +3 -0
- data/node_modules/babel-generator/node_modules/babel-types/README.md +1141 -0
- data/node_modules/babel-generator/node_modules/babel-types/lib/constants.js +40 -0
- data/node_modules/babel-generator/node_modules/babel-types/lib/converters.js +378 -0
- data/node_modules/babel-generator/node_modules/babel-types/lib/definitions/core.js +704 -0
- data/node_modules/babel-generator/node_modules/babel-types/lib/definitions/es2015.js +354 -0
- data/node_modules/babel-generator/node_modules/babel-types/lib/definitions/experimental.js +85 -0
- data/node_modules/babel-generator/node_modules/babel-types/lib/definitions/flow.js +319 -0
- data/node_modules/babel-generator/node_modules/babel-types/lib/definitions/index.js +247 -0
- data/node_modules/babel-generator/node_modules/babel-types/lib/definitions/init.js +15 -0
- data/node_modules/babel-generator/node_modules/babel-types/lib/definitions/jsx.js +137 -0
- data/node_modules/babel-generator/node_modules/babel-types/lib/definitions/misc.js +21 -0
- data/node_modules/babel-generator/node_modules/babel-types/lib/flow.js +129 -0
- data/node_modules/babel-generator/node_modules/babel-types/lib/index.js +848 -0
- data/node_modules/babel-generator/node_modules/babel-types/lib/react.js +83 -0
- data/node_modules/babel-generator/node_modules/babel-types/lib/retrievers.js +123 -0
- data/node_modules/babel-generator/node_modules/babel-types/lib/validators.js +276 -0
- data/node_modules/babel-generator/node_modules/babel-types/package.json +103 -0
- data/node_modules/babel-generator/node_modules/core-js/package.json +10 -5
- data/node_modules/babel-generator/package.json +19 -16
- data/node_modules/babel-helpers/node_modules/babel-runtime/package.json +19 -3
- data/node_modules/babel-helpers/node_modules/core-js/package.json +20 -4
- data/node_modules/babel-helpers/package.json +8 -1
- data/node_modules/babel-register/node_modules/babel-runtime/package.json +19 -3
- data/node_modules/babel-register/node_modules/core-js/package.json +20 -4
- data/node_modules/babel-register/package.json +8 -1
- data/node_modules/balanced-match/package.json +8 -1
- data/node_modules/brace-expansion/package.json +19 -12
- data/node_modules/concat-map/package.json +9 -2
- data/node_modules/convert-source-map/package.json +8 -1
- data/node_modules/detect-indent/package.json +8 -1
- data/node_modules/get-stdin/package.json +8 -1
- data/node_modules/home-or-tmp/package.json +9 -2
- data/node_modules/is-finite/package.json +8 -2
- data/node_modules/json5/package.json +8 -1
- data/node_modules/minimatch/README.md +2 -9
- data/node_modules/minimatch/minimatch.js +15 -3
- data/node_modules/minimatch/package.json +29 -21
- data/node_modules/minimist/package.json +8 -1
- data/node_modules/mkdirp/node_modules/minimist/package.json +8 -1
- data/node_modules/mkdirp/package.json +8 -1
- data/node_modules/number-is-nan/package.json +8 -1
- data/node_modules/os-tmpdir/package.json +8 -1
- data/node_modules/path-exists/package.json +8 -1
- data/node_modules/path-is-absolute/package.json +8 -1
- data/node_modules/repeating/package.json +15 -11
- data/node_modules/shebang-regex/package.json +8 -1
- data/node_modules/slash/package.json +8 -1
- data/node_modules/source-map-support/node_modules/source-map/package.json +8 -1
- data/node_modules/source-map-support/package.json +8 -1
- data/node_modules/source-map/package.json +8 -1
- data/node_modules/user-home/package.json +8 -1
- data/package.json +1 -1
- metadata +54 -6
- data/node_modules/brace-expansion/.npmignore +0 -3
- data/node_modules/brace-expansion/example.js +0 -8
- data/node_modules/minimatch/browser.js +0 -1159
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
|
@@ -7,57 +7,58 @@ var _getIterator2 = require("babel-runtime/core-js/get-iterator");
|
|
7
7
|
var _getIterator3 = _interopRequireDefault(_getIterator2);
|
8
8
|
|
9
9
|
exports.JSXAttribute = JSXAttribute;
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
10
|
+
exports.JSXIdentifier = JSXIdentifier;
|
11
|
+
exports.JSXNamespacedName = JSXNamespacedName;
|
12
|
+
exports.JSXMemberExpression = JSXMemberExpression;
|
13
|
+
exports.JSXSpreadAttribute = JSXSpreadAttribute;
|
14
|
+
exports.JSXExpressionContainer = JSXExpressionContainer;
|
15
|
+
exports.JSXText = JSXText;
|
16
|
+
exports.JSXElement = JSXElement;
|
17
|
+
exports.JSXOpeningElement = JSXOpeningElement;
|
18
|
+
exports.JSXClosingElement = JSXClosingElement;
|
19
|
+
exports.JSXEmptyExpression = JSXEmptyExpression;
|
20
|
+
|
21
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
22
22
|
|
23
23
|
function JSXAttribute(node) {
|
24
24
|
this.print(node.name, node);
|
25
25
|
if (node.value) {
|
26
|
-
this.
|
26
|
+
this.token("=");
|
27
27
|
this.print(node.value, node);
|
28
28
|
}
|
29
29
|
}
|
30
30
|
|
31
31
|
function JSXIdentifier(node) {
|
32
|
-
this.
|
32
|
+
this.word(node.name);
|
33
33
|
}
|
34
34
|
|
35
35
|
function JSXNamespacedName(node) {
|
36
36
|
this.print(node.namespace, node);
|
37
|
-
this.
|
37
|
+
this.token(":");
|
38
38
|
this.print(node.name, node);
|
39
39
|
}
|
40
40
|
|
41
41
|
function JSXMemberExpression(node) {
|
42
42
|
this.print(node.object, node);
|
43
|
-
this.
|
43
|
+
this.token(".");
|
44
44
|
this.print(node.property, node);
|
45
45
|
}
|
46
46
|
|
47
47
|
function JSXSpreadAttribute(node) {
|
48
|
-
this.
|
48
|
+
this.token("{");
|
49
|
+
this.token("...");
|
49
50
|
this.print(node.argument, node);
|
50
|
-
this.
|
51
|
+
this.token("}");
|
51
52
|
}
|
52
53
|
|
53
54
|
function JSXExpressionContainer(node) {
|
54
|
-
this.
|
55
|
+
this.token("{");
|
55
56
|
this.print(node.expression, node);
|
56
|
-
this.
|
57
|
+
this.token("}");
|
57
58
|
}
|
58
59
|
|
59
60
|
function JSXText(node) {
|
60
|
-
this.
|
61
|
+
this.token(node.value);
|
61
62
|
}
|
62
63
|
|
63
64
|
function JSXElement(node) {
|
@@ -66,8 +67,7 @@ function JSXElement(node) {
|
|
66
67
|
if (open.selfClosing) return;
|
67
68
|
|
68
69
|
this.indent();
|
69
|
-
for (
|
70
|
-
/*istanbul ignore next*/
|
70
|
+
for (var _iterator = node.children, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
|
71
71
|
var _ref;
|
72
72
|
|
73
73
|
if (_isArray) {
|
@@ -88,20 +88,29 @@ function JSXElement(node) {
|
|
88
88
|
this.print(node.closingElement, node);
|
89
89
|
}
|
90
90
|
|
91
|
+
function spaceSeparator() {
|
92
|
+
this.space();
|
93
|
+
}
|
94
|
+
|
91
95
|
function JSXOpeningElement(node) {
|
92
|
-
this.
|
96
|
+
this.token("<");
|
93
97
|
this.print(node.name, node);
|
94
98
|
if (node.attributes.length > 0) {
|
95
|
-
this.
|
96
|
-
this.printJoin(node.attributes, node, { separator:
|
99
|
+
this.space();
|
100
|
+
this.printJoin(node.attributes, node, { separator: spaceSeparator });
|
101
|
+
}
|
102
|
+
if (node.selfClosing) {
|
103
|
+
this.space();
|
104
|
+
this.token("/>");
|
105
|
+
} else {
|
106
|
+
this.token(">");
|
97
107
|
}
|
98
|
-
this.push(node.selfClosing ? " />" : ">");
|
99
108
|
}
|
100
109
|
|
101
110
|
function JSXClosingElement(node) {
|
102
|
-
this.
|
111
|
+
this.token("</");
|
103
112
|
this.print(node.name, node);
|
104
|
-
this.
|
113
|
+
this.token(">");
|
105
114
|
}
|
106
115
|
|
107
116
|
function JSXEmptyExpression() {}
|
@@ -1,33 +1,30 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.FunctionDeclaration = undefined;
|
5
5
|
exports._params = _params;
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
exports._method = _method;
|
7
|
+
exports.FunctionExpression = FunctionExpression;
|
8
|
+
exports.ArrowFunctionExpression = ArrowFunctionExpression;
|
9
9
|
|
10
|
-
var
|
10
|
+
var _babelTypes = require("babel-types");
|
11
11
|
|
12
|
-
/*istanbul ignore next*/
|
13
12
|
var t = _interopRequireWildcard(_babelTypes);
|
14
13
|
|
15
|
-
/*istanbul ignore next*/
|
16
14
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
17
15
|
|
18
16
|
function _params(node) {
|
19
|
-
/*istanbul ignore next*/
|
20
17
|
var _this = this;
|
21
18
|
|
22
19
|
this.print(node.typeParameters, node);
|
23
|
-
this.
|
20
|
+
this.token("(");
|
24
21
|
this.printList(node.params, node, {
|
25
|
-
iterator: function
|
26
|
-
if (node.optional)
|
27
|
-
|
22
|
+
iterator: function iterator(node) {
|
23
|
+
if (node.optional) _this.token("?");
|
24
|
+
_this.print(node.typeAnnotation, node);
|
28
25
|
}
|
29
26
|
});
|
30
|
-
this.
|
27
|
+
this.token(")");
|
31
28
|
|
32
29
|
if (node.returnType) {
|
33
30
|
this.print(node.returnType, node);
|
@@ -40,20 +37,24 @@ function _method(node) {
|
|
40
37
|
|
41
38
|
if (kind === "method" || kind === "init") {
|
42
39
|
if (node.generator) {
|
43
|
-
this.
|
40
|
+
this.token("*");
|
44
41
|
}
|
45
42
|
}
|
46
43
|
|
47
44
|
if (kind === "get" || kind === "set") {
|
48
|
-
this.
|
45
|
+
this.word(kind);
|
46
|
+
this.space();
|
49
47
|
}
|
50
48
|
|
51
|
-
if (node.async)
|
49
|
+
if (node.async) {
|
50
|
+
this.word("async");
|
51
|
+
this.space();
|
52
|
+
}
|
52
53
|
|
53
54
|
if (node.computed) {
|
54
|
-
this.
|
55
|
+
this.token("[");
|
55
56
|
this.print(key, node);
|
56
|
-
this.
|
57
|
+
this.token("]");
|
57
58
|
} else {
|
58
59
|
this.print(key, node);
|
59
60
|
}
|
@@ -64,12 +65,15 @@ function _method(node) {
|
|
64
65
|
}
|
65
66
|
|
66
67
|
function FunctionExpression(node) {
|
67
|
-
if (node.async)
|
68
|
-
|
69
|
-
|
68
|
+
if (node.async) {
|
69
|
+
this.word("async");
|
70
|
+
this.space();
|
71
|
+
}
|
72
|
+
this.word("function");
|
73
|
+
if (node.generator) this.token("*");
|
70
74
|
|
71
75
|
if (node.id) {
|
72
|
-
this.
|
76
|
+
this.space();
|
73
77
|
this.print(node.id, node);
|
74
78
|
} else {
|
75
79
|
this.space();
|
@@ -80,9 +84,12 @@ function FunctionExpression(node) {
|
|
80
84
|
this.print(node.body, node);
|
81
85
|
}
|
82
86
|
|
83
|
-
|
87
|
+
exports.FunctionDeclaration = FunctionExpression;
|
84
88
|
function ArrowFunctionExpression(node) {
|
85
|
-
if (node.async)
|
89
|
+
if (node.async) {
|
90
|
+
this.word("async");
|
91
|
+
this.space();
|
92
|
+
}
|
86
93
|
|
87
94
|
if (node.params.length === 1 && t.isIdentifier(node.params[0])) {
|
88
95
|
this.print(node.params[0], node);
|
@@ -90,7 +97,9 @@ function ArrowFunctionExpression(node) {
|
|
90
97
|
this._params(node);
|
91
98
|
}
|
92
99
|
|
93
|
-
this.
|
100
|
+
this.space();
|
101
|
+
this.token("=>");
|
102
|
+
this.space();
|
94
103
|
|
95
104
|
this.print(node.body, node);
|
96
105
|
}
|
@@ -1,29 +1,29 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.ImportSpecifier = ImportSpecifier;
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
var
|
16
|
-
|
17
|
-
/*istanbul ignore next*/
|
5
|
+
exports.ImportDefaultSpecifier = ImportDefaultSpecifier;
|
6
|
+
exports.ExportDefaultSpecifier = ExportDefaultSpecifier;
|
7
|
+
exports.ExportSpecifier = ExportSpecifier;
|
8
|
+
exports.ExportNamespaceSpecifier = ExportNamespaceSpecifier;
|
9
|
+
exports.ExportAllDeclaration = ExportAllDeclaration;
|
10
|
+
exports.ExportNamedDeclaration = ExportNamedDeclaration;
|
11
|
+
exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
|
12
|
+
exports.ImportDeclaration = ImportDeclaration;
|
13
|
+
exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier;
|
14
|
+
|
15
|
+
var _babelTypes = require("babel-types");
|
16
|
+
|
18
17
|
var t = _interopRequireWildcard(_babelTypes);
|
19
18
|
|
20
|
-
/*istanbul ignore next*/
|
21
19
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
22
20
|
|
23
21
|
function ImportSpecifier(node) {
|
24
22
|
this.print(node.imported, node);
|
25
23
|
if (node.local && node.local.name !== node.imported.name) {
|
26
|
-
this.
|
24
|
+
this.space();
|
25
|
+
this.word("as");
|
26
|
+
this.space();
|
27
27
|
this.print(node.local, node);
|
28
28
|
}
|
29
29
|
}
|
@@ -39,34 +39,49 @@ function ExportDefaultSpecifier(node) {
|
|
39
39
|
function ExportSpecifier(node) {
|
40
40
|
this.print(node.local, node);
|
41
41
|
if (node.exported && node.local.name !== node.exported.name) {
|
42
|
-
this.
|
42
|
+
this.space();
|
43
|
+
this.word("as");
|
44
|
+
this.space();
|
43
45
|
this.print(node.exported, node);
|
44
46
|
}
|
45
47
|
}
|
46
48
|
|
47
49
|
function ExportNamespaceSpecifier(node) {
|
48
|
-
this.
|
50
|
+
this.token("*");
|
51
|
+
this.space();
|
52
|
+
this.word("as");
|
53
|
+
this.space();
|
49
54
|
this.print(node.exported, node);
|
50
55
|
}
|
51
56
|
|
52
57
|
function ExportAllDeclaration(node) {
|
53
|
-
this.
|
58
|
+
this.word("export");
|
59
|
+
this.space();
|
60
|
+
this.token("*");
|
54
61
|
if (node.exported) {
|
55
|
-
this.
|
62
|
+
this.space();
|
63
|
+
this.word("as");
|
64
|
+
this.space();
|
56
65
|
this.print(node.exported, node);
|
57
66
|
}
|
58
|
-
this.
|
67
|
+
this.space();
|
68
|
+
this.word("from");
|
69
|
+
this.space();
|
59
70
|
this.print(node.source, node);
|
60
71
|
this.semicolon();
|
61
72
|
}
|
62
73
|
|
63
74
|
function ExportNamedDeclaration() {
|
64
|
-
this.
|
75
|
+
this.word("export");
|
76
|
+
this.space();
|
65
77
|
ExportDeclaration.apply(this, arguments);
|
66
78
|
}
|
67
79
|
|
68
80
|
function ExportDefaultDeclaration() {
|
69
|
-
this.
|
81
|
+
this.word("export");
|
82
|
+
this.space();
|
83
|
+
this.word("default");
|
84
|
+
this.space();
|
70
85
|
ExportDeclaration.apply(this, arguments);
|
71
86
|
}
|
72
87
|
|
@@ -74,10 +89,11 @@ function ExportDeclaration(node) {
|
|
74
89
|
if (node.declaration) {
|
75
90
|
var declar = node.declaration;
|
76
91
|
this.print(declar, node);
|
77
|
-
if (t.isStatement(declar)
|
92
|
+
if (!t.isStatement(declar)) this.semicolon();
|
78
93
|
} else {
|
79
94
|
if (node.exportKind === "type") {
|
80
|
-
this.
|
95
|
+
this.word("type");
|
96
|
+
this.space();
|
81
97
|
}
|
82
98
|
|
83
99
|
var specifiers = node.specifiers.slice(0);
|
@@ -90,7 +106,8 @@ function ExportDeclaration(node) {
|
|
90
106
|
hasSpecial = true;
|
91
107
|
this.print(specifiers.shift(), node);
|
92
108
|
if (specifiers.length) {
|
93
|
-
this.
|
109
|
+
this.token(",");
|
110
|
+
this.space();
|
94
111
|
}
|
95
112
|
} else {
|
96
113
|
break;
|
@@ -98,29 +115,33 @@ function ExportDeclaration(node) {
|
|
98
115
|
}
|
99
116
|
|
100
117
|
if (specifiers.length || !specifiers.length && !hasSpecial) {
|
101
|
-
this.
|
118
|
+
this.token("{");
|
102
119
|
if (specifiers.length) {
|
103
120
|
this.space();
|
104
|
-
this.
|
121
|
+
this.printList(specifiers, node);
|
105
122
|
this.space();
|
106
123
|
}
|
107
|
-
this.
|
124
|
+
this.token("}");
|
108
125
|
}
|
109
126
|
|
110
127
|
if (node.source) {
|
111
|
-
this.
|
128
|
+
this.space();
|
129
|
+
this.word("from");
|
130
|
+
this.space();
|
112
131
|
this.print(node.source, node);
|
113
132
|
}
|
114
|
-
}
|
115
133
|
|
116
|
-
|
134
|
+
this.semicolon();
|
135
|
+
}
|
117
136
|
}
|
118
137
|
|
119
138
|
function ImportDeclaration(node) {
|
120
|
-
this.
|
139
|
+
this.word("import");
|
140
|
+
this.space();
|
121
141
|
|
122
142
|
if (node.importKind === "type" || node.importKind === "typeof") {
|
123
|
-
this.
|
143
|
+
this.word(node.importKind);
|
144
|
+
this.space();
|
124
145
|
}
|
125
146
|
|
126
147
|
var specifiers = node.specifiers.slice(0);
|
@@ -131,7 +152,8 @@ function ImportDeclaration(node) {
|
|
131
152
|
if (t.isImportDefaultSpecifier(first) || t.isImportNamespaceSpecifier(first)) {
|
132
153
|
this.print(specifiers.shift(), node);
|
133
154
|
if (specifiers.length) {
|
134
|
-
this.
|
155
|
+
this.token(",");
|
156
|
+
this.space();
|
135
157
|
}
|
136
158
|
} else {
|
137
159
|
break;
|
@@ -139,14 +161,16 @@ function ImportDeclaration(node) {
|
|
139
161
|
}
|
140
162
|
|
141
163
|
if (specifiers.length) {
|
142
|
-
this.
|
164
|
+
this.token("{");
|
143
165
|
this.space();
|
144
|
-
this.
|
166
|
+
this.printList(specifiers, node);
|
145
167
|
this.space();
|
146
|
-
this.
|
168
|
+
this.token("}");
|
147
169
|
}
|
148
170
|
|
149
|
-
this.
|
171
|
+
this.space();
|
172
|
+
this.word("from");
|
173
|
+
this.space();
|
150
174
|
}
|
151
175
|
|
152
176
|
this.print(node.source, node);
|
@@ -154,6 +178,9 @@ function ImportDeclaration(node) {
|
|
154
178
|
}
|
155
179
|
|
156
180
|
function ImportNamespaceSpecifier(node) {
|
157
|
-
this.
|
181
|
+
this.token("*");
|
182
|
+
this.space();
|
183
|
+
this.word("as");
|
184
|
+
this.space();
|
158
185
|
this.print(node.local, node);
|
159
186
|
}
|