@putout/bundle 3.19.1 → 3.19.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/bundle/putout.js +67 -88
- package/bundle/putout.min.js +1 -1
- package/package.json +2 -1
package/bundle/putout.js
CHANGED
|
@@ -9428,7 +9428,7 @@ __export(lib_exports, {
|
|
|
9428
9428
|
return tsTypePredicate;
|
|
9429
9429
|
},
|
|
9430
9430
|
TSTypeQuery: function() {
|
|
9431
|
-
return tsTypeQuery;
|
|
9431
|
+
return tsTypeQuery$1;
|
|
9432
9432
|
},
|
|
9433
9433
|
TSTypeReference: function() {
|
|
9434
9434
|
return tsTypeReference$1;
|
|
@@ -12224,7 +12224,7 @@ __export(lib_exports, {
|
|
|
12224
12224
|
return tsTypePredicate;
|
|
12225
12225
|
},
|
|
12226
12226
|
tsTypeQuery: function() {
|
|
12227
|
-
return tsTypeQuery;
|
|
12227
|
+
return tsTypeQuery$1;
|
|
12228
12228
|
},
|
|
12229
12229
|
tsTypeReference: function() {
|
|
12230
12230
|
return tsTypeReference$1;
|
|
@@ -23387,7 +23387,7 @@ function tsTypePredicate(parameterName) {
|
|
|
23387
23387
|
validate$4(defs.asserts, node, "asserts", asserts);
|
|
23388
23388
|
return node;
|
|
23389
23389
|
}
|
|
23390
|
-
function tsTypeQuery(exprName) {
|
|
23390
|
+
function tsTypeQuery$1(exprName) {
|
|
23391
23391
|
var typeParameters = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
|
|
23392
23392
|
var node = {
|
|
23393
23393
|
type: "TSTypeQuery",
|
|
@@ -46990,7 +46990,7 @@ function Identifier$1$1(node, parent, tokenContext, _inForInit, getRawIdentifier
|
|
|
46990
46990
|
await: false
|
|
46991
46991
|
});
|
|
46992
46992
|
}
|
|
46993
|
-
var parens
|
|
46993
|
+
var parens = /* @__PURE__ */ Object.freeze({
|
|
46994
46994
|
__proto__: null,
|
|
46995
46995
|
ArrowFunctionExpression: ConditionalExpression$1,
|
|
46996
46996
|
AssignmentExpression: AssignmentExpression$1,
|
|
@@ -47088,7 +47088,7 @@ function expandAliases(obj) {
|
|
|
47088
47088
|
}
|
|
47089
47089
|
return map;
|
|
47090
47090
|
}
|
|
47091
|
-
var expandedParens = expandAliases(parens
|
|
47091
|
+
var expandedParens = expandAliases(parens);
|
|
47092
47092
|
var expandedWhitespaceNodes = expandAliases(nodes);
|
|
47093
47093
|
function isOrHasCallExpression(node) {
|
|
47094
47094
|
if (isCallExpression$1$1(node)) {
|
|
@@ -49835,7 +49835,7 @@ function TSTypePredicate(node) {
|
|
|
49835
49835
|
this.print(node.typeAnnotation.typeAnnotation);
|
|
49836
49836
|
}
|
|
49837
49837
|
}
|
|
49838
|
-
function TSTypeQuery(node) {
|
|
49838
|
+
function TSTypeQuery$1(node) {
|
|
49839
49839
|
this.word("typeof");
|
|
49840
49840
|
this.space();
|
|
49841
49841
|
this.print(node.exprName);
|
|
@@ -50457,7 +50457,7 @@ var generatorFunctions = /* @__PURE__ */ Object.freeze({
|
|
|
50457
50457
|
TSTypeParameterDeclaration: TSTypeParameterInstantiation,
|
|
50458
50458
|
TSTypeParameterInstantiation: TSTypeParameterInstantiation,
|
|
50459
50459
|
TSTypePredicate: TSTypePredicate,
|
|
50460
|
-
TSTypeQuery: TSTypeQuery,
|
|
50460
|
+
TSTypeQuery: TSTypeQuery$1,
|
|
50461
50461
|
TSTypeReference: TSTypeReference$1,
|
|
50462
50462
|
TSUndefinedKeyword: TSUndefinedKeyword,
|
|
50463
50463
|
TSUnionType: TSUnionType$2,
|
|
@@ -79031,12 +79031,13 @@ function isOneArgArrow(path) {
|
|
|
79031
79031
|
return param.type === 'Identifier';
|
|
79032
79032
|
}
|
|
79033
79033
|
|
|
79034
|
-
var maybeParens$
|
|
79034
|
+
var maybeParens$c = {};
|
|
79035
79035
|
|
|
79036
|
-
|
|
79037
|
-
|
|
79038
|
-
|
|
79039
|
-
|
|
79036
|
+
const isParens$4 = (path) => path.node.extra?.parenthesized;
|
|
79037
|
+
|
|
79038
|
+
maybeParens$c.isParens = isParens$4;
|
|
79039
|
+
maybeParens$c.maybeParens = (print) => ({
|
|
79040
|
+
condition: isParens$4,
|
|
79040
79041
|
before(path, {write}) {
|
|
79041
79042
|
write('(');
|
|
79042
79043
|
},
|
|
@@ -79048,9 +79049,9 @@ maybeParens$9.maybeParens = (print) => ({
|
|
|
79048
79049
|
|
|
79049
79050
|
const {exists: exists$e} = is$3;
|
|
79050
79051
|
const {printParams: printParams$c} = params;
|
|
79051
|
-
const {maybeParens: maybeParens$
|
|
79052
|
+
const {maybeParens: maybeParens$b} = maybeParens$c;
|
|
79052
79053
|
|
|
79053
|
-
arrowFunctionExpression.ArrowFunctionExpression = maybeParens$
|
|
79054
|
+
arrowFunctionExpression.ArrowFunctionExpression = maybeParens$b((path, printer, semantics) => {
|
|
79054
79055
|
const {
|
|
79055
79056
|
print,
|
|
79056
79057
|
maybe,
|
|
@@ -79306,9 +79307,9 @@ var functionExpression = {};
|
|
|
79306
79307
|
|
|
79307
79308
|
const {exists: exists$d} = is$3;
|
|
79308
79309
|
const {printParams: printParams$8} = params;
|
|
79309
|
-
const {maybeParens: maybeParens$
|
|
79310
|
+
const {maybeParens: maybeParens$a} = maybeParens$c;
|
|
79310
79311
|
|
|
79311
|
-
functionExpression.FunctionExpression = maybeParens$
|
|
79312
|
+
functionExpression.FunctionExpression = maybeParens$a((path, printer, semantics) => {
|
|
79312
79313
|
const {
|
|
79313
79314
|
print,
|
|
79314
79315
|
maybe,
|
|
@@ -79358,11 +79359,11 @@ var unaryExpressions$1 = {};
|
|
|
79358
79359
|
|
|
79359
79360
|
const {isLast: isLast$b, isNext: isNext$m} = is$3;
|
|
79360
79361
|
|
|
79361
|
-
const {maybeParens: maybeParens$
|
|
79362
|
+
const {maybeParens: maybeParens$9} = maybeParens$c;
|
|
79362
79363
|
|
|
79363
79364
|
const isWord = (a) => /^(delete|typeof|void|throw)$/.test(a);
|
|
79364
79365
|
|
|
79365
|
-
const unaryExpression = maybeParens$
|
|
79366
|
+
const unaryExpression = maybeParens$9((path, printer) => {
|
|
79366
79367
|
const {maybe, traverse} = printer;
|
|
79367
79368
|
const {prefix, operator} = path.node;
|
|
79368
79369
|
const argPath = path.get('argument');
|
|
@@ -79382,7 +79383,7 @@ unaryExpressions$1.AwaitExpression = (path, {print}) => {
|
|
|
79382
79383
|
});
|
|
79383
79384
|
};
|
|
79384
79385
|
|
|
79385
|
-
unaryExpressions$1.YieldExpression = maybeParens$
|
|
79386
|
+
unaryExpressions$1.YieldExpression = maybeParens$9((path, {print, maybe}) => {
|
|
79386
79387
|
const {delegate} = path.node;
|
|
79387
79388
|
|
|
79388
79389
|
print(`yield`);
|
|
@@ -79495,7 +79496,7 @@ const {chain} = chain$1;
|
|
|
79495
79496
|
const {satisfy: satisfy$3} = is$3;
|
|
79496
79497
|
|
|
79497
79498
|
const {maybePrintComputed} = maybePrintComputed$2;
|
|
79498
|
-
const {maybeParens: maybeParens$
|
|
79499
|
+
const {maybeParens: maybeParens$8} = maybeParens$c;
|
|
79499
79500
|
|
|
79500
79501
|
const isArgOfCall = (path) => path.parentPath.isCallExpression() && path.parentPath.get('arguments.0') === path;
|
|
79501
79502
|
|
|
@@ -79530,7 +79531,7 @@ memberExpressions$1.MemberExpression = (path, printer) => {
|
|
|
79530
79531
|
maybe.indent.dec(isChain);
|
|
79531
79532
|
};
|
|
79532
79533
|
|
|
79533
|
-
memberExpressions$1.OptionalMemberExpression = maybeParens$
|
|
79534
|
+
memberExpressions$1.OptionalMemberExpression = maybeParens$8((path, {print, maybe}) => {
|
|
79534
79535
|
const {computed, optional} = path.node;
|
|
79535
79536
|
|
|
79536
79537
|
print('__object');
|
|
@@ -79711,7 +79712,7 @@ _class.ClassDeclaration = {
|
|
|
79711
79712
|
var callExpression = {};
|
|
79712
79713
|
|
|
79713
79714
|
const {exists: exists$c} = is$3;
|
|
79714
|
-
const {maybeParens: maybeParens$
|
|
79715
|
+
const {maybeParens: maybeParens$7} = maybeParens$c;
|
|
79715
79716
|
const {isArray: isArray$e} = Array;
|
|
79716
79717
|
|
|
79717
79718
|
const parseArgs = (path) => {
|
|
@@ -79723,7 +79724,7 @@ const parseArgs = (path) => {
|
|
|
79723
79724
|
return argsPath;
|
|
79724
79725
|
};
|
|
79725
79726
|
|
|
79726
|
-
const CallExpression$1 = maybeParens$
|
|
79727
|
+
const CallExpression$1 = maybeParens$7((path, {indent, print, maybe, traverse}) => {
|
|
79727
79728
|
const args = parseArgs(path);
|
|
79728
79729
|
const isParentCall = tooLong$1(args) && path.parentPath.isCallExpression();
|
|
79729
79730
|
|
|
@@ -79926,7 +79927,7 @@ objectExpression.ObjectExpression = (path, printer, semantics) => {
|
|
|
79926
79927
|
|
|
79927
79928
|
const properties = path.get('properties');
|
|
79928
79929
|
const {length} = properties;
|
|
79929
|
-
const parens = isParens$
|
|
79930
|
+
const parens = isParens$3(path);
|
|
79930
79931
|
const manyLines = !isOneLine$1(path);
|
|
79931
79932
|
|
|
79932
79933
|
maybe.print(parens, '(');
|
|
@@ -80031,7 +80032,7 @@ function isOneLine$1(path) {
|
|
|
80031
80032
|
return !isValue(path);
|
|
80032
80033
|
}
|
|
80033
80034
|
|
|
80034
|
-
function isParens$
|
|
80035
|
+
function isParens$3(path) {
|
|
80035
80036
|
if (isBodyOfArrow(path))
|
|
80036
80037
|
return true;
|
|
80037
80038
|
|
|
@@ -80475,22 +80476,7 @@ var assignmentExpression = {};
|
|
|
80475
80476
|
|
|
80476
80477
|
var maybeWriteBrace$3 = {};
|
|
80477
80478
|
|
|
80478
|
-
|
|
80479
|
-
|
|
80480
|
-
const isParens$4 = (path) => path.node.extra?.parenthesized;
|
|
80481
|
-
|
|
80482
|
-
parens.isParens = isParens$4;
|
|
80483
|
-
|
|
80484
|
-
parens.maybeParenOpen = (path, {maybe}) => {
|
|
80485
|
-
maybe.write(isParens$4(path), '(');
|
|
80486
|
-
};
|
|
80487
|
-
|
|
80488
|
-
parens.maybeParenClose = (path, {maybe}) => {
|
|
80489
|
-
maybe.write(isParens$4(path), ')');
|
|
80490
|
-
};
|
|
80491
|
-
|
|
80492
|
-
const {isParens: isParens$3} = parens;
|
|
80493
|
-
|
|
80479
|
+
const {isParens: isParens$2} = maybeParens$c;
|
|
80494
80480
|
maybeWriteBrace$3.maybePrintLeftBrace = (path, printer, semantics) => {
|
|
80495
80481
|
maybeWriteBrace$2(path, printer, semantics, {
|
|
80496
80482
|
brace: '(',
|
|
@@ -80527,7 +80513,7 @@ function maybeWriteBrace$2(path, printer, semantics, {brace}) {
|
|
|
80527
80513
|
if (!roundBraces.assign)
|
|
80528
80514
|
return;
|
|
80529
80515
|
|
|
80530
|
-
if (!isParens$
|
|
80516
|
+
if (!isParens$2(path))
|
|
80531
80517
|
return;
|
|
80532
80518
|
|
|
80533
80519
|
write(brace);
|
|
@@ -82159,11 +82145,11 @@ const {
|
|
|
82159
82145
|
} = concatenate$1;
|
|
82160
82146
|
|
|
82161
82147
|
const {maybeSpace} = maybeSpace$1;
|
|
82162
|
-
const {isParens: isParens$
|
|
82148
|
+
const {isParens: isParens$1} = maybeParens$c;
|
|
82163
82149
|
|
|
82164
82150
|
const BinaryExpression$1 = {
|
|
82165
82151
|
condition(path) {
|
|
82166
|
-
if (isParens$
|
|
82152
|
+
if (isParens$1(path))
|
|
82167
82153
|
return true;
|
|
82168
82154
|
|
|
82169
82155
|
return path.parentPath.isAwaitExpression();
|
|
@@ -82215,28 +82201,19 @@ binaryExpression.LogicalExpression = BinaryExpression$1;
|
|
|
82215
82201
|
|
|
82216
82202
|
var conditionalExpression = {};
|
|
82217
82203
|
|
|
82218
|
-
const {
|
|
82204
|
+
const {maybeParens: maybeParens$6} = maybeParens$c;
|
|
82219
82205
|
|
|
82220
|
-
conditionalExpression.ConditionalExpression = {
|
|
82221
|
-
|
|
82222
|
-
|
|
82223
|
-
|
|
82224
|
-
|
|
82225
|
-
print(
|
|
82226
|
-
|
|
82227
|
-
|
|
82228
|
-
|
|
82229
|
-
|
|
82230
|
-
|
|
82231
|
-
print.space();
|
|
82232
|
-
print(':');
|
|
82233
|
-
print.space();
|
|
82234
|
-
print('__alternate');
|
|
82235
|
-
},
|
|
82236
|
-
after(path, {print}) {
|
|
82237
|
-
print(')');
|
|
82238
|
-
},
|
|
82239
|
-
};
|
|
82206
|
+
conditionalExpression.ConditionalExpression = maybeParens$6((path, {print}) => {
|
|
82207
|
+
print('__test');
|
|
82208
|
+
print.space();
|
|
82209
|
+
print('?');
|
|
82210
|
+
print.space();
|
|
82211
|
+
print('__consequent');
|
|
82212
|
+
print.space();
|
|
82213
|
+
print(':');
|
|
82214
|
+
print.space();
|
|
82215
|
+
print('__alternate');
|
|
82216
|
+
});
|
|
82240
82217
|
|
|
82241
82218
|
var staticBlock = {};
|
|
82242
82219
|
|
|
@@ -84143,10 +84120,10 @@ maybeGet.maybeDecorators = (path) => {
|
|
|
84143
84120
|
};
|
|
84144
84121
|
|
|
84145
84122
|
const {maybeDecorators} = maybeGet;
|
|
84146
|
-
const {maybeParens: maybeParens$
|
|
84123
|
+
const {maybeParens: maybeParens$5} = maybeParens$c;
|
|
84147
84124
|
const {maybeTypeAnnotation} = maybeTypeAnnotation$4;
|
|
84148
84125
|
|
|
84149
|
-
identifier.Identifier = maybeParens$
|
|
84126
|
+
identifier.Identifier = maybeParens$5(maybeTypeAnnotation((path, printer) => {
|
|
84150
84127
|
const {
|
|
84151
84128
|
write,
|
|
84152
84129
|
maybe,
|
|
@@ -84623,13 +84600,13 @@ tsInterfaceDeclaration.TSInterfaceDeclaration = {
|
|
|
84623
84600
|
|
|
84624
84601
|
var tsAsExpression = {};
|
|
84625
84602
|
|
|
84626
|
-
const {maybeParens: maybeParens$
|
|
84603
|
+
const {maybeParens: maybeParens$4} = maybeParens$c;
|
|
84627
84604
|
const {
|
|
84628
84605
|
isVariableDeclarator,
|
|
84629
84606
|
isObjectExpression: isObjectExpression$1,
|
|
84630
84607
|
} = bundle.types;
|
|
84631
84608
|
|
|
84632
|
-
tsAsExpression.TSAsExpression = maybeParens$
|
|
84609
|
+
tsAsExpression.TSAsExpression = maybeParens$4((path, {print, maybe}) => {
|
|
84633
84610
|
const is = isParens(path);
|
|
84634
84611
|
|
|
84635
84612
|
maybe.print(is, '(');
|
|
@@ -84757,9 +84734,9 @@ printReturnType$5.printReturnType = (path, {traverse}) => {
|
|
|
84757
84734
|
const {printParams: printParams$5} = params;
|
|
84758
84735
|
const {printReturnType: printReturnType$4} = printReturnType$5;
|
|
84759
84736
|
|
|
84760
|
-
const {maybeParens: maybeParens$
|
|
84737
|
+
const {maybeParens: maybeParens$3} = maybeParens$c;
|
|
84761
84738
|
|
|
84762
|
-
tsFunctionType.TSFunctionType = maybeParens$
|
|
84739
|
+
tsFunctionType.TSFunctionType = maybeParens$3((path, printer, semantics) => {
|
|
84763
84740
|
const {print} = printer;
|
|
84764
84741
|
|
|
84765
84742
|
printParams$5(path, printer, semantics);
|
|
@@ -84954,23 +84931,18 @@ tsMethodSignature.TSMethodSignature = (path, printer, semantics) => {
|
|
|
84954
84931
|
|
|
84955
84932
|
var tsUnionType = {};
|
|
84956
84933
|
|
|
84957
|
-
const {
|
|
84958
|
-
|
|
84959
|
-
maybeParenClose,
|
|
84960
|
-
} = parens;
|
|
84934
|
+
const {maybeParens: maybeParens$2} = maybeParens$c;
|
|
84935
|
+
const insideTypeDeclaration = ({parentPath}) => parentPath.isTSTypeAliasDeclaration();
|
|
84961
84936
|
|
|
84962
|
-
tsUnionType.TSUnionType = (path, printer,
|
|
84937
|
+
tsUnionType.TSUnionType = maybeParens$2((path, printer, {maxTypesInOneLine}) => {
|
|
84963
84938
|
const types = path.get('types');
|
|
84939
|
+
const {length} = types;
|
|
84964
84940
|
|
|
84965
|
-
|
|
84966
|
-
|
|
84967
|
-
if (types.length <= semantics.maxTypesInOneLine)
|
|
84941
|
+
if (!insideTypeDeclaration(path) || length <= maxTypesInOneLine)
|
|
84968
84942
|
printInOneLine(types, printer);
|
|
84969
84943
|
else
|
|
84970
84944
|
printInCoupleLines(types, printer);
|
|
84971
|
-
|
|
84972
|
-
maybeParenClose(path, printer);
|
|
84973
|
-
};
|
|
84945
|
+
});
|
|
84974
84946
|
|
|
84975
84947
|
function printInOneLine(types, {traverse, write}) {
|
|
84976
84948
|
const n = types.length - 1;
|
|
@@ -85034,9 +85006,9 @@ tsTypeReference.TSTypeReference = (path, {print}) => {
|
|
|
85034
85006
|
|
|
85035
85007
|
var tsInferType = {};
|
|
85036
85008
|
|
|
85037
|
-
const {maybeParens} = maybeParens$
|
|
85009
|
+
const {maybeParens: maybeParens$1} = maybeParens$c;
|
|
85038
85010
|
|
|
85039
|
-
tsInferType.TSInferType = maybeParens((path, {print}) => {
|
|
85011
|
+
tsInferType.TSInferType = maybeParens$1((path, {print}) => {
|
|
85040
85012
|
print('infer ');
|
|
85041
85013
|
print('__typeParameter');
|
|
85042
85014
|
});
|
|
@@ -85078,6 +85050,15 @@ tsParameterProperty.TSParameterProperty = (path, {print, maybe}) => {
|
|
|
85078
85050
|
maybe.print.breakline(decoratorsLength);
|
|
85079
85051
|
};
|
|
85080
85052
|
|
|
85053
|
+
var tsTypeQuery = {};
|
|
85054
|
+
|
|
85055
|
+
const {maybeParens} = maybeParens$c;
|
|
85056
|
+
|
|
85057
|
+
tsTypeQuery.TSTypeQuery = maybeParens((path, {print}) => {
|
|
85058
|
+
print('typeof ');
|
|
85059
|
+
print('__exprName');
|
|
85060
|
+
});
|
|
85061
|
+
|
|
85081
85062
|
const {isNext: isNext$1} = is$3;
|
|
85082
85063
|
const {TSTypeLiteral} = tsTypeLiteral;
|
|
85083
85064
|
const {TSTypeAliasDeclaration} = tsTypeAliasDeclaration;
|
|
@@ -85115,6 +85096,7 @@ const {TSExportAssignment} = tsExportAssignment;
|
|
|
85115
85096
|
const {TSTypeReference} = tsTypeReference;
|
|
85116
85097
|
const {TSInferType} = tsInferType;
|
|
85117
85098
|
const {TSParameterProperty} = tsParameterProperty;
|
|
85099
|
+
const {TSTypeQuery} = tsTypeQuery;
|
|
85118
85100
|
|
|
85119
85101
|
var typescript$1 = {
|
|
85120
85102
|
TSAsExpression,
|
|
@@ -85130,6 +85112,7 @@ var typescript$1 = {
|
|
|
85130
85112
|
TSIntersectionType,
|
|
85131
85113
|
TSImportType,
|
|
85132
85114
|
TSUnionType,
|
|
85115
|
+
TSTypeQuery,
|
|
85133
85116
|
TSBigIntKeyword(path, {write}) {
|
|
85134
85117
|
write('bigint');
|
|
85135
85118
|
},
|
|
@@ -85139,10 +85122,6 @@ var typescript$1 = {
|
|
|
85139
85122
|
TSSymbolKeyword(path, {write}) {
|
|
85140
85123
|
write('symbol');
|
|
85141
85124
|
},
|
|
85142
|
-
TSTypeQuery(path, {print}) {
|
|
85143
|
-
print('typeof ');
|
|
85144
|
-
print('__exprName');
|
|
85145
|
-
},
|
|
85146
85125
|
TSNeverKeyword(path, {write}) {
|
|
85147
85126
|
write('never');
|
|
85148
85127
|
},
|