houdini 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/cmd-esm/index.js
CHANGED
|
@@ -33069,14 +33069,14 @@ var require_lib6 = __commonJS({
|
|
|
33069
33069
|
super.checkParams(node, false, true);
|
|
33070
33070
|
this.scope.exit();
|
|
33071
33071
|
}
|
|
33072
|
-
forwardNoArrowParamsConversionAt(node,
|
|
33072
|
+
forwardNoArrowParamsConversionAt(node, parse14) {
|
|
33073
33073
|
let result;
|
|
33074
33074
|
if (this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
|
|
33075
33075
|
this.state.noArrowParamsConversionAt.push(this.state.start);
|
|
33076
|
-
result =
|
|
33076
|
+
result = parse14();
|
|
33077
33077
|
this.state.noArrowParamsConversionAt.pop();
|
|
33078
33078
|
} else {
|
|
33079
|
-
result =
|
|
33079
|
+
result = parse14();
|
|
33080
33080
|
}
|
|
33081
33081
|
return result;
|
|
33082
33082
|
}
|
|
@@ -41911,7 +41911,7 @@ var require_lib6 = __commonJS({
|
|
|
41911
41911
|
}
|
|
41912
41912
|
return pluginMap;
|
|
41913
41913
|
}
|
|
41914
|
-
function
|
|
41914
|
+
function parse13(input, options) {
|
|
41915
41915
|
var _options2;
|
|
41916
41916
|
if (((_options2 = options) == null ? void 0 : _options2.sourceType) === "unambiguous") {
|
|
41917
41917
|
options = Object.assign({}, options);
|
|
@@ -41981,7 +41981,7 @@ var require_lib6 = __commonJS({
|
|
|
41981
41981
|
}
|
|
41982
41982
|
return cls;
|
|
41983
41983
|
}
|
|
41984
|
-
exports.parse =
|
|
41984
|
+
exports.parse = parse13;
|
|
41985
41985
|
exports.parseExpression = parseExpression;
|
|
41986
41986
|
exports.tokTypes = tokTypes;
|
|
41987
41987
|
}
|
|
@@ -44256,7 +44256,7 @@ var require_path_visitor = __commonJS({
|
|
|
44256
44256
|
}
|
|
44257
44257
|
return target;
|
|
44258
44258
|
}
|
|
44259
|
-
PathVisitor.visit = function
|
|
44259
|
+
PathVisitor.visit = function visit21(node, methods) {
|
|
44260
44260
|
return PathVisitor.fromMethodsObject(methods).visit(node);
|
|
44261
44261
|
};
|
|
44262
44262
|
var PVp = PathVisitor.prototype;
|
|
@@ -44447,7 +44447,7 @@ var require_path_visitor = __commonJS({
|
|
|
44447
44447
|
this.needToCallTraverse = false;
|
|
44448
44448
|
return visitChildren(path4, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
|
|
44449
44449
|
};
|
|
44450
|
-
sharedContextProtoMethods.visit = function
|
|
44450
|
+
sharedContextProtoMethods.visit = function visit21(path4, newVisitor) {
|
|
44451
44451
|
if (!(this instanceof this.Context)) {
|
|
44452
44452
|
throw new Error("");
|
|
44453
44453
|
}
|
|
@@ -45840,7 +45840,7 @@ var require_main = __commonJS({
|
|
|
45840
45840
|
var someField = _a.someField;
|
|
45841
45841
|
var Type = _a.Type;
|
|
45842
45842
|
var use = _a.use;
|
|
45843
|
-
var
|
|
45843
|
+
var visit21 = _a.visit;
|
|
45844
45844
|
exports.astNodesAreEquivalent = astNodesAreEquivalent;
|
|
45845
45845
|
exports.builders = builders;
|
|
45846
45846
|
exports.builtInTypes = builtInTypes;
|
|
@@ -45857,7 +45857,7 @@ var require_main = __commonJS({
|
|
|
45857
45857
|
exports.someField = someField;
|
|
45858
45858
|
exports.Type = Type;
|
|
45859
45859
|
exports.use = use;
|
|
45860
|
-
exports.visit =
|
|
45860
|
+
exports.visit = visit21;
|
|
45861
45861
|
Object.assign(namedTypes_1.namedTypes, n);
|
|
45862
45862
|
}
|
|
45863
45863
|
});
|
|
@@ -47927,7 +47927,7 @@ var require_esprima2 = __commonJS({
|
|
|
47927
47927
|
var jsx_parser_1 = __webpack_require__(3);
|
|
47928
47928
|
var parser_1 = __webpack_require__(8);
|
|
47929
47929
|
var tokenizer_1 = __webpack_require__(15);
|
|
47930
|
-
function
|
|
47930
|
+
function parse13(code, options, delegate) {
|
|
47931
47931
|
var commentHandler = null;
|
|
47932
47932
|
var proxyDelegate = function(node, metadata) {
|
|
47933
47933
|
if (delegate) {
|
|
@@ -47972,17 +47972,17 @@ var require_esprima2 = __commonJS({
|
|
|
47972
47972
|
}
|
|
47973
47973
|
return ast;
|
|
47974
47974
|
}
|
|
47975
|
-
exports2.parse =
|
|
47975
|
+
exports2.parse = parse13;
|
|
47976
47976
|
function parseModule(code, options, delegate) {
|
|
47977
47977
|
var parsingOptions = options || {};
|
|
47978
47978
|
parsingOptions.sourceType = "module";
|
|
47979
|
-
return
|
|
47979
|
+
return parse13(code, parsingOptions, delegate);
|
|
47980
47980
|
}
|
|
47981
47981
|
exports2.parseModule = parseModule;
|
|
47982
47982
|
function parseScript(code, options, delegate) {
|
|
47983
47983
|
var parsingOptions = options || {};
|
|
47984
47984
|
parsingOptions.sourceType = "script";
|
|
47985
|
-
return
|
|
47985
|
+
return parse13(code, parsingOptions, delegate);
|
|
47986
47986
|
}
|
|
47987
47987
|
exports2.parseScript = parseScript;
|
|
47988
47988
|
function tokenize(code, options, delegate) {
|
|
@@ -54046,7 +54046,7 @@ var require_esprima3 = __commonJS({
|
|
|
54046
54046
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54047
54047
|
exports.parse = void 0;
|
|
54048
54048
|
var util_1 = require_util2();
|
|
54049
|
-
function
|
|
54049
|
+
function parse13(source, options) {
|
|
54050
54050
|
var comments = [];
|
|
54051
54051
|
var ast = require_esprima2().parse(source, {
|
|
54052
54052
|
loc: true,
|
|
@@ -54064,7 +54064,7 @@ var require_esprima3 = __commonJS({
|
|
|
54064
54064
|
}
|
|
54065
54065
|
return ast;
|
|
54066
54066
|
}
|
|
54067
|
-
exports.parse =
|
|
54067
|
+
exports.parse = parse13;
|
|
54068
54068
|
}
|
|
54069
54069
|
});
|
|
54070
54070
|
|
|
@@ -55106,12 +55106,12 @@ var require_comments = __commonJS({
|
|
|
55106
55106
|
comment.trailing = true;
|
|
55107
55107
|
addCommentHelper(node, comment);
|
|
55108
55108
|
}
|
|
55109
|
-
function printLeadingComment(commentPath,
|
|
55109
|
+
function printLeadingComment(commentPath, print14) {
|
|
55110
55110
|
var comment = commentPath.getValue();
|
|
55111
55111
|
n.Comment.assert(comment);
|
|
55112
55112
|
var loc = comment.loc;
|
|
55113
55113
|
var lines = loc && loc.lines;
|
|
55114
|
-
var parts = [
|
|
55114
|
+
var parts = [print14(commentPath)];
|
|
55115
55115
|
if (comment.trailing) {
|
|
55116
55116
|
parts.push("\n");
|
|
55117
55117
|
} else if (lines instanceof lines_1.Lines) {
|
|
@@ -55126,7 +55126,7 @@ var require_comments = __commonJS({
|
|
|
55126
55126
|
}
|
|
55127
55127
|
return (0, lines_1.concat)(parts);
|
|
55128
55128
|
}
|
|
55129
|
-
function printTrailingComment(commentPath,
|
|
55129
|
+
function printTrailingComment(commentPath, print14) {
|
|
55130
55130
|
var comment = commentPath.getValue(commentPath);
|
|
55131
55131
|
n.Comment.assert(comment);
|
|
55132
55132
|
var loc = comment.loc;
|
|
@@ -55141,12 +55141,12 @@ var require_comments = __commonJS({
|
|
|
55141
55141
|
parts.push(new Array(leadingSpace.length).join("\n"));
|
|
55142
55142
|
}
|
|
55143
55143
|
}
|
|
55144
|
-
parts.push(
|
|
55144
|
+
parts.push(print14(commentPath));
|
|
55145
55145
|
return (0, lines_1.concat)(parts);
|
|
55146
55146
|
}
|
|
55147
|
-
function printComments(path4,
|
|
55147
|
+
function printComments(path4, print14) {
|
|
55148
55148
|
var value = path4.getValue();
|
|
55149
|
-
var innerLines =
|
|
55149
|
+
var innerLines = print14(path4);
|
|
55150
55150
|
var comments = n.Node.check(value) && types17.getFieldValue(value, "comments");
|
|
55151
55151
|
if (!comments || comments.length === 0) {
|
|
55152
55152
|
return innerLines;
|
|
@@ -55158,9 +55158,9 @@ var require_comments = __commonJS({
|
|
|
55158
55158
|
var leading = types17.getFieldValue(comment, "leading");
|
|
55159
55159
|
var trailing = types17.getFieldValue(comment, "trailing");
|
|
55160
55160
|
if (leading || trailing && !(n.Statement.check(value) || comment.type === "Block" || comment.type === "CommentBlock")) {
|
|
55161
|
-
leadingParts.push(printLeadingComment(commentPath,
|
|
55161
|
+
leadingParts.push(printLeadingComment(commentPath, print14));
|
|
55162
55162
|
} else if (trailing) {
|
|
55163
|
-
trailingParts.push(printTrailingComment(commentPath,
|
|
55163
|
+
trailingParts.push(printTrailingComment(commentPath, print14));
|
|
55164
55164
|
}
|
|
55165
55165
|
}, "comments");
|
|
55166
55166
|
leadingParts.push.apply(leadingParts, trailingParts);
|
|
@@ -55186,7 +55186,7 @@ var require_parser = __commonJS({
|
|
|
55186
55186
|
var lines_1 = require_lines();
|
|
55187
55187
|
var comments_1 = require_comments();
|
|
55188
55188
|
var util = tslib_1.__importStar(require_util2());
|
|
55189
|
-
function
|
|
55189
|
+
function parse13(source, options) {
|
|
55190
55190
|
options = (0, options_1.normalize)(options);
|
|
55191
55191
|
var lines = (0, lines_1.fromString)(source, options);
|
|
55192
55192
|
var sourceWithoutTabs = lines.toString({
|
|
@@ -55258,7 +55258,7 @@ var require_parser = __commonJS({
|
|
|
55258
55258
|
(0, comments_1.attach)(comments, program3.body.length ? file.program : file, lines);
|
|
55259
55259
|
return new TreeCopier(lines, tokens).copy(file);
|
|
55260
55260
|
}
|
|
55261
|
-
exports.parse =
|
|
55261
|
+
exports.parse = parse13;
|
|
55262
55262
|
var TreeCopier = function TreeCopier2(lines, tokens) {
|
|
55263
55263
|
assert_1.default.ok(this instanceof TreeCopier2);
|
|
55264
55264
|
this.lines = lines;
|
|
@@ -55851,7 +55851,7 @@ var require_patcher = __commonJS({
|
|
|
55851
55851
|
};
|
|
55852
55852
|
exports.Patcher = Patcher;
|
|
55853
55853
|
var Pp = Patcher.prototype;
|
|
55854
|
-
Pp.tryToReprintComments = function(newNode, oldNode,
|
|
55854
|
+
Pp.tryToReprintComments = function(newNode, oldNode, print14) {
|
|
55855
55855
|
var patcher = this;
|
|
55856
55856
|
if (!newNode.comments && !oldNode.comments) {
|
|
55857
55857
|
return true;
|
|
@@ -55868,7 +55868,7 @@ var require_patcher = __commonJS({
|
|
|
55868
55868
|
assert_1.default.ok(oldComment.leading || oldComment.trailing);
|
|
55869
55869
|
patcher.replace(
|
|
55870
55870
|
oldComment.loc,
|
|
55871
|
-
|
|
55871
|
+
print14(reprint.newPath).indentTail(oldComment.loc.indent)
|
|
55872
55872
|
);
|
|
55873
55873
|
});
|
|
55874
55874
|
}
|
|
@@ -55915,17 +55915,17 @@ var require_patcher = __commonJS({
|
|
|
55915
55915
|
var reprints = [];
|
|
55916
55916
|
if (!lines || !findReprints(path4, reprints))
|
|
55917
55917
|
return;
|
|
55918
|
-
return function(
|
|
55918
|
+
return function(print14) {
|
|
55919
55919
|
var patcher = new Patcher(lines);
|
|
55920
55920
|
reprints.forEach(function(reprint) {
|
|
55921
55921
|
var newNode = reprint.newPath.getValue();
|
|
55922
55922
|
var oldNode = reprint.oldPath.getValue();
|
|
55923
55923
|
SourceLocation.assert(oldNode.loc, true);
|
|
55924
|
-
var needToPrintNewPathWithComments = !patcher.tryToReprintComments(newNode, oldNode,
|
|
55924
|
+
var needToPrintNewPathWithComments = !patcher.tryToReprintComments(newNode, oldNode, print14);
|
|
55925
55925
|
if (needToPrintNewPathWithComments) {
|
|
55926
55926
|
patcher.deleteComments(oldNode);
|
|
55927
55927
|
}
|
|
55928
|
-
var newLines =
|
|
55928
|
+
var newLines = print14(reprint.newPath, {
|
|
55929
55929
|
includeComments: needToPrintNewPathWithComments,
|
|
55930
55930
|
avoidRootParens: oldNode.type === newNode.type && reprint.oldPath.hasParens()
|
|
55931
55931
|
}).indentTail(oldNode.loc.indent);
|
|
@@ -56142,10 +56142,10 @@ var require_printer = __commonJS({
|
|
|
56142
56142
|
function makePrintFunctionWith(options, overrides) {
|
|
56143
56143
|
options = Object.assign({}, options, overrides);
|
|
56144
56144
|
return function(path4) {
|
|
56145
|
-
return
|
|
56145
|
+
return print14(path4, options);
|
|
56146
56146
|
};
|
|
56147
56147
|
}
|
|
56148
|
-
function
|
|
56148
|
+
function print14(path4, options) {
|
|
56149
56149
|
assert_1.default.ok(path4 instanceof fast_path_1.default);
|
|
56150
56150
|
options = options || {};
|
|
56151
56151
|
if (options.includeComments) {
|
|
@@ -56161,7 +56161,7 @@ var require_printer = __commonJS({
|
|
|
56161
56161
|
}
|
|
56162
56162
|
}
|
|
56163
56163
|
var reprinter = (0, patcher_1.getReprinter)(path4);
|
|
56164
|
-
var lines = reprinter ? reprinter(
|
|
56164
|
+
var lines = reprinter ? reprinter(print14) : genericPrint(path4, config, options, makePrintFunctionWith(options, {
|
|
56165
56165
|
includeComments: true,
|
|
56166
56166
|
avoidRootParens: false
|
|
56167
56167
|
}));
|
|
@@ -56172,7 +56172,7 @@ var require_printer = __commonJS({
|
|
|
56172
56172
|
if (!ast) {
|
|
56173
56173
|
return emptyPrintResult;
|
|
56174
56174
|
}
|
|
56175
|
-
var lines =
|
|
56175
|
+
var lines = print14(fast_path_1.default.from(ast), {
|
|
56176
56176
|
includeComments: true,
|
|
56177
56177
|
avoidRootParens: false
|
|
56178
56178
|
});
|
|
@@ -56225,7 +56225,7 @@ var require_printer = __commonJS({
|
|
|
56225
56225
|
}
|
|
56226
56226
|
return (0, lines_1.concat)(parts);
|
|
56227
56227
|
}
|
|
56228
|
-
function genericPrintNoParens(path4, options,
|
|
56228
|
+
function genericPrintNoParens(path4, options, print14) {
|
|
56229
56229
|
var n = path4.getValue();
|
|
56230
56230
|
if (!n) {
|
|
56231
56231
|
return (0, lines_1.fromString)("");
|
|
@@ -56237,45 +56237,45 @@ var require_printer = __commonJS({
|
|
|
56237
56237
|
var parts = [];
|
|
56238
56238
|
switch (n.type) {
|
|
56239
56239
|
case "File":
|
|
56240
|
-
return path4.call(
|
|
56240
|
+
return path4.call(print14, "program");
|
|
56241
56241
|
case "Program":
|
|
56242
56242
|
if (n.directives) {
|
|
56243
56243
|
path4.each(function(childPath) {
|
|
56244
|
-
parts.push(
|
|
56244
|
+
parts.push(print14(childPath), ";\n");
|
|
56245
56245
|
}, "directives");
|
|
56246
56246
|
}
|
|
56247
56247
|
if (n.interpreter) {
|
|
56248
|
-
parts.push(path4.call(
|
|
56248
|
+
parts.push(path4.call(print14, "interpreter"));
|
|
56249
56249
|
}
|
|
56250
56250
|
parts.push(path4.call(function(bodyPath) {
|
|
56251
|
-
return printStatementSequence(bodyPath, options,
|
|
56251
|
+
return printStatementSequence(bodyPath, options, print14);
|
|
56252
56252
|
}, "body"));
|
|
56253
56253
|
return (0, lines_1.concat)(parts);
|
|
56254
56254
|
case "Noop":
|
|
56255
56255
|
case "EmptyStatement":
|
|
56256
56256
|
return (0, lines_1.fromString)("");
|
|
56257
56257
|
case "ExpressionStatement":
|
|
56258
|
-
return (0, lines_1.concat)([path4.call(
|
|
56258
|
+
return (0, lines_1.concat)([path4.call(print14, "expression"), ";"]);
|
|
56259
56259
|
case "ParenthesizedExpression":
|
|
56260
|
-
return (0, lines_1.concat)(["(", path4.call(
|
|
56260
|
+
return (0, lines_1.concat)(["(", path4.call(print14, "expression"), ")"]);
|
|
56261
56261
|
case "BinaryExpression":
|
|
56262
56262
|
case "LogicalExpression":
|
|
56263
56263
|
case "AssignmentExpression":
|
|
56264
56264
|
return (0, lines_1.fromString)(" ").join([
|
|
56265
|
-
path4.call(
|
|
56265
|
+
path4.call(print14, "left"),
|
|
56266
56266
|
n.operator,
|
|
56267
|
-
path4.call(
|
|
56267
|
+
path4.call(print14, "right")
|
|
56268
56268
|
]);
|
|
56269
56269
|
case "AssignmentPattern":
|
|
56270
56270
|
return (0, lines_1.concat)([
|
|
56271
|
-
path4.call(
|
|
56271
|
+
path4.call(print14, "left"),
|
|
56272
56272
|
" = ",
|
|
56273
|
-
path4.call(
|
|
56273
|
+
path4.call(print14, "right")
|
|
56274
56274
|
]);
|
|
56275
56275
|
case "MemberExpression":
|
|
56276
56276
|
case "OptionalMemberExpression": {
|
|
56277
|
-
parts.push(path4.call(
|
|
56278
|
-
var property = path4.call(
|
|
56277
|
+
parts.push(path4.call(print14, "object"));
|
|
56278
|
+
var property = path4.call(print14, "property");
|
|
56279
56279
|
var optional = types17.getFieldValue(n, "optional");
|
|
56280
56280
|
if (n.computed) {
|
|
56281
56281
|
parts.push(optional ? "?.[" : "[", property, "]");
|
|
@@ -56285,18 +56285,18 @@ var require_printer = __commonJS({
|
|
|
56285
56285
|
return (0, lines_1.concat)(parts);
|
|
56286
56286
|
}
|
|
56287
56287
|
case "ChainExpression":
|
|
56288
|
-
return path4.call(
|
|
56288
|
+
return path4.call(print14, "expression");
|
|
56289
56289
|
case "MetaProperty":
|
|
56290
56290
|
return (0, lines_1.concat)([
|
|
56291
|
-
path4.call(
|
|
56291
|
+
path4.call(print14, "meta"),
|
|
56292
56292
|
".",
|
|
56293
|
-
path4.call(
|
|
56293
|
+
path4.call(print14, "property")
|
|
56294
56294
|
]);
|
|
56295
56295
|
case "BindExpression":
|
|
56296
56296
|
if (n.object) {
|
|
56297
|
-
parts.push(path4.call(
|
|
56297
|
+
parts.push(path4.call(print14, "object"));
|
|
56298
56298
|
}
|
|
56299
|
-
parts.push("::", path4.call(
|
|
56299
|
+
parts.push("::", path4.call(print14, "callee"));
|
|
56300
56300
|
return (0, lines_1.concat)(parts);
|
|
56301
56301
|
case "Path":
|
|
56302
56302
|
return (0, lines_1.fromString)(".").join(n.body);
|
|
@@ -56304,7 +56304,7 @@ var require_printer = __commonJS({
|
|
|
56304
56304
|
return (0, lines_1.concat)([
|
|
56305
56305
|
(0, lines_1.fromString)(n.name, options),
|
|
56306
56306
|
n.optional ? "?" : "",
|
|
56307
|
-
path4.call(
|
|
56307
|
+
path4.call(print14, "typeAnnotation")
|
|
56308
56308
|
]);
|
|
56309
56309
|
case "SpreadElement":
|
|
56310
56310
|
case "SpreadElementPattern":
|
|
@@ -56315,8 +56315,8 @@ var require_printer = __commonJS({
|
|
|
56315
56315
|
case "RestElement":
|
|
56316
56316
|
return (0, lines_1.concat)([
|
|
56317
56317
|
"...",
|
|
56318
|
-
path4.call(
|
|
56319
|
-
path4.call(
|
|
56318
|
+
path4.call(print14, "argument"),
|
|
56319
|
+
path4.call(print14, "typeAnnotation")
|
|
56320
56320
|
]);
|
|
56321
56321
|
case "FunctionDeclaration":
|
|
56322
56322
|
case "FunctionExpression":
|
|
@@ -56331,15 +56331,15 @@ var require_printer = __commonJS({
|
|
|
56331
56331
|
if (n.generator)
|
|
56332
56332
|
parts.push("*");
|
|
56333
56333
|
if (n.id) {
|
|
56334
|
-
parts.push(" ", path4.call(
|
|
56334
|
+
parts.push(" ", path4.call(print14, "id"), path4.call(print14, "typeParameters"));
|
|
56335
56335
|
} else {
|
|
56336
56336
|
if (n.typeParameters) {
|
|
56337
|
-
parts.push(path4.call(
|
|
56337
|
+
parts.push(path4.call(print14, "typeParameters"));
|
|
56338
56338
|
}
|
|
56339
56339
|
}
|
|
56340
|
-
parts.push("(", printFunctionParams(path4, options,
|
|
56340
|
+
parts.push("(", printFunctionParams(path4, options, print14), ")", path4.call(print14, "returnType"));
|
|
56341
56341
|
if (n.body) {
|
|
56342
|
-
parts.push(" ", path4.call(
|
|
56342
|
+
parts.push(" ", path4.call(print14, "body"));
|
|
56343
56343
|
}
|
|
56344
56344
|
return (0, lines_1.concat)(parts);
|
|
56345
56345
|
case "ArrowFunctionExpression":
|
|
@@ -56347,44 +56347,44 @@ var require_printer = __commonJS({
|
|
|
56347
56347
|
parts.push("async ");
|
|
56348
56348
|
}
|
|
56349
56349
|
if (n.typeParameters) {
|
|
56350
|
-
parts.push(path4.call(
|
|
56350
|
+
parts.push(path4.call(print14, "typeParameters"));
|
|
56351
56351
|
}
|
|
56352
56352
|
if (!options.arrowParensAlways && n.params.length === 1 && !n.rest && n.params[0].type === "Identifier" && !n.params[0].typeAnnotation && !n.returnType) {
|
|
56353
|
-
parts.push(path4.call(
|
|
56353
|
+
parts.push(path4.call(print14, "params", 0));
|
|
56354
56354
|
} else {
|
|
56355
|
-
parts.push("(", printFunctionParams(path4, options,
|
|
56355
|
+
parts.push("(", printFunctionParams(path4, options, print14), ")", path4.call(print14, "returnType"));
|
|
56356
56356
|
}
|
|
56357
|
-
parts.push(" => ", path4.call(
|
|
56357
|
+
parts.push(" => ", path4.call(print14, "body"));
|
|
56358
56358
|
return (0, lines_1.concat)(parts);
|
|
56359
56359
|
case "MethodDefinition":
|
|
56360
|
-
return printMethod(path4, options,
|
|
56360
|
+
return printMethod(path4, options, print14);
|
|
56361
56361
|
case "YieldExpression":
|
|
56362
56362
|
parts.push("yield");
|
|
56363
56363
|
if (n.delegate)
|
|
56364
56364
|
parts.push("*");
|
|
56365
56365
|
if (n.argument)
|
|
56366
|
-
parts.push(" ", path4.call(
|
|
56366
|
+
parts.push(" ", path4.call(print14, "argument"));
|
|
56367
56367
|
return (0, lines_1.concat)(parts);
|
|
56368
56368
|
case "AwaitExpression":
|
|
56369
56369
|
parts.push("await");
|
|
56370
56370
|
if (n.all)
|
|
56371
56371
|
parts.push("*");
|
|
56372
56372
|
if (n.argument)
|
|
56373
|
-
parts.push(" ", path4.call(
|
|
56373
|
+
parts.push(" ", path4.call(print14, "argument"));
|
|
56374
56374
|
return (0, lines_1.concat)(parts);
|
|
56375
56375
|
case "ModuleExpression":
|
|
56376
56376
|
return (0, lines_1.concat)([
|
|
56377
56377
|
"module {\n",
|
|
56378
|
-
path4.call(
|
|
56378
|
+
path4.call(print14, "body").indent(options.tabWidth),
|
|
56379
56379
|
"\n}"
|
|
56380
56380
|
]);
|
|
56381
56381
|
case "ModuleDeclaration":
|
|
56382
|
-
parts.push("module", path4.call(
|
|
56382
|
+
parts.push("module", path4.call(print14, "id"));
|
|
56383
56383
|
if (n.source) {
|
|
56384
56384
|
assert_1.default.ok(!n.body);
|
|
56385
|
-
parts.push("from", path4.call(
|
|
56385
|
+
parts.push("from", path4.call(print14, "source"));
|
|
56386
56386
|
} else {
|
|
56387
|
-
parts.push(path4.call(
|
|
56387
|
+
parts.push(path4.call(print14, "body"));
|
|
56388
56388
|
}
|
|
56389
56389
|
return (0, lines_1.fromString)(" ").join(parts);
|
|
56390
56390
|
case "ImportSpecifier":
|
|
@@ -56392,27 +56392,27 @@ var require_printer = __commonJS({
|
|
|
56392
56392
|
parts.push(n.importKind + " ");
|
|
56393
56393
|
}
|
|
56394
56394
|
if (n.imported) {
|
|
56395
|
-
parts.push(path4.call(
|
|
56395
|
+
parts.push(path4.call(print14, "imported"));
|
|
56396
56396
|
if (n.local && n.local.name !== n.imported.name) {
|
|
56397
|
-
parts.push(" as ", path4.call(
|
|
56397
|
+
parts.push(" as ", path4.call(print14, "local"));
|
|
56398
56398
|
}
|
|
56399
56399
|
} else if (n.id) {
|
|
56400
|
-
parts.push(path4.call(
|
|
56400
|
+
parts.push(path4.call(print14, "id"));
|
|
56401
56401
|
if (n.name) {
|
|
56402
|
-
parts.push(" as ", path4.call(
|
|
56402
|
+
parts.push(" as ", path4.call(print14, "name"));
|
|
56403
56403
|
}
|
|
56404
56404
|
}
|
|
56405
56405
|
return (0, lines_1.concat)(parts);
|
|
56406
56406
|
case "ExportSpecifier":
|
|
56407
56407
|
if (n.local) {
|
|
56408
|
-
parts.push(path4.call(
|
|
56408
|
+
parts.push(path4.call(print14, "local"));
|
|
56409
56409
|
if (n.exported && n.exported.name !== n.local.name) {
|
|
56410
|
-
parts.push(" as ", path4.call(
|
|
56410
|
+
parts.push(" as ", path4.call(print14, "exported"));
|
|
56411
56411
|
}
|
|
56412
56412
|
} else if (n.id) {
|
|
56413
|
-
parts.push(path4.call(
|
|
56413
|
+
parts.push(path4.call(print14, "id"));
|
|
56414
56414
|
if (n.name) {
|
|
56415
|
-
parts.push(" as ", path4.call(
|
|
56415
|
+
parts.push(" as ", path4.call(print14, "name"));
|
|
56416
56416
|
}
|
|
56417
56417
|
}
|
|
56418
56418
|
return (0, lines_1.concat)(parts);
|
|
@@ -56421,40 +56421,40 @@ var require_printer = __commonJS({
|
|
|
56421
56421
|
case "ImportNamespaceSpecifier":
|
|
56422
56422
|
parts.push("* as ");
|
|
56423
56423
|
if (n.local) {
|
|
56424
|
-
parts.push(path4.call(
|
|
56424
|
+
parts.push(path4.call(print14, "local"));
|
|
56425
56425
|
} else if (n.id) {
|
|
56426
|
-
parts.push(path4.call(
|
|
56426
|
+
parts.push(path4.call(print14, "id"));
|
|
56427
56427
|
}
|
|
56428
56428
|
return (0, lines_1.concat)(parts);
|
|
56429
56429
|
case "ImportDefaultSpecifier":
|
|
56430
56430
|
if (n.local) {
|
|
56431
|
-
return path4.call(
|
|
56431
|
+
return path4.call(print14, "local");
|
|
56432
56432
|
}
|
|
56433
|
-
return path4.call(
|
|
56433
|
+
return path4.call(print14, "id");
|
|
56434
56434
|
case "TSExportAssignment":
|
|
56435
|
-
return (0, lines_1.concat)(["export = ", path4.call(
|
|
56435
|
+
return (0, lines_1.concat)(["export = ", path4.call(print14, "expression")]);
|
|
56436
56436
|
case "ExportDeclaration":
|
|
56437
56437
|
case "ExportDefaultDeclaration":
|
|
56438
56438
|
case "ExportNamedDeclaration":
|
|
56439
|
-
return printExportDeclaration(path4, options,
|
|
56439
|
+
return printExportDeclaration(path4, options, print14);
|
|
56440
56440
|
case "ExportAllDeclaration":
|
|
56441
56441
|
parts.push("export *");
|
|
56442
56442
|
if (n.exported) {
|
|
56443
|
-
parts.push(" as ", path4.call(
|
|
56443
|
+
parts.push(" as ", path4.call(print14, "exported"));
|
|
56444
56444
|
}
|
|
56445
|
-
parts.push(" from ", path4.call(
|
|
56445
|
+
parts.push(" from ", path4.call(print14, "source"), ";");
|
|
56446
56446
|
return (0, lines_1.concat)(parts);
|
|
56447
56447
|
case "TSNamespaceExportDeclaration":
|
|
56448
|
-
parts.push("export as namespace ", path4.call(
|
|
56448
|
+
parts.push("export as namespace ", path4.call(print14, "id"));
|
|
56449
56449
|
return maybeAddSemicolon((0, lines_1.concat)(parts));
|
|
56450
56450
|
case "ExportNamespaceSpecifier":
|
|
56451
|
-
return (0, lines_1.concat)(["* as ", path4.call(
|
|
56451
|
+
return (0, lines_1.concat)(["* as ", path4.call(print14, "exported")]);
|
|
56452
56452
|
case "ExportDefaultSpecifier":
|
|
56453
|
-
return path4.call(
|
|
56453
|
+
return path4.call(print14, "exported");
|
|
56454
56454
|
case "Import":
|
|
56455
56455
|
return (0, lines_1.fromString)("import", options);
|
|
56456
56456
|
case "ImportExpression":
|
|
56457
|
-
return (0, lines_1.concat)(["import(", path4.call(
|
|
56457
|
+
return (0, lines_1.concat)(["import(", path4.call(print14, "source"), ")"]);
|
|
56458
56458
|
case "ImportDeclaration": {
|
|
56459
56459
|
parts.push("import ");
|
|
56460
56460
|
if (n.importKind && n.importKind !== "value") {
|
|
@@ -56466,9 +56466,9 @@ var require_printer = __commonJS({
|
|
|
56466
56466
|
path4.each(function(specifierPath) {
|
|
56467
56467
|
var spec = specifierPath.getValue();
|
|
56468
56468
|
if (spec.type === "ImportSpecifier") {
|
|
56469
|
-
bracedSpecifiers_1.push(
|
|
56469
|
+
bracedSpecifiers_1.push(print14(specifierPath));
|
|
56470
56470
|
} else if (spec.type === "ImportDefaultSpecifier" || spec.type === "ImportNamespaceSpecifier") {
|
|
56471
|
-
unbracedSpecifiers_1.push(
|
|
56471
|
+
unbracedSpecifiers_1.push(print14(specifierPath));
|
|
56472
56472
|
}
|
|
56473
56473
|
}, "specifiers");
|
|
56474
56474
|
unbracedSpecifiers_1.forEach(function(lines2, i2) {
|
|
@@ -56498,16 +56498,16 @@ var require_printer = __commonJS({
|
|
|
56498
56498
|
}
|
|
56499
56499
|
parts.push(" from ");
|
|
56500
56500
|
}
|
|
56501
|
-
parts.push(path4.call(
|
|
56501
|
+
parts.push(path4.call(print14, "source"), maybePrintImportAssertions(path4, options, print14), ";");
|
|
56502
56502
|
return (0, lines_1.concat)(parts);
|
|
56503
56503
|
}
|
|
56504
56504
|
case "ImportAttribute":
|
|
56505
|
-
return (0, lines_1.concat)([path4.call(
|
|
56505
|
+
return (0, lines_1.concat)([path4.call(print14, "key"), ": ", path4.call(print14, "value")]);
|
|
56506
56506
|
case "StaticBlock":
|
|
56507
56507
|
parts.push("static ");
|
|
56508
56508
|
case "BlockStatement": {
|
|
56509
56509
|
var naked_1 = path4.call(function(bodyPath) {
|
|
56510
|
-
return printStatementSequence(bodyPath, options,
|
|
56510
|
+
return printStatementSequence(bodyPath, options, print14);
|
|
56511
56511
|
}, "body");
|
|
56512
56512
|
if (naked_1.isEmpty()) {
|
|
56513
56513
|
if (!n.directives || n.directives.length === 0) {
|
|
@@ -56518,7 +56518,7 @@ var require_printer = __commonJS({
|
|
|
56518
56518
|
parts.push("{\n");
|
|
56519
56519
|
if (n.directives) {
|
|
56520
56520
|
path4.each(function(childPath) {
|
|
56521
|
-
parts.push(maybeAddSemicolon(
|
|
56521
|
+
parts.push(maybeAddSemicolon(print14(childPath).indent(options.tabWidth)), n.directives.length > 1 || !naked_1.isEmpty() ? "\n" : "");
|
|
56522
56522
|
}, "directives");
|
|
56523
56523
|
}
|
|
56524
56524
|
parts.push(naked_1.indent(options.tabWidth));
|
|
@@ -56528,7 +56528,7 @@ var require_printer = __commonJS({
|
|
|
56528
56528
|
case "ReturnStatement": {
|
|
56529
56529
|
parts.push("return");
|
|
56530
56530
|
if (n.argument) {
|
|
56531
|
-
var argLines = path4.call(
|
|
56531
|
+
var argLines = path4.call(print14, "argument");
|
|
56532
56532
|
if (argLines.startsWithComment() || argLines.length > 1 && namedTypes.JSXElement && namedTypes.JSXElement.check(n.argument)) {
|
|
56533
56533
|
parts.push(" (\n", argLines.indent(options.tabWidth), "\n)");
|
|
56534
56534
|
} else {
|
|
@@ -56540,17 +56540,17 @@ var require_printer = __commonJS({
|
|
|
56540
56540
|
}
|
|
56541
56541
|
case "CallExpression":
|
|
56542
56542
|
case "OptionalCallExpression":
|
|
56543
|
-
parts.push(path4.call(
|
|
56543
|
+
parts.push(path4.call(print14, "callee"));
|
|
56544
56544
|
if (n.typeParameters) {
|
|
56545
|
-
parts.push(path4.call(
|
|
56545
|
+
parts.push(path4.call(print14, "typeParameters"));
|
|
56546
56546
|
}
|
|
56547
56547
|
if (n.typeArguments) {
|
|
56548
|
-
parts.push(path4.call(
|
|
56548
|
+
parts.push(path4.call(print14, "typeArguments"));
|
|
56549
56549
|
}
|
|
56550
56550
|
if (types17.getFieldValue(n, "optional")) {
|
|
56551
56551
|
parts.push("?.");
|
|
56552
56552
|
}
|
|
56553
|
-
parts.push(printArgumentsList(path4, options,
|
|
56553
|
+
parts.push(printArgumentsList(path4, options, print14));
|
|
56554
56554
|
return (0, lines_1.concat)(parts);
|
|
56555
56555
|
case "RecordExpression":
|
|
56556
56556
|
parts.push("#");
|
|
@@ -56580,7 +56580,7 @@ var require_printer = __commonJS({
|
|
|
56580
56580
|
var i_1 = 0;
|
|
56581
56581
|
fields.forEach(function(field) {
|
|
56582
56582
|
path4.each(function(childPath) {
|
|
56583
|
-
var lines2 =
|
|
56583
|
+
var lines2 = print14(childPath);
|
|
56584
56584
|
if (!oneLine_1) {
|
|
56585
56585
|
lines2 = lines2.indent(options.tabWidth);
|
|
56586
56586
|
}
|
|
@@ -56617,32 +56617,32 @@ var require_printer = __commonJS({
|
|
|
56617
56617
|
parts[parts.length - 1] = " " + rightBrace;
|
|
56618
56618
|
}
|
|
56619
56619
|
if (n.typeAnnotation) {
|
|
56620
|
-
parts.push(path4.call(
|
|
56620
|
+
parts.push(path4.call(print14, "typeAnnotation"));
|
|
56621
56621
|
}
|
|
56622
56622
|
return (0, lines_1.concat)(parts);
|
|
56623
56623
|
}
|
|
56624
56624
|
case "PropertyPattern":
|
|
56625
56625
|
return (0, lines_1.concat)([
|
|
56626
|
-
path4.call(
|
|
56626
|
+
path4.call(print14, "key"),
|
|
56627
56627
|
": ",
|
|
56628
|
-
path4.call(
|
|
56628
|
+
path4.call(print14, "pattern")
|
|
56629
56629
|
]);
|
|
56630
56630
|
case "ObjectProperty":
|
|
56631
56631
|
case "Property": {
|
|
56632
56632
|
if (n.method || n.kind === "get" || n.kind === "set") {
|
|
56633
|
-
return printMethod(path4, options,
|
|
56633
|
+
return printMethod(path4, options, print14);
|
|
56634
56634
|
}
|
|
56635
56635
|
if (n.shorthand && n.value.type === "AssignmentPattern") {
|
|
56636
|
-
return path4.call(
|
|
56636
|
+
return path4.call(print14, "value");
|
|
56637
56637
|
}
|
|
56638
|
-
var key = path4.call(
|
|
56638
|
+
var key = path4.call(print14, "key");
|
|
56639
56639
|
if (n.computed) {
|
|
56640
56640
|
parts.push("[", key, "]");
|
|
56641
56641
|
} else {
|
|
56642
56642
|
parts.push(key);
|
|
56643
56643
|
}
|
|
56644
56644
|
if (!n.shorthand || n.key.name !== n.value.name) {
|
|
56645
|
-
parts.push(": ", path4.call(
|
|
56645
|
+
parts.push(": ", path4.call(print14, "value"));
|
|
56646
56646
|
}
|
|
56647
56647
|
return (0, lines_1.concat)(parts);
|
|
56648
56648
|
}
|
|
@@ -56650,18 +56650,18 @@ var require_printer = __commonJS({
|
|
|
56650
56650
|
case "ObjectMethod":
|
|
56651
56651
|
case "ClassPrivateMethod":
|
|
56652
56652
|
case "TSDeclareMethod":
|
|
56653
|
-
return printMethod(path4, options,
|
|
56653
|
+
return printMethod(path4, options, print14);
|
|
56654
56654
|
case "PrivateName":
|
|
56655
|
-
return (0, lines_1.concat)(["#", path4.call(
|
|
56655
|
+
return (0, lines_1.concat)(["#", path4.call(print14, "id")]);
|
|
56656
56656
|
case "Decorator":
|
|
56657
|
-
return (0, lines_1.concat)(["@", path4.call(
|
|
56657
|
+
return (0, lines_1.concat)(["@", path4.call(print14, "expression")]);
|
|
56658
56658
|
case "TupleExpression":
|
|
56659
56659
|
parts.push("#");
|
|
56660
56660
|
case "ArrayExpression":
|
|
56661
56661
|
case "ArrayPattern": {
|
|
56662
56662
|
var elems = n.elements;
|
|
56663
56663
|
var len_2 = elems.length;
|
|
56664
|
-
var printed_1 = path4.map(
|
|
56664
|
+
var printed_1 = path4.map(print14, "elements");
|
|
56665
56665
|
var joined = (0, lines_1.fromString)(", ").join(printed_1);
|
|
56666
56666
|
var oneLine_2 = joined.getLineLength(1) <= options.wrapColumn;
|
|
56667
56667
|
if (oneLine_2) {
|
|
@@ -56699,12 +56699,12 @@ var require_printer = __commonJS({
|
|
|
56699
56699
|
parts.push("]");
|
|
56700
56700
|
}
|
|
56701
56701
|
if (n.typeAnnotation) {
|
|
56702
|
-
parts.push(path4.call(
|
|
56702
|
+
parts.push(path4.call(print14, "typeAnnotation"));
|
|
56703
56703
|
}
|
|
56704
56704
|
return (0, lines_1.concat)(parts);
|
|
56705
56705
|
}
|
|
56706
56706
|
case "SequenceExpression":
|
|
56707
|
-
return (0, lines_1.fromString)(", ").join(path4.map(
|
|
56707
|
+
return (0, lines_1.fromString)(", ").join(path4.map(print14, "expressions"));
|
|
56708
56708
|
case "ThisExpression":
|
|
56709
56709
|
return (0, lines_1.fromString)("this");
|
|
56710
56710
|
case "Super":
|
|
@@ -56725,7 +56725,7 @@ var require_printer = __commonJS({
|
|
|
56725
56725
|
case "Literal":
|
|
56726
56726
|
return (0, lines_1.fromString)(getPossibleRaw(n) || (typeof n.value === "string" ? nodeStr(n.value, options) : n.value), options);
|
|
56727
56727
|
case "Directive":
|
|
56728
|
-
return path4.call(
|
|
56728
|
+
return path4.call(print14, "value");
|
|
56729
56729
|
case "DirectiveLiteral":
|
|
56730
56730
|
return (0, lines_1.fromString)(getPossibleRaw(n) || nodeStr(n.value, options), options);
|
|
56731
56731
|
case "InterpreterDirective":
|
|
@@ -56739,32 +56739,32 @@ var require_printer = __commonJS({
|
|
|
56739
56739
|
parts.push(n.operator);
|
|
56740
56740
|
if (/[a-z]$/.test(n.operator))
|
|
56741
56741
|
parts.push(" ");
|
|
56742
|
-
parts.push(path4.call(
|
|
56742
|
+
parts.push(path4.call(print14, "argument"));
|
|
56743
56743
|
return (0, lines_1.concat)(parts);
|
|
56744
56744
|
case "UpdateExpression":
|
|
56745
|
-
parts.push(path4.call(
|
|
56745
|
+
parts.push(path4.call(print14, "argument"), n.operator);
|
|
56746
56746
|
if (n.prefix)
|
|
56747
56747
|
parts.reverse();
|
|
56748
56748
|
return (0, lines_1.concat)(parts);
|
|
56749
56749
|
case "ConditionalExpression":
|
|
56750
56750
|
return (0, lines_1.concat)([
|
|
56751
|
-
path4.call(
|
|
56751
|
+
path4.call(print14, "test"),
|
|
56752
56752
|
" ? ",
|
|
56753
|
-
path4.call(
|
|
56753
|
+
path4.call(print14, "consequent"),
|
|
56754
56754
|
" : ",
|
|
56755
|
-
path4.call(
|
|
56755
|
+
path4.call(print14, "alternate")
|
|
56756
56756
|
]);
|
|
56757
56757
|
case "NewExpression": {
|
|
56758
|
-
parts.push("new ", path4.call(
|
|
56758
|
+
parts.push("new ", path4.call(print14, "callee"));
|
|
56759
56759
|
if (n.typeParameters) {
|
|
56760
|
-
parts.push(path4.call(
|
|
56760
|
+
parts.push(path4.call(print14, "typeParameters"));
|
|
56761
56761
|
}
|
|
56762
56762
|
if (n.typeArguments) {
|
|
56763
|
-
parts.push(path4.call(
|
|
56763
|
+
parts.push(path4.call(print14, "typeArguments"));
|
|
56764
56764
|
}
|
|
56765
56765
|
var args = n.arguments;
|
|
56766
56766
|
if (args) {
|
|
56767
|
-
parts.push(printArgumentsList(path4, options,
|
|
56767
|
+
parts.push(printArgumentsList(path4, options, print14));
|
|
56768
56768
|
}
|
|
56769
56769
|
return (0, lines_1.concat)(parts);
|
|
56770
56770
|
}
|
|
@@ -56775,7 +56775,7 @@ var require_printer = __commonJS({
|
|
|
56775
56775
|
parts.push(n.kind, " ");
|
|
56776
56776
|
var maxLen_1 = 0;
|
|
56777
56777
|
var printed = path4.map(function(childPath) {
|
|
56778
|
-
var lines2 =
|
|
56778
|
+
var lines2 = print14(childPath);
|
|
56779
56779
|
maxLen_1 = Math.max(lines2.length, maxLen_1);
|
|
56780
56780
|
return lines2;
|
|
56781
56781
|
}, "declarations");
|
|
@@ -56794,30 +56794,30 @@ var require_printer = __commonJS({
|
|
|
56794
56794
|
}
|
|
56795
56795
|
case "VariableDeclarator":
|
|
56796
56796
|
return n.init ? (0, lines_1.fromString)(" = ").join([
|
|
56797
|
-
path4.call(
|
|
56798
|
-
path4.call(
|
|
56799
|
-
]) : path4.call(
|
|
56797
|
+
path4.call(print14, "id"),
|
|
56798
|
+
path4.call(print14, "init")
|
|
56799
|
+
]) : path4.call(print14, "id");
|
|
56800
56800
|
case "WithStatement":
|
|
56801
56801
|
return (0, lines_1.concat)([
|
|
56802
56802
|
"with (",
|
|
56803
|
-
path4.call(
|
|
56803
|
+
path4.call(print14, "object"),
|
|
56804
56804
|
") ",
|
|
56805
|
-
path4.call(
|
|
56805
|
+
path4.call(print14, "body")
|
|
56806
56806
|
]);
|
|
56807
56807
|
case "IfStatement": {
|
|
56808
|
-
var con = adjustClause(path4.call(
|
|
56809
|
-
parts.push("if (", path4.call(
|
|
56808
|
+
var con = adjustClause(path4.call(print14, "consequent"), options);
|
|
56809
|
+
parts.push("if (", path4.call(print14, "test"), ")", con);
|
|
56810
56810
|
if (n.alternate)
|
|
56811
|
-
parts.push(endsWithBrace(con) ? " else" : "\nelse", adjustClause(path4.call(
|
|
56811
|
+
parts.push(endsWithBrace(con) ? " else" : "\nelse", adjustClause(path4.call(print14, "alternate"), options));
|
|
56812
56812
|
return (0, lines_1.concat)(parts);
|
|
56813
56813
|
}
|
|
56814
56814
|
case "ForStatement": {
|
|
56815
|
-
var init3 = path4.call(
|
|
56815
|
+
var init3 = path4.call(print14, "init");
|
|
56816
56816
|
var sep3 = init3.length > 1 ? ";\n" : "; ";
|
|
56817
56817
|
var forParen = "for (";
|
|
56818
|
-
var indented = (0, lines_1.fromString)(sep3).join([init3, path4.call(
|
|
56818
|
+
var indented = (0, lines_1.fromString)(sep3).join([init3, path4.call(print14, "test"), path4.call(print14, "update")]).indentTail(forParen.length);
|
|
56819
56819
|
var head = (0, lines_1.concat)([forParen, indented, ")"]);
|
|
56820
|
-
var clause = adjustClause(path4.call(
|
|
56820
|
+
var clause = adjustClause(path4.call(print14, "body"), options);
|
|
56821
56821
|
parts.push(head);
|
|
56822
56822
|
if (head.length > 1) {
|
|
56823
56823
|
parts.push("\n");
|
|
@@ -56829,18 +56829,18 @@ var require_printer = __commonJS({
|
|
|
56829
56829
|
case "WhileStatement":
|
|
56830
56830
|
return (0, lines_1.concat)([
|
|
56831
56831
|
"while (",
|
|
56832
|
-
path4.call(
|
|
56832
|
+
path4.call(print14, "test"),
|
|
56833
56833
|
")",
|
|
56834
|
-
adjustClause(path4.call(
|
|
56834
|
+
adjustClause(path4.call(print14, "body"), options)
|
|
56835
56835
|
]);
|
|
56836
56836
|
case "ForInStatement":
|
|
56837
56837
|
return (0, lines_1.concat)([
|
|
56838
56838
|
n.each ? "for each (" : "for (",
|
|
56839
|
-
path4.call(
|
|
56839
|
+
path4.call(print14, "left"),
|
|
56840
56840
|
" in ",
|
|
56841
|
-
path4.call(
|
|
56841
|
+
path4.call(print14, "right"),
|
|
56842
56842
|
")",
|
|
56843
|
-
adjustClause(path4.call(
|
|
56843
|
+
adjustClause(path4.call(print14, "body"), options)
|
|
56844
56844
|
]);
|
|
56845
56845
|
case "ForOfStatement":
|
|
56846
56846
|
case "ForAwaitStatement":
|
|
@@ -56848,122 +56848,122 @@ var require_printer = __commonJS({
|
|
|
56848
56848
|
if (n.await || n.type === "ForAwaitStatement") {
|
|
56849
56849
|
parts.push("await ");
|
|
56850
56850
|
}
|
|
56851
|
-
parts.push("(", path4.call(
|
|
56851
|
+
parts.push("(", path4.call(print14, "left"), " of ", path4.call(print14, "right"), ")", adjustClause(path4.call(print14, "body"), options));
|
|
56852
56852
|
return (0, lines_1.concat)(parts);
|
|
56853
56853
|
case "DoWhileStatement": {
|
|
56854
56854
|
var doBody = (0, lines_1.concat)([
|
|
56855
56855
|
"do",
|
|
56856
|
-
adjustClause(path4.call(
|
|
56856
|
+
adjustClause(path4.call(print14, "body"), options)
|
|
56857
56857
|
]);
|
|
56858
56858
|
parts.push(doBody);
|
|
56859
56859
|
if (endsWithBrace(doBody))
|
|
56860
56860
|
parts.push(" while");
|
|
56861
56861
|
else
|
|
56862
56862
|
parts.push("\nwhile");
|
|
56863
|
-
parts.push(" (", path4.call(
|
|
56863
|
+
parts.push(" (", path4.call(print14, "test"), ");");
|
|
56864
56864
|
return (0, lines_1.concat)(parts);
|
|
56865
56865
|
}
|
|
56866
56866
|
case "DoExpression": {
|
|
56867
56867
|
var statements = path4.call(function(bodyPath) {
|
|
56868
|
-
return printStatementSequence(bodyPath, options,
|
|
56868
|
+
return printStatementSequence(bodyPath, options, print14);
|
|
56869
56869
|
}, "body");
|
|
56870
56870
|
return (0, lines_1.concat)(["do {\n", statements.indent(options.tabWidth), "\n}"]);
|
|
56871
56871
|
}
|
|
56872
56872
|
case "BreakStatement":
|
|
56873
56873
|
parts.push("break");
|
|
56874
56874
|
if (n.label)
|
|
56875
|
-
parts.push(" ", path4.call(
|
|
56875
|
+
parts.push(" ", path4.call(print14, "label"));
|
|
56876
56876
|
parts.push(";");
|
|
56877
56877
|
return (0, lines_1.concat)(parts);
|
|
56878
56878
|
case "ContinueStatement":
|
|
56879
56879
|
parts.push("continue");
|
|
56880
56880
|
if (n.label)
|
|
56881
|
-
parts.push(" ", path4.call(
|
|
56881
|
+
parts.push(" ", path4.call(print14, "label"));
|
|
56882
56882
|
parts.push(";");
|
|
56883
56883
|
return (0, lines_1.concat)(parts);
|
|
56884
56884
|
case "LabeledStatement":
|
|
56885
56885
|
return (0, lines_1.concat)([
|
|
56886
|
-
path4.call(
|
|
56886
|
+
path4.call(print14, "label"),
|
|
56887
56887
|
":\n",
|
|
56888
|
-
path4.call(
|
|
56888
|
+
path4.call(print14, "body")
|
|
56889
56889
|
]);
|
|
56890
56890
|
case "TryStatement":
|
|
56891
|
-
parts.push("try ", path4.call(
|
|
56891
|
+
parts.push("try ", path4.call(print14, "block"));
|
|
56892
56892
|
if (n.handler) {
|
|
56893
|
-
parts.push(" ", path4.call(
|
|
56893
|
+
parts.push(" ", path4.call(print14, "handler"));
|
|
56894
56894
|
} else if (n.handlers) {
|
|
56895
56895
|
path4.each(function(handlerPath) {
|
|
56896
|
-
parts.push(" ",
|
|
56896
|
+
parts.push(" ", print14(handlerPath));
|
|
56897
56897
|
}, "handlers");
|
|
56898
56898
|
}
|
|
56899
56899
|
if (n.finalizer) {
|
|
56900
|
-
parts.push(" finally ", path4.call(
|
|
56900
|
+
parts.push(" finally ", path4.call(print14, "finalizer"));
|
|
56901
56901
|
}
|
|
56902
56902
|
return (0, lines_1.concat)(parts);
|
|
56903
56903
|
case "CatchClause":
|
|
56904
56904
|
parts.push("catch ");
|
|
56905
56905
|
if (n.param) {
|
|
56906
|
-
parts.push("(", path4.call(
|
|
56906
|
+
parts.push("(", path4.call(print14, "param"));
|
|
56907
56907
|
}
|
|
56908
56908
|
if (n.guard) {
|
|
56909
|
-
parts.push(" if ", path4.call(
|
|
56909
|
+
parts.push(" if ", path4.call(print14, "guard"));
|
|
56910
56910
|
}
|
|
56911
56911
|
if (n.param) {
|
|
56912
56912
|
parts.push(") ");
|
|
56913
56913
|
}
|
|
56914
|
-
parts.push(path4.call(
|
|
56914
|
+
parts.push(path4.call(print14, "body"));
|
|
56915
56915
|
return (0, lines_1.concat)(parts);
|
|
56916
56916
|
case "ThrowStatement":
|
|
56917
|
-
return (0, lines_1.concat)(["throw ", path4.call(
|
|
56917
|
+
return (0, lines_1.concat)(["throw ", path4.call(print14, "argument"), ";"]);
|
|
56918
56918
|
case "SwitchStatement":
|
|
56919
56919
|
return (0, lines_1.concat)([
|
|
56920
56920
|
"switch (",
|
|
56921
|
-
path4.call(
|
|
56921
|
+
path4.call(print14, "discriminant"),
|
|
56922
56922
|
") {\n",
|
|
56923
|
-
(0, lines_1.fromString)("\n").join(path4.map(
|
|
56923
|
+
(0, lines_1.fromString)("\n").join(path4.map(print14, "cases")),
|
|
56924
56924
|
"\n}"
|
|
56925
56925
|
]);
|
|
56926
56926
|
case "SwitchCase":
|
|
56927
56927
|
if (n.test)
|
|
56928
|
-
parts.push("case ", path4.call(
|
|
56928
|
+
parts.push("case ", path4.call(print14, "test"), ":");
|
|
56929
56929
|
else
|
|
56930
56930
|
parts.push("default:");
|
|
56931
56931
|
if (n.consequent.length > 0) {
|
|
56932
56932
|
parts.push("\n", path4.call(function(consequentPath) {
|
|
56933
|
-
return printStatementSequence(consequentPath, options,
|
|
56933
|
+
return printStatementSequence(consequentPath, options, print14);
|
|
56934
56934
|
}, "consequent").indent(options.tabWidth));
|
|
56935
56935
|
}
|
|
56936
56936
|
return (0, lines_1.concat)(parts);
|
|
56937
56937
|
case "DebuggerStatement":
|
|
56938
56938
|
return (0, lines_1.fromString)("debugger;");
|
|
56939
56939
|
case "JSXAttribute":
|
|
56940
|
-
parts.push(path4.call(
|
|
56940
|
+
parts.push(path4.call(print14, "name"));
|
|
56941
56941
|
if (n.value)
|
|
56942
|
-
parts.push("=", path4.call(
|
|
56942
|
+
parts.push("=", path4.call(print14, "value"));
|
|
56943
56943
|
return (0, lines_1.concat)(parts);
|
|
56944
56944
|
case "JSXIdentifier":
|
|
56945
56945
|
return (0, lines_1.fromString)(n.name, options);
|
|
56946
56946
|
case "JSXNamespacedName":
|
|
56947
56947
|
return (0, lines_1.fromString)(":").join([
|
|
56948
|
-
path4.call(
|
|
56949
|
-
path4.call(
|
|
56948
|
+
path4.call(print14, "namespace"),
|
|
56949
|
+
path4.call(print14, "name")
|
|
56950
56950
|
]);
|
|
56951
56951
|
case "JSXMemberExpression":
|
|
56952
56952
|
return (0, lines_1.fromString)(".").join([
|
|
56953
|
-
path4.call(
|
|
56954
|
-
path4.call(
|
|
56953
|
+
path4.call(print14, "object"),
|
|
56954
|
+
path4.call(print14, "property")
|
|
56955
56955
|
]);
|
|
56956
56956
|
case "JSXSpreadAttribute":
|
|
56957
|
-
return (0, lines_1.concat)(["{...", path4.call(
|
|
56957
|
+
return (0, lines_1.concat)(["{...", path4.call(print14, "argument"), "}"]);
|
|
56958
56958
|
case "JSXSpreadChild":
|
|
56959
|
-
return (0, lines_1.concat)(["{...", path4.call(
|
|
56959
|
+
return (0, lines_1.concat)(["{...", path4.call(print14, "expression"), "}"]);
|
|
56960
56960
|
case "JSXExpressionContainer":
|
|
56961
|
-
return (0, lines_1.concat)(["{", path4.call(
|
|
56961
|
+
return (0, lines_1.concat)(["{", path4.call(print14, "expression"), "}"]);
|
|
56962
56962
|
case "JSXElement":
|
|
56963
56963
|
case "JSXFragment": {
|
|
56964
56964
|
var openingPropName = "opening" + (n.type === "JSXElement" ? "Element" : "Fragment");
|
|
56965
56965
|
var closingPropName = "closing" + (n.type === "JSXElement" ? "Element" : "Fragment");
|
|
56966
|
-
var openingLines = path4.call(
|
|
56966
|
+
var openingLines = path4.call(print14, openingPropName);
|
|
56967
56967
|
if (n[openingPropName].selfClosing) {
|
|
56968
56968
|
assert_1.default.ok(!n[closingPropName], "unexpected " + closingPropName + " element in self-closing " + n.type);
|
|
56969
56969
|
return openingLines;
|
|
@@ -56977,16 +56977,16 @@ var require_printer = __commonJS({
|
|
|
56977
56977
|
return "\n";
|
|
56978
56978
|
}
|
|
56979
56979
|
}
|
|
56980
|
-
return
|
|
56980
|
+
return print14(childPath);
|
|
56981
56981
|
}, "children")).indentTail(options.tabWidth);
|
|
56982
|
-
var closingLines = path4.call(
|
|
56982
|
+
var closingLines = path4.call(print14, closingPropName);
|
|
56983
56983
|
return (0, lines_1.concat)([openingLines, childLines, closingLines]);
|
|
56984
56984
|
}
|
|
56985
56985
|
case "JSXOpeningElement": {
|
|
56986
|
-
parts.push("<", path4.call(
|
|
56986
|
+
parts.push("<", path4.call(print14, "name"));
|
|
56987
56987
|
var attrParts_1 = [];
|
|
56988
56988
|
path4.each(function(attrPath) {
|
|
56989
|
-
attrParts_1.push(" ",
|
|
56989
|
+
attrParts_1.push(" ", print14(attrPath));
|
|
56990
56990
|
}, "attributes");
|
|
56991
56991
|
var attrLines = (0, lines_1.concat)(attrParts_1);
|
|
56992
56992
|
var needLineWrap = attrLines.length > 1 || attrLines.getLineLength(1) > options.wrapColumn;
|
|
@@ -57003,7 +57003,7 @@ var require_printer = __commonJS({
|
|
|
57003
57003
|
return (0, lines_1.concat)(parts);
|
|
57004
57004
|
}
|
|
57005
57005
|
case "JSXClosingElement":
|
|
57006
|
-
return (0, lines_1.concat)(["</", path4.call(
|
|
57006
|
+
return (0, lines_1.concat)(["</", path4.call(print14, "name"), ">"]);
|
|
57007
57007
|
case "JSXOpeningFragment":
|
|
57008
57008
|
return (0, lines_1.fromString)("<>");
|
|
57009
57009
|
case "JSXClosingFragment":
|
|
@@ -57014,9 +57014,9 @@ var require_printer = __commonJS({
|
|
|
57014
57014
|
return (0, lines_1.fromString)("");
|
|
57015
57015
|
case "TypeAnnotatedIdentifier":
|
|
57016
57016
|
return (0, lines_1.concat)([
|
|
57017
|
-
path4.call(
|
|
57017
|
+
path4.call(print14, "annotation"),
|
|
57018
57018
|
" ",
|
|
57019
|
-
path4.call(
|
|
57019
|
+
path4.call(print14, "identifier")
|
|
57020
57020
|
]);
|
|
57021
57021
|
case "ClassBody":
|
|
57022
57022
|
if (n.body.length === 0) {
|
|
@@ -57025,12 +57025,12 @@ var require_printer = __commonJS({
|
|
|
57025
57025
|
return (0, lines_1.concat)([
|
|
57026
57026
|
"{\n",
|
|
57027
57027
|
path4.call(function(bodyPath) {
|
|
57028
|
-
return printStatementSequence(bodyPath, options,
|
|
57028
|
+
return printStatementSequence(bodyPath, options, print14);
|
|
57029
57029
|
}, "body").indent(options.tabWidth),
|
|
57030
57030
|
"\n}"
|
|
57031
57031
|
]);
|
|
57032
57032
|
case "ClassPropertyDefinition":
|
|
57033
|
-
parts.push("static ", path4.call(
|
|
57033
|
+
parts.push("static ", path4.call(print14, "definition"));
|
|
57034
57034
|
if (!namedTypes.MethodDefinition.check(n.definition))
|
|
57035
57035
|
parts.push(";");
|
|
57036
57036
|
return (0, lines_1.concat)(parts);
|
|
@@ -57051,12 +57051,12 @@ var require_printer = __commonJS({
|
|
|
57051
57051
|
if (n.readonly) {
|
|
57052
57052
|
parts.push("readonly ");
|
|
57053
57053
|
}
|
|
57054
|
-
var key = path4.call(
|
|
57054
|
+
var key = path4.call(print14, "key");
|
|
57055
57055
|
if (n.computed) {
|
|
57056
57056
|
key = (0, lines_1.concat)(["[", key, "]"]);
|
|
57057
57057
|
}
|
|
57058
57058
|
if (n.variance) {
|
|
57059
|
-
key = (0, lines_1.concat)([printVariance(path4,
|
|
57059
|
+
key = (0, lines_1.concat)([printVariance(path4, print14), key]);
|
|
57060
57060
|
}
|
|
57061
57061
|
parts.push(key);
|
|
57062
57062
|
if (n.optional) {
|
|
@@ -57066,10 +57066,10 @@ var require_printer = __commonJS({
|
|
|
57066
57066
|
parts.push("!");
|
|
57067
57067
|
}
|
|
57068
57068
|
if (n.typeAnnotation) {
|
|
57069
|
-
parts.push(path4.call(
|
|
57069
|
+
parts.push(path4.call(print14, "typeAnnotation"));
|
|
57070
57070
|
}
|
|
57071
57071
|
if (n.value) {
|
|
57072
|
-
parts.push(" = ", path4.call(
|
|
57072
|
+
parts.push(" = ", path4.call(print14, "value"));
|
|
57073
57073
|
}
|
|
57074
57074
|
parts.push(";");
|
|
57075
57075
|
return (0, lines_1.concat)(parts);
|
|
@@ -57078,21 +57078,21 @@ var require_printer = __commonJS({
|
|
|
57078
57078
|
if (n.static) {
|
|
57079
57079
|
parts.push("static ");
|
|
57080
57080
|
}
|
|
57081
|
-
parts.push(path4.call(
|
|
57081
|
+
parts.push(path4.call(print14, "key"));
|
|
57082
57082
|
if (n.typeAnnotation) {
|
|
57083
|
-
parts.push(path4.call(
|
|
57083
|
+
parts.push(path4.call(print14, "typeAnnotation"));
|
|
57084
57084
|
}
|
|
57085
57085
|
if (n.value) {
|
|
57086
|
-
parts.push(" = ", path4.call(
|
|
57086
|
+
parts.push(" = ", path4.call(print14, "value"));
|
|
57087
57087
|
}
|
|
57088
57088
|
parts.push(";");
|
|
57089
57089
|
return (0, lines_1.concat)(parts);
|
|
57090
57090
|
case "ClassAccessorProperty": {
|
|
57091
57091
|
parts.push.apply(parts, tslib_1.__spreadArray(tslib_1.__spreadArray([], printClassMemberModifiers(n), false), ["accessor "], false));
|
|
57092
57092
|
if (n.computed) {
|
|
57093
|
-
parts.push("[", path4.call(
|
|
57093
|
+
parts.push("[", path4.call(print14, "key"), "]");
|
|
57094
57094
|
} else {
|
|
57095
|
-
parts.push(path4.call(
|
|
57095
|
+
parts.push(path4.call(print14, "key"));
|
|
57096
57096
|
}
|
|
57097
57097
|
if (n.optional) {
|
|
57098
57098
|
parts.push("?");
|
|
@@ -57101,10 +57101,10 @@ var require_printer = __commonJS({
|
|
|
57101
57101
|
parts.push("!");
|
|
57102
57102
|
}
|
|
57103
57103
|
if (n.typeAnnotation) {
|
|
57104
|
-
parts.push(path4.call(
|
|
57104
|
+
parts.push(path4.call(print14, "typeAnnotation"));
|
|
57105
57105
|
}
|
|
57106
57106
|
if (n.value) {
|
|
57107
|
-
parts.push(" = ", path4.call(
|
|
57107
|
+
parts.push(" = ", path4.call(print14, "value"));
|
|
57108
57108
|
}
|
|
57109
57109
|
parts.push(";");
|
|
57110
57110
|
return (0, lines_1.concat)(parts);
|
|
@@ -57120,21 +57120,21 @@ var require_printer = __commonJS({
|
|
|
57120
57120
|
}
|
|
57121
57121
|
parts.push("class");
|
|
57122
57122
|
if (n.id) {
|
|
57123
|
-
parts.push(" ", path4.call(
|
|
57123
|
+
parts.push(" ", path4.call(print14, "id"));
|
|
57124
57124
|
}
|
|
57125
57125
|
if (n.typeParameters) {
|
|
57126
|
-
parts.push(path4.call(
|
|
57126
|
+
parts.push(path4.call(print14, "typeParameters"));
|
|
57127
57127
|
}
|
|
57128
57128
|
if (n.superClass) {
|
|
57129
|
-
parts.push(" extends ", path4.call(
|
|
57129
|
+
parts.push(" extends ", path4.call(print14, "superClass"), path4.call(print14, "superTypeParameters"));
|
|
57130
57130
|
}
|
|
57131
57131
|
if (n.extends && n.extends.length > 0) {
|
|
57132
|
-
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path4.map(
|
|
57132
|
+
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path4.map(print14, "extends")));
|
|
57133
57133
|
}
|
|
57134
57134
|
if (n["implements"] && n["implements"].length > 0) {
|
|
57135
|
-
parts.push(" implements ", (0, lines_1.fromString)(", ").join(path4.map(
|
|
57135
|
+
parts.push(" implements ", (0, lines_1.fromString)(", ").join(path4.map(print14, "implements")));
|
|
57136
57136
|
}
|
|
57137
|
-
parts.push(" ", path4.call(
|
|
57137
|
+
parts.push(" ", path4.call(print14, "body"));
|
|
57138
57138
|
if (n.type === "DeclareClass") {
|
|
57139
57139
|
return printFlowDeclaration(path4, parts);
|
|
57140
57140
|
} else {
|
|
@@ -57143,11 +57143,11 @@ var require_printer = __commonJS({
|
|
|
57143
57143
|
case "TemplateElement":
|
|
57144
57144
|
return (0, lines_1.fromString)(n.value.raw, options).lockIndentTail();
|
|
57145
57145
|
case "TemplateLiteral": {
|
|
57146
|
-
var expressions_1 = path4.map(
|
|
57146
|
+
var expressions_1 = path4.map(print14, "expressions");
|
|
57147
57147
|
parts.push("`");
|
|
57148
57148
|
path4.each(function(childPath) {
|
|
57149
57149
|
var i2 = childPath.getName();
|
|
57150
|
-
parts.push(
|
|
57150
|
+
parts.push(print14(childPath));
|
|
57151
57151
|
if (i2 < expressions_1.length) {
|
|
57152
57152
|
parts.push("${", expressions_1[i2], "}");
|
|
57153
57153
|
}
|
|
@@ -57156,7 +57156,7 @@ var require_printer = __commonJS({
|
|
|
57156
57156
|
return (0, lines_1.concat)(parts).lockIndentTail();
|
|
57157
57157
|
}
|
|
57158
57158
|
case "TaggedTemplateExpression":
|
|
57159
|
-
return (0, lines_1.concat)([path4.call(
|
|
57159
|
+
return (0, lines_1.concat)([path4.call(print14, "tag"), path4.call(print14, "quasi")]);
|
|
57160
57160
|
case "Node":
|
|
57161
57161
|
case "Printable":
|
|
57162
57162
|
case "SourceLocation":
|
|
@@ -57190,7 +57190,7 @@ var require_printer = __commonJS({
|
|
|
57190
57190
|
if (n.typeAnnotation.type !== "FunctionTypeAnnotation") {
|
|
57191
57191
|
parts.push(": ");
|
|
57192
57192
|
}
|
|
57193
|
-
parts.push(path4.call(
|
|
57193
|
+
parts.push(path4.call(print14, "typeAnnotation"));
|
|
57194
57194
|
return (0, lines_1.concat)(parts);
|
|
57195
57195
|
}
|
|
57196
57196
|
return (0, lines_1.fromString)("");
|
|
@@ -57204,9 +57204,9 @@ var require_printer = __commonJS({
|
|
|
57204
57204
|
case "MixedTypeAnnotation":
|
|
57205
57205
|
return (0, lines_1.fromString)("mixed", options);
|
|
57206
57206
|
case "ArrayTypeAnnotation":
|
|
57207
|
-
return (0, lines_1.concat)([path4.call(
|
|
57207
|
+
return (0, lines_1.concat)([path4.call(print14, "elementType"), "[]"]);
|
|
57208
57208
|
case "TupleTypeAnnotation": {
|
|
57209
|
-
var printed_2 = path4.map(
|
|
57209
|
+
var printed_2 = path4.map(print14, "types");
|
|
57210
57210
|
var joined = (0, lines_1.fromString)(", ").join(printed_2);
|
|
57211
57211
|
var oneLine_3 = joined.getLineLength(1) <= options.wrapColumn;
|
|
57212
57212
|
if (oneLine_3) {
|
|
@@ -57253,38 +57253,38 @@ var require_printer = __commonJS({
|
|
|
57253
57253
|
case "InterfaceTypeAnnotation":
|
|
57254
57254
|
parts.push("interface");
|
|
57255
57255
|
if (n.extends && n.extends.length > 0) {
|
|
57256
|
-
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path4.map(
|
|
57256
|
+
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path4.map(print14, "extends")));
|
|
57257
57257
|
}
|
|
57258
|
-
parts.push(" ", path4.call(
|
|
57258
|
+
parts.push(" ", path4.call(print14, "body"));
|
|
57259
57259
|
return (0, lines_1.concat)(parts);
|
|
57260
57260
|
case "DeclareFunction":
|
|
57261
57261
|
return printFlowDeclaration(path4, [
|
|
57262
57262
|
"function ",
|
|
57263
|
-
path4.call(
|
|
57263
|
+
path4.call(print14, "id"),
|
|
57264
57264
|
";"
|
|
57265
57265
|
]);
|
|
57266
57266
|
case "DeclareModule":
|
|
57267
57267
|
return printFlowDeclaration(path4, [
|
|
57268
57268
|
"module ",
|
|
57269
|
-
path4.call(
|
|
57269
|
+
path4.call(print14, "id"),
|
|
57270
57270
|
" ",
|
|
57271
|
-
path4.call(
|
|
57271
|
+
path4.call(print14, "body")
|
|
57272
57272
|
]);
|
|
57273
57273
|
case "DeclareModuleExports":
|
|
57274
57274
|
return printFlowDeclaration(path4, [
|
|
57275
57275
|
"module.exports",
|
|
57276
|
-
path4.call(
|
|
57276
|
+
path4.call(print14, "typeAnnotation")
|
|
57277
57277
|
]);
|
|
57278
57278
|
case "DeclareVariable":
|
|
57279
|
-
return printFlowDeclaration(path4, ["var ", path4.call(
|
|
57279
|
+
return printFlowDeclaration(path4, ["var ", path4.call(print14, "id"), ";"]);
|
|
57280
57280
|
case "DeclareExportDeclaration":
|
|
57281
57281
|
case "DeclareExportAllDeclaration":
|
|
57282
|
-
return (0, lines_1.concat)(["declare ", printExportDeclaration(path4, options,
|
|
57282
|
+
return (0, lines_1.concat)(["declare ", printExportDeclaration(path4, options, print14)]);
|
|
57283
57283
|
case "EnumDeclaration":
|
|
57284
57284
|
return (0, lines_1.concat)([
|
|
57285
57285
|
"enum ",
|
|
57286
|
-
path4.call(
|
|
57287
|
-
path4.call(
|
|
57286
|
+
path4.call(print14, "id"),
|
|
57287
|
+
path4.call(print14, "body")
|
|
57288
57288
|
]);
|
|
57289
57289
|
case "EnumBooleanBody":
|
|
57290
57290
|
case "EnumNumberBody":
|
|
@@ -57296,24 +57296,24 @@ var require_printer = __commonJS({
|
|
|
57296
57296
|
n.type.slice(4, -4).toLowerCase()
|
|
57297
57297
|
);
|
|
57298
57298
|
}
|
|
57299
|
-
parts.push(" {\n", (0, lines_1.fromString)("\n").join(path4.map(
|
|
57299
|
+
parts.push(" {\n", (0, lines_1.fromString)("\n").join(path4.map(print14, "members")).indent(options.tabWidth), "\n}");
|
|
57300
57300
|
return (0, lines_1.concat)(parts);
|
|
57301
57301
|
}
|
|
57302
57302
|
case "EnumDefaultedMember":
|
|
57303
|
-
return (0, lines_1.concat)([path4.call(
|
|
57303
|
+
return (0, lines_1.concat)([path4.call(print14, "id"), ","]);
|
|
57304
57304
|
case "EnumBooleanMember":
|
|
57305
57305
|
case "EnumNumberMember":
|
|
57306
57306
|
case "EnumStringMember":
|
|
57307
57307
|
return (0, lines_1.concat)([
|
|
57308
|
-
path4.call(
|
|
57308
|
+
path4.call(print14, "id"),
|
|
57309
57309
|
" = ",
|
|
57310
|
-
path4.call(
|
|
57310
|
+
path4.call(print14, "init"),
|
|
57311
57311
|
","
|
|
57312
57312
|
]);
|
|
57313
57313
|
case "InferredPredicate":
|
|
57314
57314
|
return (0, lines_1.fromString)("%checks", options);
|
|
57315
57315
|
case "DeclaredPredicate":
|
|
57316
|
-
return (0, lines_1.concat)(["%checks(", path4.call(
|
|
57316
|
+
return (0, lines_1.concat)(["%checks(", path4.call(print14, "value"), ")"]);
|
|
57317
57317
|
case "FunctionTypeAnnotation": {
|
|
57318
57318
|
var parent2 = path4.getParentNode(0);
|
|
57319
57319
|
var isArrowFunctionTypeAnnotation = !(namedTypes.ObjectTypeCallProperty.check(parent2) || namedTypes.ObjectTypeInternalSlot.check(parent2) && parent2.method || namedTypes.DeclareFunction.check(path4.getParentNode(2)));
|
|
@@ -57323,14 +57323,14 @@ var require_printer = __commonJS({
|
|
|
57323
57323
|
}
|
|
57324
57324
|
var hasTypeParameters = !!n.typeParameters;
|
|
57325
57325
|
var needsParens = hasTypeParameters || n.params.length !== 1 || n.params[0].name;
|
|
57326
|
-
parts.push(hasTypeParameters ? path4.call(
|
|
57326
|
+
parts.push(hasTypeParameters ? path4.call(print14, "typeParameters") : "", needsParens ? "(" : "", printFunctionParams(path4, options, print14), needsParens ? ")" : "");
|
|
57327
57327
|
if (n.returnType) {
|
|
57328
|
-
parts.push(isArrowFunctionTypeAnnotation ? " => " : ": ", path4.call(
|
|
57328
|
+
parts.push(isArrowFunctionTypeAnnotation ? " => " : ": ", path4.call(print14, "returnType"));
|
|
57329
57329
|
}
|
|
57330
57330
|
return (0, lines_1.concat)(parts);
|
|
57331
57331
|
}
|
|
57332
57332
|
case "FunctionTypeParam": {
|
|
57333
|
-
var name = path4.call(
|
|
57333
|
+
var name = path4.call(print14, "name");
|
|
57334
57334
|
parts.push(name);
|
|
57335
57335
|
if (n.optional) {
|
|
57336
57336
|
parts.push("?");
|
|
@@ -57338,13 +57338,13 @@ var require_printer = __commonJS({
|
|
|
57338
57338
|
if (name.infos[0].line) {
|
|
57339
57339
|
parts.push(": ");
|
|
57340
57340
|
}
|
|
57341
|
-
parts.push(path4.call(
|
|
57341
|
+
parts.push(path4.call(print14, "typeAnnotation"));
|
|
57342
57342
|
return (0, lines_1.concat)(parts);
|
|
57343
57343
|
}
|
|
57344
57344
|
case "GenericTypeAnnotation":
|
|
57345
57345
|
return (0, lines_1.concat)([
|
|
57346
|
-
path4.call(
|
|
57347
|
-
path4.call(
|
|
57346
|
+
path4.call(print14, "id"),
|
|
57347
|
+
path4.call(print14, "typeParameters")
|
|
57348
57348
|
]);
|
|
57349
57349
|
case "DeclareInterface":
|
|
57350
57350
|
parts.push("declare ");
|
|
@@ -57353,24 +57353,24 @@ var require_printer = __commonJS({
|
|
|
57353
57353
|
if (n.declare) {
|
|
57354
57354
|
parts.push("declare ");
|
|
57355
57355
|
}
|
|
57356
|
-
parts.push("interface ", path4.call(
|
|
57356
|
+
parts.push("interface ", path4.call(print14, "id"), path4.call(print14, "typeParameters"), " ");
|
|
57357
57357
|
if (n["extends"] && n["extends"].length > 0) {
|
|
57358
|
-
parts.push("extends ", (0, lines_1.fromString)(", ").join(path4.map(
|
|
57358
|
+
parts.push("extends ", (0, lines_1.fromString)(", ").join(path4.map(print14, "extends")), " ");
|
|
57359
57359
|
}
|
|
57360
57360
|
if (n.body) {
|
|
57361
|
-
parts.push(path4.call(
|
|
57361
|
+
parts.push(path4.call(print14, "body"));
|
|
57362
57362
|
}
|
|
57363
57363
|
return (0, lines_1.concat)(parts);
|
|
57364
57364
|
case "ClassImplements":
|
|
57365
57365
|
case "InterfaceExtends":
|
|
57366
57366
|
return (0, lines_1.concat)([
|
|
57367
|
-
path4.call(
|
|
57368
|
-
path4.call(
|
|
57367
|
+
path4.call(print14, "id"),
|
|
57368
|
+
path4.call(print14, "typeParameters")
|
|
57369
57369
|
]);
|
|
57370
57370
|
case "IntersectionTypeAnnotation":
|
|
57371
|
-
return (0, lines_1.fromString)(" & ").join(path4.map(
|
|
57371
|
+
return (0, lines_1.fromString)(" & ").join(path4.map(print14, "types"));
|
|
57372
57372
|
case "NullableTypeAnnotation":
|
|
57373
|
-
return (0, lines_1.concat)(["?", path4.call(
|
|
57373
|
+
return (0, lines_1.concat)(["?", path4.call(print14, "typeAnnotation")]);
|
|
57374
57374
|
case "NullLiteralTypeAnnotation":
|
|
57375
57375
|
return (0, lines_1.fromString)("null", options);
|
|
57376
57376
|
case "ThisTypeAnnotation":
|
|
@@ -57378,40 +57378,40 @@ var require_printer = __commonJS({
|
|
|
57378
57378
|
case "NumberTypeAnnotation":
|
|
57379
57379
|
return (0, lines_1.fromString)("number", options);
|
|
57380
57380
|
case "ObjectTypeCallProperty":
|
|
57381
|
-
return path4.call(
|
|
57381
|
+
return path4.call(print14, "value");
|
|
57382
57382
|
case "ObjectTypeIndexer":
|
|
57383
57383
|
if (n.static) {
|
|
57384
57384
|
parts.push("static ");
|
|
57385
57385
|
}
|
|
57386
|
-
parts.push(printVariance(path4,
|
|
57386
|
+
parts.push(printVariance(path4, print14), "[");
|
|
57387
57387
|
if (n.id) {
|
|
57388
|
-
parts.push(path4.call(
|
|
57388
|
+
parts.push(path4.call(print14, "id"), ": ");
|
|
57389
57389
|
}
|
|
57390
|
-
parts.push(path4.call(
|
|
57390
|
+
parts.push(path4.call(print14, "key"), "]: ", path4.call(print14, "value"));
|
|
57391
57391
|
return (0, lines_1.concat)(parts);
|
|
57392
57392
|
case "ObjectTypeProperty":
|
|
57393
57393
|
return (0, lines_1.concat)([
|
|
57394
|
-
printVariance(path4,
|
|
57395
|
-
path4.call(
|
|
57394
|
+
printVariance(path4, print14),
|
|
57395
|
+
path4.call(print14, "key"),
|
|
57396
57396
|
n.optional ? "?" : "",
|
|
57397
57397
|
": ",
|
|
57398
|
-
path4.call(
|
|
57398
|
+
path4.call(print14, "value")
|
|
57399
57399
|
]);
|
|
57400
57400
|
case "ObjectTypeInternalSlot":
|
|
57401
57401
|
return (0, lines_1.concat)([
|
|
57402
57402
|
n.static ? "static " : "",
|
|
57403
57403
|
"[[",
|
|
57404
|
-
path4.call(
|
|
57404
|
+
path4.call(print14, "id"),
|
|
57405
57405
|
"]]",
|
|
57406
57406
|
n.optional ? "?" : "",
|
|
57407
57407
|
n.value.type !== "FunctionTypeAnnotation" ? ": " : "",
|
|
57408
|
-
path4.call(
|
|
57408
|
+
path4.call(print14, "value")
|
|
57409
57409
|
]);
|
|
57410
57410
|
case "QualifiedTypeIdentifier":
|
|
57411
57411
|
return (0, lines_1.concat)([
|
|
57412
|
-
path4.call(
|
|
57412
|
+
path4.call(print14, "qualification"),
|
|
57413
57413
|
".",
|
|
57414
|
-
path4.call(
|
|
57414
|
+
path4.call(print14, "id")
|
|
57415
57415
|
]);
|
|
57416
57416
|
case "StringLiteralTypeAnnotation":
|
|
57417
57417
|
return (0, lines_1.fromString)(nodeStr(n.value, options), options);
|
|
@@ -57428,36 +57428,36 @@ var require_printer = __commonJS({
|
|
|
57428
57428
|
case "TypeAlias":
|
|
57429
57429
|
return (0, lines_1.concat)([
|
|
57430
57430
|
"type ",
|
|
57431
|
-
path4.call(
|
|
57432
|
-
path4.call(
|
|
57431
|
+
path4.call(print14, "id"),
|
|
57432
|
+
path4.call(print14, "typeParameters"),
|
|
57433
57433
|
" = ",
|
|
57434
|
-
path4.call(
|
|
57434
|
+
path4.call(print14, "right"),
|
|
57435
57435
|
";"
|
|
57436
57436
|
]);
|
|
57437
57437
|
case "DeclareOpaqueType":
|
|
57438
57438
|
parts.push("declare ");
|
|
57439
57439
|
case "OpaqueType":
|
|
57440
|
-
parts.push("opaque type ", path4.call(
|
|
57440
|
+
parts.push("opaque type ", path4.call(print14, "id"), path4.call(print14, "typeParameters"));
|
|
57441
57441
|
if (n["supertype"]) {
|
|
57442
|
-
parts.push(": ", path4.call(
|
|
57442
|
+
parts.push(": ", path4.call(print14, "supertype"));
|
|
57443
57443
|
}
|
|
57444
57444
|
if (n["impltype"]) {
|
|
57445
|
-
parts.push(" = ", path4.call(
|
|
57445
|
+
parts.push(" = ", path4.call(print14, "impltype"));
|
|
57446
57446
|
}
|
|
57447
57447
|
parts.push(";");
|
|
57448
57448
|
return (0, lines_1.concat)(parts);
|
|
57449
57449
|
case "TypeCastExpression":
|
|
57450
57450
|
return (0, lines_1.concat)([
|
|
57451
57451
|
"(",
|
|
57452
|
-
path4.call(
|
|
57453
|
-
path4.call(
|
|
57452
|
+
path4.call(print14, "expression"),
|
|
57453
|
+
path4.call(print14, "typeAnnotation"),
|
|
57454
57454
|
")"
|
|
57455
57455
|
]);
|
|
57456
57456
|
case "TypeParameterDeclaration":
|
|
57457
57457
|
case "TypeParameterInstantiation":
|
|
57458
57458
|
return (0, lines_1.concat)([
|
|
57459
57459
|
"<",
|
|
57460
|
-
(0, lines_1.fromString)(", ").join(path4.map(
|
|
57460
|
+
(0, lines_1.fromString)(", ").join(path4.map(print14, "params")),
|
|
57461
57461
|
">"
|
|
57462
57462
|
]);
|
|
57463
57463
|
case "Variance":
|
|
@@ -57470,32 +57470,32 @@ var require_printer = __commonJS({
|
|
|
57470
57470
|
return (0, lines_1.fromString)("");
|
|
57471
57471
|
case "TypeParameter":
|
|
57472
57472
|
if (n.variance) {
|
|
57473
|
-
parts.push(printVariance(path4,
|
|
57473
|
+
parts.push(printVariance(path4, print14));
|
|
57474
57474
|
}
|
|
57475
|
-
parts.push(path4.call(
|
|
57475
|
+
parts.push(path4.call(print14, "name"));
|
|
57476
57476
|
if (n.bound) {
|
|
57477
|
-
parts.push(path4.call(
|
|
57477
|
+
parts.push(path4.call(print14, "bound"));
|
|
57478
57478
|
}
|
|
57479
57479
|
if (n["default"]) {
|
|
57480
|
-
parts.push("=", path4.call(
|
|
57480
|
+
parts.push("=", path4.call(print14, "default"));
|
|
57481
57481
|
}
|
|
57482
57482
|
return (0, lines_1.concat)(parts);
|
|
57483
57483
|
case "TypeofTypeAnnotation":
|
|
57484
57484
|
return (0, lines_1.concat)([
|
|
57485
57485
|
(0, lines_1.fromString)("typeof ", options),
|
|
57486
|
-
path4.call(
|
|
57486
|
+
path4.call(print14, "argument")
|
|
57487
57487
|
]);
|
|
57488
57488
|
case "IndexedAccessType":
|
|
57489
57489
|
case "OptionalIndexedAccessType":
|
|
57490
57490
|
return (0, lines_1.concat)([
|
|
57491
|
-
path4.call(
|
|
57491
|
+
path4.call(print14, "objectType"),
|
|
57492
57492
|
n.optional ? "?." : "",
|
|
57493
57493
|
"[",
|
|
57494
|
-
path4.call(
|
|
57494
|
+
path4.call(print14, "indexType"),
|
|
57495
57495
|
"]"
|
|
57496
57496
|
]);
|
|
57497
57497
|
case "UnionTypeAnnotation":
|
|
57498
|
-
return (0, lines_1.fromString)(" | ").join(path4.map(
|
|
57498
|
+
return (0, lines_1.fromString)(" | ").join(path4.map(print14, "types"));
|
|
57499
57499
|
case "VoidTypeAnnotation":
|
|
57500
57500
|
return (0, lines_1.fromString)("void", options);
|
|
57501
57501
|
case "NullTypeAnnotation":
|
|
@@ -57535,77 +57535,77 @@ var require_printer = __commonJS({
|
|
|
57535
57535
|
case "TSNeverKeyword":
|
|
57536
57536
|
return (0, lines_1.fromString)("never", options);
|
|
57537
57537
|
case "TSArrayType":
|
|
57538
|
-
return (0, lines_1.concat)([path4.call(
|
|
57538
|
+
return (0, lines_1.concat)([path4.call(print14, "elementType"), "[]"]);
|
|
57539
57539
|
case "TSLiteralType":
|
|
57540
|
-
return path4.call(
|
|
57540
|
+
return path4.call(print14, "literal");
|
|
57541
57541
|
case "TSUnionType":
|
|
57542
|
-
return (0, lines_1.fromString)(" | ").join(path4.map(
|
|
57542
|
+
return (0, lines_1.fromString)(" | ").join(path4.map(print14, "types"));
|
|
57543
57543
|
case "TSIntersectionType":
|
|
57544
|
-
return (0, lines_1.fromString)(" & ").join(path4.map(
|
|
57544
|
+
return (0, lines_1.fromString)(" & ").join(path4.map(print14, "types"));
|
|
57545
57545
|
case "TSConditionalType":
|
|
57546
|
-
parts.push(path4.call(
|
|
57546
|
+
parts.push(path4.call(print14, "checkType"), " extends ", path4.call(print14, "extendsType"), " ? ", path4.call(print14, "trueType"), " : ", path4.call(print14, "falseType"));
|
|
57547
57547
|
return (0, lines_1.concat)(parts);
|
|
57548
57548
|
case "TSInferType":
|
|
57549
|
-
parts.push("infer ", path4.call(
|
|
57549
|
+
parts.push("infer ", path4.call(print14, "typeParameter"));
|
|
57550
57550
|
return (0, lines_1.concat)(parts);
|
|
57551
57551
|
case "TSParenthesizedType":
|
|
57552
|
-
return (0, lines_1.concat)(["(", path4.call(
|
|
57552
|
+
return (0, lines_1.concat)(["(", path4.call(print14, "typeAnnotation"), ")"]);
|
|
57553
57553
|
case "TSFunctionType":
|
|
57554
57554
|
return (0, lines_1.concat)([
|
|
57555
|
-
path4.call(
|
|
57555
|
+
path4.call(print14, "typeParameters"),
|
|
57556
57556
|
"(",
|
|
57557
|
-
printFunctionParams(path4, options,
|
|
57557
|
+
printFunctionParams(path4, options, print14),
|
|
57558
57558
|
") => ",
|
|
57559
|
-
path4.call(
|
|
57559
|
+
path4.call(print14, "typeAnnotation", "typeAnnotation")
|
|
57560
57560
|
]);
|
|
57561
57561
|
case "TSConstructorType":
|
|
57562
57562
|
return (0, lines_1.concat)([
|
|
57563
57563
|
"new ",
|
|
57564
|
-
path4.call(
|
|
57564
|
+
path4.call(print14, "typeParameters"),
|
|
57565
57565
|
"(",
|
|
57566
|
-
printFunctionParams(path4, options,
|
|
57566
|
+
printFunctionParams(path4, options, print14),
|
|
57567
57567
|
") => ",
|
|
57568
|
-
path4.call(
|
|
57568
|
+
path4.call(print14, "typeAnnotation", "typeAnnotation")
|
|
57569
57569
|
]);
|
|
57570
57570
|
case "TSMappedType": {
|
|
57571
|
-
parts.push(n.readonly ? "readonly " : "", "[", path4.call(
|
|
57571
|
+
parts.push(n.readonly ? "readonly " : "", "[", path4.call(print14, "typeParameter"), "]", n.optional ? "?" : "");
|
|
57572
57572
|
if (n.typeAnnotation) {
|
|
57573
|
-
parts.push(": ", path4.call(
|
|
57573
|
+
parts.push(": ", path4.call(print14, "typeAnnotation"), ";");
|
|
57574
57574
|
}
|
|
57575
57575
|
return (0, lines_1.concat)(["{\n", (0, lines_1.concat)(parts).indent(options.tabWidth), "\n}"]);
|
|
57576
57576
|
}
|
|
57577
57577
|
case "TSTupleType":
|
|
57578
57578
|
return (0, lines_1.concat)([
|
|
57579
57579
|
"[",
|
|
57580
|
-
(0, lines_1.fromString)(", ").join(path4.map(
|
|
57580
|
+
(0, lines_1.fromString)(", ").join(path4.map(print14, "elementTypes")),
|
|
57581
57581
|
"]"
|
|
57582
57582
|
]);
|
|
57583
57583
|
case "TSNamedTupleMember":
|
|
57584
|
-
parts.push(path4.call(
|
|
57584
|
+
parts.push(path4.call(print14, "label"));
|
|
57585
57585
|
if (n.optional) {
|
|
57586
57586
|
parts.push("?");
|
|
57587
57587
|
}
|
|
57588
|
-
parts.push(": ", path4.call(
|
|
57588
|
+
parts.push(": ", path4.call(print14, "elementType"));
|
|
57589
57589
|
return (0, lines_1.concat)(parts);
|
|
57590
57590
|
case "TSRestType":
|
|
57591
|
-
return (0, lines_1.concat)(["...", path4.call(
|
|
57591
|
+
return (0, lines_1.concat)(["...", path4.call(print14, "typeAnnotation")]);
|
|
57592
57592
|
case "TSOptionalType":
|
|
57593
|
-
return (0, lines_1.concat)([path4.call(
|
|
57593
|
+
return (0, lines_1.concat)([path4.call(print14, "typeAnnotation"), "?"]);
|
|
57594
57594
|
case "TSIndexedAccessType":
|
|
57595
57595
|
return (0, lines_1.concat)([
|
|
57596
|
-
path4.call(
|
|
57596
|
+
path4.call(print14, "objectType"),
|
|
57597
57597
|
"[",
|
|
57598
|
-
path4.call(
|
|
57598
|
+
path4.call(print14, "indexType"),
|
|
57599
57599
|
"]"
|
|
57600
57600
|
]);
|
|
57601
57601
|
case "TSTypeOperator":
|
|
57602
57602
|
return (0, lines_1.concat)([
|
|
57603
|
-
path4.call(
|
|
57603
|
+
path4.call(print14, "operator"),
|
|
57604
57604
|
" ",
|
|
57605
|
-
path4.call(
|
|
57605
|
+
path4.call(print14, "typeAnnotation")
|
|
57606
57606
|
]);
|
|
57607
57607
|
case "TSTypeLiteral": {
|
|
57608
|
-
var members = (0, lines_1.fromString)("\n").join(path4.map(
|
|
57608
|
+
var members = (0, lines_1.fromString)("\n").join(path4.map(print14, "members").map(function(member) {
|
|
57609
57609
|
if (lastNonSpaceCharacter(member) !== ";") {
|
|
57610
57610
|
return member.concat(";");
|
|
57611
57611
|
}
|
|
@@ -57618,13 +57618,13 @@ var require_printer = __commonJS({
|
|
|
57618
57618
|
return (0, lines_1.concat)(parts);
|
|
57619
57619
|
}
|
|
57620
57620
|
case "TSEnumMember":
|
|
57621
|
-
parts.push(path4.call(
|
|
57621
|
+
parts.push(path4.call(print14, "id"));
|
|
57622
57622
|
if (n.initializer) {
|
|
57623
|
-
parts.push(" = ", path4.call(
|
|
57623
|
+
parts.push(" = ", path4.call(print14, "initializer"));
|
|
57624
57624
|
}
|
|
57625
57625
|
return (0, lines_1.concat)(parts);
|
|
57626
57626
|
case "TSTypeQuery":
|
|
57627
|
-
return (0, lines_1.concat)(["typeof ", path4.call(
|
|
57627
|
+
return (0, lines_1.concat)(["typeof ", path4.call(print14, "exprName")]);
|
|
57628
57628
|
case "TSParameterProperty":
|
|
57629
57629
|
if (n.accessibility) {
|
|
57630
57630
|
parts.push(n.accessibility, " ");
|
|
@@ -57638,119 +57638,119 @@ var require_printer = __commonJS({
|
|
|
57638
57638
|
if (n.readonly) {
|
|
57639
57639
|
parts.push("readonly ");
|
|
57640
57640
|
}
|
|
57641
|
-
parts.push(path4.call(
|
|
57641
|
+
parts.push(path4.call(print14, "parameter"));
|
|
57642
57642
|
return (0, lines_1.concat)(parts);
|
|
57643
57643
|
case "TSTypeReference":
|
|
57644
57644
|
return (0, lines_1.concat)([
|
|
57645
|
-
path4.call(
|
|
57646
|
-
path4.call(
|
|
57645
|
+
path4.call(print14, "typeName"),
|
|
57646
|
+
path4.call(print14, "typeParameters")
|
|
57647
57647
|
]);
|
|
57648
57648
|
case "TSQualifiedName":
|
|
57649
|
-
return (0, lines_1.concat)([path4.call(
|
|
57649
|
+
return (0, lines_1.concat)([path4.call(print14, "left"), ".", path4.call(print14, "right")]);
|
|
57650
57650
|
case "TSAsExpression":
|
|
57651
57651
|
case "TSSatisfiesExpression": {
|
|
57652
|
-
var expression = path4.call(
|
|
57653
|
-
parts.push(expression, n.type === "TSSatisfiesExpression" ? " satisfies " : " as ", path4.call(
|
|
57652
|
+
var expression = path4.call(print14, "expression");
|
|
57653
|
+
parts.push(expression, n.type === "TSSatisfiesExpression" ? " satisfies " : " as ", path4.call(print14, "typeAnnotation"));
|
|
57654
57654
|
return (0, lines_1.concat)(parts);
|
|
57655
57655
|
}
|
|
57656
57656
|
case "TSTypeCastExpression":
|
|
57657
57657
|
return (0, lines_1.concat)([
|
|
57658
|
-
path4.call(
|
|
57659
|
-
path4.call(
|
|
57658
|
+
path4.call(print14, "expression"),
|
|
57659
|
+
path4.call(print14, "typeAnnotation")
|
|
57660
57660
|
]);
|
|
57661
57661
|
case "TSNonNullExpression":
|
|
57662
|
-
return (0, lines_1.concat)([path4.call(
|
|
57662
|
+
return (0, lines_1.concat)([path4.call(print14, "expression"), "!"]);
|
|
57663
57663
|
case "TSTypeAnnotation":
|
|
57664
|
-
return (0, lines_1.concat)([": ", path4.call(
|
|
57664
|
+
return (0, lines_1.concat)([": ", path4.call(print14, "typeAnnotation")]);
|
|
57665
57665
|
case "TSIndexSignature":
|
|
57666
57666
|
return (0, lines_1.concat)([
|
|
57667
57667
|
n.readonly ? "readonly " : "",
|
|
57668
57668
|
"[",
|
|
57669
|
-
path4.map(
|
|
57669
|
+
path4.map(print14, "parameters"),
|
|
57670
57670
|
"]",
|
|
57671
|
-
path4.call(
|
|
57671
|
+
path4.call(print14, "typeAnnotation")
|
|
57672
57672
|
]);
|
|
57673
57673
|
case "TSPropertySignature":
|
|
57674
|
-
parts.push(printVariance(path4,
|
|
57674
|
+
parts.push(printVariance(path4, print14), n.readonly ? "readonly " : "");
|
|
57675
57675
|
if (n.computed) {
|
|
57676
|
-
parts.push("[", path4.call(
|
|
57676
|
+
parts.push("[", path4.call(print14, "key"), "]");
|
|
57677
57677
|
} else {
|
|
57678
|
-
parts.push(path4.call(
|
|
57678
|
+
parts.push(path4.call(print14, "key"));
|
|
57679
57679
|
}
|
|
57680
|
-
parts.push(n.optional ? "?" : "", path4.call(
|
|
57680
|
+
parts.push(n.optional ? "?" : "", path4.call(print14, "typeAnnotation"));
|
|
57681
57681
|
return (0, lines_1.concat)(parts);
|
|
57682
57682
|
case "TSMethodSignature":
|
|
57683
57683
|
if (n.computed) {
|
|
57684
|
-
parts.push("[", path4.call(
|
|
57684
|
+
parts.push("[", path4.call(print14, "key"), "]");
|
|
57685
57685
|
} else {
|
|
57686
|
-
parts.push(path4.call(
|
|
57686
|
+
parts.push(path4.call(print14, "key"));
|
|
57687
57687
|
}
|
|
57688
57688
|
if (n.optional) {
|
|
57689
57689
|
parts.push("?");
|
|
57690
57690
|
}
|
|
57691
|
-
parts.push(path4.call(
|
|
57691
|
+
parts.push(path4.call(print14, "typeParameters"), "(", printFunctionParams(path4, options, print14), ")", path4.call(print14, "typeAnnotation"));
|
|
57692
57692
|
return (0, lines_1.concat)(parts);
|
|
57693
57693
|
case "TSTypePredicate":
|
|
57694
57694
|
if (n.asserts) {
|
|
57695
57695
|
parts.push("asserts ");
|
|
57696
57696
|
}
|
|
57697
|
-
parts.push(path4.call(
|
|
57697
|
+
parts.push(path4.call(print14, "parameterName"));
|
|
57698
57698
|
if (n.typeAnnotation) {
|
|
57699
|
-
parts.push(" is ", path4.call(
|
|
57699
|
+
parts.push(" is ", path4.call(print14, "typeAnnotation", "typeAnnotation"));
|
|
57700
57700
|
}
|
|
57701
57701
|
return (0, lines_1.concat)(parts);
|
|
57702
57702
|
case "TSCallSignatureDeclaration":
|
|
57703
57703
|
return (0, lines_1.concat)([
|
|
57704
|
-
path4.call(
|
|
57704
|
+
path4.call(print14, "typeParameters"),
|
|
57705
57705
|
"(",
|
|
57706
|
-
printFunctionParams(path4, options,
|
|
57706
|
+
printFunctionParams(path4, options, print14),
|
|
57707
57707
|
")",
|
|
57708
|
-
path4.call(
|
|
57708
|
+
path4.call(print14, "typeAnnotation")
|
|
57709
57709
|
]);
|
|
57710
57710
|
case "TSConstructSignatureDeclaration":
|
|
57711
57711
|
if (n.typeParameters) {
|
|
57712
|
-
parts.push("new", path4.call(
|
|
57712
|
+
parts.push("new", path4.call(print14, "typeParameters"));
|
|
57713
57713
|
} else {
|
|
57714
57714
|
parts.push("new ");
|
|
57715
57715
|
}
|
|
57716
|
-
parts.push("(", printFunctionParams(path4, options,
|
|
57716
|
+
parts.push("(", printFunctionParams(path4, options, print14), ")", path4.call(print14, "typeAnnotation"));
|
|
57717
57717
|
return (0, lines_1.concat)(parts);
|
|
57718
57718
|
case "TSTypeAliasDeclaration":
|
|
57719
57719
|
return (0, lines_1.concat)([
|
|
57720
57720
|
n.declare ? "declare " : "",
|
|
57721
57721
|
"type ",
|
|
57722
|
-
path4.call(
|
|
57723
|
-
path4.call(
|
|
57722
|
+
path4.call(print14, "id"),
|
|
57723
|
+
path4.call(print14, "typeParameters"),
|
|
57724
57724
|
" = ",
|
|
57725
|
-
path4.call(
|
|
57725
|
+
path4.call(print14, "typeAnnotation"),
|
|
57726
57726
|
";"
|
|
57727
57727
|
]);
|
|
57728
57728
|
case "TSTypeParameter": {
|
|
57729
|
-
parts.push(path4.call(
|
|
57729
|
+
parts.push(path4.call(print14, "name"));
|
|
57730
57730
|
var parent2 = path4.getParentNode(0);
|
|
57731
57731
|
var isInMappedType = namedTypes.TSMappedType.check(parent2);
|
|
57732
57732
|
if (n.constraint) {
|
|
57733
|
-
parts.push(isInMappedType ? " in " : " extends ", path4.call(
|
|
57733
|
+
parts.push(isInMappedType ? " in " : " extends ", path4.call(print14, "constraint"));
|
|
57734
57734
|
}
|
|
57735
57735
|
if (n["default"]) {
|
|
57736
|
-
parts.push(" = ", path4.call(
|
|
57736
|
+
parts.push(" = ", path4.call(print14, "default"));
|
|
57737
57737
|
}
|
|
57738
57738
|
return (0, lines_1.concat)(parts);
|
|
57739
57739
|
}
|
|
57740
57740
|
case "TSTypeAssertion": {
|
|
57741
|
-
parts.push("<", path4.call(
|
|
57741
|
+
parts.push("<", path4.call(print14, "typeAnnotation"), "> ", path4.call(print14, "expression"));
|
|
57742
57742
|
return (0, lines_1.concat)(parts);
|
|
57743
57743
|
}
|
|
57744
57744
|
case "TSTypeParameterDeclaration":
|
|
57745
57745
|
case "TSTypeParameterInstantiation":
|
|
57746
57746
|
return (0, lines_1.concat)([
|
|
57747
57747
|
"<",
|
|
57748
|
-
(0, lines_1.fromString)(", ").join(path4.map(
|
|
57748
|
+
(0, lines_1.fromString)(", ").join(path4.map(print14, "params")),
|
|
57749
57749
|
">"
|
|
57750
57750
|
]);
|
|
57751
57751
|
case "TSEnumDeclaration": {
|
|
57752
|
-
parts.push(n.declare ? "declare " : "", n.const ? "const " : "", "enum ", path4.call(
|
|
57753
|
-
var memberLines = (0, lines_1.fromString)(",\n").join(path4.map(
|
|
57752
|
+
parts.push(n.declare ? "declare " : "", n.const ? "const " : "", "enum ", path4.call(print14, "id"));
|
|
57753
|
+
var memberLines = (0, lines_1.fromString)(",\n").join(path4.map(print14, "members"));
|
|
57754
57754
|
if (memberLines.isEmpty()) {
|
|
57755
57755
|
parts.push(" {}");
|
|
57756
57756
|
} else {
|
|
@@ -57760,11 +57760,11 @@ var require_printer = __commonJS({
|
|
|
57760
57760
|
}
|
|
57761
57761
|
case "TSExpressionWithTypeArguments":
|
|
57762
57762
|
return (0, lines_1.concat)([
|
|
57763
|
-
path4.call(
|
|
57764
|
-
path4.call(
|
|
57763
|
+
path4.call(print14, "expression"),
|
|
57764
|
+
path4.call(print14, "typeParameters")
|
|
57765
57765
|
]);
|
|
57766
57766
|
case "TSInterfaceBody": {
|
|
57767
|
-
var lines = (0, lines_1.fromString)("\n").join(path4.map(
|
|
57767
|
+
var lines = (0, lines_1.fromString)("\n").join(path4.map(print14, "body").map(function(element) {
|
|
57768
57768
|
if (lastNonSpaceCharacter(element) !== ";") {
|
|
57769
57769
|
return element.concat(";");
|
|
57770
57770
|
}
|
|
@@ -57776,22 +57776,22 @@ var require_printer = __commonJS({
|
|
|
57776
57776
|
return (0, lines_1.concat)(["{\n", lines.indent(options.tabWidth), "\n}"]);
|
|
57777
57777
|
}
|
|
57778
57778
|
case "TSImportType":
|
|
57779
|
-
parts.push("import(", path4.call(
|
|
57779
|
+
parts.push("import(", path4.call(print14, "argument"), ")");
|
|
57780
57780
|
if (n.qualifier) {
|
|
57781
|
-
parts.push(".", path4.call(
|
|
57781
|
+
parts.push(".", path4.call(print14, "qualifier"));
|
|
57782
57782
|
}
|
|
57783
57783
|
if (n.typeParameters) {
|
|
57784
|
-
parts.push(path4.call(
|
|
57784
|
+
parts.push(path4.call(print14, "typeParameters"));
|
|
57785
57785
|
}
|
|
57786
57786
|
return (0, lines_1.concat)(parts);
|
|
57787
57787
|
case "TSImportEqualsDeclaration":
|
|
57788
57788
|
if (n.isExport) {
|
|
57789
57789
|
parts.push("export ");
|
|
57790
57790
|
}
|
|
57791
|
-
parts.push("import ", path4.call(
|
|
57791
|
+
parts.push("import ", path4.call(print14, "id"), " = ", path4.call(print14, "moduleReference"));
|
|
57792
57792
|
return maybeAddSemicolon((0, lines_1.concat)(parts));
|
|
57793
57793
|
case "TSExternalModuleReference":
|
|
57794
|
-
return (0, lines_1.concat)(["require(", path4.call(
|
|
57794
|
+
return (0, lines_1.concat)(["require(", path4.call(print14, "expression"), ")"]);
|
|
57795
57795
|
case "TSModuleDeclaration": {
|
|
57796
57796
|
var parent2 = path4.getParentNode();
|
|
57797
57797
|
if (parent2.type === "TSModuleDeclaration") {
|
|
@@ -57816,16 +57816,16 @@ var require_printer = __commonJS({
|
|
|
57816
57816
|
}
|
|
57817
57817
|
}
|
|
57818
57818
|
}
|
|
57819
|
-
parts.push(path4.call(
|
|
57819
|
+
parts.push(path4.call(print14, "id"));
|
|
57820
57820
|
if (n.body) {
|
|
57821
57821
|
parts.push(" ");
|
|
57822
|
-
parts.push(path4.call(
|
|
57822
|
+
parts.push(path4.call(print14, "body"));
|
|
57823
57823
|
}
|
|
57824
57824
|
return (0, lines_1.concat)(parts);
|
|
57825
57825
|
}
|
|
57826
57826
|
case "TSModuleBlock": {
|
|
57827
57827
|
var naked = path4.call(function(bodyPath) {
|
|
57828
|
-
return printStatementSequence(bodyPath, options,
|
|
57828
|
+
return printStatementSequence(bodyPath, options, print14);
|
|
57829
57829
|
}, "body");
|
|
57830
57830
|
if (naked.isEmpty()) {
|
|
57831
57831
|
parts.push("{}");
|
|
@@ -57835,11 +57835,11 @@ var require_printer = __commonJS({
|
|
|
57835
57835
|
return (0, lines_1.concat)(parts);
|
|
57836
57836
|
}
|
|
57837
57837
|
case "TSInstantiationExpression": {
|
|
57838
|
-
parts.push(path4.call(
|
|
57838
|
+
parts.push(path4.call(print14, "expression"), path4.call(print14, "typeParameters"));
|
|
57839
57839
|
return (0, lines_1.concat)(parts);
|
|
57840
57840
|
}
|
|
57841
57841
|
case "V8IntrinsicIdentifier":
|
|
57842
|
-
return (0, lines_1.concat)(["%", path4.call(
|
|
57842
|
+
return (0, lines_1.concat)(["%", path4.call(print14, "name")]);
|
|
57843
57843
|
case "TopicReference":
|
|
57844
57844
|
return (0, lines_1.fromString)("#");
|
|
57845
57845
|
case "ClassHeritage":
|
|
@@ -57889,7 +57889,7 @@ var require_printer = __commonJS({
|
|
|
57889
57889
|
}
|
|
57890
57890
|
return (0, lines_1.concat)(parts);
|
|
57891
57891
|
}
|
|
57892
|
-
function printStatementSequence(path4, options,
|
|
57892
|
+
function printStatementSequence(path4, options, print14) {
|
|
57893
57893
|
var filtered = [];
|
|
57894
57894
|
var sawComment = false;
|
|
57895
57895
|
var sawStatement = false;
|
|
@@ -57910,7 +57910,7 @@ var require_printer = __commonJS({
|
|
|
57910
57910
|
}
|
|
57911
57911
|
filtered.push({
|
|
57912
57912
|
node: stmt,
|
|
57913
|
-
printed:
|
|
57913
|
+
printed: print14(stmtPath)
|
|
57914
57914
|
});
|
|
57915
57915
|
});
|
|
57916
57916
|
if (sawComment) {
|
|
@@ -58002,7 +58002,7 @@ var require_printer = __commonJS({
|
|
|
58002
58002
|
}
|
|
58003
58003
|
return parts;
|
|
58004
58004
|
}
|
|
58005
|
-
function printMethod(path4, options,
|
|
58005
|
+
function printMethod(path4, options, print14) {
|
|
58006
58006
|
var node = path4.getNode();
|
|
58007
58007
|
var kind = node.kind;
|
|
58008
58008
|
var parts = [];
|
|
@@ -58020,7 +58020,7 @@ var require_printer = __commonJS({
|
|
|
58020
58020
|
if (kind === "get" || kind === "set") {
|
|
58021
58021
|
parts.push(kind, " ");
|
|
58022
58022
|
}
|
|
58023
|
-
var key = path4.call(
|
|
58023
|
+
var key = path4.call(print14, "key");
|
|
58024
58024
|
if (node.computed) {
|
|
58025
58025
|
key = (0, lines_1.concat)(["[", key, "]"]);
|
|
58026
58026
|
}
|
|
@@ -58029,26 +58029,26 @@ var require_printer = __commonJS({
|
|
|
58029
58029
|
parts.push("?");
|
|
58030
58030
|
}
|
|
58031
58031
|
if (node === nodeValue) {
|
|
58032
|
-
parts.push(path4.call(
|
|
58032
|
+
parts.push(path4.call(print14, "typeParameters"), "(", printFunctionParams(path4, options, print14), ")", path4.call(print14, "returnType"));
|
|
58033
58033
|
if (node.body) {
|
|
58034
|
-
parts.push(" ", path4.call(
|
|
58034
|
+
parts.push(" ", path4.call(print14, "body"));
|
|
58035
58035
|
} else {
|
|
58036
58036
|
parts.push(";");
|
|
58037
58037
|
}
|
|
58038
58038
|
} else {
|
|
58039
|
-
parts.push(path4.call(
|
|
58040
|
-
return printFunctionParams(valuePath, options,
|
|
58041
|
-
}, "value"), ")", path4.call(
|
|
58039
|
+
parts.push(path4.call(print14, "value", "typeParameters"), "(", path4.call(function(valuePath) {
|
|
58040
|
+
return printFunctionParams(valuePath, options, print14);
|
|
58041
|
+
}, "value"), ")", path4.call(print14, "value", "returnType"));
|
|
58042
58042
|
if (nodeValue.body) {
|
|
58043
|
-
parts.push(" ", path4.call(
|
|
58043
|
+
parts.push(" ", path4.call(print14, "value", "body"));
|
|
58044
58044
|
} else {
|
|
58045
58045
|
parts.push(";");
|
|
58046
58046
|
}
|
|
58047
58047
|
}
|
|
58048
58048
|
return (0, lines_1.concat)(parts);
|
|
58049
58049
|
}
|
|
58050
|
-
function printArgumentsList(path4, options,
|
|
58051
|
-
var printed = path4.map(
|
|
58050
|
+
function printArgumentsList(path4, options, print14) {
|
|
58051
|
+
var printed = path4.map(print14, "arguments");
|
|
58052
58052
|
var trailingComma = util.isTrailingCommaEnabled(options, "parameters");
|
|
58053
58053
|
var joined = (0, lines_1.fromString)(", ").join(printed);
|
|
58054
58054
|
if (joined.getLineLength(1) > options.wrapColumn) {
|
|
@@ -58061,28 +58061,28 @@ var require_printer = __commonJS({
|
|
|
58061
58061
|
}
|
|
58062
58062
|
return (0, lines_1.concat)(["(", joined, ")"]);
|
|
58063
58063
|
}
|
|
58064
|
-
function printFunctionParams(path4, options,
|
|
58064
|
+
function printFunctionParams(path4, options, print14) {
|
|
58065
58065
|
var fun = path4.getValue();
|
|
58066
58066
|
var params;
|
|
58067
58067
|
var printed = [];
|
|
58068
58068
|
if (fun.params) {
|
|
58069
58069
|
params = fun.params;
|
|
58070
|
-
printed = path4.map(
|
|
58070
|
+
printed = path4.map(print14, "params");
|
|
58071
58071
|
} else if (fun.parameters) {
|
|
58072
58072
|
params = fun.parameters;
|
|
58073
|
-
printed = path4.map(
|
|
58073
|
+
printed = path4.map(print14, "parameters");
|
|
58074
58074
|
}
|
|
58075
58075
|
if (fun.defaults) {
|
|
58076
58076
|
path4.each(function(defExprPath) {
|
|
58077
58077
|
var i2 = defExprPath.getName();
|
|
58078
58078
|
var p3 = printed[i2];
|
|
58079
58079
|
if (p3 && defExprPath.getValue()) {
|
|
58080
|
-
printed[i2] = (0, lines_1.concat)([p3, " = ",
|
|
58080
|
+
printed[i2] = (0, lines_1.concat)([p3, " = ", print14(defExprPath)]);
|
|
58081
58081
|
}
|
|
58082
58082
|
}, "defaults");
|
|
58083
58083
|
}
|
|
58084
58084
|
if (fun.rest) {
|
|
58085
|
-
printed.push((0, lines_1.concat)(["...", path4.call(
|
|
58085
|
+
printed.push((0, lines_1.concat)(["...", path4.call(print14, "rest")]));
|
|
58086
58086
|
}
|
|
58087
58087
|
var joined = (0, lines_1.fromString)(", ").join(printed);
|
|
58088
58088
|
if (joined.length > 1 || joined.getLineLength(1) > options.wrapColumn) {
|
|
@@ -58096,11 +58096,11 @@ var require_printer = __commonJS({
|
|
|
58096
58096
|
}
|
|
58097
58097
|
return joined;
|
|
58098
58098
|
}
|
|
58099
|
-
function maybePrintImportAssertions(path4, options,
|
|
58099
|
+
function maybePrintImportAssertions(path4, options, print14) {
|
|
58100
58100
|
var n = path4.getValue();
|
|
58101
58101
|
if (n.assertions && n.assertions.length > 0) {
|
|
58102
58102
|
var parts = [" assert {"];
|
|
58103
|
-
var printed = path4.map(
|
|
58103
|
+
var printed = path4.map(print14, "assertions");
|
|
58104
58104
|
var flat = (0, lines_1.fromString)(", ").join(printed);
|
|
58105
58105
|
if (flat.length > 1 || flat.getLineLength(1) > options.wrapColumn) {
|
|
58106
58106
|
parts.push("\n", (0, lines_1.fromString)(",\n").join(printed).indent(options.tabWidth), "\n}");
|
|
@@ -58111,7 +58111,7 @@ var require_printer = __commonJS({
|
|
|
58111
58111
|
}
|
|
58112
58112
|
return (0, lines_1.fromString)("");
|
|
58113
58113
|
}
|
|
58114
|
-
function printExportDeclaration(path4, options,
|
|
58114
|
+
function printExportDeclaration(path4, options, print14) {
|
|
58115
58115
|
var decl = path4.getValue();
|
|
58116
58116
|
var parts = ["export "];
|
|
58117
58117
|
if (decl.exportKind && decl.exportKind === "type") {
|
|
@@ -58125,7 +58125,7 @@ var require_printer = __commonJS({
|
|
|
58125
58125
|
parts.push("default ");
|
|
58126
58126
|
}
|
|
58127
58127
|
if (decl.declaration) {
|
|
58128
|
-
parts.push(path4.call(
|
|
58128
|
+
parts.push(path4.call(print14, "declaration"));
|
|
58129
58129
|
} else if (decl.specifiers) {
|
|
58130
58130
|
if (decl.specifiers.length === 1 && decl.specifiers[0].type === "ExportBatchSpecifier") {
|
|
58131
58131
|
parts.push("*");
|
|
@@ -58137,9 +58137,9 @@ var require_printer = __commonJS({
|
|
|
58137
58137
|
path4.each(function(specifierPath) {
|
|
58138
58138
|
var spec = specifierPath.getValue();
|
|
58139
58139
|
if (spec.type === "ExportDefaultSpecifier") {
|
|
58140
|
-
unbracedSpecifiers_2.push(
|
|
58140
|
+
unbracedSpecifiers_2.push(print14(specifierPath));
|
|
58141
58141
|
} else {
|
|
58142
|
-
bracedSpecifiers_2.push(
|
|
58142
|
+
bracedSpecifiers_2.push(print14(specifierPath));
|
|
58143
58143
|
}
|
|
58144
58144
|
}, "specifiers");
|
|
58145
58145
|
unbracedSpecifiers_2.forEach(function(lines2, i2) {
|
|
@@ -58168,10 +58168,10 @@ var require_printer = __commonJS({
|
|
|
58168
58168
|
}
|
|
58169
58169
|
}
|
|
58170
58170
|
} else {
|
|
58171
|
-
parts.push(shouldPrintSpaces ? "{ " : "{", (0, lines_1.fromString)(", ").join(path4.map(
|
|
58171
|
+
parts.push(shouldPrintSpaces ? "{ " : "{", (0, lines_1.fromString)(", ").join(path4.map(print14, "specifiers")), shouldPrintSpaces ? " }" : "}");
|
|
58172
58172
|
}
|
|
58173
58173
|
if (decl.source) {
|
|
58174
|
-
parts.push(" from ", path4.call(
|
|
58174
|
+
parts.push(" from ", path4.call(print14, "source"), maybePrintImportAssertions(path4, options, print14));
|
|
58175
58175
|
}
|
|
58176
58176
|
}
|
|
58177
58177
|
var lines = (0, lines_1.concat)(parts);
|
|
@@ -58189,7 +58189,7 @@ var require_printer = __commonJS({
|
|
|
58189
58189
|
}
|
|
58190
58190
|
return (0, lines_1.concat)(parts);
|
|
58191
58191
|
}
|
|
58192
|
-
function printVariance(path4,
|
|
58192
|
+
function printVariance(path4, print14) {
|
|
58193
58193
|
return path4.call(function(variancePath) {
|
|
58194
58194
|
var value = variancePath.getValue();
|
|
58195
58195
|
if (value) {
|
|
@@ -58199,7 +58199,7 @@ var require_printer = __commonJS({
|
|
|
58199
58199
|
if (value === "minus") {
|
|
58200
58200
|
return (0, lines_1.fromString)("-");
|
|
58201
58201
|
}
|
|
58202
|
-
return
|
|
58202
|
+
return print14(variancePath);
|
|
58203
58203
|
}
|
|
58204
58204
|
return (0, lines_1.fromString)("");
|
|
58205
58205
|
}, "variance");
|
|
@@ -58286,10 +58286,10 @@ var require_main2 = __commonJS({
|
|
|
58286
58286
|
Object.defineProperty(exports, "visit", { enumerable: true, get: function() {
|
|
58287
58287
|
return ast_types_1.visit;
|
|
58288
58288
|
} });
|
|
58289
|
-
function
|
|
58289
|
+
function print14(node, options) {
|
|
58290
58290
|
return new printer_1.Printer(options).print(node);
|
|
58291
58291
|
}
|
|
58292
|
-
exports.print =
|
|
58292
|
+
exports.print = print14;
|
|
58293
58293
|
function prettyPrint3(node, options) {
|
|
58294
58294
|
return new printer_1.Printer(options).printGenerically(node);
|
|
58295
58295
|
}
|
|
@@ -58313,7 +58313,7 @@ var require_main2 = __commonJS({
|
|
|
58313
58313
|
function runString(code, transformer, options) {
|
|
58314
58314
|
var writeback = options && options.writeback || defaultWriteback;
|
|
58315
58315
|
transformer((0, parser_1.parse)(code, options), function(node) {
|
|
58316
|
-
writeback(
|
|
58316
|
+
writeback(print14(node, options).code);
|
|
58317
58317
|
});
|
|
58318
58318
|
}
|
|
58319
58319
|
}
|
|
@@ -81917,6 +81917,7 @@ var bgCyan3 = init(46, 49);
|
|
|
81917
81917
|
var bgWhite3 = init(47, 49);
|
|
81918
81918
|
|
|
81919
81919
|
// src/cmd/init.ts
|
|
81920
|
+
var recast14 = __toESM(require_main2(), 1);
|
|
81920
81921
|
import { execSync } from "node:child_process";
|
|
81921
81922
|
function pCancel(cancelText = "Operation cancelled.") {
|
|
81922
81923
|
ne(cancelText);
|
|
@@ -82084,7 +82085,7 @@ async function init2(_path, args) {
|
|
|
82084
82085
|
);
|
|
82085
82086
|
await houdiniClient(sourceDir, typescript, frameworkInfo, url);
|
|
82086
82087
|
if (frameworkInfo.framework === "svelte") {
|
|
82087
|
-
await
|
|
82088
|
+
await svelteMainJs(targetPath, typescript);
|
|
82088
82089
|
} else if (frameworkInfo.framework === "kit") {
|
|
82089
82090
|
await svelteConfig(targetPath, typescript);
|
|
82090
82091
|
}
|
|
@@ -82183,56 +82184,61 @@ export default new HoudiniClient({
|
|
|
82183
82184
|
`;
|
|
82184
82185
|
await fs_exports.writeFile(houdiniClientPath, content);
|
|
82185
82186
|
}
|
|
82186
|
-
async function
|
|
82187
|
-
const
|
|
82187
|
+
async function svelteMainJs(targetPath, typescript) {
|
|
82188
|
+
const mainFile = typescript ? "main.ts" : "main.js";
|
|
82189
|
+
const svelteMainJsPath = path_exports.join(targetPath, "src", mainFile);
|
|
82190
|
+
const mainContents = await fs_exports.readFile(svelteMainJsPath);
|
|
82191
|
+
if (!mainContents) {
|
|
82192
|
+
throw new Error(`Failed to update ${mainFile} - cannot read`);
|
|
82193
|
+
}
|
|
82188
82194
|
const newContent = `import client from "./client";
|
|
82189
|
-
|
|
82190
|
-
import App from './App.svelte'
|
|
82191
|
-
|
|
82192
|
-
const app = new App({
|
|
82193
|
-
target: document.getElementById('app')
|
|
82194
|
-
})
|
|
82195
|
-
|
|
82196
|
-
export default app
|
|
82197
|
-
`;
|
|
82195
|
+
` + mainContents;
|
|
82198
82196
|
await fs_exports.writeFile(svelteMainJsPath, newContent);
|
|
82199
82197
|
}
|
|
82200
82198
|
async function svelteConfig(targetPath, typescript) {
|
|
82201
82199
|
const svelteConfigPath = path_exports.join(targetPath, "svelte.config.js");
|
|
82202
|
-
const
|
|
82203
|
-
|
|
82204
|
-
|
|
82205
|
-
|
|
82206
|
-
const
|
|
82207
|
-
|
|
82208
|
-
|
|
82209
|
-
|
|
82210
|
-
|
|
82211
|
-
|
|
82212
|
-
|
|
82213
|
-
|
|
82214
|
-
|
|
82215
|
-
|
|
82216
|
-
|
|
82217
|
-
|
|
82218
|
-
|
|
82219
|
-
|
|
82220
|
-
|
|
82221
|
-
|
|
82222
|
-
|
|
82223
|
-
|
|
82224
|
-
|
|
82225
|
-
|
|
82226
|
-
|
|
82227
|
-
|
|
82228
|
-
|
|
82229
|
-
|
|
82230
|
-
|
|
82231
|
-
}
|
|
82232
|
-
|
|
82233
|
-
|
|
82234
|
-
|
|
82235
|
-
|
|
82200
|
+
const contents = await fs_exports.readFile(svelteConfigPath);
|
|
82201
|
+
if (!contents) {
|
|
82202
|
+
throw new Error("Failed to patch svelte config: cannot open file");
|
|
82203
|
+
}
|
|
82204
|
+
const ast = recast14.parse(contents);
|
|
82205
|
+
recast14.visit(ast, {
|
|
82206
|
+
visitProperty(path4) {
|
|
82207
|
+
if (path4.node.key.type === "Identifier" && path4.node.key.name === "kit" && path4.node.value.type === "ObjectExpression") {
|
|
82208
|
+
const houdiniAlias = {
|
|
82209
|
+
type: "Property",
|
|
82210
|
+
key: { type: "Identifier", name: "$houdini" },
|
|
82211
|
+
value: { type: "StringLiteral", value: ".houdini/" },
|
|
82212
|
+
kind: "init"
|
|
82213
|
+
};
|
|
82214
|
+
let aliasProperty = path4.node.value.properties.find(
|
|
82215
|
+
(p3) => p3.type === "Property" && p3.key.type === "Identifier" && p3.key.name === "alias"
|
|
82216
|
+
);
|
|
82217
|
+
if (aliasProperty && aliasProperty.type === "Property" && aliasProperty.value.type === "ObjectExpression") {
|
|
82218
|
+
const existingAlias = aliasProperty.value.properties.find(
|
|
82219
|
+
(x3) => x3.type === "Property" && x3.key.type === "Identifier" && x3.key.name === "$houdini"
|
|
82220
|
+
);
|
|
82221
|
+
if (existingAlias) {
|
|
82222
|
+
existingAlias.value = houdiniAlias.value;
|
|
82223
|
+
} else {
|
|
82224
|
+
aliasProperty.value.properties.push(houdiniAlias);
|
|
82225
|
+
}
|
|
82226
|
+
} else {
|
|
82227
|
+
path4.node.value.properties.push({
|
|
82228
|
+
type: "Property",
|
|
82229
|
+
key: { type: "Identifier", name: "alias" },
|
|
82230
|
+
value: {
|
|
82231
|
+
type: "ObjectExpression",
|
|
82232
|
+
properties: [houdiniAlias]
|
|
82233
|
+
},
|
|
82234
|
+
kind: "init"
|
|
82235
|
+
});
|
|
82236
|
+
}
|
|
82237
|
+
}
|
|
82238
|
+
return false;
|
|
82239
|
+
}
|
|
82240
|
+
});
|
|
82241
|
+
await fs_exports.writeFile(svelteConfigPath, recast14.print(ast).code);
|
|
82236
82242
|
}
|
|
82237
82243
|
async function gitIgnore(targetPath) {
|
|
82238
82244
|
const filepath = path_exports.join(targetPath, ".gitignore");
|
|
@@ -82257,36 +82263,117 @@ async function graphqlRC(targetPath) {
|
|
|
82257
82263
|
}
|
|
82258
82264
|
async function viteConfig(targetPath, frameworkInfo, typescript) {
|
|
82259
82265
|
const viteConfigPath = path_exports.join(targetPath, typescript ? "vite.config.ts" : "vite.config.js");
|
|
82260
|
-
let
|
|
82266
|
+
let contents = await fs_exports.readFile(viteConfigPath);
|
|
82267
|
+
if (!contents) {
|
|
82268
|
+
throw new Error("Failed to patch vite config: cannot open file");
|
|
82269
|
+
}
|
|
82270
|
+
const ast = recast14.parse(contents);
|
|
82271
|
+
const houdiniImport = {
|
|
82272
|
+
type: "ImportDeclaration",
|
|
82273
|
+
specifiers: [
|
|
82274
|
+
{
|
|
82275
|
+
type: "ImportDefaultSpecifier",
|
|
82276
|
+
local: { type: "Identifier", name: "houdini" }
|
|
82277
|
+
}
|
|
82278
|
+
],
|
|
82279
|
+
source: { type: "Literal", value: "houdini/vite" }
|
|
82280
|
+
};
|
|
82281
|
+
ast.program.body.unshift(houdiniImport);
|
|
82282
|
+
recast14.visit(ast, {
|
|
82283
|
+
visitProperty(path4) {
|
|
82284
|
+
if (path4.node.key.type === "Identifier" && path4.node.key.name === "plugins") {
|
|
82285
|
+
if (path4.node.value.type === "ArrayExpression") {
|
|
82286
|
+
path4.node.value.elements.unshift({
|
|
82287
|
+
type: "CallExpression",
|
|
82288
|
+
callee: {
|
|
82289
|
+
type: "Identifier",
|
|
82290
|
+
name: "houdini"
|
|
82291
|
+
},
|
|
82292
|
+
arguments: []
|
|
82293
|
+
});
|
|
82294
|
+
}
|
|
82295
|
+
}
|
|
82296
|
+
return false;
|
|
82297
|
+
}
|
|
82298
|
+
});
|
|
82261
82299
|
if (frameworkInfo.framework === "svelte") {
|
|
82262
|
-
|
|
82263
|
-
|
|
82264
|
-
|
|
82265
|
-
|
|
82266
|
-
|
|
82267
|
-
|
|
82268
|
-
|
|
82269
|
-
|
|
82270
|
-
|
|
82271
|
-
|
|
82272
|
-
|
|
82273
|
-
|
|
82274
|
-
|
|
82275
|
-
|
|
82276
|
-
|
|
82277
|
-
|
|
82278
|
-
|
|
82279
|
-
|
|
82280
|
-
|
|
82281
|
-
|
|
82282
|
-
|
|
82283
|
-
|
|
82284
|
-
|
|
82285
|
-
|
|
82286
|
-
|
|
82287
|
-
|
|
82300
|
+
const houdiniAliasProperty = {
|
|
82301
|
+
type: "Property",
|
|
82302
|
+
key: { type: "Identifier", name: "$houdini" },
|
|
82303
|
+
value: { type: "StringLiteral", value: ".houdini/" },
|
|
82304
|
+
kind: "init"
|
|
82305
|
+
};
|
|
82306
|
+
const aliasValue = {
|
|
82307
|
+
type: "ObjectExpression",
|
|
82308
|
+
properties: [houdiniAliasProperty]
|
|
82309
|
+
};
|
|
82310
|
+
const resolveValue = {
|
|
82311
|
+
type: "ObjectExpression",
|
|
82312
|
+
properties: [
|
|
82313
|
+
{
|
|
82314
|
+
type: "Property",
|
|
82315
|
+
key: { type: "Identifier", name: "alias" },
|
|
82316
|
+
value: aliasValue,
|
|
82317
|
+
kind: "init"
|
|
82318
|
+
}
|
|
82319
|
+
]
|
|
82320
|
+
};
|
|
82321
|
+
recast14.visit(ast, {
|
|
82322
|
+
visitCallExpression(path4) {
|
|
82323
|
+
const config = path4.node.arguments[0];
|
|
82324
|
+
if (!config || config.type !== "ObjectExpression") {
|
|
82325
|
+
throw new Error(
|
|
82326
|
+
"Failed to patch vite config: Couldn't update `defineConfig` param - not an object"
|
|
82327
|
+
);
|
|
82328
|
+
}
|
|
82329
|
+
const resolveProperty = config.properties.find(
|
|
82330
|
+
(x3) => x3.type === "Property" && x3.key.type === "Identifier" && x3.key.name === "resolve"
|
|
82331
|
+
);
|
|
82332
|
+
if (!resolveProperty) {
|
|
82333
|
+
config.properties.push({
|
|
82334
|
+
type: "Property",
|
|
82335
|
+
key: { type: "Identifier", name: "resolve" },
|
|
82336
|
+
value: resolveValue,
|
|
82337
|
+
kind: "init"
|
|
82338
|
+
});
|
|
82339
|
+
} else {
|
|
82340
|
+
if (resolveProperty.value.type !== "ObjectExpression") {
|
|
82341
|
+
throw new Error(
|
|
82342
|
+
"Failed to patch vite config: Couldn't update `resolve` field - not an object"
|
|
82343
|
+
);
|
|
82344
|
+
}
|
|
82345
|
+
const aliasProperty = resolveProperty.value.properties.find(
|
|
82346
|
+
(x3) => x3.type === "Property" && x3.key.type === "Identifier" && x3.key.name === "alias"
|
|
82347
|
+
);
|
|
82348
|
+
if (!aliasProperty) {
|
|
82349
|
+
resolveProperty.value.properties.push({
|
|
82350
|
+
type: "Property",
|
|
82351
|
+
key: { type: "Identifier", name: "alias" },
|
|
82352
|
+
value: aliasValue,
|
|
82353
|
+
kind: "init"
|
|
82354
|
+
});
|
|
82355
|
+
} else {
|
|
82356
|
+
if (aliasProperty.value.type !== "ObjectExpression") {
|
|
82357
|
+
throw new Error(
|
|
82358
|
+
"Failed to patch vite config: Couldn't update `alias` field - not an object"
|
|
82359
|
+
);
|
|
82360
|
+
}
|
|
82361
|
+
const houdiniAlias = aliasProperty.value.properties.find(
|
|
82362
|
+
(x3) => x3.type === "Property" && x3.key.type === "Identifier" && x3.key.name === "$houdini"
|
|
82363
|
+
);
|
|
82364
|
+
if (!houdiniAlias) {
|
|
82365
|
+
aliasProperty.value.properties.push(houdiniAliasProperty);
|
|
82366
|
+
} else {
|
|
82367
|
+
houdiniAlias.value = houdiniAliasProperty.value;
|
|
82368
|
+
}
|
|
82369
|
+
}
|
|
82370
|
+
}
|
|
82371
|
+
return false;
|
|
82372
|
+
}
|
|
82373
|
+
});
|
|
82288
82374
|
}
|
|
82289
|
-
|
|
82375
|
+
contents = recast14.print(ast).code;
|
|
82376
|
+
await fs_exports.writeFile(viteConfigPath, recast14.print(ast).code);
|
|
82290
82377
|
}
|
|
82291
82378
|
async function tjsConfig(targetPath, frameworkInfo) {
|
|
82292
82379
|
let configFile = path_exports.join(targetPath, "tsconfig.json");
|
|
@@ -82331,12 +82418,12 @@ async function packageJSON(targetPath, frameworkInfo) {
|
|
|
82331
82418
|
}
|
|
82332
82419
|
packageJSON2.devDependencies = {
|
|
82333
82420
|
...packageJSON2.devDependencies,
|
|
82334
|
-
houdini: "^1.5.
|
|
82421
|
+
houdini: "^1.5.2"
|
|
82335
82422
|
};
|
|
82336
82423
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
82337
82424
|
packageJSON2.devDependencies = {
|
|
82338
82425
|
...packageJSON2.devDependencies,
|
|
82339
|
-
"houdini-svelte": "^2.1.
|
|
82426
|
+
"houdini-svelte": "^2.1.6"
|
|
82340
82427
|
};
|
|
82341
82428
|
} else {
|
|
82342
82429
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|