@putout/bundle 3.19.2 → 3.20.0
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 +207 -126
- package/bundle/putout.min.js +1 -1
- package/package.json +2 -2
package/bundle/putout.js
CHANGED
|
@@ -9008,7 +9008,7 @@ __export(lib_exports, {
|
|
|
9008
9008
|
return labeledStatement;
|
|
9009
9009
|
},
|
|
9010
9010
|
LogicalExpression: function() {
|
|
9011
|
-
return logicalExpression;
|
|
9011
|
+
return logicalExpression$1;
|
|
9012
9012
|
},
|
|
9013
9013
|
METHOD_TYPES: function() {
|
|
9014
9014
|
return METHOD_TYPES;
|
|
@@ -11393,7 +11393,7 @@ __export(lib_exports, {
|
|
|
11393
11393
|
return isRestProperty;
|
|
11394
11394
|
},
|
|
11395
11395
|
isReturnStatement: function() {
|
|
11396
|
-
return isReturnStatement;
|
|
11396
|
+
return isReturnStatement$1;
|
|
11397
11397
|
},
|
|
11398
11398
|
isScopable: function() {
|
|
11399
11399
|
return isScopable;
|
|
@@ -11744,7 +11744,7 @@ __export(lib_exports, {
|
|
|
11744
11744
|
return isVariableDeclaration$2;
|
|
11745
11745
|
},
|
|
11746
11746
|
isVariableDeclarator: function() {
|
|
11747
|
-
return isVariableDeclarator$
|
|
11747
|
+
return isVariableDeclarator$4;
|
|
11748
11748
|
},
|
|
11749
11749
|
isVariance: function() {
|
|
11750
11750
|
return isVariance;
|
|
@@ -11813,7 +11813,7 @@ __export(lib_exports, {
|
|
|
11813
11813
|
return labeledStatement;
|
|
11814
11814
|
},
|
|
11815
11815
|
logicalExpression: function() {
|
|
11816
|
-
return logicalExpression;
|
|
11816
|
+
return logicalExpression$1;
|
|
11817
11817
|
},
|
|
11818
11818
|
matchesPattern: function() {
|
|
11819
11819
|
return matchesPattern$1;
|
|
@@ -13838,7 +13838,7 @@ function isRestElement(node, opts) {
|
|
|
13838
13838
|
if (node.type !== "RestElement") return false;
|
|
13839
13839
|
return opts == null || shallowEqual(node, opts);
|
|
13840
13840
|
}
|
|
13841
|
-
function isReturnStatement(node, opts) {
|
|
13841
|
+
function isReturnStatement$1(node, opts) {
|
|
13842
13842
|
if (!node) return false;
|
|
13843
13843
|
if (node.type !== "ReturnStatement") return false;
|
|
13844
13844
|
return opts == null || shallowEqual(node, opts);
|
|
@@ -13893,7 +13893,7 @@ function isVariableDeclaration$2(node, opts) {
|
|
|
13893
13893
|
if (node.type !== "VariableDeclaration") return false;
|
|
13894
13894
|
return opts == null || shallowEqual(node, opts);
|
|
13895
13895
|
}
|
|
13896
|
-
function isVariableDeclarator$
|
|
13896
|
+
function isVariableDeclarator$4(node, opts) {
|
|
13897
13897
|
if (!node) return false;
|
|
13898
13898
|
if (node.type !== "VariableDeclarator") return false;
|
|
13899
13899
|
return opts == null || shallowEqual(node, opts);
|
|
@@ -16319,7 +16319,7 @@ function validateOptionalType() {
|
|
|
16319
16319
|
};
|
|
16320
16320
|
}
|
|
16321
16321
|
function arrayOf(elementType) {
|
|
16322
|
-
return chain$
|
|
16322
|
+
return chain$4(assertValueType("array"), assertEach(elementType));
|
|
16323
16323
|
}
|
|
16324
16324
|
function arrayOfType() {
|
|
16325
16325
|
for(var _len = arguments.length, typeNames = new Array(_len), _key = 0; _key < _len; _key++){
|
|
@@ -16494,7 +16494,7 @@ function assertOptionalChainStart() {
|
|
|
16494
16494
|
}
|
|
16495
16495
|
return validate4;
|
|
16496
16496
|
}
|
|
16497
|
-
function chain$
|
|
16497
|
+
function chain$4() {
|
|
16498
16498
|
for(var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++){
|
|
16499
16499
|
fns[_key] = arguments[_key];
|
|
16500
16500
|
}
|
|
@@ -16735,7 +16735,7 @@ var utils$1 = /* @__PURE__ */ Object.freeze({
|
|
|
16735
16735
|
assertOptionalChainStart: assertOptionalChainStart,
|
|
16736
16736
|
assertShape: assertShape,
|
|
16737
16737
|
assertValueType: assertValueType,
|
|
16738
|
-
chain: chain$
|
|
16738
|
+
chain: chain$4,
|
|
16739
16739
|
default: defineType$5,
|
|
16740
16740
|
defineAliasedType: defineAliasedType,
|
|
16741
16741
|
validate: validate$2$1,
|
|
@@ -17253,7 +17253,7 @@ defineType$4("Identifier", {
|
|
|
17253
17253
|
],
|
|
17254
17254
|
fields: Object.assign({}, patternLikeCommon(), {
|
|
17255
17255
|
name: {
|
|
17256
|
-
validate: chain$
|
|
17256
|
+
validate: chain$4(assertValueType("string"), Object.assign(function(node, key, val) {
|
|
17257
17257
|
if (!isValidIdentifier(val, false)) {
|
|
17258
17258
|
throw new TypeError('"'.concat(val, '" is not a valid identifier name'));
|
|
17259
17259
|
}
|
|
@@ -17354,7 +17354,7 @@ defineType$4("NumericLiteral", {
|
|
|
17354
17354
|
deprecatedAlias: "NumberLiteral",
|
|
17355
17355
|
fields: {
|
|
17356
17356
|
value: {
|
|
17357
|
-
validate: chain$
|
|
17357
|
+
validate: chain$4(assertValueType("number"), Object.assign(function(node, key, val) {
|
|
17358
17358
|
if (1 / val < 0 || !Number.isFinite(val)) {
|
|
17359
17359
|
var error = new Error("NumericLiterals must be non-negative finite numbers. You can use t.valueToNode(".concat(val, ") instead."));
|
|
17360
17360
|
{
|
|
@@ -17417,7 +17417,7 @@ defineType$4("RegExpLiteral", {
|
|
|
17417
17417
|
validate: assertValueType("string")
|
|
17418
17418
|
},
|
|
17419
17419
|
flags: {
|
|
17420
|
-
validate: chain$
|
|
17420
|
+
validate: chain$4(assertValueType("string"), Object.assign(function(node, key, val) {
|
|
17421
17421
|
var invalid = /[^gimsuy]/.exec(val);
|
|
17422
17422
|
if (invalid) {
|
|
17423
17423
|
throw new TypeError('"'.concat(invalid[0], '" is not a valid RegExp flag'));
|
|
@@ -17637,7 +17637,7 @@ defineType$4("ObjectProperty", {
|
|
|
17637
17637
|
validate: assertNodeType("Expression", "PatternLike")
|
|
17638
17638
|
},
|
|
17639
17639
|
shorthand: {
|
|
17640
|
-
validate: chain$
|
|
17640
|
+
validate: chain$4(assertValueType("boolean"), Object.assign(function(node, key, shorthand) {
|
|
17641
17641
|
if (!shorthand) return;
|
|
17642
17642
|
if (node.computed) {
|
|
17643
17643
|
throw new TypeError("Property shorthand of ObjectProperty cannot be true if computed is true");
|
|
@@ -17803,7 +17803,7 @@ defineType$4("TryStatement", {
|
|
|
17803
17803
|
],
|
|
17804
17804
|
fields: {
|
|
17805
17805
|
block: {
|
|
17806
|
-
validate: chain$
|
|
17806
|
+
validate: chain$4(assertNodeType("BlockStatement"), Object.assign(function(node) {
|
|
17807
17807
|
if (!node.handler && !node.finalizer) {
|
|
17808
17808
|
throw new TypeError("TryStatement expects either a handler or finalizer, or both");
|
|
17809
17809
|
}
|
|
@@ -18011,7 +18011,7 @@ defineType$4("ArrayPattern", {
|
|
|
18011
18011
|
],
|
|
18012
18012
|
fields: Object.assign({}, patternLikeCommon(), {
|
|
18013
18013
|
elements: {
|
|
18014
|
-
validate: chain$
|
|
18014
|
+
validate: chain$4(assertValueType("array"), assertEach(assertNodeOrValueType("null", "PatternLike", "LVal")))
|
|
18015
18015
|
}
|
|
18016
18016
|
})
|
|
18017
18017
|
});
|
|
@@ -18237,7 +18237,7 @@ defineType$4("ExportNamedDeclaration", {
|
|
|
18237
18237
|
fields: Object.assign({
|
|
18238
18238
|
declaration: {
|
|
18239
18239
|
optional: true,
|
|
18240
|
-
validate: chain$
|
|
18240
|
+
validate: chain$4(assertNodeType("Declaration"), Object.assign(function(node, key, val) {
|
|
18241
18241
|
if (val && node.specifiers.length) {
|
|
18242
18242
|
throw new TypeError("Only declaration or specifiers is allowed on ExportNamedDeclaration");
|
|
18243
18243
|
}
|
|
@@ -18470,7 +18470,7 @@ defineType$4("MetaProperty", {
|
|
|
18470
18470
|
],
|
|
18471
18471
|
fields: {
|
|
18472
18472
|
meta: {
|
|
18473
|
-
validate: chain$
|
|
18473
|
+
validate: chain$4(assertNodeType("Identifier"), Object.assign(function(node, key, val) {
|
|
18474
18474
|
var property;
|
|
18475
18475
|
switch(val.name){
|
|
18476
18476
|
case "function":
|
|
@@ -18523,7 +18523,7 @@ var classMethodOrPropertyCommon = function() {
|
|
|
18523
18523
|
optional: true
|
|
18524
18524
|
},
|
|
18525
18525
|
key: {
|
|
18526
|
-
validate: chain$
|
|
18526
|
+
validate: chain$4(function() {
|
|
18527
18527
|
var normal = assertNodeType("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral");
|
|
18528
18528
|
var computed = assertNodeType("Expression");
|
|
18529
18529
|
return function(node, key, val) {
|
|
@@ -18542,7 +18542,7 @@ var classMethodOrDeclareMethodCommon = function() {
|
|
|
18542
18542
|
default: "method"
|
|
18543
18543
|
},
|
|
18544
18544
|
access: {
|
|
18545
|
-
validate: chain$
|
|
18545
|
+
validate: chain$4(assertValueType("string"), assertOneOf("public", "private", "protected")),
|
|
18546
18546
|
optional: true
|
|
18547
18547
|
},
|
|
18548
18548
|
decorators: {
|
|
@@ -18649,7 +18649,7 @@ defineType$4("TemplateElement", {
|
|
|
18649
18649
|
],
|
|
18650
18650
|
fields: {
|
|
18651
18651
|
value: {
|
|
18652
|
-
validate: chain$
|
|
18652
|
+
validate: chain$4(assertShape({
|
|
18653
18653
|
raw: {
|
|
18654
18654
|
validate: assertValueType("string")
|
|
18655
18655
|
},
|
|
@@ -18695,7 +18695,7 @@ defineType$4("TemplateLiteral", {
|
|
|
18695
18695
|
fields: {
|
|
18696
18696
|
quasis: validateArrayOfType("TemplateElement"),
|
|
18697
18697
|
expressions: {
|
|
18698
|
-
validate: chain$
|
|
18698
|
+
validate: chain$4(assertValueType("array"), assertEach(assertNodeType("Expression", "TSType")), function(node, key, val) {
|
|
18699
18699
|
if (node.quasis.length !== val.length + 1) {
|
|
18700
18700
|
throw new TypeError("Number of ".concat(node.type, " quasis should be exactly one more than the number of expressions.\nExpected ").concat(val.length + 1, " quasis but got ").concat(node.quasis.length));
|
|
18701
18701
|
}
|
|
@@ -18717,7 +18717,7 @@ defineType$4("YieldExpression", {
|
|
|
18717
18717
|
],
|
|
18718
18718
|
fields: {
|
|
18719
18719
|
delegate: {
|
|
18720
|
-
validate: chain$
|
|
18720
|
+
validate: chain$4(assertValueType("boolean"), Object.assign(function(node, key, val) {
|
|
18721
18721
|
if (val && !node.argument) {
|
|
18722
18722
|
throw new TypeError("Property delegate of YieldExpression cannot be true if there is no argument");
|
|
18723
18723
|
}
|
|
@@ -18821,7 +18821,7 @@ defineType$4("OptionalMemberExpression", {
|
|
|
18821
18821
|
default: false
|
|
18822
18822
|
},
|
|
18823
18823
|
optional: {
|
|
18824
|
-
validate: chain$
|
|
18824
|
+
validate: chain$4(assertValueType("boolean"), assertOptionalChainStart())
|
|
18825
18825
|
}
|
|
18826
18826
|
}
|
|
18827
18827
|
});
|
|
@@ -18846,7 +18846,7 @@ defineType$4("OptionalCallExpression", {
|
|
|
18846
18846
|
},
|
|
18847
18847
|
arguments: validateArrayOfType("Expression", "SpreadElement", "ArgumentPlaceholder"),
|
|
18848
18848
|
optional: {
|
|
18849
|
-
validate: chain$
|
|
18849
|
+
validate: chain$4(assertValueType("boolean"), assertOptionalChainStart())
|
|
18850
18850
|
},
|
|
18851
18851
|
typeArguments: {
|
|
18852
18852
|
validate: assertNodeType("TypeParameterInstantiation"),
|
|
@@ -18928,7 +18928,7 @@ defineType$4("ClassAccessorProperty", {
|
|
|
18928
18928
|
],
|
|
18929
18929
|
fields: Object.assign({}, classMethodOrPropertyCommon(), {
|
|
18930
18930
|
key: {
|
|
18931
|
-
validate: chain$
|
|
18931
|
+
validate: chain$4(function() {
|
|
18932
18932
|
var normal = assertNodeType("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral", "PrivateName");
|
|
18933
18933
|
var computed = assertNodeType("Expression");
|
|
18934
18934
|
return function(node, key, val) {
|
|
@@ -21474,7 +21474,7 @@ function regExpLiteral(pattern) {
|
|
|
21474
21474
|
validate$4(defs.flags, node, "flags", flags);
|
|
21475
21475
|
return node;
|
|
21476
21476
|
}
|
|
21477
|
-
function logicalExpression(operator, left, right) {
|
|
21477
|
+
function logicalExpression$1(operator, left, right) {
|
|
21478
21478
|
var node = {
|
|
21479
21479
|
type: "LogicalExpression",
|
|
21480
21480
|
operator: operator,
|
|
@@ -25944,7 +25944,7 @@ function getFunctionName(node, parent) {
|
|
|
25944
25944
|
id = getObjectMemberKey(node);
|
|
25945
25945
|
if (node.kind === "get") prefix2 = "get ";
|
|
25946
25946
|
else if (node.kind === "set") prefix2 = "set ";
|
|
25947
|
-
} else if (isVariableDeclarator$
|
|
25947
|
+
} else if (isVariableDeclarator$4(parent, {
|
|
25948
25948
|
init: node
|
|
25949
25949
|
})) {
|
|
25950
25950
|
id = parent.id;
|
|
@@ -29368,7 +29368,7 @@ var CommentsParser = /*#__PURE__*/ function(BaseParser) {
|
|
|
29368
29368
|
}(BaseParser);
|
|
29369
29369
|
var lineBreak = /\r\n|[\r\n\u2028\u2029]/;
|
|
29370
29370
|
var lineBreakG = new RegExp(lineBreak.source, "g");
|
|
29371
|
-
function isNewLine(code2) {
|
|
29371
|
+
function isNewLine$1(code2) {
|
|
29372
29372
|
switch(code2){
|
|
29373
29373
|
case 10:
|
|
29374
29374
|
case 13:
|
|
@@ -29381,7 +29381,7 @@ function isNewLine(code2) {
|
|
|
29381
29381
|
}
|
|
29382
29382
|
function hasNewLine(input, start, end) {
|
|
29383
29383
|
for(var i = start; i < end; i++){
|
|
29384
|
-
if (isNewLine(input.charCodeAt(i))) {
|
|
29384
|
+
if (isNewLine$1(input.charCodeAt(i))) {
|
|
29385
29385
|
return true;
|
|
29386
29386
|
}
|
|
29387
29387
|
}
|
|
@@ -30186,7 +30186,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
|
|
|
30186
30186
|
if (!this.isLookahead) startLoc = this.state.curPosition();
|
|
30187
30187
|
var ch = this.input.charCodeAt(this.state.pos += startSkip);
|
|
30188
30188
|
if (this.state.pos < this.length) {
|
|
30189
|
-
while(!isNewLine(ch) && ++this.state.pos < this.length){
|
|
30189
|
+
while(!isNewLine$1(ch) && ++this.state.pos < this.length){
|
|
30190
30190
|
ch = this.input.charCodeAt(this.state.pos);
|
|
30191
30191
|
}
|
|
30192
30192
|
}
|
|
@@ -30382,7 +30382,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
|
|
|
30382
30382
|
if (ch !== 33) return false;
|
|
30383
30383
|
var start = this.state.pos;
|
|
30384
30384
|
this.state.pos += 1;
|
|
30385
|
-
while(!isNewLine(ch) && ++this.state.pos < this.length){
|
|
30385
|
+
while(!isNewLine$1(ch) && ++this.state.pos < this.length){
|
|
30386
30386
|
ch = this.input.charCodeAt(this.state.pos);
|
|
30387
30387
|
}
|
|
30388
30388
|
var value1 = this.input.slice(start + 2, this.state.pos);
|
|
@@ -30724,7 +30724,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
|
|
|
30724
30724
|
throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
|
|
30725
30725
|
}
|
|
30726
30726
|
var ch = this.input.charCodeAt(pos);
|
|
30727
|
-
if (isNewLine(ch)) {
|
|
30727
|
+
if (isNewLine$1(ch)) {
|
|
30728
30728
|
throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
|
|
30729
30729
|
}
|
|
30730
30730
|
if (escaped) {
|
|
@@ -35054,7 +35054,7 @@ var jsx$3 = function(superClass) {
|
|
|
35054
35054
|
});
|
|
35055
35055
|
}
|
|
35056
35056
|
default:
|
|
35057
|
-
if (isNewLine(ch)) {
|
|
35057
|
+
if (isNewLine$1(ch)) {
|
|
35058
35058
|
out += this.input.slice(chunkStart, this.state.pos);
|
|
35059
35059
|
out += this.jsxReadNewLine(true);
|
|
35060
35060
|
chunkStart = this.state.pos;
|
|
@@ -35097,7 +35097,7 @@ var jsx$3 = function(superClass) {
|
|
|
35097
35097
|
out += this.input.slice(chunkStart, this.state.pos);
|
|
35098
35098
|
out += this.jsxReadEntity();
|
|
35099
35099
|
chunkStart = this.state.pos;
|
|
35100
|
-
} else if (isNewLine(ch)) {
|
|
35100
|
+
} else if (isNewLine$1(ch)) {
|
|
35101
35101
|
out += this.input.slice(chunkStart, this.state.pos);
|
|
35102
35102
|
out += this.jsxReadNewLine(false);
|
|
35103
35103
|
chunkStart = this.state.pos;
|
|
@@ -46897,7 +46897,7 @@ function TSInstantiationExpression$1(node, parent) {
|
|
|
46897
46897
|
var parentType = parent.type;
|
|
46898
46898
|
return (parentType === "CallExpression" || parentType === "OptionalCallExpression" || parentType === "NewExpression" || parentType === "TSInstantiationExpression") && !!parent.typeParameters;
|
|
46899
46899
|
}
|
|
46900
|
-
function BinaryExpression$
|
|
46900
|
+
function BinaryExpression$1(node, parent, tokenContext, inForStatementInit) {
|
|
46901
46901
|
return node.operator === "in" && inForStatementInit;
|
|
46902
46902
|
}
|
|
46903
46903
|
function SequenceExpression$1(node, parent) {
|
|
@@ -46996,7 +46996,7 @@ var parens = /* @__PURE__ */ Object.freeze({
|
|
|
46996
46996
|
AssignmentExpression: AssignmentExpression$1,
|
|
46997
46997
|
AwaitExpression: YieldExpression$1,
|
|
46998
46998
|
Binary: Binary,
|
|
46999
|
-
BinaryExpression: BinaryExpression$
|
|
46999
|
+
BinaryExpression: BinaryExpression$1,
|
|
47000
47000
|
ClassExpression: ClassExpression$1,
|
|
47001
47001
|
ConditionalExpression: ConditionalExpression$1,
|
|
47002
47002
|
DoExpression: DoExpression$1,
|
|
@@ -78646,7 +78646,7 @@ const {maybeInsideFn} = maybeInsideFn$1;
|
|
|
78646
78646
|
|
|
78647
78647
|
const {
|
|
78648
78648
|
isObjectProperty: isObjectProperty$1,
|
|
78649
|
-
isVariableDeclarator: isVariableDeclarator$
|
|
78649
|
+
isVariableDeclarator: isVariableDeclarator$3,
|
|
78650
78650
|
isClassProperty,
|
|
78651
78651
|
isTSPropertySignature,
|
|
78652
78652
|
isSpreadElement: isSpreadElement$2,
|
|
@@ -78654,17 +78654,17 @@ const {
|
|
|
78654
78654
|
|
|
78655
78655
|
const isProperty = satisfy$4([
|
|
78656
78656
|
isObjectProperty$1,
|
|
78657
|
-
isVariableDeclarator$
|
|
78657
|
+
isVariableDeclarator$3,
|
|
78658
78658
|
isClassProperty,
|
|
78659
78659
|
isTSPropertySignature,
|
|
78660
78660
|
isSpreadElement$2,
|
|
78661
78661
|
]);
|
|
78662
78662
|
|
|
78663
78663
|
const isInsideVar = ({parentPath}) => {
|
|
78664
|
-
if (isVariableDeclarator$
|
|
78664
|
+
if (isVariableDeclarator$3(parentPath))
|
|
78665
78665
|
return true;
|
|
78666
78666
|
|
|
78667
|
-
return isVariableDeclarator$
|
|
78667
|
+
return isVariableDeclarator$3(parentPath.parentPath);
|
|
78668
78668
|
};
|
|
78669
78669
|
|
|
78670
78670
|
const hasDecorators = (path) => {
|
|
@@ -79031,13 +79031,21 @@ function isOneArgArrow(path) {
|
|
|
79031
79031
|
return param.type === 'Identifier';
|
|
79032
79032
|
}
|
|
79033
79033
|
|
|
79034
|
-
var maybeParens$
|
|
79034
|
+
var maybeParens$e = {};
|
|
79035
|
+
|
|
79036
|
+
const isFn$6 = (a) => typeof a === 'function';
|
|
79037
|
+
const isParens$3 = (path) => path.node.extra?.parenthesized;
|
|
79035
79038
|
|
|
79036
|
-
|
|
79039
|
+
maybeParens$e.isParens = isParens$3;
|
|
79040
|
+
maybeParens$e.maybeParens = (print) => {
|
|
79041
|
+
if (isFn$6(print))
|
|
79042
|
+
return maybeParensPrint(print);
|
|
79043
|
+
|
|
79044
|
+
return maybeParensCondition(print);
|
|
79045
|
+
};
|
|
79037
79046
|
|
|
79038
|
-
|
|
79039
|
-
|
|
79040
|
-
condition: isParens$4,
|
|
79047
|
+
const maybeParensPrint = (print) => ({
|
|
79048
|
+
condition: isParens$3,
|
|
79041
79049
|
before(path, {write}) {
|
|
79042
79050
|
write('(');
|
|
79043
79051
|
},
|
|
@@ -79047,11 +79055,16 @@ maybeParens$c.maybeParens = (print) => ({
|
|
|
79047
79055
|
},
|
|
79048
79056
|
});
|
|
79049
79057
|
|
|
79058
|
+
const maybeParensCondition = ({print, condition}) => ({
|
|
79059
|
+
...maybeParensPrint(print),
|
|
79060
|
+
condition: (path) => condition(path) || isParens$3(path),
|
|
79061
|
+
});
|
|
79062
|
+
|
|
79050
79063
|
const {exists: exists$e} = is$3;
|
|
79051
79064
|
const {printParams: printParams$c} = params;
|
|
79052
|
-
const {maybeParens: maybeParens$
|
|
79065
|
+
const {maybeParens: maybeParens$d} = maybeParens$e;
|
|
79053
79066
|
|
|
79054
|
-
arrowFunctionExpression.ArrowFunctionExpression = maybeParens$
|
|
79067
|
+
arrowFunctionExpression.ArrowFunctionExpression = maybeParens$d((path, printer, semantics) => {
|
|
79055
79068
|
const {
|
|
79056
79069
|
print,
|
|
79057
79070
|
maybe,
|
|
@@ -79307,9 +79320,9 @@ var functionExpression = {};
|
|
|
79307
79320
|
|
|
79308
79321
|
const {exists: exists$d} = is$3;
|
|
79309
79322
|
const {printParams: printParams$8} = params;
|
|
79310
|
-
const {maybeParens: maybeParens$
|
|
79323
|
+
const {maybeParens: maybeParens$c} = maybeParens$e;
|
|
79311
79324
|
|
|
79312
|
-
functionExpression.FunctionExpression = maybeParens$
|
|
79325
|
+
functionExpression.FunctionExpression = maybeParens$c((path, printer, semantics) => {
|
|
79313
79326
|
const {
|
|
79314
79327
|
print,
|
|
79315
79328
|
maybe,
|
|
@@ -79359,11 +79372,11 @@ var unaryExpressions$1 = {};
|
|
|
79359
79372
|
|
|
79360
79373
|
const {isLast: isLast$b, isNext: isNext$m} = is$3;
|
|
79361
79374
|
|
|
79362
|
-
const {maybeParens: maybeParens$
|
|
79375
|
+
const {maybeParens: maybeParens$b} = maybeParens$e;
|
|
79363
79376
|
|
|
79364
79377
|
const isWord = (a) => /^(delete|typeof|void|throw)$/.test(a);
|
|
79365
79378
|
|
|
79366
|
-
const unaryExpression = maybeParens$
|
|
79379
|
+
const unaryExpression = maybeParens$b((path, printer) => {
|
|
79367
79380
|
const {maybe, traverse} = printer;
|
|
79368
79381
|
const {prefix, operator} = path.node;
|
|
79369
79382
|
const argPath = path.get('argument');
|
|
@@ -79383,7 +79396,7 @@ unaryExpressions$1.AwaitExpression = (path, {print}) => {
|
|
|
79383
79396
|
});
|
|
79384
79397
|
};
|
|
79385
79398
|
|
|
79386
|
-
unaryExpressions$1.YieldExpression = maybeParens$
|
|
79399
|
+
unaryExpressions$1.YieldExpression = maybeParens$b((path, {print, maybe}) => {
|
|
79387
79400
|
const {delegate} = path.node;
|
|
79388
79401
|
|
|
79389
79402
|
print(`yield`);
|
|
@@ -79411,14 +79424,14 @@ function printUnary(path, name, {print}) {
|
|
|
79411
79424
|
|
|
79412
79425
|
var memberExpressions$1 = {};
|
|
79413
79426
|
|
|
79414
|
-
var chain$
|
|
79427
|
+
var chain$3 = {};
|
|
79415
79428
|
|
|
79416
79429
|
const {assign: assign$c} = Object;
|
|
79417
79430
|
|
|
79418
|
-
chain$
|
|
79431
|
+
chain$3.chain = (path) => {
|
|
79419
79432
|
const all = [
|
|
79420
|
-
...down(path),
|
|
79421
|
-
...up(path),
|
|
79433
|
+
...down$1(path),
|
|
79434
|
+
...up$1(path),
|
|
79422
79435
|
];
|
|
79423
79436
|
|
|
79424
79437
|
const properties = all.slice(0, -1);
|
|
@@ -79427,7 +79440,7 @@ chain$1.chain = (path) => {
|
|
|
79427
79440
|
return [root, properties];
|
|
79428
79441
|
};
|
|
79429
79442
|
|
|
79430
|
-
function down(path) {
|
|
79443
|
+
function down$1(path) {
|
|
79431
79444
|
const properties = [];
|
|
79432
79445
|
|
|
79433
79446
|
let current = path.get('object');
|
|
@@ -79450,7 +79463,7 @@ function down(path) {
|
|
|
79450
79463
|
return properties;
|
|
79451
79464
|
}
|
|
79452
79465
|
|
|
79453
|
-
function up(current) {
|
|
79466
|
+
function up$1(current) {
|
|
79454
79467
|
const properties = [];
|
|
79455
79468
|
|
|
79456
79469
|
while (current.isMemberExpression()) {
|
|
@@ -79492,11 +79505,11 @@ const {
|
|
|
79492
79505
|
isIfStatement,
|
|
79493
79506
|
} = bundle.types;
|
|
79494
79507
|
|
|
79495
|
-
const {chain} = chain$
|
|
79508
|
+
const {chain: chain$2} = chain$3;
|
|
79496
79509
|
const {satisfy: satisfy$3} = is$3;
|
|
79497
79510
|
|
|
79498
79511
|
const {maybePrintComputed} = maybePrintComputed$2;
|
|
79499
|
-
const {maybeParens: maybeParens$
|
|
79512
|
+
const {maybeParens: maybeParens$a} = maybeParens$e;
|
|
79500
79513
|
|
|
79501
79514
|
const isArgOfCall = (path) => path.parentPath.isCallExpression() && path.parentPath.get('arguments.0') === path;
|
|
79502
79515
|
|
|
@@ -79531,7 +79544,7 @@ memberExpressions$1.MemberExpression = (path, printer) => {
|
|
|
79531
79544
|
maybe.indent.dec(isChain);
|
|
79532
79545
|
};
|
|
79533
79546
|
|
|
79534
|
-
memberExpressions$1.OptionalMemberExpression = maybeParens$
|
|
79547
|
+
memberExpressions$1.OptionalMemberExpression = maybeParens$a((path, {print, maybe}) => {
|
|
79535
79548
|
const {computed, optional} = path.node;
|
|
79536
79549
|
|
|
79537
79550
|
print('__object');
|
|
@@ -79581,7 +79594,7 @@ const isIfUp = (path) => {
|
|
|
79581
79594
|
|
|
79582
79595
|
memberExpressions$1.likeChain = likeChain$1;
|
|
79583
79596
|
function likeChain$1(path) {
|
|
79584
|
-
const [root, properties] = chain(path);
|
|
79597
|
+
const [root, properties] = chain$2(path);
|
|
79585
79598
|
|
|
79586
79599
|
if (isExcludedFromChain(root))
|
|
79587
79600
|
return false;
|
|
@@ -79712,7 +79725,7 @@ _class.ClassDeclaration = {
|
|
|
79712
79725
|
var callExpression = {};
|
|
79713
79726
|
|
|
79714
79727
|
const {exists: exists$c} = is$3;
|
|
79715
|
-
const {maybeParens: maybeParens$
|
|
79728
|
+
const {maybeParens: maybeParens$9} = maybeParens$e;
|
|
79716
79729
|
const {isArray: isArray$e} = Array;
|
|
79717
79730
|
|
|
79718
79731
|
const parseArgs = (path) => {
|
|
@@ -79724,7 +79737,7 @@ const parseArgs = (path) => {
|
|
|
79724
79737
|
return argsPath;
|
|
79725
79738
|
};
|
|
79726
79739
|
|
|
79727
|
-
const CallExpression$1 = maybeParens$
|
|
79740
|
+
const CallExpression$1 = maybeParens$9((path, {indent, print, maybe, traverse}) => {
|
|
79728
79741
|
const args = parseArgs(path);
|
|
79729
79742
|
const isParentCall = tooLong$1(args) && path.parentPath.isCallExpression();
|
|
79730
79743
|
|
|
@@ -79927,7 +79940,7 @@ objectExpression.ObjectExpression = (path, printer, semantics) => {
|
|
|
79927
79940
|
|
|
79928
79941
|
const properties = path.get('properties');
|
|
79929
79942
|
const {length} = properties;
|
|
79930
|
-
const parens = isParens$
|
|
79943
|
+
const parens = isParens$2(path);
|
|
79931
79944
|
const manyLines = !isOneLine$1(path);
|
|
79932
79945
|
|
|
79933
79946
|
maybe.print(parens, '(');
|
|
@@ -80032,7 +80045,7 @@ function isOneLine$1(path) {
|
|
|
80032
80045
|
return !isValue(path);
|
|
80033
80046
|
}
|
|
80034
80047
|
|
|
80035
|
-
function isParens$
|
|
80048
|
+
function isParens$2(path) {
|
|
80036
80049
|
if (isBodyOfArrow(path))
|
|
80037
80050
|
return true;
|
|
80038
80051
|
|
|
@@ -80060,6 +80073,9 @@ concatenate$1.isConcatenation = (path) => {
|
|
|
80060
80073
|
const {parentPath} = path;
|
|
80061
80074
|
const {operator} = path.node;
|
|
80062
80075
|
|
|
80076
|
+
if (operator !== '+')
|
|
80077
|
+
return false;
|
|
80078
|
+
|
|
80063
80079
|
const startLine = path.node.loc?.start.line;
|
|
80064
80080
|
const endLine = path.node.loc?.end.line;
|
|
80065
80081
|
|
|
@@ -80069,9 +80085,6 @@ concatenate$1.isConcatenation = (path) => {
|
|
|
80069
80085
|
const left = path.get('left');
|
|
80070
80086
|
const right = path.get('right');
|
|
80071
80087
|
|
|
80072
|
-
if (operator !== '+')
|
|
80073
|
-
return false;
|
|
80074
|
-
|
|
80075
80088
|
if (isStringLike(left) && isStringLike(right) && isBinaryExpression(parentPath))
|
|
80076
80089
|
return true;
|
|
80077
80090
|
|
|
@@ -80209,7 +80222,7 @@ const {
|
|
|
80209
80222
|
isIdentifier: isIdentifier$a,
|
|
80210
80223
|
isObjectPattern: isObjectPattern$2,
|
|
80211
80224
|
isAssignmentPattern,
|
|
80212
|
-
isVariableDeclarator: isVariableDeclarator$
|
|
80225
|
+
isVariableDeclarator: isVariableDeclarator$2,
|
|
80213
80226
|
} = bundle.types;
|
|
80214
80227
|
|
|
80215
80228
|
const {wrongShorthand} = wrongShortand;
|
|
@@ -80391,7 +80404,7 @@ function shouldAddNewline(path, semantics) {
|
|
|
80391
80404
|
if (hasObjectPattern(properties))
|
|
80392
80405
|
return COUPLE_LINES;
|
|
80393
80406
|
|
|
80394
|
-
if (moreCount && !moreLength && isVariableDeclarator$
|
|
80407
|
+
if (moreCount && !moreLength && isVariableDeclarator$2(path.parentPath))
|
|
80395
80408
|
return ONE_LINE$1;
|
|
80396
80409
|
|
|
80397
80410
|
if (!fnParam && n && !isForOf$2(path) && checkLength(properties))
|
|
@@ -80476,7 +80489,8 @@ var assignmentExpression = {};
|
|
|
80476
80489
|
|
|
80477
80490
|
var maybeWriteBrace$3 = {};
|
|
80478
80491
|
|
|
80479
|
-
const {isParens: isParens$
|
|
80492
|
+
const {isParens: isParens$1} = maybeParens$e;
|
|
80493
|
+
|
|
80480
80494
|
maybeWriteBrace$3.maybePrintLeftBrace = (path, printer, semantics) => {
|
|
80481
80495
|
maybeWriteBrace$2(path, printer, semantics, {
|
|
80482
80496
|
brace: '(',
|
|
@@ -80513,7 +80527,7 @@ function maybeWriteBrace$2(path, printer, semantics, {brace}) {
|
|
|
80513
80527
|
if (!roundBraces.assign)
|
|
80514
80528
|
return;
|
|
80515
80529
|
|
|
80516
|
-
if (!isParens$
|
|
80530
|
+
if (!isParens$1(path))
|
|
80517
80531
|
return;
|
|
80518
80532
|
|
|
80519
80533
|
write(brace);
|
|
@@ -82145,63 +82159,134 @@ const {
|
|
|
82145
82159
|
} = concatenate$1;
|
|
82146
82160
|
|
|
82147
82161
|
const {maybeSpace} = maybeSpace$1;
|
|
82148
|
-
const {
|
|
82162
|
+
const {maybeParens: maybeParens$8} = maybeParens$e;
|
|
82149
82163
|
|
|
82150
|
-
|
|
82164
|
+
binaryExpression.BinaryExpression = maybeParens$8((path, {print, indent, maybe}) => {
|
|
82165
|
+
const {operator} = path.node;
|
|
82166
|
+
|
|
82167
|
+
if (operator === 'in' || operator === 'instanceof') {
|
|
82168
|
+
print('__left');
|
|
82169
|
+
print(' ');
|
|
82170
|
+
print(operator);
|
|
82171
|
+
print(' ');
|
|
82172
|
+
print('__right');
|
|
82173
|
+
|
|
82174
|
+
return;
|
|
82175
|
+
}
|
|
82176
|
+
|
|
82177
|
+
if (isConcatenation$1(path))
|
|
82178
|
+
return concatenate(path, {
|
|
82179
|
+
print,
|
|
82180
|
+
indent,
|
|
82181
|
+
maybe,
|
|
82182
|
+
});
|
|
82183
|
+
|
|
82184
|
+
print('__left');
|
|
82185
|
+
print.space();
|
|
82186
|
+
print(path.node.operator);
|
|
82187
|
+
maybeSpace(path, {
|
|
82188
|
+
print,
|
|
82189
|
+
});
|
|
82190
|
+
print('__right');
|
|
82191
|
+
});
|
|
82192
|
+
|
|
82193
|
+
var logicalExpression = {};
|
|
82194
|
+
|
|
82195
|
+
var chain$1 = {};
|
|
82196
|
+
|
|
82197
|
+
const {
|
|
82198
|
+
isReturnStatement,
|
|
82199
|
+
isVariableDeclarator: isVariableDeclarator$1,
|
|
82200
|
+
} = bundle.types;
|
|
82201
|
+
|
|
82202
|
+
chain$1.isRootOk = (path) => {
|
|
82203
|
+
return isReturnStatement(path) || isVariableDeclarator$1(path);
|
|
82204
|
+
};
|
|
82205
|
+
|
|
82206
|
+
chain$1.chain = (path) => {
|
|
82207
|
+
const [downCount] = down(path);
|
|
82208
|
+
const [upCount, root] = up(path);
|
|
82209
|
+
|
|
82210
|
+
return [
|
|
82211
|
+
root,
|
|
82212
|
+
downCount + upCount,
|
|
82213
|
+
downCount,
|
|
82214
|
+
upCount,
|
|
82215
|
+
];
|
|
82216
|
+
};
|
|
82217
|
+
|
|
82218
|
+
function down(current) {
|
|
82219
|
+
let count = 0;
|
|
82220
|
+
|
|
82221
|
+
do {
|
|
82222
|
+
++count;
|
|
82223
|
+
current = current.get('left');
|
|
82224
|
+
const {operator} = current.node;
|
|
82225
|
+
|
|
82226
|
+
if (operator !== '||' && operator !== '&&')
|
|
82227
|
+
break;
|
|
82228
|
+
} while (current.isLogicalExpression());
|
|
82229
|
+
|
|
82230
|
+
return [count];
|
|
82231
|
+
}
|
|
82232
|
+
|
|
82233
|
+
function up(current) {
|
|
82234
|
+
let count = 0;
|
|
82235
|
+
|
|
82236
|
+
do {
|
|
82237
|
+
++count;
|
|
82238
|
+
current = current.parentPath;
|
|
82239
|
+
} while (current.isLogicalExpression());
|
|
82240
|
+
|
|
82241
|
+
return [
|
|
82242
|
+
count, {
|
|
82243
|
+
type: current.type,
|
|
82244
|
+
},
|
|
82245
|
+
];
|
|
82246
|
+
}
|
|
82247
|
+
|
|
82248
|
+
const {maybeParens: maybeParens$7} = maybeParens$e;
|
|
82249
|
+
const {chain, isRootOk} = chain$1;
|
|
82250
|
+
|
|
82251
|
+
logicalExpression.LogicalExpression = maybeParens$7({
|
|
82151
82252
|
condition(path) {
|
|
82152
|
-
if (
|
|
82253
|
+
if (path.parentPath.isUnaryExpression())
|
|
82153
82254
|
return true;
|
|
82154
82255
|
|
|
82155
82256
|
return path.parentPath.isAwaitExpression();
|
|
82156
82257
|
},
|
|
82157
|
-
|
|
82158
|
-
print('
|
|
82159
|
-
},
|
|
82160
|
-
print(path, {print, indent, maybe}) {
|
|
82161
|
-
const {operator} = path.node;
|
|
82162
|
-
|
|
82163
|
-
if (operator === 'instanceof') {
|
|
82164
|
-
print('__left');
|
|
82165
|
-
print(' instanceof ');
|
|
82166
|
-
print('__right');
|
|
82167
|
-
|
|
82168
|
-
return;
|
|
82169
|
-
}
|
|
82258
|
+
print(path, {print, maybe}, semantics) {
|
|
82259
|
+
print('__left');
|
|
82170
82260
|
|
|
82171
|
-
|
|
82172
|
-
print('__left');
|
|
82173
|
-
print(' in ');
|
|
82174
|
-
print('__right');
|
|
82175
|
-
|
|
82176
|
-
return;
|
|
82177
|
-
}
|
|
82261
|
+
const needNewLine = isNewLine(path, semantics);
|
|
82178
82262
|
|
|
82179
|
-
|
|
82180
|
-
|
|
82181
|
-
|
|
82182
|
-
indent,
|
|
82183
|
-
maybe,
|
|
82184
|
-
});
|
|
82263
|
+
maybe.indent.inc(needNewLine);
|
|
82264
|
+
needNewLine ? print.breakline() : print.space();
|
|
82265
|
+
maybe.indent.dec(needNewLine);
|
|
82185
82266
|
|
|
82186
|
-
print('__left');
|
|
82187
|
-
print.space();
|
|
82188
82267
|
print(path.node.operator);
|
|
82189
|
-
|
|
82190
|
-
print,
|
|
82191
|
-
});
|
|
82268
|
+
print.space();
|
|
82192
82269
|
print('__right');
|
|
82193
82270
|
},
|
|
82194
|
-
|
|
82195
|
-
print(')');
|
|
82196
|
-
},
|
|
82197
|
-
};
|
|
82271
|
+
});
|
|
82198
82272
|
|
|
82199
|
-
|
|
82200
|
-
|
|
82273
|
+
function isNewLine(path, semantics) {
|
|
82274
|
+
const [root, count] = chain(path);
|
|
82275
|
+
|
|
82276
|
+
if (!isRootOk(root))
|
|
82277
|
+
return false;
|
|
82278
|
+
|
|
82279
|
+
if (count <= semantics.maxElementsInOneLine)
|
|
82280
|
+
return false;
|
|
82281
|
+
|
|
82282
|
+
const {operator} = path.node;
|
|
82283
|
+
|
|
82284
|
+
return operator === '||' || operator === '&&';
|
|
82285
|
+
}
|
|
82201
82286
|
|
|
82202
82287
|
var conditionalExpression = {};
|
|
82203
82288
|
|
|
82204
|
-
const {maybeParens: maybeParens$6} = maybeParens$
|
|
82289
|
+
const {maybeParens: maybeParens$6} = maybeParens$e;
|
|
82205
82290
|
|
|
82206
82291
|
conditionalExpression.ConditionalExpression = maybeParens$6((path, {print}) => {
|
|
82207
82292
|
print('__test');
|
|
@@ -82451,12 +82536,8 @@ const {RestElement} = restElement;
|
|
|
82451
82536
|
const {SpreadElement} = spreadElement;
|
|
82452
82537
|
const {SequenceExpression} = sequenceExpression;
|
|
82453
82538
|
const {TaggedTemplateExpression} = taggedTemplateExpression;
|
|
82454
|
-
|
|
82455
|
-
const {
|
|
82456
|
-
BinaryExpression,
|
|
82457
|
-
LogicalExpression,
|
|
82458
|
-
} = binaryExpression;
|
|
82459
|
-
|
|
82539
|
+
const {BinaryExpression} = binaryExpression;
|
|
82540
|
+
const {LogicalExpression} = logicalExpression;
|
|
82460
82541
|
const {ConditionalExpression} = conditionalExpression;
|
|
82461
82542
|
const {StaticBlock} = staticBlock;
|
|
82462
82543
|
const {RecordExpression} = recordExpression;
|
|
@@ -84120,7 +84201,7 @@ maybeGet.maybeDecorators = (path) => {
|
|
|
84120
84201
|
};
|
|
84121
84202
|
|
|
84122
84203
|
const {maybeDecorators} = maybeGet;
|
|
84123
|
-
const {maybeParens: maybeParens$5} = maybeParens$
|
|
84204
|
+
const {maybeParens: maybeParens$5} = maybeParens$e;
|
|
84124
84205
|
const {maybeTypeAnnotation} = maybeTypeAnnotation$4;
|
|
84125
84206
|
|
|
84126
84207
|
identifier.Identifier = maybeParens$5(maybeTypeAnnotation((path, printer) => {
|
|
@@ -84600,7 +84681,7 @@ tsInterfaceDeclaration.TSInterfaceDeclaration = {
|
|
|
84600
84681
|
|
|
84601
84682
|
var tsAsExpression = {};
|
|
84602
84683
|
|
|
84603
|
-
const {maybeParens: maybeParens$4} = maybeParens$
|
|
84684
|
+
const {maybeParens: maybeParens$4} = maybeParens$e;
|
|
84604
84685
|
const {
|
|
84605
84686
|
isVariableDeclarator,
|
|
84606
84687
|
isObjectExpression: isObjectExpression$1,
|
|
@@ -84734,7 +84815,7 @@ printReturnType$5.printReturnType = (path, {traverse}) => {
|
|
|
84734
84815
|
const {printParams: printParams$5} = params;
|
|
84735
84816
|
const {printReturnType: printReturnType$4} = printReturnType$5;
|
|
84736
84817
|
|
|
84737
|
-
const {maybeParens: maybeParens$3} = maybeParens$
|
|
84818
|
+
const {maybeParens: maybeParens$3} = maybeParens$e;
|
|
84738
84819
|
|
|
84739
84820
|
tsFunctionType.TSFunctionType = maybeParens$3((path, printer, semantics) => {
|
|
84740
84821
|
const {print} = printer;
|
|
@@ -84931,7 +85012,7 @@ tsMethodSignature.TSMethodSignature = (path, printer, semantics) => {
|
|
|
84931
85012
|
|
|
84932
85013
|
var tsUnionType = {};
|
|
84933
85014
|
|
|
84934
|
-
const {maybeParens: maybeParens$2} = maybeParens$
|
|
85015
|
+
const {maybeParens: maybeParens$2} = maybeParens$e;
|
|
84935
85016
|
const insideTypeDeclaration = ({parentPath}) => parentPath.isTSTypeAliasDeclaration();
|
|
84936
85017
|
|
|
84937
85018
|
tsUnionType.TSUnionType = maybeParens$2((path, printer, {maxTypesInOneLine}) => {
|
|
@@ -85006,7 +85087,7 @@ tsTypeReference.TSTypeReference = (path, {print}) => {
|
|
|
85006
85087
|
|
|
85007
85088
|
var tsInferType = {};
|
|
85008
85089
|
|
|
85009
|
-
const {maybeParens: maybeParens$1} = maybeParens$
|
|
85090
|
+
const {maybeParens: maybeParens$1} = maybeParens$e;
|
|
85010
85091
|
|
|
85011
85092
|
tsInferType.TSInferType = maybeParens$1((path, {print}) => {
|
|
85012
85093
|
print('infer ');
|
|
@@ -85052,7 +85133,7 @@ tsParameterProperty.TSParameterProperty = (path, {print, maybe}) => {
|
|
|
85052
85133
|
|
|
85053
85134
|
var tsTypeQuery = {};
|
|
85054
85135
|
|
|
85055
|
-
const {maybeParens} = maybeParens$
|
|
85136
|
+
const {maybeParens} = maybeParens$e;
|
|
85056
85137
|
|
|
85057
85138
|
tsTypeQuery.TSTypeQuery = maybeParens((path, {print}) => {
|
|
85058
85139
|
print('typeof ');
|