webpipe-js 2.0.15 → 2.0.17

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
@@ -943,42 +943,58 @@ var Parser = class {
943
943
  this.skipInlineSpaces();
944
944
  const when = this.parseWhen();
945
945
  this.skipSpaces();
946
- const input = this.tryParse(() => {
947
- this.expect("with");
948
- this.skipInlineSpaces();
949
- this.expect("input");
950
- this.skipInlineSpaces();
951
- const v = this.parseBacktickString();
952
- this.skipSpaces();
953
- return v;
954
- }) ?? void 0;
955
- const body = this.tryParse(() => {
956
- this.expect("with");
957
- this.skipInlineSpaces();
958
- this.expect("body");
959
- this.skipInlineSpaces();
960
- const v = this.parseBacktickString();
961
- this.skipSpaces();
962
- return v;
963
- }) ?? void 0;
964
- const headers = this.tryParse(() => {
965
- this.expect("with");
966
- this.skipInlineSpaces();
967
- this.expect("headers");
968
- this.skipInlineSpaces();
969
- const v = this.parseBacktickString();
970
- this.skipSpaces();
971
- return v;
972
- }) ?? void 0;
973
- const cookies = this.tryParse(() => {
974
- this.expect("with");
975
- this.skipInlineSpaces();
976
- this.expect("cookies");
977
- this.skipInlineSpaces();
978
- const v = this.parseBacktickString();
979
- this.skipSpaces();
980
- return v;
981
- }) ?? void 0;
946
+ let input;
947
+ let body;
948
+ let headers;
949
+ let cookies;
950
+ let firstWithClause = true;
951
+ while (true) {
952
+ const parsed = this.tryParse(() => {
953
+ if (firstWithClause) {
954
+ this.expect("with");
955
+ } else {
956
+ this.expect("and");
957
+ this.skipInlineSpaces();
958
+ this.expect("with");
959
+ }
960
+ this.skipInlineSpaces();
961
+ if (this.text.startsWith("input", this.pos)) {
962
+ this.expect("input");
963
+ this.skipInlineSpaces();
964
+ const v = this.parseBacktickString();
965
+ this.skipSpaces();
966
+ return { type: "input", value: v };
967
+ } else if (this.text.startsWith("body", this.pos)) {
968
+ this.expect("body");
969
+ this.skipInlineSpaces();
970
+ const v = this.parseBacktickString();
971
+ this.skipSpaces();
972
+ return { type: "body", value: v };
973
+ } else if (this.text.startsWith("headers", this.pos)) {
974
+ this.expect("headers");
975
+ this.skipInlineSpaces();
976
+ const v = this.parseBacktickString();
977
+ this.skipSpaces();
978
+ return { type: "headers", value: v };
979
+ } else if (this.text.startsWith("cookies", this.pos)) {
980
+ this.expect("cookies");
981
+ this.skipInlineSpaces();
982
+ const v = this.parseBacktickString();
983
+ this.skipSpaces();
984
+ return { type: "cookies", value: v };
985
+ } else if (this.text.startsWith("mock", this.pos)) {
986
+ throw new Error("mock");
987
+ } else {
988
+ throw new Error("unknown with clause");
989
+ }
990
+ });
991
+ if (!parsed) break;
992
+ if (parsed.type === "input") input = parsed.value;
993
+ else if (parsed.type === "body") body = parsed.value;
994
+ else if (parsed.type === "headers") headers = parsed.value;
995
+ else if (parsed.type === "cookies") cookies = parsed.value;
996
+ firstWithClause = false;
997
+ }
982
998
  const extraMocks = [];
983
999
  while (true) {
984
1000
  const m = this.tryParse(() => this.parseAndMock());
package/dist/index.mjs CHANGED
@@ -893,42 +893,58 @@ var Parser = class {
893
893
  this.skipInlineSpaces();
894
894
  const when = this.parseWhen();
895
895
  this.skipSpaces();
896
- const input = this.tryParse(() => {
897
- this.expect("with");
898
- this.skipInlineSpaces();
899
- this.expect("input");
900
- this.skipInlineSpaces();
901
- const v = this.parseBacktickString();
902
- this.skipSpaces();
903
- return v;
904
- }) ?? void 0;
905
- const body = this.tryParse(() => {
906
- this.expect("with");
907
- this.skipInlineSpaces();
908
- this.expect("body");
909
- this.skipInlineSpaces();
910
- const v = this.parseBacktickString();
911
- this.skipSpaces();
912
- return v;
913
- }) ?? void 0;
914
- const headers = this.tryParse(() => {
915
- this.expect("with");
916
- this.skipInlineSpaces();
917
- this.expect("headers");
918
- this.skipInlineSpaces();
919
- const v = this.parseBacktickString();
920
- this.skipSpaces();
921
- return v;
922
- }) ?? void 0;
923
- const cookies = this.tryParse(() => {
924
- this.expect("with");
925
- this.skipInlineSpaces();
926
- this.expect("cookies");
927
- this.skipInlineSpaces();
928
- const v = this.parseBacktickString();
929
- this.skipSpaces();
930
- return v;
931
- }) ?? void 0;
896
+ let input;
897
+ let body;
898
+ let headers;
899
+ let cookies;
900
+ let firstWithClause = true;
901
+ while (true) {
902
+ const parsed = this.tryParse(() => {
903
+ if (firstWithClause) {
904
+ this.expect("with");
905
+ } else {
906
+ this.expect("and");
907
+ this.skipInlineSpaces();
908
+ this.expect("with");
909
+ }
910
+ this.skipInlineSpaces();
911
+ if (this.text.startsWith("input", this.pos)) {
912
+ this.expect("input");
913
+ this.skipInlineSpaces();
914
+ const v = this.parseBacktickString();
915
+ this.skipSpaces();
916
+ return { type: "input", value: v };
917
+ } else if (this.text.startsWith("body", this.pos)) {
918
+ this.expect("body");
919
+ this.skipInlineSpaces();
920
+ const v = this.parseBacktickString();
921
+ this.skipSpaces();
922
+ return { type: "body", value: v };
923
+ } else if (this.text.startsWith("headers", this.pos)) {
924
+ this.expect("headers");
925
+ this.skipInlineSpaces();
926
+ const v = this.parseBacktickString();
927
+ this.skipSpaces();
928
+ return { type: "headers", value: v };
929
+ } else if (this.text.startsWith("cookies", this.pos)) {
930
+ this.expect("cookies");
931
+ this.skipInlineSpaces();
932
+ const v = this.parseBacktickString();
933
+ this.skipSpaces();
934
+ return { type: "cookies", value: v };
935
+ } else if (this.text.startsWith("mock", this.pos)) {
936
+ throw new Error("mock");
937
+ } else {
938
+ throw new Error("unknown with clause");
939
+ }
940
+ });
941
+ if (!parsed) break;
942
+ if (parsed.type === "input") input = parsed.value;
943
+ else if (parsed.type === "body") body = parsed.value;
944
+ else if (parsed.type === "headers") headers = parsed.value;
945
+ else if (parsed.type === "cookies") cookies = parsed.value;
946
+ firstWithClause = false;
947
+ }
932
948
  const extraMocks = [];
933
949
  while (true) {
934
950
  const m = this.tryParse(() => this.parseAndMock());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpipe-js",
3
- "version": "2.0.15",
3
+ "version": "2.0.17",
4
4
  "description": "Web Pipe parser",
5
5
  "license": "ISC",
6
6
  "author": "William Cotton",