webpipe-js 0.1.10 → 0.1.11

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
@@ -85,7 +85,7 @@ var Parser = class {
85
85
  const text = this.consumeWhile((ch) => ch !== "\n");
86
86
  return {
87
87
  type: "inline",
88
- text: text.trim(),
88
+ text,
89
89
  style: "#",
90
90
  lineNumber: this.getLineNumber(start)
91
91
  };
@@ -95,7 +95,7 @@ var Parser = class {
95
95
  const text = this.consumeWhile((ch) => ch !== "\n");
96
96
  return {
97
97
  type: "inline",
98
- text: text.trim(),
98
+ text,
99
99
  style: "//",
100
100
  lineNumber: this.getLineNumber(start)
101
101
  };
@@ -105,11 +105,12 @@ var Parser = class {
105
105
  parseStandaloneComment() {
106
106
  const start = this.pos;
107
107
  if (this.text.startsWith("#", this.pos)) {
108
+ const originalPos = this.pos;
108
109
  this.pos++;
109
- const text = this.consumeWhile((ch) => ch !== "\n");
110
+ const restOfLine = this.consumeWhile((ch) => ch !== "\n");
110
111
  return {
111
112
  type: "standalone",
112
- text: text.trim(),
113
+ text: restOfLine,
113
114
  style: "#",
114
115
  lineNumber: this.getLineNumber(start)
115
116
  };
@@ -119,7 +120,7 @@ var Parser = class {
119
120
  const text = this.consumeWhile((ch) => ch !== "\n");
120
121
  return {
121
122
  type: "standalone",
122
- text: text.trim(),
123
+ text,
123
124
  style: "//",
124
125
  lineNumber: this.getLineNumber(start)
125
126
  };
@@ -735,6 +736,12 @@ function printTest(test) {
735
736
  return lines.join("\n");
736
737
  }
737
738
  function printComment(comment) {
739
+ if (comment.style === "#" && comment.text.startsWith("#")) {
740
+ return `${comment.style}${comment.text}`;
741
+ }
742
+ if (comment.text === "" || comment.text.startsWith(" ")) {
743
+ return `${comment.style}${comment.text}`;
744
+ }
738
745
  return `${comment.style} ${comment.text}`;
739
746
  }
740
747
  function printDescribe(describe) {
@@ -812,7 +819,7 @@ function prettyPrint(program) {
812
819
  break;
813
820
  }
814
821
  });
815
- return lines.join("\n").trim();
822
+ return lines.join("\n").trim() + "\n";
816
823
  }
817
824
  function formatConfigValue(value) {
818
825
  switch (value.kind) {
package/dist/index.mjs CHANGED
@@ -41,7 +41,7 @@ var Parser = class {
41
41
  const text = this.consumeWhile((ch) => ch !== "\n");
42
42
  return {
43
43
  type: "inline",
44
- text: text.trim(),
44
+ text,
45
45
  style: "#",
46
46
  lineNumber: this.getLineNumber(start)
47
47
  };
@@ -51,7 +51,7 @@ var Parser = class {
51
51
  const text = this.consumeWhile((ch) => ch !== "\n");
52
52
  return {
53
53
  type: "inline",
54
- text: text.trim(),
54
+ text,
55
55
  style: "//",
56
56
  lineNumber: this.getLineNumber(start)
57
57
  };
@@ -61,11 +61,12 @@ var Parser = class {
61
61
  parseStandaloneComment() {
62
62
  const start = this.pos;
63
63
  if (this.text.startsWith("#", this.pos)) {
64
+ const originalPos = this.pos;
64
65
  this.pos++;
65
- const text = this.consumeWhile((ch) => ch !== "\n");
66
+ const restOfLine = this.consumeWhile((ch) => ch !== "\n");
66
67
  return {
67
68
  type: "standalone",
68
- text: text.trim(),
69
+ text: restOfLine,
69
70
  style: "#",
70
71
  lineNumber: this.getLineNumber(start)
71
72
  };
@@ -75,7 +76,7 @@ var Parser = class {
75
76
  const text = this.consumeWhile((ch) => ch !== "\n");
76
77
  return {
77
78
  type: "standalone",
78
- text: text.trim(),
79
+ text,
79
80
  style: "//",
80
81
  lineNumber: this.getLineNumber(start)
81
82
  };
@@ -691,6 +692,12 @@ function printTest(test) {
691
692
  return lines.join("\n");
692
693
  }
693
694
  function printComment(comment) {
695
+ if (comment.style === "#" && comment.text.startsWith("#")) {
696
+ return `${comment.style}${comment.text}`;
697
+ }
698
+ if (comment.text === "" || comment.text.startsWith(" ")) {
699
+ return `${comment.style}${comment.text}`;
700
+ }
694
701
  return `${comment.style} ${comment.text}`;
695
702
  }
696
703
  function printDescribe(describe) {
@@ -768,7 +775,7 @@ function prettyPrint(program) {
768
775
  break;
769
776
  }
770
777
  });
771
- return lines.join("\n").trim();
778
+ return lines.join("\n").trim() + "\n";
772
779
  }
773
780
  function formatConfigValue(value) {
774
781
  switch (value.kind) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpipe-js",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Web Pipe parser",
5
5
  "license": "ISC",
6
6
  "author": "William Cotton",