bio-dts 0.10.0 → 0.11.0

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.
@@ -531,12 +531,24 @@ declare function p${
531
531
  // remove entirely, if empty
532
532
  if (!newDoc.replace(/[/*\s]/g, '')) {
533
533
  return null;
534
- } else {
535
- return b.commentBlock.from({
536
- leading: true,
537
- value: newDoc
538
- });
539
534
  }
535
+
536
+ // leave comment unchanged
537
+ if (newDoc === comment.value) {
538
+ return comment;
539
+ }
540
+
541
+ const commentBuilder = {
542
+ 'CommentLine': b.commentLine,
543
+ 'CommentBlock': b.commentBlock
544
+ };
545
+
546
+ return commentBuilder[comment.type].from({
547
+ leading: comment.leading,
548
+ trailing: comment.trailing,
549
+ loc: comment.loc,
550
+ value: newDoc
551
+ });
540
552
  }
541
553
 
542
554
  /**
@@ -551,9 +563,12 @@ declare function p${
551
563
  const comment = comments.get(key);
552
564
 
553
565
  const newComment = cleanComment(comment.value);
554
- if (newComment) {
566
+
567
+ if (newComment && newComment !== comment.value) {
555
568
  replace(comment, newComment);
556
- } else {
569
+ }
570
+
571
+ if (!newComment) {
557
572
  replace(comment);
558
573
  }
559
574
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bio-dts",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Generate sane and clean types from JavaScript sources",
5
5
  "type": "module",
6
6
  "bin": "bin/cmd.js",