webpipe-js 2.0.51 → 2.0.53

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
@@ -127,21 +127,27 @@ var Parser = class {
127
127
  const originalPos = this.pos;
128
128
  this.pos++;
129
129
  const restOfLine = this.consumeWhile((ch) => ch !== "\n");
130
+ const end = this.pos;
130
131
  return {
131
132
  type: "standalone",
132
133
  text: restOfLine,
133
134
  style: "#",
134
- lineNumber: this.getLineNumber(start)
135
+ lineNumber: this.getLineNumber(start),
136
+ start,
137
+ end
135
138
  };
136
139
  }
137
140
  if (this.text.startsWith("//", this.pos)) {
138
141
  this.pos += 2;
139
142
  const text = this.consumeWhile((ch) => ch !== "\n");
143
+ const end = this.pos;
140
144
  return {
141
145
  type: "standalone",
142
146
  text,
143
147
  style: "//",
144
- lineNumber: this.getLineNumber(start)
148
+ lineNumber: this.getLineNumber(start),
149
+ start,
150
+ end
145
151
  };
146
152
  }
147
153
  return null;
@@ -892,10 +898,11 @@ var Parser = class {
892
898
  const comments = [];
893
899
  while (true) {
894
900
  const save = this.pos;
895
- this.skipSpaces();
901
+ this.skipWhitespaceOnly();
896
902
  const comment = this.tryParse(() => this.parseStandaloneComment());
897
903
  if (comment) {
898
904
  comments.push(comment);
905
+ if (this.cur() === "\n") this.pos++;
899
906
  continue;
900
907
  }
901
908
  for (const keyword of stopKeywords) {
@@ -921,10 +928,11 @@ var Parser = class {
921
928
  const comments = [];
922
929
  while (true) {
923
930
  const save = this.pos;
924
- this.skipSpaces();
931
+ this.skipWhitespaceOnly();
925
932
  const comment = this.tryParse(() => this.parseStandaloneComment());
926
933
  if (comment) {
927
934
  comments.push(comment);
935
+ if (this.cur() === "\n") this.pos++;
928
936
  continue;
929
937
  }
930
938
  if (!this.text.startsWith("|>", this.pos)) {
@@ -1501,10 +1509,11 @@ var Parser = class {
1501
1509
  const tests = [];
1502
1510
  const comments = [];
1503
1511
  while (true) {
1504
- this.skipSpaces();
1512
+ this.skipWhitespaceOnly();
1505
1513
  const comment = this.tryParse(() => this.parseStandaloneComment());
1506
1514
  if (comment) {
1507
1515
  comments.push(comment);
1516
+ if (this.cur() === "\n") this.pos++;
1508
1517
  continue;
1509
1518
  }
1510
1519
  const letBinding = this.tryParse(() => this.parseLetBinding());
@@ -1614,7 +1623,9 @@ function printPipeline(pipeline) {
1614
1623
  items.push({ type: "step", item: step, position: step.start });
1615
1624
  });
1616
1625
  pipeline.pipeline.comments.forEach((comment) => {
1617
- items.push({ type: "comment", item: comment, position: comment.lineNumber || 0 });
1626
+ if (comment.start !== void 0) {
1627
+ items.push({ type: "comment", item: comment, position: comment.start });
1628
+ }
1618
1629
  });
1619
1630
  items.sort((a, b) => a.position - b.position);
1620
1631
  items.forEach((entry) => {
@@ -2026,7 +2037,9 @@ function formatPipelineRef(ref) {
2026
2037
  items.push({ type: "step", item: step, position: step.start });
2027
2038
  });
2028
2039
  ref.pipeline.comments.forEach((comment) => {
2029
- items.push({ type: "comment", item: comment, position: comment.lineNumber || 0 });
2040
+ if (comment.start !== void 0) {
2041
+ items.push({ type: "comment", item: comment, position: comment.start });
2042
+ }
2030
2043
  });
2031
2044
  items.sort((a, b) => a.position - b.position);
2032
2045
  items.forEach((entry) => {
package/dist/index.d.cts CHANGED
@@ -16,6 +16,8 @@ interface Comment {
16
16
  text: string;
17
17
  style: '#' | '//';
18
18
  lineNumber?: number;
19
+ start?: number;
20
+ end?: number;
19
21
  }
20
22
  interface Config {
21
23
  name: string;
package/dist/index.d.ts CHANGED
@@ -16,6 +16,8 @@ interface Comment {
16
16
  text: string;
17
17
  style: '#' | '//';
18
18
  lineNumber?: number;
19
+ start?: number;
20
+ end?: number;
19
21
  }
20
22
  interface Config {
21
23
  name: string;
package/dist/index.mjs CHANGED
@@ -74,21 +74,27 @@ var Parser = class {
74
74
  const originalPos = this.pos;
75
75
  this.pos++;
76
76
  const restOfLine = this.consumeWhile((ch) => ch !== "\n");
77
+ const end = this.pos;
77
78
  return {
78
79
  type: "standalone",
79
80
  text: restOfLine,
80
81
  style: "#",
81
- lineNumber: this.getLineNumber(start)
82
+ lineNumber: this.getLineNumber(start),
83
+ start,
84
+ end
82
85
  };
83
86
  }
84
87
  if (this.text.startsWith("//", this.pos)) {
85
88
  this.pos += 2;
86
89
  const text = this.consumeWhile((ch) => ch !== "\n");
90
+ const end = this.pos;
87
91
  return {
88
92
  type: "standalone",
89
93
  text,
90
94
  style: "//",
91
- lineNumber: this.getLineNumber(start)
95
+ lineNumber: this.getLineNumber(start),
96
+ start,
97
+ end
92
98
  };
93
99
  }
94
100
  return null;
@@ -839,10 +845,11 @@ var Parser = class {
839
845
  const comments = [];
840
846
  while (true) {
841
847
  const save = this.pos;
842
- this.skipSpaces();
848
+ this.skipWhitespaceOnly();
843
849
  const comment = this.tryParse(() => this.parseStandaloneComment());
844
850
  if (comment) {
845
851
  comments.push(comment);
852
+ if (this.cur() === "\n") this.pos++;
846
853
  continue;
847
854
  }
848
855
  for (const keyword of stopKeywords) {
@@ -868,10 +875,11 @@ var Parser = class {
868
875
  const comments = [];
869
876
  while (true) {
870
877
  const save = this.pos;
871
- this.skipSpaces();
878
+ this.skipWhitespaceOnly();
872
879
  const comment = this.tryParse(() => this.parseStandaloneComment());
873
880
  if (comment) {
874
881
  comments.push(comment);
882
+ if (this.cur() === "\n") this.pos++;
875
883
  continue;
876
884
  }
877
885
  if (!this.text.startsWith("|>", this.pos)) {
@@ -1448,10 +1456,11 @@ var Parser = class {
1448
1456
  const tests = [];
1449
1457
  const comments = [];
1450
1458
  while (true) {
1451
- this.skipSpaces();
1459
+ this.skipWhitespaceOnly();
1452
1460
  const comment = this.tryParse(() => this.parseStandaloneComment());
1453
1461
  if (comment) {
1454
1462
  comments.push(comment);
1463
+ if (this.cur() === "\n") this.pos++;
1455
1464
  continue;
1456
1465
  }
1457
1466
  const letBinding = this.tryParse(() => this.parseLetBinding());
@@ -1561,7 +1570,9 @@ function printPipeline(pipeline) {
1561
1570
  items.push({ type: "step", item: step, position: step.start });
1562
1571
  });
1563
1572
  pipeline.pipeline.comments.forEach((comment) => {
1564
- items.push({ type: "comment", item: comment, position: comment.lineNumber || 0 });
1573
+ if (comment.start !== void 0) {
1574
+ items.push({ type: "comment", item: comment, position: comment.start });
1575
+ }
1565
1576
  });
1566
1577
  items.sort((a, b) => a.position - b.position);
1567
1578
  items.forEach((entry) => {
@@ -1973,7 +1984,9 @@ function formatPipelineRef(ref) {
1973
1984
  items.push({ type: "step", item: step, position: step.start });
1974
1985
  });
1975
1986
  ref.pipeline.comments.forEach((comment) => {
1976
- items.push({ type: "comment", item: comment, position: comment.lineNumber || 0 });
1987
+ if (comment.start !== void 0) {
1988
+ items.push({ type: "comment", item: comment, position: comment.start });
1989
+ }
1977
1990
  });
1978
1991
  items.sort((a, b) => a.position - b.position);
1979
1992
  items.forEach((entry) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpipe-js",
3
- "version": "2.0.51",
3
+ "version": "2.0.53",
4
4
  "description": "Web Pipe parser",
5
5
  "license": "ISC",
6
6
  "author": "William Cotton",