esrap 2.1.2 → 2.1.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esrap",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "Parse in reverse",
5
5
  "repository": {
6
6
  "type": "git",
@@ -962,13 +962,28 @@ export default (options = {}) => {
962
962
  },
963
963
 
964
964
  ExportNamedDeclaration(node, context) {
965
- context.write('export ');
966
-
967
965
  if (node.declaration) {
968
- context.visit(node.declaration);
966
+ // Check if declaration has decorators (ClassDeclaration, ClassExpression can have them)
967
+ const decl = /** @type {any} */ (node.declaration);
968
+ if (decl.decorators && decl.decorators.length > 0) {
969
+ for (const decorator of decl.decorators) {
970
+ context.visit(decorator);
971
+ }
972
+ context.write('export ');
973
+ // Temporarily remove decorators so ClassDeclaration doesn't print them again
974
+ const savedDecorators = decl.decorators;
975
+ decl.decorators = [];
976
+ context.visit(node.declaration);
977
+ decl.decorators = savedDecorators;
978
+ } else {
979
+ context.write('export ');
980
+ context.visit(node.declaration);
981
+ }
969
982
  return;
970
983
  }
971
984
 
985
+ context.write('export ');
986
+
972
987
  if (node.exportKind === 'type') {
973
988
  context.write('type ');
974
989
  }