houdini 1.4.3 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cmd-cjs/index.js +531 -444
- package/build/cmd-esm/index.js +531 -444
- package/build/lib-cjs/index.js +1 -1
- package/build/lib-esm/index.js +1 -1
- package/build/test-cjs/index.js +1 -1
- package/build/test-esm/index.js +1 -1
- package/build/vite-cjs/index.js +1 -1
- package/build/vite-esm/index.js +1 -1
- package/package.json +2 -3
package/build/cmd-cjs/index.js
CHANGED
|
@@ -33063,14 +33063,14 @@ var require_lib6 = __commonJS({
|
|
|
33063
33063
|
super.checkParams(node, false, true);
|
|
33064
33064
|
this.scope.exit();
|
|
33065
33065
|
}
|
|
33066
|
-
forwardNoArrowParamsConversionAt(node,
|
|
33066
|
+
forwardNoArrowParamsConversionAt(node, parse14) {
|
|
33067
33067
|
let result;
|
|
33068
33068
|
if (this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
|
|
33069
33069
|
this.state.noArrowParamsConversionAt.push(this.state.start);
|
|
33070
|
-
result =
|
|
33070
|
+
result = parse14();
|
|
33071
33071
|
this.state.noArrowParamsConversionAt.pop();
|
|
33072
33072
|
} else {
|
|
33073
|
-
result =
|
|
33073
|
+
result = parse14();
|
|
33074
33074
|
}
|
|
33075
33075
|
return result;
|
|
33076
33076
|
}
|
|
@@ -41905,7 +41905,7 @@ var require_lib6 = __commonJS({
|
|
|
41905
41905
|
}
|
|
41906
41906
|
return pluginMap;
|
|
41907
41907
|
}
|
|
41908
|
-
function
|
|
41908
|
+
function parse13(input, options) {
|
|
41909
41909
|
var _options2;
|
|
41910
41910
|
if (((_options2 = options) == null ? void 0 : _options2.sourceType) === "unambiguous") {
|
|
41911
41911
|
options = Object.assign({}, options);
|
|
@@ -41975,7 +41975,7 @@ var require_lib6 = __commonJS({
|
|
|
41975
41975
|
}
|
|
41976
41976
|
return cls;
|
|
41977
41977
|
}
|
|
41978
|
-
exports.parse =
|
|
41978
|
+
exports.parse = parse13;
|
|
41979
41979
|
exports.parseExpression = parseExpression;
|
|
41980
41980
|
exports.tokTypes = tokTypes;
|
|
41981
41981
|
}
|
|
@@ -44250,7 +44250,7 @@ var require_path_visitor = __commonJS({
|
|
|
44250
44250
|
}
|
|
44251
44251
|
return target;
|
|
44252
44252
|
}
|
|
44253
|
-
PathVisitor.visit = function
|
|
44253
|
+
PathVisitor.visit = function visit21(node, methods) {
|
|
44254
44254
|
return PathVisitor.fromMethodsObject(methods).visit(node);
|
|
44255
44255
|
};
|
|
44256
44256
|
var PVp = PathVisitor.prototype;
|
|
@@ -44441,7 +44441,7 @@ var require_path_visitor = __commonJS({
|
|
|
44441
44441
|
this.needToCallTraverse = false;
|
|
44442
44442
|
return visitChildren(path4, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
|
|
44443
44443
|
};
|
|
44444
|
-
sharedContextProtoMethods.visit = function
|
|
44444
|
+
sharedContextProtoMethods.visit = function visit21(path4, newVisitor) {
|
|
44445
44445
|
if (!(this instanceof this.Context)) {
|
|
44446
44446
|
throw new Error("");
|
|
44447
44447
|
}
|
|
@@ -45834,7 +45834,7 @@ var require_main = __commonJS({
|
|
|
45834
45834
|
var someField = _a.someField;
|
|
45835
45835
|
var Type = _a.Type;
|
|
45836
45836
|
var use = _a.use;
|
|
45837
|
-
var
|
|
45837
|
+
var visit21 = _a.visit;
|
|
45838
45838
|
exports.astNodesAreEquivalent = astNodesAreEquivalent;
|
|
45839
45839
|
exports.builders = builders;
|
|
45840
45840
|
exports.builtInTypes = builtInTypes;
|
|
@@ -45851,7 +45851,7 @@ var require_main = __commonJS({
|
|
|
45851
45851
|
exports.someField = someField;
|
|
45852
45852
|
exports.Type = Type;
|
|
45853
45853
|
exports.use = use;
|
|
45854
|
-
exports.visit =
|
|
45854
|
+
exports.visit = visit21;
|
|
45855
45855
|
Object.assign(namedTypes_1.namedTypes, n);
|
|
45856
45856
|
}
|
|
45857
45857
|
});
|
|
@@ -47921,7 +47921,7 @@ var require_esprima2 = __commonJS({
|
|
|
47921
47921
|
var jsx_parser_1 = __webpack_require__(3);
|
|
47922
47922
|
var parser_1 = __webpack_require__(8);
|
|
47923
47923
|
var tokenizer_1 = __webpack_require__(15);
|
|
47924
|
-
function
|
|
47924
|
+
function parse13(code, options, delegate) {
|
|
47925
47925
|
var commentHandler = null;
|
|
47926
47926
|
var proxyDelegate = function(node, metadata) {
|
|
47927
47927
|
if (delegate) {
|
|
@@ -47966,17 +47966,17 @@ var require_esprima2 = __commonJS({
|
|
|
47966
47966
|
}
|
|
47967
47967
|
return ast;
|
|
47968
47968
|
}
|
|
47969
|
-
exports2.parse =
|
|
47969
|
+
exports2.parse = parse13;
|
|
47970
47970
|
function parseModule(code, options, delegate) {
|
|
47971
47971
|
var parsingOptions = options || {};
|
|
47972
47972
|
parsingOptions.sourceType = "module";
|
|
47973
|
-
return
|
|
47973
|
+
return parse13(code, parsingOptions, delegate);
|
|
47974
47974
|
}
|
|
47975
47975
|
exports2.parseModule = parseModule;
|
|
47976
47976
|
function parseScript(code, options, delegate) {
|
|
47977
47977
|
var parsingOptions = options || {};
|
|
47978
47978
|
parsingOptions.sourceType = "script";
|
|
47979
|
-
return
|
|
47979
|
+
return parse13(code, parsingOptions, delegate);
|
|
47980
47980
|
}
|
|
47981
47981
|
exports2.parseScript = parseScript;
|
|
47982
47982
|
function tokenize(code, options, delegate) {
|
|
@@ -54040,7 +54040,7 @@ var require_esprima3 = __commonJS({
|
|
|
54040
54040
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54041
54041
|
exports.parse = void 0;
|
|
54042
54042
|
var util_1 = require_util2();
|
|
54043
|
-
function
|
|
54043
|
+
function parse13(source, options) {
|
|
54044
54044
|
var comments = [];
|
|
54045
54045
|
var ast = require_esprima2().parse(source, {
|
|
54046
54046
|
loc: true,
|
|
@@ -54058,7 +54058,7 @@ var require_esprima3 = __commonJS({
|
|
|
54058
54058
|
}
|
|
54059
54059
|
return ast;
|
|
54060
54060
|
}
|
|
54061
|
-
exports.parse =
|
|
54061
|
+
exports.parse = parse13;
|
|
54062
54062
|
}
|
|
54063
54063
|
});
|
|
54064
54064
|
|
|
@@ -55100,12 +55100,12 @@ var require_comments = __commonJS({
|
|
|
55100
55100
|
comment.trailing = true;
|
|
55101
55101
|
addCommentHelper(node, comment);
|
|
55102
55102
|
}
|
|
55103
|
-
function printLeadingComment(commentPath,
|
|
55103
|
+
function printLeadingComment(commentPath, print14) {
|
|
55104
55104
|
var comment = commentPath.getValue();
|
|
55105
55105
|
n.Comment.assert(comment);
|
|
55106
55106
|
var loc = comment.loc;
|
|
55107
55107
|
var lines = loc && loc.lines;
|
|
55108
|
-
var parts = [
|
|
55108
|
+
var parts = [print14(commentPath)];
|
|
55109
55109
|
if (comment.trailing) {
|
|
55110
55110
|
parts.push("\n");
|
|
55111
55111
|
} else if (lines instanceof lines_1.Lines) {
|
|
@@ -55120,7 +55120,7 @@ var require_comments = __commonJS({
|
|
|
55120
55120
|
}
|
|
55121
55121
|
return (0, lines_1.concat)(parts);
|
|
55122
55122
|
}
|
|
55123
|
-
function printTrailingComment(commentPath,
|
|
55123
|
+
function printTrailingComment(commentPath, print14) {
|
|
55124
55124
|
var comment = commentPath.getValue(commentPath);
|
|
55125
55125
|
n.Comment.assert(comment);
|
|
55126
55126
|
var loc = comment.loc;
|
|
@@ -55135,12 +55135,12 @@ var require_comments = __commonJS({
|
|
|
55135
55135
|
parts.push(new Array(leadingSpace.length).join("\n"));
|
|
55136
55136
|
}
|
|
55137
55137
|
}
|
|
55138
|
-
parts.push(
|
|
55138
|
+
parts.push(print14(commentPath));
|
|
55139
55139
|
return (0, lines_1.concat)(parts);
|
|
55140
55140
|
}
|
|
55141
|
-
function printComments(path4,
|
|
55141
|
+
function printComments(path4, print14) {
|
|
55142
55142
|
var value = path4.getValue();
|
|
55143
|
-
var innerLines =
|
|
55143
|
+
var innerLines = print14(path4);
|
|
55144
55144
|
var comments = n.Node.check(value) && types17.getFieldValue(value, "comments");
|
|
55145
55145
|
if (!comments || comments.length === 0) {
|
|
55146
55146
|
return innerLines;
|
|
@@ -55152,9 +55152,9 @@ var require_comments = __commonJS({
|
|
|
55152
55152
|
var leading = types17.getFieldValue(comment, "leading");
|
|
55153
55153
|
var trailing = types17.getFieldValue(comment, "trailing");
|
|
55154
55154
|
if (leading || trailing && !(n.Statement.check(value) || comment.type === "Block" || comment.type === "CommentBlock")) {
|
|
55155
|
-
leadingParts.push(printLeadingComment(commentPath,
|
|
55155
|
+
leadingParts.push(printLeadingComment(commentPath, print14));
|
|
55156
55156
|
} else if (trailing) {
|
|
55157
|
-
trailingParts.push(printTrailingComment(commentPath,
|
|
55157
|
+
trailingParts.push(printTrailingComment(commentPath, print14));
|
|
55158
55158
|
}
|
|
55159
55159
|
}, "comments");
|
|
55160
55160
|
leadingParts.push.apply(leadingParts, trailingParts);
|
|
@@ -55180,7 +55180,7 @@ var require_parser = __commonJS({
|
|
|
55180
55180
|
var lines_1 = require_lines();
|
|
55181
55181
|
var comments_1 = require_comments();
|
|
55182
55182
|
var util = tslib_1.__importStar(require_util2());
|
|
55183
|
-
function
|
|
55183
|
+
function parse13(source, options) {
|
|
55184
55184
|
options = (0, options_1.normalize)(options);
|
|
55185
55185
|
var lines = (0, lines_1.fromString)(source, options);
|
|
55186
55186
|
var sourceWithoutTabs = lines.toString({
|
|
@@ -55252,7 +55252,7 @@ var require_parser = __commonJS({
|
|
|
55252
55252
|
(0, comments_1.attach)(comments, program3.body.length ? file.program : file, lines);
|
|
55253
55253
|
return new TreeCopier(lines, tokens).copy(file);
|
|
55254
55254
|
}
|
|
55255
|
-
exports.parse =
|
|
55255
|
+
exports.parse = parse13;
|
|
55256
55256
|
var TreeCopier = function TreeCopier2(lines, tokens) {
|
|
55257
55257
|
assert_1.default.ok(this instanceof TreeCopier2);
|
|
55258
55258
|
this.lines = lines;
|
|
@@ -55845,7 +55845,7 @@ var require_patcher = __commonJS({
|
|
|
55845
55845
|
};
|
|
55846
55846
|
exports.Patcher = Patcher;
|
|
55847
55847
|
var Pp = Patcher.prototype;
|
|
55848
|
-
Pp.tryToReprintComments = function(newNode, oldNode,
|
|
55848
|
+
Pp.tryToReprintComments = function(newNode, oldNode, print14) {
|
|
55849
55849
|
var patcher = this;
|
|
55850
55850
|
if (!newNode.comments && !oldNode.comments) {
|
|
55851
55851
|
return true;
|
|
@@ -55862,7 +55862,7 @@ var require_patcher = __commonJS({
|
|
|
55862
55862
|
assert_1.default.ok(oldComment.leading || oldComment.trailing);
|
|
55863
55863
|
patcher.replace(
|
|
55864
55864
|
oldComment.loc,
|
|
55865
|
-
|
|
55865
|
+
print14(reprint.newPath).indentTail(oldComment.loc.indent)
|
|
55866
55866
|
);
|
|
55867
55867
|
});
|
|
55868
55868
|
}
|
|
@@ -55909,17 +55909,17 @@ var require_patcher = __commonJS({
|
|
|
55909
55909
|
var reprints = [];
|
|
55910
55910
|
if (!lines || !findReprints(path4, reprints))
|
|
55911
55911
|
return;
|
|
55912
|
-
return function(
|
|
55912
|
+
return function(print14) {
|
|
55913
55913
|
var patcher = new Patcher(lines);
|
|
55914
55914
|
reprints.forEach(function(reprint) {
|
|
55915
55915
|
var newNode = reprint.newPath.getValue();
|
|
55916
55916
|
var oldNode = reprint.oldPath.getValue();
|
|
55917
55917
|
SourceLocation.assert(oldNode.loc, true);
|
|
55918
|
-
var needToPrintNewPathWithComments = !patcher.tryToReprintComments(newNode, oldNode,
|
|
55918
|
+
var needToPrintNewPathWithComments = !patcher.tryToReprintComments(newNode, oldNode, print14);
|
|
55919
55919
|
if (needToPrintNewPathWithComments) {
|
|
55920
55920
|
patcher.deleteComments(oldNode);
|
|
55921
55921
|
}
|
|
55922
|
-
var newLines =
|
|
55922
|
+
var newLines = print14(reprint.newPath, {
|
|
55923
55923
|
includeComments: needToPrintNewPathWithComments,
|
|
55924
55924
|
avoidRootParens: oldNode.type === newNode.type && reprint.oldPath.hasParens()
|
|
55925
55925
|
}).indentTail(oldNode.loc.indent);
|
|
@@ -56136,10 +56136,10 @@ var require_printer = __commonJS({
|
|
|
56136
56136
|
function makePrintFunctionWith(options, overrides) {
|
|
56137
56137
|
options = Object.assign({}, options, overrides);
|
|
56138
56138
|
return function(path4) {
|
|
56139
|
-
return
|
|
56139
|
+
return print14(path4, options);
|
|
56140
56140
|
};
|
|
56141
56141
|
}
|
|
56142
|
-
function
|
|
56142
|
+
function print14(path4, options) {
|
|
56143
56143
|
assert_1.default.ok(path4 instanceof fast_path_1.default);
|
|
56144
56144
|
options = options || {};
|
|
56145
56145
|
if (options.includeComments) {
|
|
@@ -56155,7 +56155,7 @@ var require_printer = __commonJS({
|
|
|
56155
56155
|
}
|
|
56156
56156
|
}
|
|
56157
56157
|
var reprinter = (0, patcher_1.getReprinter)(path4);
|
|
56158
|
-
var lines = reprinter ? reprinter(
|
|
56158
|
+
var lines = reprinter ? reprinter(print14) : genericPrint(path4, config, options, makePrintFunctionWith(options, {
|
|
56159
56159
|
includeComments: true,
|
|
56160
56160
|
avoidRootParens: false
|
|
56161
56161
|
}));
|
|
@@ -56166,7 +56166,7 @@ var require_printer = __commonJS({
|
|
|
56166
56166
|
if (!ast) {
|
|
56167
56167
|
return emptyPrintResult;
|
|
56168
56168
|
}
|
|
56169
|
-
var lines =
|
|
56169
|
+
var lines = print14(fast_path_1.default.from(ast), {
|
|
56170
56170
|
includeComments: true,
|
|
56171
56171
|
avoidRootParens: false
|
|
56172
56172
|
});
|
|
@@ -56219,7 +56219,7 @@ var require_printer = __commonJS({
|
|
|
56219
56219
|
}
|
|
56220
56220
|
return (0, lines_1.concat)(parts);
|
|
56221
56221
|
}
|
|
56222
|
-
function genericPrintNoParens(path4, options,
|
|
56222
|
+
function genericPrintNoParens(path4, options, print14) {
|
|
56223
56223
|
var n = path4.getValue();
|
|
56224
56224
|
if (!n) {
|
|
56225
56225
|
return (0, lines_1.fromString)("");
|
|
@@ -56231,45 +56231,45 @@ var require_printer = __commonJS({
|
|
|
56231
56231
|
var parts = [];
|
|
56232
56232
|
switch (n.type) {
|
|
56233
56233
|
case "File":
|
|
56234
|
-
return path4.call(
|
|
56234
|
+
return path4.call(print14, "program");
|
|
56235
56235
|
case "Program":
|
|
56236
56236
|
if (n.directives) {
|
|
56237
56237
|
path4.each(function(childPath) {
|
|
56238
|
-
parts.push(
|
|
56238
|
+
parts.push(print14(childPath), ";\n");
|
|
56239
56239
|
}, "directives");
|
|
56240
56240
|
}
|
|
56241
56241
|
if (n.interpreter) {
|
|
56242
|
-
parts.push(path4.call(
|
|
56242
|
+
parts.push(path4.call(print14, "interpreter"));
|
|
56243
56243
|
}
|
|
56244
56244
|
parts.push(path4.call(function(bodyPath) {
|
|
56245
|
-
return printStatementSequence(bodyPath, options,
|
|
56245
|
+
return printStatementSequence(bodyPath, options, print14);
|
|
56246
56246
|
}, "body"));
|
|
56247
56247
|
return (0, lines_1.concat)(parts);
|
|
56248
56248
|
case "Noop":
|
|
56249
56249
|
case "EmptyStatement":
|
|
56250
56250
|
return (0, lines_1.fromString)("");
|
|
56251
56251
|
case "ExpressionStatement":
|
|
56252
|
-
return (0, lines_1.concat)([path4.call(
|
|
56252
|
+
return (0, lines_1.concat)([path4.call(print14, "expression"), ";"]);
|
|
56253
56253
|
case "ParenthesizedExpression":
|
|
56254
|
-
return (0, lines_1.concat)(["(", path4.call(
|
|
56254
|
+
return (0, lines_1.concat)(["(", path4.call(print14, "expression"), ")"]);
|
|
56255
56255
|
case "BinaryExpression":
|
|
56256
56256
|
case "LogicalExpression":
|
|
56257
56257
|
case "AssignmentExpression":
|
|
56258
56258
|
return (0, lines_1.fromString)(" ").join([
|
|
56259
|
-
path4.call(
|
|
56259
|
+
path4.call(print14, "left"),
|
|
56260
56260
|
n.operator,
|
|
56261
|
-
path4.call(
|
|
56261
|
+
path4.call(print14, "right")
|
|
56262
56262
|
]);
|
|
56263
56263
|
case "AssignmentPattern":
|
|
56264
56264
|
return (0, lines_1.concat)([
|
|
56265
|
-
path4.call(
|
|
56265
|
+
path4.call(print14, "left"),
|
|
56266
56266
|
" = ",
|
|
56267
|
-
path4.call(
|
|
56267
|
+
path4.call(print14, "right")
|
|
56268
56268
|
]);
|
|
56269
56269
|
case "MemberExpression":
|
|
56270
56270
|
case "OptionalMemberExpression": {
|
|
56271
|
-
parts.push(path4.call(
|
|
56272
|
-
var property = path4.call(
|
|
56271
|
+
parts.push(path4.call(print14, "object"));
|
|
56272
|
+
var property = path4.call(print14, "property");
|
|
56273
56273
|
var optional = types17.getFieldValue(n, "optional");
|
|
56274
56274
|
if (n.computed) {
|
|
56275
56275
|
parts.push(optional ? "?.[" : "[", property, "]");
|
|
@@ -56279,18 +56279,18 @@ var require_printer = __commonJS({
|
|
|
56279
56279
|
return (0, lines_1.concat)(parts);
|
|
56280
56280
|
}
|
|
56281
56281
|
case "ChainExpression":
|
|
56282
|
-
return path4.call(
|
|
56282
|
+
return path4.call(print14, "expression");
|
|
56283
56283
|
case "MetaProperty":
|
|
56284
56284
|
return (0, lines_1.concat)([
|
|
56285
|
-
path4.call(
|
|
56285
|
+
path4.call(print14, "meta"),
|
|
56286
56286
|
".",
|
|
56287
|
-
path4.call(
|
|
56287
|
+
path4.call(print14, "property")
|
|
56288
56288
|
]);
|
|
56289
56289
|
case "BindExpression":
|
|
56290
56290
|
if (n.object) {
|
|
56291
|
-
parts.push(path4.call(
|
|
56291
|
+
parts.push(path4.call(print14, "object"));
|
|
56292
56292
|
}
|
|
56293
|
-
parts.push("::", path4.call(
|
|
56293
|
+
parts.push("::", path4.call(print14, "callee"));
|
|
56294
56294
|
return (0, lines_1.concat)(parts);
|
|
56295
56295
|
case "Path":
|
|
56296
56296
|
return (0, lines_1.fromString)(".").join(n.body);
|
|
@@ -56298,7 +56298,7 @@ var require_printer = __commonJS({
|
|
|
56298
56298
|
return (0, lines_1.concat)([
|
|
56299
56299
|
(0, lines_1.fromString)(n.name, options),
|
|
56300
56300
|
n.optional ? "?" : "",
|
|
56301
|
-
path4.call(
|
|
56301
|
+
path4.call(print14, "typeAnnotation")
|
|
56302
56302
|
]);
|
|
56303
56303
|
case "SpreadElement":
|
|
56304
56304
|
case "SpreadElementPattern":
|
|
@@ -56309,8 +56309,8 @@ var require_printer = __commonJS({
|
|
|
56309
56309
|
case "RestElement":
|
|
56310
56310
|
return (0, lines_1.concat)([
|
|
56311
56311
|
"...",
|
|
56312
|
-
path4.call(
|
|
56313
|
-
path4.call(
|
|
56312
|
+
path4.call(print14, "argument"),
|
|
56313
|
+
path4.call(print14, "typeAnnotation")
|
|
56314
56314
|
]);
|
|
56315
56315
|
case "FunctionDeclaration":
|
|
56316
56316
|
case "FunctionExpression":
|
|
@@ -56325,15 +56325,15 @@ var require_printer = __commonJS({
|
|
|
56325
56325
|
if (n.generator)
|
|
56326
56326
|
parts.push("*");
|
|
56327
56327
|
if (n.id) {
|
|
56328
|
-
parts.push(" ", path4.call(
|
|
56328
|
+
parts.push(" ", path4.call(print14, "id"), path4.call(print14, "typeParameters"));
|
|
56329
56329
|
} else {
|
|
56330
56330
|
if (n.typeParameters) {
|
|
56331
|
-
parts.push(path4.call(
|
|
56331
|
+
parts.push(path4.call(print14, "typeParameters"));
|
|
56332
56332
|
}
|
|
56333
56333
|
}
|
|
56334
|
-
parts.push("(", printFunctionParams(path4, options,
|
|
56334
|
+
parts.push("(", printFunctionParams(path4, options, print14), ")", path4.call(print14, "returnType"));
|
|
56335
56335
|
if (n.body) {
|
|
56336
|
-
parts.push(" ", path4.call(
|
|
56336
|
+
parts.push(" ", path4.call(print14, "body"));
|
|
56337
56337
|
}
|
|
56338
56338
|
return (0, lines_1.concat)(parts);
|
|
56339
56339
|
case "ArrowFunctionExpression":
|
|
@@ -56341,44 +56341,44 @@ var require_printer = __commonJS({
|
|
|
56341
56341
|
parts.push("async ");
|
|
56342
56342
|
}
|
|
56343
56343
|
if (n.typeParameters) {
|
|
56344
|
-
parts.push(path4.call(
|
|
56344
|
+
parts.push(path4.call(print14, "typeParameters"));
|
|
56345
56345
|
}
|
|
56346
56346
|
if (!options.arrowParensAlways && n.params.length === 1 && !n.rest && n.params[0].type === "Identifier" && !n.params[0].typeAnnotation && !n.returnType) {
|
|
56347
|
-
parts.push(path4.call(
|
|
56347
|
+
parts.push(path4.call(print14, "params", 0));
|
|
56348
56348
|
} else {
|
|
56349
|
-
parts.push("(", printFunctionParams(path4, options,
|
|
56349
|
+
parts.push("(", printFunctionParams(path4, options, print14), ")", path4.call(print14, "returnType"));
|
|
56350
56350
|
}
|
|
56351
|
-
parts.push(" => ", path4.call(
|
|
56351
|
+
parts.push(" => ", path4.call(print14, "body"));
|
|
56352
56352
|
return (0, lines_1.concat)(parts);
|
|
56353
56353
|
case "MethodDefinition":
|
|
56354
|
-
return printMethod(path4, options,
|
|
56354
|
+
return printMethod(path4, options, print14);
|
|
56355
56355
|
case "YieldExpression":
|
|
56356
56356
|
parts.push("yield");
|
|
56357
56357
|
if (n.delegate)
|
|
56358
56358
|
parts.push("*");
|
|
56359
56359
|
if (n.argument)
|
|
56360
|
-
parts.push(" ", path4.call(
|
|
56360
|
+
parts.push(" ", path4.call(print14, "argument"));
|
|
56361
56361
|
return (0, lines_1.concat)(parts);
|
|
56362
56362
|
case "AwaitExpression":
|
|
56363
56363
|
parts.push("await");
|
|
56364
56364
|
if (n.all)
|
|
56365
56365
|
parts.push("*");
|
|
56366
56366
|
if (n.argument)
|
|
56367
|
-
parts.push(" ", path4.call(
|
|
56367
|
+
parts.push(" ", path4.call(print14, "argument"));
|
|
56368
56368
|
return (0, lines_1.concat)(parts);
|
|
56369
56369
|
case "ModuleExpression":
|
|
56370
56370
|
return (0, lines_1.concat)([
|
|
56371
56371
|
"module {\n",
|
|
56372
|
-
path4.call(
|
|
56372
|
+
path4.call(print14, "body").indent(options.tabWidth),
|
|
56373
56373
|
"\n}"
|
|
56374
56374
|
]);
|
|
56375
56375
|
case "ModuleDeclaration":
|
|
56376
|
-
parts.push("module", path4.call(
|
|
56376
|
+
parts.push("module", path4.call(print14, "id"));
|
|
56377
56377
|
if (n.source) {
|
|
56378
56378
|
assert_1.default.ok(!n.body);
|
|
56379
|
-
parts.push("from", path4.call(
|
|
56379
|
+
parts.push("from", path4.call(print14, "source"));
|
|
56380
56380
|
} else {
|
|
56381
|
-
parts.push(path4.call(
|
|
56381
|
+
parts.push(path4.call(print14, "body"));
|
|
56382
56382
|
}
|
|
56383
56383
|
return (0, lines_1.fromString)(" ").join(parts);
|
|
56384
56384
|
case "ImportSpecifier":
|
|
@@ -56386,27 +56386,27 @@ var require_printer = __commonJS({
|
|
|
56386
56386
|
parts.push(n.importKind + " ");
|
|
56387
56387
|
}
|
|
56388
56388
|
if (n.imported) {
|
|
56389
|
-
parts.push(path4.call(
|
|
56389
|
+
parts.push(path4.call(print14, "imported"));
|
|
56390
56390
|
if (n.local && n.local.name !== n.imported.name) {
|
|
56391
|
-
parts.push(" as ", path4.call(
|
|
56391
|
+
parts.push(" as ", path4.call(print14, "local"));
|
|
56392
56392
|
}
|
|
56393
56393
|
} else if (n.id) {
|
|
56394
|
-
parts.push(path4.call(
|
|
56394
|
+
parts.push(path4.call(print14, "id"));
|
|
56395
56395
|
if (n.name) {
|
|
56396
|
-
parts.push(" as ", path4.call(
|
|
56396
|
+
parts.push(" as ", path4.call(print14, "name"));
|
|
56397
56397
|
}
|
|
56398
56398
|
}
|
|
56399
56399
|
return (0, lines_1.concat)(parts);
|
|
56400
56400
|
case "ExportSpecifier":
|
|
56401
56401
|
if (n.local) {
|
|
56402
|
-
parts.push(path4.call(
|
|
56402
|
+
parts.push(path4.call(print14, "local"));
|
|
56403
56403
|
if (n.exported && n.exported.name !== n.local.name) {
|
|
56404
|
-
parts.push(" as ", path4.call(
|
|
56404
|
+
parts.push(" as ", path4.call(print14, "exported"));
|
|
56405
56405
|
}
|
|
56406
56406
|
} else if (n.id) {
|
|
56407
|
-
parts.push(path4.call(
|
|
56407
|
+
parts.push(path4.call(print14, "id"));
|
|
56408
56408
|
if (n.name) {
|
|
56409
|
-
parts.push(" as ", path4.call(
|
|
56409
|
+
parts.push(" as ", path4.call(print14, "name"));
|
|
56410
56410
|
}
|
|
56411
56411
|
}
|
|
56412
56412
|
return (0, lines_1.concat)(parts);
|
|
@@ -56415,40 +56415,40 @@ var require_printer = __commonJS({
|
|
|
56415
56415
|
case "ImportNamespaceSpecifier":
|
|
56416
56416
|
parts.push("* as ");
|
|
56417
56417
|
if (n.local) {
|
|
56418
|
-
parts.push(path4.call(
|
|
56418
|
+
parts.push(path4.call(print14, "local"));
|
|
56419
56419
|
} else if (n.id) {
|
|
56420
|
-
parts.push(path4.call(
|
|
56420
|
+
parts.push(path4.call(print14, "id"));
|
|
56421
56421
|
}
|
|
56422
56422
|
return (0, lines_1.concat)(parts);
|
|
56423
56423
|
case "ImportDefaultSpecifier":
|
|
56424
56424
|
if (n.local) {
|
|
56425
|
-
return path4.call(
|
|
56425
|
+
return path4.call(print14, "local");
|
|
56426
56426
|
}
|
|
56427
|
-
return path4.call(
|
|
56427
|
+
return path4.call(print14, "id");
|
|
56428
56428
|
case "TSExportAssignment":
|
|
56429
|
-
return (0, lines_1.concat)(["export = ", path4.call(
|
|
56429
|
+
return (0, lines_1.concat)(["export = ", path4.call(print14, "expression")]);
|
|
56430
56430
|
case "ExportDeclaration":
|
|
56431
56431
|
case "ExportDefaultDeclaration":
|
|
56432
56432
|
case "ExportNamedDeclaration":
|
|
56433
|
-
return printExportDeclaration(path4, options,
|
|
56433
|
+
return printExportDeclaration(path4, options, print14);
|
|
56434
56434
|
case "ExportAllDeclaration":
|
|
56435
56435
|
parts.push("export *");
|
|
56436
56436
|
if (n.exported) {
|
|
56437
|
-
parts.push(" as ", path4.call(
|
|
56437
|
+
parts.push(" as ", path4.call(print14, "exported"));
|
|
56438
56438
|
}
|
|
56439
|
-
parts.push(" from ", path4.call(
|
|
56439
|
+
parts.push(" from ", path4.call(print14, "source"), ";");
|
|
56440
56440
|
return (0, lines_1.concat)(parts);
|
|
56441
56441
|
case "TSNamespaceExportDeclaration":
|
|
56442
|
-
parts.push("export as namespace ", path4.call(
|
|
56442
|
+
parts.push("export as namespace ", path4.call(print14, "id"));
|
|
56443
56443
|
return maybeAddSemicolon((0, lines_1.concat)(parts));
|
|
56444
56444
|
case "ExportNamespaceSpecifier":
|
|
56445
|
-
return (0, lines_1.concat)(["* as ", path4.call(
|
|
56445
|
+
return (0, lines_1.concat)(["* as ", path4.call(print14, "exported")]);
|
|
56446
56446
|
case "ExportDefaultSpecifier":
|
|
56447
|
-
return path4.call(
|
|
56447
|
+
return path4.call(print14, "exported");
|
|
56448
56448
|
case "Import":
|
|
56449
56449
|
return (0, lines_1.fromString)("import", options);
|
|
56450
56450
|
case "ImportExpression":
|
|
56451
|
-
return (0, lines_1.concat)(["import(", path4.call(
|
|
56451
|
+
return (0, lines_1.concat)(["import(", path4.call(print14, "source"), ")"]);
|
|
56452
56452
|
case "ImportDeclaration": {
|
|
56453
56453
|
parts.push("import ");
|
|
56454
56454
|
if (n.importKind && n.importKind !== "value") {
|
|
@@ -56460,9 +56460,9 @@ var require_printer = __commonJS({
|
|
|
56460
56460
|
path4.each(function(specifierPath) {
|
|
56461
56461
|
var spec = specifierPath.getValue();
|
|
56462
56462
|
if (spec.type === "ImportSpecifier") {
|
|
56463
|
-
bracedSpecifiers_1.push(
|
|
56463
|
+
bracedSpecifiers_1.push(print14(specifierPath));
|
|
56464
56464
|
} else if (spec.type === "ImportDefaultSpecifier" || spec.type === "ImportNamespaceSpecifier") {
|
|
56465
|
-
unbracedSpecifiers_1.push(
|
|
56465
|
+
unbracedSpecifiers_1.push(print14(specifierPath));
|
|
56466
56466
|
}
|
|
56467
56467
|
}, "specifiers");
|
|
56468
56468
|
unbracedSpecifiers_1.forEach(function(lines2, i2) {
|
|
@@ -56492,16 +56492,16 @@ var require_printer = __commonJS({
|
|
|
56492
56492
|
}
|
|
56493
56493
|
parts.push(" from ");
|
|
56494
56494
|
}
|
|
56495
|
-
parts.push(path4.call(
|
|
56495
|
+
parts.push(path4.call(print14, "source"), maybePrintImportAssertions(path4, options, print14), ";");
|
|
56496
56496
|
return (0, lines_1.concat)(parts);
|
|
56497
56497
|
}
|
|
56498
56498
|
case "ImportAttribute":
|
|
56499
|
-
return (0, lines_1.concat)([path4.call(
|
|
56499
|
+
return (0, lines_1.concat)([path4.call(print14, "key"), ": ", path4.call(print14, "value")]);
|
|
56500
56500
|
case "StaticBlock":
|
|
56501
56501
|
parts.push("static ");
|
|
56502
56502
|
case "BlockStatement": {
|
|
56503
56503
|
var naked_1 = path4.call(function(bodyPath) {
|
|
56504
|
-
return printStatementSequence(bodyPath, options,
|
|
56504
|
+
return printStatementSequence(bodyPath, options, print14);
|
|
56505
56505
|
}, "body");
|
|
56506
56506
|
if (naked_1.isEmpty()) {
|
|
56507
56507
|
if (!n.directives || n.directives.length === 0) {
|
|
@@ -56512,7 +56512,7 @@ var require_printer = __commonJS({
|
|
|
56512
56512
|
parts.push("{\n");
|
|
56513
56513
|
if (n.directives) {
|
|
56514
56514
|
path4.each(function(childPath) {
|
|
56515
|
-
parts.push(maybeAddSemicolon(
|
|
56515
|
+
parts.push(maybeAddSemicolon(print14(childPath).indent(options.tabWidth)), n.directives.length > 1 || !naked_1.isEmpty() ? "\n" : "");
|
|
56516
56516
|
}, "directives");
|
|
56517
56517
|
}
|
|
56518
56518
|
parts.push(naked_1.indent(options.tabWidth));
|
|
@@ -56522,7 +56522,7 @@ var require_printer = __commonJS({
|
|
|
56522
56522
|
case "ReturnStatement": {
|
|
56523
56523
|
parts.push("return");
|
|
56524
56524
|
if (n.argument) {
|
|
56525
|
-
var argLines = path4.call(
|
|
56525
|
+
var argLines = path4.call(print14, "argument");
|
|
56526
56526
|
if (argLines.startsWithComment() || argLines.length > 1 && namedTypes.JSXElement && namedTypes.JSXElement.check(n.argument)) {
|
|
56527
56527
|
parts.push(" (\n", argLines.indent(options.tabWidth), "\n)");
|
|
56528
56528
|
} else {
|
|
@@ -56534,17 +56534,17 @@ var require_printer = __commonJS({
|
|
|
56534
56534
|
}
|
|
56535
56535
|
case "CallExpression":
|
|
56536
56536
|
case "OptionalCallExpression":
|
|
56537
|
-
parts.push(path4.call(
|
|
56537
|
+
parts.push(path4.call(print14, "callee"));
|
|
56538
56538
|
if (n.typeParameters) {
|
|
56539
|
-
parts.push(path4.call(
|
|
56539
|
+
parts.push(path4.call(print14, "typeParameters"));
|
|
56540
56540
|
}
|
|
56541
56541
|
if (n.typeArguments) {
|
|
56542
|
-
parts.push(path4.call(
|
|
56542
|
+
parts.push(path4.call(print14, "typeArguments"));
|
|
56543
56543
|
}
|
|
56544
56544
|
if (types17.getFieldValue(n, "optional")) {
|
|
56545
56545
|
parts.push("?.");
|
|
56546
56546
|
}
|
|
56547
|
-
parts.push(printArgumentsList(path4, options,
|
|
56547
|
+
parts.push(printArgumentsList(path4, options, print14));
|
|
56548
56548
|
return (0, lines_1.concat)(parts);
|
|
56549
56549
|
case "RecordExpression":
|
|
56550
56550
|
parts.push("#");
|
|
@@ -56574,7 +56574,7 @@ var require_printer = __commonJS({
|
|
|
56574
56574
|
var i_1 = 0;
|
|
56575
56575
|
fields.forEach(function(field) {
|
|
56576
56576
|
path4.each(function(childPath) {
|
|
56577
|
-
var lines2 =
|
|
56577
|
+
var lines2 = print14(childPath);
|
|
56578
56578
|
if (!oneLine_1) {
|
|
56579
56579
|
lines2 = lines2.indent(options.tabWidth);
|
|
56580
56580
|
}
|
|
@@ -56611,32 +56611,32 @@ var require_printer = __commonJS({
|
|
|
56611
56611
|
parts[parts.length - 1] = " " + rightBrace;
|
|
56612
56612
|
}
|
|
56613
56613
|
if (n.typeAnnotation) {
|
|
56614
|
-
parts.push(path4.call(
|
|
56614
|
+
parts.push(path4.call(print14, "typeAnnotation"));
|
|
56615
56615
|
}
|
|
56616
56616
|
return (0, lines_1.concat)(parts);
|
|
56617
56617
|
}
|
|
56618
56618
|
case "PropertyPattern":
|
|
56619
56619
|
return (0, lines_1.concat)([
|
|
56620
|
-
path4.call(
|
|
56620
|
+
path4.call(print14, "key"),
|
|
56621
56621
|
": ",
|
|
56622
|
-
path4.call(
|
|
56622
|
+
path4.call(print14, "pattern")
|
|
56623
56623
|
]);
|
|
56624
56624
|
case "ObjectProperty":
|
|
56625
56625
|
case "Property": {
|
|
56626
56626
|
if (n.method || n.kind === "get" || n.kind === "set") {
|
|
56627
|
-
return printMethod(path4, options,
|
|
56627
|
+
return printMethod(path4, options, print14);
|
|
56628
56628
|
}
|
|
56629
56629
|
if (n.shorthand && n.value.type === "AssignmentPattern") {
|
|
56630
|
-
return path4.call(
|
|
56630
|
+
return path4.call(print14, "value");
|
|
56631
56631
|
}
|
|
56632
|
-
var key = path4.call(
|
|
56632
|
+
var key = path4.call(print14, "key");
|
|
56633
56633
|
if (n.computed) {
|
|
56634
56634
|
parts.push("[", key, "]");
|
|
56635
56635
|
} else {
|
|
56636
56636
|
parts.push(key);
|
|
56637
56637
|
}
|
|
56638
56638
|
if (!n.shorthand || n.key.name !== n.value.name) {
|
|
56639
|
-
parts.push(": ", path4.call(
|
|
56639
|
+
parts.push(": ", path4.call(print14, "value"));
|
|
56640
56640
|
}
|
|
56641
56641
|
return (0, lines_1.concat)(parts);
|
|
56642
56642
|
}
|
|
@@ -56644,18 +56644,18 @@ var require_printer = __commonJS({
|
|
|
56644
56644
|
case "ObjectMethod":
|
|
56645
56645
|
case "ClassPrivateMethod":
|
|
56646
56646
|
case "TSDeclareMethod":
|
|
56647
|
-
return printMethod(path4, options,
|
|
56647
|
+
return printMethod(path4, options, print14);
|
|
56648
56648
|
case "PrivateName":
|
|
56649
|
-
return (0, lines_1.concat)(["#", path4.call(
|
|
56649
|
+
return (0, lines_1.concat)(["#", path4.call(print14, "id")]);
|
|
56650
56650
|
case "Decorator":
|
|
56651
|
-
return (0, lines_1.concat)(["@", path4.call(
|
|
56651
|
+
return (0, lines_1.concat)(["@", path4.call(print14, "expression")]);
|
|
56652
56652
|
case "TupleExpression":
|
|
56653
56653
|
parts.push("#");
|
|
56654
56654
|
case "ArrayExpression":
|
|
56655
56655
|
case "ArrayPattern": {
|
|
56656
56656
|
var elems = n.elements;
|
|
56657
56657
|
var len_2 = elems.length;
|
|
56658
|
-
var printed_1 = path4.map(
|
|
56658
|
+
var printed_1 = path4.map(print14, "elements");
|
|
56659
56659
|
var joined = (0, lines_1.fromString)(", ").join(printed_1);
|
|
56660
56660
|
var oneLine_2 = joined.getLineLength(1) <= options.wrapColumn;
|
|
56661
56661
|
if (oneLine_2) {
|
|
@@ -56693,12 +56693,12 @@ var require_printer = __commonJS({
|
|
|
56693
56693
|
parts.push("]");
|
|
56694
56694
|
}
|
|
56695
56695
|
if (n.typeAnnotation) {
|
|
56696
|
-
parts.push(path4.call(
|
|
56696
|
+
parts.push(path4.call(print14, "typeAnnotation"));
|
|
56697
56697
|
}
|
|
56698
56698
|
return (0, lines_1.concat)(parts);
|
|
56699
56699
|
}
|
|
56700
56700
|
case "SequenceExpression":
|
|
56701
|
-
return (0, lines_1.fromString)(", ").join(path4.map(
|
|
56701
|
+
return (0, lines_1.fromString)(", ").join(path4.map(print14, "expressions"));
|
|
56702
56702
|
case "ThisExpression":
|
|
56703
56703
|
return (0, lines_1.fromString)("this");
|
|
56704
56704
|
case "Super":
|
|
@@ -56719,7 +56719,7 @@ var require_printer = __commonJS({
|
|
|
56719
56719
|
case "Literal":
|
|
56720
56720
|
return (0, lines_1.fromString)(getPossibleRaw(n) || (typeof n.value === "string" ? nodeStr(n.value, options) : n.value), options);
|
|
56721
56721
|
case "Directive":
|
|
56722
|
-
return path4.call(
|
|
56722
|
+
return path4.call(print14, "value");
|
|
56723
56723
|
case "DirectiveLiteral":
|
|
56724
56724
|
return (0, lines_1.fromString)(getPossibleRaw(n) || nodeStr(n.value, options), options);
|
|
56725
56725
|
case "InterpreterDirective":
|
|
@@ -56733,32 +56733,32 @@ var require_printer = __commonJS({
|
|
|
56733
56733
|
parts.push(n.operator);
|
|
56734
56734
|
if (/[a-z]$/.test(n.operator))
|
|
56735
56735
|
parts.push(" ");
|
|
56736
|
-
parts.push(path4.call(
|
|
56736
|
+
parts.push(path4.call(print14, "argument"));
|
|
56737
56737
|
return (0, lines_1.concat)(parts);
|
|
56738
56738
|
case "UpdateExpression":
|
|
56739
|
-
parts.push(path4.call(
|
|
56739
|
+
parts.push(path4.call(print14, "argument"), n.operator);
|
|
56740
56740
|
if (n.prefix)
|
|
56741
56741
|
parts.reverse();
|
|
56742
56742
|
return (0, lines_1.concat)(parts);
|
|
56743
56743
|
case "ConditionalExpression":
|
|
56744
56744
|
return (0, lines_1.concat)([
|
|
56745
|
-
path4.call(
|
|
56745
|
+
path4.call(print14, "test"),
|
|
56746
56746
|
" ? ",
|
|
56747
|
-
path4.call(
|
|
56747
|
+
path4.call(print14, "consequent"),
|
|
56748
56748
|
" : ",
|
|
56749
|
-
path4.call(
|
|
56749
|
+
path4.call(print14, "alternate")
|
|
56750
56750
|
]);
|
|
56751
56751
|
case "NewExpression": {
|
|
56752
|
-
parts.push("new ", path4.call(
|
|
56752
|
+
parts.push("new ", path4.call(print14, "callee"));
|
|
56753
56753
|
if (n.typeParameters) {
|
|
56754
|
-
parts.push(path4.call(
|
|
56754
|
+
parts.push(path4.call(print14, "typeParameters"));
|
|
56755
56755
|
}
|
|
56756
56756
|
if (n.typeArguments) {
|
|
56757
|
-
parts.push(path4.call(
|
|
56757
|
+
parts.push(path4.call(print14, "typeArguments"));
|
|
56758
56758
|
}
|
|
56759
56759
|
var args = n.arguments;
|
|
56760
56760
|
if (args) {
|
|
56761
|
-
parts.push(printArgumentsList(path4, options,
|
|
56761
|
+
parts.push(printArgumentsList(path4, options, print14));
|
|
56762
56762
|
}
|
|
56763
56763
|
return (0, lines_1.concat)(parts);
|
|
56764
56764
|
}
|
|
@@ -56769,7 +56769,7 @@ var require_printer = __commonJS({
|
|
|
56769
56769
|
parts.push(n.kind, " ");
|
|
56770
56770
|
var maxLen_1 = 0;
|
|
56771
56771
|
var printed = path4.map(function(childPath) {
|
|
56772
|
-
var lines2 =
|
|
56772
|
+
var lines2 = print14(childPath);
|
|
56773
56773
|
maxLen_1 = Math.max(lines2.length, maxLen_1);
|
|
56774
56774
|
return lines2;
|
|
56775
56775
|
}, "declarations");
|
|
@@ -56788,30 +56788,30 @@ var require_printer = __commonJS({
|
|
|
56788
56788
|
}
|
|
56789
56789
|
case "VariableDeclarator":
|
|
56790
56790
|
return n.init ? (0, lines_1.fromString)(" = ").join([
|
|
56791
|
-
path4.call(
|
|
56792
|
-
path4.call(
|
|
56793
|
-
]) : path4.call(
|
|
56791
|
+
path4.call(print14, "id"),
|
|
56792
|
+
path4.call(print14, "init")
|
|
56793
|
+
]) : path4.call(print14, "id");
|
|
56794
56794
|
case "WithStatement":
|
|
56795
56795
|
return (0, lines_1.concat)([
|
|
56796
56796
|
"with (",
|
|
56797
|
-
path4.call(
|
|
56797
|
+
path4.call(print14, "object"),
|
|
56798
56798
|
") ",
|
|
56799
|
-
path4.call(
|
|
56799
|
+
path4.call(print14, "body")
|
|
56800
56800
|
]);
|
|
56801
56801
|
case "IfStatement": {
|
|
56802
|
-
var con = adjustClause(path4.call(
|
|
56803
|
-
parts.push("if (", path4.call(
|
|
56802
|
+
var con = adjustClause(path4.call(print14, "consequent"), options);
|
|
56803
|
+
parts.push("if (", path4.call(print14, "test"), ")", con);
|
|
56804
56804
|
if (n.alternate)
|
|
56805
|
-
parts.push(endsWithBrace(con) ? " else" : "\nelse", adjustClause(path4.call(
|
|
56805
|
+
parts.push(endsWithBrace(con) ? " else" : "\nelse", adjustClause(path4.call(print14, "alternate"), options));
|
|
56806
56806
|
return (0, lines_1.concat)(parts);
|
|
56807
56807
|
}
|
|
56808
56808
|
case "ForStatement": {
|
|
56809
|
-
var init3 = path4.call(
|
|
56809
|
+
var init3 = path4.call(print14, "init");
|
|
56810
56810
|
var sep3 = init3.length > 1 ? ";\n" : "; ";
|
|
56811
56811
|
var forParen = "for (";
|
|
56812
|
-
var indented = (0, lines_1.fromString)(sep3).join([init3, path4.call(
|
|
56812
|
+
var indented = (0, lines_1.fromString)(sep3).join([init3, path4.call(print14, "test"), path4.call(print14, "update")]).indentTail(forParen.length);
|
|
56813
56813
|
var head = (0, lines_1.concat)([forParen, indented, ")"]);
|
|
56814
|
-
var clause = adjustClause(path4.call(
|
|
56814
|
+
var clause = adjustClause(path4.call(print14, "body"), options);
|
|
56815
56815
|
parts.push(head);
|
|
56816
56816
|
if (head.length > 1) {
|
|
56817
56817
|
parts.push("\n");
|
|
@@ -56823,18 +56823,18 @@ var require_printer = __commonJS({
|
|
|
56823
56823
|
case "WhileStatement":
|
|
56824
56824
|
return (0, lines_1.concat)([
|
|
56825
56825
|
"while (",
|
|
56826
|
-
path4.call(
|
|
56826
|
+
path4.call(print14, "test"),
|
|
56827
56827
|
")",
|
|
56828
|
-
adjustClause(path4.call(
|
|
56828
|
+
adjustClause(path4.call(print14, "body"), options)
|
|
56829
56829
|
]);
|
|
56830
56830
|
case "ForInStatement":
|
|
56831
56831
|
return (0, lines_1.concat)([
|
|
56832
56832
|
n.each ? "for each (" : "for (",
|
|
56833
|
-
path4.call(
|
|
56833
|
+
path4.call(print14, "left"),
|
|
56834
56834
|
" in ",
|
|
56835
|
-
path4.call(
|
|
56835
|
+
path4.call(print14, "right"),
|
|
56836
56836
|
")",
|
|
56837
|
-
adjustClause(path4.call(
|
|
56837
|
+
adjustClause(path4.call(print14, "body"), options)
|
|
56838
56838
|
]);
|
|
56839
56839
|
case "ForOfStatement":
|
|
56840
56840
|
case "ForAwaitStatement":
|
|
@@ -56842,122 +56842,122 @@ var require_printer = __commonJS({
|
|
|
56842
56842
|
if (n.await || n.type === "ForAwaitStatement") {
|
|
56843
56843
|
parts.push("await ");
|
|
56844
56844
|
}
|
|
56845
|
-
parts.push("(", path4.call(
|
|
56845
|
+
parts.push("(", path4.call(print14, "left"), " of ", path4.call(print14, "right"), ")", adjustClause(path4.call(print14, "body"), options));
|
|
56846
56846
|
return (0, lines_1.concat)(parts);
|
|
56847
56847
|
case "DoWhileStatement": {
|
|
56848
56848
|
var doBody = (0, lines_1.concat)([
|
|
56849
56849
|
"do",
|
|
56850
|
-
adjustClause(path4.call(
|
|
56850
|
+
adjustClause(path4.call(print14, "body"), options)
|
|
56851
56851
|
]);
|
|
56852
56852
|
parts.push(doBody);
|
|
56853
56853
|
if (endsWithBrace(doBody))
|
|
56854
56854
|
parts.push(" while");
|
|
56855
56855
|
else
|
|
56856
56856
|
parts.push("\nwhile");
|
|
56857
|
-
parts.push(" (", path4.call(
|
|
56857
|
+
parts.push(" (", path4.call(print14, "test"), ");");
|
|
56858
56858
|
return (0, lines_1.concat)(parts);
|
|
56859
56859
|
}
|
|
56860
56860
|
case "DoExpression": {
|
|
56861
56861
|
var statements = path4.call(function(bodyPath) {
|
|
56862
|
-
return printStatementSequence(bodyPath, options,
|
|
56862
|
+
return printStatementSequence(bodyPath, options, print14);
|
|
56863
56863
|
}, "body");
|
|
56864
56864
|
return (0, lines_1.concat)(["do {\n", statements.indent(options.tabWidth), "\n}"]);
|
|
56865
56865
|
}
|
|
56866
56866
|
case "BreakStatement":
|
|
56867
56867
|
parts.push("break");
|
|
56868
56868
|
if (n.label)
|
|
56869
|
-
parts.push(" ", path4.call(
|
|
56869
|
+
parts.push(" ", path4.call(print14, "label"));
|
|
56870
56870
|
parts.push(";");
|
|
56871
56871
|
return (0, lines_1.concat)(parts);
|
|
56872
56872
|
case "ContinueStatement":
|
|
56873
56873
|
parts.push("continue");
|
|
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 "LabeledStatement":
|
|
56879
56879
|
return (0, lines_1.concat)([
|
|
56880
|
-
path4.call(
|
|
56880
|
+
path4.call(print14, "label"),
|
|
56881
56881
|
":\n",
|
|
56882
|
-
path4.call(
|
|
56882
|
+
path4.call(print14, "body")
|
|
56883
56883
|
]);
|
|
56884
56884
|
case "TryStatement":
|
|
56885
|
-
parts.push("try ", path4.call(
|
|
56885
|
+
parts.push("try ", path4.call(print14, "block"));
|
|
56886
56886
|
if (n.handler) {
|
|
56887
|
-
parts.push(" ", path4.call(
|
|
56887
|
+
parts.push(" ", path4.call(print14, "handler"));
|
|
56888
56888
|
} else if (n.handlers) {
|
|
56889
56889
|
path4.each(function(handlerPath) {
|
|
56890
|
-
parts.push(" ",
|
|
56890
|
+
parts.push(" ", print14(handlerPath));
|
|
56891
56891
|
}, "handlers");
|
|
56892
56892
|
}
|
|
56893
56893
|
if (n.finalizer) {
|
|
56894
|
-
parts.push(" finally ", path4.call(
|
|
56894
|
+
parts.push(" finally ", path4.call(print14, "finalizer"));
|
|
56895
56895
|
}
|
|
56896
56896
|
return (0, lines_1.concat)(parts);
|
|
56897
56897
|
case "CatchClause":
|
|
56898
56898
|
parts.push("catch ");
|
|
56899
56899
|
if (n.param) {
|
|
56900
|
-
parts.push("(", path4.call(
|
|
56900
|
+
parts.push("(", path4.call(print14, "param"));
|
|
56901
56901
|
}
|
|
56902
56902
|
if (n.guard) {
|
|
56903
|
-
parts.push(" if ", path4.call(
|
|
56903
|
+
parts.push(" if ", path4.call(print14, "guard"));
|
|
56904
56904
|
}
|
|
56905
56905
|
if (n.param) {
|
|
56906
56906
|
parts.push(") ");
|
|
56907
56907
|
}
|
|
56908
|
-
parts.push(path4.call(
|
|
56908
|
+
parts.push(path4.call(print14, "body"));
|
|
56909
56909
|
return (0, lines_1.concat)(parts);
|
|
56910
56910
|
case "ThrowStatement":
|
|
56911
|
-
return (0, lines_1.concat)(["throw ", path4.call(
|
|
56911
|
+
return (0, lines_1.concat)(["throw ", path4.call(print14, "argument"), ";"]);
|
|
56912
56912
|
case "SwitchStatement":
|
|
56913
56913
|
return (0, lines_1.concat)([
|
|
56914
56914
|
"switch (",
|
|
56915
|
-
path4.call(
|
|
56915
|
+
path4.call(print14, "discriminant"),
|
|
56916
56916
|
") {\n",
|
|
56917
|
-
(0, lines_1.fromString)("\n").join(path4.map(
|
|
56917
|
+
(0, lines_1.fromString)("\n").join(path4.map(print14, "cases")),
|
|
56918
56918
|
"\n}"
|
|
56919
56919
|
]);
|
|
56920
56920
|
case "SwitchCase":
|
|
56921
56921
|
if (n.test)
|
|
56922
|
-
parts.push("case ", path4.call(
|
|
56922
|
+
parts.push("case ", path4.call(print14, "test"), ":");
|
|
56923
56923
|
else
|
|
56924
56924
|
parts.push("default:");
|
|
56925
56925
|
if (n.consequent.length > 0) {
|
|
56926
56926
|
parts.push("\n", path4.call(function(consequentPath) {
|
|
56927
|
-
return printStatementSequence(consequentPath, options,
|
|
56927
|
+
return printStatementSequence(consequentPath, options, print14);
|
|
56928
56928
|
}, "consequent").indent(options.tabWidth));
|
|
56929
56929
|
}
|
|
56930
56930
|
return (0, lines_1.concat)(parts);
|
|
56931
56931
|
case "DebuggerStatement":
|
|
56932
56932
|
return (0, lines_1.fromString)("debugger;");
|
|
56933
56933
|
case "JSXAttribute":
|
|
56934
|
-
parts.push(path4.call(
|
|
56934
|
+
parts.push(path4.call(print14, "name"));
|
|
56935
56935
|
if (n.value)
|
|
56936
|
-
parts.push("=", path4.call(
|
|
56936
|
+
parts.push("=", path4.call(print14, "value"));
|
|
56937
56937
|
return (0, lines_1.concat)(parts);
|
|
56938
56938
|
case "JSXIdentifier":
|
|
56939
56939
|
return (0, lines_1.fromString)(n.name, options);
|
|
56940
56940
|
case "JSXNamespacedName":
|
|
56941
56941
|
return (0, lines_1.fromString)(":").join([
|
|
56942
|
-
path4.call(
|
|
56943
|
-
path4.call(
|
|
56942
|
+
path4.call(print14, "namespace"),
|
|
56943
|
+
path4.call(print14, "name")
|
|
56944
56944
|
]);
|
|
56945
56945
|
case "JSXMemberExpression":
|
|
56946
56946
|
return (0, lines_1.fromString)(".").join([
|
|
56947
|
-
path4.call(
|
|
56948
|
-
path4.call(
|
|
56947
|
+
path4.call(print14, "object"),
|
|
56948
|
+
path4.call(print14, "property")
|
|
56949
56949
|
]);
|
|
56950
56950
|
case "JSXSpreadAttribute":
|
|
56951
|
-
return (0, lines_1.concat)(["{...", path4.call(
|
|
56951
|
+
return (0, lines_1.concat)(["{...", path4.call(print14, "argument"), "}"]);
|
|
56952
56952
|
case "JSXSpreadChild":
|
|
56953
|
-
return (0, lines_1.concat)(["{...", path4.call(
|
|
56953
|
+
return (0, lines_1.concat)(["{...", path4.call(print14, "expression"), "}"]);
|
|
56954
56954
|
case "JSXExpressionContainer":
|
|
56955
|
-
return (0, lines_1.concat)(["{", path4.call(
|
|
56955
|
+
return (0, lines_1.concat)(["{", path4.call(print14, "expression"), "}"]);
|
|
56956
56956
|
case "JSXElement":
|
|
56957
56957
|
case "JSXFragment": {
|
|
56958
56958
|
var openingPropName = "opening" + (n.type === "JSXElement" ? "Element" : "Fragment");
|
|
56959
56959
|
var closingPropName = "closing" + (n.type === "JSXElement" ? "Element" : "Fragment");
|
|
56960
|
-
var openingLines = path4.call(
|
|
56960
|
+
var openingLines = path4.call(print14, openingPropName);
|
|
56961
56961
|
if (n[openingPropName].selfClosing) {
|
|
56962
56962
|
assert_1.default.ok(!n[closingPropName], "unexpected " + closingPropName + " element in self-closing " + n.type);
|
|
56963
56963
|
return openingLines;
|
|
@@ -56971,16 +56971,16 @@ var require_printer = __commonJS({
|
|
|
56971
56971
|
return "\n";
|
|
56972
56972
|
}
|
|
56973
56973
|
}
|
|
56974
|
-
return
|
|
56974
|
+
return print14(childPath);
|
|
56975
56975
|
}, "children")).indentTail(options.tabWidth);
|
|
56976
|
-
var closingLines = path4.call(
|
|
56976
|
+
var closingLines = path4.call(print14, closingPropName);
|
|
56977
56977
|
return (0, lines_1.concat)([openingLines, childLines, closingLines]);
|
|
56978
56978
|
}
|
|
56979
56979
|
case "JSXOpeningElement": {
|
|
56980
|
-
parts.push("<", path4.call(
|
|
56980
|
+
parts.push("<", path4.call(print14, "name"));
|
|
56981
56981
|
var attrParts_1 = [];
|
|
56982
56982
|
path4.each(function(attrPath) {
|
|
56983
|
-
attrParts_1.push(" ",
|
|
56983
|
+
attrParts_1.push(" ", print14(attrPath));
|
|
56984
56984
|
}, "attributes");
|
|
56985
56985
|
var attrLines = (0, lines_1.concat)(attrParts_1);
|
|
56986
56986
|
var needLineWrap = attrLines.length > 1 || attrLines.getLineLength(1) > options.wrapColumn;
|
|
@@ -56997,7 +56997,7 @@ var require_printer = __commonJS({
|
|
|
56997
56997
|
return (0, lines_1.concat)(parts);
|
|
56998
56998
|
}
|
|
56999
56999
|
case "JSXClosingElement":
|
|
57000
|
-
return (0, lines_1.concat)(["</", path4.call(
|
|
57000
|
+
return (0, lines_1.concat)(["</", path4.call(print14, "name"), ">"]);
|
|
57001
57001
|
case "JSXOpeningFragment":
|
|
57002
57002
|
return (0, lines_1.fromString)("<>");
|
|
57003
57003
|
case "JSXClosingFragment":
|
|
@@ -57008,9 +57008,9 @@ var require_printer = __commonJS({
|
|
|
57008
57008
|
return (0, lines_1.fromString)("");
|
|
57009
57009
|
case "TypeAnnotatedIdentifier":
|
|
57010
57010
|
return (0, lines_1.concat)([
|
|
57011
|
-
path4.call(
|
|
57011
|
+
path4.call(print14, "annotation"),
|
|
57012
57012
|
" ",
|
|
57013
|
-
path4.call(
|
|
57013
|
+
path4.call(print14, "identifier")
|
|
57014
57014
|
]);
|
|
57015
57015
|
case "ClassBody":
|
|
57016
57016
|
if (n.body.length === 0) {
|
|
@@ -57019,12 +57019,12 @@ var require_printer = __commonJS({
|
|
|
57019
57019
|
return (0, lines_1.concat)([
|
|
57020
57020
|
"{\n",
|
|
57021
57021
|
path4.call(function(bodyPath) {
|
|
57022
|
-
return printStatementSequence(bodyPath, options,
|
|
57022
|
+
return printStatementSequence(bodyPath, options, print14);
|
|
57023
57023
|
}, "body").indent(options.tabWidth),
|
|
57024
57024
|
"\n}"
|
|
57025
57025
|
]);
|
|
57026
57026
|
case "ClassPropertyDefinition":
|
|
57027
|
-
parts.push("static ", path4.call(
|
|
57027
|
+
parts.push("static ", path4.call(print14, "definition"));
|
|
57028
57028
|
if (!namedTypes.MethodDefinition.check(n.definition))
|
|
57029
57029
|
parts.push(";");
|
|
57030
57030
|
return (0, lines_1.concat)(parts);
|
|
@@ -57045,12 +57045,12 @@ var require_printer = __commonJS({
|
|
|
57045
57045
|
if (n.readonly) {
|
|
57046
57046
|
parts.push("readonly ");
|
|
57047
57047
|
}
|
|
57048
|
-
var key = path4.call(
|
|
57048
|
+
var key = path4.call(print14, "key");
|
|
57049
57049
|
if (n.computed) {
|
|
57050
57050
|
key = (0, lines_1.concat)(["[", key, "]"]);
|
|
57051
57051
|
}
|
|
57052
57052
|
if (n.variance) {
|
|
57053
|
-
key = (0, lines_1.concat)([printVariance(path4,
|
|
57053
|
+
key = (0, lines_1.concat)([printVariance(path4, print14), key]);
|
|
57054
57054
|
}
|
|
57055
57055
|
parts.push(key);
|
|
57056
57056
|
if (n.optional) {
|
|
@@ -57060,10 +57060,10 @@ var require_printer = __commonJS({
|
|
|
57060
57060
|
parts.push("!");
|
|
57061
57061
|
}
|
|
57062
57062
|
if (n.typeAnnotation) {
|
|
57063
|
-
parts.push(path4.call(
|
|
57063
|
+
parts.push(path4.call(print14, "typeAnnotation"));
|
|
57064
57064
|
}
|
|
57065
57065
|
if (n.value) {
|
|
57066
|
-
parts.push(" = ", path4.call(
|
|
57066
|
+
parts.push(" = ", path4.call(print14, "value"));
|
|
57067
57067
|
}
|
|
57068
57068
|
parts.push(";");
|
|
57069
57069
|
return (0, lines_1.concat)(parts);
|
|
@@ -57072,21 +57072,21 @@ var require_printer = __commonJS({
|
|
|
57072
57072
|
if (n.static) {
|
|
57073
57073
|
parts.push("static ");
|
|
57074
57074
|
}
|
|
57075
|
-
parts.push(path4.call(
|
|
57075
|
+
parts.push(path4.call(print14, "key"));
|
|
57076
57076
|
if (n.typeAnnotation) {
|
|
57077
|
-
parts.push(path4.call(
|
|
57077
|
+
parts.push(path4.call(print14, "typeAnnotation"));
|
|
57078
57078
|
}
|
|
57079
57079
|
if (n.value) {
|
|
57080
|
-
parts.push(" = ", path4.call(
|
|
57080
|
+
parts.push(" = ", path4.call(print14, "value"));
|
|
57081
57081
|
}
|
|
57082
57082
|
parts.push(";");
|
|
57083
57083
|
return (0, lines_1.concat)(parts);
|
|
57084
57084
|
case "ClassAccessorProperty": {
|
|
57085
57085
|
parts.push.apply(parts, tslib_1.__spreadArray(tslib_1.__spreadArray([], printClassMemberModifiers(n), false), ["accessor "], false));
|
|
57086
57086
|
if (n.computed) {
|
|
57087
|
-
parts.push("[", path4.call(
|
|
57087
|
+
parts.push("[", path4.call(print14, "key"), "]");
|
|
57088
57088
|
} else {
|
|
57089
|
-
parts.push(path4.call(
|
|
57089
|
+
parts.push(path4.call(print14, "key"));
|
|
57090
57090
|
}
|
|
57091
57091
|
if (n.optional) {
|
|
57092
57092
|
parts.push("?");
|
|
@@ -57095,10 +57095,10 @@ var require_printer = __commonJS({
|
|
|
57095
57095
|
parts.push("!");
|
|
57096
57096
|
}
|
|
57097
57097
|
if (n.typeAnnotation) {
|
|
57098
|
-
parts.push(path4.call(
|
|
57098
|
+
parts.push(path4.call(print14, "typeAnnotation"));
|
|
57099
57099
|
}
|
|
57100
57100
|
if (n.value) {
|
|
57101
|
-
parts.push(" = ", path4.call(
|
|
57101
|
+
parts.push(" = ", path4.call(print14, "value"));
|
|
57102
57102
|
}
|
|
57103
57103
|
parts.push(";");
|
|
57104
57104
|
return (0, lines_1.concat)(parts);
|
|
@@ -57114,21 +57114,21 @@ var require_printer = __commonJS({
|
|
|
57114
57114
|
}
|
|
57115
57115
|
parts.push("class");
|
|
57116
57116
|
if (n.id) {
|
|
57117
|
-
parts.push(" ", path4.call(
|
|
57117
|
+
parts.push(" ", path4.call(print14, "id"));
|
|
57118
57118
|
}
|
|
57119
57119
|
if (n.typeParameters) {
|
|
57120
|
-
parts.push(path4.call(
|
|
57120
|
+
parts.push(path4.call(print14, "typeParameters"));
|
|
57121
57121
|
}
|
|
57122
57122
|
if (n.superClass) {
|
|
57123
|
-
parts.push(" extends ", path4.call(
|
|
57123
|
+
parts.push(" extends ", path4.call(print14, "superClass"), path4.call(print14, "superTypeParameters"));
|
|
57124
57124
|
}
|
|
57125
57125
|
if (n.extends && n.extends.length > 0) {
|
|
57126
|
-
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path4.map(
|
|
57126
|
+
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path4.map(print14, "extends")));
|
|
57127
57127
|
}
|
|
57128
57128
|
if (n["implements"] && n["implements"].length > 0) {
|
|
57129
|
-
parts.push(" implements ", (0, lines_1.fromString)(", ").join(path4.map(
|
|
57129
|
+
parts.push(" implements ", (0, lines_1.fromString)(", ").join(path4.map(print14, "implements")));
|
|
57130
57130
|
}
|
|
57131
|
-
parts.push(" ", path4.call(
|
|
57131
|
+
parts.push(" ", path4.call(print14, "body"));
|
|
57132
57132
|
if (n.type === "DeclareClass") {
|
|
57133
57133
|
return printFlowDeclaration(path4, parts);
|
|
57134
57134
|
} else {
|
|
@@ -57137,11 +57137,11 @@ var require_printer = __commonJS({
|
|
|
57137
57137
|
case "TemplateElement":
|
|
57138
57138
|
return (0, lines_1.fromString)(n.value.raw, options).lockIndentTail();
|
|
57139
57139
|
case "TemplateLiteral": {
|
|
57140
|
-
var expressions_1 = path4.map(
|
|
57140
|
+
var expressions_1 = path4.map(print14, "expressions");
|
|
57141
57141
|
parts.push("`");
|
|
57142
57142
|
path4.each(function(childPath) {
|
|
57143
57143
|
var i2 = childPath.getName();
|
|
57144
|
-
parts.push(
|
|
57144
|
+
parts.push(print14(childPath));
|
|
57145
57145
|
if (i2 < expressions_1.length) {
|
|
57146
57146
|
parts.push("${", expressions_1[i2], "}");
|
|
57147
57147
|
}
|
|
@@ -57150,7 +57150,7 @@ var require_printer = __commonJS({
|
|
|
57150
57150
|
return (0, lines_1.concat)(parts).lockIndentTail();
|
|
57151
57151
|
}
|
|
57152
57152
|
case "TaggedTemplateExpression":
|
|
57153
|
-
return (0, lines_1.concat)([path4.call(
|
|
57153
|
+
return (0, lines_1.concat)([path4.call(print14, "tag"), path4.call(print14, "quasi")]);
|
|
57154
57154
|
case "Node":
|
|
57155
57155
|
case "Printable":
|
|
57156
57156
|
case "SourceLocation":
|
|
@@ -57184,7 +57184,7 @@ var require_printer = __commonJS({
|
|
|
57184
57184
|
if (n.typeAnnotation.type !== "FunctionTypeAnnotation") {
|
|
57185
57185
|
parts.push(": ");
|
|
57186
57186
|
}
|
|
57187
|
-
parts.push(path4.call(
|
|
57187
|
+
parts.push(path4.call(print14, "typeAnnotation"));
|
|
57188
57188
|
return (0, lines_1.concat)(parts);
|
|
57189
57189
|
}
|
|
57190
57190
|
return (0, lines_1.fromString)("");
|
|
@@ -57198,9 +57198,9 @@ var require_printer = __commonJS({
|
|
|
57198
57198
|
case "MixedTypeAnnotation":
|
|
57199
57199
|
return (0, lines_1.fromString)("mixed", options);
|
|
57200
57200
|
case "ArrayTypeAnnotation":
|
|
57201
|
-
return (0, lines_1.concat)([path4.call(
|
|
57201
|
+
return (0, lines_1.concat)([path4.call(print14, "elementType"), "[]"]);
|
|
57202
57202
|
case "TupleTypeAnnotation": {
|
|
57203
|
-
var printed_2 = path4.map(
|
|
57203
|
+
var printed_2 = path4.map(print14, "types");
|
|
57204
57204
|
var joined = (0, lines_1.fromString)(", ").join(printed_2);
|
|
57205
57205
|
var oneLine_3 = joined.getLineLength(1) <= options.wrapColumn;
|
|
57206
57206
|
if (oneLine_3) {
|
|
@@ -57247,38 +57247,38 @@ var require_printer = __commonJS({
|
|
|
57247
57247
|
case "InterfaceTypeAnnotation":
|
|
57248
57248
|
parts.push("interface");
|
|
57249
57249
|
if (n.extends && n.extends.length > 0) {
|
|
57250
|
-
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path4.map(
|
|
57250
|
+
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path4.map(print14, "extends")));
|
|
57251
57251
|
}
|
|
57252
|
-
parts.push(" ", path4.call(
|
|
57252
|
+
parts.push(" ", path4.call(print14, "body"));
|
|
57253
57253
|
return (0, lines_1.concat)(parts);
|
|
57254
57254
|
case "DeclareFunction":
|
|
57255
57255
|
return printFlowDeclaration(path4, [
|
|
57256
57256
|
"function ",
|
|
57257
|
-
path4.call(
|
|
57257
|
+
path4.call(print14, "id"),
|
|
57258
57258
|
";"
|
|
57259
57259
|
]);
|
|
57260
57260
|
case "DeclareModule":
|
|
57261
57261
|
return printFlowDeclaration(path4, [
|
|
57262
57262
|
"module ",
|
|
57263
|
-
path4.call(
|
|
57263
|
+
path4.call(print14, "id"),
|
|
57264
57264
|
" ",
|
|
57265
|
-
path4.call(
|
|
57265
|
+
path4.call(print14, "body")
|
|
57266
57266
|
]);
|
|
57267
57267
|
case "DeclareModuleExports":
|
|
57268
57268
|
return printFlowDeclaration(path4, [
|
|
57269
57269
|
"module.exports",
|
|
57270
|
-
path4.call(
|
|
57270
|
+
path4.call(print14, "typeAnnotation")
|
|
57271
57271
|
]);
|
|
57272
57272
|
case "DeclareVariable":
|
|
57273
|
-
return printFlowDeclaration(path4, ["var ", path4.call(
|
|
57273
|
+
return printFlowDeclaration(path4, ["var ", path4.call(print14, "id"), ";"]);
|
|
57274
57274
|
case "DeclareExportDeclaration":
|
|
57275
57275
|
case "DeclareExportAllDeclaration":
|
|
57276
|
-
return (0, lines_1.concat)(["declare ", printExportDeclaration(path4, options,
|
|
57276
|
+
return (0, lines_1.concat)(["declare ", printExportDeclaration(path4, options, print14)]);
|
|
57277
57277
|
case "EnumDeclaration":
|
|
57278
57278
|
return (0, lines_1.concat)([
|
|
57279
57279
|
"enum ",
|
|
57280
|
-
path4.call(
|
|
57281
|
-
path4.call(
|
|
57280
|
+
path4.call(print14, "id"),
|
|
57281
|
+
path4.call(print14, "body")
|
|
57282
57282
|
]);
|
|
57283
57283
|
case "EnumBooleanBody":
|
|
57284
57284
|
case "EnumNumberBody":
|
|
@@ -57290,24 +57290,24 @@ var require_printer = __commonJS({
|
|
|
57290
57290
|
n.type.slice(4, -4).toLowerCase()
|
|
57291
57291
|
);
|
|
57292
57292
|
}
|
|
57293
|
-
parts.push(" {\n", (0, lines_1.fromString)("\n").join(path4.map(
|
|
57293
|
+
parts.push(" {\n", (0, lines_1.fromString)("\n").join(path4.map(print14, "members")).indent(options.tabWidth), "\n}");
|
|
57294
57294
|
return (0, lines_1.concat)(parts);
|
|
57295
57295
|
}
|
|
57296
57296
|
case "EnumDefaultedMember":
|
|
57297
|
-
return (0, lines_1.concat)([path4.call(
|
|
57297
|
+
return (0, lines_1.concat)([path4.call(print14, "id"), ","]);
|
|
57298
57298
|
case "EnumBooleanMember":
|
|
57299
57299
|
case "EnumNumberMember":
|
|
57300
57300
|
case "EnumStringMember":
|
|
57301
57301
|
return (0, lines_1.concat)([
|
|
57302
|
-
path4.call(
|
|
57302
|
+
path4.call(print14, "id"),
|
|
57303
57303
|
" = ",
|
|
57304
|
-
path4.call(
|
|
57304
|
+
path4.call(print14, "init"),
|
|
57305
57305
|
","
|
|
57306
57306
|
]);
|
|
57307
57307
|
case "InferredPredicate":
|
|
57308
57308
|
return (0, lines_1.fromString)("%checks", options);
|
|
57309
57309
|
case "DeclaredPredicate":
|
|
57310
|
-
return (0, lines_1.concat)(["%checks(", path4.call(
|
|
57310
|
+
return (0, lines_1.concat)(["%checks(", path4.call(print14, "value"), ")"]);
|
|
57311
57311
|
case "FunctionTypeAnnotation": {
|
|
57312
57312
|
var parent2 = path4.getParentNode(0);
|
|
57313
57313
|
var isArrowFunctionTypeAnnotation = !(namedTypes.ObjectTypeCallProperty.check(parent2) || namedTypes.ObjectTypeInternalSlot.check(parent2) && parent2.method || namedTypes.DeclareFunction.check(path4.getParentNode(2)));
|
|
@@ -57317,14 +57317,14 @@ var require_printer = __commonJS({
|
|
|
57317
57317
|
}
|
|
57318
57318
|
var hasTypeParameters = !!n.typeParameters;
|
|
57319
57319
|
var needsParens = hasTypeParameters || n.params.length !== 1 || n.params[0].name;
|
|
57320
|
-
parts.push(hasTypeParameters ? path4.call(
|
|
57320
|
+
parts.push(hasTypeParameters ? path4.call(print14, "typeParameters") : "", needsParens ? "(" : "", printFunctionParams(path4, options, print14), needsParens ? ")" : "");
|
|
57321
57321
|
if (n.returnType) {
|
|
57322
|
-
parts.push(isArrowFunctionTypeAnnotation ? " => " : ": ", path4.call(
|
|
57322
|
+
parts.push(isArrowFunctionTypeAnnotation ? " => " : ": ", path4.call(print14, "returnType"));
|
|
57323
57323
|
}
|
|
57324
57324
|
return (0, lines_1.concat)(parts);
|
|
57325
57325
|
}
|
|
57326
57326
|
case "FunctionTypeParam": {
|
|
57327
|
-
var name = path4.call(
|
|
57327
|
+
var name = path4.call(print14, "name");
|
|
57328
57328
|
parts.push(name);
|
|
57329
57329
|
if (n.optional) {
|
|
57330
57330
|
parts.push("?");
|
|
@@ -57332,13 +57332,13 @@ var require_printer = __commonJS({
|
|
|
57332
57332
|
if (name.infos[0].line) {
|
|
57333
57333
|
parts.push(": ");
|
|
57334
57334
|
}
|
|
57335
|
-
parts.push(path4.call(
|
|
57335
|
+
parts.push(path4.call(print14, "typeAnnotation"));
|
|
57336
57336
|
return (0, lines_1.concat)(parts);
|
|
57337
57337
|
}
|
|
57338
57338
|
case "GenericTypeAnnotation":
|
|
57339
57339
|
return (0, lines_1.concat)([
|
|
57340
|
-
path4.call(
|
|
57341
|
-
path4.call(
|
|
57340
|
+
path4.call(print14, "id"),
|
|
57341
|
+
path4.call(print14, "typeParameters")
|
|
57342
57342
|
]);
|
|
57343
57343
|
case "DeclareInterface":
|
|
57344
57344
|
parts.push("declare ");
|
|
@@ -57347,24 +57347,24 @@ var require_printer = __commonJS({
|
|
|
57347
57347
|
if (n.declare) {
|
|
57348
57348
|
parts.push("declare ");
|
|
57349
57349
|
}
|
|
57350
|
-
parts.push("interface ", path4.call(
|
|
57350
|
+
parts.push("interface ", path4.call(print14, "id"), path4.call(print14, "typeParameters"), " ");
|
|
57351
57351
|
if (n["extends"] && n["extends"].length > 0) {
|
|
57352
|
-
parts.push("extends ", (0, lines_1.fromString)(", ").join(path4.map(
|
|
57352
|
+
parts.push("extends ", (0, lines_1.fromString)(", ").join(path4.map(print14, "extends")), " ");
|
|
57353
57353
|
}
|
|
57354
57354
|
if (n.body) {
|
|
57355
|
-
parts.push(path4.call(
|
|
57355
|
+
parts.push(path4.call(print14, "body"));
|
|
57356
57356
|
}
|
|
57357
57357
|
return (0, lines_1.concat)(parts);
|
|
57358
57358
|
case "ClassImplements":
|
|
57359
57359
|
case "InterfaceExtends":
|
|
57360
57360
|
return (0, lines_1.concat)([
|
|
57361
|
-
path4.call(
|
|
57362
|
-
path4.call(
|
|
57361
|
+
path4.call(print14, "id"),
|
|
57362
|
+
path4.call(print14, "typeParameters")
|
|
57363
57363
|
]);
|
|
57364
57364
|
case "IntersectionTypeAnnotation":
|
|
57365
|
-
return (0, lines_1.fromString)(" & ").join(path4.map(
|
|
57365
|
+
return (0, lines_1.fromString)(" & ").join(path4.map(print14, "types"));
|
|
57366
57366
|
case "NullableTypeAnnotation":
|
|
57367
|
-
return (0, lines_1.concat)(["?", path4.call(
|
|
57367
|
+
return (0, lines_1.concat)(["?", path4.call(print14, "typeAnnotation")]);
|
|
57368
57368
|
case "NullLiteralTypeAnnotation":
|
|
57369
57369
|
return (0, lines_1.fromString)("null", options);
|
|
57370
57370
|
case "ThisTypeAnnotation":
|
|
@@ -57372,40 +57372,40 @@ var require_printer = __commonJS({
|
|
|
57372
57372
|
case "NumberTypeAnnotation":
|
|
57373
57373
|
return (0, lines_1.fromString)("number", options);
|
|
57374
57374
|
case "ObjectTypeCallProperty":
|
|
57375
|
-
return path4.call(
|
|
57375
|
+
return path4.call(print14, "value");
|
|
57376
57376
|
case "ObjectTypeIndexer":
|
|
57377
57377
|
if (n.static) {
|
|
57378
57378
|
parts.push("static ");
|
|
57379
57379
|
}
|
|
57380
|
-
parts.push(printVariance(path4,
|
|
57380
|
+
parts.push(printVariance(path4, print14), "[");
|
|
57381
57381
|
if (n.id) {
|
|
57382
|
-
parts.push(path4.call(
|
|
57382
|
+
parts.push(path4.call(print14, "id"), ": ");
|
|
57383
57383
|
}
|
|
57384
|
-
parts.push(path4.call(
|
|
57384
|
+
parts.push(path4.call(print14, "key"), "]: ", path4.call(print14, "value"));
|
|
57385
57385
|
return (0, lines_1.concat)(parts);
|
|
57386
57386
|
case "ObjectTypeProperty":
|
|
57387
57387
|
return (0, lines_1.concat)([
|
|
57388
|
-
printVariance(path4,
|
|
57389
|
-
path4.call(
|
|
57388
|
+
printVariance(path4, print14),
|
|
57389
|
+
path4.call(print14, "key"),
|
|
57390
57390
|
n.optional ? "?" : "",
|
|
57391
57391
|
": ",
|
|
57392
|
-
path4.call(
|
|
57392
|
+
path4.call(print14, "value")
|
|
57393
57393
|
]);
|
|
57394
57394
|
case "ObjectTypeInternalSlot":
|
|
57395
57395
|
return (0, lines_1.concat)([
|
|
57396
57396
|
n.static ? "static " : "",
|
|
57397
57397
|
"[[",
|
|
57398
|
-
path4.call(
|
|
57398
|
+
path4.call(print14, "id"),
|
|
57399
57399
|
"]]",
|
|
57400
57400
|
n.optional ? "?" : "",
|
|
57401
57401
|
n.value.type !== "FunctionTypeAnnotation" ? ": " : "",
|
|
57402
|
-
path4.call(
|
|
57402
|
+
path4.call(print14, "value")
|
|
57403
57403
|
]);
|
|
57404
57404
|
case "QualifiedTypeIdentifier":
|
|
57405
57405
|
return (0, lines_1.concat)([
|
|
57406
|
-
path4.call(
|
|
57406
|
+
path4.call(print14, "qualification"),
|
|
57407
57407
|
".",
|
|
57408
|
-
path4.call(
|
|
57408
|
+
path4.call(print14, "id")
|
|
57409
57409
|
]);
|
|
57410
57410
|
case "StringLiteralTypeAnnotation":
|
|
57411
57411
|
return (0, lines_1.fromString)(nodeStr(n.value, options), options);
|
|
@@ -57422,36 +57422,36 @@ var require_printer = __commonJS({
|
|
|
57422
57422
|
case "TypeAlias":
|
|
57423
57423
|
return (0, lines_1.concat)([
|
|
57424
57424
|
"type ",
|
|
57425
|
-
path4.call(
|
|
57426
|
-
path4.call(
|
|
57425
|
+
path4.call(print14, "id"),
|
|
57426
|
+
path4.call(print14, "typeParameters"),
|
|
57427
57427
|
" = ",
|
|
57428
|
-
path4.call(
|
|
57428
|
+
path4.call(print14, "right"),
|
|
57429
57429
|
";"
|
|
57430
57430
|
]);
|
|
57431
57431
|
case "DeclareOpaqueType":
|
|
57432
57432
|
parts.push("declare ");
|
|
57433
57433
|
case "OpaqueType":
|
|
57434
|
-
parts.push("opaque type ", path4.call(
|
|
57434
|
+
parts.push("opaque type ", path4.call(print14, "id"), path4.call(print14, "typeParameters"));
|
|
57435
57435
|
if (n["supertype"]) {
|
|
57436
|
-
parts.push(": ", path4.call(
|
|
57436
|
+
parts.push(": ", path4.call(print14, "supertype"));
|
|
57437
57437
|
}
|
|
57438
57438
|
if (n["impltype"]) {
|
|
57439
|
-
parts.push(" = ", path4.call(
|
|
57439
|
+
parts.push(" = ", path4.call(print14, "impltype"));
|
|
57440
57440
|
}
|
|
57441
57441
|
parts.push(";");
|
|
57442
57442
|
return (0, lines_1.concat)(parts);
|
|
57443
57443
|
case "TypeCastExpression":
|
|
57444
57444
|
return (0, lines_1.concat)([
|
|
57445
57445
|
"(",
|
|
57446
|
-
path4.call(
|
|
57447
|
-
path4.call(
|
|
57446
|
+
path4.call(print14, "expression"),
|
|
57447
|
+
path4.call(print14, "typeAnnotation"),
|
|
57448
57448
|
")"
|
|
57449
57449
|
]);
|
|
57450
57450
|
case "TypeParameterDeclaration":
|
|
57451
57451
|
case "TypeParameterInstantiation":
|
|
57452
57452
|
return (0, lines_1.concat)([
|
|
57453
57453
|
"<",
|
|
57454
|
-
(0, lines_1.fromString)(", ").join(path4.map(
|
|
57454
|
+
(0, lines_1.fromString)(", ").join(path4.map(print14, "params")),
|
|
57455
57455
|
">"
|
|
57456
57456
|
]);
|
|
57457
57457
|
case "Variance":
|
|
@@ -57464,32 +57464,32 @@ var require_printer = __commonJS({
|
|
|
57464
57464
|
return (0, lines_1.fromString)("");
|
|
57465
57465
|
case "TypeParameter":
|
|
57466
57466
|
if (n.variance) {
|
|
57467
|
-
parts.push(printVariance(path4,
|
|
57467
|
+
parts.push(printVariance(path4, print14));
|
|
57468
57468
|
}
|
|
57469
|
-
parts.push(path4.call(
|
|
57469
|
+
parts.push(path4.call(print14, "name"));
|
|
57470
57470
|
if (n.bound) {
|
|
57471
|
-
parts.push(path4.call(
|
|
57471
|
+
parts.push(path4.call(print14, "bound"));
|
|
57472
57472
|
}
|
|
57473
57473
|
if (n["default"]) {
|
|
57474
|
-
parts.push("=", path4.call(
|
|
57474
|
+
parts.push("=", path4.call(print14, "default"));
|
|
57475
57475
|
}
|
|
57476
57476
|
return (0, lines_1.concat)(parts);
|
|
57477
57477
|
case "TypeofTypeAnnotation":
|
|
57478
57478
|
return (0, lines_1.concat)([
|
|
57479
57479
|
(0, lines_1.fromString)("typeof ", options),
|
|
57480
|
-
path4.call(
|
|
57480
|
+
path4.call(print14, "argument")
|
|
57481
57481
|
]);
|
|
57482
57482
|
case "IndexedAccessType":
|
|
57483
57483
|
case "OptionalIndexedAccessType":
|
|
57484
57484
|
return (0, lines_1.concat)([
|
|
57485
|
-
path4.call(
|
|
57485
|
+
path4.call(print14, "objectType"),
|
|
57486
57486
|
n.optional ? "?." : "",
|
|
57487
57487
|
"[",
|
|
57488
|
-
path4.call(
|
|
57488
|
+
path4.call(print14, "indexType"),
|
|
57489
57489
|
"]"
|
|
57490
57490
|
]);
|
|
57491
57491
|
case "UnionTypeAnnotation":
|
|
57492
|
-
return (0, lines_1.fromString)(" | ").join(path4.map(
|
|
57492
|
+
return (0, lines_1.fromString)(" | ").join(path4.map(print14, "types"));
|
|
57493
57493
|
case "VoidTypeAnnotation":
|
|
57494
57494
|
return (0, lines_1.fromString)("void", options);
|
|
57495
57495
|
case "NullTypeAnnotation":
|
|
@@ -57529,77 +57529,77 @@ var require_printer = __commonJS({
|
|
|
57529
57529
|
case "TSNeverKeyword":
|
|
57530
57530
|
return (0, lines_1.fromString)("never", options);
|
|
57531
57531
|
case "TSArrayType":
|
|
57532
|
-
return (0, lines_1.concat)([path4.call(
|
|
57532
|
+
return (0, lines_1.concat)([path4.call(print14, "elementType"), "[]"]);
|
|
57533
57533
|
case "TSLiteralType":
|
|
57534
|
-
return path4.call(
|
|
57534
|
+
return path4.call(print14, "literal");
|
|
57535
57535
|
case "TSUnionType":
|
|
57536
|
-
return (0, lines_1.fromString)(" | ").join(path4.map(
|
|
57536
|
+
return (0, lines_1.fromString)(" | ").join(path4.map(print14, "types"));
|
|
57537
57537
|
case "TSIntersectionType":
|
|
57538
|
-
return (0, lines_1.fromString)(" & ").join(path4.map(
|
|
57538
|
+
return (0, lines_1.fromString)(" & ").join(path4.map(print14, "types"));
|
|
57539
57539
|
case "TSConditionalType":
|
|
57540
|
-
parts.push(path4.call(
|
|
57540
|
+
parts.push(path4.call(print14, "checkType"), " extends ", path4.call(print14, "extendsType"), " ? ", path4.call(print14, "trueType"), " : ", path4.call(print14, "falseType"));
|
|
57541
57541
|
return (0, lines_1.concat)(parts);
|
|
57542
57542
|
case "TSInferType":
|
|
57543
|
-
parts.push("infer ", path4.call(
|
|
57543
|
+
parts.push("infer ", path4.call(print14, "typeParameter"));
|
|
57544
57544
|
return (0, lines_1.concat)(parts);
|
|
57545
57545
|
case "TSParenthesizedType":
|
|
57546
|
-
return (0, lines_1.concat)(["(", path4.call(
|
|
57546
|
+
return (0, lines_1.concat)(["(", path4.call(print14, "typeAnnotation"), ")"]);
|
|
57547
57547
|
case "TSFunctionType":
|
|
57548
57548
|
return (0, lines_1.concat)([
|
|
57549
|
-
path4.call(
|
|
57549
|
+
path4.call(print14, "typeParameters"),
|
|
57550
57550
|
"(",
|
|
57551
|
-
printFunctionParams(path4, options,
|
|
57551
|
+
printFunctionParams(path4, options, print14),
|
|
57552
57552
|
") => ",
|
|
57553
|
-
path4.call(
|
|
57553
|
+
path4.call(print14, "typeAnnotation", "typeAnnotation")
|
|
57554
57554
|
]);
|
|
57555
57555
|
case "TSConstructorType":
|
|
57556
57556
|
return (0, lines_1.concat)([
|
|
57557
57557
|
"new ",
|
|
57558
|
-
path4.call(
|
|
57558
|
+
path4.call(print14, "typeParameters"),
|
|
57559
57559
|
"(",
|
|
57560
|
-
printFunctionParams(path4, options,
|
|
57560
|
+
printFunctionParams(path4, options, print14),
|
|
57561
57561
|
") => ",
|
|
57562
|
-
path4.call(
|
|
57562
|
+
path4.call(print14, "typeAnnotation", "typeAnnotation")
|
|
57563
57563
|
]);
|
|
57564
57564
|
case "TSMappedType": {
|
|
57565
|
-
parts.push(n.readonly ? "readonly " : "", "[", path4.call(
|
|
57565
|
+
parts.push(n.readonly ? "readonly " : "", "[", path4.call(print14, "typeParameter"), "]", n.optional ? "?" : "");
|
|
57566
57566
|
if (n.typeAnnotation) {
|
|
57567
|
-
parts.push(": ", path4.call(
|
|
57567
|
+
parts.push(": ", path4.call(print14, "typeAnnotation"), ";");
|
|
57568
57568
|
}
|
|
57569
57569
|
return (0, lines_1.concat)(["{\n", (0, lines_1.concat)(parts).indent(options.tabWidth), "\n}"]);
|
|
57570
57570
|
}
|
|
57571
57571
|
case "TSTupleType":
|
|
57572
57572
|
return (0, lines_1.concat)([
|
|
57573
57573
|
"[",
|
|
57574
|
-
(0, lines_1.fromString)(", ").join(path4.map(
|
|
57574
|
+
(0, lines_1.fromString)(", ").join(path4.map(print14, "elementTypes")),
|
|
57575
57575
|
"]"
|
|
57576
57576
|
]);
|
|
57577
57577
|
case "TSNamedTupleMember":
|
|
57578
|
-
parts.push(path4.call(
|
|
57578
|
+
parts.push(path4.call(print14, "label"));
|
|
57579
57579
|
if (n.optional) {
|
|
57580
57580
|
parts.push("?");
|
|
57581
57581
|
}
|
|
57582
|
-
parts.push(": ", path4.call(
|
|
57582
|
+
parts.push(": ", path4.call(print14, "elementType"));
|
|
57583
57583
|
return (0, lines_1.concat)(parts);
|
|
57584
57584
|
case "TSRestType":
|
|
57585
|
-
return (0, lines_1.concat)(["...", path4.call(
|
|
57585
|
+
return (0, lines_1.concat)(["...", path4.call(print14, "typeAnnotation")]);
|
|
57586
57586
|
case "TSOptionalType":
|
|
57587
|
-
return (0, lines_1.concat)([path4.call(
|
|
57587
|
+
return (0, lines_1.concat)([path4.call(print14, "typeAnnotation"), "?"]);
|
|
57588
57588
|
case "TSIndexedAccessType":
|
|
57589
57589
|
return (0, lines_1.concat)([
|
|
57590
|
-
path4.call(
|
|
57590
|
+
path4.call(print14, "objectType"),
|
|
57591
57591
|
"[",
|
|
57592
|
-
path4.call(
|
|
57592
|
+
path4.call(print14, "indexType"),
|
|
57593
57593
|
"]"
|
|
57594
57594
|
]);
|
|
57595
57595
|
case "TSTypeOperator":
|
|
57596
57596
|
return (0, lines_1.concat)([
|
|
57597
|
-
path4.call(
|
|
57597
|
+
path4.call(print14, "operator"),
|
|
57598
57598
|
" ",
|
|
57599
|
-
path4.call(
|
|
57599
|
+
path4.call(print14, "typeAnnotation")
|
|
57600
57600
|
]);
|
|
57601
57601
|
case "TSTypeLiteral": {
|
|
57602
|
-
var members = (0, lines_1.fromString)("\n").join(path4.map(
|
|
57602
|
+
var members = (0, lines_1.fromString)("\n").join(path4.map(print14, "members").map(function(member) {
|
|
57603
57603
|
if (lastNonSpaceCharacter(member) !== ";") {
|
|
57604
57604
|
return member.concat(";");
|
|
57605
57605
|
}
|
|
@@ -57612,13 +57612,13 @@ var require_printer = __commonJS({
|
|
|
57612
57612
|
return (0, lines_1.concat)(parts);
|
|
57613
57613
|
}
|
|
57614
57614
|
case "TSEnumMember":
|
|
57615
|
-
parts.push(path4.call(
|
|
57615
|
+
parts.push(path4.call(print14, "id"));
|
|
57616
57616
|
if (n.initializer) {
|
|
57617
|
-
parts.push(" = ", path4.call(
|
|
57617
|
+
parts.push(" = ", path4.call(print14, "initializer"));
|
|
57618
57618
|
}
|
|
57619
57619
|
return (0, lines_1.concat)(parts);
|
|
57620
57620
|
case "TSTypeQuery":
|
|
57621
|
-
return (0, lines_1.concat)(["typeof ", path4.call(
|
|
57621
|
+
return (0, lines_1.concat)(["typeof ", path4.call(print14, "exprName")]);
|
|
57622
57622
|
case "TSParameterProperty":
|
|
57623
57623
|
if (n.accessibility) {
|
|
57624
57624
|
parts.push(n.accessibility, " ");
|
|
@@ -57632,119 +57632,119 @@ var require_printer = __commonJS({
|
|
|
57632
57632
|
if (n.readonly) {
|
|
57633
57633
|
parts.push("readonly ");
|
|
57634
57634
|
}
|
|
57635
|
-
parts.push(path4.call(
|
|
57635
|
+
parts.push(path4.call(print14, "parameter"));
|
|
57636
57636
|
return (0, lines_1.concat)(parts);
|
|
57637
57637
|
case "TSTypeReference":
|
|
57638
57638
|
return (0, lines_1.concat)([
|
|
57639
|
-
path4.call(
|
|
57640
|
-
path4.call(
|
|
57639
|
+
path4.call(print14, "typeName"),
|
|
57640
|
+
path4.call(print14, "typeParameters")
|
|
57641
57641
|
]);
|
|
57642
57642
|
case "TSQualifiedName":
|
|
57643
|
-
return (0, lines_1.concat)([path4.call(
|
|
57643
|
+
return (0, lines_1.concat)([path4.call(print14, "left"), ".", path4.call(print14, "right")]);
|
|
57644
57644
|
case "TSAsExpression":
|
|
57645
57645
|
case "TSSatisfiesExpression": {
|
|
57646
|
-
var expression = path4.call(
|
|
57647
|
-
parts.push(expression, n.type === "TSSatisfiesExpression" ? " satisfies " : " as ", path4.call(
|
|
57646
|
+
var expression = path4.call(print14, "expression");
|
|
57647
|
+
parts.push(expression, n.type === "TSSatisfiesExpression" ? " satisfies " : " as ", path4.call(print14, "typeAnnotation"));
|
|
57648
57648
|
return (0, lines_1.concat)(parts);
|
|
57649
57649
|
}
|
|
57650
57650
|
case "TSTypeCastExpression":
|
|
57651
57651
|
return (0, lines_1.concat)([
|
|
57652
|
-
path4.call(
|
|
57653
|
-
path4.call(
|
|
57652
|
+
path4.call(print14, "expression"),
|
|
57653
|
+
path4.call(print14, "typeAnnotation")
|
|
57654
57654
|
]);
|
|
57655
57655
|
case "TSNonNullExpression":
|
|
57656
|
-
return (0, lines_1.concat)([path4.call(
|
|
57656
|
+
return (0, lines_1.concat)([path4.call(print14, "expression"), "!"]);
|
|
57657
57657
|
case "TSTypeAnnotation":
|
|
57658
|
-
return (0, lines_1.concat)([": ", path4.call(
|
|
57658
|
+
return (0, lines_1.concat)([": ", path4.call(print14, "typeAnnotation")]);
|
|
57659
57659
|
case "TSIndexSignature":
|
|
57660
57660
|
return (0, lines_1.concat)([
|
|
57661
57661
|
n.readonly ? "readonly " : "",
|
|
57662
57662
|
"[",
|
|
57663
|
-
path4.map(
|
|
57663
|
+
path4.map(print14, "parameters"),
|
|
57664
57664
|
"]",
|
|
57665
|
-
path4.call(
|
|
57665
|
+
path4.call(print14, "typeAnnotation")
|
|
57666
57666
|
]);
|
|
57667
57667
|
case "TSPropertySignature":
|
|
57668
|
-
parts.push(printVariance(path4,
|
|
57668
|
+
parts.push(printVariance(path4, print14), n.readonly ? "readonly " : "");
|
|
57669
57669
|
if (n.computed) {
|
|
57670
|
-
parts.push("[", path4.call(
|
|
57670
|
+
parts.push("[", path4.call(print14, "key"), "]");
|
|
57671
57671
|
} else {
|
|
57672
|
-
parts.push(path4.call(
|
|
57672
|
+
parts.push(path4.call(print14, "key"));
|
|
57673
57673
|
}
|
|
57674
|
-
parts.push(n.optional ? "?" : "", path4.call(
|
|
57674
|
+
parts.push(n.optional ? "?" : "", path4.call(print14, "typeAnnotation"));
|
|
57675
57675
|
return (0, lines_1.concat)(parts);
|
|
57676
57676
|
case "TSMethodSignature":
|
|
57677
57677
|
if (n.computed) {
|
|
57678
|
-
parts.push("[", path4.call(
|
|
57678
|
+
parts.push("[", path4.call(print14, "key"), "]");
|
|
57679
57679
|
} else {
|
|
57680
|
-
parts.push(path4.call(
|
|
57680
|
+
parts.push(path4.call(print14, "key"));
|
|
57681
57681
|
}
|
|
57682
57682
|
if (n.optional) {
|
|
57683
57683
|
parts.push("?");
|
|
57684
57684
|
}
|
|
57685
|
-
parts.push(path4.call(
|
|
57685
|
+
parts.push(path4.call(print14, "typeParameters"), "(", printFunctionParams(path4, options, print14), ")", path4.call(print14, "typeAnnotation"));
|
|
57686
57686
|
return (0, lines_1.concat)(parts);
|
|
57687
57687
|
case "TSTypePredicate":
|
|
57688
57688
|
if (n.asserts) {
|
|
57689
57689
|
parts.push("asserts ");
|
|
57690
57690
|
}
|
|
57691
|
-
parts.push(path4.call(
|
|
57691
|
+
parts.push(path4.call(print14, "parameterName"));
|
|
57692
57692
|
if (n.typeAnnotation) {
|
|
57693
|
-
parts.push(" is ", path4.call(
|
|
57693
|
+
parts.push(" is ", path4.call(print14, "typeAnnotation", "typeAnnotation"));
|
|
57694
57694
|
}
|
|
57695
57695
|
return (0, lines_1.concat)(parts);
|
|
57696
57696
|
case "TSCallSignatureDeclaration":
|
|
57697
57697
|
return (0, lines_1.concat)([
|
|
57698
|
-
path4.call(
|
|
57698
|
+
path4.call(print14, "typeParameters"),
|
|
57699
57699
|
"(",
|
|
57700
|
-
printFunctionParams(path4, options,
|
|
57700
|
+
printFunctionParams(path4, options, print14),
|
|
57701
57701
|
")",
|
|
57702
|
-
path4.call(
|
|
57702
|
+
path4.call(print14, "typeAnnotation")
|
|
57703
57703
|
]);
|
|
57704
57704
|
case "TSConstructSignatureDeclaration":
|
|
57705
57705
|
if (n.typeParameters) {
|
|
57706
|
-
parts.push("new", path4.call(
|
|
57706
|
+
parts.push("new", path4.call(print14, "typeParameters"));
|
|
57707
57707
|
} else {
|
|
57708
57708
|
parts.push("new ");
|
|
57709
57709
|
}
|
|
57710
|
-
parts.push("(", printFunctionParams(path4, options,
|
|
57710
|
+
parts.push("(", printFunctionParams(path4, options, print14), ")", path4.call(print14, "typeAnnotation"));
|
|
57711
57711
|
return (0, lines_1.concat)(parts);
|
|
57712
57712
|
case "TSTypeAliasDeclaration":
|
|
57713
57713
|
return (0, lines_1.concat)([
|
|
57714
57714
|
n.declare ? "declare " : "",
|
|
57715
57715
|
"type ",
|
|
57716
|
-
path4.call(
|
|
57717
|
-
path4.call(
|
|
57716
|
+
path4.call(print14, "id"),
|
|
57717
|
+
path4.call(print14, "typeParameters"),
|
|
57718
57718
|
" = ",
|
|
57719
|
-
path4.call(
|
|
57719
|
+
path4.call(print14, "typeAnnotation"),
|
|
57720
57720
|
";"
|
|
57721
57721
|
]);
|
|
57722
57722
|
case "TSTypeParameter": {
|
|
57723
|
-
parts.push(path4.call(
|
|
57723
|
+
parts.push(path4.call(print14, "name"));
|
|
57724
57724
|
var parent2 = path4.getParentNode(0);
|
|
57725
57725
|
var isInMappedType = namedTypes.TSMappedType.check(parent2);
|
|
57726
57726
|
if (n.constraint) {
|
|
57727
|
-
parts.push(isInMappedType ? " in " : " extends ", path4.call(
|
|
57727
|
+
parts.push(isInMappedType ? " in " : " extends ", path4.call(print14, "constraint"));
|
|
57728
57728
|
}
|
|
57729
57729
|
if (n["default"]) {
|
|
57730
|
-
parts.push(" = ", path4.call(
|
|
57730
|
+
parts.push(" = ", path4.call(print14, "default"));
|
|
57731
57731
|
}
|
|
57732
57732
|
return (0, lines_1.concat)(parts);
|
|
57733
57733
|
}
|
|
57734
57734
|
case "TSTypeAssertion": {
|
|
57735
|
-
parts.push("<", path4.call(
|
|
57735
|
+
parts.push("<", path4.call(print14, "typeAnnotation"), "> ", path4.call(print14, "expression"));
|
|
57736
57736
|
return (0, lines_1.concat)(parts);
|
|
57737
57737
|
}
|
|
57738
57738
|
case "TSTypeParameterDeclaration":
|
|
57739
57739
|
case "TSTypeParameterInstantiation":
|
|
57740
57740
|
return (0, lines_1.concat)([
|
|
57741
57741
|
"<",
|
|
57742
|
-
(0, lines_1.fromString)(", ").join(path4.map(
|
|
57742
|
+
(0, lines_1.fromString)(", ").join(path4.map(print14, "params")),
|
|
57743
57743
|
">"
|
|
57744
57744
|
]);
|
|
57745
57745
|
case "TSEnumDeclaration": {
|
|
57746
|
-
parts.push(n.declare ? "declare " : "", n.const ? "const " : "", "enum ", path4.call(
|
|
57747
|
-
var memberLines = (0, lines_1.fromString)(",\n").join(path4.map(
|
|
57746
|
+
parts.push(n.declare ? "declare " : "", n.const ? "const " : "", "enum ", path4.call(print14, "id"));
|
|
57747
|
+
var memberLines = (0, lines_1.fromString)(",\n").join(path4.map(print14, "members"));
|
|
57748
57748
|
if (memberLines.isEmpty()) {
|
|
57749
57749
|
parts.push(" {}");
|
|
57750
57750
|
} else {
|
|
@@ -57754,11 +57754,11 @@ var require_printer = __commonJS({
|
|
|
57754
57754
|
}
|
|
57755
57755
|
case "TSExpressionWithTypeArguments":
|
|
57756
57756
|
return (0, lines_1.concat)([
|
|
57757
|
-
path4.call(
|
|
57758
|
-
path4.call(
|
|
57757
|
+
path4.call(print14, "expression"),
|
|
57758
|
+
path4.call(print14, "typeParameters")
|
|
57759
57759
|
]);
|
|
57760
57760
|
case "TSInterfaceBody": {
|
|
57761
|
-
var lines = (0, lines_1.fromString)("\n").join(path4.map(
|
|
57761
|
+
var lines = (0, lines_1.fromString)("\n").join(path4.map(print14, "body").map(function(element) {
|
|
57762
57762
|
if (lastNonSpaceCharacter(element) !== ";") {
|
|
57763
57763
|
return element.concat(";");
|
|
57764
57764
|
}
|
|
@@ -57770,22 +57770,22 @@ var require_printer = __commonJS({
|
|
|
57770
57770
|
return (0, lines_1.concat)(["{\n", lines.indent(options.tabWidth), "\n}"]);
|
|
57771
57771
|
}
|
|
57772
57772
|
case "TSImportType":
|
|
57773
|
-
parts.push("import(", path4.call(
|
|
57773
|
+
parts.push("import(", path4.call(print14, "argument"), ")");
|
|
57774
57774
|
if (n.qualifier) {
|
|
57775
|
-
parts.push(".", path4.call(
|
|
57775
|
+
parts.push(".", path4.call(print14, "qualifier"));
|
|
57776
57776
|
}
|
|
57777
57777
|
if (n.typeParameters) {
|
|
57778
|
-
parts.push(path4.call(
|
|
57778
|
+
parts.push(path4.call(print14, "typeParameters"));
|
|
57779
57779
|
}
|
|
57780
57780
|
return (0, lines_1.concat)(parts);
|
|
57781
57781
|
case "TSImportEqualsDeclaration":
|
|
57782
57782
|
if (n.isExport) {
|
|
57783
57783
|
parts.push("export ");
|
|
57784
57784
|
}
|
|
57785
|
-
parts.push("import ", path4.call(
|
|
57785
|
+
parts.push("import ", path4.call(print14, "id"), " = ", path4.call(print14, "moduleReference"));
|
|
57786
57786
|
return maybeAddSemicolon((0, lines_1.concat)(parts));
|
|
57787
57787
|
case "TSExternalModuleReference":
|
|
57788
|
-
return (0, lines_1.concat)(["require(", path4.call(
|
|
57788
|
+
return (0, lines_1.concat)(["require(", path4.call(print14, "expression"), ")"]);
|
|
57789
57789
|
case "TSModuleDeclaration": {
|
|
57790
57790
|
var parent2 = path4.getParentNode();
|
|
57791
57791
|
if (parent2.type === "TSModuleDeclaration") {
|
|
@@ -57810,16 +57810,16 @@ var require_printer = __commonJS({
|
|
|
57810
57810
|
}
|
|
57811
57811
|
}
|
|
57812
57812
|
}
|
|
57813
|
-
parts.push(path4.call(
|
|
57813
|
+
parts.push(path4.call(print14, "id"));
|
|
57814
57814
|
if (n.body) {
|
|
57815
57815
|
parts.push(" ");
|
|
57816
|
-
parts.push(path4.call(
|
|
57816
|
+
parts.push(path4.call(print14, "body"));
|
|
57817
57817
|
}
|
|
57818
57818
|
return (0, lines_1.concat)(parts);
|
|
57819
57819
|
}
|
|
57820
57820
|
case "TSModuleBlock": {
|
|
57821
57821
|
var naked = path4.call(function(bodyPath) {
|
|
57822
|
-
return printStatementSequence(bodyPath, options,
|
|
57822
|
+
return printStatementSequence(bodyPath, options, print14);
|
|
57823
57823
|
}, "body");
|
|
57824
57824
|
if (naked.isEmpty()) {
|
|
57825
57825
|
parts.push("{}");
|
|
@@ -57829,11 +57829,11 @@ var require_printer = __commonJS({
|
|
|
57829
57829
|
return (0, lines_1.concat)(parts);
|
|
57830
57830
|
}
|
|
57831
57831
|
case "TSInstantiationExpression": {
|
|
57832
|
-
parts.push(path4.call(
|
|
57832
|
+
parts.push(path4.call(print14, "expression"), path4.call(print14, "typeParameters"));
|
|
57833
57833
|
return (0, lines_1.concat)(parts);
|
|
57834
57834
|
}
|
|
57835
57835
|
case "V8IntrinsicIdentifier":
|
|
57836
|
-
return (0, lines_1.concat)(["%", path4.call(
|
|
57836
|
+
return (0, lines_1.concat)(["%", path4.call(print14, "name")]);
|
|
57837
57837
|
case "TopicReference":
|
|
57838
57838
|
return (0, lines_1.fromString)("#");
|
|
57839
57839
|
case "ClassHeritage":
|
|
@@ -57883,7 +57883,7 @@ var require_printer = __commonJS({
|
|
|
57883
57883
|
}
|
|
57884
57884
|
return (0, lines_1.concat)(parts);
|
|
57885
57885
|
}
|
|
57886
|
-
function printStatementSequence(path4, options,
|
|
57886
|
+
function printStatementSequence(path4, options, print14) {
|
|
57887
57887
|
var filtered = [];
|
|
57888
57888
|
var sawComment = false;
|
|
57889
57889
|
var sawStatement = false;
|
|
@@ -57904,7 +57904,7 @@ var require_printer = __commonJS({
|
|
|
57904
57904
|
}
|
|
57905
57905
|
filtered.push({
|
|
57906
57906
|
node: stmt,
|
|
57907
|
-
printed:
|
|
57907
|
+
printed: print14(stmtPath)
|
|
57908
57908
|
});
|
|
57909
57909
|
});
|
|
57910
57910
|
if (sawComment) {
|
|
@@ -57996,7 +57996,7 @@ var require_printer = __commonJS({
|
|
|
57996
57996
|
}
|
|
57997
57997
|
return parts;
|
|
57998
57998
|
}
|
|
57999
|
-
function printMethod(path4, options,
|
|
57999
|
+
function printMethod(path4, options, print14) {
|
|
58000
58000
|
var node = path4.getNode();
|
|
58001
58001
|
var kind = node.kind;
|
|
58002
58002
|
var parts = [];
|
|
@@ -58014,7 +58014,7 @@ var require_printer = __commonJS({
|
|
|
58014
58014
|
if (kind === "get" || kind === "set") {
|
|
58015
58015
|
parts.push(kind, " ");
|
|
58016
58016
|
}
|
|
58017
|
-
var key = path4.call(
|
|
58017
|
+
var key = path4.call(print14, "key");
|
|
58018
58018
|
if (node.computed) {
|
|
58019
58019
|
key = (0, lines_1.concat)(["[", key, "]"]);
|
|
58020
58020
|
}
|
|
@@ -58023,26 +58023,26 @@ var require_printer = __commonJS({
|
|
|
58023
58023
|
parts.push("?");
|
|
58024
58024
|
}
|
|
58025
58025
|
if (node === nodeValue) {
|
|
58026
|
-
parts.push(path4.call(
|
|
58026
|
+
parts.push(path4.call(print14, "typeParameters"), "(", printFunctionParams(path4, options, print14), ")", path4.call(print14, "returnType"));
|
|
58027
58027
|
if (node.body) {
|
|
58028
|
-
parts.push(" ", path4.call(
|
|
58028
|
+
parts.push(" ", path4.call(print14, "body"));
|
|
58029
58029
|
} else {
|
|
58030
58030
|
parts.push(";");
|
|
58031
58031
|
}
|
|
58032
58032
|
} else {
|
|
58033
|
-
parts.push(path4.call(
|
|
58034
|
-
return printFunctionParams(valuePath, options,
|
|
58035
|
-
}, "value"), ")", path4.call(
|
|
58033
|
+
parts.push(path4.call(print14, "value", "typeParameters"), "(", path4.call(function(valuePath) {
|
|
58034
|
+
return printFunctionParams(valuePath, options, print14);
|
|
58035
|
+
}, "value"), ")", path4.call(print14, "value", "returnType"));
|
|
58036
58036
|
if (nodeValue.body) {
|
|
58037
|
-
parts.push(" ", path4.call(
|
|
58037
|
+
parts.push(" ", path4.call(print14, "value", "body"));
|
|
58038
58038
|
} else {
|
|
58039
58039
|
parts.push(";");
|
|
58040
58040
|
}
|
|
58041
58041
|
}
|
|
58042
58042
|
return (0, lines_1.concat)(parts);
|
|
58043
58043
|
}
|
|
58044
|
-
function printArgumentsList(path4, options,
|
|
58045
|
-
var printed = path4.map(
|
|
58044
|
+
function printArgumentsList(path4, options, print14) {
|
|
58045
|
+
var printed = path4.map(print14, "arguments");
|
|
58046
58046
|
var trailingComma = util.isTrailingCommaEnabled(options, "parameters");
|
|
58047
58047
|
var joined = (0, lines_1.fromString)(", ").join(printed);
|
|
58048
58048
|
if (joined.getLineLength(1) > options.wrapColumn) {
|
|
@@ -58055,28 +58055,28 @@ var require_printer = __commonJS({
|
|
|
58055
58055
|
}
|
|
58056
58056
|
return (0, lines_1.concat)(["(", joined, ")"]);
|
|
58057
58057
|
}
|
|
58058
|
-
function printFunctionParams(path4, options,
|
|
58058
|
+
function printFunctionParams(path4, options, print14) {
|
|
58059
58059
|
var fun = path4.getValue();
|
|
58060
58060
|
var params;
|
|
58061
58061
|
var printed = [];
|
|
58062
58062
|
if (fun.params) {
|
|
58063
58063
|
params = fun.params;
|
|
58064
|
-
printed = path4.map(
|
|
58064
|
+
printed = path4.map(print14, "params");
|
|
58065
58065
|
} else if (fun.parameters) {
|
|
58066
58066
|
params = fun.parameters;
|
|
58067
|
-
printed = path4.map(
|
|
58067
|
+
printed = path4.map(print14, "parameters");
|
|
58068
58068
|
}
|
|
58069
58069
|
if (fun.defaults) {
|
|
58070
58070
|
path4.each(function(defExprPath) {
|
|
58071
58071
|
var i2 = defExprPath.getName();
|
|
58072
58072
|
var p3 = printed[i2];
|
|
58073
58073
|
if (p3 && defExprPath.getValue()) {
|
|
58074
|
-
printed[i2] = (0, lines_1.concat)([p3, " = ",
|
|
58074
|
+
printed[i2] = (0, lines_1.concat)([p3, " = ", print14(defExprPath)]);
|
|
58075
58075
|
}
|
|
58076
58076
|
}, "defaults");
|
|
58077
58077
|
}
|
|
58078
58078
|
if (fun.rest) {
|
|
58079
|
-
printed.push((0, lines_1.concat)(["...", path4.call(
|
|
58079
|
+
printed.push((0, lines_1.concat)(["...", path4.call(print14, "rest")]));
|
|
58080
58080
|
}
|
|
58081
58081
|
var joined = (0, lines_1.fromString)(", ").join(printed);
|
|
58082
58082
|
if (joined.length > 1 || joined.getLineLength(1) > options.wrapColumn) {
|
|
@@ -58090,11 +58090,11 @@ var require_printer = __commonJS({
|
|
|
58090
58090
|
}
|
|
58091
58091
|
return joined;
|
|
58092
58092
|
}
|
|
58093
|
-
function maybePrintImportAssertions(path4, options,
|
|
58093
|
+
function maybePrintImportAssertions(path4, options, print14) {
|
|
58094
58094
|
var n = path4.getValue();
|
|
58095
58095
|
if (n.assertions && n.assertions.length > 0) {
|
|
58096
58096
|
var parts = [" assert {"];
|
|
58097
|
-
var printed = path4.map(
|
|
58097
|
+
var printed = path4.map(print14, "assertions");
|
|
58098
58098
|
var flat = (0, lines_1.fromString)(", ").join(printed);
|
|
58099
58099
|
if (flat.length > 1 || flat.getLineLength(1) > options.wrapColumn) {
|
|
58100
58100
|
parts.push("\n", (0, lines_1.fromString)(",\n").join(printed).indent(options.tabWidth), "\n}");
|
|
@@ -58105,7 +58105,7 @@ var require_printer = __commonJS({
|
|
|
58105
58105
|
}
|
|
58106
58106
|
return (0, lines_1.fromString)("");
|
|
58107
58107
|
}
|
|
58108
|
-
function printExportDeclaration(path4, options,
|
|
58108
|
+
function printExportDeclaration(path4, options, print14) {
|
|
58109
58109
|
var decl = path4.getValue();
|
|
58110
58110
|
var parts = ["export "];
|
|
58111
58111
|
if (decl.exportKind && decl.exportKind === "type") {
|
|
@@ -58119,7 +58119,7 @@ var require_printer = __commonJS({
|
|
|
58119
58119
|
parts.push("default ");
|
|
58120
58120
|
}
|
|
58121
58121
|
if (decl.declaration) {
|
|
58122
|
-
parts.push(path4.call(
|
|
58122
|
+
parts.push(path4.call(print14, "declaration"));
|
|
58123
58123
|
} else if (decl.specifiers) {
|
|
58124
58124
|
if (decl.specifiers.length === 1 && decl.specifiers[0].type === "ExportBatchSpecifier") {
|
|
58125
58125
|
parts.push("*");
|
|
@@ -58131,9 +58131,9 @@ var require_printer = __commonJS({
|
|
|
58131
58131
|
path4.each(function(specifierPath) {
|
|
58132
58132
|
var spec = specifierPath.getValue();
|
|
58133
58133
|
if (spec.type === "ExportDefaultSpecifier") {
|
|
58134
|
-
unbracedSpecifiers_2.push(
|
|
58134
|
+
unbracedSpecifiers_2.push(print14(specifierPath));
|
|
58135
58135
|
} else {
|
|
58136
|
-
bracedSpecifiers_2.push(
|
|
58136
|
+
bracedSpecifiers_2.push(print14(specifierPath));
|
|
58137
58137
|
}
|
|
58138
58138
|
}, "specifiers");
|
|
58139
58139
|
unbracedSpecifiers_2.forEach(function(lines2, i2) {
|
|
@@ -58162,10 +58162,10 @@ var require_printer = __commonJS({
|
|
|
58162
58162
|
}
|
|
58163
58163
|
}
|
|
58164
58164
|
} else {
|
|
58165
|
-
parts.push(shouldPrintSpaces ? "{ " : "{", (0, lines_1.fromString)(", ").join(path4.map(
|
|
58165
|
+
parts.push(shouldPrintSpaces ? "{ " : "{", (0, lines_1.fromString)(", ").join(path4.map(print14, "specifiers")), shouldPrintSpaces ? " }" : "}");
|
|
58166
58166
|
}
|
|
58167
58167
|
if (decl.source) {
|
|
58168
|
-
parts.push(" from ", path4.call(
|
|
58168
|
+
parts.push(" from ", path4.call(print14, "source"), maybePrintImportAssertions(path4, options, print14));
|
|
58169
58169
|
}
|
|
58170
58170
|
}
|
|
58171
58171
|
var lines = (0, lines_1.concat)(parts);
|
|
@@ -58183,7 +58183,7 @@ var require_printer = __commonJS({
|
|
|
58183
58183
|
}
|
|
58184
58184
|
return (0, lines_1.concat)(parts);
|
|
58185
58185
|
}
|
|
58186
|
-
function printVariance(path4,
|
|
58186
|
+
function printVariance(path4, print14) {
|
|
58187
58187
|
return path4.call(function(variancePath) {
|
|
58188
58188
|
var value = variancePath.getValue();
|
|
58189
58189
|
if (value) {
|
|
@@ -58193,7 +58193,7 @@ var require_printer = __commonJS({
|
|
|
58193
58193
|
if (value === "minus") {
|
|
58194
58194
|
return (0, lines_1.fromString)("-");
|
|
58195
58195
|
}
|
|
58196
|
-
return
|
|
58196
|
+
return print14(variancePath);
|
|
58197
58197
|
}
|
|
58198
58198
|
return (0, lines_1.fromString)("");
|
|
58199
58199
|
}, "variance");
|
|
@@ -58280,10 +58280,10 @@ var require_main2 = __commonJS({
|
|
|
58280
58280
|
Object.defineProperty(exports, "visit", { enumerable: true, get: function() {
|
|
58281
58281
|
return ast_types_1.visit;
|
|
58282
58282
|
} });
|
|
58283
|
-
function
|
|
58283
|
+
function print14(node, options) {
|
|
58284
58284
|
return new printer_1.Printer(options).print(node);
|
|
58285
58285
|
}
|
|
58286
|
-
exports.print =
|
|
58286
|
+
exports.print = print14;
|
|
58287
58287
|
function prettyPrint3(node, options) {
|
|
58288
58288
|
return new printer_1.Printer(options).printGenerically(node);
|
|
58289
58289
|
}
|
|
@@ -58307,7 +58307,7 @@ var require_main2 = __commonJS({
|
|
|
58307
58307
|
function runString(code, transformer, options) {
|
|
58308
58308
|
var writeback = options && options.writeback || defaultWriteback;
|
|
58309
58309
|
transformer((0, parser_1.parse)(code, options), function(node) {
|
|
58310
|
-
writeback(
|
|
58310
|
+
writeback(print14(node, options).code);
|
|
58311
58311
|
});
|
|
58312
58312
|
}
|
|
58313
58313
|
}
|
|
@@ -71615,7 +71615,7 @@ var Config = class {
|
|
|
71615
71615
|
this.include.map(
|
|
71616
71616
|
(filepath) => glob2(join2(this.projectRoot, filepath))
|
|
71617
71617
|
)
|
|
71618
|
-
)).flat().filter((filepath) => this.includeFile(filepath)).filter((filepath) => {
|
|
71618
|
+
)).flat().map((filepath) => posixify(filepath)).filter((filepath) => this.includeFile(filepath)).filter((filepath) => {
|
|
71619
71619
|
const prefix = this.schemaPath?.startsWith("./") ? "./" : "";
|
|
71620
71620
|
return !this.schemaPath || !(0, import_minimatch8.default)(
|
|
71621
71621
|
prefix + relative(this.projectRoot, filepath).replaceAll("\\", "/"),
|
|
@@ -81913,6 +81913,7 @@ var bgWhite3 = init(47, 49);
|
|
|
81913
81913
|
|
|
81914
81914
|
// src/cmd/init.ts
|
|
81915
81915
|
var import_node_child_process = require("node:child_process");
|
|
81916
|
+
var recast14 = __toESM(require_main2(), 1);
|
|
81916
81917
|
function pCancel(cancelText = "Operation cancelled.") {
|
|
81917
81918
|
ne(cancelText);
|
|
81918
81919
|
process.exit(1);
|
|
@@ -82079,7 +82080,7 @@ async function init2(_path, args) {
|
|
|
82079
82080
|
);
|
|
82080
82081
|
await houdiniClient(sourceDir, typescript, frameworkInfo, url);
|
|
82081
82082
|
if (frameworkInfo.framework === "svelte") {
|
|
82082
|
-
await
|
|
82083
|
+
await svelteMainJs(targetPath, typescript);
|
|
82083
82084
|
} else if (frameworkInfo.framework === "kit") {
|
|
82084
82085
|
await svelteConfig(targetPath, typescript);
|
|
82085
82086
|
}
|
|
@@ -82178,56 +82179,61 @@ export default new HoudiniClient({
|
|
|
82178
82179
|
`;
|
|
82179
82180
|
await fs_exports.writeFile(houdiniClientPath, content);
|
|
82180
82181
|
}
|
|
82181
|
-
async function
|
|
82182
|
-
const
|
|
82182
|
+
async function svelteMainJs(targetPath, typescript) {
|
|
82183
|
+
const mainFile = typescript ? "main.ts" : "main.js";
|
|
82184
|
+
const svelteMainJsPath = path_exports.join(targetPath, "src", mainFile);
|
|
82185
|
+
const mainContents = await fs_exports.readFile(svelteMainJsPath);
|
|
82186
|
+
if (!mainContents) {
|
|
82187
|
+
throw new Error(`Failed to update ${mainFile} - cannot read`);
|
|
82188
|
+
}
|
|
82183
82189
|
const newContent = `import client from "./client";
|
|
82184
|
-
|
|
82185
|
-
import App from './App.svelte'
|
|
82186
|
-
|
|
82187
|
-
const app = new App({
|
|
82188
|
-
target: document.getElementById('app')
|
|
82189
|
-
})
|
|
82190
|
-
|
|
82191
|
-
export default app
|
|
82192
|
-
`;
|
|
82190
|
+
` + mainContents;
|
|
82193
82191
|
await fs_exports.writeFile(svelteMainJsPath, newContent);
|
|
82194
82192
|
}
|
|
82195
82193
|
async function svelteConfig(targetPath, typescript) {
|
|
82196
82194
|
const svelteConfigPath = path_exports.join(targetPath, "svelte.config.js");
|
|
82197
|
-
const
|
|
82198
|
-
|
|
82199
|
-
|
|
82200
|
-
|
|
82201
|
-
const
|
|
82202
|
-
|
|
82203
|
-
|
|
82204
|
-
|
|
82205
|
-
|
|
82206
|
-
|
|
82207
|
-
|
|
82208
|
-
|
|
82209
|
-
|
|
82210
|
-
|
|
82211
|
-
|
|
82212
|
-
|
|
82213
|
-
|
|
82214
|
-
|
|
82215
|
-
|
|
82216
|
-
|
|
82217
|
-
|
|
82218
|
-
|
|
82219
|
-
|
|
82220
|
-
|
|
82221
|
-
|
|
82222
|
-
|
|
82223
|
-
|
|
82224
|
-
|
|
82225
|
-
|
|
82226
|
-
}
|
|
82227
|
-
|
|
82228
|
-
|
|
82229
|
-
|
|
82230
|
-
|
|
82195
|
+
const contents = await fs_exports.readFile(svelteConfigPath);
|
|
82196
|
+
if (!contents) {
|
|
82197
|
+
throw new Error("Failed to patch svelte config: cannot open file");
|
|
82198
|
+
}
|
|
82199
|
+
const ast = recast14.parse(contents);
|
|
82200
|
+
recast14.visit(ast, {
|
|
82201
|
+
visitProperty(path4) {
|
|
82202
|
+
if (path4.node.key.type === "Identifier" && path4.node.key.name === "kit" && path4.node.value.type === "ObjectExpression") {
|
|
82203
|
+
const houdiniAlias = {
|
|
82204
|
+
type: "Property",
|
|
82205
|
+
key: { type: "Identifier", name: "$houdini" },
|
|
82206
|
+
value: { type: "StringLiteral", value: ".houdini/" },
|
|
82207
|
+
kind: "init"
|
|
82208
|
+
};
|
|
82209
|
+
let aliasProperty = path4.node.value.properties.find(
|
|
82210
|
+
(p3) => p3.type === "Property" && p3.key.type === "Identifier" && p3.key.name === "alias"
|
|
82211
|
+
);
|
|
82212
|
+
if (aliasProperty && aliasProperty.type === "Property" && aliasProperty.value.type === "ObjectExpression") {
|
|
82213
|
+
const existingAlias = aliasProperty.value.properties.find(
|
|
82214
|
+
(x3) => x3.type === "Property" && x3.key.type === "Identifier" && x3.key.name === "$houdini"
|
|
82215
|
+
);
|
|
82216
|
+
if (existingAlias) {
|
|
82217
|
+
existingAlias.value = houdiniAlias.value;
|
|
82218
|
+
} else {
|
|
82219
|
+
aliasProperty.value.properties.push(houdiniAlias);
|
|
82220
|
+
}
|
|
82221
|
+
} else {
|
|
82222
|
+
path4.node.value.properties.push({
|
|
82223
|
+
type: "Property",
|
|
82224
|
+
key: { type: "Identifier", name: "alias" },
|
|
82225
|
+
value: {
|
|
82226
|
+
type: "ObjectExpression",
|
|
82227
|
+
properties: [houdiniAlias]
|
|
82228
|
+
},
|
|
82229
|
+
kind: "init"
|
|
82230
|
+
});
|
|
82231
|
+
}
|
|
82232
|
+
}
|
|
82233
|
+
return false;
|
|
82234
|
+
}
|
|
82235
|
+
});
|
|
82236
|
+
await fs_exports.writeFile(svelteConfigPath, recast14.print(ast).code);
|
|
82231
82237
|
}
|
|
82232
82238
|
async function gitIgnore(targetPath) {
|
|
82233
82239
|
const filepath = path_exports.join(targetPath, ".gitignore");
|
|
@@ -82252,36 +82258,117 @@ async function graphqlRC(targetPath) {
|
|
|
82252
82258
|
}
|
|
82253
82259
|
async function viteConfig(targetPath, frameworkInfo, typescript) {
|
|
82254
82260
|
const viteConfigPath = path_exports.join(targetPath, typescript ? "vite.config.ts" : "vite.config.js");
|
|
82255
|
-
let
|
|
82261
|
+
let contents = await fs_exports.readFile(viteConfigPath);
|
|
82262
|
+
if (!contents) {
|
|
82263
|
+
throw new Error("Failed to patch vite config: cannot open file");
|
|
82264
|
+
}
|
|
82265
|
+
const ast = recast14.parse(contents);
|
|
82266
|
+
const houdiniImport = {
|
|
82267
|
+
type: "ImportDeclaration",
|
|
82268
|
+
specifiers: [
|
|
82269
|
+
{
|
|
82270
|
+
type: "ImportDefaultSpecifier",
|
|
82271
|
+
local: { type: "Identifier", name: "houdini" }
|
|
82272
|
+
}
|
|
82273
|
+
],
|
|
82274
|
+
source: { type: "Literal", value: "houdini/vite" }
|
|
82275
|
+
};
|
|
82276
|
+
ast.program.body.unshift(houdiniImport);
|
|
82277
|
+
recast14.visit(ast, {
|
|
82278
|
+
visitProperty(path4) {
|
|
82279
|
+
if (path4.node.key.type === "Identifier" && path4.node.key.name === "plugins") {
|
|
82280
|
+
if (path4.node.value.type === "ArrayExpression") {
|
|
82281
|
+
path4.node.value.elements.unshift({
|
|
82282
|
+
type: "CallExpression",
|
|
82283
|
+
callee: {
|
|
82284
|
+
type: "Identifier",
|
|
82285
|
+
name: "houdini"
|
|
82286
|
+
},
|
|
82287
|
+
arguments: []
|
|
82288
|
+
});
|
|
82289
|
+
}
|
|
82290
|
+
}
|
|
82291
|
+
return false;
|
|
82292
|
+
}
|
|
82293
|
+
});
|
|
82256
82294
|
if (frameworkInfo.framework === "svelte") {
|
|
82257
|
-
|
|
82258
|
-
|
|
82259
|
-
|
|
82260
|
-
|
|
82261
|
-
|
|
82262
|
-
|
|
82263
|
-
|
|
82264
|
-
|
|
82265
|
-
|
|
82266
|
-
|
|
82267
|
-
|
|
82268
|
-
|
|
82269
|
-
|
|
82270
|
-
|
|
82271
|
-
|
|
82272
|
-
|
|
82273
|
-
|
|
82274
|
-
|
|
82275
|
-
|
|
82276
|
-
|
|
82277
|
-
|
|
82278
|
-
|
|
82279
|
-
|
|
82280
|
-
|
|
82281
|
-
|
|
82282
|
-
|
|
82295
|
+
const houdiniAliasProperty = {
|
|
82296
|
+
type: "Property",
|
|
82297
|
+
key: { type: "Identifier", name: "$houdini" },
|
|
82298
|
+
value: { type: "StringLiteral", value: ".houdini/" },
|
|
82299
|
+
kind: "init"
|
|
82300
|
+
};
|
|
82301
|
+
const aliasValue = {
|
|
82302
|
+
type: "ObjectExpression",
|
|
82303
|
+
properties: [houdiniAliasProperty]
|
|
82304
|
+
};
|
|
82305
|
+
const resolveValue = {
|
|
82306
|
+
type: "ObjectExpression",
|
|
82307
|
+
properties: [
|
|
82308
|
+
{
|
|
82309
|
+
type: "Property",
|
|
82310
|
+
key: { type: "Identifier", name: "alias" },
|
|
82311
|
+
value: aliasValue,
|
|
82312
|
+
kind: "init"
|
|
82313
|
+
}
|
|
82314
|
+
]
|
|
82315
|
+
};
|
|
82316
|
+
recast14.visit(ast, {
|
|
82317
|
+
visitCallExpression(path4) {
|
|
82318
|
+
const config = path4.node.arguments[0];
|
|
82319
|
+
if (!config || config.type !== "ObjectExpression") {
|
|
82320
|
+
throw new Error(
|
|
82321
|
+
"Failed to patch vite config: Couldn't update `defineConfig` param - not an object"
|
|
82322
|
+
);
|
|
82323
|
+
}
|
|
82324
|
+
const resolveProperty = config.properties.find(
|
|
82325
|
+
(x3) => x3.type === "Property" && x3.key.type === "Identifier" && x3.key.name === "resolve"
|
|
82326
|
+
);
|
|
82327
|
+
if (!resolveProperty) {
|
|
82328
|
+
config.properties.push({
|
|
82329
|
+
type: "Property",
|
|
82330
|
+
key: { type: "Identifier", name: "resolve" },
|
|
82331
|
+
value: resolveValue,
|
|
82332
|
+
kind: "init"
|
|
82333
|
+
});
|
|
82334
|
+
} else {
|
|
82335
|
+
if (resolveProperty.value.type !== "ObjectExpression") {
|
|
82336
|
+
throw new Error(
|
|
82337
|
+
"Failed to patch vite config: Couldn't update `resolve` field - not an object"
|
|
82338
|
+
);
|
|
82339
|
+
}
|
|
82340
|
+
const aliasProperty = resolveProperty.value.properties.find(
|
|
82341
|
+
(x3) => x3.type === "Property" && x3.key.type === "Identifier" && x3.key.name === "alias"
|
|
82342
|
+
);
|
|
82343
|
+
if (!aliasProperty) {
|
|
82344
|
+
resolveProperty.value.properties.push({
|
|
82345
|
+
type: "Property",
|
|
82346
|
+
key: { type: "Identifier", name: "alias" },
|
|
82347
|
+
value: aliasValue,
|
|
82348
|
+
kind: "init"
|
|
82349
|
+
});
|
|
82350
|
+
} else {
|
|
82351
|
+
if (aliasProperty.value.type !== "ObjectExpression") {
|
|
82352
|
+
throw new Error(
|
|
82353
|
+
"Failed to patch vite config: Couldn't update `alias` field - not an object"
|
|
82354
|
+
);
|
|
82355
|
+
}
|
|
82356
|
+
const houdiniAlias = aliasProperty.value.properties.find(
|
|
82357
|
+
(x3) => x3.type === "Property" && x3.key.type === "Identifier" && x3.key.name === "$houdini"
|
|
82358
|
+
);
|
|
82359
|
+
if (!houdiniAlias) {
|
|
82360
|
+
aliasProperty.value.properties.push(houdiniAliasProperty);
|
|
82361
|
+
} else {
|
|
82362
|
+
houdiniAlias.value = houdiniAliasProperty.value;
|
|
82363
|
+
}
|
|
82364
|
+
}
|
|
82365
|
+
}
|
|
82366
|
+
return false;
|
|
82367
|
+
}
|
|
82368
|
+
});
|
|
82283
82369
|
}
|
|
82284
|
-
|
|
82370
|
+
contents = recast14.print(ast).code;
|
|
82371
|
+
await fs_exports.writeFile(viteConfigPath, recast14.print(ast).code);
|
|
82285
82372
|
}
|
|
82286
82373
|
async function tjsConfig(targetPath, frameworkInfo) {
|
|
82287
82374
|
let configFile = path_exports.join(targetPath, "tsconfig.json");
|
|
@@ -82326,12 +82413,12 @@ async function packageJSON(targetPath, frameworkInfo) {
|
|
|
82326
82413
|
}
|
|
82327
82414
|
packageJSON2.devDependencies = {
|
|
82328
82415
|
...packageJSON2.devDependencies,
|
|
82329
|
-
houdini: "^1.
|
|
82416
|
+
houdini: "^1.5.1"
|
|
82330
82417
|
};
|
|
82331
82418
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
82332
82419
|
packageJSON2.devDependencies = {
|
|
82333
82420
|
...packageJSON2.devDependencies,
|
|
82334
|
-
"houdini-svelte": "^2.1.
|
|
82421
|
+
"houdini-svelte": "^2.1.5"
|
|
82335
82422
|
};
|
|
82336
82423
|
} else {
|
|
82337
82424
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|