esrap 1.2.0 → 1.2.1

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 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 } = parse(ast, {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esrap",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Parse in reverse",
5
5
  "repository": {
6
6
  "type": "git",
package/src/handlers.js CHANGED
@@ -871,17 +871,16 @@ const handlers = {
871
871
 
872
872
  state.commands.push('import ');
873
873
 
874
- if (namespace_specifier) {
875
- state.commands.push(c('* as ' + namespace_specifier.local.name, namespace_specifier));
876
- }
877
-
878
874
  if (default_specifier) {
879
875
  state.commands.push(c(default_specifier.local.name, default_specifier));
876
+ if (namespace_specifier || named_specifiers.length > 0) state.commands.push(', ');
880
877
  }
881
878
 
882
- if (named_specifiers.length > 0) {
883
- if (default_specifier) state.commands.push(', ');
879
+ if (namespace_specifier) {
880
+ state.commands.push(c('* as ' + namespace_specifier.local.name, namespace_specifier));
881
+ }
884
882
 
883
+ if (named_specifiers.length > 0) {
885
884
  state.commands.push('{');
886
885
  sequence(named_specifiers, state, true, (s, state) => {
887
886
  if (s.local.name !== s.imported.name) {