webpipe-js 2.0.29 → 2.0.31

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
@@ -1059,6 +1059,7 @@ var Parser = class {
1059
1059
  return this.parseMockHead("and");
1060
1060
  }
1061
1061
  parseLetBinding() {
1062
+ const fullStart = this.pos;
1062
1063
  this.expect("let");
1063
1064
  this.skipInlineSpaces();
1064
1065
  const nameStart = this.pos;
@@ -1120,9 +1121,19 @@ var Parser = class {
1120
1121
  }
1121
1122
  throw new Error("let value");
1122
1123
  })();
1123
- return [name, value, format];
1124
+ const fullEnd = this.pos;
1125
+ return {
1126
+ name,
1127
+ value,
1128
+ format,
1129
+ start: nameStart,
1130
+ end: nameEnd,
1131
+ fullStart,
1132
+ fullEnd
1133
+ };
1124
1134
  }
1125
1135
  parseIt() {
1136
+ const start = this.pos;
1126
1137
  this.skipSpaces();
1127
1138
  this.expect("it");
1128
1139
  this.skipInlineSpaces();
@@ -1220,6 +1231,7 @@ var Parser = class {
1220
1231
  conditions.push(c);
1221
1232
  }
1222
1233
  this.currentTestName = null;
1234
+ const end = this.pos;
1223
1235
  return {
1224
1236
  name,
1225
1237
  mocks: [...mocks, ...extraMocks],
@@ -1229,10 +1241,13 @@ var Parser = class {
1229
1241
  body,
1230
1242
  headers,
1231
1243
  cookies,
1232
- conditions
1244
+ conditions,
1245
+ start,
1246
+ end
1233
1247
  };
1234
1248
  }
1235
1249
  parseDescribe() {
1250
+ const start = this.pos;
1236
1251
  this.skipSpaces();
1237
1252
  this.expect("describe");
1238
1253
  this.skipInlineSpaces();
@@ -1270,7 +1285,8 @@ var Parser = class {
1270
1285
  break;
1271
1286
  }
1272
1287
  this.currentDescribeName = null;
1273
- return { name, variables, mocks, tests, inlineComment: inlineComment || void 0 };
1288
+ const end = this.pos;
1289
+ return { name, variables, mocks, tests, inlineComment: inlineComment || void 0, start, end };
1274
1290
  }
1275
1291
  };
1276
1292
  function parseProgram(text) {
@@ -1428,9 +1444,9 @@ function printTest(test) {
1428
1444
  });
1429
1445
  lines.push(` when ${formatWhen(test.when)}`);
1430
1446
  if (test.variables) {
1431
- test.variables.forEach(([name, value, format]) => {
1432
- const formattedValue = format === "quoted" ? `"${value}"` : format === "backtick" ? `\`${value}\`` : value;
1433
- lines.push(` let ${name} = ${formattedValue}`);
1447
+ test.variables.forEach((variable) => {
1448
+ const formattedValue = variable.format === "quoted" ? `"${variable.value}"` : variable.format === "backtick" ? `\`${variable.value}\`` : variable.value;
1449
+ lines.push(` let ${variable.name} = ${formattedValue}`);
1434
1450
  });
1435
1451
  }
1436
1452
  if (test.input) {
@@ -1468,9 +1484,9 @@ function printDescribe(describe) {
1468
1484
  lines.push(describeLine);
1469
1485
  }
1470
1486
  if (describe.variables && describe.variables.length > 0) {
1471
- describe.variables.forEach(([name, value, format]) => {
1472
- const formattedValue = format === "quoted" ? `"${value}"` : format === "backtick" ? `\`${value}\`` : value;
1473
- lines.push(` let ${name} = ${formattedValue}`);
1487
+ describe.variables.forEach((variable) => {
1488
+ const formattedValue = variable.format === "quoted" ? `"${variable.value}"` : variable.format === "backtick" ? `\`${variable.value}\`` : variable.value;
1489
+ lines.push(` let ${variable.name} = ${formattedValue}`);
1474
1490
  });
1475
1491
  lines.push("");
1476
1492
  }
@@ -89,6 +89,15 @@ interface Pipeline {
89
89
  }
90
90
  type ConfigType = 'backtick' | 'quoted' | 'identifier';
91
91
  type LetValueFormat = 'quoted' | 'backtick' | 'bare';
92
+ interface LetVariable {
93
+ name: string;
94
+ value: string;
95
+ format: LetValueFormat;
96
+ start: number;
97
+ end: number;
98
+ fullStart: number;
99
+ fullEnd: number;
100
+ }
92
101
  interface Tag {
93
102
  name: string;
94
103
  negated: boolean;
@@ -150,11 +159,13 @@ type ResultBranchType = {
150
159
  };
151
160
  interface Describe {
152
161
  name: string;
153
- variables: Array<[string, string, LetValueFormat]>;
162
+ variables: LetVariable[];
154
163
  mocks: Mock[];
155
164
  tests: It[];
156
165
  lineNumber?: number;
157
166
  inlineComment?: Comment;
167
+ start: number;
168
+ end: number;
158
169
  }
159
170
  interface Mock {
160
171
  target: string;
@@ -164,12 +175,14 @@ interface It {
164
175
  name: string;
165
176
  mocks: Mock[];
166
177
  when: When;
167
- variables?: Array<[string, string, LetValueFormat]>;
178
+ variables?: LetVariable[];
168
179
  input?: string;
169
180
  body?: string;
170
181
  headers?: string;
171
182
  cookies?: string;
172
183
  conditions: Condition[];
184
+ start: number;
185
+ end: number;
173
186
  }
174
187
  type When = {
175
188
  kind: 'CallingRoute';
@@ -259,4 +272,4 @@ declare function formatTagExpr(expr: TagExpr): string;
259
272
  declare function formatPipelineRef(ref: PipelineRef): string[];
260
273
  declare function formatWhen(when: When): string;
261
274
 
262
- export { type Comment, type Condition, type Config, type ConfigProperty, type ConfigType, type ConfigValue, type Describe, type DiagnosticSeverity, type DispatchBranch, type DomAssertType, type GraphQLSchema, type It, type LetValueFormat, type Mock, type MutationResolver, type NamedPipeline, type ParseDiagnostic, type Pipeline, type PipelineRef, type PipelineStep, type Program, type QueryResolver, type ResultBranch, type ResultBranchType, type Route, type Tag, type TagExpr, type TestLetVariable, type Variable, type When, formatConfigValue, formatPipelineRef, formatPipelineStep, formatStepConfig, formatTag, formatTagExpr, formatTags, formatWhen, getPipelineRanges, getTestLetVariableRanges, getTestLetVariables, getVariableRanges, parseProgram, parseProgramWithDiagnostics, prettyPrint, printComment, printCondition, printConfig, printDescribe, printGraphQLSchema, printMock, printMutationResolver, printPipeline, printQueryResolver, printRoute, printTest, printVariable };
275
+ export { type Comment, type Condition, type Config, type ConfigProperty, type ConfigType, type ConfigValue, type Describe, type DiagnosticSeverity, type DispatchBranch, type DomAssertType, type GraphQLSchema, type It, type LetValueFormat, type LetVariable, type Mock, type MutationResolver, type NamedPipeline, type ParseDiagnostic, type Pipeline, type PipelineRef, type PipelineStep, type Program, type QueryResolver, type ResultBranch, type ResultBranchType, type Route, type Tag, type TagExpr, type TestLetVariable, type Variable, type When, formatConfigValue, formatPipelineRef, formatPipelineStep, formatStepConfig, formatTag, formatTagExpr, formatTags, formatWhen, getPipelineRanges, getTestLetVariableRanges, getTestLetVariables, getVariableRanges, parseProgram, parseProgramWithDiagnostics, prettyPrint, printComment, printCondition, printConfig, printDescribe, printGraphQLSchema, printMock, printMutationResolver, printPipeline, printQueryResolver, printRoute, printTest, printVariable };
package/dist/index.d.ts CHANGED
@@ -89,6 +89,15 @@ interface Pipeline {
89
89
  }
90
90
  type ConfigType = 'backtick' | 'quoted' | 'identifier';
91
91
  type LetValueFormat = 'quoted' | 'backtick' | 'bare';
92
+ interface LetVariable {
93
+ name: string;
94
+ value: string;
95
+ format: LetValueFormat;
96
+ start: number;
97
+ end: number;
98
+ fullStart: number;
99
+ fullEnd: number;
100
+ }
92
101
  interface Tag {
93
102
  name: string;
94
103
  negated: boolean;
@@ -150,11 +159,13 @@ type ResultBranchType = {
150
159
  };
151
160
  interface Describe {
152
161
  name: string;
153
- variables: Array<[string, string, LetValueFormat]>;
162
+ variables: LetVariable[];
154
163
  mocks: Mock[];
155
164
  tests: It[];
156
165
  lineNumber?: number;
157
166
  inlineComment?: Comment;
167
+ start: number;
168
+ end: number;
158
169
  }
159
170
  interface Mock {
160
171
  target: string;
@@ -164,12 +175,14 @@ interface It {
164
175
  name: string;
165
176
  mocks: Mock[];
166
177
  when: When;
167
- variables?: Array<[string, string, LetValueFormat]>;
178
+ variables?: LetVariable[];
168
179
  input?: string;
169
180
  body?: string;
170
181
  headers?: string;
171
182
  cookies?: string;
172
183
  conditions: Condition[];
184
+ start: number;
185
+ end: number;
173
186
  }
174
187
  type When = {
175
188
  kind: 'CallingRoute';
@@ -259,4 +272,4 @@ declare function formatTagExpr(expr: TagExpr): string;
259
272
  declare function formatPipelineRef(ref: PipelineRef): string[];
260
273
  declare function formatWhen(when: When): string;
261
274
 
262
- export { type Comment, type Condition, type Config, type ConfigProperty, type ConfigType, type ConfigValue, type Describe, type DiagnosticSeverity, type DispatchBranch, type DomAssertType, type GraphQLSchema, type It, type LetValueFormat, type Mock, type MutationResolver, type NamedPipeline, type ParseDiagnostic, type Pipeline, type PipelineRef, type PipelineStep, type Program, type QueryResolver, type ResultBranch, type ResultBranchType, type Route, type Tag, type TagExpr, type TestLetVariable, type Variable, type When, formatConfigValue, formatPipelineRef, formatPipelineStep, formatStepConfig, formatTag, formatTagExpr, formatTags, formatWhen, getPipelineRanges, getTestLetVariableRanges, getTestLetVariables, getVariableRanges, parseProgram, parseProgramWithDiagnostics, prettyPrint, printComment, printCondition, printConfig, printDescribe, printGraphQLSchema, printMock, printMutationResolver, printPipeline, printQueryResolver, printRoute, printTest, printVariable };
275
+ export { type Comment, type Condition, type Config, type ConfigProperty, type ConfigType, type ConfigValue, type Describe, type DiagnosticSeverity, type DispatchBranch, type DomAssertType, type GraphQLSchema, type It, type LetValueFormat, type LetVariable, type Mock, type MutationResolver, type NamedPipeline, type ParseDiagnostic, type Pipeline, type PipelineRef, type PipelineStep, type Program, type QueryResolver, type ResultBranch, type ResultBranchType, type Route, type Tag, type TagExpr, type TestLetVariable, type Variable, type When, formatConfigValue, formatPipelineRef, formatPipelineStep, formatStepConfig, formatTag, formatTagExpr, formatTags, formatWhen, getPipelineRanges, getTestLetVariableRanges, getTestLetVariables, getVariableRanges, parseProgram, parseProgramWithDiagnostics, prettyPrint, printComment, printCondition, printConfig, printDescribe, printGraphQLSchema, printMock, printMutationResolver, printPipeline, printQueryResolver, printRoute, printTest, printVariable };
package/dist/index.mjs CHANGED
@@ -1007,6 +1007,7 @@ var Parser = class {
1007
1007
  return this.parseMockHead("and");
1008
1008
  }
1009
1009
  parseLetBinding() {
1010
+ const fullStart = this.pos;
1010
1011
  this.expect("let");
1011
1012
  this.skipInlineSpaces();
1012
1013
  const nameStart = this.pos;
@@ -1068,9 +1069,19 @@ var Parser = class {
1068
1069
  }
1069
1070
  throw new Error("let value");
1070
1071
  })();
1071
- return [name, value, format];
1072
+ const fullEnd = this.pos;
1073
+ return {
1074
+ name,
1075
+ value,
1076
+ format,
1077
+ start: nameStart,
1078
+ end: nameEnd,
1079
+ fullStart,
1080
+ fullEnd
1081
+ };
1072
1082
  }
1073
1083
  parseIt() {
1084
+ const start = this.pos;
1074
1085
  this.skipSpaces();
1075
1086
  this.expect("it");
1076
1087
  this.skipInlineSpaces();
@@ -1168,6 +1179,7 @@ var Parser = class {
1168
1179
  conditions.push(c);
1169
1180
  }
1170
1181
  this.currentTestName = null;
1182
+ const end = this.pos;
1171
1183
  return {
1172
1184
  name,
1173
1185
  mocks: [...mocks, ...extraMocks],
@@ -1177,10 +1189,13 @@ var Parser = class {
1177
1189
  body,
1178
1190
  headers,
1179
1191
  cookies,
1180
- conditions
1192
+ conditions,
1193
+ start,
1194
+ end
1181
1195
  };
1182
1196
  }
1183
1197
  parseDescribe() {
1198
+ const start = this.pos;
1184
1199
  this.skipSpaces();
1185
1200
  this.expect("describe");
1186
1201
  this.skipInlineSpaces();
@@ -1218,7 +1233,8 @@ var Parser = class {
1218
1233
  break;
1219
1234
  }
1220
1235
  this.currentDescribeName = null;
1221
- return { name, variables, mocks, tests, inlineComment: inlineComment || void 0 };
1236
+ const end = this.pos;
1237
+ return { name, variables, mocks, tests, inlineComment: inlineComment || void 0, start, end };
1222
1238
  }
1223
1239
  };
1224
1240
  function parseProgram(text) {
@@ -1376,9 +1392,9 @@ function printTest(test) {
1376
1392
  });
1377
1393
  lines.push(` when ${formatWhen(test.when)}`);
1378
1394
  if (test.variables) {
1379
- test.variables.forEach(([name, value, format]) => {
1380
- const formattedValue = format === "quoted" ? `"${value}"` : format === "backtick" ? `\`${value}\`` : value;
1381
- lines.push(` let ${name} = ${formattedValue}`);
1395
+ test.variables.forEach((variable) => {
1396
+ const formattedValue = variable.format === "quoted" ? `"${variable.value}"` : variable.format === "backtick" ? `\`${variable.value}\`` : variable.value;
1397
+ lines.push(` let ${variable.name} = ${formattedValue}`);
1382
1398
  });
1383
1399
  }
1384
1400
  if (test.input) {
@@ -1416,9 +1432,9 @@ function printDescribe(describe) {
1416
1432
  lines.push(describeLine);
1417
1433
  }
1418
1434
  if (describe.variables && describe.variables.length > 0) {
1419
- describe.variables.forEach(([name, value, format]) => {
1420
- const formattedValue = format === "quoted" ? `"${value}"` : format === "backtick" ? `\`${value}\`` : value;
1421
- lines.push(` let ${name} = ${formattedValue}`);
1435
+ describe.variables.forEach((variable) => {
1436
+ const formattedValue = variable.format === "quoted" ? `"${variable.value}"` : variable.format === "backtick" ? `\`${variable.value}\`` : variable.value;
1437
+ lines.push(` let ${variable.name} = ${formattedValue}`);
1422
1438
  });
1423
1439
  lines.push("");
1424
1440
  }
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "webpipe-js",
3
- "version": "2.0.29",
3
+ "version": "2.0.31",
4
4
  "description": "Web Pipe parser",
5
5
  "license": "ISC",
6
6
  "author": "William Cotton",
7
+ "type": "module",
7
8
  "main": "./dist/index.cjs",
8
9
  "module": "./dist/index.mjs",
9
10
  "types": "./dist/index.d.ts",