webpipe-js 2.0.50 → 2.0.51
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 +41 -5
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +41 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -889,14 +889,20 @@ var Parser = class {
|
|
|
889
889
|
parseIfPipeline(...stopKeywords) {
|
|
890
890
|
const start = this.pos;
|
|
891
891
|
const steps = [];
|
|
892
|
+
const comments = [];
|
|
892
893
|
while (true) {
|
|
893
894
|
const save = this.pos;
|
|
894
895
|
this.skipSpaces();
|
|
896
|
+
const comment = this.tryParse(() => this.parseStandaloneComment());
|
|
897
|
+
if (comment) {
|
|
898
|
+
comments.push(comment);
|
|
899
|
+
continue;
|
|
900
|
+
}
|
|
895
901
|
for (const keyword of stopKeywords) {
|
|
896
902
|
if (this.text.startsWith(keyword, this.pos)) {
|
|
897
903
|
this.pos = save;
|
|
898
904
|
const end2 = this.pos;
|
|
899
|
-
return { steps, start, end: end2 };
|
|
905
|
+
return { steps, comments, start, end: end2 };
|
|
900
906
|
}
|
|
901
907
|
}
|
|
902
908
|
if (!this.text.startsWith("|>", this.pos)) {
|
|
@@ -907,14 +913,20 @@ var Parser = class {
|
|
|
907
913
|
steps.push(step);
|
|
908
914
|
}
|
|
909
915
|
const end = this.pos;
|
|
910
|
-
return { steps, start, end };
|
|
916
|
+
return { steps, comments, start, end };
|
|
911
917
|
}
|
|
912
918
|
parsePipeline() {
|
|
913
919
|
const start = this.pos;
|
|
914
920
|
const steps = [];
|
|
921
|
+
const comments = [];
|
|
915
922
|
while (true) {
|
|
916
923
|
const save = this.pos;
|
|
917
924
|
this.skipSpaces();
|
|
925
|
+
const comment = this.tryParse(() => this.parseStandaloneComment());
|
|
926
|
+
if (comment) {
|
|
927
|
+
comments.push(comment);
|
|
928
|
+
continue;
|
|
929
|
+
}
|
|
918
930
|
if (!this.text.startsWith("|>", this.pos)) {
|
|
919
931
|
this.pos = save;
|
|
920
932
|
break;
|
|
@@ -923,7 +935,7 @@ var Parser = class {
|
|
|
923
935
|
steps.push(step);
|
|
924
936
|
}
|
|
925
937
|
const end = this.pos;
|
|
926
|
-
return { steps, start, end };
|
|
938
|
+
return { steps, comments, start, end };
|
|
927
939
|
}
|
|
928
940
|
parseNamedPipeline() {
|
|
929
941
|
const start = this.pos;
|
|
@@ -1597,8 +1609,20 @@ function printPipeline(pipeline) {
|
|
|
1597
1609
|
} else {
|
|
1598
1610
|
lines.push(pipelineLine);
|
|
1599
1611
|
}
|
|
1612
|
+
const items = [];
|
|
1600
1613
|
pipeline.pipeline.steps.forEach((step) => {
|
|
1601
|
-
|
|
1614
|
+
items.push({ type: "step", item: step, position: step.start });
|
|
1615
|
+
});
|
|
1616
|
+
pipeline.pipeline.comments.forEach((comment) => {
|
|
1617
|
+
items.push({ type: "comment", item: comment, position: comment.lineNumber || 0 });
|
|
1618
|
+
});
|
|
1619
|
+
items.sort((a, b) => a.position - b.position);
|
|
1620
|
+
items.forEach((entry) => {
|
|
1621
|
+
if (entry.type === "step") {
|
|
1622
|
+
lines.push(formatPipelineStep(entry.item));
|
|
1623
|
+
} else {
|
|
1624
|
+
lines.push(` ${printComment(entry.item)}`);
|
|
1625
|
+
}
|
|
1602
1626
|
});
|
|
1603
1627
|
return lines.join("\n");
|
|
1604
1628
|
}
|
|
@@ -1997,8 +2021,20 @@ function formatPipelineRef(ref) {
|
|
|
1997
2021
|
return [` |> pipeline: ${ref.name}`];
|
|
1998
2022
|
} else {
|
|
1999
2023
|
const lines = [];
|
|
2024
|
+
const items = [];
|
|
2000
2025
|
ref.pipeline.steps.forEach((step) => {
|
|
2001
|
-
|
|
2026
|
+
items.push({ type: "step", item: step, position: step.start });
|
|
2027
|
+
});
|
|
2028
|
+
ref.pipeline.comments.forEach((comment) => {
|
|
2029
|
+
items.push({ type: "comment", item: comment, position: comment.lineNumber || 0 });
|
|
2030
|
+
});
|
|
2031
|
+
items.sort((a, b) => a.position - b.position);
|
|
2032
|
+
items.forEach((entry) => {
|
|
2033
|
+
if (entry.type === "step") {
|
|
2034
|
+
lines.push(formatPipelineStep(entry.item));
|
|
2035
|
+
} else {
|
|
2036
|
+
lines.push(` ${printComment(entry.item)}`);
|
|
2037
|
+
}
|
|
2002
2038
|
});
|
|
2003
2039
|
return lines;
|
|
2004
2040
|
}
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -836,14 +836,20 @@ var Parser = class {
|
|
|
836
836
|
parseIfPipeline(...stopKeywords) {
|
|
837
837
|
const start = this.pos;
|
|
838
838
|
const steps = [];
|
|
839
|
+
const comments = [];
|
|
839
840
|
while (true) {
|
|
840
841
|
const save = this.pos;
|
|
841
842
|
this.skipSpaces();
|
|
843
|
+
const comment = this.tryParse(() => this.parseStandaloneComment());
|
|
844
|
+
if (comment) {
|
|
845
|
+
comments.push(comment);
|
|
846
|
+
continue;
|
|
847
|
+
}
|
|
842
848
|
for (const keyword of stopKeywords) {
|
|
843
849
|
if (this.text.startsWith(keyword, this.pos)) {
|
|
844
850
|
this.pos = save;
|
|
845
851
|
const end2 = this.pos;
|
|
846
|
-
return { steps, start, end: end2 };
|
|
852
|
+
return { steps, comments, start, end: end2 };
|
|
847
853
|
}
|
|
848
854
|
}
|
|
849
855
|
if (!this.text.startsWith("|>", this.pos)) {
|
|
@@ -854,14 +860,20 @@ var Parser = class {
|
|
|
854
860
|
steps.push(step);
|
|
855
861
|
}
|
|
856
862
|
const end = this.pos;
|
|
857
|
-
return { steps, start, end };
|
|
863
|
+
return { steps, comments, start, end };
|
|
858
864
|
}
|
|
859
865
|
parsePipeline() {
|
|
860
866
|
const start = this.pos;
|
|
861
867
|
const steps = [];
|
|
868
|
+
const comments = [];
|
|
862
869
|
while (true) {
|
|
863
870
|
const save = this.pos;
|
|
864
871
|
this.skipSpaces();
|
|
872
|
+
const comment = this.tryParse(() => this.parseStandaloneComment());
|
|
873
|
+
if (comment) {
|
|
874
|
+
comments.push(comment);
|
|
875
|
+
continue;
|
|
876
|
+
}
|
|
865
877
|
if (!this.text.startsWith("|>", this.pos)) {
|
|
866
878
|
this.pos = save;
|
|
867
879
|
break;
|
|
@@ -870,7 +882,7 @@ var Parser = class {
|
|
|
870
882
|
steps.push(step);
|
|
871
883
|
}
|
|
872
884
|
const end = this.pos;
|
|
873
|
-
return { steps, start, end };
|
|
885
|
+
return { steps, comments, start, end };
|
|
874
886
|
}
|
|
875
887
|
parseNamedPipeline() {
|
|
876
888
|
const start = this.pos;
|
|
@@ -1544,8 +1556,20 @@ function printPipeline(pipeline) {
|
|
|
1544
1556
|
} else {
|
|
1545
1557
|
lines.push(pipelineLine);
|
|
1546
1558
|
}
|
|
1559
|
+
const items = [];
|
|
1547
1560
|
pipeline.pipeline.steps.forEach((step) => {
|
|
1548
|
-
|
|
1561
|
+
items.push({ type: "step", item: step, position: step.start });
|
|
1562
|
+
});
|
|
1563
|
+
pipeline.pipeline.comments.forEach((comment) => {
|
|
1564
|
+
items.push({ type: "comment", item: comment, position: comment.lineNumber || 0 });
|
|
1565
|
+
});
|
|
1566
|
+
items.sort((a, b) => a.position - b.position);
|
|
1567
|
+
items.forEach((entry) => {
|
|
1568
|
+
if (entry.type === "step") {
|
|
1569
|
+
lines.push(formatPipelineStep(entry.item));
|
|
1570
|
+
} else {
|
|
1571
|
+
lines.push(` ${printComment(entry.item)}`);
|
|
1572
|
+
}
|
|
1549
1573
|
});
|
|
1550
1574
|
return lines.join("\n");
|
|
1551
1575
|
}
|
|
@@ -1944,8 +1968,20 @@ function formatPipelineRef(ref) {
|
|
|
1944
1968
|
return [` |> pipeline: ${ref.name}`];
|
|
1945
1969
|
} else {
|
|
1946
1970
|
const lines = [];
|
|
1971
|
+
const items = [];
|
|
1947
1972
|
ref.pipeline.steps.forEach((step) => {
|
|
1948
|
-
|
|
1973
|
+
items.push({ type: "step", item: step, position: step.start });
|
|
1974
|
+
});
|
|
1975
|
+
ref.pipeline.comments.forEach((comment) => {
|
|
1976
|
+
items.push({ type: "comment", item: comment, position: comment.lineNumber || 0 });
|
|
1977
|
+
});
|
|
1978
|
+
items.sort((a, b) => a.position - b.position);
|
|
1979
|
+
items.forEach((entry) => {
|
|
1980
|
+
if (entry.type === "step") {
|
|
1981
|
+
lines.push(formatPipelineStep(entry.item));
|
|
1982
|
+
} else {
|
|
1983
|
+
lines.push(` ${printComment(entry.item)}`);
|
|
1984
|
+
}
|
|
1949
1985
|
});
|
|
1950
1986
|
return lines;
|
|
1951
1987
|
}
|