houdini 1.0.0-next.6 → 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 +356 -356
- package/build/cmd-esm/index.js +356 -356
- package/build/codegen-cjs/index.js +354 -354
- package/build/codegen-esm/index.js +354 -354
- package/build/lib-cjs/index.js +354 -354
- package/build/lib-esm/index.js +354 -354
- 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-cjs/index.js +354 -354
- package/build/test-esm/index.js +354 -354
- package/build/vite-cjs/index.js +354 -354
- package/build/vite-esm/index.js +354 -354
- package/package.json +1 -1
package/build/lib-cjs/index.js
CHANGED
|
@@ -3069,10 +3069,10 @@ var require_printer = __commonJS({
|
|
|
3069
3069
|
Object.defineProperty(exports, "__esModule", {
|
|
3070
3070
|
value: true
|
|
3071
3071
|
});
|
|
3072
|
-
exports.print =
|
|
3072
|
+
exports.print = print4;
|
|
3073
3073
|
var _visitor = require_visitor();
|
|
3074
3074
|
var _blockString = require_blockString();
|
|
3075
|
-
function
|
|
3075
|
+
function print4(ast) {
|
|
3076
3076
|
return (0, _visitor.visit)(ast, {
|
|
3077
3077
|
leave: printDocASTReducer2
|
|
3078
3078
|
});
|
|
@@ -55174,12 +55174,12 @@ var require_comments = __commonJS({
|
|
|
55174
55174
|
comment.trailing = true;
|
|
55175
55175
|
addCommentHelper(node, comment);
|
|
55176
55176
|
}
|
|
55177
|
-
function printLeadingComment(commentPath,
|
|
55177
|
+
function printLeadingComment(commentPath, print4) {
|
|
55178
55178
|
var comment = commentPath.getValue();
|
|
55179
55179
|
n.Comment.assert(comment);
|
|
55180
55180
|
var loc = comment.loc;
|
|
55181
55181
|
var lines = loc && loc.lines;
|
|
55182
|
-
var parts = [
|
|
55182
|
+
var parts = [print4(commentPath)];
|
|
55183
55183
|
if (comment.trailing) {
|
|
55184
55184
|
parts.push("\n");
|
|
55185
55185
|
} else if (lines instanceof lines_1.Lines) {
|
|
@@ -55194,7 +55194,7 @@ var require_comments = __commonJS({
|
|
|
55194
55194
|
}
|
|
55195
55195
|
return (0, lines_1.concat)(parts);
|
|
55196
55196
|
}
|
|
55197
|
-
function printTrailingComment(commentPath,
|
|
55197
|
+
function printTrailingComment(commentPath, print4) {
|
|
55198
55198
|
var comment = commentPath.getValue(commentPath);
|
|
55199
55199
|
n.Comment.assert(comment);
|
|
55200
55200
|
var loc = comment.loc;
|
|
@@ -55209,12 +55209,12 @@ var require_comments = __commonJS({
|
|
|
55209
55209
|
parts.push(new Array(leadingSpace.length).join("\n"));
|
|
55210
55210
|
}
|
|
55211
55211
|
}
|
|
55212
|
-
parts.push(
|
|
55212
|
+
parts.push(print4(commentPath));
|
|
55213
55213
|
return (0, lines_1.concat)(parts);
|
|
55214
55214
|
}
|
|
55215
|
-
function printComments(path2,
|
|
55215
|
+
function printComments(path2, print4) {
|
|
55216
55216
|
var value = path2.getValue();
|
|
55217
|
-
var innerLines =
|
|
55217
|
+
var innerLines = print4(path2);
|
|
55218
55218
|
var comments = n.Node.check(value) && types4.getFieldValue(value, "comments");
|
|
55219
55219
|
if (!comments || comments.length === 0) {
|
|
55220
55220
|
return innerLines;
|
|
@@ -55226,9 +55226,9 @@ var require_comments = __commonJS({
|
|
|
55226
55226
|
var leading = types4.getFieldValue(comment, "leading");
|
|
55227
55227
|
var trailing = types4.getFieldValue(comment, "trailing");
|
|
55228
55228
|
if (leading || trailing && !(n.Statement.check(value) || comment.type === "Block" || comment.type === "CommentBlock")) {
|
|
55229
|
-
leadingParts.push(printLeadingComment(commentPath,
|
|
55229
|
+
leadingParts.push(printLeadingComment(commentPath, print4));
|
|
55230
55230
|
} else if (trailing) {
|
|
55231
|
-
trailingParts.push(printTrailingComment(commentPath,
|
|
55231
|
+
trailingParts.push(printTrailingComment(commentPath, print4));
|
|
55232
55232
|
}
|
|
55233
55233
|
}, "comments");
|
|
55234
55234
|
leadingParts.push.apply(leadingParts, trailingParts);
|
|
@@ -55919,7 +55919,7 @@ var require_patcher = __commonJS({
|
|
|
55919
55919
|
};
|
|
55920
55920
|
exports.Patcher = Patcher;
|
|
55921
55921
|
var Pp = Patcher.prototype;
|
|
55922
|
-
Pp.tryToReprintComments = function(newNode, oldNode,
|
|
55922
|
+
Pp.tryToReprintComments = function(newNode, oldNode, print4) {
|
|
55923
55923
|
var patcher = this;
|
|
55924
55924
|
if (!newNode.comments && !oldNode.comments) {
|
|
55925
55925
|
return true;
|
|
@@ -55936,7 +55936,7 @@ var require_patcher = __commonJS({
|
|
|
55936
55936
|
assert_1.default.ok(oldComment.leading || oldComment.trailing);
|
|
55937
55937
|
patcher.replace(
|
|
55938
55938
|
oldComment.loc,
|
|
55939
|
-
|
|
55939
|
+
print4(reprint.newPath).indentTail(oldComment.loc.indent)
|
|
55940
55940
|
);
|
|
55941
55941
|
});
|
|
55942
55942
|
}
|
|
@@ -55983,17 +55983,17 @@ var require_patcher = __commonJS({
|
|
|
55983
55983
|
var reprints = [];
|
|
55984
55984
|
if (!lines || !findReprints(path2, reprints))
|
|
55985
55985
|
return;
|
|
55986
|
-
return function(
|
|
55986
|
+
return function(print4) {
|
|
55987
55987
|
var patcher = new Patcher(lines);
|
|
55988
55988
|
reprints.forEach(function(reprint) {
|
|
55989
55989
|
var newNode = reprint.newPath.getValue();
|
|
55990
55990
|
var oldNode = reprint.oldPath.getValue();
|
|
55991
55991
|
SourceLocation.assert(oldNode.loc, true);
|
|
55992
|
-
var needToPrintNewPathWithComments = !patcher.tryToReprintComments(newNode, oldNode,
|
|
55992
|
+
var needToPrintNewPathWithComments = !patcher.tryToReprintComments(newNode, oldNode, print4);
|
|
55993
55993
|
if (needToPrintNewPathWithComments) {
|
|
55994
55994
|
patcher.deleteComments(oldNode);
|
|
55995
55995
|
}
|
|
55996
|
-
var newLines =
|
|
55996
|
+
var newLines = print4(reprint.newPath, {
|
|
55997
55997
|
includeComments: needToPrintNewPathWithComments,
|
|
55998
55998
|
avoidRootParens: oldNode.type === newNode.type && reprint.oldPath.hasParens()
|
|
55999
55999
|
}).indentTail(oldNode.loc.indent);
|
|
@@ -56210,10 +56210,10 @@ var require_printer2 = __commonJS({
|
|
|
56210
56210
|
function makePrintFunctionWith(options, overrides) {
|
|
56211
56211
|
options = Object.assign({}, options, overrides);
|
|
56212
56212
|
return function(path2) {
|
|
56213
|
-
return
|
|
56213
|
+
return print4(path2, options);
|
|
56214
56214
|
};
|
|
56215
56215
|
}
|
|
56216
|
-
function
|
|
56216
|
+
function print4(path2, options) {
|
|
56217
56217
|
assert_1.default.ok(path2 instanceof fast_path_1.default);
|
|
56218
56218
|
options = options || {};
|
|
56219
56219
|
if (options.includeComments) {
|
|
@@ -56229,7 +56229,7 @@ var require_printer2 = __commonJS({
|
|
|
56229
56229
|
}
|
|
56230
56230
|
}
|
|
56231
56231
|
var reprinter = (0, patcher_1.getReprinter)(path2);
|
|
56232
|
-
var lines = reprinter ? reprinter(
|
|
56232
|
+
var lines = reprinter ? reprinter(print4) : genericPrint(path2, config, options, makePrintFunctionWith(options, {
|
|
56233
56233
|
includeComments: true,
|
|
56234
56234
|
avoidRootParens: false
|
|
56235
56235
|
}));
|
|
@@ -56240,7 +56240,7 @@ var require_printer2 = __commonJS({
|
|
|
56240
56240
|
if (!ast) {
|
|
56241
56241
|
return emptyPrintResult;
|
|
56242
56242
|
}
|
|
56243
|
-
var lines =
|
|
56243
|
+
var lines = print4(fast_path_1.default.from(ast), {
|
|
56244
56244
|
includeComments: true,
|
|
56245
56245
|
avoidRootParens: false
|
|
56246
56246
|
});
|
|
@@ -56293,7 +56293,7 @@ var require_printer2 = __commonJS({
|
|
|
56293
56293
|
}
|
|
56294
56294
|
return (0, lines_1.concat)(parts);
|
|
56295
56295
|
}
|
|
56296
|
-
function genericPrintNoParens(path2, options,
|
|
56296
|
+
function genericPrintNoParens(path2, options, print4) {
|
|
56297
56297
|
var n = path2.getValue();
|
|
56298
56298
|
if (!n) {
|
|
56299
56299
|
return (0, lines_1.fromString)("");
|
|
@@ -56305,45 +56305,45 @@ var require_printer2 = __commonJS({
|
|
|
56305
56305
|
var parts = [];
|
|
56306
56306
|
switch (n.type) {
|
|
56307
56307
|
case "File":
|
|
56308
|
-
return path2.call(
|
|
56308
|
+
return path2.call(print4, "program");
|
|
56309
56309
|
case "Program":
|
|
56310
56310
|
if (n.directives) {
|
|
56311
56311
|
path2.each(function(childPath) {
|
|
56312
|
-
parts.push(
|
|
56312
|
+
parts.push(print4(childPath), ";\n");
|
|
56313
56313
|
}, "directives");
|
|
56314
56314
|
}
|
|
56315
56315
|
if (n.interpreter) {
|
|
56316
|
-
parts.push(path2.call(
|
|
56316
|
+
parts.push(path2.call(print4, "interpreter"));
|
|
56317
56317
|
}
|
|
56318
56318
|
parts.push(path2.call(function(bodyPath) {
|
|
56319
|
-
return printStatementSequence(bodyPath, options,
|
|
56319
|
+
return printStatementSequence(bodyPath, options, print4);
|
|
56320
56320
|
}, "body"));
|
|
56321
56321
|
return (0, lines_1.concat)(parts);
|
|
56322
56322
|
case "Noop":
|
|
56323
56323
|
case "EmptyStatement":
|
|
56324
56324
|
return (0, lines_1.fromString)("");
|
|
56325
56325
|
case "ExpressionStatement":
|
|
56326
|
-
return (0, lines_1.concat)([path2.call(
|
|
56326
|
+
return (0, lines_1.concat)([path2.call(print4, "expression"), ";"]);
|
|
56327
56327
|
case "ParenthesizedExpression":
|
|
56328
|
-
return (0, lines_1.concat)(["(", path2.call(
|
|
56328
|
+
return (0, lines_1.concat)(["(", path2.call(print4, "expression"), ")"]);
|
|
56329
56329
|
case "BinaryExpression":
|
|
56330
56330
|
case "LogicalExpression":
|
|
56331
56331
|
case "AssignmentExpression":
|
|
56332
56332
|
return (0, lines_1.fromString)(" ").join([
|
|
56333
|
-
path2.call(
|
|
56333
|
+
path2.call(print4, "left"),
|
|
56334
56334
|
n.operator,
|
|
56335
|
-
path2.call(
|
|
56335
|
+
path2.call(print4, "right")
|
|
56336
56336
|
]);
|
|
56337
56337
|
case "AssignmentPattern":
|
|
56338
56338
|
return (0, lines_1.concat)([
|
|
56339
|
-
path2.call(
|
|
56339
|
+
path2.call(print4, "left"),
|
|
56340
56340
|
" = ",
|
|
56341
|
-
path2.call(
|
|
56341
|
+
path2.call(print4, "right")
|
|
56342
56342
|
]);
|
|
56343
56343
|
case "MemberExpression":
|
|
56344
56344
|
case "OptionalMemberExpression": {
|
|
56345
|
-
parts.push(path2.call(
|
|
56346
|
-
var property = path2.call(
|
|
56345
|
+
parts.push(path2.call(print4, "object"));
|
|
56346
|
+
var property = path2.call(print4, "property");
|
|
56347
56347
|
var optional = types4.getFieldValue(n, "optional");
|
|
56348
56348
|
if (n.computed) {
|
|
56349
56349
|
parts.push(optional ? "?.[" : "[", property, "]");
|
|
@@ -56353,18 +56353,18 @@ var require_printer2 = __commonJS({
|
|
|
56353
56353
|
return (0, lines_1.concat)(parts);
|
|
56354
56354
|
}
|
|
56355
56355
|
case "ChainExpression":
|
|
56356
|
-
return path2.call(
|
|
56356
|
+
return path2.call(print4, "expression");
|
|
56357
56357
|
case "MetaProperty":
|
|
56358
56358
|
return (0, lines_1.concat)([
|
|
56359
|
-
path2.call(
|
|
56359
|
+
path2.call(print4, "meta"),
|
|
56360
56360
|
".",
|
|
56361
|
-
path2.call(
|
|
56361
|
+
path2.call(print4, "property")
|
|
56362
56362
|
]);
|
|
56363
56363
|
case "BindExpression":
|
|
56364
56364
|
if (n.object) {
|
|
56365
|
-
parts.push(path2.call(
|
|
56365
|
+
parts.push(path2.call(print4, "object"));
|
|
56366
56366
|
}
|
|
56367
|
-
parts.push("::", path2.call(
|
|
56367
|
+
parts.push("::", path2.call(print4, "callee"));
|
|
56368
56368
|
return (0, lines_1.concat)(parts);
|
|
56369
56369
|
case "Path":
|
|
56370
56370
|
return (0, lines_1.fromString)(".").join(n.body);
|
|
@@ -56372,7 +56372,7 @@ var require_printer2 = __commonJS({
|
|
|
56372
56372
|
return (0, lines_1.concat)([
|
|
56373
56373
|
(0, lines_1.fromString)(n.name, options),
|
|
56374
56374
|
n.optional ? "?" : "",
|
|
56375
|
-
path2.call(
|
|
56375
|
+
path2.call(print4, "typeAnnotation")
|
|
56376
56376
|
]);
|
|
56377
56377
|
case "SpreadElement":
|
|
56378
56378
|
case "SpreadElementPattern":
|
|
@@ -56383,8 +56383,8 @@ var require_printer2 = __commonJS({
|
|
|
56383
56383
|
case "RestElement":
|
|
56384
56384
|
return (0, lines_1.concat)([
|
|
56385
56385
|
"...",
|
|
56386
|
-
path2.call(
|
|
56387
|
-
path2.call(
|
|
56386
|
+
path2.call(print4, "argument"),
|
|
56387
|
+
path2.call(print4, "typeAnnotation")
|
|
56388
56388
|
]);
|
|
56389
56389
|
case "FunctionDeclaration":
|
|
56390
56390
|
case "FunctionExpression":
|
|
@@ -56399,15 +56399,15 @@ var require_printer2 = __commonJS({
|
|
|
56399
56399
|
if (n.generator)
|
|
56400
56400
|
parts.push("*");
|
|
56401
56401
|
if (n.id) {
|
|
56402
|
-
parts.push(" ", path2.call(
|
|
56402
|
+
parts.push(" ", path2.call(print4, "id"), path2.call(print4, "typeParameters"));
|
|
56403
56403
|
} else {
|
|
56404
56404
|
if (n.typeParameters) {
|
|
56405
|
-
parts.push(path2.call(
|
|
56405
|
+
parts.push(path2.call(print4, "typeParameters"));
|
|
56406
56406
|
}
|
|
56407
56407
|
}
|
|
56408
|
-
parts.push("(", printFunctionParams(path2, options,
|
|
56408
|
+
parts.push("(", printFunctionParams(path2, options, print4), ")", path2.call(print4, "returnType"));
|
|
56409
56409
|
if (n.body) {
|
|
56410
|
-
parts.push(" ", path2.call(
|
|
56410
|
+
parts.push(" ", path2.call(print4, "body"));
|
|
56411
56411
|
}
|
|
56412
56412
|
return (0, lines_1.concat)(parts);
|
|
56413
56413
|
case "ArrowFunctionExpression":
|
|
@@ -56415,44 +56415,44 @@ var require_printer2 = __commonJS({
|
|
|
56415
56415
|
parts.push("async ");
|
|
56416
56416
|
}
|
|
56417
56417
|
if (n.typeParameters) {
|
|
56418
|
-
parts.push(path2.call(
|
|
56418
|
+
parts.push(path2.call(print4, "typeParameters"));
|
|
56419
56419
|
}
|
|
56420
56420
|
if (!options.arrowParensAlways && n.params.length === 1 && !n.rest && n.params[0].type === "Identifier" && !n.params[0].typeAnnotation && !n.returnType) {
|
|
56421
|
-
parts.push(path2.call(
|
|
56421
|
+
parts.push(path2.call(print4, "params", 0));
|
|
56422
56422
|
} else {
|
|
56423
|
-
parts.push("(", printFunctionParams(path2, options,
|
|
56423
|
+
parts.push("(", printFunctionParams(path2, options, print4), ")", path2.call(print4, "returnType"));
|
|
56424
56424
|
}
|
|
56425
|
-
parts.push(" => ", path2.call(
|
|
56425
|
+
parts.push(" => ", path2.call(print4, "body"));
|
|
56426
56426
|
return (0, lines_1.concat)(parts);
|
|
56427
56427
|
case "MethodDefinition":
|
|
56428
|
-
return printMethod(path2, options,
|
|
56428
|
+
return printMethod(path2, options, print4);
|
|
56429
56429
|
case "YieldExpression":
|
|
56430
56430
|
parts.push("yield");
|
|
56431
56431
|
if (n.delegate)
|
|
56432
56432
|
parts.push("*");
|
|
56433
56433
|
if (n.argument)
|
|
56434
|
-
parts.push(" ", path2.call(
|
|
56434
|
+
parts.push(" ", path2.call(print4, "argument"));
|
|
56435
56435
|
return (0, lines_1.concat)(parts);
|
|
56436
56436
|
case "AwaitExpression":
|
|
56437
56437
|
parts.push("await");
|
|
56438
56438
|
if (n.all)
|
|
56439
56439
|
parts.push("*");
|
|
56440
56440
|
if (n.argument)
|
|
56441
|
-
parts.push(" ", path2.call(
|
|
56441
|
+
parts.push(" ", path2.call(print4, "argument"));
|
|
56442
56442
|
return (0, lines_1.concat)(parts);
|
|
56443
56443
|
case "ModuleExpression":
|
|
56444
56444
|
return (0, lines_1.concat)([
|
|
56445
56445
|
"module {\n",
|
|
56446
|
-
path2.call(
|
|
56446
|
+
path2.call(print4, "body").indent(options.tabWidth),
|
|
56447
56447
|
"\n}"
|
|
56448
56448
|
]);
|
|
56449
56449
|
case "ModuleDeclaration":
|
|
56450
|
-
parts.push("module", path2.call(
|
|
56450
|
+
parts.push("module", path2.call(print4, "id"));
|
|
56451
56451
|
if (n.source) {
|
|
56452
56452
|
assert_1.default.ok(!n.body);
|
|
56453
|
-
parts.push("from", path2.call(
|
|
56453
|
+
parts.push("from", path2.call(print4, "source"));
|
|
56454
56454
|
} else {
|
|
56455
|
-
parts.push(path2.call(
|
|
56455
|
+
parts.push(path2.call(print4, "body"));
|
|
56456
56456
|
}
|
|
56457
56457
|
return (0, lines_1.fromString)(" ").join(parts);
|
|
56458
56458
|
case "ImportSpecifier":
|
|
@@ -56460,27 +56460,27 @@ var require_printer2 = __commonJS({
|
|
|
56460
56460
|
parts.push(n.importKind + " ");
|
|
56461
56461
|
}
|
|
56462
56462
|
if (n.imported) {
|
|
56463
|
-
parts.push(path2.call(
|
|
56463
|
+
parts.push(path2.call(print4, "imported"));
|
|
56464
56464
|
if (n.local && n.local.name !== n.imported.name) {
|
|
56465
|
-
parts.push(" as ", path2.call(
|
|
56465
|
+
parts.push(" as ", path2.call(print4, "local"));
|
|
56466
56466
|
}
|
|
56467
56467
|
} else if (n.id) {
|
|
56468
|
-
parts.push(path2.call(
|
|
56468
|
+
parts.push(path2.call(print4, "id"));
|
|
56469
56469
|
if (n.name) {
|
|
56470
|
-
parts.push(" as ", path2.call(
|
|
56470
|
+
parts.push(" as ", path2.call(print4, "name"));
|
|
56471
56471
|
}
|
|
56472
56472
|
}
|
|
56473
56473
|
return (0, lines_1.concat)(parts);
|
|
56474
56474
|
case "ExportSpecifier":
|
|
56475
56475
|
if (n.local) {
|
|
56476
|
-
parts.push(path2.call(
|
|
56476
|
+
parts.push(path2.call(print4, "local"));
|
|
56477
56477
|
if (n.exported && n.exported.name !== n.local.name) {
|
|
56478
|
-
parts.push(" as ", path2.call(
|
|
56478
|
+
parts.push(" as ", path2.call(print4, "exported"));
|
|
56479
56479
|
}
|
|
56480
56480
|
} else if (n.id) {
|
|
56481
|
-
parts.push(path2.call(
|
|
56481
|
+
parts.push(path2.call(print4, "id"));
|
|
56482
56482
|
if (n.name) {
|
|
56483
|
-
parts.push(" as ", path2.call(
|
|
56483
|
+
parts.push(" as ", path2.call(print4, "name"));
|
|
56484
56484
|
}
|
|
56485
56485
|
}
|
|
56486
56486
|
return (0, lines_1.concat)(parts);
|
|
@@ -56489,40 +56489,40 @@ var require_printer2 = __commonJS({
|
|
|
56489
56489
|
case "ImportNamespaceSpecifier":
|
|
56490
56490
|
parts.push("* as ");
|
|
56491
56491
|
if (n.local) {
|
|
56492
|
-
parts.push(path2.call(
|
|
56492
|
+
parts.push(path2.call(print4, "local"));
|
|
56493
56493
|
} else if (n.id) {
|
|
56494
|
-
parts.push(path2.call(
|
|
56494
|
+
parts.push(path2.call(print4, "id"));
|
|
56495
56495
|
}
|
|
56496
56496
|
return (0, lines_1.concat)(parts);
|
|
56497
56497
|
case "ImportDefaultSpecifier":
|
|
56498
56498
|
if (n.local) {
|
|
56499
|
-
return path2.call(
|
|
56499
|
+
return path2.call(print4, "local");
|
|
56500
56500
|
}
|
|
56501
|
-
return path2.call(
|
|
56501
|
+
return path2.call(print4, "id");
|
|
56502
56502
|
case "TSExportAssignment":
|
|
56503
|
-
return (0, lines_1.concat)(["export = ", path2.call(
|
|
56503
|
+
return (0, lines_1.concat)(["export = ", path2.call(print4, "expression")]);
|
|
56504
56504
|
case "ExportDeclaration":
|
|
56505
56505
|
case "ExportDefaultDeclaration":
|
|
56506
56506
|
case "ExportNamedDeclaration":
|
|
56507
|
-
return printExportDeclaration(path2, options,
|
|
56507
|
+
return printExportDeclaration(path2, options, print4);
|
|
56508
56508
|
case "ExportAllDeclaration":
|
|
56509
56509
|
parts.push("export *");
|
|
56510
56510
|
if (n.exported) {
|
|
56511
|
-
parts.push(" as ", path2.call(
|
|
56511
|
+
parts.push(" as ", path2.call(print4, "exported"));
|
|
56512
56512
|
}
|
|
56513
|
-
parts.push(" from ", path2.call(
|
|
56513
|
+
parts.push(" from ", path2.call(print4, "source"), ";");
|
|
56514
56514
|
return (0, lines_1.concat)(parts);
|
|
56515
56515
|
case "TSNamespaceExportDeclaration":
|
|
56516
|
-
parts.push("export as namespace ", path2.call(
|
|
56516
|
+
parts.push("export as namespace ", path2.call(print4, "id"));
|
|
56517
56517
|
return maybeAddSemicolon((0, lines_1.concat)(parts));
|
|
56518
56518
|
case "ExportNamespaceSpecifier":
|
|
56519
|
-
return (0, lines_1.concat)(["* as ", path2.call(
|
|
56519
|
+
return (0, lines_1.concat)(["* as ", path2.call(print4, "exported")]);
|
|
56520
56520
|
case "ExportDefaultSpecifier":
|
|
56521
|
-
return path2.call(
|
|
56521
|
+
return path2.call(print4, "exported");
|
|
56522
56522
|
case "Import":
|
|
56523
56523
|
return (0, lines_1.fromString)("import", options);
|
|
56524
56524
|
case "ImportExpression":
|
|
56525
|
-
return (0, lines_1.concat)(["import(", path2.call(
|
|
56525
|
+
return (0, lines_1.concat)(["import(", path2.call(print4, "source"), ")"]);
|
|
56526
56526
|
case "ImportDeclaration": {
|
|
56527
56527
|
parts.push("import ");
|
|
56528
56528
|
if (n.importKind && n.importKind !== "value") {
|
|
@@ -56534,9 +56534,9 @@ var require_printer2 = __commonJS({
|
|
|
56534
56534
|
path2.each(function(specifierPath) {
|
|
56535
56535
|
var spec = specifierPath.getValue();
|
|
56536
56536
|
if (spec.type === "ImportSpecifier") {
|
|
56537
|
-
bracedSpecifiers_1.push(
|
|
56537
|
+
bracedSpecifiers_1.push(print4(specifierPath));
|
|
56538
56538
|
} else if (spec.type === "ImportDefaultSpecifier" || spec.type === "ImportNamespaceSpecifier") {
|
|
56539
|
-
unbracedSpecifiers_1.push(
|
|
56539
|
+
unbracedSpecifiers_1.push(print4(specifierPath));
|
|
56540
56540
|
}
|
|
56541
56541
|
}, "specifiers");
|
|
56542
56542
|
unbracedSpecifiers_1.forEach(function(lines2, i2) {
|
|
@@ -56566,16 +56566,16 @@ var require_printer2 = __commonJS({
|
|
|
56566
56566
|
}
|
|
56567
56567
|
parts.push(" from ");
|
|
56568
56568
|
}
|
|
56569
|
-
parts.push(path2.call(
|
|
56569
|
+
parts.push(path2.call(print4, "source"), maybePrintImportAssertions(path2, options, print4), ";");
|
|
56570
56570
|
return (0, lines_1.concat)(parts);
|
|
56571
56571
|
}
|
|
56572
56572
|
case "ImportAttribute":
|
|
56573
|
-
return (0, lines_1.concat)([path2.call(
|
|
56573
|
+
return (0, lines_1.concat)([path2.call(print4, "key"), ": ", path2.call(print4, "value")]);
|
|
56574
56574
|
case "StaticBlock":
|
|
56575
56575
|
parts.push("static ");
|
|
56576
56576
|
case "BlockStatement": {
|
|
56577
56577
|
var naked_1 = path2.call(function(bodyPath) {
|
|
56578
|
-
return printStatementSequence(bodyPath, options,
|
|
56578
|
+
return printStatementSequence(bodyPath, options, print4);
|
|
56579
56579
|
}, "body");
|
|
56580
56580
|
if (naked_1.isEmpty()) {
|
|
56581
56581
|
if (!n.directives || n.directives.length === 0) {
|
|
@@ -56586,7 +56586,7 @@ var require_printer2 = __commonJS({
|
|
|
56586
56586
|
parts.push("{\n");
|
|
56587
56587
|
if (n.directives) {
|
|
56588
56588
|
path2.each(function(childPath) {
|
|
56589
|
-
parts.push(maybeAddSemicolon(
|
|
56589
|
+
parts.push(maybeAddSemicolon(print4(childPath).indent(options.tabWidth)), n.directives.length > 1 || !naked_1.isEmpty() ? "\n" : "");
|
|
56590
56590
|
}, "directives");
|
|
56591
56591
|
}
|
|
56592
56592
|
parts.push(naked_1.indent(options.tabWidth));
|
|
@@ -56596,7 +56596,7 @@ var require_printer2 = __commonJS({
|
|
|
56596
56596
|
case "ReturnStatement": {
|
|
56597
56597
|
parts.push("return");
|
|
56598
56598
|
if (n.argument) {
|
|
56599
|
-
var argLines = path2.call(
|
|
56599
|
+
var argLines = path2.call(print4, "argument");
|
|
56600
56600
|
if (argLines.startsWithComment() || argLines.length > 1 && namedTypes.JSXElement && namedTypes.JSXElement.check(n.argument)) {
|
|
56601
56601
|
parts.push(" (\n", argLines.indent(options.tabWidth), "\n)");
|
|
56602
56602
|
} else {
|
|
@@ -56608,17 +56608,17 @@ var require_printer2 = __commonJS({
|
|
|
56608
56608
|
}
|
|
56609
56609
|
case "CallExpression":
|
|
56610
56610
|
case "OptionalCallExpression":
|
|
56611
|
-
parts.push(path2.call(
|
|
56611
|
+
parts.push(path2.call(print4, "callee"));
|
|
56612
56612
|
if (n.typeParameters) {
|
|
56613
|
-
parts.push(path2.call(
|
|
56613
|
+
parts.push(path2.call(print4, "typeParameters"));
|
|
56614
56614
|
}
|
|
56615
56615
|
if (n.typeArguments) {
|
|
56616
|
-
parts.push(path2.call(
|
|
56616
|
+
parts.push(path2.call(print4, "typeArguments"));
|
|
56617
56617
|
}
|
|
56618
56618
|
if (types4.getFieldValue(n, "optional")) {
|
|
56619
56619
|
parts.push("?.");
|
|
56620
56620
|
}
|
|
56621
|
-
parts.push(printArgumentsList(path2, options,
|
|
56621
|
+
parts.push(printArgumentsList(path2, options, print4));
|
|
56622
56622
|
return (0, lines_1.concat)(parts);
|
|
56623
56623
|
case "RecordExpression":
|
|
56624
56624
|
parts.push("#");
|
|
@@ -56648,7 +56648,7 @@ var require_printer2 = __commonJS({
|
|
|
56648
56648
|
var i_1 = 0;
|
|
56649
56649
|
fields.forEach(function(field) {
|
|
56650
56650
|
path2.each(function(childPath) {
|
|
56651
|
-
var lines2 =
|
|
56651
|
+
var lines2 = print4(childPath);
|
|
56652
56652
|
if (!oneLine_1) {
|
|
56653
56653
|
lines2 = lines2.indent(options.tabWidth);
|
|
56654
56654
|
}
|
|
@@ -56685,32 +56685,32 @@ var require_printer2 = __commonJS({
|
|
|
56685
56685
|
parts[parts.length - 1] = " " + rightBrace;
|
|
56686
56686
|
}
|
|
56687
56687
|
if (n.typeAnnotation) {
|
|
56688
|
-
parts.push(path2.call(
|
|
56688
|
+
parts.push(path2.call(print4, "typeAnnotation"));
|
|
56689
56689
|
}
|
|
56690
56690
|
return (0, lines_1.concat)(parts);
|
|
56691
56691
|
}
|
|
56692
56692
|
case "PropertyPattern":
|
|
56693
56693
|
return (0, lines_1.concat)([
|
|
56694
|
-
path2.call(
|
|
56694
|
+
path2.call(print4, "key"),
|
|
56695
56695
|
": ",
|
|
56696
|
-
path2.call(
|
|
56696
|
+
path2.call(print4, "pattern")
|
|
56697
56697
|
]);
|
|
56698
56698
|
case "ObjectProperty":
|
|
56699
56699
|
case "Property": {
|
|
56700
56700
|
if (n.method || n.kind === "get" || n.kind === "set") {
|
|
56701
|
-
return printMethod(path2, options,
|
|
56701
|
+
return printMethod(path2, options, print4);
|
|
56702
56702
|
}
|
|
56703
56703
|
if (n.shorthand && n.value.type === "AssignmentPattern") {
|
|
56704
|
-
return path2.call(
|
|
56704
|
+
return path2.call(print4, "value");
|
|
56705
56705
|
}
|
|
56706
|
-
var key = path2.call(
|
|
56706
|
+
var key = path2.call(print4, "key");
|
|
56707
56707
|
if (n.computed) {
|
|
56708
56708
|
parts.push("[", key, "]");
|
|
56709
56709
|
} else {
|
|
56710
56710
|
parts.push(key);
|
|
56711
56711
|
}
|
|
56712
56712
|
if (!n.shorthand || n.key.name !== n.value.name) {
|
|
56713
|
-
parts.push(": ", path2.call(
|
|
56713
|
+
parts.push(": ", path2.call(print4, "value"));
|
|
56714
56714
|
}
|
|
56715
56715
|
return (0, lines_1.concat)(parts);
|
|
56716
56716
|
}
|
|
@@ -56718,18 +56718,18 @@ var require_printer2 = __commonJS({
|
|
|
56718
56718
|
case "ObjectMethod":
|
|
56719
56719
|
case "ClassPrivateMethod":
|
|
56720
56720
|
case "TSDeclareMethod":
|
|
56721
|
-
return printMethod(path2, options,
|
|
56721
|
+
return printMethod(path2, options, print4);
|
|
56722
56722
|
case "PrivateName":
|
|
56723
|
-
return (0, lines_1.concat)(["#", path2.call(
|
|
56723
|
+
return (0, lines_1.concat)(["#", path2.call(print4, "id")]);
|
|
56724
56724
|
case "Decorator":
|
|
56725
|
-
return (0, lines_1.concat)(["@", path2.call(
|
|
56725
|
+
return (0, lines_1.concat)(["@", path2.call(print4, "expression")]);
|
|
56726
56726
|
case "TupleExpression":
|
|
56727
56727
|
parts.push("#");
|
|
56728
56728
|
case "ArrayExpression":
|
|
56729
56729
|
case "ArrayPattern": {
|
|
56730
56730
|
var elems = n.elements;
|
|
56731
56731
|
var len_2 = elems.length;
|
|
56732
|
-
var printed_1 = path2.map(
|
|
56732
|
+
var printed_1 = path2.map(print4, "elements");
|
|
56733
56733
|
var joined = (0, lines_1.fromString)(", ").join(printed_1);
|
|
56734
56734
|
var oneLine_2 = joined.getLineLength(1) <= options.wrapColumn;
|
|
56735
56735
|
if (oneLine_2) {
|
|
@@ -56767,12 +56767,12 @@ var require_printer2 = __commonJS({
|
|
|
56767
56767
|
parts.push("]");
|
|
56768
56768
|
}
|
|
56769
56769
|
if (n.typeAnnotation) {
|
|
56770
|
-
parts.push(path2.call(
|
|
56770
|
+
parts.push(path2.call(print4, "typeAnnotation"));
|
|
56771
56771
|
}
|
|
56772
56772
|
return (0, lines_1.concat)(parts);
|
|
56773
56773
|
}
|
|
56774
56774
|
case "SequenceExpression":
|
|
56775
|
-
return (0, lines_1.fromString)(", ").join(path2.map(
|
|
56775
|
+
return (0, lines_1.fromString)(", ").join(path2.map(print4, "expressions"));
|
|
56776
56776
|
case "ThisExpression":
|
|
56777
56777
|
return (0, lines_1.fromString)("this");
|
|
56778
56778
|
case "Super":
|
|
@@ -56793,7 +56793,7 @@ var require_printer2 = __commonJS({
|
|
|
56793
56793
|
case "Literal":
|
|
56794
56794
|
return (0, lines_1.fromString)(getPossibleRaw(n) || (typeof n.value === "string" ? nodeStr(n.value, options) : n.value), options);
|
|
56795
56795
|
case "Directive":
|
|
56796
|
-
return path2.call(
|
|
56796
|
+
return path2.call(print4, "value");
|
|
56797
56797
|
case "DirectiveLiteral":
|
|
56798
56798
|
return (0, lines_1.fromString)(getPossibleRaw(n) || nodeStr(n.value, options), options);
|
|
56799
56799
|
case "InterpreterDirective":
|
|
@@ -56807,32 +56807,32 @@ var require_printer2 = __commonJS({
|
|
|
56807
56807
|
parts.push(n.operator);
|
|
56808
56808
|
if (/[a-z]$/.test(n.operator))
|
|
56809
56809
|
parts.push(" ");
|
|
56810
|
-
parts.push(path2.call(
|
|
56810
|
+
parts.push(path2.call(print4, "argument"));
|
|
56811
56811
|
return (0, lines_1.concat)(parts);
|
|
56812
56812
|
case "UpdateExpression":
|
|
56813
|
-
parts.push(path2.call(
|
|
56813
|
+
parts.push(path2.call(print4, "argument"), n.operator);
|
|
56814
56814
|
if (n.prefix)
|
|
56815
56815
|
parts.reverse();
|
|
56816
56816
|
return (0, lines_1.concat)(parts);
|
|
56817
56817
|
case "ConditionalExpression":
|
|
56818
56818
|
return (0, lines_1.concat)([
|
|
56819
|
-
path2.call(
|
|
56819
|
+
path2.call(print4, "test"),
|
|
56820
56820
|
" ? ",
|
|
56821
|
-
path2.call(
|
|
56821
|
+
path2.call(print4, "consequent"),
|
|
56822
56822
|
" : ",
|
|
56823
|
-
path2.call(
|
|
56823
|
+
path2.call(print4, "alternate")
|
|
56824
56824
|
]);
|
|
56825
56825
|
case "NewExpression": {
|
|
56826
|
-
parts.push("new ", path2.call(
|
|
56826
|
+
parts.push("new ", path2.call(print4, "callee"));
|
|
56827
56827
|
if (n.typeParameters) {
|
|
56828
|
-
parts.push(path2.call(
|
|
56828
|
+
parts.push(path2.call(print4, "typeParameters"));
|
|
56829
56829
|
}
|
|
56830
56830
|
if (n.typeArguments) {
|
|
56831
|
-
parts.push(path2.call(
|
|
56831
|
+
parts.push(path2.call(print4, "typeArguments"));
|
|
56832
56832
|
}
|
|
56833
56833
|
var args = n.arguments;
|
|
56834
56834
|
if (args) {
|
|
56835
|
-
parts.push(printArgumentsList(path2, options,
|
|
56835
|
+
parts.push(printArgumentsList(path2, options, print4));
|
|
56836
56836
|
}
|
|
56837
56837
|
return (0, lines_1.concat)(parts);
|
|
56838
56838
|
}
|
|
@@ -56843,7 +56843,7 @@ var require_printer2 = __commonJS({
|
|
|
56843
56843
|
parts.push(n.kind, " ");
|
|
56844
56844
|
var maxLen_1 = 0;
|
|
56845
56845
|
var printed = path2.map(function(childPath) {
|
|
56846
|
-
var lines2 =
|
|
56846
|
+
var lines2 = print4(childPath);
|
|
56847
56847
|
maxLen_1 = Math.max(lines2.length, maxLen_1);
|
|
56848
56848
|
return lines2;
|
|
56849
56849
|
}, "declarations");
|
|
@@ -56862,30 +56862,30 @@ var require_printer2 = __commonJS({
|
|
|
56862
56862
|
}
|
|
56863
56863
|
case "VariableDeclarator":
|
|
56864
56864
|
return n.init ? (0, lines_1.fromString)(" = ").join([
|
|
56865
|
-
path2.call(
|
|
56866
|
-
path2.call(
|
|
56867
|
-
]) : path2.call(
|
|
56865
|
+
path2.call(print4, "id"),
|
|
56866
|
+
path2.call(print4, "init")
|
|
56867
|
+
]) : path2.call(print4, "id");
|
|
56868
56868
|
case "WithStatement":
|
|
56869
56869
|
return (0, lines_1.concat)([
|
|
56870
56870
|
"with (",
|
|
56871
|
-
path2.call(
|
|
56871
|
+
path2.call(print4, "object"),
|
|
56872
56872
|
") ",
|
|
56873
|
-
path2.call(
|
|
56873
|
+
path2.call(print4, "body")
|
|
56874
56874
|
]);
|
|
56875
56875
|
case "IfStatement": {
|
|
56876
|
-
var con = adjustClause(path2.call(
|
|
56877
|
-
parts.push("if (", path2.call(
|
|
56876
|
+
var con = adjustClause(path2.call(print4, "consequent"), options);
|
|
56877
|
+
parts.push("if (", path2.call(print4, "test"), ")", con);
|
|
56878
56878
|
if (n.alternate)
|
|
56879
|
-
parts.push(endsWithBrace(con) ? " else" : "\nelse", adjustClause(path2.call(
|
|
56879
|
+
parts.push(endsWithBrace(con) ? " else" : "\nelse", adjustClause(path2.call(print4, "alternate"), options));
|
|
56880
56880
|
return (0, lines_1.concat)(parts);
|
|
56881
56881
|
}
|
|
56882
56882
|
case "ForStatement": {
|
|
56883
|
-
var init = path2.call(
|
|
56883
|
+
var init = path2.call(print4, "init");
|
|
56884
56884
|
var sep2 = init.length > 1 ? ";\n" : "; ";
|
|
56885
56885
|
var forParen = "for (";
|
|
56886
|
-
var indented = (0, lines_1.fromString)(sep2).join([init, path2.call(
|
|
56886
|
+
var indented = (0, lines_1.fromString)(sep2).join([init, path2.call(print4, "test"), path2.call(print4, "update")]).indentTail(forParen.length);
|
|
56887
56887
|
var head = (0, lines_1.concat)([forParen, indented, ")"]);
|
|
56888
|
-
var clause = adjustClause(path2.call(
|
|
56888
|
+
var clause = adjustClause(path2.call(print4, "body"), options);
|
|
56889
56889
|
parts.push(head);
|
|
56890
56890
|
if (head.length > 1) {
|
|
56891
56891
|
parts.push("\n");
|
|
@@ -56897,18 +56897,18 @@ var require_printer2 = __commonJS({
|
|
|
56897
56897
|
case "WhileStatement":
|
|
56898
56898
|
return (0, lines_1.concat)([
|
|
56899
56899
|
"while (",
|
|
56900
|
-
path2.call(
|
|
56900
|
+
path2.call(print4, "test"),
|
|
56901
56901
|
")",
|
|
56902
|
-
adjustClause(path2.call(
|
|
56902
|
+
adjustClause(path2.call(print4, "body"), options)
|
|
56903
56903
|
]);
|
|
56904
56904
|
case "ForInStatement":
|
|
56905
56905
|
return (0, lines_1.concat)([
|
|
56906
56906
|
n.each ? "for each (" : "for (",
|
|
56907
|
-
path2.call(
|
|
56907
|
+
path2.call(print4, "left"),
|
|
56908
56908
|
" in ",
|
|
56909
|
-
path2.call(
|
|
56909
|
+
path2.call(print4, "right"),
|
|
56910
56910
|
")",
|
|
56911
|
-
adjustClause(path2.call(
|
|
56911
|
+
adjustClause(path2.call(print4, "body"), options)
|
|
56912
56912
|
]);
|
|
56913
56913
|
case "ForOfStatement":
|
|
56914
56914
|
case "ForAwaitStatement":
|
|
@@ -56916,122 +56916,122 @@ var require_printer2 = __commonJS({
|
|
|
56916
56916
|
if (n.await || n.type === "ForAwaitStatement") {
|
|
56917
56917
|
parts.push("await ");
|
|
56918
56918
|
}
|
|
56919
|
-
parts.push("(", path2.call(
|
|
56919
|
+
parts.push("(", path2.call(print4, "left"), " of ", path2.call(print4, "right"), ")", adjustClause(path2.call(print4, "body"), options));
|
|
56920
56920
|
return (0, lines_1.concat)(parts);
|
|
56921
56921
|
case "DoWhileStatement": {
|
|
56922
56922
|
var doBody = (0, lines_1.concat)([
|
|
56923
56923
|
"do",
|
|
56924
|
-
adjustClause(path2.call(
|
|
56924
|
+
adjustClause(path2.call(print4, "body"), options)
|
|
56925
56925
|
]);
|
|
56926
56926
|
parts.push(doBody);
|
|
56927
56927
|
if (endsWithBrace(doBody))
|
|
56928
56928
|
parts.push(" while");
|
|
56929
56929
|
else
|
|
56930
56930
|
parts.push("\nwhile");
|
|
56931
|
-
parts.push(" (", path2.call(
|
|
56931
|
+
parts.push(" (", path2.call(print4, "test"), ");");
|
|
56932
56932
|
return (0, lines_1.concat)(parts);
|
|
56933
56933
|
}
|
|
56934
56934
|
case "DoExpression": {
|
|
56935
56935
|
var statements = path2.call(function(bodyPath) {
|
|
56936
|
-
return printStatementSequence(bodyPath, options,
|
|
56936
|
+
return printStatementSequence(bodyPath, options, print4);
|
|
56937
56937
|
}, "body");
|
|
56938
56938
|
return (0, lines_1.concat)(["do {\n", statements.indent(options.tabWidth), "\n}"]);
|
|
56939
56939
|
}
|
|
56940
56940
|
case "BreakStatement":
|
|
56941
56941
|
parts.push("break");
|
|
56942
56942
|
if (n.label)
|
|
56943
|
-
parts.push(" ", path2.call(
|
|
56943
|
+
parts.push(" ", path2.call(print4, "label"));
|
|
56944
56944
|
parts.push(";");
|
|
56945
56945
|
return (0, lines_1.concat)(parts);
|
|
56946
56946
|
case "ContinueStatement":
|
|
56947
56947
|
parts.push("continue");
|
|
56948
56948
|
if (n.label)
|
|
56949
|
-
parts.push(" ", path2.call(
|
|
56949
|
+
parts.push(" ", path2.call(print4, "label"));
|
|
56950
56950
|
parts.push(";");
|
|
56951
56951
|
return (0, lines_1.concat)(parts);
|
|
56952
56952
|
case "LabeledStatement":
|
|
56953
56953
|
return (0, lines_1.concat)([
|
|
56954
|
-
path2.call(
|
|
56954
|
+
path2.call(print4, "label"),
|
|
56955
56955
|
":\n",
|
|
56956
|
-
path2.call(
|
|
56956
|
+
path2.call(print4, "body")
|
|
56957
56957
|
]);
|
|
56958
56958
|
case "TryStatement":
|
|
56959
|
-
parts.push("try ", path2.call(
|
|
56959
|
+
parts.push("try ", path2.call(print4, "block"));
|
|
56960
56960
|
if (n.handler) {
|
|
56961
|
-
parts.push(" ", path2.call(
|
|
56961
|
+
parts.push(" ", path2.call(print4, "handler"));
|
|
56962
56962
|
} else if (n.handlers) {
|
|
56963
56963
|
path2.each(function(handlerPath) {
|
|
56964
|
-
parts.push(" ",
|
|
56964
|
+
parts.push(" ", print4(handlerPath));
|
|
56965
56965
|
}, "handlers");
|
|
56966
56966
|
}
|
|
56967
56967
|
if (n.finalizer) {
|
|
56968
|
-
parts.push(" finally ", path2.call(
|
|
56968
|
+
parts.push(" finally ", path2.call(print4, "finalizer"));
|
|
56969
56969
|
}
|
|
56970
56970
|
return (0, lines_1.concat)(parts);
|
|
56971
56971
|
case "CatchClause":
|
|
56972
56972
|
parts.push("catch ");
|
|
56973
56973
|
if (n.param) {
|
|
56974
|
-
parts.push("(", path2.call(
|
|
56974
|
+
parts.push("(", path2.call(print4, "param"));
|
|
56975
56975
|
}
|
|
56976
56976
|
if (n.guard) {
|
|
56977
|
-
parts.push(" if ", path2.call(
|
|
56977
|
+
parts.push(" if ", path2.call(print4, "guard"));
|
|
56978
56978
|
}
|
|
56979
56979
|
if (n.param) {
|
|
56980
56980
|
parts.push(") ");
|
|
56981
56981
|
}
|
|
56982
|
-
parts.push(path2.call(
|
|
56982
|
+
parts.push(path2.call(print4, "body"));
|
|
56983
56983
|
return (0, lines_1.concat)(parts);
|
|
56984
56984
|
case "ThrowStatement":
|
|
56985
|
-
return (0, lines_1.concat)(["throw ", path2.call(
|
|
56985
|
+
return (0, lines_1.concat)(["throw ", path2.call(print4, "argument"), ";"]);
|
|
56986
56986
|
case "SwitchStatement":
|
|
56987
56987
|
return (0, lines_1.concat)([
|
|
56988
56988
|
"switch (",
|
|
56989
|
-
path2.call(
|
|
56989
|
+
path2.call(print4, "discriminant"),
|
|
56990
56990
|
") {\n",
|
|
56991
|
-
(0, lines_1.fromString)("\n").join(path2.map(
|
|
56991
|
+
(0, lines_1.fromString)("\n").join(path2.map(print4, "cases")),
|
|
56992
56992
|
"\n}"
|
|
56993
56993
|
]);
|
|
56994
56994
|
case "SwitchCase":
|
|
56995
56995
|
if (n.test)
|
|
56996
|
-
parts.push("case ", path2.call(
|
|
56996
|
+
parts.push("case ", path2.call(print4, "test"), ":");
|
|
56997
56997
|
else
|
|
56998
56998
|
parts.push("default:");
|
|
56999
56999
|
if (n.consequent.length > 0) {
|
|
57000
57000
|
parts.push("\n", path2.call(function(consequentPath) {
|
|
57001
|
-
return printStatementSequence(consequentPath, options,
|
|
57001
|
+
return printStatementSequence(consequentPath, options, print4);
|
|
57002
57002
|
}, "consequent").indent(options.tabWidth));
|
|
57003
57003
|
}
|
|
57004
57004
|
return (0, lines_1.concat)(parts);
|
|
57005
57005
|
case "DebuggerStatement":
|
|
57006
57006
|
return (0, lines_1.fromString)("debugger;");
|
|
57007
57007
|
case "JSXAttribute":
|
|
57008
|
-
parts.push(path2.call(
|
|
57008
|
+
parts.push(path2.call(print4, "name"));
|
|
57009
57009
|
if (n.value)
|
|
57010
|
-
parts.push("=", path2.call(
|
|
57010
|
+
parts.push("=", path2.call(print4, "value"));
|
|
57011
57011
|
return (0, lines_1.concat)(parts);
|
|
57012
57012
|
case "JSXIdentifier":
|
|
57013
57013
|
return (0, lines_1.fromString)(n.name, options);
|
|
57014
57014
|
case "JSXNamespacedName":
|
|
57015
57015
|
return (0, lines_1.fromString)(":").join([
|
|
57016
|
-
path2.call(
|
|
57017
|
-
path2.call(
|
|
57016
|
+
path2.call(print4, "namespace"),
|
|
57017
|
+
path2.call(print4, "name")
|
|
57018
57018
|
]);
|
|
57019
57019
|
case "JSXMemberExpression":
|
|
57020
57020
|
return (0, lines_1.fromString)(".").join([
|
|
57021
|
-
path2.call(
|
|
57022
|
-
path2.call(
|
|
57021
|
+
path2.call(print4, "object"),
|
|
57022
|
+
path2.call(print4, "property")
|
|
57023
57023
|
]);
|
|
57024
57024
|
case "JSXSpreadAttribute":
|
|
57025
|
-
return (0, lines_1.concat)(["{...", path2.call(
|
|
57025
|
+
return (0, lines_1.concat)(["{...", path2.call(print4, "argument"), "}"]);
|
|
57026
57026
|
case "JSXSpreadChild":
|
|
57027
|
-
return (0, lines_1.concat)(["{...", path2.call(
|
|
57027
|
+
return (0, lines_1.concat)(["{...", path2.call(print4, "expression"), "}"]);
|
|
57028
57028
|
case "JSXExpressionContainer":
|
|
57029
|
-
return (0, lines_1.concat)(["{", path2.call(
|
|
57029
|
+
return (0, lines_1.concat)(["{", path2.call(print4, "expression"), "}"]);
|
|
57030
57030
|
case "JSXElement":
|
|
57031
57031
|
case "JSXFragment": {
|
|
57032
57032
|
var openingPropName = "opening" + (n.type === "JSXElement" ? "Element" : "Fragment");
|
|
57033
57033
|
var closingPropName = "closing" + (n.type === "JSXElement" ? "Element" : "Fragment");
|
|
57034
|
-
var openingLines = path2.call(
|
|
57034
|
+
var openingLines = path2.call(print4, openingPropName);
|
|
57035
57035
|
if (n[openingPropName].selfClosing) {
|
|
57036
57036
|
assert_1.default.ok(!n[closingPropName], "unexpected " + closingPropName + " element in self-closing " + n.type);
|
|
57037
57037
|
return openingLines;
|
|
@@ -57045,16 +57045,16 @@ var require_printer2 = __commonJS({
|
|
|
57045
57045
|
return "\n";
|
|
57046
57046
|
}
|
|
57047
57047
|
}
|
|
57048
|
-
return
|
|
57048
|
+
return print4(childPath);
|
|
57049
57049
|
}, "children")).indentTail(options.tabWidth);
|
|
57050
|
-
var closingLines = path2.call(
|
|
57050
|
+
var closingLines = path2.call(print4, closingPropName);
|
|
57051
57051
|
return (0, lines_1.concat)([openingLines, childLines, closingLines]);
|
|
57052
57052
|
}
|
|
57053
57053
|
case "JSXOpeningElement": {
|
|
57054
|
-
parts.push("<", path2.call(
|
|
57054
|
+
parts.push("<", path2.call(print4, "name"));
|
|
57055
57055
|
var attrParts_1 = [];
|
|
57056
57056
|
path2.each(function(attrPath) {
|
|
57057
|
-
attrParts_1.push(" ",
|
|
57057
|
+
attrParts_1.push(" ", print4(attrPath));
|
|
57058
57058
|
}, "attributes");
|
|
57059
57059
|
var attrLines = (0, lines_1.concat)(attrParts_1);
|
|
57060
57060
|
var needLineWrap = attrLines.length > 1 || attrLines.getLineLength(1) > options.wrapColumn;
|
|
@@ -57071,7 +57071,7 @@ var require_printer2 = __commonJS({
|
|
|
57071
57071
|
return (0, lines_1.concat)(parts);
|
|
57072
57072
|
}
|
|
57073
57073
|
case "JSXClosingElement":
|
|
57074
|
-
return (0, lines_1.concat)(["</", path2.call(
|
|
57074
|
+
return (0, lines_1.concat)(["</", path2.call(print4, "name"), ">"]);
|
|
57075
57075
|
case "JSXOpeningFragment":
|
|
57076
57076
|
return (0, lines_1.fromString)("<>");
|
|
57077
57077
|
case "JSXClosingFragment":
|
|
@@ -57082,9 +57082,9 @@ var require_printer2 = __commonJS({
|
|
|
57082
57082
|
return (0, lines_1.fromString)("");
|
|
57083
57083
|
case "TypeAnnotatedIdentifier":
|
|
57084
57084
|
return (0, lines_1.concat)([
|
|
57085
|
-
path2.call(
|
|
57085
|
+
path2.call(print4, "annotation"),
|
|
57086
57086
|
" ",
|
|
57087
|
-
path2.call(
|
|
57087
|
+
path2.call(print4, "identifier")
|
|
57088
57088
|
]);
|
|
57089
57089
|
case "ClassBody":
|
|
57090
57090
|
if (n.body.length === 0) {
|
|
@@ -57093,12 +57093,12 @@ var require_printer2 = __commonJS({
|
|
|
57093
57093
|
return (0, lines_1.concat)([
|
|
57094
57094
|
"{\n",
|
|
57095
57095
|
path2.call(function(bodyPath) {
|
|
57096
|
-
return printStatementSequence(bodyPath, options,
|
|
57096
|
+
return printStatementSequence(bodyPath, options, print4);
|
|
57097
57097
|
}, "body").indent(options.tabWidth),
|
|
57098
57098
|
"\n}"
|
|
57099
57099
|
]);
|
|
57100
57100
|
case "ClassPropertyDefinition":
|
|
57101
|
-
parts.push("static ", path2.call(
|
|
57101
|
+
parts.push("static ", path2.call(print4, "definition"));
|
|
57102
57102
|
if (!namedTypes.MethodDefinition.check(n.definition))
|
|
57103
57103
|
parts.push(";");
|
|
57104
57104
|
return (0, lines_1.concat)(parts);
|
|
@@ -57119,12 +57119,12 @@ var require_printer2 = __commonJS({
|
|
|
57119
57119
|
if (n.readonly) {
|
|
57120
57120
|
parts.push("readonly ");
|
|
57121
57121
|
}
|
|
57122
|
-
var key = path2.call(
|
|
57122
|
+
var key = path2.call(print4, "key");
|
|
57123
57123
|
if (n.computed) {
|
|
57124
57124
|
key = (0, lines_1.concat)(["[", key, "]"]);
|
|
57125
57125
|
}
|
|
57126
57126
|
if (n.variance) {
|
|
57127
|
-
key = (0, lines_1.concat)([printVariance(path2,
|
|
57127
|
+
key = (0, lines_1.concat)([printVariance(path2, print4), key]);
|
|
57128
57128
|
}
|
|
57129
57129
|
parts.push(key);
|
|
57130
57130
|
if (n.optional) {
|
|
@@ -57134,10 +57134,10 @@ var require_printer2 = __commonJS({
|
|
|
57134
57134
|
parts.push("!");
|
|
57135
57135
|
}
|
|
57136
57136
|
if (n.typeAnnotation) {
|
|
57137
|
-
parts.push(path2.call(
|
|
57137
|
+
parts.push(path2.call(print4, "typeAnnotation"));
|
|
57138
57138
|
}
|
|
57139
57139
|
if (n.value) {
|
|
57140
|
-
parts.push(" = ", path2.call(
|
|
57140
|
+
parts.push(" = ", path2.call(print4, "value"));
|
|
57141
57141
|
}
|
|
57142
57142
|
parts.push(";");
|
|
57143
57143
|
return (0, lines_1.concat)(parts);
|
|
@@ -57146,21 +57146,21 @@ var require_printer2 = __commonJS({
|
|
|
57146
57146
|
if (n.static) {
|
|
57147
57147
|
parts.push("static ");
|
|
57148
57148
|
}
|
|
57149
|
-
parts.push(path2.call(
|
|
57149
|
+
parts.push(path2.call(print4, "key"));
|
|
57150
57150
|
if (n.typeAnnotation) {
|
|
57151
|
-
parts.push(path2.call(
|
|
57151
|
+
parts.push(path2.call(print4, "typeAnnotation"));
|
|
57152
57152
|
}
|
|
57153
57153
|
if (n.value) {
|
|
57154
|
-
parts.push(" = ", path2.call(
|
|
57154
|
+
parts.push(" = ", path2.call(print4, "value"));
|
|
57155
57155
|
}
|
|
57156
57156
|
parts.push(";");
|
|
57157
57157
|
return (0, lines_1.concat)(parts);
|
|
57158
57158
|
case "ClassAccessorProperty": {
|
|
57159
57159
|
parts.push.apply(parts, tslib_1.__spreadArray(tslib_1.__spreadArray([], printClassMemberModifiers(n), false), ["accessor "], false));
|
|
57160
57160
|
if (n.computed) {
|
|
57161
|
-
parts.push("[", path2.call(
|
|
57161
|
+
parts.push("[", path2.call(print4, "key"), "]");
|
|
57162
57162
|
} else {
|
|
57163
|
-
parts.push(path2.call(
|
|
57163
|
+
parts.push(path2.call(print4, "key"));
|
|
57164
57164
|
}
|
|
57165
57165
|
if (n.optional) {
|
|
57166
57166
|
parts.push("?");
|
|
@@ -57169,10 +57169,10 @@ var require_printer2 = __commonJS({
|
|
|
57169
57169
|
parts.push("!");
|
|
57170
57170
|
}
|
|
57171
57171
|
if (n.typeAnnotation) {
|
|
57172
|
-
parts.push(path2.call(
|
|
57172
|
+
parts.push(path2.call(print4, "typeAnnotation"));
|
|
57173
57173
|
}
|
|
57174
57174
|
if (n.value) {
|
|
57175
|
-
parts.push(" = ", path2.call(
|
|
57175
|
+
parts.push(" = ", path2.call(print4, "value"));
|
|
57176
57176
|
}
|
|
57177
57177
|
parts.push(";");
|
|
57178
57178
|
return (0, lines_1.concat)(parts);
|
|
@@ -57188,21 +57188,21 @@ var require_printer2 = __commonJS({
|
|
|
57188
57188
|
}
|
|
57189
57189
|
parts.push("class");
|
|
57190
57190
|
if (n.id) {
|
|
57191
|
-
parts.push(" ", path2.call(
|
|
57191
|
+
parts.push(" ", path2.call(print4, "id"));
|
|
57192
57192
|
}
|
|
57193
57193
|
if (n.typeParameters) {
|
|
57194
|
-
parts.push(path2.call(
|
|
57194
|
+
parts.push(path2.call(print4, "typeParameters"));
|
|
57195
57195
|
}
|
|
57196
57196
|
if (n.superClass) {
|
|
57197
|
-
parts.push(" extends ", path2.call(
|
|
57197
|
+
parts.push(" extends ", path2.call(print4, "superClass"), path2.call(print4, "superTypeParameters"));
|
|
57198
57198
|
}
|
|
57199
57199
|
if (n.extends && n.extends.length > 0) {
|
|
57200
|
-
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path2.map(
|
|
57200
|
+
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path2.map(print4, "extends")));
|
|
57201
57201
|
}
|
|
57202
57202
|
if (n["implements"] && n["implements"].length > 0) {
|
|
57203
|
-
parts.push(" implements ", (0, lines_1.fromString)(", ").join(path2.map(
|
|
57203
|
+
parts.push(" implements ", (0, lines_1.fromString)(", ").join(path2.map(print4, "implements")));
|
|
57204
57204
|
}
|
|
57205
|
-
parts.push(" ", path2.call(
|
|
57205
|
+
parts.push(" ", path2.call(print4, "body"));
|
|
57206
57206
|
if (n.type === "DeclareClass") {
|
|
57207
57207
|
return printFlowDeclaration(path2, parts);
|
|
57208
57208
|
} else {
|
|
@@ -57211,11 +57211,11 @@ var require_printer2 = __commonJS({
|
|
|
57211
57211
|
case "TemplateElement":
|
|
57212
57212
|
return (0, lines_1.fromString)(n.value.raw, options).lockIndentTail();
|
|
57213
57213
|
case "TemplateLiteral": {
|
|
57214
|
-
var expressions_1 = path2.map(
|
|
57214
|
+
var expressions_1 = path2.map(print4, "expressions");
|
|
57215
57215
|
parts.push("`");
|
|
57216
57216
|
path2.each(function(childPath) {
|
|
57217
57217
|
var i2 = childPath.getName();
|
|
57218
|
-
parts.push(
|
|
57218
|
+
parts.push(print4(childPath));
|
|
57219
57219
|
if (i2 < expressions_1.length) {
|
|
57220
57220
|
parts.push("${", expressions_1[i2], "}");
|
|
57221
57221
|
}
|
|
@@ -57224,7 +57224,7 @@ var require_printer2 = __commonJS({
|
|
|
57224
57224
|
return (0, lines_1.concat)(parts).lockIndentTail();
|
|
57225
57225
|
}
|
|
57226
57226
|
case "TaggedTemplateExpression":
|
|
57227
|
-
return (0, lines_1.concat)([path2.call(
|
|
57227
|
+
return (0, lines_1.concat)([path2.call(print4, "tag"), path2.call(print4, "quasi")]);
|
|
57228
57228
|
case "Node":
|
|
57229
57229
|
case "Printable":
|
|
57230
57230
|
case "SourceLocation":
|
|
@@ -57258,7 +57258,7 @@ var require_printer2 = __commonJS({
|
|
|
57258
57258
|
if (n.typeAnnotation.type !== "FunctionTypeAnnotation") {
|
|
57259
57259
|
parts.push(": ");
|
|
57260
57260
|
}
|
|
57261
|
-
parts.push(path2.call(
|
|
57261
|
+
parts.push(path2.call(print4, "typeAnnotation"));
|
|
57262
57262
|
return (0, lines_1.concat)(parts);
|
|
57263
57263
|
}
|
|
57264
57264
|
return (0, lines_1.fromString)("");
|
|
@@ -57272,9 +57272,9 @@ var require_printer2 = __commonJS({
|
|
|
57272
57272
|
case "MixedTypeAnnotation":
|
|
57273
57273
|
return (0, lines_1.fromString)("mixed", options);
|
|
57274
57274
|
case "ArrayTypeAnnotation":
|
|
57275
|
-
return (0, lines_1.concat)([path2.call(
|
|
57275
|
+
return (0, lines_1.concat)([path2.call(print4, "elementType"), "[]"]);
|
|
57276
57276
|
case "TupleTypeAnnotation": {
|
|
57277
|
-
var printed_2 = path2.map(
|
|
57277
|
+
var printed_2 = path2.map(print4, "types");
|
|
57278
57278
|
var joined = (0, lines_1.fromString)(", ").join(printed_2);
|
|
57279
57279
|
var oneLine_3 = joined.getLineLength(1) <= options.wrapColumn;
|
|
57280
57280
|
if (oneLine_3) {
|
|
@@ -57321,38 +57321,38 @@ var require_printer2 = __commonJS({
|
|
|
57321
57321
|
case "InterfaceTypeAnnotation":
|
|
57322
57322
|
parts.push("interface");
|
|
57323
57323
|
if (n.extends && n.extends.length > 0) {
|
|
57324
|
-
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path2.map(
|
|
57324
|
+
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path2.map(print4, "extends")));
|
|
57325
57325
|
}
|
|
57326
|
-
parts.push(" ", path2.call(
|
|
57326
|
+
parts.push(" ", path2.call(print4, "body"));
|
|
57327
57327
|
return (0, lines_1.concat)(parts);
|
|
57328
57328
|
case "DeclareFunction":
|
|
57329
57329
|
return printFlowDeclaration(path2, [
|
|
57330
57330
|
"function ",
|
|
57331
|
-
path2.call(
|
|
57331
|
+
path2.call(print4, "id"),
|
|
57332
57332
|
";"
|
|
57333
57333
|
]);
|
|
57334
57334
|
case "DeclareModule":
|
|
57335
57335
|
return printFlowDeclaration(path2, [
|
|
57336
57336
|
"module ",
|
|
57337
|
-
path2.call(
|
|
57337
|
+
path2.call(print4, "id"),
|
|
57338
57338
|
" ",
|
|
57339
|
-
path2.call(
|
|
57339
|
+
path2.call(print4, "body")
|
|
57340
57340
|
]);
|
|
57341
57341
|
case "DeclareModuleExports":
|
|
57342
57342
|
return printFlowDeclaration(path2, [
|
|
57343
57343
|
"module.exports",
|
|
57344
|
-
path2.call(
|
|
57344
|
+
path2.call(print4, "typeAnnotation")
|
|
57345
57345
|
]);
|
|
57346
57346
|
case "DeclareVariable":
|
|
57347
|
-
return printFlowDeclaration(path2, ["var ", path2.call(
|
|
57347
|
+
return printFlowDeclaration(path2, ["var ", path2.call(print4, "id"), ";"]);
|
|
57348
57348
|
case "DeclareExportDeclaration":
|
|
57349
57349
|
case "DeclareExportAllDeclaration":
|
|
57350
|
-
return (0, lines_1.concat)(["declare ", printExportDeclaration(path2, options,
|
|
57350
|
+
return (0, lines_1.concat)(["declare ", printExportDeclaration(path2, options, print4)]);
|
|
57351
57351
|
case "EnumDeclaration":
|
|
57352
57352
|
return (0, lines_1.concat)([
|
|
57353
57353
|
"enum ",
|
|
57354
|
-
path2.call(
|
|
57355
|
-
path2.call(
|
|
57354
|
+
path2.call(print4, "id"),
|
|
57355
|
+
path2.call(print4, "body")
|
|
57356
57356
|
]);
|
|
57357
57357
|
case "EnumBooleanBody":
|
|
57358
57358
|
case "EnumNumberBody":
|
|
@@ -57364,24 +57364,24 @@ var require_printer2 = __commonJS({
|
|
|
57364
57364
|
n.type.slice(4, -4).toLowerCase()
|
|
57365
57365
|
);
|
|
57366
57366
|
}
|
|
57367
|
-
parts.push(" {\n", (0, lines_1.fromString)("\n").join(path2.map(
|
|
57367
|
+
parts.push(" {\n", (0, lines_1.fromString)("\n").join(path2.map(print4, "members")).indent(options.tabWidth), "\n}");
|
|
57368
57368
|
return (0, lines_1.concat)(parts);
|
|
57369
57369
|
}
|
|
57370
57370
|
case "EnumDefaultedMember":
|
|
57371
|
-
return (0, lines_1.concat)([path2.call(
|
|
57371
|
+
return (0, lines_1.concat)([path2.call(print4, "id"), ","]);
|
|
57372
57372
|
case "EnumBooleanMember":
|
|
57373
57373
|
case "EnumNumberMember":
|
|
57374
57374
|
case "EnumStringMember":
|
|
57375
57375
|
return (0, lines_1.concat)([
|
|
57376
|
-
path2.call(
|
|
57376
|
+
path2.call(print4, "id"),
|
|
57377
57377
|
" = ",
|
|
57378
|
-
path2.call(
|
|
57378
|
+
path2.call(print4, "init"),
|
|
57379
57379
|
","
|
|
57380
57380
|
]);
|
|
57381
57381
|
case "InferredPredicate":
|
|
57382
57382
|
return (0, lines_1.fromString)("%checks", options);
|
|
57383
57383
|
case "DeclaredPredicate":
|
|
57384
|
-
return (0, lines_1.concat)(["%checks(", path2.call(
|
|
57384
|
+
return (0, lines_1.concat)(["%checks(", path2.call(print4, "value"), ")"]);
|
|
57385
57385
|
case "FunctionTypeAnnotation": {
|
|
57386
57386
|
var parent = path2.getParentNode(0);
|
|
57387
57387
|
var isArrowFunctionTypeAnnotation = !(namedTypes.ObjectTypeCallProperty.check(parent) || namedTypes.ObjectTypeInternalSlot.check(parent) && parent.method || namedTypes.DeclareFunction.check(path2.getParentNode(2)));
|
|
@@ -57391,14 +57391,14 @@ var require_printer2 = __commonJS({
|
|
|
57391
57391
|
}
|
|
57392
57392
|
var hasTypeParameters = !!n.typeParameters;
|
|
57393
57393
|
var needsParens = hasTypeParameters || n.params.length !== 1 || n.params[0].name;
|
|
57394
|
-
parts.push(hasTypeParameters ? path2.call(
|
|
57394
|
+
parts.push(hasTypeParameters ? path2.call(print4, "typeParameters") : "", needsParens ? "(" : "", printFunctionParams(path2, options, print4), needsParens ? ")" : "");
|
|
57395
57395
|
if (n.returnType) {
|
|
57396
|
-
parts.push(isArrowFunctionTypeAnnotation ? " => " : ": ", path2.call(
|
|
57396
|
+
parts.push(isArrowFunctionTypeAnnotation ? " => " : ": ", path2.call(print4, "returnType"));
|
|
57397
57397
|
}
|
|
57398
57398
|
return (0, lines_1.concat)(parts);
|
|
57399
57399
|
}
|
|
57400
57400
|
case "FunctionTypeParam": {
|
|
57401
|
-
var name = path2.call(
|
|
57401
|
+
var name = path2.call(print4, "name");
|
|
57402
57402
|
parts.push(name);
|
|
57403
57403
|
if (n.optional) {
|
|
57404
57404
|
parts.push("?");
|
|
@@ -57406,13 +57406,13 @@ var require_printer2 = __commonJS({
|
|
|
57406
57406
|
if (name.infos[0].line) {
|
|
57407
57407
|
parts.push(": ");
|
|
57408
57408
|
}
|
|
57409
|
-
parts.push(path2.call(
|
|
57409
|
+
parts.push(path2.call(print4, "typeAnnotation"));
|
|
57410
57410
|
return (0, lines_1.concat)(parts);
|
|
57411
57411
|
}
|
|
57412
57412
|
case "GenericTypeAnnotation":
|
|
57413
57413
|
return (0, lines_1.concat)([
|
|
57414
|
-
path2.call(
|
|
57415
|
-
path2.call(
|
|
57414
|
+
path2.call(print4, "id"),
|
|
57415
|
+
path2.call(print4, "typeParameters")
|
|
57416
57416
|
]);
|
|
57417
57417
|
case "DeclareInterface":
|
|
57418
57418
|
parts.push("declare ");
|
|
@@ -57421,24 +57421,24 @@ var require_printer2 = __commonJS({
|
|
|
57421
57421
|
if (n.declare) {
|
|
57422
57422
|
parts.push("declare ");
|
|
57423
57423
|
}
|
|
57424
|
-
parts.push("interface ", path2.call(
|
|
57424
|
+
parts.push("interface ", path2.call(print4, "id"), path2.call(print4, "typeParameters"), " ");
|
|
57425
57425
|
if (n["extends"] && n["extends"].length > 0) {
|
|
57426
|
-
parts.push("extends ", (0, lines_1.fromString)(", ").join(path2.map(
|
|
57426
|
+
parts.push("extends ", (0, lines_1.fromString)(", ").join(path2.map(print4, "extends")), " ");
|
|
57427
57427
|
}
|
|
57428
57428
|
if (n.body) {
|
|
57429
|
-
parts.push(path2.call(
|
|
57429
|
+
parts.push(path2.call(print4, "body"));
|
|
57430
57430
|
}
|
|
57431
57431
|
return (0, lines_1.concat)(parts);
|
|
57432
57432
|
case "ClassImplements":
|
|
57433
57433
|
case "InterfaceExtends":
|
|
57434
57434
|
return (0, lines_1.concat)([
|
|
57435
|
-
path2.call(
|
|
57436
|
-
path2.call(
|
|
57435
|
+
path2.call(print4, "id"),
|
|
57436
|
+
path2.call(print4, "typeParameters")
|
|
57437
57437
|
]);
|
|
57438
57438
|
case "IntersectionTypeAnnotation":
|
|
57439
|
-
return (0, lines_1.fromString)(" & ").join(path2.map(
|
|
57439
|
+
return (0, lines_1.fromString)(" & ").join(path2.map(print4, "types"));
|
|
57440
57440
|
case "NullableTypeAnnotation":
|
|
57441
|
-
return (0, lines_1.concat)(["?", path2.call(
|
|
57441
|
+
return (0, lines_1.concat)(["?", path2.call(print4, "typeAnnotation")]);
|
|
57442
57442
|
case "NullLiteralTypeAnnotation":
|
|
57443
57443
|
return (0, lines_1.fromString)("null", options);
|
|
57444
57444
|
case "ThisTypeAnnotation":
|
|
@@ -57446,40 +57446,40 @@ var require_printer2 = __commonJS({
|
|
|
57446
57446
|
case "NumberTypeAnnotation":
|
|
57447
57447
|
return (0, lines_1.fromString)("number", options);
|
|
57448
57448
|
case "ObjectTypeCallProperty":
|
|
57449
|
-
return path2.call(
|
|
57449
|
+
return path2.call(print4, "value");
|
|
57450
57450
|
case "ObjectTypeIndexer":
|
|
57451
57451
|
if (n.static) {
|
|
57452
57452
|
parts.push("static ");
|
|
57453
57453
|
}
|
|
57454
|
-
parts.push(printVariance(path2,
|
|
57454
|
+
parts.push(printVariance(path2, print4), "[");
|
|
57455
57455
|
if (n.id) {
|
|
57456
|
-
parts.push(path2.call(
|
|
57456
|
+
parts.push(path2.call(print4, "id"), ": ");
|
|
57457
57457
|
}
|
|
57458
|
-
parts.push(path2.call(
|
|
57458
|
+
parts.push(path2.call(print4, "key"), "]: ", path2.call(print4, "value"));
|
|
57459
57459
|
return (0, lines_1.concat)(parts);
|
|
57460
57460
|
case "ObjectTypeProperty":
|
|
57461
57461
|
return (0, lines_1.concat)([
|
|
57462
|
-
printVariance(path2,
|
|
57463
|
-
path2.call(
|
|
57462
|
+
printVariance(path2, print4),
|
|
57463
|
+
path2.call(print4, "key"),
|
|
57464
57464
|
n.optional ? "?" : "",
|
|
57465
57465
|
": ",
|
|
57466
|
-
path2.call(
|
|
57466
|
+
path2.call(print4, "value")
|
|
57467
57467
|
]);
|
|
57468
57468
|
case "ObjectTypeInternalSlot":
|
|
57469
57469
|
return (0, lines_1.concat)([
|
|
57470
57470
|
n.static ? "static " : "",
|
|
57471
57471
|
"[[",
|
|
57472
|
-
path2.call(
|
|
57472
|
+
path2.call(print4, "id"),
|
|
57473
57473
|
"]]",
|
|
57474
57474
|
n.optional ? "?" : "",
|
|
57475
57475
|
n.value.type !== "FunctionTypeAnnotation" ? ": " : "",
|
|
57476
|
-
path2.call(
|
|
57476
|
+
path2.call(print4, "value")
|
|
57477
57477
|
]);
|
|
57478
57478
|
case "QualifiedTypeIdentifier":
|
|
57479
57479
|
return (0, lines_1.concat)([
|
|
57480
|
-
path2.call(
|
|
57480
|
+
path2.call(print4, "qualification"),
|
|
57481
57481
|
".",
|
|
57482
|
-
path2.call(
|
|
57482
|
+
path2.call(print4, "id")
|
|
57483
57483
|
]);
|
|
57484
57484
|
case "StringLiteralTypeAnnotation":
|
|
57485
57485
|
return (0, lines_1.fromString)(nodeStr(n.value, options), options);
|
|
@@ -57496,36 +57496,36 @@ var require_printer2 = __commonJS({
|
|
|
57496
57496
|
case "TypeAlias":
|
|
57497
57497
|
return (0, lines_1.concat)([
|
|
57498
57498
|
"type ",
|
|
57499
|
-
path2.call(
|
|
57500
|
-
path2.call(
|
|
57499
|
+
path2.call(print4, "id"),
|
|
57500
|
+
path2.call(print4, "typeParameters"),
|
|
57501
57501
|
" = ",
|
|
57502
|
-
path2.call(
|
|
57502
|
+
path2.call(print4, "right"),
|
|
57503
57503
|
";"
|
|
57504
57504
|
]);
|
|
57505
57505
|
case "DeclareOpaqueType":
|
|
57506
57506
|
parts.push("declare ");
|
|
57507
57507
|
case "OpaqueType":
|
|
57508
|
-
parts.push("opaque type ", path2.call(
|
|
57508
|
+
parts.push("opaque type ", path2.call(print4, "id"), path2.call(print4, "typeParameters"));
|
|
57509
57509
|
if (n["supertype"]) {
|
|
57510
|
-
parts.push(": ", path2.call(
|
|
57510
|
+
parts.push(": ", path2.call(print4, "supertype"));
|
|
57511
57511
|
}
|
|
57512
57512
|
if (n["impltype"]) {
|
|
57513
|
-
parts.push(" = ", path2.call(
|
|
57513
|
+
parts.push(" = ", path2.call(print4, "impltype"));
|
|
57514
57514
|
}
|
|
57515
57515
|
parts.push(";");
|
|
57516
57516
|
return (0, lines_1.concat)(parts);
|
|
57517
57517
|
case "TypeCastExpression":
|
|
57518
57518
|
return (0, lines_1.concat)([
|
|
57519
57519
|
"(",
|
|
57520
|
-
path2.call(
|
|
57521
|
-
path2.call(
|
|
57520
|
+
path2.call(print4, "expression"),
|
|
57521
|
+
path2.call(print4, "typeAnnotation"),
|
|
57522
57522
|
")"
|
|
57523
57523
|
]);
|
|
57524
57524
|
case "TypeParameterDeclaration":
|
|
57525
57525
|
case "TypeParameterInstantiation":
|
|
57526
57526
|
return (0, lines_1.concat)([
|
|
57527
57527
|
"<",
|
|
57528
|
-
(0, lines_1.fromString)(", ").join(path2.map(
|
|
57528
|
+
(0, lines_1.fromString)(", ").join(path2.map(print4, "params")),
|
|
57529
57529
|
">"
|
|
57530
57530
|
]);
|
|
57531
57531
|
case "Variance":
|
|
@@ -57538,32 +57538,32 @@ var require_printer2 = __commonJS({
|
|
|
57538
57538
|
return (0, lines_1.fromString)("");
|
|
57539
57539
|
case "TypeParameter":
|
|
57540
57540
|
if (n.variance) {
|
|
57541
|
-
parts.push(printVariance(path2,
|
|
57541
|
+
parts.push(printVariance(path2, print4));
|
|
57542
57542
|
}
|
|
57543
|
-
parts.push(path2.call(
|
|
57543
|
+
parts.push(path2.call(print4, "name"));
|
|
57544
57544
|
if (n.bound) {
|
|
57545
|
-
parts.push(path2.call(
|
|
57545
|
+
parts.push(path2.call(print4, "bound"));
|
|
57546
57546
|
}
|
|
57547
57547
|
if (n["default"]) {
|
|
57548
|
-
parts.push("=", path2.call(
|
|
57548
|
+
parts.push("=", path2.call(print4, "default"));
|
|
57549
57549
|
}
|
|
57550
57550
|
return (0, lines_1.concat)(parts);
|
|
57551
57551
|
case "TypeofTypeAnnotation":
|
|
57552
57552
|
return (0, lines_1.concat)([
|
|
57553
57553
|
(0, lines_1.fromString)("typeof ", options),
|
|
57554
|
-
path2.call(
|
|
57554
|
+
path2.call(print4, "argument")
|
|
57555
57555
|
]);
|
|
57556
57556
|
case "IndexedAccessType":
|
|
57557
57557
|
case "OptionalIndexedAccessType":
|
|
57558
57558
|
return (0, lines_1.concat)([
|
|
57559
|
-
path2.call(
|
|
57559
|
+
path2.call(print4, "objectType"),
|
|
57560
57560
|
n.optional ? "?." : "",
|
|
57561
57561
|
"[",
|
|
57562
|
-
path2.call(
|
|
57562
|
+
path2.call(print4, "indexType"),
|
|
57563
57563
|
"]"
|
|
57564
57564
|
]);
|
|
57565
57565
|
case "UnionTypeAnnotation":
|
|
57566
|
-
return (0, lines_1.fromString)(" | ").join(path2.map(
|
|
57566
|
+
return (0, lines_1.fromString)(" | ").join(path2.map(print4, "types"));
|
|
57567
57567
|
case "VoidTypeAnnotation":
|
|
57568
57568
|
return (0, lines_1.fromString)("void", options);
|
|
57569
57569
|
case "NullTypeAnnotation":
|
|
@@ -57603,77 +57603,77 @@ var require_printer2 = __commonJS({
|
|
|
57603
57603
|
case "TSNeverKeyword":
|
|
57604
57604
|
return (0, lines_1.fromString)("never", options);
|
|
57605
57605
|
case "TSArrayType":
|
|
57606
|
-
return (0, lines_1.concat)([path2.call(
|
|
57606
|
+
return (0, lines_1.concat)([path2.call(print4, "elementType"), "[]"]);
|
|
57607
57607
|
case "TSLiteralType":
|
|
57608
|
-
return path2.call(
|
|
57608
|
+
return path2.call(print4, "literal");
|
|
57609
57609
|
case "TSUnionType":
|
|
57610
|
-
return (0, lines_1.fromString)(" | ").join(path2.map(
|
|
57610
|
+
return (0, lines_1.fromString)(" | ").join(path2.map(print4, "types"));
|
|
57611
57611
|
case "TSIntersectionType":
|
|
57612
|
-
return (0, lines_1.fromString)(" & ").join(path2.map(
|
|
57612
|
+
return (0, lines_1.fromString)(" & ").join(path2.map(print4, "types"));
|
|
57613
57613
|
case "TSConditionalType":
|
|
57614
|
-
parts.push(path2.call(
|
|
57614
|
+
parts.push(path2.call(print4, "checkType"), " extends ", path2.call(print4, "extendsType"), " ? ", path2.call(print4, "trueType"), " : ", path2.call(print4, "falseType"));
|
|
57615
57615
|
return (0, lines_1.concat)(parts);
|
|
57616
57616
|
case "TSInferType":
|
|
57617
|
-
parts.push("infer ", path2.call(
|
|
57617
|
+
parts.push("infer ", path2.call(print4, "typeParameter"));
|
|
57618
57618
|
return (0, lines_1.concat)(parts);
|
|
57619
57619
|
case "TSParenthesizedType":
|
|
57620
|
-
return (0, lines_1.concat)(["(", path2.call(
|
|
57620
|
+
return (0, lines_1.concat)(["(", path2.call(print4, "typeAnnotation"), ")"]);
|
|
57621
57621
|
case "TSFunctionType":
|
|
57622
57622
|
return (0, lines_1.concat)([
|
|
57623
|
-
path2.call(
|
|
57623
|
+
path2.call(print4, "typeParameters"),
|
|
57624
57624
|
"(",
|
|
57625
|
-
printFunctionParams(path2, options,
|
|
57625
|
+
printFunctionParams(path2, options, print4),
|
|
57626
57626
|
") => ",
|
|
57627
|
-
path2.call(
|
|
57627
|
+
path2.call(print4, "typeAnnotation", "typeAnnotation")
|
|
57628
57628
|
]);
|
|
57629
57629
|
case "TSConstructorType":
|
|
57630
57630
|
return (0, lines_1.concat)([
|
|
57631
57631
|
"new ",
|
|
57632
|
-
path2.call(
|
|
57632
|
+
path2.call(print4, "typeParameters"),
|
|
57633
57633
|
"(",
|
|
57634
|
-
printFunctionParams(path2, options,
|
|
57634
|
+
printFunctionParams(path2, options, print4),
|
|
57635
57635
|
") => ",
|
|
57636
|
-
path2.call(
|
|
57636
|
+
path2.call(print4, "typeAnnotation", "typeAnnotation")
|
|
57637
57637
|
]);
|
|
57638
57638
|
case "TSMappedType": {
|
|
57639
|
-
parts.push(n.readonly ? "readonly " : "", "[", path2.call(
|
|
57639
|
+
parts.push(n.readonly ? "readonly " : "", "[", path2.call(print4, "typeParameter"), "]", n.optional ? "?" : "");
|
|
57640
57640
|
if (n.typeAnnotation) {
|
|
57641
|
-
parts.push(": ", path2.call(
|
|
57641
|
+
parts.push(": ", path2.call(print4, "typeAnnotation"), ";");
|
|
57642
57642
|
}
|
|
57643
57643
|
return (0, lines_1.concat)(["{\n", (0, lines_1.concat)(parts).indent(options.tabWidth), "\n}"]);
|
|
57644
57644
|
}
|
|
57645
57645
|
case "TSTupleType":
|
|
57646
57646
|
return (0, lines_1.concat)([
|
|
57647
57647
|
"[",
|
|
57648
|
-
(0, lines_1.fromString)(", ").join(path2.map(
|
|
57648
|
+
(0, lines_1.fromString)(", ").join(path2.map(print4, "elementTypes")),
|
|
57649
57649
|
"]"
|
|
57650
57650
|
]);
|
|
57651
57651
|
case "TSNamedTupleMember":
|
|
57652
|
-
parts.push(path2.call(
|
|
57652
|
+
parts.push(path2.call(print4, "label"));
|
|
57653
57653
|
if (n.optional) {
|
|
57654
57654
|
parts.push("?");
|
|
57655
57655
|
}
|
|
57656
|
-
parts.push(": ", path2.call(
|
|
57656
|
+
parts.push(": ", path2.call(print4, "elementType"));
|
|
57657
57657
|
return (0, lines_1.concat)(parts);
|
|
57658
57658
|
case "TSRestType":
|
|
57659
|
-
return (0, lines_1.concat)(["...", path2.call(
|
|
57659
|
+
return (0, lines_1.concat)(["...", path2.call(print4, "typeAnnotation")]);
|
|
57660
57660
|
case "TSOptionalType":
|
|
57661
|
-
return (0, lines_1.concat)([path2.call(
|
|
57661
|
+
return (0, lines_1.concat)([path2.call(print4, "typeAnnotation"), "?"]);
|
|
57662
57662
|
case "TSIndexedAccessType":
|
|
57663
57663
|
return (0, lines_1.concat)([
|
|
57664
|
-
path2.call(
|
|
57664
|
+
path2.call(print4, "objectType"),
|
|
57665
57665
|
"[",
|
|
57666
|
-
path2.call(
|
|
57666
|
+
path2.call(print4, "indexType"),
|
|
57667
57667
|
"]"
|
|
57668
57668
|
]);
|
|
57669
57669
|
case "TSTypeOperator":
|
|
57670
57670
|
return (0, lines_1.concat)([
|
|
57671
|
-
path2.call(
|
|
57671
|
+
path2.call(print4, "operator"),
|
|
57672
57672
|
" ",
|
|
57673
|
-
path2.call(
|
|
57673
|
+
path2.call(print4, "typeAnnotation")
|
|
57674
57674
|
]);
|
|
57675
57675
|
case "TSTypeLiteral": {
|
|
57676
|
-
var members = (0, lines_1.fromString)("\n").join(path2.map(
|
|
57676
|
+
var members = (0, lines_1.fromString)("\n").join(path2.map(print4, "members").map(function(member) {
|
|
57677
57677
|
if (lastNonSpaceCharacter(member) !== ";") {
|
|
57678
57678
|
return member.concat(";");
|
|
57679
57679
|
}
|
|
@@ -57686,13 +57686,13 @@ var require_printer2 = __commonJS({
|
|
|
57686
57686
|
return (0, lines_1.concat)(parts);
|
|
57687
57687
|
}
|
|
57688
57688
|
case "TSEnumMember":
|
|
57689
|
-
parts.push(path2.call(
|
|
57689
|
+
parts.push(path2.call(print4, "id"));
|
|
57690
57690
|
if (n.initializer) {
|
|
57691
|
-
parts.push(" = ", path2.call(
|
|
57691
|
+
parts.push(" = ", path2.call(print4, "initializer"));
|
|
57692
57692
|
}
|
|
57693
57693
|
return (0, lines_1.concat)(parts);
|
|
57694
57694
|
case "TSTypeQuery":
|
|
57695
|
-
return (0, lines_1.concat)(["typeof ", path2.call(
|
|
57695
|
+
return (0, lines_1.concat)(["typeof ", path2.call(print4, "exprName")]);
|
|
57696
57696
|
case "TSParameterProperty":
|
|
57697
57697
|
if (n.accessibility) {
|
|
57698
57698
|
parts.push(n.accessibility, " ");
|
|
@@ -57706,119 +57706,119 @@ var require_printer2 = __commonJS({
|
|
|
57706
57706
|
if (n.readonly) {
|
|
57707
57707
|
parts.push("readonly ");
|
|
57708
57708
|
}
|
|
57709
|
-
parts.push(path2.call(
|
|
57709
|
+
parts.push(path2.call(print4, "parameter"));
|
|
57710
57710
|
return (0, lines_1.concat)(parts);
|
|
57711
57711
|
case "TSTypeReference":
|
|
57712
57712
|
return (0, lines_1.concat)([
|
|
57713
|
-
path2.call(
|
|
57714
|
-
path2.call(
|
|
57713
|
+
path2.call(print4, "typeName"),
|
|
57714
|
+
path2.call(print4, "typeParameters")
|
|
57715
57715
|
]);
|
|
57716
57716
|
case "TSQualifiedName":
|
|
57717
|
-
return (0, lines_1.concat)([path2.call(
|
|
57717
|
+
return (0, lines_1.concat)([path2.call(print4, "left"), ".", path2.call(print4, "right")]);
|
|
57718
57718
|
case "TSAsExpression":
|
|
57719
57719
|
case "TSSatisfiesExpression": {
|
|
57720
|
-
var expression = path2.call(
|
|
57721
|
-
parts.push(expression, n.type === "TSSatisfiesExpression" ? " satisfies " : " as ", path2.call(
|
|
57720
|
+
var expression = path2.call(print4, "expression");
|
|
57721
|
+
parts.push(expression, n.type === "TSSatisfiesExpression" ? " satisfies " : " as ", path2.call(print4, "typeAnnotation"));
|
|
57722
57722
|
return (0, lines_1.concat)(parts);
|
|
57723
57723
|
}
|
|
57724
57724
|
case "TSTypeCastExpression":
|
|
57725
57725
|
return (0, lines_1.concat)([
|
|
57726
|
-
path2.call(
|
|
57727
|
-
path2.call(
|
|
57726
|
+
path2.call(print4, "expression"),
|
|
57727
|
+
path2.call(print4, "typeAnnotation")
|
|
57728
57728
|
]);
|
|
57729
57729
|
case "TSNonNullExpression":
|
|
57730
|
-
return (0, lines_1.concat)([path2.call(
|
|
57730
|
+
return (0, lines_1.concat)([path2.call(print4, "expression"), "!"]);
|
|
57731
57731
|
case "TSTypeAnnotation":
|
|
57732
|
-
return (0, lines_1.concat)([": ", path2.call(
|
|
57732
|
+
return (0, lines_1.concat)([": ", path2.call(print4, "typeAnnotation")]);
|
|
57733
57733
|
case "TSIndexSignature":
|
|
57734
57734
|
return (0, lines_1.concat)([
|
|
57735
57735
|
n.readonly ? "readonly " : "",
|
|
57736
57736
|
"[",
|
|
57737
|
-
path2.map(
|
|
57737
|
+
path2.map(print4, "parameters"),
|
|
57738
57738
|
"]",
|
|
57739
|
-
path2.call(
|
|
57739
|
+
path2.call(print4, "typeAnnotation")
|
|
57740
57740
|
]);
|
|
57741
57741
|
case "TSPropertySignature":
|
|
57742
|
-
parts.push(printVariance(path2,
|
|
57742
|
+
parts.push(printVariance(path2, print4), n.readonly ? "readonly " : "");
|
|
57743
57743
|
if (n.computed) {
|
|
57744
|
-
parts.push("[", path2.call(
|
|
57744
|
+
parts.push("[", path2.call(print4, "key"), "]");
|
|
57745
57745
|
} else {
|
|
57746
|
-
parts.push(path2.call(
|
|
57746
|
+
parts.push(path2.call(print4, "key"));
|
|
57747
57747
|
}
|
|
57748
|
-
parts.push(n.optional ? "?" : "", path2.call(
|
|
57748
|
+
parts.push(n.optional ? "?" : "", path2.call(print4, "typeAnnotation"));
|
|
57749
57749
|
return (0, lines_1.concat)(parts);
|
|
57750
57750
|
case "TSMethodSignature":
|
|
57751
57751
|
if (n.computed) {
|
|
57752
|
-
parts.push("[", path2.call(
|
|
57752
|
+
parts.push("[", path2.call(print4, "key"), "]");
|
|
57753
57753
|
} else {
|
|
57754
|
-
parts.push(path2.call(
|
|
57754
|
+
parts.push(path2.call(print4, "key"));
|
|
57755
57755
|
}
|
|
57756
57756
|
if (n.optional) {
|
|
57757
57757
|
parts.push("?");
|
|
57758
57758
|
}
|
|
57759
|
-
parts.push(path2.call(
|
|
57759
|
+
parts.push(path2.call(print4, "typeParameters"), "(", printFunctionParams(path2, options, print4), ")", path2.call(print4, "typeAnnotation"));
|
|
57760
57760
|
return (0, lines_1.concat)(parts);
|
|
57761
57761
|
case "TSTypePredicate":
|
|
57762
57762
|
if (n.asserts) {
|
|
57763
57763
|
parts.push("asserts ");
|
|
57764
57764
|
}
|
|
57765
|
-
parts.push(path2.call(
|
|
57765
|
+
parts.push(path2.call(print4, "parameterName"));
|
|
57766
57766
|
if (n.typeAnnotation) {
|
|
57767
|
-
parts.push(" is ", path2.call(
|
|
57767
|
+
parts.push(" is ", path2.call(print4, "typeAnnotation", "typeAnnotation"));
|
|
57768
57768
|
}
|
|
57769
57769
|
return (0, lines_1.concat)(parts);
|
|
57770
57770
|
case "TSCallSignatureDeclaration":
|
|
57771
57771
|
return (0, lines_1.concat)([
|
|
57772
|
-
path2.call(
|
|
57772
|
+
path2.call(print4, "typeParameters"),
|
|
57773
57773
|
"(",
|
|
57774
|
-
printFunctionParams(path2, options,
|
|
57774
|
+
printFunctionParams(path2, options, print4),
|
|
57775
57775
|
")",
|
|
57776
|
-
path2.call(
|
|
57776
|
+
path2.call(print4, "typeAnnotation")
|
|
57777
57777
|
]);
|
|
57778
57778
|
case "TSConstructSignatureDeclaration":
|
|
57779
57779
|
if (n.typeParameters) {
|
|
57780
|
-
parts.push("new", path2.call(
|
|
57780
|
+
parts.push("new", path2.call(print4, "typeParameters"));
|
|
57781
57781
|
} else {
|
|
57782
57782
|
parts.push("new ");
|
|
57783
57783
|
}
|
|
57784
|
-
parts.push("(", printFunctionParams(path2, options,
|
|
57784
|
+
parts.push("(", printFunctionParams(path2, options, print4), ")", path2.call(print4, "typeAnnotation"));
|
|
57785
57785
|
return (0, lines_1.concat)(parts);
|
|
57786
57786
|
case "TSTypeAliasDeclaration":
|
|
57787
57787
|
return (0, lines_1.concat)([
|
|
57788
57788
|
n.declare ? "declare " : "",
|
|
57789
57789
|
"type ",
|
|
57790
|
-
path2.call(
|
|
57791
|
-
path2.call(
|
|
57790
|
+
path2.call(print4, "id"),
|
|
57791
|
+
path2.call(print4, "typeParameters"),
|
|
57792
57792
|
" = ",
|
|
57793
|
-
path2.call(
|
|
57793
|
+
path2.call(print4, "typeAnnotation"),
|
|
57794
57794
|
";"
|
|
57795
57795
|
]);
|
|
57796
57796
|
case "TSTypeParameter": {
|
|
57797
|
-
parts.push(path2.call(
|
|
57797
|
+
parts.push(path2.call(print4, "name"));
|
|
57798
57798
|
var parent = path2.getParentNode(0);
|
|
57799
57799
|
var isInMappedType = namedTypes.TSMappedType.check(parent);
|
|
57800
57800
|
if (n.constraint) {
|
|
57801
|
-
parts.push(isInMappedType ? " in " : " extends ", path2.call(
|
|
57801
|
+
parts.push(isInMappedType ? " in " : " extends ", path2.call(print4, "constraint"));
|
|
57802
57802
|
}
|
|
57803
57803
|
if (n["default"]) {
|
|
57804
|
-
parts.push(" = ", path2.call(
|
|
57804
|
+
parts.push(" = ", path2.call(print4, "default"));
|
|
57805
57805
|
}
|
|
57806
57806
|
return (0, lines_1.concat)(parts);
|
|
57807
57807
|
}
|
|
57808
57808
|
case "TSTypeAssertion": {
|
|
57809
|
-
parts.push("<", path2.call(
|
|
57809
|
+
parts.push("<", path2.call(print4, "typeAnnotation"), "> ", path2.call(print4, "expression"));
|
|
57810
57810
|
return (0, lines_1.concat)(parts);
|
|
57811
57811
|
}
|
|
57812
57812
|
case "TSTypeParameterDeclaration":
|
|
57813
57813
|
case "TSTypeParameterInstantiation":
|
|
57814
57814
|
return (0, lines_1.concat)([
|
|
57815
57815
|
"<",
|
|
57816
|
-
(0, lines_1.fromString)(", ").join(path2.map(
|
|
57816
|
+
(0, lines_1.fromString)(", ").join(path2.map(print4, "params")),
|
|
57817
57817
|
">"
|
|
57818
57818
|
]);
|
|
57819
57819
|
case "TSEnumDeclaration": {
|
|
57820
|
-
parts.push(n.declare ? "declare " : "", n.const ? "const " : "", "enum ", path2.call(
|
|
57821
|
-
var memberLines = (0, lines_1.fromString)(",\n").join(path2.map(
|
|
57820
|
+
parts.push(n.declare ? "declare " : "", n.const ? "const " : "", "enum ", path2.call(print4, "id"));
|
|
57821
|
+
var memberLines = (0, lines_1.fromString)(",\n").join(path2.map(print4, "members"));
|
|
57822
57822
|
if (memberLines.isEmpty()) {
|
|
57823
57823
|
parts.push(" {}");
|
|
57824
57824
|
} else {
|
|
@@ -57828,11 +57828,11 @@ var require_printer2 = __commonJS({
|
|
|
57828
57828
|
}
|
|
57829
57829
|
case "TSExpressionWithTypeArguments":
|
|
57830
57830
|
return (0, lines_1.concat)([
|
|
57831
|
-
path2.call(
|
|
57832
|
-
path2.call(
|
|
57831
|
+
path2.call(print4, "expression"),
|
|
57832
|
+
path2.call(print4, "typeParameters")
|
|
57833
57833
|
]);
|
|
57834
57834
|
case "TSInterfaceBody": {
|
|
57835
|
-
var lines = (0, lines_1.fromString)("\n").join(path2.map(
|
|
57835
|
+
var lines = (0, lines_1.fromString)("\n").join(path2.map(print4, "body").map(function(element) {
|
|
57836
57836
|
if (lastNonSpaceCharacter(element) !== ";") {
|
|
57837
57837
|
return element.concat(";");
|
|
57838
57838
|
}
|
|
@@ -57844,22 +57844,22 @@ var require_printer2 = __commonJS({
|
|
|
57844
57844
|
return (0, lines_1.concat)(["{\n", lines.indent(options.tabWidth), "\n}"]);
|
|
57845
57845
|
}
|
|
57846
57846
|
case "TSImportType":
|
|
57847
|
-
parts.push("import(", path2.call(
|
|
57847
|
+
parts.push("import(", path2.call(print4, "argument"), ")");
|
|
57848
57848
|
if (n.qualifier) {
|
|
57849
|
-
parts.push(".", path2.call(
|
|
57849
|
+
parts.push(".", path2.call(print4, "qualifier"));
|
|
57850
57850
|
}
|
|
57851
57851
|
if (n.typeParameters) {
|
|
57852
|
-
parts.push(path2.call(
|
|
57852
|
+
parts.push(path2.call(print4, "typeParameters"));
|
|
57853
57853
|
}
|
|
57854
57854
|
return (0, lines_1.concat)(parts);
|
|
57855
57855
|
case "TSImportEqualsDeclaration":
|
|
57856
57856
|
if (n.isExport) {
|
|
57857
57857
|
parts.push("export ");
|
|
57858
57858
|
}
|
|
57859
|
-
parts.push("import ", path2.call(
|
|
57859
|
+
parts.push("import ", path2.call(print4, "id"), " = ", path2.call(print4, "moduleReference"));
|
|
57860
57860
|
return maybeAddSemicolon((0, lines_1.concat)(parts));
|
|
57861
57861
|
case "TSExternalModuleReference":
|
|
57862
|
-
return (0, lines_1.concat)(["require(", path2.call(
|
|
57862
|
+
return (0, lines_1.concat)(["require(", path2.call(print4, "expression"), ")"]);
|
|
57863
57863
|
case "TSModuleDeclaration": {
|
|
57864
57864
|
var parent = path2.getParentNode();
|
|
57865
57865
|
if (parent.type === "TSModuleDeclaration") {
|
|
@@ -57884,16 +57884,16 @@ var require_printer2 = __commonJS({
|
|
|
57884
57884
|
}
|
|
57885
57885
|
}
|
|
57886
57886
|
}
|
|
57887
|
-
parts.push(path2.call(
|
|
57887
|
+
parts.push(path2.call(print4, "id"));
|
|
57888
57888
|
if (n.body) {
|
|
57889
57889
|
parts.push(" ");
|
|
57890
|
-
parts.push(path2.call(
|
|
57890
|
+
parts.push(path2.call(print4, "body"));
|
|
57891
57891
|
}
|
|
57892
57892
|
return (0, lines_1.concat)(parts);
|
|
57893
57893
|
}
|
|
57894
57894
|
case "TSModuleBlock": {
|
|
57895
57895
|
var naked = path2.call(function(bodyPath) {
|
|
57896
|
-
return printStatementSequence(bodyPath, options,
|
|
57896
|
+
return printStatementSequence(bodyPath, options, print4);
|
|
57897
57897
|
}, "body");
|
|
57898
57898
|
if (naked.isEmpty()) {
|
|
57899
57899
|
parts.push("{}");
|
|
@@ -57903,11 +57903,11 @@ var require_printer2 = __commonJS({
|
|
|
57903
57903
|
return (0, lines_1.concat)(parts);
|
|
57904
57904
|
}
|
|
57905
57905
|
case "TSInstantiationExpression": {
|
|
57906
|
-
parts.push(path2.call(
|
|
57906
|
+
parts.push(path2.call(print4, "expression"), path2.call(print4, "typeParameters"));
|
|
57907
57907
|
return (0, lines_1.concat)(parts);
|
|
57908
57908
|
}
|
|
57909
57909
|
case "V8IntrinsicIdentifier":
|
|
57910
|
-
return (0, lines_1.concat)(["%", path2.call(
|
|
57910
|
+
return (0, lines_1.concat)(["%", path2.call(print4, "name")]);
|
|
57911
57911
|
case "TopicReference":
|
|
57912
57912
|
return (0, lines_1.fromString)("#");
|
|
57913
57913
|
case "ClassHeritage":
|
|
@@ -57957,7 +57957,7 @@ var require_printer2 = __commonJS({
|
|
|
57957
57957
|
}
|
|
57958
57958
|
return (0, lines_1.concat)(parts);
|
|
57959
57959
|
}
|
|
57960
|
-
function printStatementSequence(path2, options,
|
|
57960
|
+
function printStatementSequence(path2, options, print4) {
|
|
57961
57961
|
var filtered = [];
|
|
57962
57962
|
var sawComment = false;
|
|
57963
57963
|
var sawStatement = false;
|
|
@@ -57978,7 +57978,7 @@ var require_printer2 = __commonJS({
|
|
|
57978
57978
|
}
|
|
57979
57979
|
filtered.push({
|
|
57980
57980
|
node: stmt,
|
|
57981
|
-
printed:
|
|
57981
|
+
printed: print4(stmtPath)
|
|
57982
57982
|
});
|
|
57983
57983
|
});
|
|
57984
57984
|
if (sawComment) {
|
|
@@ -58070,7 +58070,7 @@ var require_printer2 = __commonJS({
|
|
|
58070
58070
|
}
|
|
58071
58071
|
return parts;
|
|
58072
58072
|
}
|
|
58073
|
-
function printMethod(path2, options,
|
|
58073
|
+
function printMethod(path2, options, print4) {
|
|
58074
58074
|
var node = path2.getNode();
|
|
58075
58075
|
var kind = node.kind;
|
|
58076
58076
|
var parts = [];
|
|
@@ -58088,7 +58088,7 @@ var require_printer2 = __commonJS({
|
|
|
58088
58088
|
if (kind === "get" || kind === "set") {
|
|
58089
58089
|
parts.push(kind, " ");
|
|
58090
58090
|
}
|
|
58091
|
-
var key = path2.call(
|
|
58091
|
+
var key = path2.call(print4, "key");
|
|
58092
58092
|
if (node.computed) {
|
|
58093
58093
|
key = (0, lines_1.concat)(["[", key, "]"]);
|
|
58094
58094
|
}
|
|
@@ -58097,26 +58097,26 @@ var require_printer2 = __commonJS({
|
|
|
58097
58097
|
parts.push("?");
|
|
58098
58098
|
}
|
|
58099
58099
|
if (node === nodeValue) {
|
|
58100
|
-
parts.push(path2.call(
|
|
58100
|
+
parts.push(path2.call(print4, "typeParameters"), "(", printFunctionParams(path2, options, print4), ")", path2.call(print4, "returnType"));
|
|
58101
58101
|
if (node.body) {
|
|
58102
|
-
parts.push(" ", path2.call(
|
|
58102
|
+
parts.push(" ", path2.call(print4, "body"));
|
|
58103
58103
|
} else {
|
|
58104
58104
|
parts.push(";");
|
|
58105
58105
|
}
|
|
58106
58106
|
} else {
|
|
58107
|
-
parts.push(path2.call(
|
|
58108
|
-
return printFunctionParams(valuePath, options,
|
|
58109
|
-
}, "value"), ")", path2.call(
|
|
58107
|
+
parts.push(path2.call(print4, "value", "typeParameters"), "(", path2.call(function(valuePath) {
|
|
58108
|
+
return printFunctionParams(valuePath, options, print4);
|
|
58109
|
+
}, "value"), ")", path2.call(print4, "value", "returnType"));
|
|
58110
58110
|
if (nodeValue.body) {
|
|
58111
|
-
parts.push(" ", path2.call(
|
|
58111
|
+
parts.push(" ", path2.call(print4, "value", "body"));
|
|
58112
58112
|
} else {
|
|
58113
58113
|
parts.push(";");
|
|
58114
58114
|
}
|
|
58115
58115
|
}
|
|
58116
58116
|
return (0, lines_1.concat)(parts);
|
|
58117
58117
|
}
|
|
58118
|
-
function printArgumentsList(path2, options,
|
|
58119
|
-
var printed = path2.map(
|
|
58118
|
+
function printArgumentsList(path2, options, print4) {
|
|
58119
|
+
var printed = path2.map(print4, "arguments");
|
|
58120
58120
|
var trailingComma = util.isTrailingCommaEnabled(options, "parameters");
|
|
58121
58121
|
var joined = (0, lines_1.fromString)(", ").join(printed);
|
|
58122
58122
|
if (joined.getLineLength(1) > options.wrapColumn) {
|
|
@@ -58129,28 +58129,28 @@ var require_printer2 = __commonJS({
|
|
|
58129
58129
|
}
|
|
58130
58130
|
return (0, lines_1.concat)(["(", joined, ")"]);
|
|
58131
58131
|
}
|
|
58132
|
-
function printFunctionParams(path2, options,
|
|
58132
|
+
function printFunctionParams(path2, options, print4) {
|
|
58133
58133
|
var fun = path2.getValue();
|
|
58134
58134
|
var params;
|
|
58135
58135
|
var printed = [];
|
|
58136
58136
|
if (fun.params) {
|
|
58137
58137
|
params = fun.params;
|
|
58138
|
-
printed = path2.map(
|
|
58138
|
+
printed = path2.map(print4, "params");
|
|
58139
58139
|
} else if (fun.parameters) {
|
|
58140
58140
|
params = fun.parameters;
|
|
58141
|
-
printed = path2.map(
|
|
58141
|
+
printed = path2.map(print4, "parameters");
|
|
58142
58142
|
}
|
|
58143
58143
|
if (fun.defaults) {
|
|
58144
58144
|
path2.each(function(defExprPath) {
|
|
58145
58145
|
var i2 = defExprPath.getName();
|
|
58146
58146
|
var p = printed[i2];
|
|
58147
58147
|
if (p && defExprPath.getValue()) {
|
|
58148
|
-
printed[i2] = (0, lines_1.concat)([p, " = ",
|
|
58148
|
+
printed[i2] = (0, lines_1.concat)([p, " = ", print4(defExprPath)]);
|
|
58149
58149
|
}
|
|
58150
58150
|
}, "defaults");
|
|
58151
58151
|
}
|
|
58152
58152
|
if (fun.rest) {
|
|
58153
|
-
printed.push((0, lines_1.concat)(["...", path2.call(
|
|
58153
|
+
printed.push((0, lines_1.concat)(["...", path2.call(print4, "rest")]));
|
|
58154
58154
|
}
|
|
58155
58155
|
var joined = (0, lines_1.fromString)(", ").join(printed);
|
|
58156
58156
|
if (joined.length > 1 || joined.getLineLength(1) > options.wrapColumn) {
|
|
@@ -58164,11 +58164,11 @@ var require_printer2 = __commonJS({
|
|
|
58164
58164
|
}
|
|
58165
58165
|
return joined;
|
|
58166
58166
|
}
|
|
58167
|
-
function maybePrintImportAssertions(path2, options,
|
|
58167
|
+
function maybePrintImportAssertions(path2, options, print4) {
|
|
58168
58168
|
var n = path2.getValue();
|
|
58169
58169
|
if (n.assertions && n.assertions.length > 0) {
|
|
58170
58170
|
var parts = [" assert {"];
|
|
58171
|
-
var printed = path2.map(
|
|
58171
|
+
var printed = path2.map(print4, "assertions");
|
|
58172
58172
|
var flat = (0, lines_1.fromString)(", ").join(printed);
|
|
58173
58173
|
if (flat.length > 1 || flat.getLineLength(1) > options.wrapColumn) {
|
|
58174
58174
|
parts.push("\n", (0, lines_1.fromString)(",\n").join(printed).indent(options.tabWidth), "\n}");
|
|
@@ -58179,7 +58179,7 @@ var require_printer2 = __commonJS({
|
|
|
58179
58179
|
}
|
|
58180
58180
|
return (0, lines_1.fromString)("");
|
|
58181
58181
|
}
|
|
58182
|
-
function printExportDeclaration(path2, options,
|
|
58182
|
+
function printExportDeclaration(path2, options, print4) {
|
|
58183
58183
|
var decl = path2.getValue();
|
|
58184
58184
|
var parts = ["export "];
|
|
58185
58185
|
if (decl.exportKind && decl.exportKind === "type") {
|
|
@@ -58193,7 +58193,7 @@ var require_printer2 = __commonJS({
|
|
|
58193
58193
|
parts.push("default ");
|
|
58194
58194
|
}
|
|
58195
58195
|
if (decl.declaration) {
|
|
58196
|
-
parts.push(path2.call(
|
|
58196
|
+
parts.push(path2.call(print4, "declaration"));
|
|
58197
58197
|
} else if (decl.specifiers) {
|
|
58198
58198
|
if (decl.specifiers.length === 1 && decl.specifiers[0].type === "ExportBatchSpecifier") {
|
|
58199
58199
|
parts.push("*");
|
|
@@ -58205,9 +58205,9 @@ var require_printer2 = __commonJS({
|
|
|
58205
58205
|
path2.each(function(specifierPath) {
|
|
58206
58206
|
var spec = specifierPath.getValue();
|
|
58207
58207
|
if (spec.type === "ExportDefaultSpecifier") {
|
|
58208
|
-
unbracedSpecifiers_2.push(
|
|
58208
|
+
unbracedSpecifiers_2.push(print4(specifierPath));
|
|
58209
58209
|
} else {
|
|
58210
|
-
bracedSpecifiers_2.push(
|
|
58210
|
+
bracedSpecifiers_2.push(print4(specifierPath));
|
|
58211
58211
|
}
|
|
58212
58212
|
}, "specifiers");
|
|
58213
58213
|
unbracedSpecifiers_2.forEach(function(lines2, i2) {
|
|
@@ -58236,10 +58236,10 @@ var require_printer2 = __commonJS({
|
|
|
58236
58236
|
}
|
|
58237
58237
|
}
|
|
58238
58238
|
} else {
|
|
58239
|
-
parts.push(shouldPrintSpaces ? "{ " : "{", (0, lines_1.fromString)(", ").join(path2.map(
|
|
58239
|
+
parts.push(shouldPrintSpaces ? "{ " : "{", (0, lines_1.fromString)(", ").join(path2.map(print4, "specifiers")), shouldPrintSpaces ? " }" : "}");
|
|
58240
58240
|
}
|
|
58241
58241
|
if (decl.source) {
|
|
58242
|
-
parts.push(" from ", path2.call(
|
|
58242
|
+
parts.push(" from ", path2.call(print4, "source"), maybePrintImportAssertions(path2, options, print4));
|
|
58243
58243
|
}
|
|
58244
58244
|
}
|
|
58245
58245
|
var lines = (0, lines_1.concat)(parts);
|
|
@@ -58257,7 +58257,7 @@ var require_printer2 = __commonJS({
|
|
|
58257
58257
|
}
|
|
58258
58258
|
return (0, lines_1.concat)(parts);
|
|
58259
58259
|
}
|
|
58260
|
-
function printVariance(path2,
|
|
58260
|
+
function printVariance(path2, print4) {
|
|
58261
58261
|
return path2.call(function(variancePath) {
|
|
58262
58262
|
var value = variancePath.getValue();
|
|
58263
58263
|
if (value) {
|
|
@@ -58267,7 +58267,7 @@ var require_printer2 = __commonJS({
|
|
|
58267
58267
|
if (value === "minus") {
|
|
58268
58268
|
return (0, lines_1.fromString)("-");
|
|
58269
58269
|
}
|
|
58270
|
-
return
|
|
58270
|
+
return print4(variancePath);
|
|
58271
58271
|
}
|
|
58272
58272
|
return (0, lines_1.fromString)("");
|
|
58273
58273
|
}, "variance");
|
|
@@ -58354,10 +58354,10 @@ var require_main2 = __commonJS({
|
|
|
58354
58354
|
Object.defineProperty(exports, "visit", { enumerable: true, get: function() {
|
|
58355
58355
|
return ast_types_1.visit;
|
|
58356
58356
|
} });
|
|
58357
|
-
function
|
|
58357
|
+
function print4(node, options) {
|
|
58358
58358
|
return new printer_1.Printer(options).print(node);
|
|
58359
58359
|
}
|
|
58360
|
-
exports.print =
|
|
58360
|
+
exports.print = print4;
|
|
58361
58361
|
function prettyPrint(node, options) {
|
|
58362
58362
|
return new printer_1.Printer(options).printGenerically(node);
|
|
58363
58363
|
}
|
|
@@ -58381,7 +58381,7 @@ var require_main2 = __commonJS({
|
|
|
58381
58381
|
function runString(code, transformer, options) {
|
|
58382
58382
|
var writeback = options && options.writeback || defaultWriteback;
|
|
58383
58383
|
transformer((0, parser_1.parse)(code, options), function(node) {
|
|
58384
|
-
writeback(
|
|
58384
|
+
writeback(print4(node, options).code);
|
|
58385
58385
|
});
|
|
58386
58386
|
}
|
|
58387
58387
|
}
|
|
@@ -63936,8 +63936,8 @@ function getRootType(type) {
|
|
|
63936
63936
|
function hashDocument({
|
|
63937
63937
|
document
|
|
63938
63938
|
}) {
|
|
63939
|
-
const docString = typeof document === "string" ? document :
|
|
63940
|
-
return import_crypto.default.createHash("sha256").update(docString).digest("hex");
|
|
63939
|
+
const docString = typeof document === "string" ? document : document.artifact?.raw;
|
|
63940
|
+
return import_crypto.default.createHash("sha256").update(docString ?? "").digest("hex");
|
|
63941
63941
|
}
|
|
63942
63942
|
function parentTypeFromAncestors(schema, filepath, ancestors) {
|
|
63943
63943
|
const parents = [...ancestors];
|