webpipe-js 2.0.37 → 2.0.39

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
@@ -71,7 +71,11 @@ var Parser = class {
71
71
  return new Map(this.pipelineRanges);
72
72
  }
73
73
  getVariableRanges() {
74
- return new Map(this.variableRanges);
74
+ const copy = /* @__PURE__ */ new Map();
75
+ for (const [varType, byName] of this.variableRanges.entries()) {
76
+ copy.set(varType, new Map(byName));
77
+ }
78
+ return copy;
75
79
  }
76
80
  getTestLetVariables() {
77
81
  return [...this.testLetVariables];
@@ -964,7 +968,10 @@ var Parser = class {
964
968
  const value = this.parseBacktickString();
965
969
  const inlineComment = this.parseInlineComment();
966
970
  const end = this.pos;
967
- this.variableRanges.set(`${varType}::${name}`, { start, end });
971
+ if (!this.variableRanges.has(varType)) {
972
+ this.variableRanges.set(varType, /* @__PURE__ */ new Map());
973
+ }
974
+ this.variableRanges.get(varType).set(name, { start, end });
968
975
  this.skipWhitespaceOnly();
969
976
  return { varType, name, value, inlineComment: inlineComment || void 0, start, end };
970
977
  }
@@ -1248,6 +1255,7 @@ var Parser = class {
1248
1255
  this.skipInlineSpaces();
1249
1256
  this.expect("mock");
1250
1257
  this.skipInlineSpaces();
1258
+ const targetStart = this.pos;
1251
1259
  let target;
1252
1260
  if (this.text.startsWith("query ", this.pos) || this.text.startsWith("mutation ", this.pos)) {
1253
1261
  const type = this.consumeWhile((c) => c !== " ");
@@ -1263,7 +1271,7 @@ var Parser = class {
1263
1271
  const returnValue = this.parseBacktickString();
1264
1272
  this.skipSpaces();
1265
1273
  const end = this.pos;
1266
- return { target, returnValue, start, end };
1274
+ return { target, targetStart, returnValue, start, end };
1267
1275
  }
1268
1276
  parseMock() {
1269
1277
  return this.parseMockHead("with");
package/dist/index.d.cts CHANGED
@@ -220,6 +220,7 @@ interface Describe {
220
220
  }
221
221
  interface Mock {
222
222
  target: string;
223
+ targetStart: number;
223
224
  returnValue: string;
224
225
  start: number;
225
226
  end: number;
@@ -304,10 +305,10 @@ declare function getPipelineRanges(text: string): Map<string, {
304
305
  start: number;
305
306
  end: number;
306
307
  }>;
307
- declare function getVariableRanges(text: string): Map<string, {
308
+ declare function getVariableRanges(text: string): Map<string, Map<string, {
308
309
  start: number;
309
310
  end: number;
310
- }>;
311
+ }>>;
311
312
  declare function getTestLetVariables(text: string): TestLetVariable[];
312
313
  declare function getTestLetVariableRanges(text: string): Map<string, {
313
314
  start: number;
package/dist/index.d.ts CHANGED
@@ -220,6 +220,7 @@ interface Describe {
220
220
  }
221
221
  interface Mock {
222
222
  target: string;
223
+ targetStart: number;
223
224
  returnValue: string;
224
225
  start: number;
225
226
  end: number;
@@ -304,10 +305,10 @@ declare function getPipelineRanges(text: string): Map<string, {
304
305
  start: number;
305
306
  end: number;
306
307
  }>;
307
- declare function getVariableRanges(text: string): Map<string, {
308
+ declare function getVariableRanges(text: string): Map<string, Map<string, {
308
309
  start: number;
309
310
  end: number;
310
- }>;
311
+ }>>;
311
312
  declare function getTestLetVariables(text: string): TestLetVariable[];
312
313
  declare function getTestLetVariableRanges(text: string): Map<string, {
313
314
  start: number;
package/dist/index.mjs CHANGED
@@ -18,7 +18,11 @@ var Parser = class {
18
18
  return new Map(this.pipelineRanges);
19
19
  }
20
20
  getVariableRanges() {
21
- return new Map(this.variableRanges);
21
+ const copy = /* @__PURE__ */ new Map();
22
+ for (const [varType, byName] of this.variableRanges.entries()) {
23
+ copy.set(varType, new Map(byName));
24
+ }
25
+ return copy;
22
26
  }
23
27
  getTestLetVariables() {
24
28
  return [...this.testLetVariables];
@@ -911,7 +915,10 @@ var Parser = class {
911
915
  const value = this.parseBacktickString();
912
916
  const inlineComment = this.parseInlineComment();
913
917
  const end = this.pos;
914
- this.variableRanges.set(`${varType}::${name}`, { start, end });
918
+ if (!this.variableRanges.has(varType)) {
919
+ this.variableRanges.set(varType, /* @__PURE__ */ new Map());
920
+ }
921
+ this.variableRanges.get(varType).set(name, { start, end });
915
922
  this.skipWhitespaceOnly();
916
923
  return { varType, name, value, inlineComment: inlineComment || void 0, start, end };
917
924
  }
@@ -1195,6 +1202,7 @@ var Parser = class {
1195
1202
  this.skipInlineSpaces();
1196
1203
  this.expect("mock");
1197
1204
  this.skipInlineSpaces();
1205
+ const targetStart = this.pos;
1198
1206
  let target;
1199
1207
  if (this.text.startsWith("query ", this.pos) || this.text.startsWith("mutation ", this.pos)) {
1200
1208
  const type = this.consumeWhile((c) => c !== " ");
@@ -1210,7 +1218,7 @@ var Parser = class {
1210
1218
  const returnValue = this.parseBacktickString();
1211
1219
  this.skipSpaces();
1212
1220
  const end = this.pos;
1213
- return { target, returnValue, start, end };
1221
+ return { target, targetStart, returnValue, start, end };
1214
1222
  }
1215
1223
  parseMock() {
1216
1224
  return this.parseMockHead("with");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpipe-js",
3
- "version": "2.0.37",
3
+ "version": "2.0.39",
4
4
  "description": "Web Pipe parser",
5
5
  "license": "ISC",
6
6
  "author": "William Cotton",