webpipe-js 2.0.19 → 2.0.21
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 +22 -6
- package/dist/index.mjs +22 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -367,7 +367,7 @@ var Parser = class {
|
|
|
367
367
|
if (this.cur() === ")") {
|
|
368
368
|
throw new ParseFailure("empty tag arguments not allowed", this.pos);
|
|
369
369
|
}
|
|
370
|
-
args.push(this.
|
|
370
|
+
args.push(this.parseTagArgument());
|
|
371
371
|
this.skipInlineSpaces();
|
|
372
372
|
while (this.cur() === ",") {
|
|
373
373
|
this.pos++;
|
|
@@ -375,12 +375,17 @@ var Parser = class {
|
|
|
375
375
|
if (this.cur() === ")") {
|
|
376
376
|
throw new ParseFailure("trailing comma in tag arguments", this.pos);
|
|
377
377
|
}
|
|
378
|
-
args.push(this.
|
|
378
|
+
args.push(this.parseTagArgument());
|
|
379
379
|
this.skipInlineSpaces();
|
|
380
380
|
}
|
|
381
381
|
this.expect(")");
|
|
382
382
|
return args;
|
|
383
383
|
}
|
|
384
|
+
parseTagArgument() {
|
|
385
|
+
const bt = this.tryParse(() => this.parseBacktickString());
|
|
386
|
+
if (bt !== null) return bt;
|
|
387
|
+
return this.parseIdentifier();
|
|
388
|
+
}
|
|
384
389
|
parseTags() {
|
|
385
390
|
const tags = [];
|
|
386
391
|
while (!this.eof()) {
|
|
@@ -1064,9 +1069,14 @@ var Parser = class {
|
|
|
1064
1069
|
const tests = [];
|
|
1065
1070
|
while (true) {
|
|
1066
1071
|
this.skipSpaces();
|
|
1067
|
-
const
|
|
1068
|
-
if (
|
|
1069
|
-
mocks.push(
|
|
1072
|
+
const withMock = this.tryParse(() => this.parseMock());
|
|
1073
|
+
if (withMock) {
|
|
1074
|
+
mocks.push(withMock);
|
|
1075
|
+
continue;
|
|
1076
|
+
}
|
|
1077
|
+
const andMock = this.tryParse(() => this.parseAndMock());
|
|
1078
|
+
if (andMock) {
|
|
1079
|
+
mocks.push(andMock);
|
|
1070
1080
|
continue;
|
|
1071
1081
|
}
|
|
1072
1082
|
const it = this.tryParse(() => this.parseIt());
|
|
@@ -1401,7 +1411,13 @@ function formatTags(tags) {
|
|
|
1401
1411
|
}
|
|
1402
1412
|
function formatTag(tag) {
|
|
1403
1413
|
const negation = tag.negated ? "!" : "";
|
|
1404
|
-
const
|
|
1414
|
+
const formattedArgs = tag.args.map((arg) => {
|
|
1415
|
+
if (/[^a-zA-Z0-9_-]/.test(arg)) {
|
|
1416
|
+
return `\`${arg}\``;
|
|
1417
|
+
}
|
|
1418
|
+
return arg;
|
|
1419
|
+
});
|
|
1420
|
+
const args = tag.args.length > 0 ? `(${formattedArgs.join(",")})` : "";
|
|
1405
1421
|
return `@${negation}${tag.name}${args}`;
|
|
1406
1422
|
}
|
|
1407
1423
|
function formatTagExpr(expr) {
|
package/dist/index.mjs
CHANGED
|
@@ -317,7 +317,7 @@ var Parser = class {
|
|
|
317
317
|
if (this.cur() === ")") {
|
|
318
318
|
throw new ParseFailure("empty tag arguments not allowed", this.pos);
|
|
319
319
|
}
|
|
320
|
-
args.push(this.
|
|
320
|
+
args.push(this.parseTagArgument());
|
|
321
321
|
this.skipInlineSpaces();
|
|
322
322
|
while (this.cur() === ",") {
|
|
323
323
|
this.pos++;
|
|
@@ -325,12 +325,17 @@ var Parser = class {
|
|
|
325
325
|
if (this.cur() === ")") {
|
|
326
326
|
throw new ParseFailure("trailing comma in tag arguments", this.pos);
|
|
327
327
|
}
|
|
328
|
-
args.push(this.
|
|
328
|
+
args.push(this.parseTagArgument());
|
|
329
329
|
this.skipInlineSpaces();
|
|
330
330
|
}
|
|
331
331
|
this.expect(")");
|
|
332
332
|
return args;
|
|
333
333
|
}
|
|
334
|
+
parseTagArgument() {
|
|
335
|
+
const bt = this.tryParse(() => this.parseBacktickString());
|
|
336
|
+
if (bt !== null) return bt;
|
|
337
|
+
return this.parseIdentifier();
|
|
338
|
+
}
|
|
334
339
|
parseTags() {
|
|
335
340
|
const tags = [];
|
|
336
341
|
while (!this.eof()) {
|
|
@@ -1014,9 +1019,14 @@ var Parser = class {
|
|
|
1014
1019
|
const tests = [];
|
|
1015
1020
|
while (true) {
|
|
1016
1021
|
this.skipSpaces();
|
|
1017
|
-
const
|
|
1018
|
-
if (
|
|
1019
|
-
mocks.push(
|
|
1022
|
+
const withMock = this.tryParse(() => this.parseMock());
|
|
1023
|
+
if (withMock) {
|
|
1024
|
+
mocks.push(withMock);
|
|
1025
|
+
continue;
|
|
1026
|
+
}
|
|
1027
|
+
const andMock = this.tryParse(() => this.parseAndMock());
|
|
1028
|
+
if (andMock) {
|
|
1029
|
+
mocks.push(andMock);
|
|
1020
1030
|
continue;
|
|
1021
1031
|
}
|
|
1022
1032
|
const it = this.tryParse(() => this.parseIt());
|
|
@@ -1351,7 +1361,13 @@ function formatTags(tags) {
|
|
|
1351
1361
|
}
|
|
1352
1362
|
function formatTag(tag) {
|
|
1353
1363
|
const negation = tag.negated ? "!" : "";
|
|
1354
|
-
const
|
|
1364
|
+
const formattedArgs = tag.args.map((arg) => {
|
|
1365
|
+
if (/[^a-zA-Z0-9_-]/.test(arg)) {
|
|
1366
|
+
return `\`${arg}\``;
|
|
1367
|
+
}
|
|
1368
|
+
return arg;
|
|
1369
|
+
});
|
|
1370
|
+
const args = tag.args.length > 0 ? `(${formattedArgs.join(",")})` : "";
|
|
1355
1371
|
return `@${negation}${tag.name}${args}`;
|
|
1356
1372
|
}
|
|
1357
1373
|
function formatTagExpr(expr) {
|