houdini 1.0.0-next.5 → 1.0.0-next.7
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/build/cmd-cjs/index.js +484 -475
- package/build/cmd-esm/index.js +484 -475
- package/build/codegen/generators/artifacts/index.d.ts +2 -2
- package/build/codegen/generators/artifacts/indexFile.d.ts +2 -2
- package/build/codegen/generators/artifacts/selection.d.ts +2 -2
- package/build/codegen/generators/indexFile/index.d.ts +2 -2
- package/build/codegen/generators/persistedQueries/index.d.ts +2 -2
- package/build/codegen/generators/runtime/graphqlFunction.d.ts +2 -2
- package/build/codegen/generators/runtime/index.d.ts +2 -2
- package/build/codegen/generators/typescript/documentTypes.d.ts +2 -2
- package/build/codegen/generators/typescript/imperativeTypeDef.d.ts +2 -2
- package/build/codegen/generators/typescript/index.d.ts +2 -2
- package/build/codegen/index.d.ts +2 -2
- package/build/codegen/transforms/addID.d.ts +2 -2
- package/build/codegen/transforms/composeQueries.d.ts +4 -4
- package/build/codegen/transforms/fragmentVariables.d.ts +2 -2
- package/build/codegen/transforms/list.d.ts +2 -2
- package/build/codegen/transforms/paginate.d.ts +2 -2
- package/build/codegen/transforms/schema.d.ts +2 -2
- package/build/codegen/transforms/typename.d.ts +2 -2
- package/build/codegen/validators/noIDAlias.d.ts +2 -2
- package/build/codegen/validators/plugins.d.ts +2 -2
- package/build/codegen/validators/typeCheck.d.ts +2 -2
- package/build/codegen/validators/uniqueNames.d.ts +2 -2
- package/build/codegen-cjs/index.js +481 -472
- package/build/codegen-esm/index.js +481 -472
- package/build/lib/graphql.d.ts +2 -2
- package/build/lib/types.d.ts +35 -35
- package/build/lib-cjs/index.js +355 -355
- package/build/lib-esm/index.js +355 -355
- package/build/runtime/client/documentStore.d.ts +1 -1
- package/build/runtime/client/index.d.ts +7 -6
- package/build/runtime-cjs/client/documentStore.d.ts +1 -1
- package/build/runtime-cjs/client/index.d.ts +7 -6
- package/build/runtime-esm/client/documentStore.d.ts +1 -1
- package/build/runtime-esm/client/index.d.ts +7 -6
- package/build/test/index.d.ts +3 -3
- package/build/test-cjs/index.js +479 -470
- package/build/test-esm/index.js +479 -470
- package/build/vite-cjs/index.js +484 -475
- package/build/vite-esm/index.js +484 -475
- package/package.json +1 -1
package/build/lib-esm/index.js
CHANGED
|
@@ -3074,10 +3074,10 @@ var require_printer = __commonJS({
|
|
|
3074
3074
|
Object.defineProperty(exports, "__esModule", {
|
|
3075
3075
|
value: true
|
|
3076
3076
|
});
|
|
3077
|
-
exports.print =
|
|
3077
|
+
exports.print = print4;
|
|
3078
3078
|
var _visitor = require_visitor();
|
|
3079
3079
|
var _blockString = require_blockString();
|
|
3080
|
-
function
|
|
3080
|
+
function print4(ast) {
|
|
3081
3081
|
return (0, _visitor.visit)(ast, {
|
|
3082
3082
|
leave: printDocASTReducer2
|
|
3083
3083
|
});
|
|
@@ -55179,12 +55179,12 @@ var require_comments = __commonJS({
|
|
|
55179
55179
|
comment.trailing = true;
|
|
55180
55180
|
addCommentHelper(node, comment);
|
|
55181
55181
|
}
|
|
55182
|
-
function printLeadingComment(commentPath,
|
|
55182
|
+
function printLeadingComment(commentPath, print4) {
|
|
55183
55183
|
var comment = commentPath.getValue();
|
|
55184
55184
|
n.Comment.assert(comment);
|
|
55185
55185
|
var loc = comment.loc;
|
|
55186
55186
|
var lines = loc && loc.lines;
|
|
55187
|
-
var parts = [
|
|
55187
|
+
var parts = [print4(commentPath)];
|
|
55188
55188
|
if (comment.trailing) {
|
|
55189
55189
|
parts.push("\n");
|
|
55190
55190
|
} else if (lines instanceof lines_1.Lines) {
|
|
@@ -55199,7 +55199,7 @@ var require_comments = __commonJS({
|
|
|
55199
55199
|
}
|
|
55200
55200
|
return (0, lines_1.concat)(parts);
|
|
55201
55201
|
}
|
|
55202
|
-
function printTrailingComment(commentPath,
|
|
55202
|
+
function printTrailingComment(commentPath, print4) {
|
|
55203
55203
|
var comment = commentPath.getValue(commentPath);
|
|
55204
55204
|
n.Comment.assert(comment);
|
|
55205
55205
|
var loc = comment.loc;
|
|
@@ -55214,12 +55214,12 @@ var require_comments = __commonJS({
|
|
|
55214
55214
|
parts.push(new Array(leadingSpace.length).join("\n"));
|
|
55215
55215
|
}
|
|
55216
55216
|
}
|
|
55217
|
-
parts.push(
|
|
55217
|
+
parts.push(print4(commentPath));
|
|
55218
55218
|
return (0, lines_1.concat)(parts);
|
|
55219
55219
|
}
|
|
55220
|
-
function printComments(path2,
|
|
55220
|
+
function printComments(path2, print4) {
|
|
55221
55221
|
var value = path2.getValue();
|
|
55222
|
-
var innerLines =
|
|
55222
|
+
var innerLines = print4(path2);
|
|
55223
55223
|
var comments = n.Node.check(value) && types4.getFieldValue(value, "comments");
|
|
55224
55224
|
if (!comments || comments.length === 0) {
|
|
55225
55225
|
return innerLines;
|
|
@@ -55231,9 +55231,9 @@ var require_comments = __commonJS({
|
|
|
55231
55231
|
var leading = types4.getFieldValue(comment, "leading");
|
|
55232
55232
|
var trailing = types4.getFieldValue(comment, "trailing");
|
|
55233
55233
|
if (leading || trailing && !(n.Statement.check(value) || comment.type === "Block" || comment.type === "CommentBlock")) {
|
|
55234
|
-
leadingParts.push(printLeadingComment(commentPath,
|
|
55234
|
+
leadingParts.push(printLeadingComment(commentPath, print4));
|
|
55235
55235
|
} else if (trailing) {
|
|
55236
|
-
trailingParts.push(printTrailingComment(commentPath,
|
|
55236
|
+
trailingParts.push(printTrailingComment(commentPath, print4));
|
|
55237
55237
|
}
|
|
55238
55238
|
}, "comments");
|
|
55239
55239
|
leadingParts.push.apply(leadingParts, trailingParts);
|
|
@@ -55924,7 +55924,7 @@ var require_patcher = __commonJS({
|
|
|
55924
55924
|
};
|
|
55925
55925
|
exports.Patcher = Patcher;
|
|
55926
55926
|
var Pp = Patcher.prototype;
|
|
55927
|
-
Pp.tryToReprintComments = function(newNode, oldNode,
|
|
55927
|
+
Pp.tryToReprintComments = function(newNode, oldNode, print4) {
|
|
55928
55928
|
var patcher = this;
|
|
55929
55929
|
if (!newNode.comments && !oldNode.comments) {
|
|
55930
55930
|
return true;
|
|
@@ -55941,7 +55941,7 @@ var require_patcher = __commonJS({
|
|
|
55941
55941
|
assert_1.default.ok(oldComment.leading || oldComment.trailing);
|
|
55942
55942
|
patcher.replace(
|
|
55943
55943
|
oldComment.loc,
|
|
55944
|
-
|
|
55944
|
+
print4(reprint.newPath).indentTail(oldComment.loc.indent)
|
|
55945
55945
|
);
|
|
55946
55946
|
});
|
|
55947
55947
|
}
|
|
@@ -55988,17 +55988,17 @@ var require_patcher = __commonJS({
|
|
|
55988
55988
|
var reprints = [];
|
|
55989
55989
|
if (!lines || !findReprints(path2, reprints))
|
|
55990
55990
|
return;
|
|
55991
|
-
return function(
|
|
55991
|
+
return function(print4) {
|
|
55992
55992
|
var patcher = new Patcher(lines);
|
|
55993
55993
|
reprints.forEach(function(reprint) {
|
|
55994
55994
|
var newNode = reprint.newPath.getValue();
|
|
55995
55995
|
var oldNode = reprint.oldPath.getValue();
|
|
55996
55996
|
SourceLocation.assert(oldNode.loc, true);
|
|
55997
|
-
var needToPrintNewPathWithComments = !patcher.tryToReprintComments(newNode, oldNode,
|
|
55997
|
+
var needToPrintNewPathWithComments = !patcher.tryToReprintComments(newNode, oldNode, print4);
|
|
55998
55998
|
if (needToPrintNewPathWithComments) {
|
|
55999
55999
|
patcher.deleteComments(oldNode);
|
|
56000
56000
|
}
|
|
56001
|
-
var newLines =
|
|
56001
|
+
var newLines = print4(reprint.newPath, {
|
|
56002
56002
|
includeComments: needToPrintNewPathWithComments,
|
|
56003
56003
|
avoidRootParens: oldNode.type === newNode.type && reprint.oldPath.hasParens()
|
|
56004
56004
|
}).indentTail(oldNode.loc.indent);
|
|
@@ -56215,10 +56215,10 @@ var require_printer2 = __commonJS({
|
|
|
56215
56215
|
function makePrintFunctionWith(options, overrides) {
|
|
56216
56216
|
options = Object.assign({}, options, overrides);
|
|
56217
56217
|
return function(path2) {
|
|
56218
|
-
return
|
|
56218
|
+
return print4(path2, options);
|
|
56219
56219
|
};
|
|
56220
56220
|
}
|
|
56221
|
-
function
|
|
56221
|
+
function print4(path2, options) {
|
|
56222
56222
|
assert_1.default.ok(path2 instanceof fast_path_1.default);
|
|
56223
56223
|
options = options || {};
|
|
56224
56224
|
if (options.includeComments) {
|
|
@@ -56234,7 +56234,7 @@ var require_printer2 = __commonJS({
|
|
|
56234
56234
|
}
|
|
56235
56235
|
}
|
|
56236
56236
|
var reprinter = (0, patcher_1.getReprinter)(path2);
|
|
56237
|
-
var lines = reprinter ? reprinter(
|
|
56237
|
+
var lines = reprinter ? reprinter(print4) : genericPrint(path2, config, options, makePrintFunctionWith(options, {
|
|
56238
56238
|
includeComments: true,
|
|
56239
56239
|
avoidRootParens: false
|
|
56240
56240
|
}));
|
|
@@ -56245,7 +56245,7 @@ var require_printer2 = __commonJS({
|
|
|
56245
56245
|
if (!ast) {
|
|
56246
56246
|
return emptyPrintResult;
|
|
56247
56247
|
}
|
|
56248
|
-
var lines =
|
|
56248
|
+
var lines = print4(fast_path_1.default.from(ast), {
|
|
56249
56249
|
includeComments: true,
|
|
56250
56250
|
avoidRootParens: false
|
|
56251
56251
|
});
|
|
@@ -56298,7 +56298,7 @@ var require_printer2 = __commonJS({
|
|
|
56298
56298
|
}
|
|
56299
56299
|
return (0, lines_1.concat)(parts);
|
|
56300
56300
|
}
|
|
56301
|
-
function genericPrintNoParens(path2, options,
|
|
56301
|
+
function genericPrintNoParens(path2, options, print4) {
|
|
56302
56302
|
var n = path2.getValue();
|
|
56303
56303
|
if (!n) {
|
|
56304
56304
|
return (0, lines_1.fromString)("");
|
|
@@ -56310,45 +56310,45 @@ var require_printer2 = __commonJS({
|
|
|
56310
56310
|
var parts = [];
|
|
56311
56311
|
switch (n.type) {
|
|
56312
56312
|
case "File":
|
|
56313
|
-
return path2.call(
|
|
56313
|
+
return path2.call(print4, "program");
|
|
56314
56314
|
case "Program":
|
|
56315
56315
|
if (n.directives) {
|
|
56316
56316
|
path2.each(function(childPath) {
|
|
56317
|
-
parts.push(
|
|
56317
|
+
parts.push(print4(childPath), ";\n");
|
|
56318
56318
|
}, "directives");
|
|
56319
56319
|
}
|
|
56320
56320
|
if (n.interpreter) {
|
|
56321
|
-
parts.push(path2.call(
|
|
56321
|
+
parts.push(path2.call(print4, "interpreter"));
|
|
56322
56322
|
}
|
|
56323
56323
|
parts.push(path2.call(function(bodyPath) {
|
|
56324
|
-
return printStatementSequence(bodyPath, options,
|
|
56324
|
+
return printStatementSequence(bodyPath, options, print4);
|
|
56325
56325
|
}, "body"));
|
|
56326
56326
|
return (0, lines_1.concat)(parts);
|
|
56327
56327
|
case "Noop":
|
|
56328
56328
|
case "EmptyStatement":
|
|
56329
56329
|
return (0, lines_1.fromString)("");
|
|
56330
56330
|
case "ExpressionStatement":
|
|
56331
|
-
return (0, lines_1.concat)([path2.call(
|
|
56331
|
+
return (0, lines_1.concat)([path2.call(print4, "expression"), ";"]);
|
|
56332
56332
|
case "ParenthesizedExpression":
|
|
56333
|
-
return (0, lines_1.concat)(["(", path2.call(
|
|
56333
|
+
return (0, lines_1.concat)(["(", path2.call(print4, "expression"), ")"]);
|
|
56334
56334
|
case "BinaryExpression":
|
|
56335
56335
|
case "LogicalExpression":
|
|
56336
56336
|
case "AssignmentExpression":
|
|
56337
56337
|
return (0, lines_1.fromString)(" ").join([
|
|
56338
|
-
path2.call(
|
|
56338
|
+
path2.call(print4, "left"),
|
|
56339
56339
|
n.operator,
|
|
56340
|
-
path2.call(
|
|
56340
|
+
path2.call(print4, "right")
|
|
56341
56341
|
]);
|
|
56342
56342
|
case "AssignmentPattern":
|
|
56343
56343
|
return (0, lines_1.concat)([
|
|
56344
|
-
path2.call(
|
|
56344
|
+
path2.call(print4, "left"),
|
|
56345
56345
|
" = ",
|
|
56346
|
-
path2.call(
|
|
56346
|
+
path2.call(print4, "right")
|
|
56347
56347
|
]);
|
|
56348
56348
|
case "MemberExpression":
|
|
56349
56349
|
case "OptionalMemberExpression": {
|
|
56350
|
-
parts.push(path2.call(
|
|
56351
|
-
var property = path2.call(
|
|
56350
|
+
parts.push(path2.call(print4, "object"));
|
|
56351
|
+
var property = path2.call(print4, "property");
|
|
56352
56352
|
var optional = types4.getFieldValue(n, "optional");
|
|
56353
56353
|
if (n.computed) {
|
|
56354
56354
|
parts.push(optional ? "?.[" : "[", property, "]");
|
|
@@ -56358,18 +56358,18 @@ var require_printer2 = __commonJS({
|
|
|
56358
56358
|
return (0, lines_1.concat)(parts);
|
|
56359
56359
|
}
|
|
56360
56360
|
case "ChainExpression":
|
|
56361
|
-
return path2.call(
|
|
56361
|
+
return path2.call(print4, "expression");
|
|
56362
56362
|
case "MetaProperty":
|
|
56363
56363
|
return (0, lines_1.concat)([
|
|
56364
|
-
path2.call(
|
|
56364
|
+
path2.call(print4, "meta"),
|
|
56365
56365
|
".",
|
|
56366
|
-
path2.call(
|
|
56366
|
+
path2.call(print4, "property")
|
|
56367
56367
|
]);
|
|
56368
56368
|
case "BindExpression":
|
|
56369
56369
|
if (n.object) {
|
|
56370
|
-
parts.push(path2.call(
|
|
56370
|
+
parts.push(path2.call(print4, "object"));
|
|
56371
56371
|
}
|
|
56372
|
-
parts.push("::", path2.call(
|
|
56372
|
+
parts.push("::", path2.call(print4, "callee"));
|
|
56373
56373
|
return (0, lines_1.concat)(parts);
|
|
56374
56374
|
case "Path":
|
|
56375
56375
|
return (0, lines_1.fromString)(".").join(n.body);
|
|
@@ -56377,7 +56377,7 @@ var require_printer2 = __commonJS({
|
|
|
56377
56377
|
return (0, lines_1.concat)([
|
|
56378
56378
|
(0, lines_1.fromString)(n.name, options),
|
|
56379
56379
|
n.optional ? "?" : "",
|
|
56380
|
-
path2.call(
|
|
56380
|
+
path2.call(print4, "typeAnnotation")
|
|
56381
56381
|
]);
|
|
56382
56382
|
case "SpreadElement":
|
|
56383
56383
|
case "SpreadElementPattern":
|
|
@@ -56388,8 +56388,8 @@ var require_printer2 = __commonJS({
|
|
|
56388
56388
|
case "RestElement":
|
|
56389
56389
|
return (0, lines_1.concat)([
|
|
56390
56390
|
"...",
|
|
56391
|
-
path2.call(
|
|
56392
|
-
path2.call(
|
|
56391
|
+
path2.call(print4, "argument"),
|
|
56392
|
+
path2.call(print4, "typeAnnotation")
|
|
56393
56393
|
]);
|
|
56394
56394
|
case "FunctionDeclaration":
|
|
56395
56395
|
case "FunctionExpression":
|
|
@@ -56404,15 +56404,15 @@ var require_printer2 = __commonJS({
|
|
|
56404
56404
|
if (n.generator)
|
|
56405
56405
|
parts.push("*");
|
|
56406
56406
|
if (n.id) {
|
|
56407
|
-
parts.push(" ", path2.call(
|
|
56407
|
+
parts.push(" ", path2.call(print4, "id"), path2.call(print4, "typeParameters"));
|
|
56408
56408
|
} else {
|
|
56409
56409
|
if (n.typeParameters) {
|
|
56410
|
-
parts.push(path2.call(
|
|
56410
|
+
parts.push(path2.call(print4, "typeParameters"));
|
|
56411
56411
|
}
|
|
56412
56412
|
}
|
|
56413
|
-
parts.push("(", printFunctionParams(path2, options,
|
|
56413
|
+
parts.push("(", printFunctionParams(path2, options, print4), ")", path2.call(print4, "returnType"));
|
|
56414
56414
|
if (n.body) {
|
|
56415
|
-
parts.push(" ", path2.call(
|
|
56415
|
+
parts.push(" ", path2.call(print4, "body"));
|
|
56416
56416
|
}
|
|
56417
56417
|
return (0, lines_1.concat)(parts);
|
|
56418
56418
|
case "ArrowFunctionExpression":
|
|
@@ -56420,44 +56420,44 @@ var require_printer2 = __commonJS({
|
|
|
56420
56420
|
parts.push("async ");
|
|
56421
56421
|
}
|
|
56422
56422
|
if (n.typeParameters) {
|
|
56423
|
-
parts.push(path2.call(
|
|
56423
|
+
parts.push(path2.call(print4, "typeParameters"));
|
|
56424
56424
|
}
|
|
56425
56425
|
if (!options.arrowParensAlways && n.params.length === 1 && !n.rest && n.params[0].type === "Identifier" && !n.params[0].typeAnnotation && !n.returnType) {
|
|
56426
|
-
parts.push(path2.call(
|
|
56426
|
+
parts.push(path2.call(print4, "params", 0));
|
|
56427
56427
|
} else {
|
|
56428
|
-
parts.push("(", printFunctionParams(path2, options,
|
|
56428
|
+
parts.push("(", printFunctionParams(path2, options, print4), ")", path2.call(print4, "returnType"));
|
|
56429
56429
|
}
|
|
56430
|
-
parts.push(" => ", path2.call(
|
|
56430
|
+
parts.push(" => ", path2.call(print4, "body"));
|
|
56431
56431
|
return (0, lines_1.concat)(parts);
|
|
56432
56432
|
case "MethodDefinition":
|
|
56433
|
-
return printMethod(path2, options,
|
|
56433
|
+
return printMethod(path2, options, print4);
|
|
56434
56434
|
case "YieldExpression":
|
|
56435
56435
|
parts.push("yield");
|
|
56436
56436
|
if (n.delegate)
|
|
56437
56437
|
parts.push("*");
|
|
56438
56438
|
if (n.argument)
|
|
56439
|
-
parts.push(" ", path2.call(
|
|
56439
|
+
parts.push(" ", path2.call(print4, "argument"));
|
|
56440
56440
|
return (0, lines_1.concat)(parts);
|
|
56441
56441
|
case "AwaitExpression":
|
|
56442
56442
|
parts.push("await");
|
|
56443
56443
|
if (n.all)
|
|
56444
56444
|
parts.push("*");
|
|
56445
56445
|
if (n.argument)
|
|
56446
|
-
parts.push(" ", path2.call(
|
|
56446
|
+
parts.push(" ", path2.call(print4, "argument"));
|
|
56447
56447
|
return (0, lines_1.concat)(parts);
|
|
56448
56448
|
case "ModuleExpression":
|
|
56449
56449
|
return (0, lines_1.concat)([
|
|
56450
56450
|
"module {\n",
|
|
56451
|
-
path2.call(
|
|
56451
|
+
path2.call(print4, "body").indent(options.tabWidth),
|
|
56452
56452
|
"\n}"
|
|
56453
56453
|
]);
|
|
56454
56454
|
case "ModuleDeclaration":
|
|
56455
|
-
parts.push("module", path2.call(
|
|
56455
|
+
parts.push("module", path2.call(print4, "id"));
|
|
56456
56456
|
if (n.source) {
|
|
56457
56457
|
assert_1.default.ok(!n.body);
|
|
56458
|
-
parts.push("from", path2.call(
|
|
56458
|
+
parts.push("from", path2.call(print4, "source"));
|
|
56459
56459
|
} else {
|
|
56460
|
-
parts.push(path2.call(
|
|
56460
|
+
parts.push(path2.call(print4, "body"));
|
|
56461
56461
|
}
|
|
56462
56462
|
return (0, lines_1.fromString)(" ").join(parts);
|
|
56463
56463
|
case "ImportSpecifier":
|
|
@@ -56465,27 +56465,27 @@ var require_printer2 = __commonJS({
|
|
|
56465
56465
|
parts.push(n.importKind + " ");
|
|
56466
56466
|
}
|
|
56467
56467
|
if (n.imported) {
|
|
56468
|
-
parts.push(path2.call(
|
|
56468
|
+
parts.push(path2.call(print4, "imported"));
|
|
56469
56469
|
if (n.local && n.local.name !== n.imported.name) {
|
|
56470
|
-
parts.push(" as ", path2.call(
|
|
56470
|
+
parts.push(" as ", path2.call(print4, "local"));
|
|
56471
56471
|
}
|
|
56472
56472
|
} else if (n.id) {
|
|
56473
|
-
parts.push(path2.call(
|
|
56473
|
+
parts.push(path2.call(print4, "id"));
|
|
56474
56474
|
if (n.name) {
|
|
56475
|
-
parts.push(" as ", path2.call(
|
|
56475
|
+
parts.push(" as ", path2.call(print4, "name"));
|
|
56476
56476
|
}
|
|
56477
56477
|
}
|
|
56478
56478
|
return (0, lines_1.concat)(parts);
|
|
56479
56479
|
case "ExportSpecifier":
|
|
56480
56480
|
if (n.local) {
|
|
56481
|
-
parts.push(path2.call(
|
|
56481
|
+
parts.push(path2.call(print4, "local"));
|
|
56482
56482
|
if (n.exported && n.exported.name !== n.local.name) {
|
|
56483
|
-
parts.push(" as ", path2.call(
|
|
56483
|
+
parts.push(" as ", path2.call(print4, "exported"));
|
|
56484
56484
|
}
|
|
56485
56485
|
} else if (n.id) {
|
|
56486
|
-
parts.push(path2.call(
|
|
56486
|
+
parts.push(path2.call(print4, "id"));
|
|
56487
56487
|
if (n.name) {
|
|
56488
|
-
parts.push(" as ", path2.call(
|
|
56488
|
+
parts.push(" as ", path2.call(print4, "name"));
|
|
56489
56489
|
}
|
|
56490
56490
|
}
|
|
56491
56491
|
return (0, lines_1.concat)(parts);
|
|
@@ -56494,40 +56494,40 @@ var require_printer2 = __commonJS({
|
|
|
56494
56494
|
case "ImportNamespaceSpecifier":
|
|
56495
56495
|
parts.push("* as ");
|
|
56496
56496
|
if (n.local) {
|
|
56497
|
-
parts.push(path2.call(
|
|
56497
|
+
parts.push(path2.call(print4, "local"));
|
|
56498
56498
|
} else if (n.id) {
|
|
56499
|
-
parts.push(path2.call(
|
|
56499
|
+
parts.push(path2.call(print4, "id"));
|
|
56500
56500
|
}
|
|
56501
56501
|
return (0, lines_1.concat)(parts);
|
|
56502
56502
|
case "ImportDefaultSpecifier":
|
|
56503
56503
|
if (n.local) {
|
|
56504
|
-
return path2.call(
|
|
56504
|
+
return path2.call(print4, "local");
|
|
56505
56505
|
}
|
|
56506
|
-
return path2.call(
|
|
56506
|
+
return path2.call(print4, "id");
|
|
56507
56507
|
case "TSExportAssignment":
|
|
56508
|
-
return (0, lines_1.concat)(["export = ", path2.call(
|
|
56508
|
+
return (0, lines_1.concat)(["export = ", path2.call(print4, "expression")]);
|
|
56509
56509
|
case "ExportDeclaration":
|
|
56510
56510
|
case "ExportDefaultDeclaration":
|
|
56511
56511
|
case "ExportNamedDeclaration":
|
|
56512
|
-
return printExportDeclaration(path2, options,
|
|
56512
|
+
return printExportDeclaration(path2, options, print4);
|
|
56513
56513
|
case "ExportAllDeclaration":
|
|
56514
56514
|
parts.push("export *");
|
|
56515
56515
|
if (n.exported) {
|
|
56516
|
-
parts.push(" as ", path2.call(
|
|
56516
|
+
parts.push(" as ", path2.call(print4, "exported"));
|
|
56517
56517
|
}
|
|
56518
|
-
parts.push(" from ", path2.call(
|
|
56518
|
+
parts.push(" from ", path2.call(print4, "source"), ";");
|
|
56519
56519
|
return (0, lines_1.concat)(parts);
|
|
56520
56520
|
case "TSNamespaceExportDeclaration":
|
|
56521
|
-
parts.push("export as namespace ", path2.call(
|
|
56521
|
+
parts.push("export as namespace ", path2.call(print4, "id"));
|
|
56522
56522
|
return maybeAddSemicolon((0, lines_1.concat)(parts));
|
|
56523
56523
|
case "ExportNamespaceSpecifier":
|
|
56524
|
-
return (0, lines_1.concat)(["* as ", path2.call(
|
|
56524
|
+
return (0, lines_1.concat)(["* as ", path2.call(print4, "exported")]);
|
|
56525
56525
|
case "ExportDefaultSpecifier":
|
|
56526
|
-
return path2.call(
|
|
56526
|
+
return path2.call(print4, "exported");
|
|
56527
56527
|
case "Import":
|
|
56528
56528
|
return (0, lines_1.fromString)("import", options);
|
|
56529
56529
|
case "ImportExpression":
|
|
56530
|
-
return (0, lines_1.concat)(["import(", path2.call(
|
|
56530
|
+
return (0, lines_1.concat)(["import(", path2.call(print4, "source"), ")"]);
|
|
56531
56531
|
case "ImportDeclaration": {
|
|
56532
56532
|
parts.push("import ");
|
|
56533
56533
|
if (n.importKind && n.importKind !== "value") {
|
|
@@ -56539,9 +56539,9 @@ var require_printer2 = __commonJS({
|
|
|
56539
56539
|
path2.each(function(specifierPath) {
|
|
56540
56540
|
var spec = specifierPath.getValue();
|
|
56541
56541
|
if (spec.type === "ImportSpecifier") {
|
|
56542
|
-
bracedSpecifiers_1.push(
|
|
56542
|
+
bracedSpecifiers_1.push(print4(specifierPath));
|
|
56543
56543
|
} else if (spec.type === "ImportDefaultSpecifier" || spec.type === "ImportNamespaceSpecifier") {
|
|
56544
|
-
unbracedSpecifiers_1.push(
|
|
56544
|
+
unbracedSpecifiers_1.push(print4(specifierPath));
|
|
56545
56545
|
}
|
|
56546
56546
|
}, "specifiers");
|
|
56547
56547
|
unbracedSpecifiers_1.forEach(function(lines2, i2) {
|
|
@@ -56571,16 +56571,16 @@ var require_printer2 = __commonJS({
|
|
|
56571
56571
|
}
|
|
56572
56572
|
parts.push(" from ");
|
|
56573
56573
|
}
|
|
56574
|
-
parts.push(path2.call(
|
|
56574
|
+
parts.push(path2.call(print4, "source"), maybePrintImportAssertions(path2, options, print4), ";");
|
|
56575
56575
|
return (0, lines_1.concat)(parts);
|
|
56576
56576
|
}
|
|
56577
56577
|
case "ImportAttribute":
|
|
56578
|
-
return (0, lines_1.concat)([path2.call(
|
|
56578
|
+
return (0, lines_1.concat)([path2.call(print4, "key"), ": ", path2.call(print4, "value")]);
|
|
56579
56579
|
case "StaticBlock":
|
|
56580
56580
|
parts.push("static ");
|
|
56581
56581
|
case "BlockStatement": {
|
|
56582
56582
|
var naked_1 = path2.call(function(bodyPath) {
|
|
56583
|
-
return printStatementSequence(bodyPath, options,
|
|
56583
|
+
return printStatementSequence(bodyPath, options, print4);
|
|
56584
56584
|
}, "body");
|
|
56585
56585
|
if (naked_1.isEmpty()) {
|
|
56586
56586
|
if (!n.directives || n.directives.length === 0) {
|
|
@@ -56591,7 +56591,7 @@ var require_printer2 = __commonJS({
|
|
|
56591
56591
|
parts.push("{\n");
|
|
56592
56592
|
if (n.directives) {
|
|
56593
56593
|
path2.each(function(childPath) {
|
|
56594
|
-
parts.push(maybeAddSemicolon(
|
|
56594
|
+
parts.push(maybeAddSemicolon(print4(childPath).indent(options.tabWidth)), n.directives.length > 1 || !naked_1.isEmpty() ? "\n" : "");
|
|
56595
56595
|
}, "directives");
|
|
56596
56596
|
}
|
|
56597
56597
|
parts.push(naked_1.indent(options.tabWidth));
|
|
@@ -56601,7 +56601,7 @@ var require_printer2 = __commonJS({
|
|
|
56601
56601
|
case "ReturnStatement": {
|
|
56602
56602
|
parts.push("return");
|
|
56603
56603
|
if (n.argument) {
|
|
56604
|
-
var argLines = path2.call(
|
|
56604
|
+
var argLines = path2.call(print4, "argument");
|
|
56605
56605
|
if (argLines.startsWithComment() || argLines.length > 1 && namedTypes.JSXElement && namedTypes.JSXElement.check(n.argument)) {
|
|
56606
56606
|
parts.push(" (\n", argLines.indent(options.tabWidth), "\n)");
|
|
56607
56607
|
} else {
|
|
@@ -56613,17 +56613,17 @@ var require_printer2 = __commonJS({
|
|
|
56613
56613
|
}
|
|
56614
56614
|
case "CallExpression":
|
|
56615
56615
|
case "OptionalCallExpression":
|
|
56616
|
-
parts.push(path2.call(
|
|
56616
|
+
parts.push(path2.call(print4, "callee"));
|
|
56617
56617
|
if (n.typeParameters) {
|
|
56618
|
-
parts.push(path2.call(
|
|
56618
|
+
parts.push(path2.call(print4, "typeParameters"));
|
|
56619
56619
|
}
|
|
56620
56620
|
if (n.typeArguments) {
|
|
56621
|
-
parts.push(path2.call(
|
|
56621
|
+
parts.push(path2.call(print4, "typeArguments"));
|
|
56622
56622
|
}
|
|
56623
56623
|
if (types4.getFieldValue(n, "optional")) {
|
|
56624
56624
|
parts.push("?.");
|
|
56625
56625
|
}
|
|
56626
|
-
parts.push(printArgumentsList(path2, options,
|
|
56626
|
+
parts.push(printArgumentsList(path2, options, print4));
|
|
56627
56627
|
return (0, lines_1.concat)(parts);
|
|
56628
56628
|
case "RecordExpression":
|
|
56629
56629
|
parts.push("#");
|
|
@@ -56653,7 +56653,7 @@ var require_printer2 = __commonJS({
|
|
|
56653
56653
|
var i_1 = 0;
|
|
56654
56654
|
fields.forEach(function(field) {
|
|
56655
56655
|
path2.each(function(childPath) {
|
|
56656
|
-
var lines2 =
|
|
56656
|
+
var lines2 = print4(childPath);
|
|
56657
56657
|
if (!oneLine_1) {
|
|
56658
56658
|
lines2 = lines2.indent(options.tabWidth);
|
|
56659
56659
|
}
|
|
@@ -56690,32 +56690,32 @@ var require_printer2 = __commonJS({
|
|
|
56690
56690
|
parts[parts.length - 1] = " " + rightBrace;
|
|
56691
56691
|
}
|
|
56692
56692
|
if (n.typeAnnotation) {
|
|
56693
|
-
parts.push(path2.call(
|
|
56693
|
+
parts.push(path2.call(print4, "typeAnnotation"));
|
|
56694
56694
|
}
|
|
56695
56695
|
return (0, lines_1.concat)(parts);
|
|
56696
56696
|
}
|
|
56697
56697
|
case "PropertyPattern":
|
|
56698
56698
|
return (0, lines_1.concat)([
|
|
56699
|
-
path2.call(
|
|
56699
|
+
path2.call(print4, "key"),
|
|
56700
56700
|
": ",
|
|
56701
|
-
path2.call(
|
|
56701
|
+
path2.call(print4, "pattern")
|
|
56702
56702
|
]);
|
|
56703
56703
|
case "ObjectProperty":
|
|
56704
56704
|
case "Property": {
|
|
56705
56705
|
if (n.method || n.kind === "get" || n.kind === "set") {
|
|
56706
|
-
return printMethod(path2, options,
|
|
56706
|
+
return printMethod(path2, options, print4);
|
|
56707
56707
|
}
|
|
56708
56708
|
if (n.shorthand && n.value.type === "AssignmentPattern") {
|
|
56709
|
-
return path2.call(
|
|
56709
|
+
return path2.call(print4, "value");
|
|
56710
56710
|
}
|
|
56711
|
-
var key = path2.call(
|
|
56711
|
+
var key = path2.call(print4, "key");
|
|
56712
56712
|
if (n.computed) {
|
|
56713
56713
|
parts.push("[", key, "]");
|
|
56714
56714
|
} else {
|
|
56715
56715
|
parts.push(key);
|
|
56716
56716
|
}
|
|
56717
56717
|
if (!n.shorthand || n.key.name !== n.value.name) {
|
|
56718
|
-
parts.push(": ", path2.call(
|
|
56718
|
+
parts.push(": ", path2.call(print4, "value"));
|
|
56719
56719
|
}
|
|
56720
56720
|
return (0, lines_1.concat)(parts);
|
|
56721
56721
|
}
|
|
@@ -56723,18 +56723,18 @@ var require_printer2 = __commonJS({
|
|
|
56723
56723
|
case "ObjectMethod":
|
|
56724
56724
|
case "ClassPrivateMethod":
|
|
56725
56725
|
case "TSDeclareMethod":
|
|
56726
|
-
return printMethod(path2, options,
|
|
56726
|
+
return printMethod(path2, options, print4);
|
|
56727
56727
|
case "PrivateName":
|
|
56728
|
-
return (0, lines_1.concat)(["#", path2.call(
|
|
56728
|
+
return (0, lines_1.concat)(["#", path2.call(print4, "id")]);
|
|
56729
56729
|
case "Decorator":
|
|
56730
|
-
return (0, lines_1.concat)(["@", path2.call(
|
|
56730
|
+
return (0, lines_1.concat)(["@", path2.call(print4, "expression")]);
|
|
56731
56731
|
case "TupleExpression":
|
|
56732
56732
|
parts.push("#");
|
|
56733
56733
|
case "ArrayExpression":
|
|
56734
56734
|
case "ArrayPattern": {
|
|
56735
56735
|
var elems = n.elements;
|
|
56736
56736
|
var len_2 = elems.length;
|
|
56737
|
-
var printed_1 = path2.map(
|
|
56737
|
+
var printed_1 = path2.map(print4, "elements");
|
|
56738
56738
|
var joined = (0, lines_1.fromString)(", ").join(printed_1);
|
|
56739
56739
|
var oneLine_2 = joined.getLineLength(1) <= options.wrapColumn;
|
|
56740
56740
|
if (oneLine_2) {
|
|
@@ -56772,12 +56772,12 @@ var require_printer2 = __commonJS({
|
|
|
56772
56772
|
parts.push("]");
|
|
56773
56773
|
}
|
|
56774
56774
|
if (n.typeAnnotation) {
|
|
56775
|
-
parts.push(path2.call(
|
|
56775
|
+
parts.push(path2.call(print4, "typeAnnotation"));
|
|
56776
56776
|
}
|
|
56777
56777
|
return (0, lines_1.concat)(parts);
|
|
56778
56778
|
}
|
|
56779
56779
|
case "SequenceExpression":
|
|
56780
|
-
return (0, lines_1.fromString)(", ").join(path2.map(
|
|
56780
|
+
return (0, lines_1.fromString)(", ").join(path2.map(print4, "expressions"));
|
|
56781
56781
|
case "ThisExpression":
|
|
56782
56782
|
return (0, lines_1.fromString)("this");
|
|
56783
56783
|
case "Super":
|
|
@@ -56798,7 +56798,7 @@ var require_printer2 = __commonJS({
|
|
|
56798
56798
|
case "Literal":
|
|
56799
56799
|
return (0, lines_1.fromString)(getPossibleRaw(n) || (typeof n.value === "string" ? nodeStr(n.value, options) : n.value), options);
|
|
56800
56800
|
case "Directive":
|
|
56801
|
-
return path2.call(
|
|
56801
|
+
return path2.call(print4, "value");
|
|
56802
56802
|
case "DirectiveLiteral":
|
|
56803
56803
|
return (0, lines_1.fromString)(getPossibleRaw(n) || nodeStr(n.value, options), options);
|
|
56804
56804
|
case "InterpreterDirective":
|
|
@@ -56812,32 +56812,32 @@ var require_printer2 = __commonJS({
|
|
|
56812
56812
|
parts.push(n.operator);
|
|
56813
56813
|
if (/[a-z]$/.test(n.operator))
|
|
56814
56814
|
parts.push(" ");
|
|
56815
|
-
parts.push(path2.call(
|
|
56815
|
+
parts.push(path2.call(print4, "argument"));
|
|
56816
56816
|
return (0, lines_1.concat)(parts);
|
|
56817
56817
|
case "UpdateExpression":
|
|
56818
|
-
parts.push(path2.call(
|
|
56818
|
+
parts.push(path2.call(print4, "argument"), n.operator);
|
|
56819
56819
|
if (n.prefix)
|
|
56820
56820
|
parts.reverse();
|
|
56821
56821
|
return (0, lines_1.concat)(parts);
|
|
56822
56822
|
case "ConditionalExpression":
|
|
56823
56823
|
return (0, lines_1.concat)([
|
|
56824
|
-
path2.call(
|
|
56824
|
+
path2.call(print4, "test"),
|
|
56825
56825
|
" ? ",
|
|
56826
|
-
path2.call(
|
|
56826
|
+
path2.call(print4, "consequent"),
|
|
56827
56827
|
" : ",
|
|
56828
|
-
path2.call(
|
|
56828
|
+
path2.call(print4, "alternate")
|
|
56829
56829
|
]);
|
|
56830
56830
|
case "NewExpression": {
|
|
56831
|
-
parts.push("new ", path2.call(
|
|
56831
|
+
parts.push("new ", path2.call(print4, "callee"));
|
|
56832
56832
|
if (n.typeParameters) {
|
|
56833
|
-
parts.push(path2.call(
|
|
56833
|
+
parts.push(path2.call(print4, "typeParameters"));
|
|
56834
56834
|
}
|
|
56835
56835
|
if (n.typeArguments) {
|
|
56836
|
-
parts.push(path2.call(
|
|
56836
|
+
parts.push(path2.call(print4, "typeArguments"));
|
|
56837
56837
|
}
|
|
56838
56838
|
var args = n.arguments;
|
|
56839
56839
|
if (args) {
|
|
56840
|
-
parts.push(printArgumentsList(path2, options,
|
|
56840
|
+
parts.push(printArgumentsList(path2, options, print4));
|
|
56841
56841
|
}
|
|
56842
56842
|
return (0, lines_1.concat)(parts);
|
|
56843
56843
|
}
|
|
@@ -56848,7 +56848,7 @@ var require_printer2 = __commonJS({
|
|
|
56848
56848
|
parts.push(n.kind, " ");
|
|
56849
56849
|
var maxLen_1 = 0;
|
|
56850
56850
|
var printed = path2.map(function(childPath) {
|
|
56851
|
-
var lines2 =
|
|
56851
|
+
var lines2 = print4(childPath);
|
|
56852
56852
|
maxLen_1 = Math.max(lines2.length, maxLen_1);
|
|
56853
56853
|
return lines2;
|
|
56854
56854
|
}, "declarations");
|
|
@@ -56867,30 +56867,30 @@ var require_printer2 = __commonJS({
|
|
|
56867
56867
|
}
|
|
56868
56868
|
case "VariableDeclarator":
|
|
56869
56869
|
return n.init ? (0, lines_1.fromString)(" = ").join([
|
|
56870
|
-
path2.call(
|
|
56871
|
-
path2.call(
|
|
56872
|
-
]) : path2.call(
|
|
56870
|
+
path2.call(print4, "id"),
|
|
56871
|
+
path2.call(print4, "init")
|
|
56872
|
+
]) : path2.call(print4, "id");
|
|
56873
56873
|
case "WithStatement":
|
|
56874
56874
|
return (0, lines_1.concat)([
|
|
56875
56875
|
"with (",
|
|
56876
|
-
path2.call(
|
|
56876
|
+
path2.call(print4, "object"),
|
|
56877
56877
|
") ",
|
|
56878
|
-
path2.call(
|
|
56878
|
+
path2.call(print4, "body")
|
|
56879
56879
|
]);
|
|
56880
56880
|
case "IfStatement": {
|
|
56881
|
-
var con = adjustClause(path2.call(
|
|
56882
|
-
parts.push("if (", path2.call(
|
|
56881
|
+
var con = adjustClause(path2.call(print4, "consequent"), options);
|
|
56882
|
+
parts.push("if (", path2.call(print4, "test"), ")", con);
|
|
56883
56883
|
if (n.alternate)
|
|
56884
|
-
parts.push(endsWithBrace(con) ? " else" : "\nelse", adjustClause(path2.call(
|
|
56884
|
+
parts.push(endsWithBrace(con) ? " else" : "\nelse", adjustClause(path2.call(print4, "alternate"), options));
|
|
56885
56885
|
return (0, lines_1.concat)(parts);
|
|
56886
56886
|
}
|
|
56887
56887
|
case "ForStatement": {
|
|
56888
|
-
var init = path2.call(
|
|
56888
|
+
var init = path2.call(print4, "init");
|
|
56889
56889
|
var sep2 = init.length > 1 ? ";\n" : "; ";
|
|
56890
56890
|
var forParen = "for (";
|
|
56891
|
-
var indented = (0, lines_1.fromString)(sep2).join([init, path2.call(
|
|
56891
|
+
var indented = (0, lines_1.fromString)(sep2).join([init, path2.call(print4, "test"), path2.call(print4, "update")]).indentTail(forParen.length);
|
|
56892
56892
|
var head = (0, lines_1.concat)([forParen, indented, ")"]);
|
|
56893
|
-
var clause = adjustClause(path2.call(
|
|
56893
|
+
var clause = adjustClause(path2.call(print4, "body"), options);
|
|
56894
56894
|
parts.push(head);
|
|
56895
56895
|
if (head.length > 1) {
|
|
56896
56896
|
parts.push("\n");
|
|
@@ -56902,18 +56902,18 @@ var require_printer2 = __commonJS({
|
|
|
56902
56902
|
case "WhileStatement":
|
|
56903
56903
|
return (0, lines_1.concat)([
|
|
56904
56904
|
"while (",
|
|
56905
|
-
path2.call(
|
|
56905
|
+
path2.call(print4, "test"),
|
|
56906
56906
|
")",
|
|
56907
|
-
adjustClause(path2.call(
|
|
56907
|
+
adjustClause(path2.call(print4, "body"), options)
|
|
56908
56908
|
]);
|
|
56909
56909
|
case "ForInStatement":
|
|
56910
56910
|
return (0, lines_1.concat)([
|
|
56911
56911
|
n.each ? "for each (" : "for (",
|
|
56912
|
-
path2.call(
|
|
56912
|
+
path2.call(print4, "left"),
|
|
56913
56913
|
" in ",
|
|
56914
|
-
path2.call(
|
|
56914
|
+
path2.call(print4, "right"),
|
|
56915
56915
|
")",
|
|
56916
|
-
adjustClause(path2.call(
|
|
56916
|
+
adjustClause(path2.call(print4, "body"), options)
|
|
56917
56917
|
]);
|
|
56918
56918
|
case "ForOfStatement":
|
|
56919
56919
|
case "ForAwaitStatement":
|
|
@@ -56921,122 +56921,122 @@ var require_printer2 = __commonJS({
|
|
|
56921
56921
|
if (n.await || n.type === "ForAwaitStatement") {
|
|
56922
56922
|
parts.push("await ");
|
|
56923
56923
|
}
|
|
56924
|
-
parts.push("(", path2.call(
|
|
56924
|
+
parts.push("(", path2.call(print4, "left"), " of ", path2.call(print4, "right"), ")", adjustClause(path2.call(print4, "body"), options));
|
|
56925
56925
|
return (0, lines_1.concat)(parts);
|
|
56926
56926
|
case "DoWhileStatement": {
|
|
56927
56927
|
var doBody = (0, lines_1.concat)([
|
|
56928
56928
|
"do",
|
|
56929
|
-
adjustClause(path2.call(
|
|
56929
|
+
adjustClause(path2.call(print4, "body"), options)
|
|
56930
56930
|
]);
|
|
56931
56931
|
parts.push(doBody);
|
|
56932
56932
|
if (endsWithBrace(doBody))
|
|
56933
56933
|
parts.push(" while");
|
|
56934
56934
|
else
|
|
56935
56935
|
parts.push("\nwhile");
|
|
56936
|
-
parts.push(" (", path2.call(
|
|
56936
|
+
parts.push(" (", path2.call(print4, "test"), ");");
|
|
56937
56937
|
return (0, lines_1.concat)(parts);
|
|
56938
56938
|
}
|
|
56939
56939
|
case "DoExpression": {
|
|
56940
56940
|
var statements = path2.call(function(bodyPath) {
|
|
56941
|
-
return printStatementSequence(bodyPath, options,
|
|
56941
|
+
return printStatementSequence(bodyPath, options, print4);
|
|
56942
56942
|
}, "body");
|
|
56943
56943
|
return (0, lines_1.concat)(["do {\n", statements.indent(options.tabWidth), "\n}"]);
|
|
56944
56944
|
}
|
|
56945
56945
|
case "BreakStatement":
|
|
56946
56946
|
parts.push("break");
|
|
56947
56947
|
if (n.label)
|
|
56948
|
-
parts.push(" ", path2.call(
|
|
56948
|
+
parts.push(" ", path2.call(print4, "label"));
|
|
56949
56949
|
parts.push(";");
|
|
56950
56950
|
return (0, lines_1.concat)(parts);
|
|
56951
56951
|
case "ContinueStatement":
|
|
56952
56952
|
parts.push("continue");
|
|
56953
56953
|
if (n.label)
|
|
56954
|
-
parts.push(" ", path2.call(
|
|
56954
|
+
parts.push(" ", path2.call(print4, "label"));
|
|
56955
56955
|
parts.push(";");
|
|
56956
56956
|
return (0, lines_1.concat)(parts);
|
|
56957
56957
|
case "LabeledStatement":
|
|
56958
56958
|
return (0, lines_1.concat)([
|
|
56959
|
-
path2.call(
|
|
56959
|
+
path2.call(print4, "label"),
|
|
56960
56960
|
":\n",
|
|
56961
|
-
path2.call(
|
|
56961
|
+
path2.call(print4, "body")
|
|
56962
56962
|
]);
|
|
56963
56963
|
case "TryStatement":
|
|
56964
|
-
parts.push("try ", path2.call(
|
|
56964
|
+
parts.push("try ", path2.call(print4, "block"));
|
|
56965
56965
|
if (n.handler) {
|
|
56966
|
-
parts.push(" ", path2.call(
|
|
56966
|
+
parts.push(" ", path2.call(print4, "handler"));
|
|
56967
56967
|
} else if (n.handlers) {
|
|
56968
56968
|
path2.each(function(handlerPath) {
|
|
56969
|
-
parts.push(" ",
|
|
56969
|
+
parts.push(" ", print4(handlerPath));
|
|
56970
56970
|
}, "handlers");
|
|
56971
56971
|
}
|
|
56972
56972
|
if (n.finalizer) {
|
|
56973
|
-
parts.push(" finally ", path2.call(
|
|
56973
|
+
parts.push(" finally ", path2.call(print4, "finalizer"));
|
|
56974
56974
|
}
|
|
56975
56975
|
return (0, lines_1.concat)(parts);
|
|
56976
56976
|
case "CatchClause":
|
|
56977
56977
|
parts.push("catch ");
|
|
56978
56978
|
if (n.param) {
|
|
56979
|
-
parts.push("(", path2.call(
|
|
56979
|
+
parts.push("(", path2.call(print4, "param"));
|
|
56980
56980
|
}
|
|
56981
56981
|
if (n.guard) {
|
|
56982
|
-
parts.push(" if ", path2.call(
|
|
56982
|
+
parts.push(" if ", path2.call(print4, "guard"));
|
|
56983
56983
|
}
|
|
56984
56984
|
if (n.param) {
|
|
56985
56985
|
parts.push(") ");
|
|
56986
56986
|
}
|
|
56987
|
-
parts.push(path2.call(
|
|
56987
|
+
parts.push(path2.call(print4, "body"));
|
|
56988
56988
|
return (0, lines_1.concat)(parts);
|
|
56989
56989
|
case "ThrowStatement":
|
|
56990
|
-
return (0, lines_1.concat)(["throw ", path2.call(
|
|
56990
|
+
return (0, lines_1.concat)(["throw ", path2.call(print4, "argument"), ";"]);
|
|
56991
56991
|
case "SwitchStatement":
|
|
56992
56992
|
return (0, lines_1.concat)([
|
|
56993
56993
|
"switch (",
|
|
56994
|
-
path2.call(
|
|
56994
|
+
path2.call(print4, "discriminant"),
|
|
56995
56995
|
") {\n",
|
|
56996
|
-
(0, lines_1.fromString)("\n").join(path2.map(
|
|
56996
|
+
(0, lines_1.fromString)("\n").join(path2.map(print4, "cases")),
|
|
56997
56997
|
"\n}"
|
|
56998
56998
|
]);
|
|
56999
56999
|
case "SwitchCase":
|
|
57000
57000
|
if (n.test)
|
|
57001
|
-
parts.push("case ", path2.call(
|
|
57001
|
+
parts.push("case ", path2.call(print4, "test"), ":");
|
|
57002
57002
|
else
|
|
57003
57003
|
parts.push("default:");
|
|
57004
57004
|
if (n.consequent.length > 0) {
|
|
57005
57005
|
parts.push("\n", path2.call(function(consequentPath) {
|
|
57006
|
-
return printStatementSequence(consequentPath, options,
|
|
57006
|
+
return printStatementSequence(consequentPath, options, print4);
|
|
57007
57007
|
}, "consequent").indent(options.tabWidth));
|
|
57008
57008
|
}
|
|
57009
57009
|
return (0, lines_1.concat)(parts);
|
|
57010
57010
|
case "DebuggerStatement":
|
|
57011
57011
|
return (0, lines_1.fromString)("debugger;");
|
|
57012
57012
|
case "JSXAttribute":
|
|
57013
|
-
parts.push(path2.call(
|
|
57013
|
+
parts.push(path2.call(print4, "name"));
|
|
57014
57014
|
if (n.value)
|
|
57015
|
-
parts.push("=", path2.call(
|
|
57015
|
+
parts.push("=", path2.call(print4, "value"));
|
|
57016
57016
|
return (0, lines_1.concat)(parts);
|
|
57017
57017
|
case "JSXIdentifier":
|
|
57018
57018
|
return (0, lines_1.fromString)(n.name, options);
|
|
57019
57019
|
case "JSXNamespacedName":
|
|
57020
57020
|
return (0, lines_1.fromString)(":").join([
|
|
57021
|
-
path2.call(
|
|
57022
|
-
path2.call(
|
|
57021
|
+
path2.call(print4, "namespace"),
|
|
57022
|
+
path2.call(print4, "name")
|
|
57023
57023
|
]);
|
|
57024
57024
|
case "JSXMemberExpression":
|
|
57025
57025
|
return (0, lines_1.fromString)(".").join([
|
|
57026
|
-
path2.call(
|
|
57027
|
-
path2.call(
|
|
57026
|
+
path2.call(print4, "object"),
|
|
57027
|
+
path2.call(print4, "property")
|
|
57028
57028
|
]);
|
|
57029
57029
|
case "JSXSpreadAttribute":
|
|
57030
|
-
return (0, lines_1.concat)(["{...", path2.call(
|
|
57030
|
+
return (0, lines_1.concat)(["{...", path2.call(print4, "argument"), "}"]);
|
|
57031
57031
|
case "JSXSpreadChild":
|
|
57032
|
-
return (0, lines_1.concat)(["{...", path2.call(
|
|
57032
|
+
return (0, lines_1.concat)(["{...", path2.call(print4, "expression"), "}"]);
|
|
57033
57033
|
case "JSXExpressionContainer":
|
|
57034
|
-
return (0, lines_1.concat)(["{", path2.call(
|
|
57034
|
+
return (0, lines_1.concat)(["{", path2.call(print4, "expression"), "}"]);
|
|
57035
57035
|
case "JSXElement":
|
|
57036
57036
|
case "JSXFragment": {
|
|
57037
57037
|
var openingPropName = "opening" + (n.type === "JSXElement" ? "Element" : "Fragment");
|
|
57038
57038
|
var closingPropName = "closing" + (n.type === "JSXElement" ? "Element" : "Fragment");
|
|
57039
|
-
var openingLines = path2.call(
|
|
57039
|
+
var openingLines = path2.call(print4, openingPropName);
|
|
57040
57040
|
if (n[openingPropName].selfClosing) {
|
|
57041
57041
|
assert_1.default.ok(!n[closingPropName], "unexpected " + closingPropName + " element in self-closing " + n.type);
|
|
57042
57042
|
return openingLines;
|
|
@@ -57050,16 +57050,16 @@ var require_printer2 = __commonJS({
|
|
|
57050
57050
|
return "\n";
|
|
57051
57051
|
}
|
|
57052
57052
|
}
|
|
57053
|
-
return
|
|
57053
|
+
return print4(childPath);
|
|
57054
57054
|
}, "children")).indentTail(options.tabWidth);
|
|
57055
|
-
var closingLines = path2.call(
|
|
57055
|
+
var closingLines = path2.call(print4, closingPropName);
|
|
57056
57056
|
return (0, lines_1.concat)([openingLines, childLines, closingLines]);
|
|
57057
57057
|
}
|
|
57058
57058
|
case "JSXOpeningElement": {
|
|
57059
|
-
parts.push("<", path2.call(
|
|
57059
|
+
parts.push("<", path2.call(print4, "name"));
|
|
57060
57060
|
var attrParts_1 = [];
|
|
57061
57061
|
path2.each(function(attrPath) {
|
|
57062
|
-
attrParts_1.push(" ",
|
|
57062
|
+
attrParts_1.push(" ", print4(attrPath));
|
|
57063
57063
|
}, "attributes");
|
|
57064
57064
|
var attrLines = (0, lines_1.concat)(attrParts_1);
|
|
57065
57065
|
var needLineWrap = attrLines.length > 1 || attrLines.getLineLength(1) > options.wrapColumn;
|
|
@@ -57076,7 +57076,7 @@ var require_printer2 = __commonJS({
|
|
|
57076
57076
|
return (0, lines_1.concat)(parts);
|
|
57077
57077
|
}
|
|
57078
57078
|
case "JSXClosingElement":
|
|
57079
|
-
return (0, lines_1.concat)(["</", path2.call(
|
|
57079
|
+
return (0, lines_1.concat)(["</", path2.call(print4, "name"), ">"]);
|
|
57080
57080
|
case "JSXOpeningFragment":
|
|
57081
57081
|
return (0, lines_1.fromString)("<>");
|
|
57082
57082
|
case "JSXClosingFragment":
|
|
@@ -57087,9 +57087,9 @@ var require_printer2 = __commonJS({
|
|
|
57087
57087
|
return (0, lines_1.fromString)("");
|
|
57088
57088
|
case "TypeAnnotatedIdentifier":
|
|
57089
57089
|
return (0, lines_1.concat)([
|
|
57090
|
-
path2.call(
|
|
57090
|
+
path2.call(print4, "annotation"),
|
|
57091
57091
|
" ",
|
|
57092
|
-
path2.call(
|
|
57092
|
+
path2.call(print4, "identifier")
|
|
57093
57093
|
]);
|
|
57094
57094
|
case "ClassBody":
|
|
57095
57095
|
if (n.body.length === 0) {
|
|
@@ -57098,12 +57098,12 @@ var require_printer2 = __commonJS({
|
|
|
57098
57098
|
return (0, lines_1.concat)([
|
|
57099
57099
|
"{\n",
|
|
57100
57100
|
path2.call(function(bodyPath) {
|
|
57101
|
-
return printStatementSequence(bodyPath, options,
|
|
57101
|
+
return printStatementSequence(bodyPath, options, print4);
|
|
57102
57102
|
}, "body").indent(options.tabWidth),
|
|
57103
57103
|
"\n}"
|
|
57104
57104
|
]);
|
|
57105
57105
|
case "ClassPropertyDefinition":
|
|
57106
|
-
parts.push("static ", path2.call(
|
|
57106
|
+
parts.push("static ", path2.call(print4, "definition"));
|
|
57107
57107
|
if (!namedTypes.MethodDefinition.check(n.definition))
|
|
57108
57108
|
parts.push(";");
|
|
57109
57109
|
return (0, lines_1.concat)(parts);
|
|
@@ -57124,12 +57124,12 @@ var require_printer2 = __commonJS({
|
|
|
57124
57124
|
if (n.readonly) {
|
|
57125
57125
|
parts.push("readonly ");
|
|
57126
57126
|
}
|
|
57127
|
-
var key = path2.call(
|
|
57127
|
+
var key = path2.call(print4, "key");
|
|
57128
57128
|
if (n.computed) {
|
|
57129
57129
|
key = (0, lines_1.concat)(["[", key, "]"]);
|
|
57130
57130
|
}
|
|
57131
57131
|
if (n.variance) {
|
|
57132
|
-
key = (0, lines_1.concat)([printVariance(path2,
|
|
57132
|
+
key = (0, lines_1.concat)([printVariance(path2, print4), key]);
|
|
57133
57133
|
}
|
|
57134
57134
|
parts.push(key);
|
|
57135
57135
|
if (n.optional) {
|
|
@@ -57139,10 +57139,10 @@ var require_printer2 = __commonJS({
|
|
|
57139
57139
|
parts.push("!");
|
|
57140
57140
|
}
|
|
57141
57141
|
if (n.typeAnnotation) {
|
|
57142
|
-
parts.push(path2.call(
|
|
57142
|
+
parts.push(path2.call(print4, "typeAnnotation"));
|
|
57143
57143
|
}
|
|
57144
57144
|
if (n.value) {
|
|
57145
|
-
parts.push(" = ", path2.call(
|
|
57145
|
+
parts.push(" = ", path2.call(print4, "value"));
|
|
57146
57146
|
}
|
|
57147
57147
|
parts.push(";");
|
|
57148
57148
|
return (0, lines_1.concat)(parts);
|
|
@@ -57151,21 +57151,21 @@ var require_printer2 = __commonJS({
|
|
|
57151
57151
|
if (n.static) {
|
|
57152
57152
|
parts.push("static ");
|
|
57153
57153
|
}
|
|
57154
|
-
parts.push(path2.call(
|
|
57154
|
+
parts.push(path2.call(print4, "key"));
|
|
57155
57155
|
if (n.typeAnnotation) {
|
|
57156
|
-
parts.push(path2.call(
|
|
57156
|
+
parts.push(path2.call(print4, "typeAnnotation"));
|
|
57157
57157
|
}
|
|
57158
57158
|
if (n.value) {
|
|
57159
|
-
parts.push(" = ", path2.call(
|
|
57159
|
+
parts.push(" = ", path2.call(print4, "value"));
|
|
57160
57160
|
}
|
|
57161
57161
|
parts.push(";");
|
|
57162
57162
|
return (0, lines_1.concat)(parts);
|
|
57163
57163
|
case "ClassAccessorProperty": {
|
|
57164
57164
|
parts.push.apply(parts, tslib_1.__spreadArray(tslib_1.__spreadArray([], printClassMemberModifiers(n), false), ["accessor "], false));
|
|
57165
57165
|
if (n.computed) {
|
|
57166
|
-
parts.push("[", path2.call(
|
|
57166
|
+
parts.push("[", path2.call(print4, "key"), "]");
|
|
57167
57167
|
} else {
|
|
57168
|
-
parts.push(path2.call(
|
|
57168
|
+
parts.push(path2.call(print4, "key"));
|
|
57169
57169
|
}
|
|
57170
57170
|
if (n.optional) {
|
|
57171
57171
|
parts.push("?");
|
|
@@ -57174,10 +57174,10 @@ var require_printer2 = __commonJS({
|
|
|
57174
57174
|
parts.push("!");
|
|
57175
57175
|
}
|
|
57176
57176
|
if (n.typeAnnotation) {
|
|
57177
|
-
parts.push(path2.call(
|
|
57177
|
+
parts.push(path2.call(print4, "typeAnnotation"));
|
|
57178
57178
|
}
|
|
57179
57179
|
if (n.value) {
|
|
57180
|
-
parts.push(" = ", path2.call(
|
|
57180
|
+
parts.push(" = ", path2.call(print4, "value"));
|
|
57181
57181
|
}
|
|
57182
57182
|
parts.push(";");
|
|
57183
57183
|
return (0, lines_1.concat)(parts);
|
|
@@ -57193,21 +57193,21 @@ var require_printer2 = __commonJS({
|
|
|
57193
57193
|
}
|
|
57194
57194
|
parts.push("class");
|
|
57195
57195
|
if (n.id) {
|
|
57196
|
-
parts.push(" ", path2.call(
|
|
57196
|
+
parts.push(" ", path2.call(print4, "id"));
|
|
57197
57197
|
}
|
|
57198
57198
|
if (n.typeParameters) {
|
|
57199
|
-
parts.push(path2.call(
|
|
57199
|
+
parts.push(path2.call(print4, "typeParameters"));
|
|
57200
57200
|
}
|
|
57201
57201
|
if (n.superClass) {
|
|
57202
|
-
parts.push(" extends ", path2.call(
|
|
57202
|
+
parts.push(" extends ", path2.call(print4, "superClass"), path2.call(print4, "superTypeParameters"));
|
|
57203
57203
|
}
|
|
57204
57204
|
if (n.extends && n.extends.length > 0) {
|
|
57205
|
-
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path2.map(
|
|
57205
|
+
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path2.map(print4, "extends")));
|
|
57206
57206
|
}
|
|
57207
57207
|
if (n["implements"] && n["implements"].length > 0) {
|
|
57208
|
-
parts.push(" implements ", (0, lines_1.fromString)(", ").join(path2.map(
|
|
57208
|
+
parts.push(" implements ", (0, lines_1.fromString)(", ").join(path2.map(print4, "implements")));
|
|
57209
57209
|
}
|
|
57210
|
-
parts.push(" ", path2.call(
|
|
57210
|
+
parts.push(" ", path2.call(print4, "body"));
|
|
57211
57211
|
if (n.type === "DeclareClass") {
|
|
57212
57212
|
return printFlowDeclaration(path2, parts);
|
|
57213
57213
|
} else {
|
|
@@ -57216,11 +57216,11 @@ var require_printer2 = __commonJS({
|
|
|
57216
57216
|
case "TemplateElement":
|
|
57217
57217
|
return (0, lines_1.fromString)(n.value.raw, options).lockIndentTail();
|
|
57218
57218
|
case "TemplateLiteral": {
|
|
57219
|
-
var expressions_1 = path2.map(
|
|
57219
|
+
var expressions_1 = path2.map(print4, "expressions");
|
|
57220
57220
|
parts.push("`");
|
|
57221
57221
|
path2.each(function(childPath) {
|
|
57222
57222
|
var i2 = childPath.getName();
|
|
57223
|
-
parts.push(
|
|
57223
|
+
parts.push(print4(childPath));
|
|
57224
57224
|
if (i2 < expressions_1.length) {
|
|
57225
57225
|
parts.push("${", expressions_1[i2], "}");
|
|
57226
57226
|
}
|
|
@@ -57229,7 +57229,7 @@ var require_printer2 = __commonJS({
|
|
|
57229
57229
|
return (0, lines_1.concat)(parts).lockIndentTail();
|
|
57230
57230
|
}
|
|
57231
57231
|
case "TaggedTemplateExpression":
|
|
57232
|
-
return (0, lines_1.concat)([path2.call(
|
|
57232
|
+
return (0, lines_1.concat)([path2.call(print4, "tag"), path2.call(print4, "quasi")]);
|
|
57233
57233
|
case "Node":
|
|
57234
57234
|
case "Printable":
|
|
57235
57235
|
case "SourceLocation":
|
|
@@ -57263,7 +57263,7 @@ var require_printer2 = __commonJS({
|
|
|
57263
57263
|
if (n.typeAnnotation.type !== "FunctionTypeAnnotation") {
|
|
57264
57264
|
parts.push(": ");
|
|
57265
57265
|
}
|
|
57266
|
-
parts.push(path2.call(
|
|
57266
|
+
parts.push(path2.call(print4, "typeAnnotation"));
|
|
57267
57267
|
return (0, lines_1.concat)(parts);
|
|
57268
57268
|
}
|
|
57269
57269
|
return (0, lines_1.fromString)("");
|
|
@@ -57277,9 +57277,9 @@ var require_printer2 = __commonJS({
|
|
|
57277
57277
|
case "MixedTypeAnnotation":
|
|
57278
57278
|
return (0, lines_1.fromString)("mixed", options);
|
|
57279
57279
|
case "ArrayTypeAnnotation":
|
|
57280
|
-
return (0, lines_1.concat)([path2.call(
|
|
57280
|
+
return (0, lines_1.concat)([path2.call(print4, "elementType"), "[]"]);
|
|
57281
57281
|
case "TupleTypeAnnotation": {
|
|
57282
|
-
var printed_2 = path2.map(
|
|
57282
|
+
var printed_2 = path2.map(print4, "types");
|
|
57283
57283
|
var joined = (0, lines_1.fromString)(", ").join(printed_2);
|
|
57284
57284
|
var oneLine_3 = joined.getLineLength(1) <= options.wrapColumn;
|
|
57285
57285
|
if (oneLine_3) {
|
|
@@ -57326,38 +57326,38 @@ var require_printer2 = __commonJS({
|
|
|
57326
57326
|
case "InterfaceTypeAnnotation":
|
|
57327
57327
|
parts.push("interface");
|
|
57328
57328
|
if (n.extends && n.extends.length > 0) {
|
|
57329
|
-
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path2.map(
|
|
57329
|
+
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path2.map(print4, "extends")));
|
|
57330
57330
|
}
|
|
57331
|
-
parts.push(" ", path2.call(
|
|
57331
|
+
parts.push(" ", path2.call(print4, "body"));
|
|
57332
57332
|
return (0, lines_1.concat)(parts);
|
|
57333
57333
|
case "DeclareFunction":
|
|
57334
57334
|
return printFlowDeclaration(path2, [
|
|
57335
57335
|
"function ",
|
|
57336
|
-
path2.call(
|
|
57336
|
+
path2.call(print4, "id"),
|
|
57337
57337
|
";"
|
|
57338
57338
|
]);
|
|
57339
57339
|
case "DeclareModule":
|
|
57340
57340
|
return printFlowDeclaration(path2, [
|
|
57341
57341
|
"module ",
|
|
57342
|
-
path2.call(
|
|
57342
|
+
path2.call(print4, "id"),
|
|
57343
57343
|
" ",
|
|
57344
|
-
path2.call(
|
|
57344
|
+
path2.call(print4, "body")
|
|
57345
57345
|
]);
|
|
57346
57346
|
case "DeclareModuleExports":
|
|
57347
57347
|
return printFlowDeclaration(path2, [
|
|
57348
57348
|
"module.exports",
|
|
57349
|
-
path2.call(
|
|
57349
|
+
path2.call(print4, "typeAnnotation")
|
|
57350
57350
|
]);
|
|
57351
57351
|
case "DeclareVariable":
|
|
57352
|
-
return printFlowDeclaration(path2, ["var ", path2.call(
|
|
57352
|
+
return printFlowDeclaration(path2, ["var ", path2.call(print4, "id"), ";"]);
|
|
57353
57353
|
case "DeclareExportDeclaration":
|
|
57354
57354
|
case "DeclareExportAllDeclaration":
|
|
57355
|
-
return (0, lines_1.concat)(["declare ", printExportDeclaration(path2, options,
|
|
57355
|
+
return (0, lines_1.concat)(["declare ", printExportDeclaration(path2, options, print4)]);
|
|
57356
57356
|
case "EnumDeclaration":
|
|
57357
57357
|
return (0, lines_1.concat)([
|
|
57358
57358
|
"enum ",
|
|
57359
|
-
path2.call(
|
|
57360
|
-
path2.call(
|
|
57359
|
+
path2.call(print4, "id"),
|
|
57360
|
+
path2.call(print4, "body")
|
|
57361
57361
|
]);
|
|
57362
57362
|
case "EnumBooleanBody":
|
|
57363
57363
|
case "EnumNumberBody":
|
|
@@ -57369,24 +57369,24 @@ var require_printer2 = __commonJS({
|
|
|
57369
57369
|
n.type.slice(4, -4).toLowerCase()
|
|
57370
57370
|
);
|
|
57371
57371
|
}
|
|
57372
|
-
parts.push(" {\n", (0, lines_1.fromString)("\n").join(path2.map(
|
|
57372
|
+
parts.push(" {\n", (0, lines_1.fromString)("\n").join(path2.map(print4, "members")).indent(options.tabWidth), "\n}");
|
|
57373
57373
|
return (0, lines_1.concat)(parts);
|
|
57374
57374
|
}
|
|
57375
57375
|
case "EnumDefaultedMember":
|
|
57376
|
-
return (0, lines_1.concat)([path2.call(
|
|
57376
|
+
return (0, lines_1.concat)([path2.call(print4, "id"), ","]);
|
|
57377
57377
|
case "EnumBooleanMember":
|
|
57378
57378
|
case "EnumNumberMember":
|
|
57379
57379
|
case "EnumStringMember":
|
|
57380
57380
|
return (0, lines_1.concat)([
|
|
57381
|
-
path2.call(
|
|
57381
|
+
path2.call(print4, "id"),
|
|
57382
57382
|
" = ",
|
|
57383
|
-
path2.call(
|
|
57383
|
+
path2.call(print4, "init"),
|
|
57384
57384
|
","
|
|
57385
57385
|
]);
|
|
57386
57386
|
case "InferredPredicate":
|
|
57387
57387
|
return (0, lines_1.fromString)("%checks", options);
|
|
57388
57388
|
case "DeclaredPredicate":
|
|
57389
|
-
return (0, lines_1.concat)(["%checks(", path2.call(
|
|
57389
|
+
return (0, lines_1.concat)(["%checks(", path2.call(print4, "value"), ")"]);
|
|
57390
57390
|
case "FunctionTypeAnnotation": {
|
|
57391
57391
|
var parent = path2.getParentNode(0);
|
|
57392
57392
|
var isArrowFunctionTypeAnnotation = !(namedTypes.ObjectTypeCallProperty.check(parent) || namedTypes.ObjectTypeInternalSlot.check(parent) && parent.method || namedTypes.DeclareFunction.check(path2.getParentNode(2)));
|
|
@@ -57396,14 +57396,14 @@ var require_printer2 = __commonJS({
|
|
|
57396
57396
|
}
|
|
57397
57397
|
var hasTypeParameters = !!n.typeParameters;
|
|
57398
57398
|
var needsParens = hasTypeParameters || n.params.length !== 1 || n.params[0].name;
|
|
57399
|
-
parts.push(hasTypeParameters ? path2.call(
|
|
57399
|
+
parts.push(hasTypeParameters ? path2.call(print4, "typeParameters") : "", needsParens ? "(" : "", printFunctionParams(path2, options, print4), needsParens ? ")" : "");
|
|
57400
57400
|
if (n.returnType) {
|
|
57401
|
-
parts.push(isArrowFunctionTypeAnnotation ? " => " : ": ", path2.call(
|
|
57401
|
+
parts.push(isArrowFunctionTypeAnnotation ? " => " : ": ", path2.call(print4, "returnType"));
|
|
57402
57402
|
}
|
|
57403
57403
|
return (0, lines_1.concat)(parts);
|
|
57404
57404
|
}
|
|
57405
57405
|
case "FunctionTypeParam": {
|
|
57406
|
-
var name = path2.call(
|
|
57406
|
+
var name = path2.call(print4, "name");
|
|
57407
57407
|
parts.push(name);
|
|
57408
57408
|
if (n.optional) {
|
|
57409
57409
|
parts.push("?");
|
|
@@ -57411,13 +57411,13 @@ var require_printer2 = __commonJS({
|
|
|
57411
57411
|
if (name.infos[0].line) {
|
|
57412
57412
|
parts.push(": ");
|
|
57413
57413
|
}
|
|
57414
|
-
parts.push(path2.call(
|
|
57414
|
+
parts.push(path2.call(print4, "typeAnnotation"));
|
|
57415
57415
|
return (0, lines_1.concat)(parts);
|
|
57416
57416
|
}
|
|
57417
57417
|
case "GenericTypeAnnotation":
|
|
57418
57418
|
return (0, lines_1.concat)([
|
|
57419
|
-
path2.call(
|
|
57420
|
-
path2.call(
|
|
57419
|
+
path2.call(print4, "id"),
|
|
57420
|
+
path2.call(print4, "typeParameters")
|
|
57421
57421
|
]);
|
|
57422
57422
|
case "DeclareInterface":
|
|
57423
57423
|
parts.push("declare ");
|
|
@@ -57426,24 +57426,24 @@ var require_printer2 = __commonJS({
|
|
|
57426
57426
|
if (n.declare) {
|
|
57427
57427
|
parts.push("declare ");
|
|
57428
57428
|
}
|
|
57429
|
-
parts.push("interface ", path2.call(
|
|
57429
|
+
parts.push("interface ", path2.call(print4, "id"), path2.call(print4, "typeParameters"), " ");
|
|
57430
57430
|
if (n["extends"] && n["extends"].length > 0) {
|
|
57431
|
-
parts.push("extends ", (0, lines_1.fromString)(", ").join(path2.map(
|
|
57431
|
+
parts.push("extends ", (0, lines_1.fromString)(", ").join(path2.map(print4, "extends")), " ");
|
|
57432
57432
|
}
|
|
57433
57433
|
if (n.body) {
|
|
57434
|
-
parts.push(path2.call(
|
|
57434
|
+
parts.push(path2.call(print4, "body"));
|
|
57435
57435
|
}
|
|
57436
57436
|
return (0, lines_1.concat)(parts);
|
|
57437
57437
|
case "ClassImplements":
|
|
57438
57438
|
case "InterfaceExtends":
|
|
57439
57439
|
return (0, lines_1.concat)([
|
|
57440
|
-
path2.call(
|
|
57441
|
-
path2.call(
|
|
57440
|
+
path2.call(print4, "id"),
|
|
57441
|
+
path2.call(print4, "typeParameters")
|
|
57442
57442
|
]);
|
|
57443
57443
|
case "IntersectionTypeAnnotation":
|
|
57444
|
-
return (0, lines_1.fromString)(" & ").join(path2.map(
|
|
57444
|
+
return (0, lines_1.fromString)(" & ").join(path2.map(print4, "types"));
|
|
57445
57445
|
case "NullableTypeAnnotation":
|
|
57446
|
-
return (0, lines_1.concat)(["?", path2.call(
|
|
57446
|
+
return (0, lines_1.concat)(["?", path2.call(print4, "typeAnnotation")]);
|
|
57447
57447
|
case "NullLiteralTypeAnnotation":
|
|
57448
57448
|
return (0, lines_1.fromString)("null", options);
|
|
57449
57449
|
case "ThisTypeAnnotation":
|
|
@@ -57451,40 +57451,40 @@ var require_printer2 = __commonJS({
|
|
|
57451
57451
|
case "NumberTypeAnnotation":
|
|
57452
57452
|
return (0, lines_1.fromString)("number", options);
|
|
57453
57453
|
case "ObjectTypeCallProperty":
|
|
57454
|
-
return path2.call(
|
|
57454
|
+
return path2.call(print4, "value");
|
|
57455
57455
|
case "ObjectTypeIndexer":
|
|
57456
57456
|
if (n.static) {
|
|
57457
57457
|
parts.push("static ");
|
|
57458
57458
|
}
|
|
57459
|
-
parts.push(printVariance(path2,
|
|
57459
|
+
parts.push(printVariance(path2, print4), "[");
|
|
57460
57460
|
if (n.id) {
|
|
57461
|
-
parts.push(path2.call(
|
|
57461
|
+
parts.push(path2.call(print4, "id"), ": ");
|
|
57462
57462
|
}
|
|
57463
|
-
parts.push(path2.call(
|
|
57463
|
+
parts.push(path2.call(print4, "key"), "]: ", path2.call(print4, "value"));
|
|
57464
57464
|
return (0, lines_1.concat)(parts);
|
|
57465
57465
|
case "ObjectTypeProperty":
|
|
57466
57466
|
return (0, lines_1.concat)([
|
|
57467
|
-
printVariance(path2,
|
|
57468
|
-
path2.call(
|
|
57467
|
+
printVariance(path2, print4),
|
|
57468
|
+
path2.call(print4, "key"),
|
|
57469
57469
|
n.optional ? "?" : "",
|
|
57470
57470
|
": ",
|
|
57471
|
-
path2.call(
|
|
57471
|
+
path2.call(print4, "value")
|
|
57472
57472
|
]);
|
|
57473
57473
|
case "ObjectTypeInternalSlot":
|
|
57474
57474
|
return (0, lines_1.concat)([
|
|
57475
57475
|
n.static ? "static " : "",
|
|
57476
57476
|
"[[",
|
|
57477
|
-
path2.call(
|
|
57477
|
+
path2.call(print4, "id"),
|
|
57478
57478
|
"]]",
|
|
57479
57479
|
n.optional ? "?" : "",
|
|
57480
57480
|
n.value.type !== "FunctionTypeAnnotation" ? ": " : "",
|
|
57481
|
-
path2.call(
|
|
57481
|
+
path2.call(print4, "value")
|
|
57482
57482
|
]);
|
|
57483
57483
|
case "QualifiedTypeIdentifier":
|
|
57484
57484
|
return (0, lines_1.concat)([
|
|
57485
|
-
path2.call(
|
|
57485
|
+
path2.call(print4, "qualification"),
|
|
57486
57486
|
".",
|
|
57487
|
-
path2.call(
|
|
57487
|
+
path2.call(print4, "id")
|
|
57488
57488
|
]);
|
|
57489
57489
|
case "StringLiteralTypeAnnotation":
|
|
57490
57490
|
return (0, lines_1.fromString)(nodeStr(n.value, options), options);
|
|
@@ -57501,36 +57501,36 @@ var require_printer2 = __commonJS({
|
|
|
57501
57501
|
case "TypeAlias":
|
|
57502
57502
|
return (0, lines_1.concat)([
|
|
57503
57503
|
"type ",
|
|
57504
|
-
path2.call(
|
|
57505
|
-
path2.call(
|
|
57504
|
+
path2.call(print4, "id"),
|
|
57505
|
+
path2.call(print4, "typeParameters"),
|
|
57506
57506
|
" = ",
|
|
57507
|
-
path2.call(
|
|
57507
|
+
path2.call(print4, "right"),
|
|
57508
57508
|
";"
|
|
57509
57509
|
]);
|
|
57510
57510
|
case "DeclareOpaqueType":
|
|
57511
57511
|
parts.push("declare ");
|
|
57512
57512
|
case "OpaqueType":
|
|
57513
|
-
parts.push("opaque type ", path2.call(
|
|
57513
|
+
parts.push("opaque type ", path2.call(print4, "id"), path2.call(print4, "typeParameters"));
|
|
57514
57514
|
if (n["supertype"]) {
|
|
57515
|
-
parts.push(": ", path2.call(
|
|
57515
|
+
parts.push(": ", path2.call(print4, "supertype"));
|
|
57516
57516
|
}
|
|
57517
57517
|
if (n["impltype"]) {
|
|
57518
|
-
parts.push(" = ", path2.call(
|
|
57518
|
+
parts.push(" = ", path2.call(print4, "impltype"));
|
|
57519
57519
|
}
|
|
57520
57520
|
parts.push(";");
|
|
57521
57521
|
return (0, lines_1.concat)(parts);
|
|
57522
57522
|
case "TypeCastExpression":
|
|
57523
57523
|
return (0, lines_1.concat)([
|
|
57524
57524
|
"(",
|
|
57525
|
-
path2.call(
|
|
57526
|
-
path2.call(
|
|
57525
|
+
path2.call(print4, "expression"),
|
|
57526
|
+
path2.call(print4, "typeAnnotation"),
|
|
57527
57527
|
")"
|
|
57528
57528
|
]);
|
|
57529
57529
|
case "TypeParameterDeclaration":
|
|
57530
57530
|
case "TypeParameterInstantiation":
|
|
57531
57531
|
return (0, lines_1.concat)([
|
|
57532
57532
|
"<",
|
|
57533
|
-
(0, lines_1.fromString)(", ").join(path2.map(
|
|
57533
|
+
(0, lines_1.fromString)(", ").join(path2.map(print4, "params")),
|
|
57534
57534
|
">"
|
|
57535
57535
|
]);
|
|
57536
57536
|
case "Variance":
|
|
@@ -57543,32 +57543,32 @@ var require_printer2 = __commonJS({
|
|
|
57543
57543
|
return (0, lines_1.fromString)("");
|
|
57544
57544
|
case "TypeParameter":
|
|
57545
57545
|
if (n.variance) {
|
|
57546
|
-
parts.push(printVariance(path2,
|
|
57546
|
+
parts.push(printVariance(path2, print4));
|
|
57547
57547
|
}
|
|
57548
|
-
parts.push(path2.call(
|
|
57548
|
+
parts.push(path2.call(print4, "name"));
|
|
57549
57549
|
if (n.bound) {
|
|
57550
|
-
parts.push(path2.call(
|
|
57550
|
+
parts.push(path2.call(print4, "bound"));
|
|
57551
57551
|
}
|
|
57552
57552
|
if (n["default"]) {
|
|
57553
|
-
parts.push("=", path2.call(
|
|
57553
|
+
parts.push("=", path2.call(print4, "default"));
|
|
57554
57554
|
}
|
|
57555
57555
|
return (0, lines_1.concat)(parts);
|
|
57556
57556
|
case "TypeofTypeAnnotation":
|
|
57557
57557
|
return (0, lines_1.concat)([
|
|
57558
57558
|
(0, lines_1.fromString)("typeof ", options),
|
|
57559
|
-
path2.call(
|
|
57559
|
+
path2.call(print4, "argument")
|
|
57560
57560
|
]);
|
|
57561
57561
|
case "IndexedAccessType":
|
|
57562
57562
|
case "OptionalIndexedAccessType":
|
|
57563
57563
|
return (0, lines_1.concat)([
|
|
57564
|
-
path2.call(
|
|
57564
|
+
path2.call(print4, "objectType"),
|
|
57565
57565
|
n.optional ? "?." : "",
|
|
57566
57566
|
"[",
|
|
57567
|
-
path2.call(
|
|
57567
|
+
path2.call(print4, "indexType"),
|
|
57568
57568
|
"]"
|
|
57569
57569
|
]);
|
|
57570
57570
|
case "UnionTypeAnnotation":
|
|
57571
|
-
return (0, lines_1.fromString)(" | ").join(path2.map(
|
|
57571
|
+
return (0, lines_1.fromString)(" | ").join(path2.map(print4, "types"));
|
|
57572
57572
|
case "VoidTypeAnnotation":
|
|
57573
57573
|
return (0, lines_1.fromString)("void", options);
|
|
57574
57574
|
case "NullTypeAnnotation":
|
|
@@ -57608,77 +57608,77 @@ var require_printer2 = __commonJS({
|
|
|
57608
57608
|
case "TSNeverKeyword":
|
|
57609
57609
|
return (0, lines_1.fromString)("never", options);
|
|
57610
57610
|
case "TSArrayType":
|
|
57611
|
-
return (0, lines_1.concat)([path2.call(
|
|
57611
|
+
return (0, lines_1.concat)([path2.call(print4, "elementType"), "[]"]);
|
|
57612
57612
|
case "TSLiteralType":
|
|
57613
|
-
return path2.call(
|
|
57613
|
+
return path2.call(print4, "literal");
|
|
57614
57614
|
case "TSUnionType":
|
|
57615
|
-
return (0, lines_1.fromString)(" | ").join(path2.map(
|
|
57615
|
+
return (0, lines_1.fromString)(" | ").join(path2.map(print4, "types"));
|
|
57616
57616
|
case "TSIntersectionType":
|
|
57617
|
-
return (0, lines_1.fromString)(" & ").join(path2.map(
|
|
57617
|
+
return (0, lines_1.fromString)(" & ").join(path2.map(print4, "types"));
|
|
57618
57618
|
case "TSConditionalType":
|
|
57619
|
-
parts.push(path2.call(
|
|
57619
|
+
parts.push(path2.call(print4, "checkType"), " extends ", path2.call(print4, "extendsType"), " ? ", path2.call(print4, "trueType"), " : ", path2.call(print4, "falseType"));
|
|
57620
57620
|
return (0, lines_1.concat)(parts);
|
|
57621
57621
|
case "TSInferType":
|
|
57622
|
-
parts.push("infer ", path2.call(
|
|
57622
|
+
parts.push("infer ", path2.call(print4, "typeParameter"));
|
|
57623
57623
|
return (0, lines_1.concat)(parts);
|
|
57624
57624
|
case "TSParenthesizedType":
|
|
57625
|
-
return (0, lines_1.concat)(["(", path2.call(
|
|
57625
|
+
return (0, lines_1.concat)(["(", path2.call(print4, "typeAnnotation"), ")"]);
|
|
57626
57626
|
case "TSFunctionType":
|
|
57627
57627
|
return (0, lines_1.concat)([
|
|
57628
|
-
path2.call(
|
|
57628
|
+
path2.call(print4, "typeParameters"),
|
|
57629
57629
|
"(",
|
|
57630
|
-
printFunctionParams(path2, options,
|
|
57630
|
+
printFunctionParams(path2, options, print4),
|
|
57631
57631
|
") => ",
|
|
57632
|
-
path2.call(
|
|
57632
|
+
path2.call(print4, "typeAnnotation", "typeAnnotation")
|
|
57633
57633
|
]);
|
|
57634
57634
|
case "TSConstructorType":
|
|
57635
57635
|
return (0, lines_1.concat)([
|
|
57636
57636
|
"new ",
|
|
57637
|
-
path2.call(
|
|
57637
|
+
path2.call(print4, "typeParameters"),
|
|
57638
57638
|
"(",
|
|
57639
|
-
printFunctionParams(path2, options,
|
|
57639
|
+
printFunctionParams(path2, options, print4),
|
|
57640
57640
|
") => ",
|
|
57641
|
-
path2.call(
|
|
57641
|
+
path2.call(print4, "typeAnnotation", "typeAnnotation")
|
|
57642
57642
|
]);
|
|
57643
57643
|
case "TSMappedType": {
|
|
57644
|
-
parts.push(n.readonly ? "readonly " : "", "[", path2.call(
|
|
57644
|
+
parts.push(n.readonly ? "readonly " : "", "[", path2.call(print4, "typeParameter"), "]", n.optional ? "?" : "");
|
|
57645
57645
|
if (n.typeAnnotation) {
|
|
57646
|
-
parts.push(": ", path2.call(
|
|
57646
|
+
parts.push(": ", path2.call(print4, "typeAnnotation"), ";");
|
|
57647
57647
|
}
|
|
57648
57648
|
return (0, lines_1.concat)(["{\n", (0, lines_1.concat)(parts).indent(options.tabWidth), "\n}"]);
|
|
57649
57649
|
}
|
|
57650
57650
|
case "TSTupleType":
|
|
57651
57651
|
return (0, lines_1.concat)([
|
|
57652
57652
|
"[",
|
|
57653
|
-
(0, lines_1.fromString)(", ").join(path2.map(
|
|
57653
|
+
(0, lines_1.fromString)(", ").join(path2.map(print4, "elementTypes")),
|
|
57654
57654
|
"]"
|
|
57655
57655
|
]);
|
|
57656
57656
|
case "TSNamedTupleMember":
|
|
57657
|
-
parts.push(path2.call(
|
|
57657
|
+
parts.push(path2.call(print4, "label"));
|
|
57658
57658
|
if (n.optional) {
|
|
57659
57659
|
parts.push("?");
|
|
57660
57660
|
}
|
|
57661
|
-
parts.push(": ", path2.call(
|
|
57661
|
+
parts.push(": ", path2.call(print4, "elementType"));
|
|
57662
57662
|
return (0, lines_1.concat)(parts);
|
|
57663
57663
|
case "TSRestType":
|
|
57664
|
-
return (0, lines_1.concat)(["...", path2.call(
|
|
57664
|
+
return (0, lines_1.concat)(["...", path2.call(print4, "typeAnnotation")]);
|
|
57665
57665
|
case "TSOptionalType":
|
|
57666
|
-
return (0, lines_1.concat)([path2.call(
|
|
57666
|
+
return (0, lines_1.concat)([path2.call(print4, "typeAnnotation"), "?"]);
|
|
57667
57667
|
case "TSIndexedAccessType":
|
|
57668
57668
|
return (0, lines_1.concat)([
|
|
57669
|
-
path2.call(
|
|
57669
|
+
path2.call(print4, "objectType"),
|
|
57670
57670
|
"[",
|
|
57671
|
-
path2.call(
|
|
57671
|
+
path2.call(print4, "indexType"),
|
|
57672
57672
|
"]"
|
|
57673
57673
|
]);
|
|
57674
57674
|
case "TSTypeOperator":
|
|
57675
57675
|
return (0, lines_1.concat)([
|
|
57676
|
-
path2.call(
|
|
57676
|
+
path2.call(print4, "operator"),
|
|
57677
57677
|
" ",
|
|
57678
|
-
path2.call(
|
|
57678
|
+
path2.call(print4, "typeAnnotation")
|
|
57679
57679
|
]);
|
|
57680
57680
|
case "TSTypeLiteral": {
|
|
57681
|
-
var members = (0, lines_1.fromString)("\n").join(path2.map(
|
|
57681
|
+
var members = (0, lines_1.fromString)("\n").join(path2.map(print4, "members").map(function(member) {
|
|
57682
57682
|
if (lastNonSpaceCharacter(member) !== ";") {
|
|
57683
57683
|
return member.concat(";");
|
|
57684
57684
|
}
|
|
@@ -57691,13 +57691,13 @@ var require_printer2 = __commonJS({
|
|
|
57691
57691
|
return (0, lines_1.concat)(parts);
|
|
57692
57692
|
}
|
|
57693
57693
|
case "TSEnumMember":
|
|
57694
|
-
parts.push(path2.call(
|
|
57694
|
+
parts.push(path2.call(print4, "id"));
|
|
57695
57695
|
if (n.initializer) {
|
|
57696
|
-
parts.push(" = ", path2.call(
|
|
57696
|
+
parts.push(" = ", path2.call(print4, "initializer"));
|
|
57697
57697
|
}
|
|
57698
57698
|
return (0, lines_1.concat)(parts);
|
|
57699
57699
|
case "TSTypeQuery":
|
|
57700
|
-
return (0, lines_1.concat)(["typeof ", path2.call(
|
|
57700
|
+
return (0, lines_1.concat)(["typeof ", path2.call(print4, "exprName")]);
|
|
57701
57701
|
case "TSParameterProperty":
|
|
57702
57702
|
if (n.accessibility) {
|
|
57703
57703
|
parts.push(n.accessibility, " ");
|
|
@@ -57711,119 +57711,119 @@ var require_printer2 = __commonJS({
|
|
|
57711
57711
|
if (n.readonly) {
|
|
57712
57712
|
parts.push("readonly ");
|
|
57713
57713
|
}
|
|
57714
|
-
parts.push(path2.call(
|
|
57714
|
+
parts.push(path2.call(print4, "parameter"));
|
|
57715
57715
|
return (0, lines_1.concat)(parts);
|
|
57716
57716
|
case "TSTypeReference":
|
|
57717
57717
|
return (0, lines_1.concat)([
|
|
57718
|
-
path2.call(
|
|
57719
|
-
path2.call(
|
|
57718
|
+
path2.call(print4, "typeName"),
|
|
57719
|
+
path2.call(print4, "typeParameters")
|
|
57720
57720
|
]);
|
|
57721
57721
|
case "TSQualifiedName":
|
|
57722
|
-
return (0, lines_1.concat)([path2.call(
|
|
57722
|
+
return (0, lines_1.concat)([path2.call(print4, "left"), ".", path2.call(print4, "right")]);
|
|
57723
57723
|
case "TSAsExpression":
|
|
57724
57724
|
case "TSSatisfiesExpression": {
|
|
57725
|
-
var expression = path2.call(
|
|
57726
|
-
parts.push(expression, n.type === "TSSatisfiesExpression" ? " satisfies " : " as ", path2.call(
|
|
57725
|
+
var expression = path2.call(print4, "expression");
|
|
57726
|
+
parts.push(expression, n.type === "TSSatisfiesExpression" ? " satisfies " : " as ", path2.call(print4, "typeAnnotation"));
|
|
57727
57727
|
return (0, lines_1.concat)(parts);
|
|
57728
57728
|
}
|
|
57729
57729
|
case "TSTypeCastExpression":
|
|
57730
57730
|
return (0, lines_1.concat)([
|
|
57731
|
-
path2.call(
|
|
57732
|
-
path2.call(
|
|
57731
|
+
path2.call(print4, "expression"),
|
|
57732
|
+
path2.call(print4, "typeAnnotation")
|
|
57733
57733
|
]);
|
|
57734
57734
|
case "TSNonNullExpression":
|
|
57735
|
-
return (0, lines_1.concat)([path2.call(
|
|
57735
|
+
return (0, lines_1.concat)([path2.call(print4, "expression"), "!"]);
|
|
57736
57736
|
case "TSTypeAnnotation":
|
|
57737
|
-
return (0, lines_1.concat)([": ", path2.call(
|
|
57737
|
+
return (0, lines_1.concat)([": ", path2.call(print4, "typeAnnotation")]);
|
|
57738
57738
|
case "TSIndexSignature":
|
|
57739
57739
|
return (0, lines_1.concat)([
|
|
57740
57740
|
n.readonly ? "readonly " : "",
|
|
57741
57741
|
"[",
|
|
57742
|
-
path2.map(
|
|
57742
|
+
path2.map(print4, "parameters"),
|
|
57743
57743
|
"]",
|
|
57744
|
-
path2.call(
|
|
57744
|
+
path2.call(print4, "typeAnnotation")
|
|
57745
57745
|
]);
|
|
57746
57746
|
case "TSPropertySignature":
|
|
57747
|
-
parts.push(printVariance(path2,
|
|
57747
|
+
parts.push(printVariance(path2, print4), n.readonly ? "readonly " : "");
|
|
57748
57748
|
if (n.computed) {
|
|
57749
|
-
parts.push("[", path2.call(
|
|
57749
|
+
parts.push("[", path2.call(print4, "key"), "]");
|
|
57750
57750
|
} else {
|
|
57751
|
-
parts.push(path2.call(
|
|
57751
|
+
parts.push(path2.call(print4, "key"));
|
|
57752
57752
|
}
|
|
57753
|
-
parts.push(n.optional ? "?" : "", path2.call(
|
|
57753
|
+
parts.push(n.optional ? "?" : "", path2.call(print4, "typeAnnotation"));
|
|
57754
57754
|
return (0, lines_1.concat)(parts);
|
|
57755
57755
|
case "TSMethodSignature":
|
|
57756
57756
|
if (n.computed) {
|
|
57757
|
-
parts.push("[", path2.call(
|
|
57757
|
+
parts.push("[", path2.call(print4, "key"), "]");
|
|
57758
57758
|
} else {
|
|
57759
|
-
parts.push(path2.call(
|
|
57759
|
+
parts.push(path2.call(print4, "key"));
|
|
57760
57760
|
}
|
|
57761
57761
|
if (n.optional) {
|
|
57762
57762
|
parts.push("?");
|
|
57763
57763
|
}
|
|
57764
|
-
parts.push(path2.call(
|
|
57764
|
+
parts.push(path2.call(print4, "typeParameters"), "(", printFunctionParams(path2, options, print4), ")", path2.call(print4, "typeAnnotation"));
|
|
57765
57765
|
return (0, lines_1.concat)(parts);
|
|
57766
57766
|
case "TSTypePredicate":
|
|
57767
57767
|
if (n.asserts) {
|
|
57768
57768
|
parts.push("asserts ");
|
|
57769
57769
|
}
|
|
57770
|
-
parts.push(path2.call(
|
|
57770
|
+
parts.push(path2.call(print4, "parameterName"));
|
|
57771
57771
|
if (n.typeAnnotation) {
|
|
57772
|
-
parts.push(" is ", path2.call(
|
|
57772
|
+
parts.push(" is ", path2.call(print4, "typeAnnotation", "typeAnnotation"));
|
|
57773
57773
|
}
|
|
57774
57774
|
return (0, lines_1.concat)(parts);
|
|
57775
57775
|
case "TSCallSignatureDeclaration":
|
|
57776
57776
|
return (0, lines_1.concat)([
|
|
57777
|
-
path2.call(
|
|
57777
|
+
path2.call(print4, "typeParameters"),
|
|
57778
57778
|
"(",
|
|
57779
|
-
printFunctionParams(path2, options,
|
|
57779
|
+
printFunctionParams(path2, options, print4),
|
|
57780
57780
|
")",
|
|
57781
|
-
path2.call(
|
|
57781
|
+
path2.call(print4, "typeAnnotation")
|
|
57782
57782
|
]);
|
|
57783
57783
|
case "TSConstructSignatureDeclaration":
|
|
57784
57784
|
if (n.typeParameters) {
|
|
57785
|
-
parts.push("new", path2.call(
|
|
57785
|
+
parts.push("new", path2.call(print4, "typeParameters"));
|
|
57786
57786
|
} else {
|
|
57787
57787
|
parts.push("new ");
|
|
57788
57788
|
}
|
|
57789
|
-
parts.push("(", printFunctionParams(path2, options,
|
|
57789
|
+
parts.push("(", printFunctionParams(path2, options, print4), ")", path2.call(print4, "typeAnnotation"));
|
|
57790
57790
|
return (0, lines_1.concat)(parts);
|
|
57791
57791
|
case "TSTypeAliasDeclaration":
|
|
57792
57792
|
return (0, lines_1.concat)([
|
|
57793
57793
|
n.declare ? "declare " : "",
|
|
57794
57794
|
"type ",
|
|
57795
|
-
path2.call(
|
|
57796
|
-
path2.call(
|
|
57795
|
+
path2.call(print4, "id"),
|
|
57796
|
+
path2.call(print4, "typeParameters"),
|
|
57797
57797
|
" = ",
|
|
57798
|
-
path2.call(
|
|
57798
|
+
path2.call(print4, "typeAnnotation"),
|
|
57799
57799
|
";"
|
|
57800
57800
|
]);
|
|
57801
57801
|
case "TSTypeParameter": {
|
|
57802
|
-
parts.push(path2.call(
|
|
57802
|
+
parts.push(path2.call(print4, "name"));
|
|
57803
57803
|
var parent = path2.getParentNode(0);
|
|
57804
57804
|
var isInMappedType = namedTypes.TSMappedType.check(parent);
|
|
57805
57805
|
if (n.constraint) {
|
|
57806
|
-
parts.push(isInMappedType ? " in " : " extends ", path2.call(
|
|
57806
|
+
parts.push(isInMappedType ? " in " : " extends ", path2.call(print4, "constraint"));
|
|
57807
57807
|
}
|
|
57808
57808
|
if (n["default"]) {
|
|
57809
|
-
parts.push(" = ", path2.call(
|
|
57809
|
+
parts.push(" = ", path2.call(print4, "default"));
|
|
57810
57810
|
}
|
|
57811
57811
|
return (0, lines_1.concat)(parts);
|
|
57812
57812
|
}
|
|
57813
57813
|
case "TSTypeAssertion": {
|
|
57814
|
-
parts.push("<", path2.call(
|
|
57814
|
+
parts.push("<", path2.call(print4, "typeAnnotation"), "> ", path2.call(print4, "expression"));
|
|
57815
57815
|
return (0, lines_1.concat)(parts);
|
|
57816
57816
|
}
|
|
57817
57817
|
case "TSTypeParameterDeclaration":
|
|
57818
57818
|
case "TSTypeParameterInstantiation":
|
|
57819
57819
|
return (0, lines_1.concat)([
|
|
57820
57820
|
"<",
|
|
57821
|
-
(0, lines_1.fromString)(", ").join(path2.map(
|
|
57821
|
+
(0, lines_1.fromString)(", ").join(path2.map(print4, "params")),
|
|
57822
57822
|
">"
|
|
57823
57823
|
]);
|
|
57824
57824
|
case "TSEnumDeclaration": {
|
|
57825
|
-
parts.push(n.declare ? "declare " : "", n.const ? "const " : "", "enum ", path2.call(
|
|
57826
|
-
var memberLines = (0, lines_1.fromString)(",\n").join(path2.map(
|
|
57825
|
+
parts.push(n.declare ? "declare " : "", n.const ? "const " : "", "enum ", path2.call(print4, "id"));
|
|
57826
|
+
var memberLines = (0, lines_1.fromString)(",\n").join(path2.map(print4, "members"));
|
|
57827
57827
|
if (memberLines.isEmpty()) {
|
|
57828
57828
|
parts.push(" {}");
|
|
57829
57829
|
} else {
|
|
@@ -57833,11 +57833,11 @@ var require_printer2 = __commonJS({
|
|
|
57833
57833
|
}
|
|
57834
57834
|
case "TSExpressionWithTypeArguments":
|
|
57835
57835
|
return (0, lines_1.concat)([
|
|
57836
|
-
path2.call(
|
|
57837
|
-
path2.call(
|
|
57836
|
+
path2.call(print4, "expression"),
|
|
57837
|
+
path2.call(print4, "typeParameters")
|
|
57838
57838
|
]);
|
|
57839
57839
|
case "TSInterfaceBody": {
|
|
57840
|
-
var lines = (0, lines_1.fromString)("\n").join(path2.map(
|
|
57840
|
+
var lines = (0, lines_1.fromString)("\n").join(path2.map(print4, "body").map(function(element) {
|
|
57841
57841
|
if (lastNonSpaceCharacter(element) !== ";") {
|
|
57842
57842
|
return element.concat(";");
|
|
57843
57843
|
}
|
|
@@ -57849,22 +57849,22 @@ var require_printer2 = __commonJS({
|
|
|
57849
57849
|
return (0, lines_1.concat)(["{\n", lines.indent(options.tabWidth), "\n}"]);
|
|
57850
57850
|
}
|
|
57851
57851
|
case "TSImportType":
|
|
57852
|
-
parts.push("import(", path2.call(
|
|
57852
|
+
parts.push("import(", path2.call(print4, "argument"), ")");
|
|
57853
57853
|
if (n.qualifier) {
|
|
57854
|
-
parts.push(".", path2.call(
|
|
57854
|
+
parts.push(".", path2.call(print4, "qualifier"));
|
|
57855
57855
|
}
|
|
57856
57856
|
if (n.typeParameters) {
|
|
57857
|
-
parts.push(path2.call(
|
|
57857
|
+
parts.push(path2.call(print4, "typeParameters"));
|
|
57858
57858
|
}
|
|
57859
57859
|
return (0, lines_1.concat)(parts);
|
|
57860
57860
|
case "TSImportEqualsDeclaration":
|
|
57861
57861
|
if (n.isExport) {
|
|
57862
57862
|
parts.push("export ");
|
|
57863
57863
|
}
|
|
57864
|
-
parts.push("import ", path2.call(
|
|
57864
|
+
parts.push("import ", path2.call(print4, "id"), " = ", path2.call(print4, "moduleReference"));
|
|
57865
57865
|
return maybeAddSemicolon((0, lines_1.concat)(parts));
|
|
57866
57866
|
case "TSExternalModuleReference":
|
|
57867
|
-
return (0, lines_1.concat)(["require(", path2.call(
|
|
57867
|
+
return (0, lines_1.concat)(["require(", path2.call(print4, "expression"), ")"]);
|
|
57868
57868
|
case "TSModuleDeclaration": {
|
|
57869
57869
|
var parent = path2.getParentNode();
|
|
57870
57870
|
if (parent.type === "TSModuleDeclaration") {
|
|
@@ -57889,16 +57889,16 @@ var require_printer2 = __commonJS({
|
|
|
57889
57889
|
}
|
|
57890
57890
|
}
|
|
57891
57891
|
}
|
|
57892
|
-
parts.push(path2.call(
|
|
57892
|
+
parts.push(path2.call(print4, "id"));
|
|
57893
57893
|
if (n.body) {
|
|
57894
57894
|
parts.push(" ");
|
|
57895
|
-
parts.push(path2.call(
|
|
57895
|
+
parts.push(path2.call(print4, "body"));
|
|
57896
57896
|
}
|
|
57897
57897
|
return (0, lines_1.concat)(parts);
|
|
57898
57898
|
}
|
|
57899
57899
|
case "TSModuleBlock": {
|
|
57900
57900
|
var naked = path2.call(function(bodyPath) {
|
|
57901
|
-
return printStatementSequence(bodyPath, options,
|
|
57901
|
+
return printStatementSequence(bodyPath, options, print4);
|
|
57902
57902
|
}, "body");
|
|
57903
57903
|
if (naked.isEmpty()) {
|
|
57904
57904
|
parts.push("{}");
|
|
@@ -57908,11 +57908,11 @@ var require_printer2 = __commonJS({
|
|
|
57908
57908
|
return (0, lines_1.concat)(parts);
|
|
57909
57909
|
}
|
|
57910
57910
|
case "TSInstantiationExpression": {
|
|
57911
|
-
parts.push(path2.call(
|
|
57911
|
+
parts.push(path2.call(print4, "expression"), path2.call(print4, "typeParameters"));
|
|
57912
57912
|
return (0, lines_1.concat)(parts);
|
|
57913
57913
|
}
|
|
57914
57914
|
case "V8IntrinsicIdentifier":
|
|
57915
|
-
return (0, lines_1.concat)(["%", path2.call(
|
|
57915
|
+
return (0, lines_1.concat)(["%", path2.call(print4, "name")]);
|
|
57916
57916
|
case "TopicReference":
|
|
57917
57917
|
return (0, lines_1.fromString)("#");
|
|
57918
57918
|
case "ClassHeritage":
|
|
@@ -57962,7 +57962,7 @@ var require_printer2 = __commonJS({
|
|
|
57962
57962
|
}
|
|
57963
57963
|
return (0, lines_1.concat)(parts);
|
|
57964
57964
|
}
|
|
57965
|
-
function printStatementSequence(path2, options,
|
|
57965
|
+
function printStatementSequence(path2, options, print4) {
|
|
57966
57966
|
var filtered = [];
|
|
57967
57967
|
var sawComment = false;
|
|
57968
57968
|
var sawStatement = false;
|
|
@@ -57983,7 +57983,7 @@ var require_printer2 = __commonJS({
|
|
|
57983
57983
|
}
|
|
57984
57984
|
filtered.push({
|
|
57985
57985
|
node: stmt,
|
|
57986
|
-
printed:
|
|
57986
|
+
printed: print4(stmtPath)
|
|
57987
57987
|
});
|
|
57988
57988
|
});
|
|
57989
57989
|
if (sawComment) {
|
|
@@ -58075,7 +58075,7 @@ var require_printer2 = __commonJS({
|
|
|
58075
58075
|
}
|
|
58076
58076
|
return parts;
|
|
58077
58077
|
}
|
|
58078
|
-
function printMethod(path2, options,
|
|
58078
|
+
function printMethod(path2, options, print4) {
|
|
58079
58079
|
var node = path2.getNode();
|
|
58080
58080
|
var kind = node.kind;
|
|
58081
58081
|
var parts = [];
|
|
@@ -58093,7 +58093,7 @@ var require_printer2 = __commonJS({
|
|
|
58093
58093
|
if (kind === "get" || kind === "set") {
|
|
58094
58094
|
parts.push(kind, " ");
|
|
58095
58095
|
}
|
|
58096
|
-
var key = path2.call(
|
|
58096
|
+
var key = path2.call(print4, "key");
|
|
58097
58097
|
if (node.computed) {
|
|
58098
58098
|
key = (0, lines_1.concat)(["[", key, "]"]);
|
|
58099
58099
|
}
|
|
@@ -58102,26 +58102,26 @@ var require_printer2 = __commonJS({
|
|
|
58102
58102
|
parts.push("?");
|
|
58103
58103
|
}
|
|
58104
58104
|
if (node === nodeValue) {
|
|
58105
|
-
parts.push(path2.call(
|
|
58105
|
+
parts.push(path2.call(print4, "typeParameters"), "(", printFunctionParams(path2, options, print4), ")", path2.call(print4, "returnType"));
|
|
58106
58106
|
if (node.body) {
|
|
58107
|
-
parts.push(" ", path2.call(
|
|
58107
|
+
parts.push(" ", path2.call(print4, "body"));
|
|
58108
58108
|
} else {
|
|
58109
58109
|
parts.push(";");
|
|
58110
58110
|
}
|
|
58111
58111
|
} else {
|
|
58112
|
-
parts.push(path2.call(
|
|
58113
|
-
return printFunctionParams(valuePath, options,
|
|
58114
|
-
}, "value"), ")", path2.call(
|
|
58112
|
+
parts.push(path2.call(print4, "value", "typeParameters"), "(", path2.call(function(valuePath) {
|
|
58113
|
+
return printFunctionParams(valuePath, options, print4);
|
|
58114
|
+
}, "value"), ")", path2.call(print4, "value", "returnType"));
|
|
58115
58115
|
if (nodeValue.body) {
|
|
58116
|
-
parts.push(" ", path2.call(
|
|
58116
|
+
parts.push(" ", path2.call(print4, "value", "body"));
|
|
58117
58117
|
} else {
|
|
58118
58118
|
parts.push(";");
|
|
58119
58119
|
}
|
|
58120
58120
|
}
|
|
58121
58121
|
return (0, lines_1.concat)(parts);
|
|
58122
58122
|
}
|
|
58123
|
-
function printArgumentsList(path2, options,
|
|
58124
|
-
var printed = path2.map(
|
|
58123
|
+
function printArgumentsList(path2, options, print4) {
|
|
58124
|
+
var printed = path2.map(print4, "arguments");
|
|
58125
58125
|
var trailingComma = util.isTrailingCommaEnabled(options, "parameters");
|
|
58126
58126
|
var joined = (0, lines_1.fromString)(", ").join(printed);
|
|
58127
58127
|
if (joined.getLineLength(1) > options.wrapColumn) {
|
|
@@ -58134,28 +58134,28 @@ var require_printer2 = __commonJS({
|
|
|
58134
58134
|
}
|
|
58135
58135
|
return (0, lines_1.concat)(["(", joined, ")"]);
|
|
58136
58136
|
}
|
|
58137
|
-
function printFunctionParams(path2, options,
|
|
58137
|
+
function printFunctionParams(path2, options, print4) {
|
|
58138
58138
|
var fun = path2.getValue();
|
|
58139
58139
|
var params;
|
|
58140
58140
|
var printed = [];
|
|
58141
58141
|
if (fun.params) {
|
|
58142
58142
|
params = fun.params;
|
|
58143
|
-
printed = path2.map(
|
|
58143
|
+
printed = path2.map(print4, "params");
|
|
58144
58144
|
} else if (fun.parameters) {
|
|
58145
58145
|
params = fun.parameters;
|
|
58146
|
-
printed = path2.map(
|
|
58146
|
+
printed = path2.map(print4, "parameters");
|
|
58147
58147
|
}
|
|
58148
58148
|
if (fun.defaults) {
|
|
58149
58149
|
path2.each(function(defExprPath) {
|
|
58150
58150
|
var i2 = defExprPath.getName();
|
|
58151
58151
|
var p = printed[i2];
|
|
58152
58152
|
if (p && defExprPath.getValue()) {
|
|
58153
|
-
printed[i2] = (0, lines_1.concat)([p, " = ",
|
|
58153
|
+
printed[i2] = (0, lines_1.concat)([p, " = ", print4(defExprPath)]);
|
|
58154
58154
|
}
|
|
58155
58155
|
}, "defaults");
|
|
58156
58156
|
}
|
|
58157
58157
|
if (fun.rest) {
|
|
58158
|
-
printed.push((0, lines_1.concat)(["...", path2.call(
|
|
58158
|
+
printed.push((0, lines_1.concat)(["...", path2.call(print4, "rest")]));
|
|
58159
58159
|
}
|
|
58160
58160
|
var joined = (0, lines_1.fromString)(", ").join(printed);
|
|
58161
58161
|
if (joined.length > 1 || joined.getLineLength(1) > options.wrapColumn) {
|
|
@@ -58169,11 +58169,11 @@ var require_printer2 = __commonJS({
|
|
|
58169
58169
|
}
|
|
58170
58170
|
return joined;
|
|
58171
58171
|
}
|
|
58172
|
-
function maybePrintImportAssertions(path2, options,
|
|
58172
|
+
function maybePrintImportAssertions(path2, options, print4) {
|
|
58173
58173
|
var n = path2.getValue();
|
|
58174
58174
|
if (n.assertions && n.assertions.length > 0) {
|
|
58175
58175
|
var parts = [" assert {"];
|
|
58176
|
-
var printed = path2.map(
|
|
58176
|
+
var printed = path2.map(print4, "assertions");
|
|
58177
58177
|
var flat = (0, lines_1.fromString)(", ").join(printed);
|
|
58178
58178
|
if (flat.length > 1 || flat.getLineLength(1) > options.wrapColumn) {
|
|
58179
58179
|
parts.push("\n", (0, lines_1.fromString)(",\n").join(printed).indent(options.tabWidth), "\n}");
|
|
@@ -58184,7 +58184,7 @@ var require_printer2 = __commonJS({
|
|
|
58184
58184
|
}
|
|
58185
58185
|
return (0, lines_1.fromString)("");
|
|
58186
58186
|
}
|
|
58187
|
-
function printExportDeclaration(path2, options,
|
|
58187
|
+
function printExportDeclaration(path2, options, print4) {
|
|
58188
58188
|
var decl = path2.getValue();
|
|
58189
58189
|
var parts = ["export "];
|
|
58190
58190
|
if (decl.exportKind && decl.exportKind === "type") {
|
|
@@ -58198,7 +58198,7 @@ var require_printer2 = __commonJS({
|
|
|
58198
58198
|
parts.push("default ");
|
|
58199
58199
|
}
|
|
58200
58200
|
if (decl.declaration) {
|
|
58201
|
-
parts.push(path2.call(
|
|
58201
|
+
parts.push(path2.call(print4, "declaration"));
|
|
58202
58202
|
} else if (decl.specifiers) {
|
|
58203
58203
|
if (decl.specifiers.length === 1 && decl.specifiers[0].type === "ExportBatchSpecifier") {
|
|
58204
58204
|
parts.push("*");
|
|
@@ -58210,9 +58210,9 @@ var require_printer2 = __commonJS({
|
|
|
58210
58210
|
path2.each(function(specifierPath) {
|
|
58211
58211
|
var spec = specifierPath.getValue();
|
|
58212
58212
|
if (spec.type === "ExportDefaultSpecifier") {
|
|
58213
|
-
unbracedSpecifiers_2.push(
|
|
58213
|
+
unbracedSpecifiers_2.push(print4(specifierPath));
|
|
58214
58214
|
} else {
|
|
58215
|
-
bracedSpecifiers_2.push(
|
|
58215
|
+
bracedSpecifiers_2.push(print4(specifierPath));
|
|
58216
58216
|
}
|
|
58217
58217
|
}, "specifiers");
|
|
58218
58218
|
unbracedSpecifiers_2.forEach(function(lines2, i2) {
|
|
@@ -58241,10 +58241,10 @@ var require_printer2 = __commonJS({
|
|
|
58241
58241
|
}
|
|
58242
58242
|
}
|
|
58243
58243
|
} else {
|
|
58244
|
-
parts.push(shouldPrintSpaces ? "{ " : "{", (0, lines_1.fromString)(", ").join(path2.map(
|
|
58244
|
+
parts.push(shouldPrintSpaces ? "{ " : "{", (0, lines_1.fromString)(", ").join(path2.map(print4, "specifiers")), shouldPrintSpaces ? " }" : "}");
|
|
58245
58245
|
}
|
|
58246
58246
|
if (decl.source) {
|
|
58247
|
-
parts.push(" from ", path2.call(
|
|
58247
|
+
parts.push(" from ", path2.call(print4, "source"), maybePrintImportAssertions(path2, options, print4));
|
|
58248
58248
|
}
|
|
58249
58249
|
}
|
|
58250
58250
|
var lines = (0, lines_1.concat)(parts);
|
|
@@ -58262,7 +58262,7 @@ var require_printer2 = __commonJS({
|
|
|
58262
58262
|
}
|
|
58263
58263
|
return (0, lines_1.concat)(parts);
|
|
58264
58264
|
}
|
|
58265
|
-
function printVariance(path2,
|
|
58265
|
+
function printVariance(path2, print4) {
|
|
58266
58266
|
return path2.call(function(variancePath) {
|
|
58267
58267
|
var value = variancePath.getValue();
|
|
58268
58268
|
if (value) {
|
|
@@ -58272,7 +58272,7 @@ var require_printer2 = __commonJS({
|
|
|
58272
58272
|
if (value === "minus") {
|
|
58273
58273
|
return (0, lines_1.fromString)("-");
|
|
58274
58274
|
}
|
|
58275
|
-
return
|
|
58275
|
+
return print4(variancePath);
|
|
58276
58276
|
}
|
|
58277
58277
|
return (0, lines_1.fromString)("");
|
|
58278
58278
|
}, "variance");
|
|
@@ -58359,10 +58359,10 @@ var require_main2 = __commonJS({
|
|
|
58359
58359
|
Object.defineProperty(exports, "visit", { enumerable: true, get: function() {
|
|
58360
58360
|
return ast_types_1.visit;
|
|
58361
58361
|
} });
|
|
58362
|
-
function
|
|
58362
|
+
function print4(node, options) {
|
|
58363
58363
|
return new printer_1.Printer(options).print(node);
|
|
58364
58364
|
}
|
|
58365
|
-
exports.print =
|
|
58365
|
+
exports.print = print4;
|
|
58366
58366
|
function prettyPrint(node, options) {
|
|
58367
58367
|
return new printer_1.Printer(options).printGenerically(node);
|
|
58368
58368
|
}
|
|
@@ -58386,7 +58386,7 @@ var require_main2 = __commonJS({
|
|
|
58386
58386
|
function runString(code, transformer, options) {
|
|
58387
58387
|
var writeback = options && options.writeback || defaultWriteback;
|
|
58388
58388
|
transformer((0, parser_1.parse)(code, options), function(node) {
|
|
58389
|
-
writeback(
|
|
58389
|
+
writeback(print4(node, options).code);
|
|
58390
58390
|
});
|
|
58391
58391
|
}
|
|
58392
58392
|
}
|
|
@@ -63744,7 +63744,7 @@ async function getConfig({
|
|
|
63744
63744
|
}
|
|
63745
63745
|
}
|
|
63746
63746
|
_config.plugins = orderedPlugins(plugins);
|
|
63747
|
-
await Promise.all(_config.plugins.map((plugin2) => plugin2.
|
|
63747
|
+
await Promise.all(_config.plugins.map((plugin2) => plugin2.afterLoad?.({ config: _config })));
|
|
63748
63748
|
resolve2(_config);
|
|
63749
63749
|
return _config;
|
|
63750
63750
|
} catch (e2) {
|
|
@@ -63891,8 +63891,8 @@ function getRootType(type) {
|
|
|
63891
63891
|
function hashDocument({
|
|
63892
63892
|
document
|
|
63893
63893
|
}) {
|
|
63894
|
-
const docString = typeof document === "string" ? document :
|
|
63895
|
-
return crypto.createHash("sha256").update(docString).digest("hex");
|
|
63894
|
+
const docString = typeof document === "string" ? document : document.artifact?.raw;
|
|
63895
|
+
return crypto.createHash("sha256").update(docString ?? "").digest("hex");
|
|
63896
63896
|
}
|
|
63897
63897
|
function parentTypeFromAncestors(schema, filepath, ancestors) {
|
|
63898
63898
|
const parents = [...ancestors];
|