houdini 1.2.0-react.1 → 1.2.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/README.md +1 -1
- package/build/cmd-cjs/index.js +2285 -1577
- package/build/cmd-esm/index.js +2285 -1577
- package/build/codegen/generators/artifacts/selection.d.ts +2 -1
- package/build/codegen/generators/typescript/inlineType.d.ts +5 -2
- package/build/codegen/generators/typescript/loadingState.d.ts +8 -0
- package/build/codegen/transforms/fragmentVariables.d.ts +0 -11
- package/build/codegen/utils/flattenSelections.d.ts +2 -1
- package/build/codegen-cjs/index.js +2215 -1531
- package/build/codegen-esm/index.js +2215 -1531
- package/build/lib/config.d.ts +5 -0
- package/build/lib/graphql.d.ts +5 -1
- package/build/lib/parse.d.ts +10 -1
- package/build/lib-cjs/index.js +702 -578
- package/build/lib-esm/index.js +699 -578
- package/build/runtime/cache/cache.d.ts +9 -8
- package/build/runtime/cache/stuff.d.ts +1 -4
- package/build/runtime/client/documentStore.d.ts +3 -3
- package/build/runtime/client/index.d.ts +8 -7
- package/build/runtime/client/plugins/cache.d.ts +1 -1
- package/build/runtime/client/plugins/fetch.d.ts +1 -0
- package/build/runtime/client/plugins/subscription.d.ts +1 -0
- package/build/runtime/client/plugins/throwOnError.d.ts +2 -1
- package/build/runtime/lib/pagination.d.ts +4 -6
- package/build/runtime/lib/selection.d.ts +1 -1
- package/build/runtime/lib/types.d.ts +37 -4
- package/build/runtime-cjs/cache/cache.d.ts +9 -8
- package/build/runtime-cjs/cache/cache.js +108 -43
- package/build/runtime-cjs/cache/stuff.d.ts +1 -4
- package/build/runtime-cjs/cache/stuff.js +2 -2
- package/build/runtime-cjs/cache/subscription.js +5 -5
- package/build/runtime-cjs/client/documentStore.d.ts +3 -3
- package/build/runtime-cjs/client/documentStore.js +10 -2
- package/build/runtime-cjs/client/index.d.ts +8 -7
- package/build/runtime-cjs/client/index.js +12 -4
- package/build/runtime-cjs/client/plugins/cache.d.ts +1 -1
- package/build/runtime-cjs/client/plugins/cache.js +10 -2
- package/build/runtime-cjs/client/plugins/fetch.d.ts +1 -0
- package/build/runtime-cjs/client/plugins/fetch.js +3 -2
- package/build/runtime-cjs/client/plugins/subscription.d.ts +1 -0
- package/build/runtime-cjs/client/plugins/subscription.js +1 -0
- package/build/runtime-cjs/client/plugins/throwOnError.d.ts +2 -1
- package/build/runtime-cjs/lib/config.js +2 -1
- package/build/runtime-cjs/lib/pagination.d.ts +4 -6
- package/build/runtime-cjs/lib/pagination.js +0 -12
- package/build/runtime-cjs/lib/scalars.js +1 -1
- package/build/runtime-cjs/lib/selection.d.ts +1 -1
- package/build/runtime-cjs/lib/selection.js +28 -1
- package/build/runtime-cjs/lib/types.d.ts +37 -4
- package/build/runtime-cjs/lib/types.js +3 -0
- package/build/runtime-esm/cache/cache.d.ts +9 -8
- package/build/runtime-esm/cache/cache.js +109 -44
- package/build/runtime-esm/cache/stuff.d.ts +1 -4
- package/build/runtime-esm/cache/stuff.js +2 -2
- package/build/runtime-esm/cache/subscription.js +5 -5
- package/build/runtime-esm/client/documentStore.d.ts +3 -3
- package/build/runtime-esm/client/documentStore.js +10 -2
- package/build/runtime-esm/client/index.d.ts +8 -7
- package/build/runtime-esm/client/index.js +15 -7
- package/build/runtime-esm/client/plugins/cache.d.ts +1 -1
- package/build/runtime-esm/client/plugins/cache.js +10 -2
- package/build/runtime-esm/client/plugins/fetch.d.ts +1 -0
- package/build/runtime-esm/client/plugins/fetch.js +3 -2
- package/build/runtime-esm/client/plugins/subscription.d.ts +1 -0
- package/build/runtime-esm/client/plugins/subscription.js +1 -0
- package/build/runtime-esm/client/plugins/throwOnError.d.ts +2 -1
- package/build/runtime-esm/lib/config.js +2 -1
- package/build/runtime-esm/lib/pagination.d.ts +4 -6
- package/build/runtime-esm/lib/pagination.js +0 -12
- package/build/runtime-esm/lib/scalars.js +1 -1
- package/build/runtime-esm/lib/selection.d.ts +1 -1
- package/build/runtime-esm/lib/selection.js +28 -1
- package/build/runtime-esm/lib/types.d.ts +37 -4
- package/build/runtime-esm/lib/types.js +2 -0
- package/build/test/index.d.ts +15 -0
- package/build/test-cjs/index.js +2248 -1534
- package/build/test-esm/index.js +2248 -1534
- package/build/vite-cjs/index.js +2315 -1605
- package/build/vite-esm/index.js +2315 -1605
- package/package.json +7 -1
package/build/lib-cjs/index.js
CHANGED
|
@@ -3069,10 +3069,10 @@ var require_printer = __commonJS({
|
|
|
3069
3069
|
Object.defineProperty(exports, "__esModule", {
|
|
3070
3070
|
value: true
|
|
3071
3071
|
});
|
|
3072
|
-
exports.print =
|
|
3072
|
+
exports.print = print5;
|
|
3073
3073
|
var _visitor = require_visitor();
|
|
3074
3074
|
var _blockString = require_blockString();
|
|
3075
|
-
function
|
|
3075
|
+
function print5(ast) {
|
|
3076
3076
|
return (0, _visitor.visit)(ast, {
|
|
3077
3077
|
leave: printDocASTReducer2
|
|
3078
3078
|
});
|
|
@@ -42019,109 +42019,6 @@ var require_lib3 = __commonJS({
|
|
|
42019
42019
|
}
|
|
42020
42020
|
});
|
|
42021
42021
|
|
|
42022
|
-
// ../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js
|
|
42023
|
-
var require_cjs = __commonJS({
|
|
42024
|
-
"../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js"(exports, module2) {
|
|
42025
|
-
"use strict";
|
|
42026
|
-
var isMergeableObject = function isMergeableObject2(value) {
|
|
42027
|
-
return isNonNullObject(value) && !isSpecial(value);
|
|
42028
|
-
};
|
|
42029
|
-
function isNonNullObject(value) {
|
|
42030
|
-
return !!value && typeof value === "object";
|
|
42031
|
-
}
|
|
42032
|
-
function isSpecial(value) {
|
|
42033
|
-
var stringValue = Object.prototype.toString.call(value);
|
|
42034
|
-
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
|
|
42035
|
-
}
|
|
42036
|
-
var canUseSymbol = typeof Symbol === "function" && Symbol.for;
|
|
42037
|
-
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
|
|
42038
|
-
function isReactElement(value) {
|
|
42039
|
-
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
42040
|
-
}
|
|
42041
|
-
function emptyTarget(val) {
|
|
42042
|
-
return Array.isArray(val) ? [] : {};
|
|
42043
|
-
}
|
|
42044
|
-
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
42045
|
-
return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
|
|
42046
|
-
}
|
|
42047
|
-
function defaultArrayMerge(target, source, options) {
|
|
42048
|
-
return target.concat(source).map(function(element) {
|
|
42049
|
-
return cloneUnlessOtherwiseSpecified(element, options);
|
|
42050
|
-
});
|
|
42051
|
-
}
|
|
42052
|
-
function getMergeFunction(key, options) {
|
|
42053
|
-
if (!options.customMerge) {
|
|
42054
|
-
return deepmerge;
|
|
42055
|
-
}
|
|
42056
|
-
var customMerge = options.customMerge(key);
|
|
42057
|
-
return typeof customMerge === "function" ? customMerge : deepmerge;
|
|
42058
|
-
}
|
|
42059
|
-
function getEnumerableOwnPropertySymbols(target) {
|
|
42060
|
-
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
42061
|
-
return target.propertyIsEnumerable(symbol);
|
|
42062
|
-
}) : [];
|
|
42063
|
-
}
|
|
42064
|
-
function getKeys(target) {
|
|
42065
|
-
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
|
42066
|
-
}
|
|
42067
|
-
function propertyIsOnObject(object, property) {
|
|
42068
|
-
try {
|
|
42069
|
-
return property in object;
|
|
42070
|
-
} catch (_) {
|
|
42071
|
-
return false;
|
|
42072
|
-
}
|
|
42073
|
-
}
|
|
42074
|
-
function propertyIsUnsafe(target, key) {
|
|
42075
|
-
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
|
|
42076
|
-
}
|
|
42077
|
-
function mergeObject(target, source, options) {
|
|
42078
|
-
var destination = {};
|
|
42079
|
-
if (options.isMergeableObject(target)) {
|
|
42080
|
-
getKeys(target).forEach(function(key) {
|
|
42081
|
-
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
42082
|
-
});
|
|
42083
|
-
}
|
|
42084
|
-
getKeys(source).forEach(function(key) {
|
|
42085
|
-
if (propertyIsUnsafe(target, key)) {
|
|
42086
|
-
return;
|
|
42087
|
-
}
|
|
42088
|
-
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
42089
|
-
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
42090
|
-
} else {
|
|
42091
|
-
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
42092
|
-
}
|
|
42093
|
-
});
|
|
42094
|
-
return destination;
|
|
42095
|
-
}
|
|
42096
|
-
function deepmerge(target, source, options) {
|
|
42097
|
-
options = options || {};
|
|
42098
|
-
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
42099
|
-
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
42100
|
-
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
42101
|
-
var sourceIsArray = Array.isArray(source);
|
|
42102
|
-
var targetIsArray = Array.isArray(target);
|
|
42103
|
-
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
42104
|
-
if (!sourceAndTargetTypesMatch) {
|
|
42105
|
-
return cloneUnlessOtherwiseSpecified(source, options);
|
|
42106
|
-
} else if (sourceIsArray) {
|
|
42107
|
-
return options.arrayMerge(target, source, options);
|
|
42108
|
-
} else {
|
|
42109
|
-
return mergeObject(target, source, options);
|
|
42110
|
-
}
|
|
42111
|
-
}
|
|
42112
|
-
deepmerge.all = function deepmergeAll(array, options) {
|
|
42113
|
-
if (!Array.isArray(array)) {
|
|
42114
|
-
throw new Error("first argument should be an array");
|
|
42115
|
-
}
|
|
42116
|
-
return array.reduce(function(prev, next) {
|
|
42117
|
-
return deepmerge(prev, next, options);
|
|
42118
|
-
}, {});
|
|
42119
|
-
};
|
|
42120
|
-
var deepmerge_1 = deepmerge;
|
|
42121
|
-
module2.exports = deepmerge_1;
|
|
42122
|
-
}
|
|
42123
|
-
});
|
|
42124
|
-
|
|
42125
42022
|
// ../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js
|
|
42126
42023
|
var require_tslib = __commonJS({
|
|
42127
42024
|
"../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js"(exports, module2) {
|
|
@@ -55241,12 +55138,12 @@ var require_comments = __commonJS({
|
|
|
55241
55138
|
comment.trailing = true;
|
|
55242
55139
|
addCommentHelper(node, comment);
|
|
55243
55140
|
}
|
|
55244
|
-
function printLeadingComment(commentPath,
|
|
55141
|
+
function printLeadingComment(commentPath, print5) {
|
|
55245
55142
|
var comment = commentPath.getValue();
|
|
55246
55143
|
n.Comment.assert(comment);
|
|
55247
55144
|
var loc = comment.loc;
|
|
55248
55145
|
var lines = loc && loc.lines;
|
|
55249
|
-
var parts = [
|
|
55146
|
+
var parts = [print5(commentPath)];
|
|
55250
55147
|
if (comment.trailing) {
|
|
55251
55148
|
parts.push("\n");
|
|
55252
55149
|
} else if (lines instanceof lines_1.Lines) {
|
|
@@ -55261,7 +55158,7 @@ var require_comments = __commonJS({
|
|
|
55261
55158
|
}
|
|
55262
55159
|
return (0, lines_1.concat)(parts);
|
|
55263
55160
|
}
|
|
55264
|
-
function printTrailingComment(commentPath,
|
|
55161
|
+
function printTrailingComment(commentPath, print5) {
|
|
55265
55162
|
var comment = commentPath.getValue(commentPath);
|
|
55266
55163
|
n.Comment.assert(comment);
|
|
55267
55164
|
var loc = comment.loc;
|
|
@@ -55276,12 +55173,12 @@ var require_comments = __commonJS({
|
|
|
55276
55173
|
parts.push(new Array(leadingSpace.length).join("\n"));
|
|
55277
55174
|
}
|
|
55278
55175
|
}
|
|
55279
|
-
parts.push(
|
|
55176
|
+
parts.push(print5(commentPath));
|
|
55280
55177
|
return (0, lines_1.concat)(parts);
|
|
55281
55178
|
}
|
|
55282
|
-
function printComments(path2,
|
|
55179
|
+
function printComments(path2, print5) {
|
|
55283
55180
|
var value = path2.getValue();
|
|
55284
|
-
var innerLines =
|
|
55181
|
+
var innerLines = print5(path2);
|
|
55285
55182
|
var comments = n.Node.check(value) && types4.getFieldValue(value, "comments");
|
|
55286
55183
|
if (!comments || comments.length === 0) {
|
|
55287
55184
|
return innerLines;
|
|
@@ -55293,9 +55190,9 @@ var require_comments = __commonJS({
|
|
|
55293
55190
|
var leading = types4.getFieldValue(comment, "leading");
|
|
55294
55191
|
var trailing = types4.getFieldValue(comment, "trailing");
|
|
55295
55192
|
if (leading || trailing && !(n.Statement.check(value) || comment.type === "Block" || comment.type === "CommentBlock")) {
|
|
55296
|
-
leadingParts.push(printLeadingComment(commentPath,
|
|
55193
|
+
leadingParts.push(printLeadingComment(commentPath, print5));
|
|
55297
55194
|
} else if (trailing) {
|
|
55298
|
-
trailingParts.push(printTrailingComment(commentPath,
|
|
55195
|
+
trailingParts.push(printTrailingComment(commentPath, print5));
|
|
55299
55196
|
}
|
|
55300
55197
|
}, "comments");
|
|
55301
55198
|
leadingParts.push.apply(leadingParts, trailingParts);
|
|
@@ -55986,7 +55883,7 @@ var require_patcher = __commonJS({
|
|
|
55986
55883
|
};
|
|
55987
55884
|
exports.Patcher = Patcher;
|
|
55988
55885
|
var Pp = Patcher.prototype;
|
|
55989
|
-
Pp.tryToReprintComments = function(newNode, oldNode,
|
|
55886
|
+
Pp.tryToReprintComments = function(newNode, oldNode, print5) {
|
|
55990
55887
|
var patcher = this;
|
|
55991
55888
|
if (!newNode.comments && !oldNode.comments) {
|
|
55992
55889
|
return true;
|
|
@@ -56003,7 +55900,7 @@ var require_patcher = __commonJS({
|
|
|
56003
55900
|
assert_1.default.ok(oldComment.leading || oldComment.trailing);
|
|
56004
55901
|
patcher.replace(
|
|
56005
55902
|
oldComment.loc,
|
|
56006
|
-
|
|
55903
|
+
print5(reprint.newPath).indentTail(oldComment.loc.indent)
|
|
56007
55904
|
);
|
|
56008
55905
|
});
|
|
56009
55906
|
}
|
|
@@ -56050,17 +55947,17 @@ var require_patcher = __commonJS({
|
|
|
56050
55947
|
var reprints = [];
|
|
56051
55948
|
if (!lines || !findReprints(path2, reprints))
|
|
56052
55949
|
return;
|
|
56053
|
-
return function(
|
|
55950
|
+
return function(print5) {
|
|
56054
55951
|
var patcher = new Patcher(lines);
|
|
56055
55952
|
reprints.forEach(function(reprint) {
|
|
56056
55953
|
var newNode = reprint.newPath.getValue();
|
|
56057
55954
|
var oldNode = reprint.oldPath.getValue();
|
|
56058
55955
|
SourceLocation.assert(oldNode.loc, true);
|
|
56059
|
-
var needToPrintNewPathWithComments = !patcher.tryToReprintComments(newNode, oldNode,
|
|
55956
|
+
var needToPrintNewPathWithComments = !patcher.tryToReprintComments(newNode, oldNode, print5);
|
|
56060
55957
|
if (needToPrintNewPathWithComments) {
|
|
56061
55958
|
patcher.deleteComments(oldNode);
|
|
56062
55959
|
}
|
|
56063
|
-
var newLines =
|
|
55960
|
+
var newLines = print5(reprint.newPath, {
|
|
56064
55961
|
includeComments: needToPrintNewPathWithComments,
|
|
56065
55962
|
avoidRootParens: oldNode.type === newNode.type && reprint.oldPath.hasParens()
|
|
56066
55963
|
}).indentTail(oldNode.loc.indent);
|
|
@@ -56277,10 +56174,10 @@ var require_printer2 = __commonJS({
|
|
|
56277
56174
|
function makePrintFunctionWith(options, overrides) {
|
|
56278
56175
|
options = Object.assign({}, options, overrides);
|
|
56279
56176
|
return function(path2) {
|
|
56280
|
-
return
|
|
56177
|
+
return print5(path2, options);
|
|
56281
56178
|
};
|
|
56282
56179
|
}
|
|
56283
|
-
function
|
|
56180
|
+
function print5(path2, options) {
|
|
56284
56181
|
assert_1.default.ok(path2 instanceof fast_path_1.default);
|
|
56285
56182
|
options = options || {};
|
|
56286
56183
|
if (options.includeComments) {
|
|
@@ -56296,7 +56193,7 @@ var require_printer2 = __commonJS({
|
|
|
56296
56193
|
}
|
|
56297
56194
|
}
|
|
56298
56195
|
var reprinter = (0, patcher_1.getReprinter)(path2);
|
|
56299
|
-
var lines = reprinter ? reprinter(
|
|
56196
|
+
var lines = reprinter ? reprinter(print5) : genericPrint(path2, config, options, makePrintFunctionWith(options, {
|
|
56300
56197
|
includeComments: true,
|
|
56301
56198
|
avoidRootParens: false
|
|
56302
56199
|
}));
|
|
@@ -56307,7 +56204,7 @@ var require_printer2 = __commonJS({
|
|
|
56307
56204
|
if (!ast) {
|
|
56308
56205
|
return emptyPrintResult;
|
|
56309
56206
|
}
|
|
56310
|
-
var lines =
|
|
56207
|
+
var lines = print5(fast_path_1.default.from(ast), {
|
|
56311
56208
|
includeComments: true,
|
|
56312
56209
|
avoidRootParens: false
|
|
56313
56210
|
});
|
|
@@ -56360,7 +56257,7 @@ var require_printer2 = __commonJS({
|
|
|
56360
56257
|
}
|
|
56361
56258
|
return (0, lines_1.concat)(parts);
|
|
56362
56259
|
}
|
|
56363
|
-
function genericPrintNoParens(path2, options,
|
|
56260
|
+
function genericPrintNoParens(path2, options, print5) {
|
|
56364
56261
|
var n = path2.getValue();
|
|
56365
56262
|
if (!n) {
|
|
56366
56263
|
return (0, lines_1.fromString)("");
|
|
@@ -56372,45 +56269,45 @@ var require_printer2 = __commonJS({
|
|
|
56372
56269
|
var parts = [];
|
|
56373
56270
|
switch (n.type) {
|
|
56374
56271
|
case "File":
|
|
56375
|
-
return path2.call(
|
|
56272
|
+
return path2.call(print5, "program");
|
|
56376
56273
|
case "Program":
|
|
56377
56274
|
if (n.directives) {
|
|
56378
56275
|
path2.each(function(childPath) {
|
|
56379
|
-
parts.push(
|
|
56276
|
+
parts.push(print5(childPath), ";\n");
|
|
56380
56277
|
}, "directives");
|
|
56381
56278
|
}
|
|
56382
56279
|
if (n.interpreter) {
|
|
56383
|
-
parts.push(path2.call(
|
|
56280
|
+
parts.push(path2.call(print5, "interpreter"));
|
|
56384
56281
|
}
|
|
56385
56282
|
parts.push(path2.call(function(bodyPath) {
|
|
56386
|
-
return printStatementSequence(bodyPath, options,
|
|
56283
|
+
return printStatementSequence(bodyPath, options, print5);
|
|
56387
56284
|
}, "body"));
|
|
56388
56285
|
return (0, lines_1.concat)(parts);
|
|
56389
56286
|
case "Noop":
|
|
56390
56287
|
case "EmptyStatement":
|
|
56391
56288
|
return (0, lines_1.fromString)("");
|
|
56392
56289
|
case "ExpressionStatement":
|
|
56393
|
-
return (0, lines_1.concat)([path2.call(
|
|
56290
|
+
return (0, lines_1.concat)([path2.call(print5, "expression"), ";"]);
|
|
56394
56291
|
case "ParenthesizedExpression":
|
|
56395
|
-
return (0, lines_1.concat)(["(", path2.call(
|
|
56292
|
+
return (0, lines_1.concat)(["(", path2.call(print5, "expression"), ")"]);
|
|
56396
56293
|
case "BinaryExpression":
|
|
56397
56294
|
case "LogicalExpression":
|
|
56398
56295
|
case "AssignmentExpression":
|
|
56399
56296
|
return (0, lines_1.fromString)(" ").join([
|
|
56400
|
-
path2.call(
|
|
56297
|
+
path2.call(print5, "left"),
|
|
56401
56298
|
n.operator,
|
|
56402
|
-
path2.call(
|
|
56299
|
+
path2.call(print5, "right")
|
|
56403
56300
|
]);
|
|
56404
56301
|
case "AssignmentPattern":
|
|
56405
56302
|
return (0, lines_1.concat)([
|
|
56406
|
-
path2.call(
|
|
56303
|
+
path2.call(print5, "left"),
|
|
56407
56304
|
" = ",
|
|
56408
|
-
path2.call(
|
|
56305
|
+
path2.call(print5, "right")
|
|
56409
56306
|
]);
|
|
56410
56307
|
case "MemberExpression":
|
|
56411
56308
|
case "OptionalMemberExpression": {
|
|
56412
|
-
parts.push(path2.call(
|
|
56413
|
-
var property = path2.call(
|
|
56309
|
+
parts.push(path2.call(print5, "object"));
|
|
56310
|
+
var property = path2.call(print5, "property");
|
|
56414
56311
|
var optional = types4.getFieldValue(n, "optional");
|
|
56415
56312
|
if (n.computed) {
|
|
56416
56313
|
parts.push(optional ? "?.[" : "[", property, "]");
|
|
@@ -56420,18 +56317,18 @@ var require_printer2 = __commonJS({
|
|
|
56420
56317
|
return (0, lines_1.concat)(parts);
|
|
56421
56318
|
}
|
|
56422
56319
|
case "ChainExpression":
|
|
56423
|
-
return path2.call(
|
|
56320
|
+
return path2.call(print5, "expression");
|
|
56424
56321
|
case "MetaProperty":
|
|
56425
56322
|
return (0, lines_1.concat)([
|
|
56426
|
-
path2.call(
|
|
56323
|
+
path2.call(print5, "meta"),
|
|
56427
56324
|
".",
|
|
56428
|
-
path2.call(
|
|
56325
|
+
path2.call(print5, "property")
|
|
56429
56326
|
]);
|
|
56430
56327
|
case "BindExpression":
|
|
56431
56328
|
if (n.object) {
|
|
56432
|
-
parts.push(path2.call(
|
|
56329
|
+
parts.push(path2.call(print5, "object"));
|
|
56433
56330
|
}
|
|
56434
|
-
parts.push("::", path2.call(
|
|
56331
|
+
parts.push("::", path2.call(print5, "callee"));
|
|
56435
56332
|
return (0, lines_1.concat)(parts);
|
|
56436
56333
|
case "Path":
|
|
56437
56334
|
return (0, lines_1.fromString)(".").join(n.body);
|
|
@@ -56439,7 +56336,7 @@ var require_printer2 = __commonJS({
|
|
|
56439
56336
|
return (0, lines_1.concat)([
|
|
56440
56337
|
(0, lines_1.fromString)(n.name, options),
|
|
56441
56338
|
n.optional ? "?" : "",
|
|
56442
|
-
path2.call(
|
|
56339
|
+
path2.call(print5, "typeAnnotation")
|
|
56443
56340
|
]);
|
|
56444
56341
|
case "SpreadElement":
|
|
56445
56342
|
case "SpreadElementPattern":
|
|
@@ -56450,8 +56347,8 @@ var require_printer2 = __commonJS({
|
|
|
56450
56347
|
case "RestElement":
|
|
56451
56348
|
return (0, lines_1.concat)([
|
|
56452
56349
|
"...",
|
|
56453
|
-
path2.call(
|
|
56454
|
-
path2.call(
|
|
56350
|
+
path2.call(print5, "argument"),
|
|
56351
|
+
path2.call(print5, "typeAnnotation")
|
|
56455
56352
|
]);
|
|
56456
56353
|
case "FunctionDeclaration":
|
|
56457
56354
|
case "FunctionExpression":
|
|
@@ -56466,15 +56363,15 @@ var require_printer2 = __commonJS({
|
|
|
56466
56363
|
if (n.generator)
|
|
56467
56364
|
parts.push("*");
|
|
56468
56365
|
if (n.id) {
|
|
56469
|
-
parts.push(" ", path2.call(
|
|
56366
|
+
parts.push(" ", path2.call(print5, "id"), path2.call(print5, "typeParameters"));
|
|
56470
56367
|
} else {
|
|
56471
56368
|
if (n.typeParameters) {
|
|
56472
|
-
parts.push(path2.call(
|
|
56369
|
+
parts.push(path2.call(print5, "typeParameters"));
|
|
56473
56370
|
}
|
|
56474
56371
|
}
|
|
56475
|
-
parts.push("(", printFunctionParams(path2, options,
|
|
56372
|
+
parts.push("(", printFunctionParams(path2, options, print5), ")", path2.call(print5, "returnType"));
|
|
56476
56373
|
if (n.body) {
|
|
56477
|
-
parts.push(" ", path2.call(
|
|
56374
|
+
parts.push(" ", path2.call(print5, "body"));
|
|
56478
56375
|
}
|
|
56479
56376
|
return (0, lines_1.concat)(parts);
|
|
56480
56377
|
case "ArrowFunctionExpression":
|
|
@@ -56482,44 +56379,44 @@ var require_printer2 = __commonJS({
|
|
|
56482
56379
|
parts.push("async ");
|
|
56483
56380
|
}
|
|
56484
56381
|
if (n.typeParameters) {
|
|
56485
|
-
parts.push(path2.call(
|
|
56382
|
+
parts.push(path2.call(print5, "typeParameters"));
|
|
56486
56383
|
}
|
|
56487
56384
|
if (!options.arrowParensAlways && n.params.length === 1 && !n.rest && n.params[0].type === "Identifier" && !n.params[0].typeAnnotation && !n.returnType) {
|
|
56488
|
-
parts.push(path2.call(
|
|
56385
|
+
parts.push(path2.call(print5, "params", 0));
|
|
56489
56386
|
} else {
|
|
56490
|
-
parts.push("(", printFunctionParams(path2, options,
|
|
56387
|
+
parts.push("(", printFunctionParams(path2, options, print5), ")", path2.call(print5, "returnType"));
|
|
56491
56388
|
}
|
|
56492
|
-
parts.push(" => ", path2.call(
|
|
56389
|
+
parts.push(" => ", path2.call(print5, "body"));
|
|
56493
56390
|
return (0, lines_1.concat)(parts);
|
|
56494
56391
|
case "MethodDefinition":
|
|
56495
|
-
return printMethod(path2, options,
|
|
56392
|
+
return printMethod(path2, options, print5);
|
|
56496
56393
|
case "YieldExpression":
|
|
56497
56394
|
parts.push("yield");
|
|
56498
56395
|
if (n.delegate)
|
|
56499
56396
|
parts.push("*");
|
|
56500
56397
|
if (n.argument)
|
|
56501
|
-
parts.push(" ", path2.call(
|
|
56398
|
+
parts.push(" ", path2.call(print5, "argument"));
|
|
56502
56399
|
return (0, lines_1.concat)(parts);
|
|
56503
56400
|
case "AwaitExpression":
|
|
56504
56401
|
parts.push("await");
|
|
56505
56402
|
if (n.all)
|
|
56506
56403
|
parts.push("*");
|
|
56507
56404
|
if (n.argument)
|
|
56508
|
-
parts.push(" ", path2.call(
|
|
56405
|
+
parts.push(" ", path2.call(print5, "argument"));
|
|
56509
56406
|
return (0, lines_1.concat)(parts);
|
|
56510
56407
|
case "ModuleExpression":
|
|
56511
56408
|
return (0, lines_1.concat)([
|
|
56512
56409
|
"module {\n",
|
|
56513
|
-
path2.call(
|
|
56410
|
+
path2.call(print5, "body").indent(options.tabWidth),
|
|
56514
56411
|
"\n}"
|
|
56515
56412
|
]);
|
|
56516
56413
|
case "ModuleDeclaration":
|
|
56517
|
-
parts.push("module", path2.call(
|
|
56414
|
+
parts.push("module", path2.call(print5, "id"));
|
|
56518
56415
|
if (n.source) {
|
|
56519
56416
|
assert_1.default.ok(!n.body);
|
|
56520
|
-
parts.push("from", path2.call(
|
|
56417
|
+
parts.push("from", path2.call(print5, "source"));
|
|
56521
56418
|
} else {
|
|
56522
|
-
parts.push(path2.call(
|
|
56419
|
+
parts.push(path2.call(print5, "body"));
|
|
56523
56420
|
}
|
|
56524
56421
|
return (0, lines_1.fromString)(" ").join(parts);
|
|
56525
56422
|
case "ImportSpecifier":
|
|
@@ -56527,27 +56424,27 @@ var require_printer2 = __commonJS({
|
|
|
56527
56424
|
parts.push(n.importKind + " ");
|
|
56528
56425
|
}
|
|
56529
56426
|
if (n.imported) {
|
|
56530
|
-
parts.push(path2.call(
|
|
56427
|
+
parts.push(path2.call(print5, "imported"));
|
|
56531
56428
|
if (n.local && n.local.name !== n.imported.name) {
|
|
56532
|
-
parts.push(" as ", path2.call(
|
|
56429
|
+
parts.push(" as ", path2.call(print5, "local"));
|
|
56533
56430
|
}
|
|
56534
56431
|
} else if (n.id) {
|
|
56535
|
-
parts.push(path2.call(
|
|
56432
|
+
parts.push(path2.call(print5, "id"));
|
|
56536
56433
|
if (n.name) {
|
|
56537
|
-
parts.push(" as ", path2.call(
|
|
56434
|
+
parts.push(" as ", path2.call(print5, "name"));
|
|
56538
56435
|
}
|
|
56539
56436
|
}
|
|
56540
56437
|
return (0, lines_1.concat)(parts);
|
|
56541
56438
|
case "ExportSpecifier":
|
|
56542
56439
|
if (n.local) {
|
|
56543
|
-
parts.push(path2.call(
|
|
56440
|
+
parts.push(path2.call(print5, "local"));
|
|
56544
56441
|
if (n.exported && n.exported.name !== n.local.name) {
|
|
56545
|
-
parts.push(" as ", path2.call(
|
|
56442
|
+
parts.push(" as ", path2.call(print5, "exported"));
|
|
56546
56443
|
}
|
|
56547
56444
|
} else if (n.id) {
|
|
56548
|
-
parts.push(path2.call(
|
|
56445
|
+
parts.push(path2.call(print5, "id"));
|
|
56549
56446
|
if (n.name) {
|
|
56550
|
-
parts.push(" as ", path2.call(
|
|
56447
|
+
parts.push(" as ", path2.call(print5, "name"));
|
|
56551
56448
|
}
|
|
56552
56449
|
}
|
|
56553
56450
|
return (0, lines_1.concat)(parts);
|
|
@@ -56556,40 +56453,40 @@ var require_printer2 = __commonJS({
|
|
|
56556
56453
|
case "ImportNamespaceSpecifier":
|
|
56557
56454
|
parts.push("* as ");
|
|
56558
56455
|
if (n.local) {
|
|
56559
|
-
parts.push(path2.call(
|
|
56456
|
+
parts.push(path2.call(print5, "local"));
|
|
56560
56457
|
} else if (n.id) {
|
|
56561
|
-
parts.push(path2.call(
|
|
56458
|
+
parts.push(path2.call(print5, "id"));
|
|
56562
56459
|
}
|
|
56563
56460
|
return (0, lines_1.concat)(parts);
|
|
56564
56461
|
case "ImportDefaultSpecifier":
|
|
56565
56462
|
if (n.local) {
|
|
56566
|
-
return path2.call(
|
|
56463
|
+
return path2.call(print5, "local");
|
|
56567
56464
|
}
|
|
56568
|
-
return path2.call(
|
|
56465
|
+
return path2.call(print5, "id");
|
|
56569
56466
|
case "TSExportAssignment":
|
|
56570
|
-
return (0, lines_1.concat)(["export = ", path2.call(
|
|
56467
|
+
return (0, lines_1.concat)(["export = ", path2.call(print5, "expression")]);
|
|
56571
56468
|
case "ExportDeclaration":
|
|
56572
56469
|
case "ExportDefaultDeclaration":
|
|
56573
56470
|
case "ExportNamedDeclaration":
|
|
56574
|
-
return printExportDeclaration(path2, options,
|
|
56471
|
+
return printExportDeclaration(path2, options, print5);
|
|
56575
56472
|
case "ExportAllDeclaration":
|
|
56576
56473
|
parts.push("export *");
|
|
56577
56474
|
if (n.exported) {
|
|
56578
|
-
parts.push(" as ", path2.call(
|
|
56475
|
+
parts.push(" as ", path2.call(print5, "exported"));
|
|
56579
56476
|
}
|
|
56580
|
-
parts.push(" from ", path2.call(
|
|
56477
|
+
parts.push(" from ", path2.call(print5, "source"), ";");
|
|
56581
56478
|
return (0, lines_1.concat)(parts);
|
|
56582
56479
|
case "TSNamespaceExportDeclaration":
|
|
56583
|
-
parts.push("export as namespace ", path2.call(
|
|
56480
|
+
parts.push("export as namespace ", path2.call(print5, "id"));
|
|
56584
56481
|
return maybeAddSemicolon((0, lines_1.concat)(parts));
|
|
56585
56482
|
case "ExportNamespaceSpecifier":
|
|
56586
|
-
return (0, lines_1.concat)(["* as ", path2.call(
|
|
56483
|
+
return (0, lines_1.concat)(["* as ", path2.call(print5, "exported")]);
|
|
56587
56484
|
case "ExportDefaultSpecifier":
|
|
56588
|
-
return path2.call(
|
|
56485
|
+
return path2.call(print5, "exported");
|
|
56589
56486
|
case "Import":
|
|
56590
56487
|
return (0, lines_1.fromString)("import", options);
|
|
56591
56488
|
case "ImportExpression":
|
|
56592
|
-
return (0, lines_1.concat)(["import(", path2.call(
|
|
56489
|
+
return (0, lines_1.concat)(["import(", path2.call(print5, "source"), ")"]);
|
|
56593
56490
|
case "ImportDeclaration": {
|
|
56594
56491
|
parts.push("import ");
|
|
56595
56492
|
if (n.importKind && n.importKind !== "value") {
|
|
@@ -56601,9 +56498,9 @@ var require_printer2 = __commonJS({
|
|
|
56601
56498
|
path2.each(function(specifierPath) {
|
|
56602
56499
|
var spec = specifierPath.getValue();
|
|
56603
56500
|
if (spec.type === "ImportSpecifier") {
|
|
56604
|
-
bracedSpecifiers_1.push(
|
|
56501
|
+
bracedSpecifiers_1.push(print5(specifierPath));
|
|
56605
56502
|
} else if (spec.type === "ImportDefaultSpecifier" || spec.type === "ImportNamespaceSpecifier") {
|
|
56606
|
-
unbracedSpecifiers_1.push(
|
|
56503
|
+
unbracedSpecifiers_1.push(print5(specifierPath));
|
|
56607
56504
|
}
|
|
56608
56505
|
}, "specifiers");
|
|
56609
56506
|
unbracedSpecifiers_1.forEach(function(lines2, i2) {
|
|
@@ -56633,16 +56530,16 @@ var require_printer2 = __commonJS({
|
|
|
56633
56530
|
}
|
|
56634
56531
|
parts.push(" from ");
|
|
56635
56532
|
}
|
|
56636
|
-
parts.push(path2.call(
|
|
56533
|
+
parts.push(path2.call(print5, "source"), maybePrintImportAssertions(path2, options, print5), ";");
|
|
56637
56534
|
return (0, lines_1.concat)(parts);
|
|
56638
56535
|
}
|
|
56639
56536
|
case "ImportAttribute":
|
|
56640
|
-
return (0, lines_1.concat)([path2.call(
|
|
56537
|
+
return (0, lines_1.concat)([path2.call(print5, "key"), ": ", path2.call(print5, "value")]);
|
|
56641
56538
|
case "StaticBlock":
|
|
56642
56539
|
parts.push("static ");
|
|
56643
56540
|
case "BlockStatement": {
|
|
56644
56541
|
var naked_1 = path2.call(function(bodyPath) {
|
|
56645
|
-
return printStatementSequence(bodyPath, options,
|
|
56542
|
+
return printStatementSequence(bodyPath, options, print5);
|
|
56646
56543
|
}, "body");
|
|
56647
56544
|
if (naked_1.isEmpty()) {
|
|
56648
56545
|
if (!n.directives || n.directives.length === 0) {
|
|
@@ -56653,7 +56550,7 @@ var require_printer2 = __commonJS({
|
|
|
56653
56550
|
parts.push("{\n");
|
|
56654
56551
|
if (n.directives) {
|
|
56655
56552
|
path2.each(function(childPath) {
|
|
56656
|
-
parts.push(maybeAddSemicolon(
|
|
56553
|
+
parts.push(maybeAddSemicolon(print5(childPath).indent(options.tabWidth)), n.directives.length > 1 || !naked_1.isEmpty() ? "\n" : "");
|
|
56657
56554
|
}, "directives");
|
|
56658
56555
|
}
|
|
56659
56556
|
parts.push(naked_1.indent(options.tabWidth));
|
|
@@ -56663,7 +56560,7 @@ var require_printer2 = __commonJS({
|
|
|
56663
56560
|
case "ReturnStatement": {
|
|
56664
56561
|
parts.push("return");
|
|
56665
56562
|
if (n.argument) {
|
|
56666
|
-
var argLines = path2.call(
|
|
56563
|
+
var argLines = path2.call(print5, "argument");
|
|
56667
56564
|
if (argLines.startsWithComment() || argLines.length > 1 && namedTypes.JSXElement && namedTypes.JSXElement.check(n.argument)) {
|
|
56668
56565
|
parts.push(" (\n", argLines.indent(options.tabWidth), "\n)");
|
|
56669
56566
|
} else {
|
|
@@ -56675,17 +56572,17 @@ var require_printer2 = __commonJS({
|
|
|
56675
56572
|
}
|
|
56676
56573
|
case "CallExpression":
|
|
56677
56574
|
case "OptionalCallExpression":
|
|
56678
|
-
parts.push(path2.call(
|
|
56575
|
+
parts.push(path2.call(print5, "callee"));
|
|
56679
56576
|
if (n.typeParameters) {
|
|
56680
|
-
parts.push(path2.call(
|
|
56577
|
+
parts.push(path2.call(print5, "typeParameters"));
|
|
56681
56578
|
}
|
|
56682
56579
|
if (n.typeArguments) {
|
|
56683
|
-
parts.push(path2.call(
|
|
56580
|
+
parts.push(path2.call(print5, "typeArguments"));
|
|
56684
56581
|
}
|
|
56685
56582
|
if (types4.getFieldValue(n, "optional")) {
|
|
56686
56583
|
parts.push("?.");
|
|
56687
56584
|
}
|
|
56688
|
-
parts.push(printArgumentsList(path2, options,
|
|
56585
|
+
parts.push(printArgumentsList(path2, options, print5));
|
|
56689
56586
|
return (0, lines_1.concat)(parts);
|
|
56690
56587
|
case "RecordExpression":
|
|
56691
56588
|
parts.push("#");
|
|
@@ -56715,7 +56612,7 @@ var require_printer2 = __commonJS({
|
|
|
56715
56612
|
var i_1 = 0;
|
|
56716
56613
|
fields.forEach(function(field) {
|
|
56717
56614
|
path2.each(function(childPath) {
|
|
56718
|
-
var lines2 =
|
|
56615
|
+
var lines2 = print5(childPath);
|
|
56719
56616
|
if (!oneLine_1) {
|
|
56720
56617
|
lines2 = lines2.indent(options.tabWidth);
|
|
56721
56618
|
}
|
|
@@ -56752,32 +56649,32 @@ var require_printer2 = __commonJS({
|
|
|
56752
56649
|
parts[parts.length - 1] = " " + rightBrace;
|
|
56753
56650
|
}
|
|
56754
56651
|
if (n.typeAnnotation) {
|
|
56755
|
-
parts.push(path2.call(
|
|
56652
|
+
parts.push(path2.call(print5, "typeAnnotation"));
|
|
56756
56653
|
}
|
|
56757
56654
|
return (0, lines_1.concat)(parts);
|
|
56758
56655
|
}
|
|
56759
56656
|
case "PropertyPattern":
|
|
56760
56657
|
return (0, lines_1.concat)([
|
|
56761
|
-
path2.call(
|
|
56658
|
+
path2.call(print5, "key"),
|
|
56762
56659
|
": ",
|
|
56763
|
-
path2.call(
|
|
56660
|
+
path2.call(print5, "pattern")
|
|
56764
56661
|
]);
|
|
56765
56662
|
case "ObjectProperty":
|
|
56766
56663
|
case "Property": {
|
|
56767
56664
|
if (n.method || n.kind === "get" || n.kind === "set") {
|
|
56768
|
-
return printMethod(path2, options,
|
|
56665
|
+
return printMethod(path2, options, print5);
|
|
56769
56666
|
}
|
|
56770
56667
|
if (n.shorthand && n.value.type === "AssignmentPattern") {
|
|
56771
|
-
return path2.call(
|
|
56668
|
+
return path2.call(print5, "value");
|
|
56772
56669
|
}
|
|
56773
|
-
var key = path2.call(
|
|
56670
|
+
var key = path2.call(print5, "key");
|
|
56774
56671
|
if (n.computed) {
|
|
56775
56672
|
parts.push("[", key, "]");
|
|
56776
56673
|
} else {
|
|
56777
56674
|
parts.push(key);
|
|
56778
56675
|
}
|
|
56779
56676
|
if (!n.shorthand || n.key.name !== n.value.name) {
|
|
56780
|
-
parts.push(": ", path2.call(
|
|
56677
|
+
parts.push(": ", path2.call(print5, "value"));
|
|
56781
56678
|
}
|
|
56782
56679
|
return (0, lines_1.concat)(parts);
|
|
56783
56680
|
}
|
|
@@ -56785,18 +56682,18 @@ var require_printer2 = __commonJS({
|
|
|
56785
56682
|
case "ObjectMethod":
|
|
56786
56683
|
case "ClassPrivateMethod":
|
|
56787
56684
|
case "TSDeclareMethod":
|
|
56788
|
-
return printMethod(path2, options,
|
|
56685
|
+
return printMethod(path2, options, print5);
|
|
56789
56686
|
case "PrivateName":
|
|
56790
|
-
return (0, lines_1.concat)(["#", path2.call(
|
|
56687
|
+
return (0, lines_1.concat)(["#", path2.call(print5, "id")]);
|
|
56791
56688
|
case "Decorator":
|
|
56792
|
-
return (0, lines_1.concat)(["@", path2.call(
|
|
56689
|
+
return (0, lines_1.concat)(["@", path2.call(print5, "expression")]);
|
|
56793
56690
|
case "TupleExpression":
|
|
56794
56691
|
parts.push("#");
|
|
56795
56692
|
case "ArrayExpression":
|
|
56796
56693
|
case "ArrayPattern": {
|
|
56797
56694
|
var elems = n.elements;
|
|
56798
56695
|
var len_2 = elems.length;
|
|
56799
|
-
var printed_1 = path2.map(
|
|
56696
|
+
var printed_1 = path2.map(print5, "elements");
|
|
56800
56697
|
var joined = (0, lines_1.fromString)(", ").join(printed_1);
|
|
56801
56698
|
var oneLine_2 = joined.getLineLength(1) <= options.wrapColumn;
|
|
56802
56699
|
if (oneLine_2) {
|
|
@@ -56834,12 +56731,12 @@ var require_printer2 = __commonJS({
|
|
|
56834
56731
|
parts.push("]");
|
|
56835
56732
|
}
|
|
56836
56733
|
if (n.typeAnnotation) {
|
|
56837
|
-
parts.push(path2.call(
|
|
56734
|
+
parts.push(path2.call(print5, "typeAnnotation"));
|
|
56838
56735
|
}
|
|
56839
56736
|
return (0, lines_1.concat)(parts);
|
|
56840
56737
|
}
|
|
56841
56738
|
case "SequenceExpression":
|
|
56842
|
-
return (0, lines_1.fromString)(", ").join(path2.map(
|
|
56739
|
+
return (0, lines_1.fromString)(", ").join(path2.map(print5, "expressions"));
|
|
56843
56740
|
case "ThisExpression":
|
|
56844
56741
|
return (0, lines_1.fromString)("this");
|
|
56845
56742
|
case "Super":
|
|
@@ -56860,7 +56757,7 @@ var require_printer2 = __commonJS({
|
|
|
56860
56757
|
case "Literal":
|
|
56861
56758
|
return (0, lines_1.fromString)(getPossibleRaw(n) || (typeof n.value === "string" ? nodeStr(n.value, options) : n.value), options);
|
|
56862
56759
|
case "Directive":
|
|
56863
|
-
return path2.call(
|
|
56760
|
+
return path2.call(print5, "value");
|
|
56864
56761
|
case "DirectiveLiteral":
|
|
56865
56762
|
return (0, lines_1.fromString)(getPossibleRaw(n) || nodeStr(n.value, options), options);
|
|
56866
56763
|
case "InterpreterDirective":
|
|
@@ -56874,32 +56771,32 @@ var require_printer2 = __commonJS({
|
|
|
56874
56771
|
parts.push(n.operator);
|
|
56875
56772
|
if (/[a-z]$/.test(n.operator))
|
|
56876
56773
|
parts.push(" ");
|
|
56877
|
-
parts.push(path2.call(
|
|
56774
|
+
parts.push(path2.call(print5, "argument"));
|
|
56878
56775
|
return (0, lines_1.concat)(parts);
|
|
56879
56776
|
case "UpdateExpression":
|
|
56880
|
-
parts.push(path2.call(
|
|
56777
|
+
parts.push(path2.call(print5, "argument"), n.operator);
|
|
56881
56778
|
if (n.prefix)
|
|
56882
56779
|
parts.reverse();
|
|
56883
56780
|
return (0, lines_1.concat)(parts);
|
|
56884
56781
|
case "ConditionalExpression":
|
|
56885
56782
|
return (0, lines_1.concat)([
|
|
56886
|
-
path2.call(
|
|
56783
|
+
path2.call(print5, "test"),
|
|
56887
56784
|
" ? ",
|
|
56888
|
-
path2.call(
|
|
56785
|
+
path2.call(print5, "consequent"),
|
|
56889
56786
|
" : ",
|
|
56890
|
-
path2.call(
|
|
56787
|
+
path2.call(print5, "alternate")
|
|
56891
56788
|
]);
|
|
56892
56789
|
case "NewExpression": {
|
|
56893
|
-
parts.push("new ", path2.call(
|
|
56790
|
+
parts.push("new ", path2.call(print5, "callee"));
|
|
56894
56791
|
if (n.typeParameters) {
|
|
56895
|
-
parts.push(path2.call(
|
|
56792
|
+
parts.push(path2.call(print5, "typeParameters"));
|
|
56896
56793
|
}
|
|
56897
56794
|
if (n.typeArguments) {
|
|
56898
|
-
parts.push(path2.call(
|
|
56795
|
+
parts.push(path2.call(print5, "typeArguments"));
|
|
56899
56796
|
}
|
|
56900
56797
|
var args = n.arguments;
|
|
56901
56798
|
if (args) {
|
|
56902
|
-
parts.push(printArgumentsList(path2, options,
|
|
56799
|
+
parts.push(printArgumentsList(path2, options, print5));
|
|
56903
56800
|
}
|
|
56904
56801
|
return (0, lines_1.concat)(parts);
|
|
56905
56802
|
}
|
|
@@ -56910,7 +56807,7 @@ var require_printer2 = __commonJS({
|
|
|
56910
56807
|
parts.push(n.kind, " ");
|
|
56911
56808
|
var maxLen_1 = 0;
|
|
56912
56809
|
var printed = path2.map(function(childPath) {
|
|
56913
|
-
var lines2 =
|
|
56810
|
+
var lines2 = print5(childPath);
|
|
56914
56811
|
maxLen_1 = Math.max(lines2.length, maxLen_1);
|
|
56915
56812
|
return lines2;
|
|
56916
56813
|
}, "declarations");
|
|
@@ -56929,30 +56826,30 @@ var require_printer2 = __commonJS({
|
|
|
56929
56826
|
}
|
|
56930
56827
|
case "VariableDeclarator":
|
|
56931
56828
|
return n.init ? (0, lines_1.fromString)(" = ").join([
|
|
56932
|
-
path2.call(
|
|
56933
|
-
path2.call(
|
|
56934
|
-
]) : path2.call(
|
|
56829
|
+
path2.call(print5, "id"),
|
|
56830
|
+
path2.call(print5, "init")
|
|
56831
|
+
]) : path2.call(print5, "id");
|
|
56935
56832
|
case "WithStatement":
|
|
56936
56833
|
return (0, lines_1.concat)([
|
|
56937
56834
|
"with (",
|
|
56938
|
-
path2.call(
|
|
56835
|
+
path2.call(print5, "object"),
|
|
56939
56836
|
") ",
|
|
56940
|
-
path2.call(
|
|
56837
|
+
path2.call(print5, "body")
|
|
56941
56838
|
]);
|
|
56942
56839
|
case "IfStatement": {
|
|
56943
|
-
var con = adjustClause(path2.call(
|
|
56944
|
-
parts.push("if (", path2.call(
|
|
56840
|
+
var con = adjustClause(path2.call(print5, "consequent"), options);
|
|
56841
|
+
parts.push("if (", path2.call(print5, "test"), ")", con);
|
|
56945
56842
|
if (n.alternate)
|
|
56946
|
-
parts.push(endsWithBrace(con) ? " else" : "\nelse", adjustClause(path2.call(
|
|
56843
|
+
parts.push(endsWithBrace(con) ? " else" : "\nelse", adjustClause(path2.call(print5, "alternate"), options));
|
|
56947
56844
|
return (0, lines_1.concat)(parts);
|
|
56948
56845
|
}
|
|
56949
56846
|
case "ForStatement": {
|
|
56950
|
-
var init = path2.call(
|
|
56847
|
+
var init = path2.call(print5, "init");
|
|
56951
56848
|
var sep2 = init.length > 1 ? ";\n" : "; ";
|
|
56952
56849
|
var forParen = "for (";
|
|
56953
|
-
var indented = (0, lines_1.fromString)(sep2).join([init, path2.call(
|
|
56850
|
+
var indented = (0, lines_1.fromString)(sep2).join([init, path2.call(print5, "test"), path2.call(print5, "update")]).indentTail(forParen.length);
|
|
56954
56851
|
var head = (0, lines_1.concat)([forParen, indented, ")"]);
|
|
56955
|
-
var clause = adjustClause(path2.call(
|
|
56852
|
+
var clause = adjustClause(path2.call(print5, "body"), options);
|
|
56956
56853
|
parts.push(head);
|
|
56957
56854
|
if (head.length > 1) {
|
|
56958
56855
|
parts.push("\n");
|
|
@@ -56964,18 +56861,18 @@ var require_printer2 = __commonJS({
|
|
|
56964
56861
|
case "WhileStatement":
|
|
56965
56862
|
return (0, lines_1.concat)([
|
|
56966
56863
|
"while (",
|
|
56967
|
-
path2.call(
|
|
56864
|
+
path2.call(print5, "test"),
|
|
56968
56865
|
")",
|
|
56969
|
-
adjustClause(path2.call(
|
|
56866
|
+
adjustClause(path2.call(print5, "body"), options)
|
|
56970
56867
|
]);
|
|
56971
56868
|
case "ForInStatement":
|
|
56972
56869
|
return (0, lines_1.concat)([
|
|
56973
56870
|
n.each ? "for each (" : "for (",
|
|
56974
|
-
path2.call(
|
|
56871
|
+
path2.call(print5, "left"),
|
|
56975
56872
|
" in ",
|
|
56976
|
-
path2.call(
|
|
56873
|
+
path2.call(print5, "right"),
|
|
56977
56874
|
")",
|
|
56978
|
-
adjustClause(path2.call(
|
|
56875
|
+
adjustClause(path2.call(print5, "body"), options)
|
|
56979
56876
|
]);
|
|
56980
56877
|
case "ForOfStatement":
|
|
56981
56878
|
case "ForAwaitStatement":
|
|
@@ -56983,122 +56880,122 @@ var require_printer2 = __commonJS({
|
|
|
56983
56880
|
if (n.await || n.type === "ForAwaitStatement") {
|
|
56984
56881
|
parts.push("await ");
|
|
56985
56882
|
}
|
|
56986
|
-
parts.push("(", path2.call(
|
|
56883
|
+
parts.push("(", path2.call(print5, "left"), " of ", path2.call(print5, "right"), ")", adjustClause(path2.call(print5, "body"), options));
|
|
56987
56884
|
return (0, lines_1.concat)(parts);
|
|
56988
56885
|
case "DoWhileStatement": {
|
|
56989
56886
|
var doBody = (0, lines_1.concat)([
|
|
56990
56887
|
"do",
|
|
56991
|
-
adjustClause(path2.call(
|
|
56888
|
+
adjustClause(path2.call(print5, "body"), options)
|
|
56992
56889
|
]);
|
|
56993
56890
|
parts.push(doBody);
|
|
56994
56891
|
if (endsWithBrace(doBody))
|
|
56995
56892
|
parts.push(" while");
|
|
56996
56893
|
else
|
|
56997
56894
|
parts.push("\nwhile");
|
|
56998
|
-
parts.push(" (", path2.call(
|
|
56895
|
+
parts.push(" (", path2.call(print5, "test"), ");");
|
|
56999
56896
|
return (0, lines_1.concat)(parts);
|
|
57000
56897
|
}
|
|
57001
56898
|
case "DoExpression": {
|
|
57002
56899
|
var statements = path2.call(function(bodyPath) {
|
|
57003
|
-
return printStatementSequence(bodyPath, options,
|
|
56900
|
+
return printStatementSequence(bodyPath, options, print5);
|
|
57004
56901
|
}, "body");
|
|
57005
56902
|
return (0, lines_1.concat)(["do {\n", statements.indent(options.tabWidth), "\n}"]);
|
|
57006
56903
|
}
|
|
57007
56904
|
case "BreakStatement":
|
|
57008
56905
|
parts.push("break");
|
|
57009
56906
|
if (n.label)
|
|
57010
|
-
parts.push(" ", path2.call(
|
|
56907
|
+
parts.push(" ", path2.call(print5, "label"));
|
|
57011
56908
|
parts.push(";");
|
|
57012
56909
|
return (0, lines_1.concat)(parts);
|
|
57013
56910
|
case "ContinueStatement":
|
|
57014
56911
|
parts.push("continue");
|
|
57015
56912
|
if (n.label)
|
|
57016
|
-
parts.push(" ", path2.call(
|
|
56913
|
+
parts.push(" ", path2.call(print5, "label"));
|
|
57017
56914
|
parts.push(";");
|
|
57018
56915
|
return (0, lines_1.concat)(parts);
|
|
57019
56916
|
case "LabeledStatement":
|
|
57020
56917
|
return (0, lines_1.concat)([
|
|
57021
|
-
path2.call(
|
|
56918
|
+
path2.call(print5, "label"),
|
|
57022
56919
|
":\n",
|
|
57023
|
-
path2.call(
|
|
56920
|
+
path2.call(print5, "body")
|
|
57024
56921
|
]);
|
|
57025
56922
|
case "TryStatement":
|
|
57026
|
-
parts.push("try ", path2.call(
|
|
56923
|
+
parts.push("try ", path2.call(print5, "block"));
|
|
57027
56924
|
if (n.handler) {
|
|
57028
|
-
parts.push(" ", path2.call(
|
|
56925
|
+
parts.push(" ", path2.call(print5, "handler"));
|
|
57029
56926
|
} else if (n.handlers) {
|
|
57030
56927
|
path2.each(function(handlerPath) {
|
|
57031
|
-
parts.push(" ",
|
|
56928
|
+
parts.push(" ", print5(handlerPath));
|
|
57032
56929
|
}, "handlers");
|
|
57033
56930
|
}
|
|
57034
56931
|
if (n.finalizer) {
|
|
57035
|
-
parts.push(" finally ", path2.call(
|
|
56932
|
+
parts.push(" finally ", path2.call(print5, "finalizer"));
|
|
57036
56933
|
}
|
|
57037
56934
|
return (0, lines_1.concat)(parts);
|
|
57038
56935
|
case "CatchClause":
|
|
57039
56936
|
parts.push("catch ");
|
|
57040
56937
|
if (n.param) {
|
|
57041
|
-
parts.push("(", path2.call(
|
|
56938
|
+
parts.push("(", path2.call(print5, "param"));
|
|
57042
56939
|
}
|
|
57043
56940
|
if (n.guard) {
|
|
57044
|
-
parts.push(" if ", path2.call(
|
|
56941
|
+
parts.push(" if ", path2.call(print5, "guard"));
|
|
57045
56942
|
}
|
|
57046
56943
|
if (n.param) {
|
|
57047
56944
|
parts.push(") ");
|
|
57048
56945
|
}
|
|
57049
|
-
parts.push(path2.call(
|
|
56946
|
+
parts.push(path2.call(print5, "body"));
|
|
57050
56947
|
return (0, lines_1.concat)(parts);
|
|
57051
56948
|
case "ThrowStatement":
|
|
57052
|
-
return (0, lines_1.concat)(["throw ", path2.call(
|
|
56949
|
+
return (0, lines_1.concat)(["throw ", path2.call(print5, "argument"), ";"]);
|
|
57053
56950
|
case "SwitchStatement":
|
|
57054
56951
|
return (0, lines_1.concat)([
|
|
57055
56952
|
"switch (",
|
|
57056
|
-
path2.call(
|
|
56953
|
+
path2.call(print5, "discriminant"),
|
|
57057
56954
|
") {\n",
|
|
57058
|
-
(0, lines_1.fromString)("\n").join(path2.map(
|
|
56955
|
+
(0, lines_1.fromString)("\n").join(path2.map(print5, "cases")),
|
|
57059
56956
|
"\n}"
|
|
57060
56957
|
]);
|
|
57061
56958
|
case "SwitchCase":
|
|
57062
56959
|
if (n.test)
|
|
57063
|
-
parts.push("case ", path2.call(
|
|
56960
|
+
parts.push("case ", path2.call(print5, "test"), ":");
|
|
57064
56961
|
else
|
|
57065
56962
|
parts.push("default:");
|
|
57066
56963
|
if (n.consequent.length > 0) {
|
|
57067
56964
|
parts.push("\n", path2.call(function(consequentPath) {
|
|
57068
|
-
return printStatementSequence(consequentPath, options,
|
|
56965
|
+
return printStatementSequence(consequentPath, options, print5);
|
|
57069
56966
|
}, "consequent").indent(options.tabWidth));
|
|
57070
56967
|
}
|
|
57071
56968
|
return (0, lines_1.concat)(parts);
|
|
57072
56969
|
case "DebuggerStatement":
|
|
57073
56970
|
return (0, lines_1.fromString)("debugger;");
|
|
57074
56971
|
case "JSXAttribute":
|
|
57075
|
-
parts.push(path2.call(
|
|
56972
|
+
parts.push(path2.call(print5, "name"));
|
|
57076
56973
|
if (n.value)
|
|
57077
|
-
parts.push("=", path2.call(
|
|
56974
|
+
parts.push("=", path2.call(print5, "value"));
|
|
57078
56975
|
return (0, lines_1.concat)(parts);
|
|
57079
56976
|
case "JSXIdentifier":
|
|
57080
56977
|
return (0, lines_1.fromString)(n.name, options);
|
|
57081
56978
|
case "JSXNamespacedName":
|
|
57082
56979
|
return (0, lines_1.fromString)(":").join([
|
|
57083
|
-
path2.call(
|
|
57084
|
-
path2.call(
|
|
56980
|
+
path2.call(print5, "namespace"),
|
|
56981
|
+
path2.call(print5, "name")
|
|
57085
56982
|
]);
|
|
57086
56983
|
case "JSXMemberExpression":
|
|
57087
56984
|
return (0, lines_1.fromString)(".").join([
|
|
57088
|
-
path2.call(
|
|
57089
|
-
path2.call(
|
|
56985
|
+
path2.call(print5, "object"),
|
|
56986
|
+
path2.call(print5, "property")
|
|
57090
56987
|
]);
|
|
57091
56988
|
case "JSXSpreadAttribute":
|
|
57092
|
-
return (0, lines_1.concat)(["{...", path2.call(
|
|
56989
|
+
return (0, lines_1.concat)(["{...", path2.call(print5, "argument"), "}"]);
|
|
57093
56990
|
case "JSXSpreadChild":
|
|
57094
|
-
return (0, lines_1.concat)(["{...", path2.call(
|
|
56991
|
+
return (0, lines_1.concat)(["{...", path2.call(print5, "expression"), "}"]);
|
|
57095
56992
|
case "JSXExpressionContainer":
|
|
57096
|
-
return (0, lines_1.concat)(["{", path2.call(
|
|
56993
|
+
return (0, lines_1.concat)(["{", path2.call(print5, "expression"), "}"]);
|
|
57097
56994
|
case "JSXElement":
|
|
57098
56995
|
case "JSXFragment": {
|
|
57099
56996
|
var openingPropName = "opening" + (n.type === "JSXElement" ? "Element" : "Fragment");
|
|
57100
56997
|
var closingPropName = "closing" + (n.type === "JSXElement" ? "Element" : "Fragment");
|
|
57101
|
-
var openingLines = path2.call(
|
|
56998
|
+
var openingLines = path2.call(print5, openingPropName);
|
|
57102
56999
|
if (n[openingPropName].selfClosing) {
|
|
57103
57000
|
assert_1.default.ok(!n[closingPropName], "unexpected " + closingPropName + " element in self-closing " + n.type);
|
|
57104
57001
|
return openingLines;
|
|
@@ -57112,16 +57009,16 @@ var require_printer2 = __commonJS({
|
|
|
57112
57009
|
return "\n";
|
|
57113
57010
|
}
|
|
57114
57011
|
}
|
|
57115
|
-
return
|
|
57012
|
+
return print5(childPath);
|
|
57116
57013
|
}, "children")).indentTail(options.tabWidth);
|
|
57117
|
-
var closingLines = path2.call(
|
|
57014
|
+
var closingLines = path2.call(print5, closingPropName);
|
|
57118
57015
|
return (0, lines_1.concat)([openingLines, childLines, closingLines]);
|
|
57119
57016
|
}
|
|
57120
57017
|
case "JSXOpeningElement": {
|
|
57121
|
-
parts.push("<", path2.call(
|
|
57018
|
+
parts.push("<", path2.call(print5, "name"));
|
|
57122
57019
|
var attrParts_1 = [];
|
|
57123
57020
|
path2.each(function(attrPath) {
|
|
57124
|
-
attrParts_1.push(" ",
|
|
57021
|
+
attrParts_1.push(" ", print5(attrPath));
|
|
57125
57022
|
}, "attributes");
|
|
57126
57023
|
var attrLines = (0, lines_1.concat)(attrParts_1);
|
|
57127
57024
|
var needLineWrap = attrLines.length > 1 || attrLines.getLineLength(1) > options.wrapColumn;
|
|
@@ -57138,7 +57035,7 @@ var require_printer2 = __commonJS({
|
|
|
57138
57035
|
return (0, lines_1.concat)(parts);
|
|
57139
57036
|
}
|
|
57140
57037
|
case "JSXClosingElement":
|
|
57141
|
-
return (0, lines_1.concat)(["</", path2.call(
|
|
57038
|
+
return (0, lines_1.concat)(["</", path2.call(print5, "name"), ">"]);
|
|
57142
57039
|
case "JSXOpeningFragment":
|
|
57143
57040
|
return (0, lines_1.fromString)("<>");
|
|
57144
57041
|
case "JSXClosingFragment":
|
|
@@ -57149,9 +57046,9 @@ var require_printer2 = __commonJS({
|
|
|
57149
57046
|
return (0, lines_1.fromString)("");
|
|
57150
57047
|
case "TypeAnnotatedIdentifier":
|
|
57151
57048
|
return (0, lines_1.concat)([
|
|
57152
|
-
path2.call(
|
|
57049
|
+
path2.call(print5, "annotation"),
|
|
57153
57050
|
" ",
|
|
57154
|
-
path2.call(
|
|
57051
|
+
path2.call(print5, "identifier")
|
|
57155
57052
|
]);
|
|
57156
57053
|
case "ClassBody":
|
|
57157
57054
|
if (n.body.length === 0) {
|
|
@@ -57160,12 +57057,12 @@ var require_printer2 = __commonJS({
|
|
|
57160
57057
|
return (0, lines_1.concat)([
|
|
57161
57058
|
"{\n",
|
|
57162
57059
|
path2.call(function(bodyPath) {
|
|
57163
|
-
return printStatementSequence(bodyPath, options,
|
|
57060
|
+
return printStatementSequence(bodyPath, options, print5);
|
|
57164
57061
|
}, "body").indent(options.tabWidth),
|
|
57165
57062
|
"\n}"
|
|
57166
57063
|
]);
|
|
57167
57064
|
case "ClassPropertyDefinition":
|
|
57168
|
-
parts.push("static ", path2.call(
|
|
57065
|
+
parts.push("static ", path2.call(print5, "definition"));
|
|
57169
57066
|
if (!namedTypes.MethodDefinition.check(n.definition))
|
|
57170
57067
|
parts.push(";");
|
|
57171
57068
|
return (0, lines_1.concat)(parts);
|
|
@@ -57186,12 +57083,12 @@ var require_printer2 = __commonJS({
|
|
|
57186
57083
|
if (n.readonly) {
|
|
57187
57084
|
parts.push("readonly ");
|
|
57188
57085
|
}
|
|
57189
|
-
var key = path2.call(
|
|
57086
|
+
var key = path2.call(print5, "key");
|
|
57190
57087
|
if (n.computed) {
|
|
57191
57088
|
key = (0, lines_1.concat)(["[", key, "]"]);
|
|
57192
57089
|
}
|
|
57193
57090
|
if (n.variance) {
|
|
57194
|
-
key = (0, lines_1.concat)([printVariance(path2,
|
|
57091
|
+
key = (0, lines_1.concat)([printVariance(path2, print5), key]);
|
|
57195
57092
|
}
|
|
57196
57093
|
parts.push(key);
|
|
57197
57094
|
if (n.optional) {
|
|
@@ -57201,10 +57098,10 @@ var require_printer2 = __commonJS({
|
|
|
57201
57098
|
parts.push("!");
|
|
57202
57099
|
}
|
|
57203
57100
|
if (n.typeAnnotation) {
|
|
57204
|
-
parts.push(path2.call(
|
|
57101
|
+
parts.push(path2.call(print5, "typeAnnotation"));
|
|
57205
57102
|
}
|
|
57206
57103
|
if (n.value) {
|
|
57207
|
-
parts.push(" = ", path2.call(
|
|
57104
|
+
parts.push(" = ", path2.call(print5, "value"));
|
|
57208
57105
|
}
|
|
57209
57106
|
parts.push(";");
|
|
57210
57107
|
return (0, lines_1.concat)(parts);
|
|
@@ -57213,21 +57110,21 @@ var require_printer2 = __commonJS({
|
|
|
57213
57110
|
if (n.static) {
|
|
57214
57111
|
parts.push("static ");
|
|
57215
57112
|
}
|
|
57216
|
-
parts.push(path2.call(
|
|
57113
|
+
parts.push(path2.call(print5, "key"));
|
|
57217
57114
|
if (n.typeAnnotation) {
|
|
57218
|
-
parts.push(path2.call(
|
|
57115
|
+
parts.push(path2.call(print5, "typeAnnotation"));
|
|
57219
57116
|
}
|
|
57220
57117
|
if (n.value) {
|
|
57221
|
-
parts.push(" = ", path2.call(
|
|
57118
|
+
parts.push(" = ", path2.call(print5, "value"));
|
|
57222
57119
|
}
|
|
57223
57120
|
parts.push(";");
|
|
57224
57121
|
return (0, lines_1.concat)(parts);
|
|
57225
57122
|
case "ClassAccessorProperty": {
|
|
57226
57123
|
parts.push.apply(parts, tslib_1.__spreadArray(tslib_1.__spreadArray([], printClassMemberModifiers(n), false), ["accessor "], false));
|
|
57227
57124
|
if (n.computed) {
|
|
57228
|
-
parts.push("[", path2.call(
|
|
57125
|
+
parts.push("[", path2.call(print5, "key"), "]");
|
|
57229
57126
|
} else {
|
|
57230
|
-
parts.push(path2.call(
|
|
57127
|
+
parts.push(path2.call(print5, "key"));
|
|
57231
57128
|
}
|
|
57232
57129
|
if (n.optional) {
|
|
57233
57130
|
parts.push("?");
|
|
@@ -57236,10 +57133,10 @@ var require_printer2 = __commonJS({
|
|
|
57236
57133
|
parts.push("!");
|
|
57237
57134
|
}
|
|
57238
57135
|
if (n.typeAnnotation) {
|
|
57239
|
-
parts.push(path2.call(
|
|
57136
|
+
parts.push(path2.call(print5, "typeAnnotation"));
|
|
57240
57137
|
}
|
|
57241
57138
|
if (n.value) {
|
|
57242
|
-
parts.push(" = ", path2.call(
|
|
57139
|
+
parts.push(" = ", path2.call(print5, "value"));
|
|
57243
57140
|
}
|
|
57244
57141
|
parts.push(";");
|
|
57245
57142
|
return (0, lines_1.concat)(parts);
|
|
@@ -57255,21 +57152,21 @@ var require_printer2 = __commonJS({
|
|
|
57255
57152
|
}
|
|
57256
57153
|
parts.push("class");
|
|
57257
57154
|
if (n.id) {
|
|
57258
|
-
parts.push(" ", path2.call(
|
|
57155
|
+
parts.push(" ", path2.call(print5, "id"));
|
|
57259
57156
|
}
|
|
57260
57157
|
if (n.typeParameters) {
|
|
57261
|
-
parts.push(path2.call(
|
|
57158
|
+
parts.push(path2.call(print5, "typeParameters"));
|
|
57262
57159
|
}
|
|
57263
57160
|
if (n.superClass) {
|
|
57264
|
-
parts.push(" extends ", path2.call(
|
|
57161
|
+
parts.push(" extends ", path2.call(print5, "superClass"), path2.call(print5, "superTypeParameters"));
|
|
57265
57162
|
}
|
|
57266
57163
|
if (n.extends && n.extends.length > 0) {
|
|
57267
|
-
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path2.map(
|
|
57164
|
+
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path2.map(print5, "extends")));
|
|
57268
57165
|
}
|
|
57269
57166
|
if (n["implements"] && n["implements"].length > 0) {
|
|
57270
|
-
parts.push(" implements ", (0, lines_1.fromString)(", ").join(path2.map(
|
|
57167
|
+
parts.push(" implements ", (0, lines_1.fromString)(", ").join(path2.map(print5, "implements")));
|
|
57271
57168
|
}
|
|
57272
|
-
parts.push(" ", path2.call(
|
|
57169
|
+
parts.push(" ", path2.call(print5, "body"));
|
|
57273
57170
|
if (n.type === "DeclareClass") {
|
|
57274
57171
|
return printFlowDeclaration(path2, parts);
|
|
57275
57172
|
} else {
|
|
@@ -57278,11 +57175,11 @@ var require_printer2 = __commonJS({
|
|
|
57278
57175
|
case "TemplateElement":
|
|
57279
57176
|
return (0, lines_1.fromString)(n.value.raw, options).lockIndentTail();
|
|
57280
57177
|
case "TemplateLiteral": {
|
|
57281
|
-
var expressions_1 = path2.map(
|
|
57178
|
+
var expressions_1 = path2.map(print5, "expressions");
|
|
57282
57179
|
parts.push("`");
|
|
57283
57180
|
path2.each(function(childPath) {
|
|
57284
57181
|
var i2 = childPath.getName();
|
|
57285
|
-
parts.push(
|
|
57182
|
+
parts.push(print5(childPath));
|
|
57286
57183
|
if (i2 < expressions_1.length) {
|
|
57287
57184
|
parts.push("${", expressions_1[i2], "}");
|
|
57288
57185
|
}
|
|
@@ -57291,7 +57188,7 @@ var require_printer2 = __commonJS({
|
|
|
57291
57188
|
return (0, lines_1.concat)(parts).lockIndentTail();
|
|
57292
57189
|
}
|
|
57293
57190
|
case "TaggedTemplateExpression":
|
|
57294
|
-
return (0, lines_1.concat)([path2.call(
|
|
57191
|
+
return (0, lines_1.concat)([path2.call(print5, "tag"), path2.call(print5, "quasi")]);
|
|
57295
57192
|
case "Node":
|
|
57296
57193
|
case "Printable":
|
|
57297
57194
|
case "SourceLocation":
|
|
@@ -57325,7 +57222,7 @@ var require_printer2 = __commonJS({
|
|
|
57325
57222
|
if (n.typeAnnotation.type !== "FunctionTypeAnnotation") {
|
|
57326
57223
|
parts.push(": ");
|
|
57327
57224
|
}
|
|
57328
|
-
parts.push(path2.call(
|
|
57225
|
+
parts.push(path2.call(print5, "typeAnnotation"));
|
|
57329
57226
|
return (0, lines_1.concat)(parts);
|
|
57330
57227
|
}
|
|
57331
57228
|
return (0, lines_1.fromString)("");
|
|
@@ -57339,9 +57236,9 @@ var require_printer2 = __commonJS({
|
|
|
57339
57236
|
case "MixedTypeAnnotation":
|
|
57340
57237
|
return (0, lines_1.fromString)("mixed", options);
|
|
57341
57238
|
case "ArrayTypeAnnotation":
|
|
57342
|
-
return (0, lines_1.concat)([path2.call(
|
|
57239
|
+
return (0, lines_1.concat)([path2.call(print5, "elementType"), "[]"]);
|
|
57343
57240
|
case "TupleTypeAnnotation": {
|
|
57344
|
-
var printed_2 = path2.map(
|
|
57241
|
+
var printed_2 = path2.map(print5, "types");
|
|
57345
57242
|
var joined = (0, lines_1.fromString)(", ").join(printed_2);
|
|
57346
57243
|
var oneLine_3 = joined.getLineLength(1) <= options.wrapColumn;
|
|
57347
57244
|
if (oneLine_3) {
|
|
@@ -57388,38 +57285,38 @@ var require_printer2 = __commonJS({
|
|
|
57388
57285
|
case "InterfaceTypeAnnotation":
|
|
57389
57286
|
parts.push("interface");
|
|
57390
57287
|
if (n.extends && n.extends.length > 0) {
|
|
57391
|
-
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path2.map(
|
|
57288
|
+
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path2.map(print5, "extends")));
|
|
57392
57289
|
}
|
|
57393
|
-
parts.push(" ", path2.call(
|
|
57290
|
+
parts.push(" ", path2.call(print5, "body"));
|
|
57394
57291
|
return (0, lines_1.concat)(parts);
|
|
57395
57292
|
case "DeclareFunction":
|
|
57396
57293
|
return printFlowDeclaration(path2, [
|
|
57397
57294
|
"function ",
|
|
57398
|
-
path2.call(
|
|
57295
|
+
path2.call(print5, "id"),
|
|
57399
57296
|
";"
|
|
57400
57297
|
]);
|
|
57401
57298
|
case "DeclareModule":
|
|
57402
57299
|
return printFlowDeclaration(path2, [
|
|
57403
57300
|
"module ",
|
|
57404
|
-
path2.call(
|
|
57301
|
+
path2.call(print5, "id"),
|
|
57405
57302
|
" ",
|
|
57406
|
-
path2.call(
|
|
57303
|
+
path2.call(print5, "body")
|
|
57407
57304
|
]);
|
|
57408
57305
|
case "DeclareModuleExports":
|
|
57409
57306
|
return printFlowDeclaration(path2, [
|
|
57410
57307
|
"module.exports",
|
|
57411
|
-
path2.call(
|
|
57308
|
+
path2.call(print5, "typeAnnotation")
|
|
57412
57309
|
]);
|
|
57413
57310
|
case "DeclareVariable":
|
|
57414
|
-
return printFlowDeclaration(path2, ["var ", path2.call(
|
|
57311
|
+
return printFlowDeclaration(path2, ["var ", path2.call(print5, "id"), ";"]);
|
|
57415
57312
|
case "DeclareExportDeclaration":
|
|
57416
57313
|
case "DeclareExportAllDeclaration":
|
|
57417
|
-
return (0, lines_1.concat)(["declare ", printExportDeclaration(path2, options,
|
|
57314
|
+
return (0, lines_1.concat)(["declare ", printExportDeclaration(path2, options, print5)]);
|
|
57418
57315
|
case "EnumDeclaration":
|
|
57419
57316
|
return (0, lines_1.concat)([
|
|
57420
57317
|
"enum ",
|
|
57421
|
-
path2.call(
|
|
57422
|
-
path2.call(
|
|
57318
|
+
path2.call(print5, "id"),
|
|
57319
|
+
path2.call(print5, "body")
|
|
57423
57320
|
]);
|
|
57424
57321
|
case "EnumBooleanBody":
|
|
57425
57322
|
case "EnumNumberBody":
|
|
@@ -57431,24 +57328,24 @@ var require_printer2 = __commonJS({
|
|
|
57431
57328
|
n.type.slice(4, -4).toLowerCase()
|
|
57432
57329
|
);
|
|
57433
57330
|
}
|
|
57434
|
-
parts.push(" {\n", (0, lines_1.fromString)("\n").join(path2.map(
|
|
57331
|
+
parts.push(" {\n", (0, lines_1.fromString)("\n").join(path2.map(print5, "members")).indent(options.tabWidth), "\n}");
|
|
57435
57332
|
return (0, lines_1.concat)(parts);
|
|
57436
57333
|
}
|
|
57437
57334
|
case "EnumDefaultedMember":
|
|
57438
|
-
return (0, lines_1.concat)([path2.call(
|
|
57335
|
+
return (0, lines_1.concat)([path2.call(print5, "id"), ","]);
|
|
57439
57336
|
case "EnumBooleanMember":
|
|
57440
57337
|
case "EnumNumberMember":
|
|
57441
57338
|
case "EnumStringMember":
|
|
57442
57339
|
return (0, lines_1.concat)([
|
|
57443
|
-
path2.call(
|
|
57340
|
+
path2.call(print5, "id"),
|
|
57444
57341
|
" = ",
|
|
57445
|
-
path2.call(
|
|
57342
|
+
path2.call(print5, "init"),
|
|
57446
57343
|
","
|
|
57447
57344
|
]);
|
|
57448
57345
|
case "InferredPredicate":
|
|
57449
57346
|
return (0, lines_1.fromString)("%checks", options);
|
|
57450
57347
|
case "DeclaredPredicate":
|
|
57451
|
-
return (0, lines_1.concat)(["%checks(", path2.call(
|
|
57348
|
+
return (0, lines_1.concat)(["%checks(", path2.call(print5, "value"), ")"]);
|
|
57452
57349
|
case "FunctionTypeAnnotation": {
|
|
57453
57350
|
var parent = path2.getParentNode(0);
|
|
57454
57351
|
var isArrowFunctionTypeAnnotation = !(namedTypes.ObjectTypeCallProperty.check(parent) || namedTypes.ObjectTypeInternalSlot.check(parent) && parent.method || namedTypes.DeclareFunction.check(path2.getParentNode(2)));
|
|
@@ -57458,14 +57355,14 @@ var require_printer2 = __commonJS({
|
|
|
57458
57355
|
}
|
|
57459
57356
|
var hasTypeParameters = !!n.typeParameters;
|
|
57460
57357
|
var needsParens = hasTypeParameters || n.params.length !== 1 || n.params[0].name;
|
|
57461
|
-
parts.push(hasTypeParameters ? path2.call(
|
|
57358
|
+
parts.push(hasTypeParameters ? path2.call(print5, "typeParameters") : "", needsParens ? "(" : "", printFunctionParams(path2, options, print5), needsParens ? ")" : "");
|
|
57462
57359
|
if (n.returnType) {
|
|
57463
|
-
parts.push(isArrowFunctionTypeAnnotation ? " => " : ": ", path2.call(
|
|
57360
|
+
parts.push(isArrowFunctionTypeAnnotation ? " => " : ": ", path2.call(print5, "returnType"));
|
|
57464
57361
|
}
|
|
57465
57362
|
return (0, lines_1.concat)(parts);
|
|
57466
57363
|
}
|
|
57467
57364
|
case "FunctionTypeParam": {
|
|
57468
|
-
var name = path2.call(
|
|
57365
|
+
var name = path2.call(print5, "name");
|
|
57469
57366
|
parts.push(name);
|
|
57470
57367
|
if (n.optional) {
|
|
57471
57368
|
parts.push("?");
|
|
@@ -57473,13 +57370,13 @@ var require_printer2 = __commonJS({
|
|
|
57473
57370
|
if (name.infos[0].line) {
|
|
57474
57371
|
parts.push(": ");
|
|
57475
57372
|
}
|
|
57476
|
-
parts.push(path2.call(
|
|
57373
|
+
parts.push(path2.call(print5, "typeAnnotation"));
|
|
57477
57374
|
return (0, lines_1.concat)(parts);
|
|
57478
57375
|
}
|
|
57479
57376
|
case "GenericTypeAnnotation":
|
|
57480
57377
|
return (0, lines_1.concat)([
|
|
57481
|
-
path2.call(
|
|
57482
|
-
path2.call(
|
|
57378
|
+
path2.call(print5, "id"),
|
|
57379
|
+
path2.call(print5, "typeParameters")
|
|
57483
57380
|
]);
|
|
57484
57381
|
case "DeclareInterface":
|
|
57485
57382
|
parts.push("declare ");
|
|
@@ -57488,24 +57385,24 @@ var require_printer2 = __commonJS({
|
|
|
57488
57385
|
if (n.declare) {
|
|
57489
57386
|
parts.push("declare ");
|
|
57490
57387
|
}
|
|
57491
|
-
parts.push("interface ", path2.call(
|
|
57388
|
+
parts.push("interface ", path2.call(print5, "id"), path2.call(print5, "typeParameters"), " ");
|
|
57492
57389
|
if (n["extends"] && n["extends"].length > 0) {
|
|
57493
|
-
parts.push("extends ", (0, lines_1.fromString)(", ").join(path2.map(
|
|
57390
|
+
parts.push("extends ", (0, lines_1.fromString)(", ").join(path2.map(print5, "extends")), " ");
|
|
57494
57391
|
}
|
|
57495
57392
|
if (n.body) {
|
|
57496
|
-
parts.push(path2.call(
|
|
57393
|
+
parts.push(path2.call(print5, "body"));
|
|
57497
57394
|
}
|
|
57498
57395
|
return (0, lines_1.concat)(parts);
|
|
57499
57396
|
case "ClassImplements":
|
|
57500
57397
|
case "InterfaceExtends":
|
|
57501
57398
|
return (0, lines_1.concat)([
|
|
57502
|
-
path2.call(
|
|
57503
|
-
path2.call(
|
|
57399
|
+
path2.call(print5, "id"),
|
|
57400
|
+
path2.call(print5, "typeParameters")
|
|
57504
57401
|
]);
|
|
57505
57402
|
case "IntersectionTypeAnnotation":
|
|
57506
|
-
return (0, lines_1.fromString)(" & ").join(path2.map(
|
|
57403
|
+
return (0, lines_1.fromString)(" & ").join(path2.map(print5, "types"));
|
|
57507
57404
|
case "NullableTypeAnnotation":
|
|
57508
|
-
return (0, lines_1.concat)(["?", path2.call(
|
|
57405
|
+
return (0, lines_1.concat)(["?", path2.call(print5, "typeAnnotation")]);
|
|
57509
57406
|
case "NullLiteralTypeAnnotation":
|
|
57510
57407
|
return (0, lines_1.fromString)("null", options);
|
|
57511
57408
|
case "ThisTypeAnnotation":
|
|
@@ -57513,40 +57410,40 @@ var require_printer2 = __commonJS({
|
|
|
57513
57410
|
case "NumberTypeAnnotation":
|
|
57514
57411
|
return (0, lines_1.fromString)("number", options);
|
|
57515
57412
|
case "ObjectTypeCallProperty":
|
|
57516
|
-
return path2.call(
|
|
57413
|
+
return path2.call(print5, "value");
|
|
57517
57414
|
case "ObjectTypeIndexer":
|
|
57518
57415
|
if (n.static) {
|
|
57519
57416
|
parts.push("static ");
|
|
57520
57417
|
}
|
|
57521
|
-
parts.push(printVariance(path2,
|
|
57418
|
+
parts.push(printVariance(path2, print5), "[");
|
|
57522
57419
|
if (n.id) {
|
|
57523
|
-
parts.push(path2.call(
|
|
57420
|
+
parts.push(path2.call(print5, "id"), ": ");
|
|
57524
57421
|
}
|
|
57525
|
-
parts.push(path2.call(
|
|
57422
|
+
parts.push(path2.call(print5, "key"), "]: ", path2.call(print5, "value"));
|
|
57526
57423
|
return (0, lines_1.concat)(parts);
|
|
57527
57424
|
case "ObjectTypeProperty":
|
|
57528
57425
|
return (0, lines_1.concat)([
|
|
57529
|
-
printVariance(path2,
|
|
57530
|
-
path2.call(
|
|
57426
|
+
printVariance(path2, print5),
|
|
57427
|
+
path2.call(print5, "key"),
|
|
57531
57428
|
n.optional ? "?" : "",
|
|
57532
57429
|
": ",
|
|
57533
|
-
path2.call(
|
|
57430
|
+
path2.call(print5, "value")
|
|
57534
57431
|
]);
|
|
57535
57432
|
case "ObjectTypeInternalSlot":
|
|
57536
57433
|
return (0, lines_1.concat)([
|
|
57537
57434
|
n.static ? "static " : "",
|
|
57538
57435
|
"[[",
|
|
57539
|
-
path2.call(
|
|
57436
|
+
path2.call(print5, "id"),
|
|
57540
57437
|
"]]",
|
|
57541
57438
|
n.optional ? "?" : "",
|
|
57542
57439
|
n.value.type !== "FunctionTypeAnnotation" ? ": " : "",
|
|
57543
|
-
path2.call(
|
|
57440
|
+
path2.call(print5, "value")
|
|
57544
57441
|
]);
|
|
57545
57442
|
case "QualifiedTypeIdentifier":
|
|
57546
57443
|
return (0, lines_1.concat)([
|
|
57547
|
-
path2.call(
|
|
57444
|
+
path2.call(print5, "qualification"),
|
|
57548
57445
|
".",
|
|
57549
|
-
path2.call(
|
|
57446
|
+
path2.call(print5, "id")
|
|
57550
57447
|
]);
|
|
57551
57448
|
case "StringLiteralTypeAnnotation":
|
|
57552
57449
|
return (0, lines_1.fromString)(nodeStr(n.value, options), options);
|
|
@@ -57563,36 +57460,36 @@ var require_printer2 = __commonJS({
|
|
|
57563
57460
|
case "TypeAlias":
|
|
57564
57461
|
return (0, lines_1.concat)([
|
|
57565
57462
|
"type ",
|
|
57566
|
-
path2.call(
|
|
57567
|
-
path2.call(
|
|
57463
|
+
path2.call(print5, "id"),
|
|
57464
|
+
path2.call(print5, "typeParameters"),
|
|
57568
57465
|
" = ",
|
|
57569
|
-
path2.call(
|
|
57466
|
+
path2.call(print5, "right"),
|
|
57570
57467
|
";"
|
|
57571
57468
|
]);
|
|
57572
57469
|
case "DeclareOpaqueType":
|
|
57573
57470
|
parts.push("declare ");
|
|
57574
57471
|
case "OpaqueType":
|
|
57575
|
-
parts.push("opaque type ", path2.call(
|
|
57472
|
+
parts.push("opaque type ", path2.call(print5, "id"), path2.call(print5, "typeParameters"));
|
|
57576
57473
|
if (n["supertype"]) {
|
|
57577
|
-
parts.push(": ", path2.call(
|
|
57474
|
+
parts.push(": ", path2.call(print5, "supertype"));
|
|
57578
57475
|
}
|
|
57579
57476
|
if (n["impltype"]) {
|
|
57580
|
-
parts.push(" = ", path2.call(
|
|
57477
|
+
parts.push(" = ", path2.call(print5, "impltype"));
|
|
57581
57478
|
}
|
|
57582
57479
|
parts.push(";");
|
|
57583
57480
|
return (0, lines_1.concat)(parts);
|
|
57584
57481
|
case "TypeCastExpression":
|
|
57585
57482
|
return (0, lines_1.concat)([
|
|
57586
57483
|
"(",
|
|
57587
|
-
path2.call(
|
|
57588
|
-
path2.call(
|
|
57484
|
+
path2.call(print5, "expression"),
|
|
57485
|
+
path2.call(print5, "typeAnnotation"),
|
|
57589
57486
|
")"
|
|
57590
57487
|
]);
|
|
57591
57488
|
case "TypeParameterDeclaration":
|
|
57592
57489
|
case "TypeParameterInstantiation":
|
|
57593
57490
|
return (0, lines_1.concat)([
|
|
57594
57491
|
"<",
|
|
57595
|
-
(0, lines_1.fromString)(", ").join(path2.map(
|
|
57492
|
+
(0, lines_1.fromString)(", ").join(path2.map(print5, "params")),
|
|
57596
57493
|
">"
|
|
57597
57494
|
]);
|
|
57598
57495
|
case "Variance":
|
|
@@ -57605,32 +57502,32 @@ var require_printer2 = __commonJS({
|
|
|
57605
57502
|
return (0, lines_1.fromString)("");
|
|
57606
57503
|
case "TypeParameter":
|
|
57607
57504
|
if (n.variance) {
|
|
57608
|
-
parts.push(printVariance(path2,
|
|
57505
|
+
parts.push(printVariance(path2, print5));
|
|
57609
57506
|
}
|
|
57610
|
-
parts.push(path2.call(
|
|
57507
|
+
parts.push(path2.call(print5, "name"));
|
|
57611
57508
|
if (n.bound) {
|
|
57612
|
-
parts.push(path2.call(
|
|
57509
|
+
parts.push(path2.call(print5, "bound"));
|
|
57613
57510
|
}
|
|
57614
57511
|
if (n["default"]) {
|
|
57615
|
-
parts.push("=", path2.call(
|
|
57512
|
+
parts.push("=", path2.call(print5, "default"));
|
|
57616
57513
|
}
|
|
57617
57514
|
return (0, lines_1.concat)(parts);
|
|
57618
57515
|
case "TypeofTypeAnnotation":
|
|
57619
57516
|
return (0, lines_1.concat)([
|
|
57620
57517
|
(0, lines_1.fromString)("typeof ", options),
|
|
57621
|
-
path2.call(
|
|
57518
|
+
path2.call(print5, "argument")
|
|
57622
57519
|
]);
|
|
57623
57520
|
case "IndexedAccessType":
|
|
57624
57521
|
case "OptionalIndexedAccessType":
|
|
57625
57522
|
return (0, lines_1.concat)([
|
|
57626
|
-
path2.call(
|
|
57523
|
+
path2.call(print5, "objectType"),
|
|
57627
57524
|
n.optional ? "?." : "",
|
|
57628
57525
|
"[",
|
|
57629
|
-
path2.call(
|
|
57526
|
+
path2.call(print5, "indexType"),
|
|
57630
57527
|
"]"
|
|
57631
57528
|
]);
|
|
57632
57529
|
case "UnionTypeAnnotation":
|
|
57633
|
-
return (0, lines_1.fromString)(" | ").join(path2.map(
|
|
57530
|
+
return (0, lines_1.fromString)(" | ").join(path2.map(print5, "types"));
|
|
57634
57531
|
case "VoidTypeAnnotation":
|
|
57635
57532
|
return (0, lines_1.fromString)("void", options);
|
|
57636
57533
|
case "NullTypeAnnotation":
|
|
@@ -57670,77 +57567,77 @@ var require_printer2 = __commonJS({
|
|
|
57670
57567
|
case "TSNeverKeyword":
|
|
57671
57568
|
return (0, lines_1.fromString)("never", options);
|
|
57672
57569
|
case "TSArrayType":
|
|
57673
|
-
return (0, lines_1.concat)([path2.call(
|
|
57570
|
+
return (0, lines_1.concat)([path2.call(print5, "elementType"), "[]"]);
|
|
57674
57571
|
case "TSLiteralType":
|
|
57675
|
-
return path2.call(
|
|
57572
|
+
return path2.call(print5, "literal");
|
|
57676
57573
|
case "TSUnionType":
|
|
57677
|
-
return (0, lines_1.fromString)(" | ").join(path2.map(
|
|
57574
|
+
return (0, lines_1.fromString)(" | ").join(path2.map(print5, "types"));
|
|
57678
57575
|
case "TSIntersectionType":
|
|
57679
|
-
return (0, lines_1.fromString)(" & ").join(path2.map(
|
|
57576
|
+
return (0, lines_1.fromString)(" & ").join(path2.map(print5, "types"));
|
|
57680
57577
|
case "TSConditionalType":
|
|
57681
|
-
parts.push(path2.call(
|
|
57578
|
+
parts.push(path2.call(print5, "checkType"), " extends ", path2.call(print5, "extendsType"), " ? ", path2.call(print5, "trueType"), " : ", path2.call(print5, "falseType"));
|
|
57682
57579
|
return (0, lines_1.concat)(parts);
|
|
57683
57580
|
case "TSInferType":
|
|
57684
|
-
parts.push("infer ", path2.call(
|
|
57581
|
+
parts.push("infer ", path2.call(print5, "typeParameter"));
|
|
57685
57582
|
return (0, lines_1.concat)(parts);
|
|
57686
57583
|
case "TSParenthesizedType":
|
|
57687
|
-
return (0, lines_1.concat)(["(", path2.call(
|
|
57584
|
+
return (0, lines_1.concat)(["(", path2.call(print5, "typeAnnotation"), ")"]);
|
|
57688
57585
|
case "TSFunctionType":
|
|
57689
57586
|
return (0, lines_1.concat)([
|
|
57690
|
-
path2.call(
|
|
57587
|
+
path2.call(print5, "typeParameters"),
|
|
57691
57588
|
"(",
|
|
57692
|
-
printFunctionParams(path2, options,
|
|
57589
|
+
printFunctionParams(path2, options, print5),
|
|
57693
57590
|
") => ",
|
|
57694
|
-
path2.call(
|
|
57591
|
+
path2.call(print5, "typeAnnotation", "typeAnnotation")
|
|
57695
57592
|
]);
|
|
57696
57593
|
case "TSConstructorType":
|
|
57697
57594
|
return (0, lines_1.concat)([
|
|
57698
57595
|
"new ",
|
|
57699
|
-
path2.call(
|
|
57596
|
+
path2.call(print5, "typeParameters"),
|
|
57700
57597
|
"(",
|
|
57701
|
-
printFunctionParams(path2, options,
|
|
57598
|
+
printFunctionParams(path2, options, print5),
|
|
57702
57599
|
") => ",
|
|
57703
|
-
path2.call(
|
|
57600
|
+
path2.call(print5, "typeAnnotation", "typeAnnotation")
|
|
57704
57601
|
]);
|
|
57705
57602
|
case "TSMappedType": {
|
|
57706
|
-
parts.push(n.readonly ? "readonly " : "", "[", path2.call(
|
|
57603
|
+
parts.push(n.readonly ? "readonly " : "", "[", path2.call(print5, "typeParameter"), "]", n.optional ? "?" : "");
|
|
57707
57604
|
if (n.typeAnnotation) {
|
|
57708
|
-
parts.push(": ", path2.call(
|
|
57605
|
+
parts.push(": ", path2.call(print5, "typeAnnotation"), ";");
|
|
57709
57606
|
}
|
|
57710
57607
|
return (0, lines_1.concat)(["{\n", (0, lines_1.concat)(parts).indent(options.tabWidth), "\n}"]);
|
|
57711
57608
|
}
|
|
57712
57609
|
case "TSTupleType":
|
|
57713
57610
|
return (0, lines_1.concat)([
|
|
57714
57611
|
"[",
|
|
57715
|
-
(0, lines_1.fromString)(", ").join(path2.map(
|
|
57612
|
+
(0, lines_1.fromString)(", ").join(path2.map(print5, "elementTypes")),
|
|
57716
57613
|
"]"
|
|
57717
57614
|
]);
|
|
57718
57615
|
case "TSNamedTupleMember":
|
|
57719
|
-
parts.push(path2.call(
|
|
57616
|
+
parts.push(path2.call(print5, "label"));
|
|
57720
57617
|
if (n.optional) {
|
|
57721
57618
|
parts.push("?");
|
|
57722
57619
|
}
|
|
57723
|
-
parts.push(": ", path2.call(
|
|
57620
|
+
parts.push(": ", path2.call(print5, "elementType"));
|
|
57724
57621
|
return (0, lines_1.concat)(parts);
|
|
57725
57622
|
case "TSRestType":
|
|
57726
|
-
return (0, lines_1.concat)(["...", path2.call(
|
|
57623
|
+
return (0, lines_1.concat)(["...", path2.call(print5, "typeAnnotation")]);
|
|
57727
57624
|
case "TSOptionalType":
|
|
57728
|
-
return (0, lines_1.concat)([path2.call(
|
|
57625
|
+
return (0, lines_1.concat)([path2.call(print5, "typeAnnotation"), "?"]);
|
|
57729
57626
|
case "TSIndexedAccessType":
|
|
57730
57627
|
return (0, lines_1.concat)([
|
|
57731
|
-
path2.call(
|
|
57628
|
+
path2.call(print5, "objectType"),
|
|
57732
57629
|
"[",
|
|
57733
|
-
path2.call(
|
|
57630
|
+
path2.call(print5, "indexType"),
|
|
57734
57631
|
"]"
|
|
57735
57632
|
]);
|
|
57736
57633
|
case "TSTypeOperator":
|
|
57737
57634
|
return (0, lines_1.concat)([
|
|
57738
|
-
path2.call(
|
|
57635
|
+
path2.call(print5, "operator"),
|
|
57739
57636
|
" ",
|
|
57740
|
-
path2.call(
|
|
57637
|
+
path2.call(print5, "typeAnnotation")
|
|
57741
57638
|
]);
|
|
57742
57639
|
case "TSTypeLiteral": {
|
|
57743
|
-
var members = (0, lines_1.fromString)("\n").join(path2.map(
|
|
57640
|
+
var members = (0, lines_1.fromString)("\n").join(path2.map(print5, "members").map(function(member) {
|
|
57744
57641
|
if (lastNonSpaceCharacter(member) !== ";") {
|
|
57745
57642
|
return member.concat(";");
|
|
57746
57643
|
}
|
|
@@ -57753,13 +57650,13 @@ var require_printer2 = __commonJS({
|
|
|
57753
57650
|
return (0, lines_1.concat)(parts);
|
|
57754
57651
|
}
|
|
57755
57652
|
case "TSEnumMember":
|
|
57756
|
-
parts.push(path2.call(
|
|
57653
|
+
parts.push(path2.call(print5, "id"));
|
|
57757
57654
|
if (n.initializer) {
|
|
57758
|
-
parts.push(" = ", path2.call(
|
|
57655
|
+
parts.push(" = ", path2.call(print5, "initializer"));
|
|
57759
57656
|
}
|
|
57760
57657
|
return (0, lines_1.concat)(parts);
|
|
57761
57658
|
case "TSTypeQuery":
|
|
57762
|
-
return (0, lines_1.concat)(["typeof ", path2.call(
|
|
57659
|
+
return (0, lines_1.concat)(["typeof ", path2.call(print5, "exprName")]);
|
|
57763
57660
|
case "TSParameterProperty":
|
|
57764
57661
|
if (n.accessibility) {
|
|
57765
57662
|
parts.push(n.accessibility, " ");
|
|
@@ -57773,119 +57670,119 @@ var require_printer2 = __commonJS({
|
|
|
57773
57670
|
if (n.readonly) {
|
|
57774
57671
|
parts.push("readonly ");
|
|
57775
57672
|
}
|
|
57776
|
-
parts.push(path2.call(
|
|
57673
|
+
parts.push(path2.call(print5, "parameter"));
|
|
57777
57674
|
return (0, lines_1.concat)(parts);
|
|
57778
57675
|
case "TSTypeReference":
|
|
57779
57676
|
return (0, lines_1.concat)([
|
|
57780
|
-
path2.call(
|
|
57781
|
-
path2.call(
|
|
57677
|
+
path2.call(print5, "typeName"),
|
|
57678
|
+
path2.call(print5, "typeParameters")
|
|
57782
57679
|
]);
|
|
57783
57680
|
case "TSQualifiedName":
|
|
57784
|
-
return (0, lines_1.concat)([path2.call(
|
|
57681
|
+
return (0, lines_1.concat)([path2.call(print5, "left"), ".", path2.call(print5, "right")]);
|
|
57785
57682
|
case "TSAsExpression":
|
|
57786
57683
|
case "TSSatisfiesExpression": {
|
|
57787
|
-
var expression = path2.call(
|
|
57788
|
-
parts.push(expression, n.type === "TSSatisfiesExpression" ? " satisfies " : " as ", path2.call(
|
|
57684
|
+
var expression = path2.call(print5, "expression");
|
|
57685
|
+
parts.push(expression, n.type === "TSSatisfiesExpression" ? " satisfies " : " as ", path2.call(print5, "typeAnnotation"));
|
|
57789
57686
|
return (0, lines_1.concat)(parts);
|
|
57790
57687
|
}
|
|
57791
57688
|
case "TSTypeCastExpression":
|
|
57792
57689
|
return (0, lines_1.concat)([
|
|
57793
|
-
path2.call(
|
|
57794
|
-
path2.call(
|
|
57690
|
+
path2.call(print5, "expression"),
|
|
57691
|
+
path2.call(print5, "typeAnnotation")
|
|
57795
57692
|
]);
|
|
57796
57693
|
case "TSNonNullExpression":
|
|
57797
|
-
return (0, lines_1.concat)([path2.call(
|
|
57694
|
+
return (0, lines_1.concat)([path2.call(print5, "expression"), "!"]);
|
|
57798
57695
|
case "TSTypeAnnotation":
|
|
57799
|
-
return (0, lines_1.concat)([": ", path2.call(
|
|
57696
|
+
return (0, lines_1.concat)([": ", path2.call(print5, "typeAnnotation")]);
|
|
57800
57697
|
case "TSIndexSignature":
|
|
57801
57698
|
return (0, lines_1.concat)([
|
|
57802
57699
|
n.readonly ? "readonly " : "",
|
|
57803
57700
|
"[",
|
|
57804
|
-
path2.map(
|
|
57701
|
+
path2.map(print5, "parameters"),
|
|
57805
57702
|
"]",
|
|
57806
|
-
path2.call(
|
|
57703
|
+
path2.call(print5, "typeAnnotation")
|
|
57807
57704
|
]);
|
|
57808
57705
|
case "TSPropertySignature":
|
|
57809
|
-
parts.push(printVariance(path2,
|
|
57706
|
+
parts.push(printVariance(path2, print5), n.readonly ? "readonly " : "");
|
|
57810
57707
|
if (n.computed) {
|
|
57811
|
-
parts.push("[", path2.call(
|
|
57708
|
+
parts.push("[", path2.call(print5, "key"), "]");
|
|
57812
57709
|
} else {
|
|
57813
|
-
parts.push(path2.call(
|
|
57710
|
+
parts.push(path2.call(print5, "key"));
|
|
57814
57711
|
}
|
|
57815
|
-
parts.push(n.optional ? "?" : "", path2.call(
|
|
57712
|
+
parts.push(n.optional ? "?" : "", path2.call(print5, "typeAnnotation"));
|
|
57816
57713
|
return (0, lines_1.concat)(parts);
|
|
57817
57714
|
case "TSMethodSignature":
|
|
57818
57715
|
if (n.computed) {
|
|
57819
|
-
parts.push("[", path2.call(
|
|
57716
|
+
parts.push("[", path2.call(print5, "key"), "]");
|
|
57820
57717
|
} else {
|
|
57821
|
-
parts.push(path2.call(
|
|
57718
|
+
parts.push(path2.call(print5, "key"));
|
|
57822
57719
|
}
|
|
57823
57720
|
if (n.optional) {
|
|
57824
57721
|
parts.push("?");
|
|
57825
57722
|
}
|
|
57826
|
-
parts.push(path2.call(
|
|
57723
|
+
parts.push(path2.call(print5, "typeParameters"), "(", printFunctionParams(path2, options, print5), ")", path2.call(print5, "typeAnnotation"));
|
|
57827
57724
|
return (0, lines_1.concat)(parts);
|
|
57828
57725
|
case "TSTypePredicate":
|
|
57829
57726
|
if (n.asserts) {
|
|
57830
57727
|
parts.push("asserts ");
|
|
57831
57728
|
}
|
|
57832
|
-
parts.push(path2.call(
|
|
57729
|
+
parts.push(path2.call(print5, "parameterName"));
|
|
57833
57730
|
if (n.typeAnnotation) {
|
|
57834
|
-
parts.push(" is ", path2.call(
|
|
57731
|
+
parts.push(" is ", path2.call(print5, "typeAnnotation", "typeAnnotation"));
|
|
57835
57732
|
}
|
|
57836
57733
|
return (0, lines_1.concat)(parts);
|
|
57837
57734
|
case "TSCallSignatureDeclaration":
|
|
57838
57735
|
return (0, lines_1.concat)([
|
|
57839
|
-
path2.call(
|
|
57736
|
+
path2.call(print5, "typeParameters"),
|
|
57840
57737
|
"(",
|
|
57841
|
-
printFunctionParams(path2, options,
|
|
57738
|
+
printFunctionParams(path2, options, print5),
|
|
57842
57739
|
")",
|
|
57843
|
-
path2.call(
|
|
57740
|
+
path2.call(print5, "typeAnnotation")
|
|
57844
57741
|
]);
|
|
57845
57742
|
case "TSConstructSignatureDeclaration":
|
|
57846
57743
|
if (n.typeParameters) {
|
|
57847
|
-
parts.push("new", path2.call(
|
|
57744
|
+
parts.push("new", path2.call(print5, "typeParameters"));
|
|
57848
57745
|
} else {
|
|
57849
57746
|
parts.push("new ");
|
|
57850
57747
|
}
|
|
57851
|
-
parts.push("(", printFunctionParams(path2, options,
|
|
57748
|
+
parts.push("(", printFunctionParams(path2, options, print5), ")", path2.call(print5, "typeAnnotation"));
|
|
57852
57749
|
return (0, lines_1.concat)(parts);
|
|
57853
57750
|
case "TSTypeAliasDeclaration":
|
|
57854
57751
|
return (0, lines_1.concat)([
|
|
57855
57752
|
n.declare ? "declare " : "",
|
|
57856
57753
|
"type ",
|
|
57857
|
-
path2.call(
|
|
57858
|
-
path2.call(
|
|
57754
|
+
path2.call(print5, "id"),
|
|
57755
|
+
path2.call(print5, "typeParameters"),
|
|
57859
57756
|
" = ",
|
|
57860
|
-
path2.call(
|
|
57757
|
+
path2.call(print5, "typeAnnotation"),
|
|
57861
57758
|
";"
|
|
57862
57759
|
]);
|
|
57863
57760
|
case "TSTypeParameter": {
|
|
57864
|
-
parts.push(path2.call(
|
|
57761
|
+
parts.push(path2.call(print5, "name"));
|
|
57865
57762
|
var parent = path2.getParentNode(0);
|
|
57866
57763
|
var isInMappedType = namedTypes.TSMappedType.check(parent);
|
|
57867
57764
|
if (n.constraint) {
|
|
57868
|
-
parts.push(isInMappedType ? " in " : " extends ", path2.call(
|
|
57765
|
+
parts.push(isInMappedType ? " in " : " extends ", path2.call(print5, "constraint"));
|
|
57869
57766
|
}
|
|
57870
57767
|
if (n["default"]) {
|
|
57871
|
-
parts.push(" = ", path2.call(
|
|
57768
|
+
parts.push(" = ", path2.call(print5, "default"));
|
|
57872
57769
|
}
|
|
57873
57770
|
return (0, lines_1.concat)(parts);
|
|
57874
57771
|
}
|
|
57875
57772
|
case "TSTypeAssertion": {
|
|
57876
|
-
parts.push("<", path2.call(
|
|
57773
|
+
parts.push("<", path2.call(print5, "typeAnnotation"), "> ", path2.call(print5, "expression"));
|
|
57877
57774
|
return (0, lines_1.concat)(parts);
|
|
57878
57775
|
}
|
|
57879
57776
|
case "TSTypeParameterDeclaration":
|
|
57880
57777
|
case "TSTypeParameterInstantiation":
|
|
57881
57778
|
return (0, lines_1.concat)([
|
|
57882
57779
|
"<",
|
|
57883
|
-
(0, lines_1.fromString)(", ").join(path2.map(
|
|
57780
|
+
(0, lines_1.fromString)(", ").join(path2.map(print5, "params")),
|
|
57884
57781
|
">"
|
|
57885
57782
|
]);
|
|
57886
57783
|
case "TSEnumDeclaration": {
|
|
57887
|
-
parts.push(n.declare ? "declare " : "", n.const ? "const " : "", "enum ", path2.call(
|
|
57888
|
-
var memberLines = (0, lines_1.fromString)(",\n").join(path2.map(
|
|
57784
|
+
parts.push(n.declare ? "declare " : "", n.const ? "const " : "", "enum ", path2.call(print5, "id"));
|
|
57785
|
+
var memberLines = (0, lines_1.fromString)(",\n").join(path2.map(print5, "members"));
|
|
57889
57786
|
if (memberLines.isEmpty()) {
|
|
57890
57787
|
parts.push(" {}");
|
|
57891
57788
|
} else {
|
|
@@ -57895,11 +57792,11 @@ var require_printer2 = __commonJS({
|
|
|
57895
57792
|
}
|
|
57896
57793
|
case "TSExpressionWithTypeArguments":
|
|
57897
57794
|
return (0, lines_1.concat)([
|
|
57898
|
-
path2.call(
|
|
57899
|
-
path2.call(
|
|
57795
|
+
path2.call(print5, "expression"),
|
|
57796
|
+
path2.call(print5, "typeParameters")
|
|
57900
57797
|
]);
|
|
57901
57798
|
case "TSInterfaceBody": {
|
|
57902
|
-
var lines = (0, lines_1.fromString)("\n").join(path2.map(
|
|
57799
|
+
var lines = (0, lines_1.fromString)("\n").join(path2.map(print5, "body").map(function(element) {
|
|
57903
57800
|
if (lastNonSpaceCharacter(element) !== ";") {
|
|
57904
57801
|
return element.concat(";");
|
|
57905
57802
|
}
|
|
@@ -57911,22 +57808,22 @@ var require_printer2 = __commonJS({
|
|
|
57911
57808
|
return (0, lines_1.concat)(["{\n", lines.indent(options.tabWidth), "\n}"]);
|
|
57912
57809
|
}
|
|
57913
57810
|
case "TSImportType":
|
|
57914
|
-
parts.push("import(", path2.call(
|
|
57811
|
+
parts.push("import(", path2.call(print5, "argument"), ")");
|
|
57915
57812
|
if (n.qualifier) {
|
|
57916
|
-
parts.push(".", path2.call(
|
|
57813
|
+
parts.push(".", path2.call(print5, "qualifier"));
|
|
57917
57814
|
}
|
|
57918
57815
|
if (n.typeParameters) {
|
|
57919
|
-
parts.push(path2.call(
|
|
57816
|
+
parts.push(path2.call(print5, "typeParameters"));
|
|
57920
57817
|
}
|
|
57921
57818
|
return (0, lines_1.concat)(parts);
|
|
57922
57819
|
case "TSImportEqualsDeclaration":
|
|
57923
57820
|
if (n.isExport) {
|
|
57924
57821
|
parts.push("export ");
|
|
57925
57822
|
}
|
|
57926
|
-
parts.push("import ", path2.call(
|
|
57823
|
+
parts.push("import ", path2.call(print5, "id"), " = ", path2.call(print5, "moduleReference"));
|
|
57927
57824
|
return maybeAddSemicolon((0, lines_1.concat)(parts));
|
|
57928
57825
|
case "TSExternalModuleReference":
|
|
57929
|
-
return (0, lines_1.concat)(["require(", path2.call(
|
|
57826
|
+
return (0, lines_1.concat)(["require(", path2.call(print5, "expression"), ")"]);
|
|
57930
57827
|
case "TSModuleDeclaration": {
|
|
57931
57828
|
var parent = path2.getParentNode();
|
|
57932
57829
|
if (parent.type === "TSModuleDeclaration") {
|
|
@@ -57951,16 +57848,16 @@ var require_printer2 = __commonJS({
|
|
|
57951
57848
|
}
|
|
57952
57849
|
}
|
|
57953
57850
|
}
|
|
57954
|
-
parts.push(path2.call(
|
|
57851
|
+
parts.push(path2.call(print5, "id"));
|
|
57955
57852
|
if (n.body) {
|
|
57956
57853
|
parts.push(" ");
|
|
57957
|
-
parts.push(path2.call(
|
|
57854
|
+
parts.push(path2.call(print5, "body"));
|
|
57958
57855
|
}
|
|
57959
57856
|
return (0, lines_1.concat)(parts);
|
|
57960
57857
|
}
|
|
57961
57858
|
case "TSModuleBlock": {
|
|
57962
57859
|
var naked = path2.call(function(bodyPath) {
|
|
57963
|
-
return printStatementSequence(bodyPath, options,
|
|
57860
|
+
return printStatementSequence(bodyPath, options, print5);
|
|
57964
57861
|
}, "body");
|
|
57965
57862
|
if (naked.isEmpty()) {
|
|
57966
57863
|
parts.push("{}");
|
|
@@ -57970,11 +57867,11 @@ var require_printer2 = __commonJS({
|
|
|
57970
57867
|
return (0, lines_1.concat)(parts);
|
|
57971
57868
|
}
|
|
57972
57869
|
case "TSInstantiationExpression": {
|
|
57973
|
-
parts.push(path2.call(
|
|
57870
|
+
parts.push(path2.call(print5, "expression"), path2.call(print5, "typeParameters"));
|
|
57974
57871
|
return (0, lines_1.concat)(parts);
|
|
57975
57872
|
}
|
|
57976
57873
|
case "V8IntrinsicIdentifier":
|
|
57977
|
-
return (0, lines_1.concat)(["%", path2.call(
|
|
57874
|
+
return (0, lines_1.concat)(["%", path2.call(print5, "name")]);
|
|
57978
57875
|
case "TopicReference":
|
|
57979
57876
|
return (0, lines_1.fromString)("#");
|
|
57980
57877
|
case "ClassHeritage":
|
|
@@ -58024,7 +57921,7 @@ var require_printer2 = __commonJS({
|
|
|
58024
57921
|
}
|
|
58025
57922
|
return (0, lines_1.concat)(parts);
|
|
58026
57923
|
}
|
|
58027
|
-
function printStatementSequence(path2, options,
|
|
57924
|
+
function printStatementSequence(path2, options, print5) {
|
|
58028
57925
|
var filtered = [];
|
|
58029
57926
|
var sawComment = false;
|
|
58030
57927
|
var sawStatement = false;
|
|
@@ -58045,7 +57942,7 @@ var require_printer2 = __commonJS({
|
|
|
58045
57942
|
}
|
|
58046
57943
|
filtered.push({
|
|
58047
57944
|
node: stmt,
|
|
58048
|
-
printed:
|
|
57945
|
+
printed: print5(stmtPath)
|
|
58049
57946
|
});
|
|
58050
57947
|
});
|
|
58051
57948
|
if (sawComment) {
|
|
@@ -58137,7 +58034,7 @@ var require_printer2 = __commonJS({
|
|
|
58137
58034
|
}
|
|
58138
58035
|
return parts;
|
|
58139
58036
|
}
|
|
58140
|
-
function printMethod(path2, options,
|
|
58037
|
+
function printMethod(path2, options, print5) {
|
|
58141
58038
|
var node = path2.getNode();
|
|
58142
58039
|
var kind = node.kind;
|
|
58143
58040
|
var parts = [];
|
|
@@ -58155,7 +58052,7 @@ var require_printer2 = __commonJS({
|
|
|
58155
58052
|
if (kind === "get" || kind === "set") {
|
|
58156
58053
|
parts.push(kind, " ");
|
|
58157
58054
|
}
|
|
58158
|
-
var key = path2.call(
|
|
58055
|
+
var key = path2.call(print5, "key");
|
|
58159
58056
|
if (node.computed) {
|
|
58160
58057
|
key = (0, lines_1.concat)(["[", key, "]"]);
|
|
58161
58058
|
}
|
|
@@ -58164,26 +58061,26 @@ var require_printer2 = __commonJS({
|
|
|
58164
58061
|
parts.push("?");
|
|
58165
58062
|
}
|
|
58166
58063
|
if (node === nodeValue) {
|
|
58167
|
-
parts.push(path2.call(
|
|
58064
|
+
parts.push(path2.call(print5, "typeParameters"), "(", printFunctionParams(path2, options, print5), ")", path2.call(print5, "returnType"));
|
|
58168
58065
|
if (node.body) {
|
|
58169
|
-
parts.push(" ", path2.call(
|
|
58066
|
+
parts.push(" ", path2.call(print5, "body"));
|
|
58170
58067
|
} else {
|
|
58171
58068
|
parts.push(";");
|
|
58172
58069
|
}
|
|
58173
58070
|
} else {
|
|
58174
|
-
parts.push(path2.call(
|
|
58175
|
-
return printFunctionParams(valuePath, options,
|
|
58176
|
-
}, "value"), ")", path2.call(
|
|
58071
|
+
parts.push(path2.call(print5, "value", "typeParameters"), "(", path2.call(function(valuePath) {
|
|
58072
|
+
return printFunctionParams(valuePath, options, print5);
|
|
58073
|
+
}, "value"), ")", path2.call(print5, "value", "returnType"));
|
|
58177
58074
|
if (nodeValue.body) {
|
|
58178
|
-
parts.push(" ", path2.call(
|
|
58075
|
+
parts.push(" ", path2.call(print5, "value", "body"));
|
|
58179
58076
|
} else {
|
|
58180
58077
|
parts.push(";");
|
|
58181
58078
|
}
|
|
58182
58079
|
}
|
|
58183
58080
|
return (0, lines_1.concat)(parts);
|
|
58184
58081
|
}
|
|
58185
|
-
function printArgumentsList(path2, options,
|
|
58186
|
-
var printed = path2.map(
|
|
58082
|
+
function printArgumentsList(path2, options, print5) {
|
|
58083
|
+
var printed = path2.map(print5, "arguments");
|
|
58187
58084
|
var trailingComma = util.isTrailingCommaEnabled(options, "parameters");
|
|
58188
58085
|
var joined = (0, lines_1.fromString)(", ").join(printed);
|
|
58189
58086
|
if (joined.getLineLength(1) > options.wrapColumn) {
|
|
@@ -58196,28 +58093,28 @@ var require_printer2 = __commonJS({
|
|
|
58196
58093
|
}
|
|
58197
58094
|
return (0, lines_1.concat)(["(", joined, ")"]);
|
|
58198
58095
|
}
|
|
58199
|
-
function printFunctionParams(path2, options,
|
|
58096
|
+
function printFunctionParams(path2, options, print5) {
|
|
58200
58097
|
var fun = path2.getValue();
|
|
58201
58098
|
var params;
|
|
58202
58099
|
var printed = [];
|
|
58203
58100
|
if (fun.params) {
|
|
58204
58101
|
params = fun.params;
|
|
58205
|
-
printed = path2.map(
|
|
58102
|
+
printed = path2.map(print5, "params");
|
|
58206
58103
|
} else if (fun.parameters) {
|
|
58207
58104
|
params = fun.parameters;
|
|
58208
|
-
printed = path2.map(
|
|
58105
|
+
printed = path2.map(print5, "parameters");
|
|
58209
58106
|
}
|
|
58210
58107
|
if (fun.defaults) {
|
|
58211
58108
|
path2.each(function(defExprPath) {
|
|
58212
58109
|
var i2 = defExprPath.getName();
|
|
58213
58110
|
var p = printed[i2];
|
|
58214
58111
|
if (p && defExprPath.getValue()) {
|
|
58215
|
-
printed[i2] = (0, lines_1.concat)([p, " = ",
|
|
58112
|
+
printed[i2] = (0, lines_1.concat)([p, " = ", print5(defExprPath)]);
|
|
58216
58113
|
}
|
|
58217
58114
|
}, "defaults");
|
|
58218
58115
|
}
|
|
58219
58116
|
if (fun.rest) {
|
|
58220
|
-
printed.push((0, lines_1.concat)(["...", path2.call(
|
|
58117
|
+
printed.push((0, lines_1.concat)(["...", path2.call(print5, "rest")]));
|
|
58221
58118
|
}
|
|
58222
58119
|
var joined = (0, lines_1.fromString)(", ").join(printed);
|
|
58223
58120
|
if (joined.length > 1 || joined.getLineLength(1) > options.wrapColumn) {
|
|
@@ -58231,11 +58128,11 @@ var require_printer2 = __commonJS({
|
|
|
58231
58128
|
}
|
|
58232
58129
|
return joined;
|
|
58233
58130
|
}
|
|
58234
|
-
function maybePrintImportAssertions(path2, options,
|
|
58131
|
+
function maybePrintImportAssertions(path2, options, print5) {
|
|
58235
58132
|
var n = path2.getValue();
|
|
58236
58133
|
if (n.assertions && n.assertions.length > 0) {
|
|
58237
58134
|
var parts = [" assert {"];
|
|
58238
|
-
var printed = path2.map(
|
|
58135
|
+
var printed = path2.map(print5, "assertions");
|
|
58239
58136
|
var flat = (0, lines_1.fromString)(", ").join(printed);
|
|
58240
58137
|
if (flat.length > 1 || flat.getLineLength(1) > options.wrapColumn) {
|
|
58241
58138
|
parts.push("\n", (0, lines_1.fromString)(",\n").join(printed).indent(options.tabWidth), "\n}");
|
|
@@ -58246,7 +58143,7 @@ var require_printer2 = __commonJS({
|
|
|
58246
58143
|
}
|
|
58247
58144
|
return (0, lines_1.fromString)("");
|
|
58248
58145
|
}
|
|
58249
|
-
function printExportDeclaration(path2, options,
|
|
58146
|
+
function printExportDeclaration(path2, options, print5) {
|
|
58250
58147
|
var decl = path2.getValue();
|
|
58251
58148
|
var parts = ["export "];
|
|
58252
58149
|
if (decl.exportKind && decl.exportKind === "type") {
|
|
@@ -58260,7 +58157,7 @@ var require_printer2 = __commonJS({
|
|
|
58260
58157
|
parts.push("default ");
|
|
58261
58158
|
}
|
|
58262
58159
|
if (decl.declaration) {
|
|
58263
|
-
parts.push(path2.call(
|
|
58160
|
+
parts.push(path2.call(print5, "declaration"));
|
|
58264
58161
|
} else if (decl.specifiers) {
|
|
58265
58162
|
if (decl.specifiers.length === 1 && decl.specifiers[0].type === "ExportBatchSpecifier") {
|
|
58266
58163
|
parts.push("*");
|
|
@@ -58272,9 +58169,9 @@ var require_printer2 = __commonJS({
|
|
|
58272
58169
|
path2.each(function(specifierPath) {
|
|
58273
58170
|
var spec = specifierPath.getValue();
|
|
58274
58171
|
if (spec.type === "ExportDefaultSpecifier") {
|
|
58275
|
-
unbracedSpecifiers_2.push(
|
|
58172
|
+
unbracedSpecifiers_2.push(print5(specifierPath));
|
|
58276
58173
|
} else {
|
|
58277
|
-
bracedSpecifiers_2.push(
|
|
58174
|
+
bracedSpecifiers_2.push(print5(specifierPath));
|
|
58278
58175
|
}
|
|
58279
58176
|
}, "specifiers");
|
|
58280
58177
|
unbracedSpecifiers_2.forEach(function(lines2, i2) {
|
|
@@ -58303,10 +58200,10 @@ var require_printer2 = __commonJS({
|
|
|
58303
58200
|
}
|
|
58304
58201
|
}
|
|
58305
58202
|
} else {
|
|
58306
|
-
parts.push(shouldPrintSpaces ? "{ " : "{", (0, lines_1.fromString)(", ").join(path2.map(
|
|
58203
|
+
parts.push(shouldPrintSpaces ? "{ " : "{", (0, lines_1.fromString)(", ").join(path2.map(print5, "specifiers")), shouldPrintSpaces ? " }" : "}");
|
|
58307
58204
|
}
|
|
58308
58205
|
if (decl.source) {
|
|
58309
|
-
parts.push(" from ", path2.call(
|
|
58206
|
+
parts.push(" from ", path2.call(print5, "source"), maybePrintImportAssertions(path2, options, print5));
|
|
58310
58207
|
}
|
|
58311
58208
|
}
|
|
58312
58209
|
var lines = (0, lines_1.concat)(parts);
|
|
@@ -58324,7 +58221,7 @@ var require_printer2 = __commonJS({
|
|
|
58324
58221
|
}
|
|
58325
58222
|
return (0, lines_1.concat)(parts);
|
|
58326
58223
|
}
|
|
58327
|
-
function printVariance(path2,
|
|
58224
|
+
function printVariance(path2, print5) {
|
|
58328
58225
|
return path2.call(function(variancePath) {
|
|
58329
58226
|
var value = variancePath.getValue();
|
|
58330
58227
|
if (value) {
|
|
@@ -58334,7 +58231,7 @@ var require_printer2 = __commonJS({
|
|
|
58334
58231
|
if (value === "minus") {
|
|
58335
58232
|
return (0, lines_1.fromString)("-");
|
|
58336
58233
|
}
|
|
58337
|
-
return
|
|
58234
|
+
return print5(variancePath);
|
|
58338
58235
|
}
|
|
58339
58236
|
return (0, lines_1.fromString)("");
|
|
58340
58237
|
}, "variance");
|
|
@@ -58421,14 +58318,14 @@ var require_main2 = __commonJS({
|
|
|
58421
58318
|
Object.defineProperty(exports, "visit", { enumerable: true, get: function() {
|
|
58422
58319
|
return ast_types_1.visit;
|
|
58423
58320
|
} });
|
|
58424
|
-
function
|
|
58321
|
+
function print5(node, options) {
|
|
58425
58322
|
return new printer_1.Printer(options).print(node);
|
|
58426
58323
|
}
|
|
58427
|
-
exports.print =
|
|
58428
|
-
function
|
|
58324
|
+
exports.print = print5;
|
|
58325
|
+
function prettyPrint2(node, options) {
|
|
58429
58326
|
return new printer_1.Printer(options).printGenerically(node);
|
|
58430
58327
|
}
|
|
58431
|
-
exports.prettyPrint =
|
|
58328
|
+
exports.prettyPrint = prettyPrint2;
|
|
58432
58329
|
function run(transformer, options) {
|
|
58433
58330
|
return runFile(process.argv[2], transformer, options);
|
|
58434
58331
|
}
|
|
@@ -58448,12 +58345,115 @@ var require_main2 = __commonJS({
|
|
|
58448
58345
|
function runString(code, transformer, options) {
|
|
58449
58346
|
var writeback = options && options.writeback || defaultWriteback;
|
|
58450
58347
|
transformer((0, parser_1.parse)(code, options), function(node) {
|
|
58451
|
-
writeback(
|
|
58348
|
+
writeback(print5(node, options).code);
|
|
58452
58349
|
});
|
|
58453
58350
|
}
|
|
58454
58351
|
}
|
|
58455
58352
|
});
|
|
58456
58353
|
|
|
58354
|
+
// ../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js
|
|
58355
|
+
var require_cjs = __commonJS({
|
|
58356
|
+
"../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js"(exports, module2) {
|
|
58357
|
+
"use strict";
|
|
58358
|
+
var isMergeableObject = function isMergeableObject2(value) {
|
|
58359
|
+
return isNonNullObject(value) && !isSpecial(value);
|
|
58360
|
+
};
|
|
58361
|
+
function isNonNullObject(value) {
|
|
58362
|
+
return !!value && typeof value === "object";
|
|
58363
|
+
}
|
|
58364
|
+
function isSpecial(value) {
|
|
58365
|
+
var stringValue = Object.prototype.toString.call(value);
|
|
58366
|
+
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
|
|
58367
|
+
}
|
|
58368
|
+
var canUseSymbol = typeof Symbol === "function" && Symbol.for;
|
|
58369
|
+
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
|
|
58370
|
+
function isReactElement(value) {
|
|
58371
|
+
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
58372
|
+
}
|
|
58373
|
+
function emptyTarget(val) {
|
|
58374
|
+
return Array.isArray(val) ? [] : {};
|
|
58375
|
+
}
|
|
58376
|
+
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
58377
|
+
return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
|
|
58378
|
+
}
|
|
58379
|
+
function defaultArrayMerge(target, source, options) {
|
|
58380
|
+
return target.concat(source).map(function(element) {
|
|
58381
|
+
return cloneUnlessOtherwiseSpecified(element, options);
|
|
58382
|
+
});
|
|
58383
|
+
}
|
|
58384
|
+
function getMergeFunction(key, options) {
|
|
58385
|
+
if (!options.customMerge) {
|
|
58386
|
+
return deepmerge;
|
|
58387
|
+
}
|
|
58388
|
+
var customMerge = options.customMerge(key);
|
|
58389
|
+
return typeof customMerge === "function" ? customMerge : deepmerge;
|
|
58390
|
+
}
|
|
58391
|
+
function getEnumerableOwnPropertySymbols(target) {
|
|
58392
|
+
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
58393
|
+
return target.propertyIsEnumerable(symbol);
|
|
58394
|
+
}) : [];
|
|
58395
|
+
}
|
|
58396
|
+
function getKeys(target) {
|
|
58397
|
+
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
|
58398
|
+
}
|
|
58399
|
+
function propertyIsOnObject(object, property) {
|
|
58400
|
+
try {
|
|
58401
|
+
return property in object;
|
|
58402
|
+
} catch (_) {
|
|
58403
|
+
return false;
|
|
58404
|
+
}
|
|
58405
|
+
}
|
|
58406
|
+
function propertyIsUnsafe(target, key) {
|
|
58407
|
+
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
|
|
58408
|
+
}
|
|
58409
|
+
function mergeObject(target, source, options) {
|
|
58410
|
+
var destination = {};
|
|
58411
|
+
if (options.isMergeableObject(target)) {
|
|
58412
|
+
getKeys(target).forEach(function(key) {
|
|
58413
|
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
58414
|
+
});
|
|
58415
|
+
}
|
|
58416
|
+
getKeys(source).forEach(function(key) {
|
|
58417
|
+
if (propertyIsUnsafe(target, key)) {
|
|
58418
|
+
return;
|
|
58419
|
+
}
|
|
58420
|
+
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
58421
|
+
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
58422
|
+
} else {
|
|
58423
|
+
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
58424
|
+
}
|
|
58425
|
+
});
|
|
58426
|
+
return destination;
|
|
58427
|
+
}
|
|
58428
|
+
function deepmerge(target, source, options) {
|
|
58429
|
+
options = options || {};
|
|
58430
|
+
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
58431
|
+
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
58432
|
+
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
58433
|
+
var sourceIsArray = Array.isArray(source);
|
|
58434
|
+
var targetIsArray = Array.isArray(target);
|
|
58435
|
+
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
58436
|
+
if (!sourceAndTargetTypesMatch) {
|
|
58437
|
+
return cloneUnlessOtherwiseSpecified(source, options);
|
|
58438
|
+
} else if (sourceIsArray) {
|
|
58439
|
+
return options.arrayMerge(target, source, options);
|
|
58440
|
+
} else {
|
|
58441
|
+
return mergeObject(target, source, options);
|
|
58442
|
+
}
|
|
58443
|
+
}
|
|
58444
|
+
deepmerge.all = function deepmergeAll(array, options) {
|
|
58445
|
+
if (!Array.isArray(array)) {
|
|
58446
|
+
throw new Error("first argument should be an array");
|
|
58447
|
+
}
|
|
58448
|
+
return array.reduce(function(prev, next) {
|
|
58449
|
+
return deepmerge(prev, next, options);
|
|
58450
|
+
}, {});
|
|
58451
|
+
};
|
|
58452
|
+
var deepmerge_1 = deepmerge;
|
|
58453
|
+
module2.exports = deepmerge_1;
|
|
58454
|
+
}
|
|
58455
|
+
});
|
|
58456
|
+
|
|
58457
58457
|
// src/lib/index.ts
|
|
58458
58458
|
var lib_exports = {};
|
|
58459
58459
|
__export(lib_exports, {
|
|
@@ -58470,12 +58470,13 @@ __export(lib_exports, {
|
|
|
58470
58470
|
HoudiniError: () => HoudiniError,
|
|
58471
58471
|
LogLevel: () => LogLevel,
|
|
58472
58472
|
PaginateMode: () => PaginateMode,
|
|
58473
|
+
PendingValue: () => PendingValue,
|
|
58473
58474
|
RefetchUpdateMode: () => RefetchUpdateMode,
|
|
58474
58475
|
TypeWrapper: () => TypeWrapper,
|
|
58475
58476
|
cleanupFiles: () => cleanupFiles,
|
|
58476
58477
|
computeID: () => computeID,
|
|
58477
58478
|
createPluginHooks: () => createPluginHooks,
|
|
58478
|
-
deepMerge: () =>
|
|
58479
|
+
deepMerge: () => deepMerge2,
|
|
58479
58480
|
defaultConfigValues: () => defaultConfigValues,
|
|
58480
58481
|
definitionFromAncestors: () => definitionFromAncestors,
|
|
58481
58482
|
detectFromPackageJSON: () => detectFromPackageJSON,
|
|
@@ -58497,11 +58498,13 @@ __export(lib_exports, {
|
|
|
58497
58498
|
mutation: () => mutation,
|
|
58498
58499
|
operation_requires_variables: () => operation_requires_variables,
|
|
58499
58500
|
orderedPlugins: () => orderedPlugins,
|
|
58501
|
+
parentField: () => parentField,
|
|
58500
58502
|
parentTypeFromAncestors: () => parentTypeFromAncestors,
|
|
58501
58503
|
parseJS: () => parseJS,
|
|
58502
58504
|
parseJSON: () => parseJSON,
|
|
58503
58505
|
path: () => path_exports,
|
|
58504
58506
|
plugin: () => plugin,
|
|
58507
|
+
printJS: () => printJS,
|
|
58505
58508
|
pullSchema: () => pullSchema,
|
|
58506
58509
|
query: () => query,
|
|
58507
58510
|
readConfigFile: () => readConfigFile,
|
|
@@ -61674,7 +61677,8 @@ function defaultConfigValues(file) {
|
|
|
61674
61677
|
};
|
|
61675
61678
|
}
|
|
61676
61679
|
function keyFieldsForType(configFile, type) {
|
|
61677
|
-
|
|
61680
|
+
const withDefault = defaultConfigValues(configFile);
|
|
61681
|
+
return withDefault.types?.[type]?.keys || withDefault.defaultKeys;
|
|
61678
61682
|
}
|
|
61679
61683
|
function computeID(configFile, type, data) {
|
|
61680
61684
|
const fields = keyFieldsForType(configFile, type);
|
|
@@ -61731,7 +61735,15 @@ function deepEquals(objA, objB, map = /* @__PURE__ */ new WeakMap()) {
|
|
|
61731
61735
|
}
|
|
61732
61736
|
|
|
61733
61737
|
// src/runtime/lib/selection.ts
|
|
61734
|
-
function getFieldsForType(selection, __typename) {
|
|
61738
|
+
function getFieldsForType(selection, __typename, loading) {
|
|
61739
|
+
if (loading) {
|
|
61740
|
+
if (selection.loadingTypes && selection.loadingTypes.length > 0) {
|
|
61741
|
+
return deepMerge(
|
|
61742
|
+
...selection.loadingTypes.map((type) => selection.abstractFields?.fields[type])
|
|
61743
|
+
);
|
|
61744
|
+
}
|
|
61745
|
+
return selection.fields ?? {};
|
|
61746
|
+
}
|
|
61735
61747
|
let targetSelection = selection.fields || {};
|
|
61736
61748
|
if (selection.abstractFields && __typename) {
|
|
61737
61749
|
const mappedType = selection.abstractFields.typeMap[__typename];
|
|
@@ -61743,6 +61755,25 @@ function getFieldsForType(selection, __typename) {
|
|
|
61743
61755
|
}
|
|
61744
61756
|
return targetSelection;
|
|
61745
61757
|
}
|
|
61758
|
+
function deepMerge(...objects) {
|
|
61759
|
+
const mergedObj = {};
|
|
61760
|
+
for (let obj of objects) {
|
|
61761
|
+
if (!obj) {
|
|
61762
|
+
continue;
|
|
61763
|
+
}
|
|
61764
|
+
for (let prop in obj) {
|
|
61765
|
+
if (prop in obj) {
|
|
61766
|
+
const val = obj[prop];
|
|
61767
|
+
if (typeof val === "object" && val !== null && !Array.isArray(val)) {
|
|
61768
|
+
mergedObj[prop] = deepMerge(mergedObj[prop] || {}, val);
|
|
61769
|
+
} else {
|
|
61770
|
+
mergedObj[prop] = val;
|
|
61771
|
+
}
|
|
61772
|
+
}
|
|
61773
|
+
}
|
|
61774
|
+
}
|
|
61775
|
+
return mergedObj;
|
|
61776
|
+
}
|
|
61746
61777
|
|
|
61747
61778
|
// src/runtime/lib/scalars.ts
|
|
61748
61779
|
async function marshalSelection({
|
|
@@ -61756,7 +61787,7 @@ async function marshalSelection({
|
|
|
61756
61787
|
if (Array.isArray(data)) {
|
|
61757
61788
|
return await Promise.all(data.map((val) => marshalSelection({ selection, data: val })));
|
|
61758
61789
|
}
|
|
61759
|
-
const targetSelection = getFieldsForType(selection, data["__typename"]);
|
|
61790
|
+
const targetSelection = getFieldsForType(selection, data["__typename"], false);
|
|
61760
61791
|
return Object.fromEntries(
|
|
61761
61792
|
await Promise.all(
|
|
61762
61793
|
Object.entries(data).map(async ([fieldName, value]) => {
|
|
@@ -61856,6 +61887,7 @@ var DataSource = {
|
|
|
61856
61887
|
Ssr: "ssr"
|
|
61857
61888
|
};
|
|
61858
61889
|
var fragmentKey = " $fragments";
|
|
61890
|
+
var PendingValue = Symbol("houdini_loading");
|
|
61859
61891
|
|
|
61860
61892
|
// src/runtime/lib/store.ts
|
|
61861
61893
|
var subscriber_queue = [];
|
|
@@ -63515,6 +63547,7 @@ var fetch2 = (target) => {
|
|
|
63515
63547
|
}
|
|
63516
63548
|
const fetch3 = ctx.fetch ?? globalThis.fetch;
|
|
63517
63549
|
const fetchParams2 = {
|
|
63550
|
+
name: ctx.artifact.name,
|
|
63518
63551
|
text: ctx.text,
|
|
63519
63552
|
hash: ctx.hash,
|
|
63520
63553
|
variables: marshalVariables2(ctx)
|
|
@@ -63555,10 +63588,10 @@ var defaultFetch = (url, params) => {
|
|
|
63555
63588
|
"Could not find configured client url. Please specify one in your HoudiniClient constructor."
|
|
63556
63589
|
);
|
|
63557
63590
|
}
|
|
63558
|
-
return async ({ fetch: fetch3, text, variables }) => {
|
|
63591
|
+
return async ({ fetch: fetch3, name, text, variables }) => {
|
|
63559
63592
|
const result = await fetch3(url, {
|
|
63560
63593
|
method: "POST",
|
|
63561
|
-
body: JSON.stringify({ query: text, variables }),
|
|
63594
|
+
body: JSON.stringify({ operationName: name, query: text, variables }),
|
|
63562
63595
|
...params,
|
|
63563
63596
|
headers: {
|
|
63564
63597
|
Accept: "application/graphql+json, application/json",
|
|
@@ -64088,46 +64121,6 @@ var ListCollection = class {
|
|
|
64088
64121
|
}
|
|
64089
64122
|
};
|
|
64090
64123
|
|
|
64091
|
-
// src/runtime/cache/schema.ts
|
|
64092
|
-
var SchemaManager = class {
|
|
64093
|
-
cache;
|
|
64094
|
-
fieldTypes = {};
|
|
64095
|
-
constructor(cache) {
|
|
64096
|
-
this.cache = cache;
|
|
64097
|
-
}
|
|
64098
|
-
setFieldType({
|
|
64099
|
-
parent,
|
|
64100
|
-
key,
|
|
64101
|
-
type,
|
|
64102
|
-
nullable = false,
|
|
64103
|
-
link
|
|
64104
|
-
}) {
|
|
64105
|
-
let parensIndex = key.indexOf("(");
|
|
64106
|
-
if (parensIndex !== -1) {
|
|
64107
|
-
key = key.substring(0, parensIndex);
|
|
64108
|
-
}
|
|
64109
|
-
if (parent === rootID) {
|
|
64110
|
-
parent = "Query";
|
|
64111
|
-
} else if (parent.includes(":")) {
|
|
64112
|
-
parent = parent.substring(0, parent.indexOf(":"));
|
|
64113
|
-
}
|
|
64114
|
-
if (!this.fieldTypes[parent]) {
|
|
64115
|
-
this.fieldTypes[parent] = {};
|
|
64116
|
-
}
|
|
64117
|
-
this.fieldTypes[parent][key] = {
|
|
64118
|
-
type,
|
|
64119
|
-
nullable,
|
|
64120
|
-
link: !!link
|
|
64121
|
-
};
|
|
64122
|
-
}
|
|
64123
|
-
fieldType(type, field) {
|
|
64124
|
-
return this.fieldTypes[type]?.[field] || null;
|
|
64125
|
-
}
|
|
64126
|
-
get config() {
|
|
64127
|
-
return this.cache._internal_unstable.config;
|
|
64128
|
-
}
|
|
64129
|
-
};
|
|
64130
|
-
|
|
64131
64124
|
// src/runtime/cache/staleManager.ts
|
|
64132
64125
|
var StaleManager = class {
|
|
64133
64126
|
cache;
|
|
@@ -64560,7 +64553,7 @@ var OperationKind = {
|
|
|
64560
64553
|
};
|
|
64561
64554
|
|
|
64562
64555
|
// src/runtime/cache/stuff.ts
|
|
64563
|
-
function evaluateKey(key, variables =
|
|
64556
|
+
function evaluateKey(key, variables = null) {
|
|
64564
64557
|
let evaluated = "";
|
|
64565
64558
|
let varName = "";
|
|
64566
64559
|
let inString = false;
|
|
@@ -64570,7 +64563,7 @@ function evaluateKey(key, variables = {}) {
|
|
|
64570
64563
|
varName += char;
|
|
64571
64564
|
continue;
|
|
64572
64565
|
}
|
|
64573
|
-
const value = variables[varName.slice(1)];
|
|
64566
|
+
const value = variables?.[varName.slice(1)];
|
|
64574
64567
|
evaluated += typeof value !== "undefined" ? JSON.stringify(value) : "undefined";
|
|
64575
64568
|
varName = "";
|
|
64576
64569
|
}
|
|
@@ -64604,7 +64597,7 @@ var InMemorySubscriptions = class {
|
|
|
64604
64597
|
parentType
|
|
64605
64598
|
}) {
|
|
64606
64599
|
const __typename = this.cache._internal_unstable.storage.get(parent, "__typename").value;
|
|
64607
|
-
let targetSelection = getFieldsForType(selection, __typename);
|
|
64600
|
+
let targetSelection = getFieldsForType(selection, __typename, false);
|
|
64608
64601
|
for (const fieldSelection of Object.values(targetSelection || {})) {
|
|
64609
64602
|
const {
|
|
64610
64603
|
keyRaw,
|
|
@@ -64621,7 +64614,7 @@ var InMemorySubscriptions = class {
|
|
|
64621
64614
|
let targetSelection2;
|
|
64622
64615
|
if (innerSelection) {
|
|
64623
64616
|
const __typename2 = this.cache._internal_unstable.storage.get(parent, "__typename").value;
|
|
64624
|
-
targetSelection2 = getFieldsForType(innerSelection, __typename2);
|
|
64617
|
+
targetSelection2 = getFieldsForType(innerSelection, __typename2, false);
|
|
64625
64618
|
}
|
|
64626
64619
|
this.addFieldSubscription({
|
|
64627
64620
|
id: parent,
|
|
@@ -64732,7 +64725,7 @@ var InMemorySubscriptions = class {
|
|
|
64732
64725
|
filters
|
|
64733
64726
|
} = selection;
|
|
64734
64727
|
const key = evaluateKey(keyRaw, variables);
|
|
64735
|
-
const fieldSelection = innerSelection ? getFieldsForType(innerSelection, parentType) : void 0;
|
|
64728
|
+
const fieldSelection = innerSelection ? getFieldsForType(innerSelection, parentType, false) : void 0;
|
|
64736
64729
|
this.addFieldSubscription({
|
|
64737
64730
|
id: parent,
|
|
64738
64731
|
key,
|
|
@@ -64762,7 +64755,7 @@ var InMemorySubscriptions = class {
|
|
|
64762
64755
|
linkedRecord,
|
|
64763
64756
|
"__typename"
|
|
64764
64757
|
).value;
|
|
64765
|
-
let targetSelection2 = getFieldsForType(childSelection, __typename);
|
|
64758
|
+
let targetSelection2 = getFieldsForType(childSelection, __typename, false);
|
|
64766
64759
|
this.addMany({
|
|
64767
64760
|
parent: linkedRecord,
|
|
64768
64761
|
variables,
|
|
@@ -64781,7 +64774,7 @@ var InMemorySubscriptions = class {
|
|
|
64781
64774
|
visited.push(id);
|
|
64782
64775
|
const linkedIDs = [];
|
|
64783
64776
|
const __typename = this.cache._internal_unstable.storage.get(id, "__typename").value;
|
|
64784
|
-
let targetSelection = getFieldsForType(selection, __typename);
|
|
64777
|
+
let targetSelection = getFieldsForType(selection, __typename, false);
|
|
64785
64778
|
for (const fieldSelection of Object.values(targetSelection || {})) {
|
|
64786
64779
|
const key = evaluateKey(fieldSelection.keyRaw, variables);
|
|
64787
64780
|
this.removeSubscribers(id, key, targets);
|
|
@@ -64851,7 +64844,6 @@ var Cache = class {
|
|
|
64851
64844
|
lists: new ListManager(this, rootID),
|
|
64852
64845
|
lifetimes: new GarbageCollector(this),
|
|
64853
64846
|
staleManager: new StaleManager(this),
|
|
64854
|
-
schema: new SchemaManager(this),
|
|
64855
64847
|
disabled: disabled ?? typeof globalThis.window === "undefined"
|
|
64856
64848
|
});
|
|
64857
64849
|
if (Object.keys(config).length > 0) {
|
|
@@ -64962,7 +64954,6 @@ var CacheInternal = class {
|
|
|
64962
64954
|
cache;
|
|
64963
64955
|
lifetimes;
|
|
64964
64956
|
staleManager;
|
|
64965
|
-
schema;
|
|
64966
64957
|
constructor({
|
|
64967
64958
|
storage,
|
|
64968
64959
|
subscriptions,
|
|
@@ -64970,7 +64961,6 @@ var CacheInternal = class {
|
|
|
64970
64961
|
cache,
|
|
64971
64962
|
lifetimes,
|
|
64972
64963
|
staleManager,
|
|
64973
|
-
schema,
|
|
64974
64964
|
disabled,
|
|
64975
64965
|
config
|
|
64976
64966
|
}) {
|
|
@@ -64980,7 +64970,6 @@ var CacheInternal = class {
|
|
|
64980
64970
|
this.cache = cache;
|
|
64981
64971
|
this.lifetimes = lifetimes;
|
|
64982
64972
|
this.staleManager = staleManager;
|
|
64983
|
-
this.schema = schema;
|
|
64984
64973
|
this._config = config;
|
|
64985
64974
|
this._disabled = disabled;
|
|
64986
64975
|
try {
|
|
@@ -65010,7 +64999,11 @@ var CacheInternal = class {
|
|
|
65010
64999
|
if (this._disabled) {
|
|
65011
65000
|
return [];
|
|
65012
65001
|
}
|
|
65013
|
-
let targetSelection = getFieldsForType(
|
|
65002
|
+
let targetSelection = getFieldsForType(
|
|
65003
|
+
selection,
|
|
65004
|
+
data["__typename"],
|
|
65005
|
+
false
|
|
65006
|
+
);
|
|
65014
65007
|
for (const [field, value] of Object.entries(data)) {
|
|
65015
65008
|
if (!selection || !targetSelection[field]) {
|
|
65016
65009
|
continue;
|
|
@@ -65021,17 +65014,9 @@ var CacheInternal = class {
|
|
|
65021
65014
|
selection: fieldSelection,
|
|
65022
65015
|
operations,
|
|
65023
65016
|
abstract: isAbstract,
|
|
65024
|
-
updates
|
|
65025
|
-
nullable
|
|
65017
|
+
updates
|
|
65026
65018
|
} = targetSelection[field];
|
|
65027
65019
|
const key = evaluateKey(keyRaw, variables);
|
|
65028
|
-
this.schema.setFieldType({
|
|
65029
|
-
parent,
|
|
65030
|
-
key: keyRaw,
|
|
65031
|
-
type: linkedType,
|
|
65032
|
-
nullable,
|
|
65033
|
-
link: !!fieldSelection
|
|
65034
|
-
});
|
|
65035
65020
|
if (value && typeof value === "object" && "__typename" in value && value["__typename"]) {
|
|
65036
65021
|
linkedType = value["__typename"];
|
|
65037
65022
|
}
|
|
@@ -65276,42 +65261,83 @@ var CacheInternal = class {
|
|
|
65276
65261
|
parent = rootID,
|
|
65277
65262
|
variables,
|
|
65278
65263
|
stepsFromConnection = null,
|
|
65279
|
-
ignoreMasking
|
|
65264
|
+
ignoreMasking,
|
|
65265
|
+
fullCheck = false,
|
|
65266
|
+
loading: generateLoading
|
|
65280
65267
|
}) {
|
|
65281
65268
|
if (parent === null) {
|
|
65282
65269
|
return { data: null, partial: false, stale: false, hasData: true };
|
|
65283
65270
|
}
|
|
65284
65271
|
const target = {};
|
|
65285
65272
|
if (selection.fragments) {
|
|
65286
|
-
target[fragmentKey] =
|
|
65287
|
-
|
|
65288
|
-
|
|
65289
|
-
|
|
65290
|
-
|
|
65291
|
-
|
|
65292
|
-
|
|
65293
|
-
|
|
65294
|
-
|
|
65273
|
+
target[fragmentKey] = {
|
|
65274
|
+
loading: Boolean(generateLoading),
|
|
65275
|
+
values: Object.fromEntries(
|
|
65276
|
+
Object.entries(selection.fragments).filter(([, value]) => !generateLoading || value.loading).map(([key, value]) => [
|
|
65277
|
+
key,
|
|
65278
|
+
{
|
|
65279
|
+
parent,
|
|
65280
|
+
variables: evaluateFragmentVariables(
|
|
65281
|
+
value.arguments,
|
|
65282
|
+
variables ?? {}
|
|
65283
|
+
)
|
|
65284
|
+
}
|
|
65285
|
+
])
|
|
65286
|
+
)
|
|
65287
|
+
};
|
|
65295
65288
|
}
|
|
65296
65289
|
let hasData = !!selection.fragments;
|
|
65297
65290
|
let partial = false;
|
|
65298
65291
|
let cascadeNull = false;
|
|
65299
65292
|
let stale = false;
|
|
65300
65293
|
const typename = this.storage.get(parent, "__typename").value;
|
|
65301
|
-
let targetSelection = getFieldsForType(selection, typename);
|
|
65294
|
+
let targetSelection = getFieldsForType(selection, typename, !!generateLoading);
|
|
65302
65295
|
for (const [
|
|
65303
65296
|
attributeName,
|
|
65304
|
-
{
|
|
65297
|
+
{
|
|
65298
|
+
type,
|
|
65299
|
+
keyRaw,
|
|
65300
|
+
selection: fieldSelection,
|
|
65301
|
+
nullable,
|
|
65302
|
+
list,
|
|
65303
|
+
visible,
|
|
65304
|
+
directives,
|
|
65305
|
+
loading: fieldLoading,
|
|
65306
|
+
abstractHasRequired
|
|
65307
|
+
}
|
|
65305
65308
|
] of Object.entries(targetSelection)) {
|
|
65306
|
-
if (!visible && !ignoreMasking) {
|
|
65309
|
+
if (!visible && !ignoreMasking && !fullCheck) {
|
|
65307
65310
|
continue;
|
|
65308
65311
|
}
|
|
65312
|
+
const includeDirective = directives?.find((d) => {
|
|
65313
|
+
return d.name === "include";
|
|
65314
|
+
});
|
|
65315
|
+
if (includeDirective) {
|
|
65316
|
+
if (!evaluateFragmentVariables(includeDirective.arguments, variables ?? {})["if"]) {
|
|
65317
|
+
continue;
|
|
65318
|
+
}
|
|
65319
|
+
}
|
|
65320
|
+
const skipDirective = directives?.find((d) => {
|
|
65321
|
+
return d.name === "skip";
|
|
65322
|
+
});
|
|
65323
|
+
if (skipDirective) {
|
|
65324
|
+
if (evaluateFragmentVariables(skipDirective.arguments, variables ?? {})["if"]) {
|
|
65325
|
+
continue;
|
|
65326
|
+
}
|
|
65327
|
+
}
|
|
65328
|
+
const fieldTarget = visible || ignoreMasking ? target : {};
|
|
65309
65329
|
const key = evaluateKey(keyRaw, variables);
|
|
65310
|
-
|
|
65330
|
+
if (generateLoading && !fieldLoading) {
|
|
65331
|
+
continue;
|
|
65332
|
+
}
|
|
65333
|
+
let { value } = this.storage.get(parent, key);
|
|
65311
65334
|
const dt_field = this.staleManager.getFieldTime(parent, key);
|
|
65312
65335
|
if (dt_field === null) {
|
|
65313
65336
|
stale = true;
|
|
65314
65337
|
}
|
|
65338
|
+
if (generateLoading) {
|
|
65339
|
+
value = void 0;
|
|
65340
|
+
}
|
|
65315
65341
|
let nextStep = stepsFromConnection;
|
|
65316
65342
|
if (nextStep !== null) {
|
|
65317
65343
|
if (nextStep >= 2) {
|
|
@@ -65327,17 +65353,20 @@ var CacheInternal = class {
|
|
|
65327
65353
|
if (typeof value === "undefined" && !embeddedCursor) {
|
|
65328
65354
|
partial = true;
|
|
65329
65355
|
}
|
|
65330
|
-
if (
|
|
65331
|
-
|
|
65356
|
+
if (generateLoading && fieldLoading?.kind === "value") {
|
|
65357
|
+
fieldTarget[attributeName] = PendingValue;
|
|
65358
|
+
hasData = true;
|
|
65359
|
+
} else if (!generateLoading && typeof value === "undefined" || value === null) {
|
|
65360
|
+
fieldTarget[attributeName] = null;
|
|
65332
65361
|
if (typeof value !== "undefined") {
|
|
65333
65362
|
hasData = true;
|
|
65334
65363
|
}
|
|
65335
65364
|
} else if (!fieldSelection) {
|
|
65336
65365
|
const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
|
|
65337
65366
|
if (fnUnmarshal) {
|
|
65338
|
-
|
|
65367
|
+
fieldTarget[attributeName] = fnUnmarshal(value);
|
|
65339
65368
|
} else {
|
|
65340
|
-
|
|
65369
|
+
fieldTarget[attributeName] = value;
|
|
65341
65370
|
}
|
|
65342
65371
|
hasData = true;
|
|
65343
65372
|
} else if (Array.isArray(value)) {
|
|
@@ -65346,9 +65375,11 @@ var CacheInternal = class {
|
|
|
65346
65375
|
variables,
|
|
65347
65376
|
linkedList: value,
|
|
65348
65377
|
stepsFromConnection: nextStep,
|
|
65349
|
-
ignoreMasking: !!ignoreMasking
|
|
65378
|
+
ignoreMasking: !!ignoreMasking,
|
|
65379
|
+
fullCheck,
|
|
65380
|
+
loading: generateLoading
|
|
65350
65381
|
});
|
|
65351
|
-
|
|
65382
|
+
fieldTarget[attributeName] = listValue.data;
|
|
65352
65383
|
if (listValue.partial) {
|
|
65353
65384
|
partial = true;
|
|
65354
65385
|
}
|
|
@@ -65364,9 +65395,11 @@ var CacheInternal = class {
|
|
|
65364
65395
|
selection: fieldSelection,
|
|
65365
65396
|
variables,
|
|
65366
65397
|
stepsFromConnection: nextStep,
|
|
65367
|
-
ignoreMasking
|
|
65398
|
+
ignoreMasking,
|
|
65399
|
+
fullCheck,
|
|
65400
|
+
loading: generateLoading
|
|
65368
65401
|
});
|
|
65369
|
-
|
|
65402
|
+
fieldTarget[attributeName] = objectFields.data;
|
|
65370
65403
|
if (objectFields.partial) {
|
|
65371
65404
|
partial = true;
|
|
65372
65405
|
}
|
|
@@ -65377,13 +65410,27 @@ var CacheInternal = class {
|
|
|
65377
65410
|
hasData = true;
|
|
65378
65411
|
}
|
|
65379
65412
|
}
|
|
65380
|
-
if (
|
|
65381
|
-
|
|
65413
|
+
if (generateLoading && fieldLoading?.list) {
|
|
65414
|
+
fieldTarget[attributeName] = wrapInLists(
|
|
65415
|
+
Array.from({ length: fieldLoading.list.count }).fill(
|
|
65416
|
+
fieldTarget[attributeName]
|
|
65417
|
+
),
|
|
65418
|
+
fieldLoading.list.depth - 1
|
|
65419
|
+
);
|
|
65420
|
+
}
|
|
65421
|
+
if (fieldTarget[attributeName] === null && !nullable && !embeddedCursor) {
|
|
65422
|
+
if (abstractHasRequired) {
|
|
65423
|
+
target[attributeName] = {
|
|
65424
|
+
__typename: "@required field missing; don't match this"
|
|
65425
|
+
};
|
|
65426
|
+
} else {
|
|
65427
|
+
cascadeNull = true;
|
|
65428
|
+
}
|
|
65382
65429
|
}
|
|
65383
65430
|
}
|
|
65384
65431
|
return {
|
|
65385
65432
|
data: cascadeNull ? null : target,
|
|
65386
|
-
partial: hasData && partial,
|
|
65433
|
+
partial: !generateLoading && hasData && partial,
|
|
65387
65434
|
stale: hasData && stale,
|
|
65388
65435
|
hasData
|
|
65389
65436
|
};
|
|
@@ -65409,7 +65456,9 @@ var CacheInternal = class {
|
|
|
65409
65456
|
variables,
|
|
65410
65457
|
linkedList,
|
|
65411
65458
|
stepsFromConnection,
|
|
65412
|
-
ignoreMasking
|
|
65459
|
+
ignoreMasking,
|
|
65460
|
+
fullCheck,
|
|
65461
|
+
loading
|
|
65413
65462
|
}) {
|
|
65414
65463
|
const result = [];
|
|
65415
65464
|
let partialData = false;
|
|
@@ -65422,7 +65471,9 @@ var CacheInternal = class {
|
|
|
65422
65471
|
variables,
|
|
65423
65472
|
linkedList: entry,
|
|
65424
65473
|
stepsFromConnection,
|
|
65425
|
-
ignoreMasking
|
|
65474
|
+
ignoreMasking,
|
|
65475
|
+
fullCheck,
|
|
65476
|
+
loading
|
|
65426
65477
|
});
|
|
65427
65478
|
result.push(nestedValue.data);
|
|
65428
65479
|
if (nestedValue.partial) {
|
|
@@ -65444,7 +65495,9 @@ var CacheInternal = class {
|
|
|
65444
65495
|
selection: fields,
|
|
65445
65496
|
variables,
|
|
65446
65497
|
stepsFromConnection,
|
|
65447
|
-
ignoreMasking
|
|
65498
|
+
ignoreMasking,
|
|
65499
|
+
fullCheck,
|
|
65500
|
+
loading
|
|
65448
65501
|
});
|
|
65449
65502
|
result.push(data);
|
|
65450
65503
|
if (partial) {
|
|
@@ -65551,6 +65604,12 @@ function evaluateFragmentVariables(variables, args) {
|
|
|
65551
65604
|
Object.entries(variables).map(([key, value]) => [key, fragmentVariableValue(value, args)])
|
|
65552
65605
|
);
|
|
65553
65606
|
}
|
|
65607
|
+
function wrapInLists(target, count = 0) {
|
|
65608
|
+
if (count === 0) {
|
|
65609
|
+
return target;
|
|
65610
|
+
}
|
|
65611
|
+
return wrapInLists([target], count - 1);
|
|
65612
|
+
}
|
|
65554
65613
|
function fragmentVariableValue(value, args) {
|
|
65555
65614
|
if (value.kind === "StringValue") {
|
|
65556
65615
|
return value.value;
|
|
@@ -65608,7 +65667,7 @@ var cachePolicy = ({
|
|
|
65608
65667
|
const value = localCache.read({
|
|
65609
65668
|
selection: artifact.selection,
|
|
65610
65669
|
variables: marshalVariables2(ctx),
|
|
65611
|
-
|
|
65670
|
+
fullCheck: true
|
|
65612
65671
|
});
|
|
65613
65672
|
const allowed = !value.partial || artifact.kind === ArtifactKind.Query && artifact.partial;
|
|
65614
65673
|
if (policy === CachePolicy.CacheOnly) {
|
|
@@ -65645,7 +65704,15 @@ var cachePolicy = ({
|
|
|
65645
65704
|
}, 0);
|
|
65646
65705
|
}
|
|
65647
65706
|
if (!ctx.stuff?.silenceLoading) {
|
|
65648
|
-
|
|
65707
|
+
let fetchingState = null;
|
|
65708
|
+
if (!useCache && "enableLoadingState" in artifact && artifact.enableLoadingState) {
|
|
65709
|
+
fetchingState = localCache.read({
|
|
65710
|
+
selection: artifact.selection,
|
|
65711
|
+
variables: marshalVariables2(ctx),
|
|
65712
|
+
loading: true
|
|
65713
|
+
}).data;
|
|
65714
|
+
}
|
|
65715
|
+
setFetching(!useCache, fetchingState);
|
|
65649
65716
|
}
|
|
65650
65717
|
return next(ctx);
|
|
65651
65718
|
},
|
|
@@ -65887,6 +65954,7 @@ function subscription(factory) {
|
|
|
65887
65954
|
clearSubscription?.();
|
|
65888
65955
|
clearSubscription = client.subscribe(
|
|
65889
65956
|
{
|
|
65957
|
+
operationName: ctx.artifact.name,
|
|
65890
65958
|
query: ctx.artifact.raw,
|
|
65891
65959
|
variables: marshalVariables2(ctx)
|
|
65892
65960
|
},
|
|
@@ -66026,7 +66094,15 @@ var DocumentStore = class extends Writable {
|
|
|
66026
66094
|
this.#plugins = pipeline2 ?? [
|
|
66027
66095
|
cachePolicy({
|
|
66028
66096
|
enabled: cache,
|
|
66029
|
-
setFetching: (fetching2
|
|
66097
|
+
setFetching: (fetching2, data) => {
|
|
66098
|
+
this.update((state) => {
|
|
66099
|
+
const newState = { ...state, fetching: fetching2 };
|
|
66100
|
+
if (fetching2 && data) {
|
|
66101
|
+
newState.data = data;
|
|
66102
|
+
}
|
|
66103
|
+
return newState;
|
|
66104
|
+
});
|
|
66105
|
+
}
|
|
66030
66106
|
})(),
|
|
66031
66107
|
...plugins2 ?? []
|
|
66032
66108
|
];
|
|
@@ -66270,7 +66346,7 @@ var ClientPluginContextWrapper = class {
|
|
|
66270
66346
|
};
|
|
66271
66347
|
const firstInit = !ctx.stuff.inputs || !ctx.stuff.inputs.init;
|
|
66272
66348
|
const hasChanged = Object.keys(changed).length > 0 || firstInit;
|
|
66273
|
-
if (
|
|
66349
|
+
if (hasChanged) {
|
|
66274
66350
|
const newVariables = {
|
|
66275
66351
|
...ctx.stuff.inputs?.marshaled,
|
|
66276
66352
|
...marshalInputs({
|
|
@@ -66320,14 +66396,22 @@ var injectedPlugins_default = plugins;
|
|
|
66320
66396
|
// src/runtime/client/index.ts
|
|
66321
66397
|
var HoudiniClient = class {
|
|
66322
66398
|
url;
|
|
66323
|
-
|
|
66324
|
-
|
|
66399
|
+
plugins;
|
|
66400
|
+
throwOnError_operations;
|
|
66401
|
+
constructor({
|
|
66402
|
+
url,
|
|
66403
|
+
fetchParams: fetchParams2,
|
|
66404
|
+
plugins: plugins2,
|
|
66405
|
+
pipeline: pipeline2,
|
|
66406
|
+
throwOnError: throwOnError2
|
|
66407
|
+
}) {
|
|
66325
66408
|
if (plugins2 && pipeline2) {
|
|
66326
66409
|
throw new Error(
|
|
66327
66410
|
"A client cannot be given a pipeline and a list of plugins at the same time."
|
|
66328
66411
|
);
|
|
66329
66412
|
}
|
|
66330
|
-
this
|
|
66413
|
+
this.throwOnError_operations = throwOnError2?.operations ?? [];
|
|
66414
|
+
this.plugins = flatten(
|
|
66331
66415
|
[].concat(
|
|
66332
66416
|
throwOnError2 ? [throwOnError(throwOnError2)] : [],
|
|
66333
66417
|
fetchParams(fetchParams2),
|
|
@@ -66353,7 +66437,7 @@ var HoudiniClient = class {
|
|
|
66353
66437
|
return new DocumentStore({
|
|
66354
66438
|
client: this,
|
|
66355
66439
|
artifact,
|
|
66356
|
-
plugins: createPluginHooks(this
|
|
66440
|
+
plugins: createPluginHooks(this.plugins),
|
|
66357
66441
|
cache,
|
|
66358
66442
|
initialValue,
|
|
66359
66443
|
fetching
|
|
@@ -66487,7 +66571,7 @@ var Config = class {
|
|
|
66487
66571
|
this.logLevel = (logLevel || LogLevel.Summary).toLowerCase();
|
|
66488
66572
|
this.defaultFragmentMasking = defaultFragmentMasking;
|
|
66489
66573
|
this.routesDir = join2(this.projectRoot, "src", "routes");
|
|
66490
|
-
this.schemaPollInterval = watchSchema?.interval
|
|
66574
|
+
this.schemaPollInterval = watchSchema?.interval === void 0 ? 2e3 : watchSchema.interval;
|
|
66491
66575
|
this.schemaPollHeaders = watchSchema?.headers ?? {};
|
|
66492
66576
|
this.rootDir = join2(this.projectRoot, "$houdini");
|
|
66493
66577
|
this.#fragmentVariableMaps = {};
|
|
@@ -66626,7 +66710,16 @@ var Config = class {
|
|
|
66626
66710
|
return "$houdini.d.ts";
|
|
66627
66711
|
}
|
|
66628
66712
|
get runtimeSource() {
|
|
66629
|
-
|
|
66713
|
+
let relative2;
|
|
66714
|
+
if (houdini_mode.is_testing) {
|
|
66715
|
+
relative2 = join2(currentDir, "..", "..");
|
|
66716
|
+
} else if (process.versions.pnp) {
|
|
66717
|
+
const { findPnpApi } = require("node:module");
|
|
66718
|
+
const pnp = findPnpApi(this.filepath);
|
|
66719
|
+
relative2 = pnp.resolveToUnqualified("houdini", this.filepath);
|
|
66720
|
+
} else {
|
|
66721
|
+
relative2 = findModule("houdini", join2(dirname(this.filepath)));
|
|
66722
|
+
}
|
|
66630
66723
|
const which = this.module === "esm" ? "esm" : "cjs";
|
|
66631
66724
|
return resolve(relative2, "build", `runtime-${which}`);
|
|
66632
66725
|
}
|
|
@@ -66741,6 +66834,12 @@ var Config = class {
|
|
|
66741
66834
|
get listParentDirective() {
|
|
66742
66835
|
return "parentID";
|
|
66743
66836
|
}
|
|
66837
|
+
get blockingDirective() {
|
|
66838
|
+
return "blocking";
|
|
66839
|
+
}
|
|
66840
|
+
get blockingDisableDirective() {
|
|
66841
|
+
return "blocking_disable";
|
|
66842
|
+
}
|
|
66744
66843
|
get deprecatedlistDirectiveParentIDArg() {
|
|
66745
66844
|
return "parentID";
|
|
66746
66845
|
}
|
|
@@ -66762,6 +66861,9 @@ var Config = class {
|
|
|
66762
66861
|
get deleteDirectiveSuffix() {
|
|
66763
66862
|
return `_delete`;
|
|
66764
66863
|
}
|
|
66864
|
+
get loadingDirective() {
|
|
66865
|
+
return `loading`;
|
|
66866
|
+
}
|
|
66765
66867
|
get whenDirective() {
|
|
66766
66868
|
return "when";
|
|
66767
66869
|
}
|
|
@@ -66792,6 +66894,9 @@ var Config = class {
|
|
|
66792
66894
|
get cachePolicyArg() {
|
|
66793
66895
|
return "policy";
|
|
66794
66896
|
}
|
|
66897
|
+
get requiredDirective() {
|
|
66898
|
+
return "required";
|
|
66899
|
+
}
|
|
66795
66900
|
paginationQueryName(documentName) {
|
|
66796
66901
|
return documentName + "_Pagination_Query";
|
|
66797
66902
|
}
|
|
@@ -66849,7 +66954,7 @@ var Config = class {
|
|
|
66849
66954
|
fragment: fragment2
|
|
66850
66955
|
}) {
|
|
66851
66956
|
this.#fragmentVariableMaps[hash] = {
|
|
66852
|
-
args: this
|
|
66957
|
+
args: this.serializeValueMap(args),
|
|
66853
66958
|
fragment: fragment2
|
|
66854
66959
|
};
|
|
66855
66960
|
}
|
|
@@ -66860,7 +66965,7 @@ var Config = class {
|
|
|
66860
66965
|
hash
|
|
66861
66966
|
};
|
|
66862
66967
|
}
|
|
66863
|
-
|
|
66968
|
+
serializeValueMap(map) {
|
|
66864
66969
|
if (!map) {
|
|
66865
66970
|
return null;
|
|
66866
66971
|
}
|
|
@@ -66875,7 +66980,7 @@ var Config = class {
|
|
|
66875
66980
|
}
|
|
66876
66981
|
if ("values" in input) {
|
|
66877
66982
|
result.values = input.values.map(
|
|
66878
|
-
(value) => this
|
|
66983
|
+
(value) => this.serializeValueMap({ foo: value }).foo
|
|
66879
66984
|
);
|
|
66880
66985
|
}
|
|
66881
66986
|
if ("name" in input) {
|
|
@@ -66884,7 +66989,7 @@ var Config = class {
|
|
|
66884
66989
|
if ("fields" in input) {
|
|
66885
66990
|
result.fields = input.fields.map((field) => ({
|
|
66886
66991
|
name: field.name,
|
|
66887
|
-
value: this
|
|
66992
|
+
value: this.serializeValueMap({ foo: field.value }).foo
|
|
66888
66993
|
}));
|
|
66889
66994
|
}
|
|
66890
66995
|
}
|
|
@@ -67096,6 +67201,11 @@ var orderedPlugins = (plugins2) => {
|
|
|
67096
67201
|
};
|
|
67097
67202
|
async function pluginPath(plugin_name, config_path) {
|
|
67098
67203
|
try {
|
|
67204
|
+
if (process.versions.pnp) {
|
|
67205
|
+
const { findPnpApi } = require("node:module");
|
|
67206
|
+
const pnp = findPnpApi(config_path);
|
|
67207
|
+
return pnp.resolveRequest(plugin_name, config_path, { conditions: /* @__PURE__ */ new Set(["import"]) });
|
|
67208
|
+
}
|
|
67099
67209
|
const pluginDirectory = findModule(plugin_name, config_path);
|
|
67100
67210
|
const packageJsonSrc = await readFile(join2(pluginDirectory, "package.json"));
|
|
67101
67211
|
if (!packageJsonSrc) {
|
|
@@ -67183,6 +67293,16 @@ function hashDocument({
|
|
|
67183
67293
|
const docString = typeof document === "string" ? document : document.originalString;
|
|
67184
67294
|
return import_node_crypto.default.createHash("sha256").update(docString ?? "").digest("hex");
|
|
67185
67295
|
}
|
|
67296
|
+
function parentField(ancestors) {
|
|
67297
|
+
return walkParentField([...ancestors].sort(() => -1));
|
|
67298
|
+
}
|
|
67299
|
+
function walkParentField(ancestors) {
|
|
67300
|
+
let head = ancestors.shift();
|
|
67301
|
+
if (Array.isArray(head) || head.kind === "SelectionSet") {
|
|
67302
|
+
return walkParentField(ancestors);
|
|
67303
|
+
}
|
|
67304
|
+
return head;
|
|
67305
|
+
}
|
|
67186
67306
|
function parentTypeFromAncestors(schema, filepath, ancestors) {
|
|
67187
67307
|
const parents = [...ancestors];
|
|
67188
67308
|
parents.reverse();
|
|
@@ -67253,7 +67373,7 @@ function definitionFromAncestors(ancestors) {
|
|
|
67253
67373
|
while (Array.isArray(definition) && definition) {
|
|
67254
67374
|
definition = parents.shift();
|
|
67255
67375
|
}
|
|
67256
|
-
return definition;
|
|
67376
|
+
return { parents, definition };
|
|
67257
67377
|
}
|
|
67258
67378
|
function formatErrors(e2, afterError) {
|
|
67259
67379
|
const errors = Array.isArray(e2) ? e2 : [e2];
|
|
@@ -67337,10 +67457,11 @@ var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
|
|
|
67337
67457
|
|
|
67338
67458
|
// src/lib/parse.ts
|
|
67339
67459
|
var import_parser = __toESM(require_lib3(), 1);
|
|
67460
|
+
var import_recast = __toESM(require_main2(), 1);
|
|
67340
67461
|
|
|
67341
67462
|
// src/lib/deepMerge.ts
|
|
67342
67463
|
var import_deepmerge = __toESM(require_cjs(), 1);
|
|
67343
|
-
function
|
|
67464
|
+
function deepMerge2(filepath, ...targets) {
|
|
67344
67465
|
try {
|
|
67345
67466
|
if (targets.length === 1) {
|
|
67346
67467
|
return targets[0];
|
|
@@ -67349,7 +67470,7 @@ function deepMerge(filepath, ...targets) {
|
|
|
67349
67470
|
arrayMerge: (source, update) => [...new Set(source.concat(update))]
|
|
67350
67471
|
});
|
|
67351
67472
|
}
|
|
67352
|
-
return
|
|
67473
|
+
return deepMerge2(filepath, targets[0], deepMerge2(filepath, ...targets.slice(1)));
|
|
67353
67474
|
} catch (e2) {
|
|
67354
67475
|
throw new HoudiniError({
|
|
67355
67476
|
filepath,
|
|
@@ -67362,22 +67483,22 @@ function deepMerge(filepath, ...targets) {
|
|
|
67362
67483
|
// src/lib/parse.ts
|
|
67363
67484
|
async function parseJS(str, config) {
|
|
67364
67485
|
const defaultConfig = {
|
|
67365
|
-
plugins: ["typescript"],
|
|
67486
|
+
plugins: ["typescript", "importAssertions"],
|
|
67366
67487
|
sourceType: "module"
|
|
67367
67488
|
};
|
|
67368
|
-
return
|
|
67369
|
-
start: 0,
|
|
67370
|
-
script: (0, import_parser.parse)(
|
|
67371
|
-
str || "",
|
|
67372
|
-
config ? deepMerge("", defaultConfig, config) : defaultConfig
|
|
67373
|
-
).program,
|
|
67374
|
-
end: str.length
|
|
67375
|
-
};
|
|
67489
|
+
return (0, import_parser.parse)(str || "", config ? deepMerge2("", defaultConfig, config) : defaultConfig).program;
|
|
67376
67490
|
}
|
|
67377
67491
|
function parseJSON(str) {
|
|
67378
67492
|
str = str.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g, (m2, g) => g ? "" : m2);
|
|
67379
67493
|
return JSON.parse(str);
|
|
67380
67494
|
}
|
|
67495
|
+
async function printJS(script, options) {
|
|
67496
|
+
if (options?.pretty) {
|
|
67497
|
+
return (0, import_recast.prettyPrint)(script, options);
|
|
67498
|
+
} else {
|
|
67499
|
+
return (0, import_recast.print)(script, options);
|
|
67500
|
+
}
|
|
67501
|
+
}
|
|
67381
67502
|
|
|
67382
67503
|
// src/lib/imports.ts
|
|
67383
67504
|
var recast = __toESM(require_main2(), 1);
|
|
@@ -67687,6 +67808,7 @@ async function find_graphql(config, parsedScript, walker) {
|
|
|
67687
67808
|
HoudiniError,
|
|
67688
67809
|
LogLevel,
|
|
67689
67810
|
PaginateMode,
|
|
67811
|
+
PendingValue,
|
|
67690
67812
|
RefetchUpdateMode,
|
|
67691
67813
|
TypeWrapper,
|
|
67692
67814
|
cleanupFiles,
|
|
@@ -67714,11 +67836,13 @@ async function find_graphql(config, parsedScript, walker) {
|
|
|
67714
67836
|
mutation,
|
|
67715
67837
|
operation_requires_variables,
|
|
67716
67838
|
orderedPlugins,
|
|
67839
|
+
parentField,
|
|
67717
67840
|
parentTypeFromAncestors,
|
|
67718
67841
|
parseJS,
|
|
67719
67842
|
parseJSON,
|
|
67720
67843
|
path,
|
|
67721
67844
|
plugin,
|
|
67845
|
+
printJS,
|
|
67722
67846
|
pullSchema,
|
|
67723
67847
|
query,
|
|
67724
67848
|
readConfigFile,
|