webpipe-js 2.0.60 → 2.0.62

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/dist/index.cjs CHANGED
@@ -896,11 +896,22 @@ var Parser = class {
896
896
  const commentPos = this.pos;
897
897
  const comment = this.tryParse(() => this.parseStandaloneComment());
898
898
  if (comment) {
899
+ const lookAheadPos = this.pos;
899
900
  if (this.cur() === "\n") this.pos++;
900
- this.skipWhitespaceOnly();
901
+ while (true) {
902
+ this.skipWhitespaceOnly();
903
+ const nextComment = this.tryParse(() => this.parseStandaloneComment());
904
+ if (nextComment) {
905
+ if (this.cur() === "\n") this.pos++;
906
+ continue;
907
+ }
908
+ break;
909
+ }
901
910
  const hasFollowingStep = this.text.startsWith("|>", this.pos);
911
+ this.pos = lookAheadPos;
902
912
  if (hasFollowingStep || steps.length === 0) {
903
913
  comments.push(comment);
914
+ if (this.cur() === "\n") this.pos++;
904
915
  continue;
905
916
  } else {
906
917
  this.pos = commentPos;
@@ -933,11 +944,22 @@ var Parser = class {
933
944
  const commentPos = this.pos;
934
945
  const comment = this.tryParse(() => this.parseStandaloneComment());
935
946
  if (comment) {
947
+ const lookAheadPos = this.pos;
936
948
  if (this.cur() === "\n") this.pos++;
937
- this.skipWhitespaceOnly();
949
+ while (true) {
950
+ this.skipWhitespaceOnly();
951
+ const nextComment = this.tryParse(() => this.parseStandaloneComment());
952
+ if (nextComment) {
953
+ if (this.cur() === "\n") this.pos++;
954
+ continue;
955
+ }
956
+ break;
957
+ }
938
958
  const hasFollowingStep = this.text.startsWith("|>", this.pos);
959
+ this.pos = lookAheadPos;
939
960
  if (hasFollowingStep || steps.length === 0) {
940
961
  comments.push(comment);
962
+ if (this.cur() === "\n") this.pos++;
941
963
  continue;
942
964
  } else {
943
965
  this.pos = commentPos;
@@ -1883,6 +1905,9 @@ function prettyPrint(program) {
1883
1905
  const nextItem = allItems[index + 1];
1884
1906
  const shouldAddBlankLine = () => {
1885
1907
  if (!nextItem) return false;
1908
+ if (entry.type === "describe") {
1909
+ return false;
1910
+ }
1886
1911
  if (entry.type === "comment") {
1887
1912
  return nextItem.lineNumber - entry.lineNumber > 1;
1888
1913
  }
package/dist/index.mjs CHANGED
@@ -843,11 +843,22 @@ var Parser = class {
843
843
  const commentPos = this.pos;
844
844
  const comment = this.tryParse(() => this.parseStandaloneComment());
845
845
  if (comment) {
846
+ const lookAheadPos = this.pos;
846
847
  if (this.cur() === "\n") this.pos++;
847
- this.skipWhitespaceOnly();
848
+ while (true) {
849
+ this.skipWhitespaceOnly();
850
+ const nextComment = this.tryParse(() => this.parseStandaloneComment());
851
+ if (nextComment) {
852
+ if (this.cur() === "\n") this.pos++;
853
+ continue;
854
+ }
855
+ break;
856
+ }
848
857
  const hasFollowingStep = this.text.startsWith("|>", this.pos);
858
+ this.pos = lookAheadPos;
849
859
  if (hasFollowingStep || steps.length === 0) {
850
860
  comments.push(comment);
861
+ if (this.cur() === "\n") this.pos++;
851
862
  continue;
852
863
  } else {
853
864
  this.pos = commentPos;
@@ -880,11 +891,22 @@ var Parser = class {
880
891
  const commentPos = this.pos;
881
892
  const comment = this.tryParse(() => this.parseStandaloneComment());
882
893
  if (comment) {
894
+ const lookAheadPos = this.pos;
883
895
  if (this.cur() === "\n") this.pos++;
884
- this.skipWhitespaceOnly();
896
+ while (true) {
897
+ this.skipWhitespaceOnly();
898
+ const nextComment = this.tryParse(() => this.parseStandaloneComment());
899
+ if (nextComment) {
900
+ if (this.cur() === "\n") this.pos++;
901
+ continue;
902
+ }
903
+ break;
904
+ }
885
905
  const hasFollowingStep = this.text.startsWith("|>", this.pos);
906
+ this.pos = lookAheadPos;
886
907
  if (hasFollowingStep || steps.length === 0) {
887
908
  comments.push(comment);
909
+ if (this.cur() === "\n") this.pos++;
888
910
  continue;
889
911
  } else {
890
912
  this.pos = commentPos;
@@ -1830,6 +1852,9 @@ function prettyPrint(program) {
1830
1852
  const nextItem = allItems[index + 1];
1831
1853
  const shouldAddBlankLine = () => {
1832
1854
  if (!nextItem) return false;
1855
+ if (entry.type === "describe") {
1856
+ return false;
1857
+ }
1833
1858
  if (entry.type === "comment") {
1834
1859
  return nextItem.lineNumber - entry.lineNumber > 1;
1835
1860
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpipe-js",
3
- "version": "2.0.60",
3
+ "version": "2.0.62",
4
4
  "description": "Web Pipe parser",
5
5
  "license": "ISC",
6
6
  "author": "William Cotton",