webpipe-js 2.0.57 → 2.0.58

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
@@ -893,11 +893,19 @@ var Parser = class {
893
893
  while (true) {
894
894
  const save = this.pos;
895
895
  this.skipWhitespaceOnly();
896
+ const commentPos = this.pos;
896
897
  const comment = this.tryParse(() => this.parseStandaloneComment());
897
898
  if (comment) {
898
- comments.push(comment);
899
899
  if (this.cur() === "\n") this.pos++;
900
- continue;
900
+ this.skipWhitespaceOnly();
901
+ const hasFollowingStep = this.text.startsWith("|>", this.pos);
902
+ if (hasFollowingStep || steps.length === 0) {
903
+ comments.push(comment);
904
+ continue;
905
+ } else {
906
+ this.pos = commentPos;
907
+ break;
908
+ }
901
909
  }
902
910
  for (const keyword of stopKeywords) {
903
911
  if (this.text.startsWith(keyword, this.pos)) {
@@ -922,11 +930,19 @@ var Parser = class {
922
930
  const comments = [];
923
931
  while (true) {
924
932
  this.skipWhitespaceOnly();
933
+ const commentPos = this.pos;
925
934
  const comment = this.tryParse(() => this.parseStandaloneComment());
926
935
  if (comment) {
927
- comments.push(comment);
928
936
  if (this.cur() === "\n") this.pos++;
929
- continue;
937
+ this.skipWhitespaceOnly();
938
+ const hasFollowingStep = this.text.startsWith("|>", this.pos);
939
+ if (hasFollowingStep || steps.length === 0) {
940
+ comments.push(comment);
941
+ continue;
942
+ } else {
943
+ this.pos = commentPos;
944
+ break;
945
+ }
930
946
  }
931
947
  if (!this.text.startsWith("|>", this.pos)) {
932
948
  break;
@@ -1500,11 +1516,19 @@ var Parser = class {
1500
1516
  const comments = [];
1501
1517
  while (true) {
1502
1518
  this.skipWhitespaceOnly();
1519
+ const commentPos = this.pos;
1503
1520
  const comment = this.tryParse(() => this.parseStandaloneComment());
1504
1521
  if (comment) {
1505
- comments.push(comment);
1506
1522
  if (this.cur() === "\n") this.pos++;
1507
- continue;
1523
+ this.skipWhitespaceOnly();
1524
+ const hasFollowingItem = this.text.startsWith("let ", this.pos) || this.text.startsWith("with mock", this.pos) || this.text.startsWith("and mock", this.pos) || this.text.startsWith("it ", this.pos) || this.text.startsWith('it"', this.pos);
1525
+ if (hasFollowingItem || variables.length === 0 && mocks.length === 0 && tests.length === 0) {
1526
+ comments.push(comment);
1527
+ continue;
1528
+ } else {
1529
+ this.pos = commentPos;
1530
+ break;
1531
+ }
1508
1532
  }
1509
1533
  const letBinding = this.tryParse(() => this.parseLetBinding());
1510
1534
  if (letBinding) {
package/dist/index.mjs CHANGED
@@ -840,11 +840,19 @@ var Parser = class {
840
840
  while (true) {
841
841
  const save = this.pos;
842
842
  this.skipWhitespaceOnly();
843
+ const commentPos = this.pos;
843
844
  const comment = this.tryParse(() => this.parseStandaloneComment());
844
845
  if (comment) {
845
- comments.push(comment);
846
846
  if (this.cur() === "\n") this.pos++;
847
- continue;
847
+ this.skipWhitespaceOnly();
848
+ const hasFollowingStep = this.text.startsWith("|>", this.pos);
849
+ if (hasFollowingStep || steps.length === 0) {
850
+ comments.push(comment);
851
+ continue;
852
+ } else {
853
+ this.pos = commentPos;
854
+ break;
855
+ }
848
856
  }
849
857
  for (const keyword of stopKeywords) {
850
858
  if (this.text.startsWith(keyword, this.pos)) {
@@ -869,11 +877,19 @@ var Parser = class {
869
877
  const comments = [];
870
878
  while (true) {
871
879
  this.skipWhitespaceOnly();
880
+ const commentPos = this.pos;
872
881
  const comment = this.tryParse(() => this.parseStandaloneComment());
873
882
  if (comment) {
874
- comments.push(comment);
875
883
  if (this.cur() === "\n") this.pos++;
876
- continue;
884
+ this.skipWhitespaceOnly();
885
+ const hasFollowingStep = this.text.startsWith("|>", this.pos);
886
+ if (hasFollowingStep || steps.length === 0) {
887
+ comments.push(comment);
888
+ continue;
889
+ } else {
890
+ this.pos = commentPos;
891
+ break;
892
+ }
877
893
  }
878
894
  if (!this.text.startsWith("|>", this.pos)) {
879
895
  break;
@@ -1447,11 +1463,19 @@ var Parser = class {
1447
1463
  const comments = [];
1448
1464
  while (true) {
1449
1465
  this.skipWhitespaceOnly();
1466
+ const commentPos = this.pos;
1450
1467
  const comment = this.tryParse(() => this.parseStandaloneComment());
1451
1468
  if (comment) {
1452
- comments.push(comment);
1453
1469
  if (this.cur() === "\n") this.pos++;
1454
- continue;
1470
+ this.skipWhitespaceOnly();
1471
+ const hasFollowingItem = this.text.startsWith("let ", this.pos) || this.text.startsWith("with mock", this.pos) || this.text.startsWith("and mock", this.pos) || this.text.startsWith("it ", this.pos) || this.text.startsWith('it"', this.pos);
1472
+ if (hasFollowingItem || variables.length === 0 && mocks.length === 0 && tests.length === 0) {
1473
+ comments.push(comment);
1474
+ continue;
1475
+ } else {
1476
+ this.pos = commentPos;
1477
+ break;
1478
+ }
1455
1479
  }
1456
1480
  const letBinding = this.tryParse(() => this.parseLetBinding());
1457
1481
  if (letBinding) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpipe-js",
3
- "version": "2.0.57",
3
+ "version": "2.0.58",
4
4
  "description": "Web Pipe parser",
5
5
  "license": "ISC",
6
6
  "author": "William Cotton",