esrap 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/handlers.js +8 -7
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ If the nodes of the input AST have `loc` properties (e.g. the AST was generated
|
|
|
38
38
|
You can pass information that will be added to the resulting sourcemap (note that the AST is assumed to come from a single file):
|
|
39
39
|
|
|
40
40
|
```js
|
|
41
|
-
const { code, map } =
|
|
41
|
+
const { code, map } = print(ast, {
|
|
42
42
|
sourceMapSource: 'input.js',
|
|
43
43
|
sourceMapContent: fs.readFileSync('input.js', 'utf-8')
|
|
44
44
|
});
|
package/package.json
CHANGED
package/src/handlers.js
CHANGED
|
@@ -616,7 +616,9 @@ const handlers = {
|
|
|
616
616
|
|
|
617
617
|
if (
|
|
618
618
|
node.body.type === 'ObjectExpression' ||
|
|
619
|
-
(node.body.type === 'AssignmentExpression' && node.body.left.type === 'ObjectPattern')
|
|
619
|
+
(node.body.type === 'AssignmentExpression' && node.body.left.type === 'ObjectPattern') ||
|
|
620
|
+
(node.body.type === 'LogicalExpression' && node.body.left.type === 'ObjectExpression') ||
|
|
621
|
+
(node.body.type === 'ConditionalExpression' && node.body.test.type === 'ObjectExpression')
|
|
620
622
|
) {
|
|
621
623
|
state.commands.push('(');
|
|
622
624
|
handle(node.body, state);
|
|
@@ -871,17 +873,16 @@ const handlers = {
|
|
|
871
873
|
|
|
872
874
|
state.commands.push('import ');
|
|
873
875
|
|
|
874
|
-
if (namespace_specifier) {
|
|
875
|
-
state.commands.push(c('* as ' + namespace_specifier.local.name, namespace_specifier));
|
|
876
|
-
}
|
|
877
|
-
|
|
878
876
|
if (default_specifier) {
|
|
879
877
|
state.commands.push(c(default_specifier.local.name, default_specifier));
|
|
878
|
+
if (namespace_specifier || named_specifiers.length > 0) state.commands.push(', ');
|
|
880
879
|
}
|
|
881
880
|
|
|
882
|
-
if (
|
|
883
|
-
|
|
881
|
+
if (namespace_specifier) {
|
|
882
|
+
state.commands.push(c('* as ' + namespace_specifier.local.name, namespace_specifier));
|
|
883
|
+
}
|
|
884
884
|
|
|
885
|
+
if (named_specifiers.length > 0) {
|
|
885
886
|
state.commands.push('{');
|
|
886
887
|
sequence(named_specifiers, state, true, (s, state) => {
|
|
887
888
|
if (s.local.name !== s.imported.name) {
|