@cjser/jsdoc-type-pratt-parser 9.1.2-cjser.2 → 9.2.2-cjser.2
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.d.mts +2 -1
- package/dist/index.mjs +54 -33
- package/dist-cjser/index.cjs +45 -23
- package/package.json +15 -12
package/dist/index.d.mts
CHANGED
|
@@ -486,11 +486,12 @@ declare function parse(expression: string, mode: ParseMode, { range, rangeStart,
|
|
|
486
486
|
* @param expression
|
|
487
487
|
* @param modes
|
|
488
488
|
*/
|
|
489
|
-
declare function tryParse(expression: string, modes?: ParseMode[], { module, strictMode, asyncFunctionBody, classContext, range, rangeStart, loc, locStart }?: {
|
|
489
|
+
declare function tryParse(expression: string, modes?: ParseMode[], { module, strictMode, asyncFunctionBody, classContext, computedPropertyParser, range, rangeStart, loc, locStart }?: {
|
|
490
490
|
module?: boolean;
|
|
491
491
|
strictMode?: boolean;
|
|
492
492
|
asyncFunctionBody?: boolean;
|
|
493
493
|
classContext?: boolean;
|
|
494
|
+
computedPropertyParser?: (text: string, options?: any) => unknown;
|
|
494
495
|
range?: boolean;
|
|
495
496
|
rangeStart?: number;
|
|
496
497
|
loc?: boolean;
|
package/dist/index.mjs
CHANGED
|
@@ -897,11 +897,13 @@ function createObjectParslet({ signatureGrammar, objectFieldGrammar, allowKeyTyp
|
|
|
897
897
|
if (parser.lexer.current.startOfLine) {
|
|
898
898
|
separator ??= "linebreak";
|
|
899
899
|
parser.consume(",") || parser.consume(";");
|
|
900
|
-
} else if (parser.consume(","))
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
else
|
|
904
|
-
|
|
900
|
+
} else if (parser.consume(",")) {
|
|
901
|
+
if (parser.lexer.current.startOfLine) separator = "comma-and-linebreak";
|
|
902
|
+
else separator = "comma";
|
|
903
|
+
} else if (parser.consume(";")) {
|
|
904
|
+
if (parser.lexer.current.startOfLine) separator = "semicolon-and-linebreak";
|
|
905
|
+
else separator = "semicolon";
|
|
906
|
+
} else break;
|
|
905
907
|
if (parser.lexer.current.type === "}") break;
|
|
906
908
|
}
|
|
907
909
|
result.meta.separator = separator ?? "comma";
|
|
@@ -1282,9 +1284,10 @@ function createTupleParslet({ allowQuestionMark }) {
|
|
|
1282
1284
|
};
|
|
1283
1285
|
if (parser.consume("]")) return result;
|
|
1284
1286
|
const typeList = parser.parseIntermediateType(0);
|
|
1285
|
-
if (typeList.type === "JsdocTypeParameterList")
|
|
1286
|
-
|
|
1287
|
-
|
|
1287
|
+
if (typeList.type === "JsdocTypeParameterList") {
|
|
1288
|
+
if (typeList.elements[0].type === "JsdocTypeKeyValue") result.elements = typeList.elements.map(assertPlainKeyValueResult);
|
|
1289
|
+
else result.elements = typeList.elements.map(assertRootResult);
|
|
1290
|
+
} else if (typeList.type === "JsdocTypeKeyValue") result.elements = [assertPlainKeyValueResult(typeList)];
|
|
1288
1291
|
else result.elements = [assertRootResult(typeList)];
|
|
1289
1292
|
if (!parser.consume("]")) throw new Error("Unterminated '['");
|
|
1290
1293
|
if (!allowQuestionMark && result.elements.some((e) => e.type === "JsdocTypeUnknown")) throw new Error("Question mark in tuple not allowed");
|
|
@@ -1313,9 +1316,8 @@ const inferParslet = composeParslet({
|
|
|
1313
1316
|
parsePrefix: (parser) => {
|
|
1314
1317
|
parser.consume("infer");
|
|
1315
1318
|
const element = parser.parseIntermediateType(12);
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
throw new UnexpectedTypeError(element, "A typescript infer always has to have a name.");
|
|
1319
|
+
/* c8 ignore next 3 -- c8 does not mark the exercised throw as covered */
|
|
1320
|
+
if (element.type !== "JsdocTypeName") throw new UnexpectedTypeError(element, "A typescript infer always has to have a name.");
|
|
1319
1321
|
return {
|
|
1320
1322
|
type: "JsdocTypeInfer",
|
|
1321
1323
|
element
|
|
@@ -1499,6 +1501,9 @@ var Lexer = class Lexer {
|
|
|
1499
1501
|
const next = Lexer.read(this.lexerRules, this.text);
|
|
1500
1502
|
return new Lexer(this.lexerRules, next.text, this.current, this.next, next.token);
|
|
1501
1503
|
}
|
|
1504
|
+
clone() {
|
|
1505
|
+
return new Lexer(this.lexerRules, this.text, this.previous, this.current, this.next);
|
|
1506
|
+
}
|
|
1502
1507
|
};
|
|
1503
1508
|
//#endregion
|
|
1504
1509
|
//#region src/parslets/ObjectSquaredPropertyParslet.ts
|
|
@@ -1509,7 +1514,15 @@ const objectSquaredPropertyParslet = composeParslet({
|
|
|
1509
1514
|
if (parser.baseParser === void 0) throw new Error("Only allowed inside object grammar");
|
|
1510
1515
|
parser.consume("[");
|
|
1511
1516
|
let innerBracketType;
|
|
1512
|
-
|
|
1517
|
+
let isIndexSignatureOrMappedType = false;
|
|
1518
|
+
if (parser.externalParsers?.computedPropertyParser !== void 0) try {
|
|
1519
|
+
const tryLexer = parser.lexer.clone();
|
|
1520
|
+
const tryParser = new Parser(parser.grammar, tryLexer, parser.baseParser, { externalParsers: parser.externalParsers });
|
|
1521
|
+
const parsedType = tryParser.parseIntermediateType(2);
|
|
1522
|
+
const isMapped = parsedType?.type === "JsdocTypeName" && tryParser.consume("in");
|
|
1523
|
+
if (parsedType?.type === "JsdocTypeObjectField" && typeof parsedType.key === "string" && !parsedType.optional && !parsedType.readonly && parsedType.right !== void 0 || isMapped) isIndexSignatureOrMappedType = true;
|
|
1524
|
+
} catch (err) {}
|
|
1525
|
+
if (isIndexSignatureOrMappedType || parser.externalParsers?.computedPropertyParser === void 0) try {
|
|
1513
1526
|
innerBracketType = parser.parseIntermediateType(2);
|
|
1514
1527
|
} catch (err) {
|
|
1515
1528
|
throw new Error("Error parsing value inside square bracketed property.", { cause: err });
|
|
@@ -1618,7 +1631,10 @@ const objectSquaredPropertyParslet = composeParslet({
|
|
|
1618
1631
|
type = "JsdocTypeComputedMethod";
|
|
1619
1632
|
checkMiddle();
|
|
1620
1633
|
parser.consume(":");
|
|
1621
|
-
const
|
|
1634
|
+
const parentParser = parser.baseParser;
|
|
1635
|
+
parentParser.acceptLexerState(parser);
|
|
1636
|
+
const nextValue = parentParser.parseType(4);
|
|
1637
|
+
parser.acceptLexerState(parentParser);
|
|
1622
1638
|
key = {
|
|
1623
1639
|
type,
|
|
1624
1640
|
optional,
|
|
@@ -1631,7 +1647,10 @@ const objectSquaredPropertyParslet = composeParslet({
|
|
|
1631
1647
|
type = "JsdocTypeComputedProperty";
|
|
1632
1648
|
checkMiddle();
|
|
1633
1649
|
if (!parser.consume(":")) throw new Error("Incomplete computed property: missing colon");
|
|
1634
|
-
|
|
1650
|
+
const parentParser = parser.baseParser;
|
|
1651
|
+
parentParser.acceptLexerState(parser);
|
|
1652
|
+
right = parentParser.parseType(4);
|
|
1653
|
+
parser.acceptLexerState(parentParser);
|
|
1635
1654
|
key = {
|
|
1636
1655
|
type,
|
|
1637
1656
|
value: innerBracketType
|
|
@@ -2089,19 +2108,17 @@ function parse(expression, mode, { range = false, rangeStart, loc = false, locSt
|
|
|
2089
2108
|
locStart
|
|
2090
2109
|
});
|
|
2091
2110
|
break;
|
|
2092
|
-
case "typescript":
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
});
|
|
2104
|
-
break;
|
|
2111
|
+
case "typescript": parser = new Parser(typescriptGrammar, Lexer.create(rules, expression), void 0, {
|
|
2112
|
+
module,
|
|
2113
|
+
strictMode,
|
|
2114
|
+
asyncFunctionBody,
|
|
2115
|
+
classContext,
|
|
2116
|
+
range,
|
|
2117
|
+
rangeStart,
|
|
2118
|
+
loc,
|
|
2119
|
+
locStart,
|
|
2120
|
+
externalParsers: { computedPropertyParser }
|
|
2121
|
+
});
|
|
2105
2122
|
}
|
|
2106
2123
|
const result = parser.parse();
|
|
2107
2124
|
return assertResultIsNotReservedWord(parser, result);
|
|
@@ -2117,7 +2134,7 @@ function tryParse(expression, modes = [
|
|
|
2117
2134
|
"typescript",
|
|
2118
2135
|
"closure",
|
|
2119
2136
|
"jsdoc"
|
|
2120
|
-
], { module = true, strictMode = true, asyncFunctionBody = true, classContext = false, range, rangeStart, loc = false, locStart = {
|
|
2137
|
+
], { module = true, strictMode = true, asyncFunctionBody = true, classContext = false, computedPropertyParser, range, rangeStart, loc = false, locStart = {
|
|
2121
2138
|
column: 0,
|
|
2122
2139
|
line: 1
|
|
2123
2140
|
} } = {}) {
|
|
@@ -2128,6 +2145,7 @@ function tryParse(expression, modes = [
|
|
|
2128
2145
|
strictMode,
|
|
2129
2146
|
asyncFunctionBody,
|
|
2130
2147
|
classContext,
|
|
2148
|
+
computedPropertyParser,
|
|
2131
2149
|
range,
|
|
2132
2150
|
rangeStart,
|
|
2133
2151
|
loc,
|
|
@@ -2174,10 +2192,11 @@ function notAvailableTransform(parseResult) {
|
|
|
2174
2192
|
}
|
|
2175
2193
|
function extractSpecialParams(source) {
|
|
2176
2194
|
const result = { params: [] };
|
|
2177
|
-
for (const param of source.parameters) if (param.type === "JsdocTypeKeyValue")
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2195
|
+
for (const param of source.parameters) if (param.type === "JsdocTypeKeyValue") {
|
|
2196
|
+
if (param.key === "this") result.this = param.right;
|
|
2197
|
+
else if (param.key === "new") result.new = param.right;
|
|
2198
|
+
else result.params.push(param);
|
|
2199
|
+
} else result.params.push(param);
|
|
2181
2200
|
return result;
|
|
2182
2201
|
}
|
|
2183
2202
|
//#endregion
|
|
@@ -2275,7 +2294,9 @@ function stringifyRules({ computedPropertyStringifier } = {}) {
|
|
|
2275
2294
|
const separatorForSingleObjectField = result.meta.separatorForSingleObjectField ?? false;
|
|
2276
2295
|
const trailingPunctuation = result.meta.trailingPunctuation ?? false;
|
|
2277
2296
|
const bracketSpacing = result.meta.bracketSpacing ?? "";
|
|
2278
|
-
return `{${
|
|
2297
|
+
return `{${
|
|
2298
|
+
/* c8 ignore next -- Guard */
|
|
2299
|
+
(lbType && (separatorForSingleObjectField || result.elements.length > 1) ? `\n${result.meta.propertyIndent ?? ""}` : bracketSpacing) + result.elements.map(transform).join(result.meta.separator === "comma" ? ", " : lbType ? lbEnding + (result.meta.propertyIndent ?? "") : "; ") + (separatorForSingleObjectField && result.elements.length === 1 ? result.meta.separator === "comma" ? "," : lbType ? lbEnding : ";" : trailingPunctuation && result.meta.separator !== void 0 ? result.meta.separator.startsWith("comma") ? "," : result.meta.separator.startsWith("semicolon") ? ";" : "" : "") + (lbType && result.elements.length > 1 ? "\n" : bracketSpacing)}}`;
|
|
2279
2300
|
},
|
|
2280
2301
|
JsdocTypeOptional: (result, transform) => applyPosition(result.meta.position, transform(result.element), "="),
|
|
2281
2302
|
JsdocTypeSymbol: (result, transform) => `${result.value}(${result.element !== void 0 ? transform(result.element) : ""})`,
|
package/dist-cjser/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// packages/@cjser/jsdoc-type-pratt-parser.tmp-
|
|
19
|
+
// packages/@cjser/jsdoc-type-pratt-parser.tmp-27-1789662903248/dist/index.mjs
|
|
20
20
|
var index_exports = {};
|
|
21
21
|
__export(index_exports, {
|
|
22
22
|
catharsisTransform: () => catharsisTransform,
|
|
@@ -880,11 +880,13 @@ function createObjectParslet({ signatureGrammar, objectFieldGrammar: objectField
|
|
|
880
880
|
if (parser.lexer.current.startOfLine) {
|
|
881
881
|
separator ??= "linebreak";
|
|
882
882
|
parser.consume(",") || parser.consume(";");
|
|
883
|
-
} else if (parser.consume(","))
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
else
|
|
887
|
-
|
|
883
|
+
} else if (parser.consume(",")) {
|
|
884
|
+
if (parser.lexer.current.startOfLine) separator = "comma-and-linebreak";
|
|
885
|
+
else separator = "comma";
|
|
886
|
+
} else if (parser.consume(";")) {
|
|
887
|
+
if (parser.lexer.current.startOfLine) separator = "semicolon-and-linebreak";
|
|
888
|
+
else separator = "semicolon";
|
|
889
|
+
} else break;
|
|
888
890
|
if (parser.lexer.current.type === "}") break;
|
|
889
891
|
}
|
|
890
892
|
result.meta.separator = separator ?? "comma";
|
|
@@ -1246,9 +1248,10 @@ function createTupleParslet({ allowQuestionMark }) {
|
|
|
1246
1248
|
};
|
|
1247
1249
|
if (parser.consume("]")) return result;
|
|
1248
1250
|
const typeList = parser.parseIntermediateType(0);
|
|
1249
|
-
if (typeList.type === "JsdocTypeParameterList")
|
|
1250
|
-
|
|
1251
|
-
|
|
1251
|
+
if (typeList.type === "JsdocTypeParameterList") {
|
|
1252
|
+
if (typeList.elements[0].type === "JsdocTypeKeyValue") result.elements = typeList.elements.map(assertPlainKeyValueResult);
|
|
1253
|
+
else result.elements = typeList.elements.map(assertRootResult);
|
|
1254
|
+
} else if (typeList.type === "JsdocTypeKeyValue") result.elements = [assertPlainKeyValueResult(typeList)];
|
|
1252
1255
|
else result.elements = [assertRootResult(typeList)];
|
|
1253
1256
|
if (!parser.consume("]")) throw new Error("Unterminated '['");
|
|
1254
1257
|
if (!allowQuestionMark && result.elements.some((e) => e.type === "JsdocTypeUnknown")) throw new Error("Question mark in tuple not allowed");
|
|
@@ -1273,8 +1276,7 @@ var inferParslet = composeParslet({
|
|
|
1273
1276
|
parsePrefix: (parser) => {
|
|
1274
1277
|
parser.consume("infer");
|
|
1275
1278
|
const element = parser.parseIntermediateType(12);
|
|
1276
|
-
if (element.type !== "JsdocTypeName")
|
|
1277
|
-
throw new UnexpectedTypeError(element, "A typescript infer always has to have a name.");
|
|
1279
|
+
if (element.type !== "JsdocTypeName") throw new UnexpectedTypeError(element, "A typescript infer always has to have a name.");
|
|
1278
1280
|
return {
|
|
1279
1281
|
type: "JsdocTypeInfer",
|
|
1280
1282
|
element
|
|
@@ -1445,16 +1447,28 @@ var Lexer = class Lexer2 {
|
|
|
1445
1447
|
const next = Lexer2.read(this.lexerRules, this.text);
|
|
1446
1448
|
return new Lexer2(this.lexerRules, next.text, this.current, this.next, next.token);
|
|
1447
1449
|
}
|
|
1450
|
+
clone() {
|
|
1451
|
+
return new Lexer2(this.lexerRules, this.text, this.previous, this.current, this.next);
|
|
1452
|
+
}
|
|
1448
1453
|
};
|
|
1449
1454
|
var objectSquaredPropertyParslet = composeParslet({
|
|
1450
1455
|
name: "objectSquarePropertyParslet",
|
|
1451
1456
|
accept: (type) => type === "[",
|
|
1452
1457
|
parsePrefix: (parser) => {
|
|
1453
|
-
var _a, _b;
|
|
1458
|
+
var _a, _b, _c;
|
|
1454
1459
|
if (parser.baseParser === void 0) throw new Error("Only allowed inside object grammar");
|
|
1455
1460
|
parser.consume("[");
|
|
1456
1461
|
let innerBracketType;
|
|
1457
|
-
|
|
1462
|
+
let isIndexSignatureOrMappedType = false;
|
|
1463
|
+
if (((_a = parser.externalParsers) == null ? void 0 : _a.computedPropertyParser) !== void 0) try {
|
|
1464
|
+
const tryLexer = parser.lexer.clone();
|
|
1465
|
+
const tryParser = new Parser(parser.grammar, tryLexer, parser.baseParser, { externalParsers: parser.externalParsers });
|
|
1466
|
+
const parsedType = tryParser.parseIntermediateType(2);
|
|
1467
|
+
const isMapped = (parsedType == null ? void 0 : parsedType.type) === "JsdocTypeName" && tryParser.consume("in");
|
|
1468
|
+
if ((parsedType == null ? void 0 : parsedType.type) === "JsdocTypeObjectField" && typeof parsedType.key === "string" && !parsedType.optional && !parsedType.readonly && parsedType.right !== void 0 || isMapped) isIndexSignatureOrMappedType = true;
|
|
1469
|
+
} catch (err) {
|
|
1470
|
+
}
|
|
1471
|
+
if (isIndexSignatureOrMappedType || ((_b = parser.externalParsers) == null ? void 0 : _b.computedPropertyParser) === void 0) try {
|
|
1458
1472
|
innerBracketType = parser.parseIntermediateType(2);
|
|
1459
1473
|
} catch (err) {
|
|
1460
1474
|
throw new Error("Error parsing value inside square bracketed property.", { cause: err });
|
|
@@ -1499,7 +1513,7 @@ var objectSquaredPropertyParslet = composeParslet({
|
|
|
1499
1513
|
};
|
|
1500
1514
|
parser.acceptLexerState(parentParser);
|
|
1501
1515
|
} else {
|
|
1502
|
-
if (((
|
|
1516
|
+
if (((_c = parser.externalParsers) == null ? void 0 : _c.computedPropertyParser) !== void 0) {
|
|
1503
1517
|
let remaining = parser.lexer.current.text + parser.lexer.remaining();
|
|
1504
1518
|
let checkingText = remaining;
|
|
1505
1519
|
while (checkingText !== "") {
|
|
@@ -1564,7 +1578,10 @@ var objectSquaredPropertyParslet = composeParslet({
|
|
|
1564
1578
|
type = "JsdocTypeComputedMethod";
|
|
1565
1579
|
checkMiddle();
|
|
1566
1580
|
parser.consume(":");
|
|
1567
|
-
const
|
|
1581
|
+
const parentParser = parser.baseParser;
|
|
1582
|
+
parentParser.acceptLexerState(parser);
|
|
1583
|
+
const nextValue = parentParser.parseType(4);
|
|
1584
|
+
parser.acceptLexerState(parentParser);
|
|
1568
1585
|
key = {
|
|
1569
1586
|
type,
|
|
1570
1587
|
optional,
|
|
@@ -1577,7 +1594,10 @@ var objectSquaredPropertyParslet = composeParslet({
|
|
|
1577
1594
|
type = "JsdocTypeComputedProperty";
|
|
1578
1595
|
checkMiddle();
|
|
1579
1596
|
if (!parser.consume(":")) throw new Error("Incomplete computed property: missing colon");
|
|
1580
|
-
|
|
1597
|
+
const parentParser = parser.baseParser;
|
|
1598
|
+
parentParser.acceptLexerState(parser);
|
|
1599
|
+
right = parentParser.parseType(4);
|
|
1600
|
+
parser.acceptLexerState(parentParser);
|
|
1581
1601
|
key = {
|
|
1582
1602
|
type,
|
|
1583
1603
|
value: innerBracketType
|
|
@@ -2022,7 +2042,6 @@ function parse(expression, mode, { range = false, rangeStart, loc = false, locSt
|
|
|
2022
2042
|
locStart,
|
|
2023
2043
|
externalParsers: { computedPropertyParser }
|
|
2024
2044
|
});
|
|
2025
|
-
break;
|
|
2026
2045
|
}
|
|
2027
2046
|
const result = parser.parse();
|
|
2028
2047
|
return assertResultIsNotReservedWord(parser, result);
|
|
@@ -2031,7 +2050,7 @@ function tryParse(expression, modes = [
|
|
|
2031
2050
|
"typescript",
|
|
2032
2051
|
"closure",
|
|
2033
2052
|
"jsdoc"
|
|
2034
|
-
], { module: module2 = true, strictMode = true, asyncFunctionBody = true, classContext = false, range, rangeStart, loc = false, locStart = {
|
|
2053
|
+
], { module: module2 = true, strictMode = true, asyncFunctionBody = true, classContext = false, computedPropertyParser, range, rangeStart, loc = false, locStart = {
|
|
2035
2054
|
column: 0,
|
|
2036
2055
|
line: 1
|
|
2037
2056
|
} } = {}) {
|
|
@@ -2042,6 +2061,7 @@ function tryParse(expression, modes = [
|
|
|
2042
2061
|
strictMode,
|
|
2043
2062
|
asyncFunctionBody,
|
|
2044
2063
|
classContext,
|
|
2064
|
+
computedPropertyParser,
|
|
2045
2065
|
range,
|
|
2046
2066
|
rangeStart,
|
|
2047
2067
|
loc,
|
|
@@ -2082,10 +2102,11 @@ function notAvailableTransform(parseResult) {
|
|
|
2082
2102
|
}
|
|
2083
2103
|
function extractSpecialParams(source) {
|
|
2084
2104
|
const result = { params: [] };
|
|
2085
|
-
for (const param of source.parameters) if (param.type === "JsdocTypeKeyValue")
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2105
|
+
for (const param of source.parameters) if (param.type === "JsdocTypeKeyValue") {
|
|
2106
|
+
if (param.key === "this") result.this = param.right;
|
|
2107
|
+
else if (param.key === "new") result.new = param.right;
|
|
2108
|
+
else result.params.push(param);
|
|
2109
|
+
} else result.params.push(param);
|
|
2089
2110
|
return result;
|
|
2090
2111
|
}
|
|
2091
2112
|
function applyPosition(position, target, value) {
|
|
@@ -2192,7 +2213,8 @@ function stringifyRules({ computedPropertyStringifier } = {}) {
|
|
|
2192
2213
|
const separatorForSingleObjectField = result.meta.separatorForSingleObjectField ?? false;
|
|
2193
2214
|
const trailingPunctuation = result.meta.trailingPunctuation ?? false;
|
|
2194
2215
|
const bracketSpacing = result.meta.bracketSpacing ?? "";
|
|
2195
|
-
return `{${
|
|
2216
|
+
return `{${/* c8 ignore next -- Guard */
|
|
2217
|
+
(lbType && (separatorForSingleObjectField || result.elements.length > 1) ? `
|
|
2196
2218
|
${result.meta.propertyIndent ?? ""}` : bracketSpacing) + result.elements.map(transform2).join(result.meta.separator === "comma" ? ", " : lbType ? lbEnding + (result.meta.propertyIndent ?? "") : "; ") + (separatorForSingleObjectField && result.elements.length === 1 ? result.meta.separator === "comma" ? "," : lbType ? lbEnding : ";" : trailingPunctuation && result.meta.separator !== void 0 ? result.meta.separator.startsWith("comma") ? "," : result.meta.separator.startsWith("semicolon") ? ";" : "" : "") + (lbType && result.elements.length > 1 ? "\n" : bracketSpacing)}}`;
|
|
2197
2219
|
},
|
|
2198
2220
|
JsdocTypeOptional: (result, transform2) => applyPosition(result.meta.position, transform2(result.element), "="),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cjser/jsdoc-type-pratt-parser",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.2-cjser.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.mts",
|
|
@@ -15,12 +15,13 @@
|
|
|
15
15
|
"test": "test"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
-
"test": "npm run
|
|
18
|
+
"test": "npm run tsc && npm run lint && npm run test:spec",
|
|
19
19
|
"test:spec": "mocha",
|
|
20
20
|
"test:coverage": "c8 --all npm run test:spec",
|
|
21
21
|
"test:coveralls": "c8 report --reporter=lcov && coveralls",
|
|
22
22
|
"lint": "eslint .",
|
|
23
|
-
"
|
|
23
|
+
"tsc": "tsc --noEmit",
|
|
24
|
+
"tsc:ts7": "npx -y -p typescript@^7 -c \"tsc\"",
|
|
24
25
|
"attw": "attw --pack . --profile esm-only",
|
|
25
26
|
"build": "tsdown && npm run attw",
|
|
26
27
|
"apidoc": "typedoc --options typedoc.json",
|
|
@@ -38,7 +39,8 @@
|
|
|
38
39
|
"node": "^22.22.2 || >=24.15.0"
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
|
41
|
-
"@types/estree": "^1.0.9"
|
|
42
|
+
"@types/estree": "^1.0.9",
|
|
43
|
+
"@types/node": "^26.4.0"
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
46
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
@@ -47,7 +49,6 @@
|
|
|
47
49
|
"@semantic-release/git": "^11.0.1",
|
|
48
50
|
"@types/chai": "^5.2.3",
|
|
49
51
|
"@types/mocha": "^10.0.10",
|
|
50
|
-
"@types/node": "^26.2.0",
|
|
51
52
|
"@types/sinon": "^22.0.0",
|
|
52
53
|
"@types/sinon-chai": "^4.0.0",
|
|
53
54
|
"@typescript-eslint/eslint-plugin": "^8.42.0",
|
|
@@ -57,13 +58,13 @@
|
|
|
57
58
|
"chai": "^6.2.2",
|
|
58
59
|
"coveralls": "^3.1.1",
|
|
59
60
|
"eslint": "^9.39.4",
|
|
60
|
-
"eslint-config-love": "
|
|
61
|
+
"eslint-config-love": "155.0.0",
|
|
61
62
|
"eslint-plugin-import": "^2.32.0",
|
|
62
63
|
"eslint-plugin-n": "^18.3.0",
|
|
63
64
|
"eslint-plugin-promise": "^7.3.0",
|
|
64
65
|
"espree": "^11.2.0",
|
|
65
66
|
"jsdoctypeparser": "^9.0.0",
|
|
66
|
-
"mocha": "^
|
|
67
|
+
"mocha": "^12.0.0",
|
|
67
68
|
"npm-upgrade": "^3.3.0",
|
|
68
69
|
"patch-package": "^8.0.1",
|
|
69
70
|
"semantic-release": "^25.0.9",
|
|
@@ -119,11 +120,11 @@
|
|
|
119
120
|
},
|
|
120
121
|
"main": "./dist-cjser/index.cjs",
|
|
121
122
|
"cjser": {
|
|
122
|
-
"sourceVersion": "9.
|
|
123
|
+
"sourceVersion": "9.2.2",
|
|
123
124
|
"cjserVersion": 2,
|
|
124
125
|
"original": {
|
|
125
126
|
"name": "jsdoc-type-pratt-parser",
|
|
126
|
-
"version": "9.
|
|
127
|
+
"version": "9.2.2",
|
|
127
128
|
"exports": {
|
|
128
129
|
".": "./dist/index.mjs",
|
|
129
130
|
"./package.json": "./package.json"
|
|
@@ -133,18 +134,20 @@
|
|
|
133
134
|
"url": "https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser.git"
|
|
134
135
|
},
|
|
135
136
|
"dependencies": {
|
|
136
|
-
"@types/estree": "^1.0.9"
|
|
137
|
+
"@types/estree": "^1.0.9",
|
|
138
|
+
"@types/node": "^26.4.0"
|
|
137
139
|
},
|
|
138
140
|
"files": [
|
|
139
141
|
"dist/**/*"
|
|
140
142
|
],
|
|
141
143
|
"scripts": {
|
|
142
|
-
"test": "npm run
|
|
144
|
+
"test": "npm run tsc && npm run lint && npm run test:spec",
|
|
143
145
|
"test:spec": "mocha",
|
|
144
146
|
"test:coverage": "c8 --all npm run test:spec",
|
|
145
147
|
"test:coveralls": "c8 report --reporter=lcov && coveralls",
|
|
146
148
|
"lint": "eslint .",
|
|
147
|
-
"
|
|
149
|
+
"tsc": "tsc --noEmit",
|
|
150
|
+
"tsc:ts7": "npx -y -p typescript@^7 -c \"tsc\"",
|
|
148
151
|
"attw": "attw --pack . --profile esm-only",
|
|
149
152
|
"build": "tsdown && npm run attw",
|
|
150
153
|
"apidoc": "typedoc --options typedoc.json",
|