@xlr-lib/xlr-utils 0.1.1-next.0
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/dist/cjs/index.cjs +888 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/index.legacy-esm.js +821 -0
- package/dist/index.mjs +821 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +33 -0
- package/src/__tests__/__snapshots__/annotations.test.ts.snap +22 -0
- package/src/__tests__/__snapshots__/validation-helpers.test.ts.snap +53 -0
- package/src/__tests__/annotations.test.ts +40 -0
- package/src/__tests__/documentation.test.ts +116 -0
- package/src/__tests__/ts-helpers.test.ts +180 -0
- package/src/__tests__/type-check.test.ts +39 -0
- package/src/__tests__/validation-helpers.test.ts +141 -0
- package/src/annotations.ts +237 -0
- package/src/documentation.ts +243 -0
- package/src/index.ts +5 -0
- package/src/ts-helpers.ts +410 -0
- package/src/type-checks.ts +121 -0
- package/src/validation-helpers.ts +252 -0
- package/types/annotations.d.ts +7 -0
- package/types/documentation.d.ts +14 -0
- package/types/index.d.ts +6 -0
- package/types/ts-helpers.d.ts +41 -0
- package/types/type-checks.d.ts +45 -0
- package/types/validation-helpers.d.ts +41 -0
|
@@ -0,0 +1,888 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/utils/src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
applyExcludeToNodeType: () => applyExcludeToNodeType,
|
|
34
|
+
applyPartialOrRequiredToNodeType: () => applyPartialOrRequiredToNodeType,
|
|
35
|
+
applyPickOrOmitToNodeType: () => applyPickOrOmitToNodeType,
|
|
36
|
+
buildTemplateRegex: () => buildTemplateRegex,
|
|
37
|
+
computeEffectiveObject: () => computeEffectiveObject,
|
|
38
|
+
computeExtends: () => computeExtends,
|
|
39
|
+
createDocString: () => createDocString,
|
|
40
|
+
createTSDocString: () => createTSDocString,
|
|
41
|
+
decorateNode: () => decorateNode,
|
|
42
|
+
fillInGenerics: () => fillInGenerics,
|
|
43
|
+
getReferencedType: () => getReferencedType,
|
|
44
|
+
getStringLiteralsFromUnion: () => getStringLiteralsFromUnion,
|
|
45
|
+
isExportedDeclaration: () => isExportedDeclaration,
|
|
46
|
+
isGenericInterfaceDeclaration: () => isGenericInterfaceDeclaration,
|
|
47
|
+
isGenericNamedType: () => isGenericNamedType,
|
|
48
|
+
isGenericNodeType: () => isGenericNodeType,
|
|
49
|
+
isGenericTypeDeclaration: () => isGenericTypeDeclaration,
|
|
50
|
+
isNode: () => isNode,
|
|
51
|
+
isNodeExported: () => isNodeExported,
|
|
52
|
+
isNonNullable: () => isNonNullable,
|
|
53
|
+
isOptionalProperty: () => isOptionalProperty,
|
|
54
|
+
isPrimitiveTypeNode: () => isPrimitiveTypeNode,
|
|
55
|
+
isTopLevelDeclaration: () => isTopLevelDeclaration,
|
|
56
|
+
isTopLevelNode: () => isTopLevelNode,
|
|
57
|
+
isTypeReferenceGeneric: () => isTypeReferenceGeneric,
|
|
58
|
+
makePropertyMap: () => makePropertyMap,
|
|
59
|
+
propertyToTuple: () => propertyToTuple,
|
|
60
|
+
resolveConditional: () => resolveConditional,
|
|
61
|
+
resolveReferenceNode: () => resolveReferenceNode,
|
|
62
|
+
symbolDisplayToString: () => symbolDisplayToString,
|
|
63
|
+
tsStripOptionalType: () => tsStripOptionalType
|
|
64
|
+
});
|
|
65
|
+
module.exports = __toCommonJS(src_exports);
|
|
66
|
+
|
|
67
|
+
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/utils/src/annotations.ts
|
|
68
|
+
var import_typescript = __toESM(require("typescript"));
|
|
69
|
+
function extractDescription(text) {
|
|
70
|
+
if (!text) {
|
|
71
|
+
return {};
|
|
72
|
+
}
|
|
73
|
+
return { description: text };
|
|
74
|
+
}
|
|
75
|
+
function parentIsNonObjectPath(node) {
|
|
76
|
+
return node.parent && (import_typescript.default.isArrayTypeNode(node.parent) || import_typescript.default.isTupleTypeNode(node.parent) || import_typescript.default.isOptionalTypeNode(node.parent) || import_typescript.default.isRestTypeNode(node.parent) || import_typescript.default.isUnionTypeNode(node.parent));
|
|
77
|
+
}
|
|
78
|
+
function recurseTypeChain(node, child) {
|
|
79
|
+
if (!node) {
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
if (import_typescript.default.isArrayTypeNode(node) && node.parent && import_typescript.default.isRestTypeNode(node.parent)) {
|
|
83
|
+
return recurseTypeChain(node.parent, node);
|
|
84
|
+
}
|
|
85
|
+
if (import_typescript.default.isRestTypeNode(node)) {
|
|
86
|
+
return recurseTypeChain(node.parent, node);
|
|
87
|
+
}
|
|
88
|
+
if (import_typescript.default.isOptionalTypeNode(node)) {
|
|
89
|
+
return recurseTypeChain(node.parent, node);
|
|
90
|
+
}
|
|
91
|
+
if (import_typescript.default.isUnionTypeNode(node)) {
|
|
92
|
+
return recurseTypeChain(node.parent, node);
|
|
93
|
+
}
|
|
94
|
+
if (import_typescript.default.isParenthesizedTypeNode(node)) {
|
|
95
|
+
return recurseTypeChain(node.parent, node);
|
|
96
|
+
}
|
|
97
|
+
if (import_typescript.default.isTypeLiteralNode(node)) {
|
|
98
|
+
return recurseTypeChain(node.parent, node);
|
|
99
|
+
}
|
|
100
|
+
if (import_typescript.default.isArrayTypeNode(node)) {
|
|
101
|
+
return ["[]", ...recurseTypeChain(node.parent, node)];
|
|
102
|
+
}
|
|
103
|
+
if (import_typescript.default.isTupleTypeNode(node)) {
|
|
104
|
+
const pos = node.elements.indexOf(child);
|
|
105
|
+
return [
|
|
106
|
+
...pos === -1 ? [] : [`${pos}`],
|
|
107
|
+
...recurseTypeChain(node.parent, node)
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
if (import_typescript.default.isTypeAliasDeclaration(node) || import_typescript.default.isInterfaceDeclaration(node) || import_typescript.default.isPropertySignature(node)) {
|
|
111
|
+
return [node.name.getText(), ...recurseTypeChain(node.parent, node)];
|
|
112
|
+
}
|
|
113
|
+
if (parentIsNonObjectPath(node)) {
|
|
114
|
+
return recurseTypeChain(node.parent, node);
|
|
115
|
+
}
|
|
116
|
+
return [];
|
|
117
|
+
}
|
|
118
|
+
function extractTitle(node) {
|
|
119
|
+
const typeNames = recurseTypeChain(node, void 0).reverse().join(".");
|
|
120
|
+
if (!typeNames.length) {
|
|
121
|
+
return {};
|
|
122
|
+
}
|
|
123
|
+
return { title: typeNames };
|
|
124
|
+
}
|
|
125
|
+
function stringifyDoc(docString) {
|
|
126
|
+
if (typeof docString === "undefined" || typeof docString === "string") {
|
|
127
|
+
return docString;
|
|
128
|
+
}
|
|
129
|
+
return docString.map(({ text }) => text).join(" ");
|
|
130
|
+
}
|
|
131
|
+
function extractTags(tags) {
|
|
132
|
+
const descriptions = [];
|
|
133
|
+
const examples = [];
|
|
134
|
+
const _default = [];
|
|
135
|
+
const see = [];
|
|
136
|
+
const meta = {};
|
|
137
|
+
const extractSee = (tag) => {
|
|
138
|
+
return `${tag.tagName ? `${tag.tagName?.getText()} ` : ""}${stringifyDoc(tag.comment)?.trim() ?? ""}`;
|
|
139
|
+
};
|
|
140
|
+
tags.forEach((tag) => {
|
|
141
|
+
if (!tag.comment) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (tag.tagName.text === "example") {
|
|
145
|
+
examples.push(stringifyDoc(tag.comment)?.trim() ?? "");
|
|
146
|
+
} else if (tag.tagName.text === "default") {
|
|
147
|
+
_default.push(stringifyDoc(tag.comment)?.trim() ?? "");
|
|
148
|
+
} else if (tag.tagName.text === "see") {
|
|
149
|
+
see.push(extractSee(tag));
|
|
150
|
+
} else if (tag.tagName.text === "meta") {
|
|
151
|
+
const [key, value] = tag.comment.toString().split(/:(.*)/);
|
|
152
|
+
meta[key] = value?.trim() ?? "";
|
|
153
|
+
} else {
|
|
154
|
+
const text = stringifyDoc(tag.comment)?.trim() ?? "";
|
|
155
|
+
descriptions.push(`@${tag.tagName.text} ${text}`);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
return {
|
|
159
|
+
...descriptions.length === 0 ? {} : { description: descriptions.join("\n") },
|
|
160
|
+
...examples.length === 0 ? {} : { examples },
|
|
161
|
+
..._default.length === 0 ? {} : { default: _default.join("\n") },
|
|
162
|
+
...see.length === 0 ? {} : { see },
|
|
163
|
+
...meta && Object.keys(meta).length === 0 ? {} : { meta }
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function join(t, separator = "\n") {
|
|
167
|
+
const unique = new Set(t).values();
|
|
168
|
+
return Array.from(unique).filter((s) => s !== void 0).join(separator).trim();
|
|
169
|
+
}
|
|
170
|
+
function mergeAnnotations(nodes) {
|
|
171
|
+
const name = nodes.find((n) => n.name)?.name;
|
|
172
|
+
const title = join(
|
|
173
|
+
nodes.map((n) => n.title),
|
|
174
|
+
", "
|
|
175
|
+
);
|
|
176
|
+
const description = join(nodes.map((n) => n.description));
|
|
177
|
+
const _default = join(nodes.map((n) => n.default));
|
|
178
|
+
const comment = join(nodes.map((n) => n.comment));
|
|
179
|
+
const examples = join(
|
|
180
|
+
nodes.map(
|
|
181
|
+
(n) => Array.isArray(n.examples) ? join(n.examples) : n.examples
|
|
182
|
+
)
|
|
183
|
+
);
|
|
184
|
+
const see = join(
|
|
185
|
+
nodes.map((n) => Array.isArray(n.see) ? join(n.see) : n.see)
|
|
186
|
+
);
|
|
187
|
+
const meta = nodes.find((n) => n.meta)?.meta;
|
|
188
|
+
return {
|
|
189
|
+
...name ? { name } : {},
|
|
190
|
+
...title ? { title } : {},
|
|
191
|
+
...description ? { description } : {},
|
|
192
|
+
...examples ? { examples } : {},
|
|
193
|
+
..._default ? { default: _default } : {},
|
|
194
|
+
...see ? { see } : {},
|
|
195
|
+
...comment ? { comment } : {},
|
|
196
|
+
...meta ? { meta } : {}
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function decorateNode(node) {
|
|
200
|
+
const { jsDoc } = node;
|
|
201
|
+
const titleAnnotation = extractTitle(node);
|
|
202
|
+
if (jsDoc && jsDoc.length) {
|
|
203
|
+
const first = jsDoc[0];
|
|
204
|
+
return mergeAnnotations([
|
|
205
|
+
extractDescription(stringifyDoc(first.comment)),
|
|
206
|
+
titleAnnotation,
|
|
207
|
+
extractTags(first.tags ?? [])
|
|
208
|
+
]);
|
|
209
|
+
}
|
|
210
|
+
return titleAnnotation;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/utils/src/ts-helpers.ts
|
|
214
|
+
var import_typescript3 = __toESM(require("typescript"));
|
|
215
|
+
|
|
216
|
+
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/utils/src/type-checks.ts
|
|
217
|
+
var import_typescript2 = __toESM(require("typescript"));
|
|
218
|
+
function isOptionalProperty(node) {
|
|
219
|
+
return node.questionToken?.kind === import_typescript2.default.SyntaxKind.QuestionToken;
|
|
220
|
+
}
|
|
221
|
+
function isGenericInterfaceDeclaration(node) {
|
|
222
|
+
const length = node.typeParameters?.length;
|
|
223
|
+
return length ? length > 0 : false;
|
|
224
|
+
}
|
|
225
|
+
function isGenericTypeDeclaration(node) {
|
|
226
|
+
const length = node.typeParameters?.length;
|
|
227
|
+
return length ? length > 0 : false;
|
|
228
|
+
}
|
|
229
|
+
function isTypeReferenceGeneric(node, typeChecker) {
|
|
230
|
+
const symbol = typeChecker.getSymbolAtLocation(node.typeName);
|
|
231
|
+
if (symbol && symbol.declarations) {
|
|
232
|
+
return symbol.declarations[0].kind === import_typescript2.default.SyntaxKind.TypeParameter;
|
|
233
|
+
}
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
function isTopLevelDeclaration(node) {
|
|
237
|
+
return node.kind === import_typescript2.default.SyntaxKind.InterfaceDeclaration || node.kind === import_typescript2.default.SyntaxKind.TypeAliasDeclaration;
|
|
238
|
+
}
|
|
239
|
+
function isTopLevelNode(node) {
|
|
240
|
+
return node.kind === import_typescript2.default.SyntaxKind.InterfaceDeclaration || node.kind === import_typescript2.default.SyntaxKind.TypeAliasDeclaration || node.kind === import_typescript2.default.SyntaxKind.VariableStatement;
|
|
241
|
+
}
|
|
242
|
+
function isGenericNodeType(nt) {
|
|
243
|
+
return nt.genericTokens?.length > 0;
|
|
244
|
+
}
|
|
245
|
+
function isGenericNamedType(nt) {
|
|
246
|
+
return nt.genericTokens?.length > 0;
|
|
247
|
+
}
|
|
248
|
+
function isPrimitiveTypeNode(node) {
|
|
249
|
+
return node.type === "string" || node.type === "number" || node.type === "boolean" || node.type === "null" || node.type === "any" || node.type === "never" || node.type === "undefined" || node.type === "unknown" || node.type === "void";
|
|
250
|
+
}
|
|
251
|
+
function isNonNullable(a) {
|
|
252
|
+
return a !== null || a !== void 0;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/utils/src/validation-helpers.ts
|
|
256
|
+
function propertyToTuple(node) {
|
|
257
|
+
let key = node.children?.[0].value;
|
|
258
|
+
if (key.includes("-")) {
|
|
259
|
+
key = `'${key}'`;
|
|
260
|
+
}
|
|
261
|
+
return {
|
|
262
|
+
key,
|
|
263
|
+
value: node.children?.[1]
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
function makePropertyMap(node) {
|
|
267
|
+
const m = /* @__PURE__ */ new Map();
|
|
268
|
+
node.children?.forEach((child) => {
|
|
269
|
+
const property = propertyToTuple(child);
|
|
270
|
+
m.set(property.key, property.value);
|
|
271
|
+
});
|
|
272
|
+
return m;
|
|
273
|
+
}
|
|
274
|
+
function isNode(obj) {
|
|
275
|
+
return typeof obj !== "string" || typeof obj !== "number" || typeof obj !== "boolean";
|
|
276
|
+
}
|
|
277
|
+
function computeExtends(a, b) {
|
|
278
|
+
if ((a.type === "any" || a.type === "unknown") && (b.type === "any" || b.type === "unknown")) {
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
if ((a.type === "null" || a.type === "undefined") && (b.type === "null" || b.type === "undefined")) {
|
|
282
|
+
return true;
|
|
283
|
+
}
|
|
284
|
+
if (a.type === b.type) {
|
|
285
|
+
if (isPrimitiveTypeNode(a) && isPrimitiveTypeNode(b)) {
|
|
286
|
+
if (a.const && b.const) {
|
|
287
|
+
if (a.const === b.const) {
|
|
288
|
+
return true;
|
|
289
|
+
}
|
|
290
|
+
} else {
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
if (a.type === "ref" && b.type === "ref") {
|
|
295
|
+
return a.ref === b.ref;
|
|
296
|
+
}
|
|
297
|
+
if (a.type === "object" && b.type === "object") {
|
|
298
|
+
for (const property in b.properties) {
|
|
299
|
+
const propertyNode = b.properties[property];
|
|
300
|
+
if (!a.properties[property] || !computeExtends(a.properties[property].node, propertyNode.node)) {
|
|
301
|
+
return false;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return true;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (isPrimitiveTypeNode(a) && b.type === "or") {
|
|
308
|
+
return b.or.every((member) => computeExtends(a, member));
|
|
309
|
+
}
|
|
310
|
+
if (isPrimitiveTypeNode(b) && a.type === "or") {
|
|
311
|
+
return a.or.every((member) => computeExtends(b, member));
|
|
312
|
+
}
|
|
313
|
+
if (a.type === "or" && b.type === "or") {
|
|
314
|
+
return a.or.every((x) => b.or.some((y) => computeExtends(x, y)));
|
|
315
|
+
}
|
|
316
|
+
return false;
|
|
317
|
+
}
|
|
318
|
+
function resolveConditional(conditional) {
|
|
319
|
+
const { left, right } = conditional.check;
|
|
320
|
+
const conditionalResult = computeExtends(left, right) ? conditional.value.true : conditional.value.false;
|
|
321
|
+
if (isGenericNodeType(conditional)) {
|
|
322
|
+
const genericMap = /* @__PURE__ */ new Map();
|
|
323
|
+
conditional.genericTokens.forEach((token) => {
|
|
324
|
+
genericMap.set(
|
|
325
|
+
token.symbol,
|
|
326
|
+
token.default ?? token.constraints ?? { type: "any" }
|
|
327
|
+
);
|
|
328
|
+
});
|
|
329
|
+
return fillInGenerics(conditionalResult, genericMap);
|
|
330
|
+
}
|
|
331
|
+
return conditionalResult;
|
|
332
|
+
}
|
|
333
|
+
function resolveReferenceNode(genericReference, typeToFill) {
|
|
334
|
+
const genericArgs = genericReference.genericArguments;
|
|
335
|
+
const genericMap = /* @__PURE__ */ new Map();
|
|
336
|
+
if (genericArgs && isGenericNodeType(typeToFill)) {
|
|
337
|
+
typeToFill.genericTokens.forEach((token, index) => {
|
|
338
|
+
genericMap.set(
|
|
339
|
+
token.symbol,
|
|
340
|
+
genericArgs[index] ?? token.default ?? token.constraints
|
|
341
|
+
);
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
const filledInNode = fillInGenerics(typeToFill, genericMap);
|
|
345
|
+
if (isGenericNodeType(filledInNode) && genericArgs?.length) {
|
|
346
|
+
if (genericArgs.length < filledInNode.genericTokens.length) {
|
|
347
|
+
filledInNode.genericTokens = filledInNode.genericTokens.slice(
|
|
348
|
+
genericArgs?.length
|
|
349
|
+
);
|
|
350
|
+
} else if (genericArgs.length === filledInNode.genericTokens.length) {
|
|
351
|
+
filledInNode.genericTokens = [];
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
if (genericReference.property && filledInNode.type === "object") {
|
|
355
|
+
return filledInNode.properties[genericReference.property]?.node ?? filledInNode.additionalProperties ?? { type: "undefined" };
|
|
356
|
+
}
|
|
357
|
+
return filledInNode;
|
|
358
|
+
}
|
|
359
|
+
function computeEffectiveObject(base, operand, errorOnOverlap = true) {
|
|
360
|
+
const baseObjectName = base.name ?? base.title ?? "object literal";
|
|
361
|
+
const operandObjectName = operand.name ?? operand.title ?? "object literal";
|
|
362
|
+
const newObject = {
|
|
363
|
+
...JSON.parse(JSON.stringify(base)),
|
|
364
|
+
name: `${baseObjectName} & ${operandObjectName}`,
|
|
365
|
+
description: `Effective type combining ${baseObjectName} and ${operandObjectName}`,
|
|
366
|
+
genericTokens: [
|
|
367
|
+
...isGenericNodeType(base) ? base.genericTokens : [],
|
|
368
|
+
...isGenericNodeType(operand) ? operand.genericTokens : []
|
|
369
|
+
]
|
|
370
|
+
};
|
|
371
|
+
for (const property in operand.properties) {
|
|
372
|
+
if (newObject.properties[property] !== void 0 && errorOnOverlap) {
|
|
373
|
+
if (!computeExtends(
|
|
374
|
+
newObject.properties[property].node,
|
|
375
|
+
operand.properties[property].node
|
|
376
|
+
)) {
|
|
377
|
+
throw new Error(
|
|
378
|
+
`Can't compute effective type for ${baseObjectName} and ${operandObjectName} because of conflicting properties ${property}`
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
newObject.properties[property] = operand.properties[property];
|
|
383
|
+
}
|
|
384
|
+
if (newObject.additionalProperties && operand.additionalProperties) {
|
|
385
|
+
if (!isPrimitiveTypeNode(newObject.additionalProperties) || !isPrimitiveTypeNode(operand.additionalProperties) || newObject.additionalProperties.type !== operand.additionalProperties.type) {
|
|
386
|
+
newObject.additionalProperties = {
|
|
387
|
+
type: "and",
|
|
388
|
+
and: [newObject.additionalProperties, operand.additionalProperties]
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
} else if (operand.additionalProperties) {
|
|
392
|
+
newObject.additionalProperties = operand.additionalProperties;
|
|
393
|
+
}
|
|
394
|
+
return newObject;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/utils/src/ts-helpers.ts
|
|
398
|
+
function tsStripOptionalType(node) {
|
|
399
|
+
return import_typescript3.default.isOptionalTypeNode(node) ? node.type : node;
|
|
400
|
+
}
|
|
401
|
+
function isExportedDeclaration(node) {
|
|
402
|
+
const modifiers = import_typescript3.default.canHaveModifiers(node) ? import_typescript3.default.getModifiers(node) : void 0;
|
|
403
|
+
if (modifiers) {
|
|
404
|
+
return modifiers.some((m) => m.kind === import_typescript3.default.SyntaxKind.ExportKeyword);
|
|
405
|
+
}
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
function isNodeExported(node) {
|
|
409
|
+
return (import_typescript3.default.getCombinedModifierFlags(node) & import_typescript3.default.ModifierFlags.Export) !== 0 || !!node.parent && node.parent.kind === import_typescript3.default.SyntaxKind.SourceFile;
|
|
410
|
+
}
|
|
411
|
+
function getReferencedType(node, typeChecker) {
|
|
412
|
+
let symbol = typeChecker.getSymbolAtLocation(node.typeName);
|
|
413
|
+
if (symbol && (symbol.flags & import_typescript3.default.SymbolFlags.Alias) === import_typescript3.default.SymbolFlags.Alias) {
|
|
414
|
+
symbol = typeChecker.getAliasedSymbol(symbol);
|
|
415
|
+
}
|
|
416
|
+
const varDecl = symbol?.declarations?.[0];
|
|
417
|
+
if (varDecl && (import_typescript3.default.isInterfaceDeclaration(varDecl) || import_typescript3.default.isTypeAliasDeclaration(varDecl))) {
|
|
418
|
+
return { declaration: varDecl, exported: isNodeExported(varDecl) };
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
function getStringLiteralsFromUnion(node) {
|
|
422
|
+
if (import_typescript3.default.isUnionTypeNode(node)) {
|
|
423
|
+
return new Set(
|
|
424
|
+
node.types.map((type) => {
|
|
425
|
+
if (import_typescript3.default.isLiteralTypeNode(type) && import_typescript3.default.isStringLiteral(type.literal)) {
|
|
426
|
+
return type.literal.text;
|
|
427
|
+
}
|
|
428
|
+
return "";
|
|
429
|
+
})
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
if (import_typescript3.default.isLiteralTypeNode(node) && import_typescript3.default.isStringLiteral(node.literal)) {
|
|
433
|
+
return /* @__PURE__ */ new Set([node.literal.text]);
|
|
434
|
+
}
|
|
435
|
+
return /* @__PURE__ */ new Set();
|
|
436
|
+
}
|
|
437
|
+
function buildTemplateRegex(node, typeChecker) {
|
|
438
|
+
let regex = node.head.text;
|
|
439
|
+
node.templateSpans.forEach((span) => {
|
|
440
|
+
let type = span.type.kind;
|
|
441
|
+
if (import_typescript3.default.isTypeReferenceNode(span.type)) {
|
|
442
|
+
let symbol = typeChecker.getSymbolAtLocation(
|
|
443
|
+
span.type.typeName
|
|
444
|
+
);
|
|
445
|
+
if (symbol && (symbol.flags & import_typescript3.default.SymbolFlags.Alias) === import_typescript3.default.SymbolFlags.Alias) {
|
|
446
|
+
symbol = typeChecker.getAliasedSymbol(symbol);
|
|
447
|
+
}
|
|
448
|
+
type = (symbol?.declarations?.[0]).type.kind;
|
|
449
|
+
}
|
|
450
|
+
if (type === import_typescript3.default.SyntaxKind.StringKeyword) {
|
|
451
|
+
regex += ".*";
|
|
452
|
+
} else if (type === import_typescript3.default.SyntaxKind.NumberKeyword) {
|
|
453
|
+
regex += "[0-9]*";
|
|
454
|
+
} else if (type === import_typescript3.default.SyntaxKind.BooleanKeyword) {
|
|
455
|
+
regex += "true|false";
|
|
456
|
+
}
|
|
457
|
+
regex += span.literal.text;
|
|
458
|
+
});
|
|
459
|
+
return regex;
|
|
460
|
+
}
|
|
461
|
+
function fillInGenerics(xlrNode, generics) {
|
|
462
|
+
let localGenerics;
|
|
463
|
+
if (generics) {
|
|
464
|
+
localGenerics = new Map(generics);
|
|
465
|
+
} else {
|
|
466
|
+
localGenerics = /* @__PURE__ */ new Map();
|
|
467
|
+
if (isGenericNodeType(xlrNode)) {
|
|
468
|
+
xlrNode.genericTokens?.forEach((token) => {
|
|
469
|
+
const genericValue = token.default ?? token.constraints;
|
|
470
|
+
localGenerics.set(
|
|
471
|
+
token.symbol,
|
|
472
|
+
fillInGenerics(genericValue, localGenerics)
|
|
473
|
+
);
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
if (xlrNode.type === "ref") {
|
|
478
|
+
if (localGenerics.has(xlrNode.ref)) {
|
|
479
|
+
return {
|
|
480
|
+
...localGenerics.get(xlrNode.ref),
|
|
481
|
+
...xlrNode.genericArguments ? {
|
|
482
|
+
genericArguments: xlrNode.genericArguments.map(
|
|
483
|
+
(ga) => fillInGenerics(ga, localGenerics)
|
|
484
|
+
)
|
|
485
|
+
} : {},
|
|
486
|
+
...xlrNode.title ? { title: xlrNode.title } : {},
|
|
487
|
+
...xlrNode.name ? { name: xlrNode.name } : {},
|
|
488
|
+
...xlrNode.description ? { description: xlrNode.description } : {},
|
|
489
|
+
...xlrNode.comment ? { comment: xlrNode.comment } : {}
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
return {
|
|
493
|
+
...xlrNode,
|
|
494
|
+
...xlrNode.genericArguments ? {
|
|
495
|
+
genericArguments: xlrNode.genericArguments.map(
|
|
496
|
+
(ga) => fillInGenerics(ga, localGenerics)
|
|
497
|
+
)
|
|
498
|
+
} : {}
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
if (xlrNode.type === "object") {
|
|
502
|
+
const newProperties = {};
|
|
503
|
+
Object.getOwnPropertyNames(xlrNode.properties).forEach((propName) => {
|
|
504
|
+
const prop = xlrNode.properties[propName];
|
|
505
|
+
newProperties[propName] = {
|
|
506
|
+
required: prop.required,
|
|
507
|
+
node: fillInGenerics(prop.node, localGenerics)
|
|
508
|
+
};
|
|
509
|
+
});
|
|
510
|
+
return {
|
|
511
|
+
...xlrNode,
|
|
512
|
+
properties: newProperties,
|
|
513
|
+
...isGenericNamedType(xlrNode) ? {
|
|
514
|
+
genericTokens: xlrNode.genericTokens.map((token) => {
|
|
515
|
+
return {
|
|
516
|
+
...token,
|
|
517
|
+
constraints: token.constraints ? fillInGenerics(token.constraints, localGenerics) : void 0,
|
|
518
|
+
default: token.default ? fillInGenerics(token.default, localGenerics) : void 0
|
|
519
|
+
};
|
|
520
|
+
})
|
|
521
|
+
} : {},
|
|
522
|
+
extends: xlrNode.extends ? fillInGenerics(xlrNode.extends, localGenerics) : void 0,
|
|
523
|
+
additionalProperties: xlrNode.additionalProperties ? fillInGenerics(xlrNode.additionalProperties, localGenerics) : false
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
if (xlrNode.type === "array") {
|
|
527
|
+
return {
|
|
528
|
+
...xlrNode,
|
|
529
|
+
elementType: fillInGenerics(xlrNode.elementType, localGenerics)
|
|
530
|
+
};
|
|
531
|
+
} else if (xlrNode.type === "or" || xlrNode.type === "and") {
|
|
532
|
+
let pointer;
|
|
533
|
+
if (xlrNode.type === "or") {
|
|
534
|
+
pointer = xlrNode.or;
|
|
535
|
+
} else {
|
|
536
|
+
pointer = xlrNode.and;
|
|
537
|
+
}
|
|
538
|
+
return {
|
|
539
|
+
...xlrNode,
|
|
540
|
+
[xlrNode.type]: pointer.map((prop) => {
|
|
541
|
+
return fillInGenerics(prop, localGenerics);
|
|
542
|
+
})
|
|
543
|
+
};
|
|
544
|
+
} else if (xlrNode.type === "record") {
|
|
545
|
+
return {
|
|
546
|
+
...xlrNode,
|
|
547
|
+
keyType: fillInGenerics(xlrNode.keyType, localGenerics),
|
|
548
|
+
valueType: fillInGenerics(xlrNode.valueType, localGenerics)
|
|
549
|
+
};
|
|
550
|
+
} else if (xlrNode.type === "conditional") {
|
|
551
|
+
const filledInConditional = {
|
|
552
|
+
...xlrNode,
|
|
553
|
+
check: {
|
|
554
|
+
left: fillInGenerics(xlrNode.check.left, localGenerics),
|
|
555
|
+
right: fillInGenerics(xlrNode.check.right, localGenerics)
|
|
556
|
+
},
|
|
557
|
+
value: {
|
|
558
|
+
true: fillInGenerics(xlrNode.value.true, localGenerics),
|
|
559
|
+
false: fillInGenerics(xlrNode.value.false, localGenerics)
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
if (filledInConditional.check.left.type !== "ref" && filledInConditional.check.right.type !== "ref") {
|
|
563
|
+
return {
|
|
564
|
+
name: xlrNode.name,
|
|
565
|
+
title: xlrNode.title,
|
|
566
|
+
...resolveConditional(filledInConditional)
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
return filledInConditional;
|
|
570
|
+
}
|
|
571
|
+
return xlrNode;
|
|
572
|
+
}
|
|
573
|
+
function applyPickOrOmitToNodeType(baseObject, operation, properties) {
|
|
574
|
+
if (baseObject.type === "object") {
|
|
575
|
+
const newObject = { ...baseObject };
|
|
576
|
+
Object.keys(baseObject.properties).forEach((key) => {
|
|
577
|
+
if (operation === "Omit" && properties.has(key) || operation === "Pick" && !properties.has(key)) {
|
|
578
|
+
delete newObject.properties[key];
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
if (Object.keys(newObject.properties).length === 0 && (operation !== "Omit" || newObject.additionalProperties === false)) {
|
|
582
|
+
return void 0;
|
|
583
|
+
}
|
|
584
|
+
return newObject;
|
|
585
|
+
}
|
|
586
|
+
let pointer;
|
|
587
|
+
if (baseObject.type === "and") {
|
|
588
|
+
pointer = baseObject.and;
|
|
589
|
+
} else if (baseObject.type === "or") {
|
|
590
|
+
pointer = baseObject.or;
|
|
591
|
+
} else {
|
|
592
|
+
throw new Error(
|
|
593
|
+
`Error: Can not apply ${operation} to type ${baseObject.type}`
|
|
594
|
+
);
|
|
595
|
+
}
|
|
596
|
+
const pickedTypes = pointer.map((type) => {
|
|
597
|
+
const node = applyPickOrOmitToNodeType(type, operation, properties);
|
|
598
|
+
if (node === void 0) {
|
|
599
|
+
return void 0;
|
|
600
|
+
}
|
|
601
|
+
return { ...node, additionalProperties: false };
|
|
602
|
+
}).filter((type) => type !== void 0);
|
|
603
|
+
if (pickedTypes.length === 0) {
|
|
604
|
+
return void 0;
|
|
605
|
+
}
|
|
606
|
+
if (pickedTypes.length === 1) {
|
|
607
|
+
return pickedTypes[0];
|
|
608
|
+
}
|
|
609
|
+
if (baseObject.type === "and") {
|
|
610
|
+
return { ...baseObject, and: pickedTypes };
|
|
611
|
+
}
|
|
612
|
+
return { ...baseObject, or: pickedTypes };
|
|
613
|
+
}
|
|
614
|
+
function applyPartialOrRequiredToNodeType(baseObject, modifier) {
|
|
615
|
+
if (baseObject.type === "object") {
|
|
616
|
+
const newObject = { ...baseObject };
|
|
617
|
+
Object.keys(baseObject.properties).forEach((key) => {
|
|
618
|
+
newObject.properties[key].required = modifier;
|
|
619
|
+
});
|
|
620
|
+
return newObject;
|
|
621
|
+
}
|
|
622
|
+
if (baseObject.type === "and") {
|
|
623
|
+
const pickedTypes = baseObject.and.map(
|
|
624
|
+
(type) => applyPartialOrRequiredToNodeType(type, modifier)
|
|
625
|
+
);
|
|
626
|
+
return { ...baseObject, and: pickedTypes };
|
|
627
|
+
}
|
|
628
|
+
if (baseObject.type === "or") {
|
|
629
|
+
const pickedTypes = baseObject.or.map(
|
|
630
|
+
(type) => applyPartialOrRequiredToNodeType(type, modifier)
|
|
631
|
+
);
|
|
632
|
+
return { ...baseObject, or: pickedTypes };
|
|
633
|
+
}
|
|
634
|
+
throw new Error(
|
|
635
|
+
`Error: Can not apply ${modifier ? "Required" : "Partial"} to type ${baseObject.type}`
|
|
636
|
+
);
|
|
637
|
+
}
|
|
638
|
+
function applyExcludeToNodeType(baseObject, filters) {
|
|
639
|
+
const remainingMembers = baseObject.or.filter((type) => {
|
|
640
|
+
if (filters.type === "or") {
|
|
641
|
+
return !filters.or.some((filter) => computeExtends(type, filter));
|
|
642
|
+
}
|
|
643
|
+
return !computeExtends(type, filters);
|
|
644
|
+
});
|
|
645
|
+
if (remainingMembers.length === 1) {
|
|
646
|
+
return remainingMembers[0];
|
|
647
|
+
}
|
|
648
|
+
return {
|
|
649
|
+
...baseObject,
|
|
650
|
+
or: remainingMembers
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/utils/src/documentation.ts
|
|
655
|
+
var import_typescript4 = __toESM(require("typescript"));
|
|
656
|
+
var { SymbolDisplayPartKind, displayPartsToString } = import_typescript4.default;
|
|
657
|
+
function insertBetweenElements(array, separator) {
|
|
658
|
+
return array.reduce((acc, item, index) => {
|
|
659
|
+
if (index === 0) {
|
|
660
|
+
return [item];
|
|
661
|
+
}
|
|
662
|
+
return [...acc, separator, item];
|
|
663
|
+
}, []);
|
|
664
|
+
}
|
|
665
|
+
function createTSDocString(node) {
|
|
666
|
+
if (node.type === "ref") {
|
|
667
|
+
return [
|
|
668
|
+
{
|
|
669
|
+
text: node.ref,
|
|
670
|
+
kind: SymbolDisplayPartKind.keyword
|
|
671
|
+
}
|
|
672
|
+
];
|
|
673
|
+
}
|
|
674
|
+
if (node.type === "or" || node.type === "and") {
|
|
675
|
+
const items = node.type === "and" ? node.and : node.or;
|
|
676
|
+
return insertBetweenElements(
|
|
677
|
+
items.map((subnode) => createTSDocString(subnode)),
|
|
678
|
+
[
|
|
679
|
+
{
|
|
680
|
+
kind: SymbolDisplayPartKind.punctuation,
|
|
681
|
+
text: node.type === "and" ? " & " : " | "
|
|
682
|
+
}
|
|
683
|
+
]
|
|
684
|
+
).flat();
|
|
685
|
+
}
|
|
686
|
+
if (node.type === "function") {
|
|
687
|
+
return [
|
|
688
|
+
{
|
|
689
|
+
kind: SymbolDisplayPartKind.keyword,
|
|
690
|
+
text: "function"
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
kind: SymbolDisplayPartKind.space,
|
|
694
|
+
text: " "
|
|
695
|
+
},
|
|
696
|
+
...node.name ? [{ text: node.name, kind: SymbolDisplayPartKind.methodName }] : [],
|
|
697
|
+
{
|
|
698
|
+
kind: SymbolDisplayPartKind.punctuation,
|
|
699
|
+
text: "("
|
|
700
|
+
},
|
|
701
|
+
...insertBetweenElements(
|
|
702
|
+
node.parameters.map((p) => {
|
|
703
|
+
if (p.name) {
|
|
704
|
+
return [
|
|
705
|
+
{
|
|
706
|
+
kind: SymbolDisplayPartKind.parameterName,
|
|
707
|
+
text: p.name
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
kind: SymbolDisplayPartKind.punctuation,
|
|
711
|
+
text: p.optional ? "?" : ""
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
kind: SymbolDisplayPartKind.punctuation,
|
|
715
|
+
text: ": "
|
|
716
|
+
},
|
|
717
|
+
...createTSDocString(p.type)
|
|
718
|
+
];
|
|
719
|
+
}
|
|
720
|
+
return createTSDocString(p.type);
|
|
721
|
+
}),
|
|
722
|
+
[
|
|
723
|
+
{
|
|
724
|
+
kind: SymbolDisplayPartKind.punctuation,
|
|
725
|
+
text: ", "
|
|
726
|
+
}
|
|
727
|
+
]
|
|
728
|
+
).flat(),
|
|
729
|
+
{
|
|
730
|
+
kind: SymbolDisplayPartKind.punctuation,
|
|
731
|
+
text: ")"
|
|
732
|
+
},
|
|
733
|
+
...node.returnType ? [
|
|
734
|
+
{
|
|
735
|
+
kind: SymbolDisplayPartKind.punctuation,
|
|
736
|
+
text: ": "
|
|
737
|
+
},
|
|
738
|
+
...createTSDocString(node.returnType)
|
|
739
|
+
] : []
|
|
740
|
+
];
|
|
741
|
+
}
|
|
742
|
+
if (node.type === "tuple") {
|
|
743
|
+
return [
|
|
744
|
+
{
|
|
745
|
+
kind: SymbolDisplayPartKind.punctuation,
|
|
746
|
+
text: "["
|
|
747
|
+
},
|
|
748
|
+
...insertBetweenElements(
|
|
749
|
+
node.elementTypes.map((t) => {
|
|
750
|
+
if (t.name) {
|
|
751
|
+
return [
|
|
752
|
+
{
|
|
753
|
+
kind: SymbolDisplayPartKind.propertyName,
|
|
754
|
+
text: t.name
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
kind: SymbolDisplayPartKind.punctuation,
|
|
758
|
+
text: ": "
|
|
759
|
+
},
|
|
760
|
+
...createTSDocString(t.type)
|
|
761
|
+
];
|
|
762
|
+
}
|
|
763
|
+
return createTSDocString(t.type);
|
|
764
|
+
}),
|
|
765
|
+
[
|
|
766
|
+
{
|
|
767
|
+
kind: SymbolDisplayPartKind.punctuation,
|
|
768
|
+
text: ", "
|
|
769
|
+
}
|
|
770
|
+
]
|
|
771
|
+
).flat(),
|
|
772
|
+
{
|
|
773
|
+
kind: SymbolDisplayPartKind.punctuation,
|
|
774
|
+
text: "]"
|
|
775
|
+
}
|
|
776
|
+
];
|
|
777
|
+
}
|
|
778
|
+
if (node.type === "array") {
|
|
779
|
+
return [
|
|
780
|
+
{
|
|
781
|
+
kind: SymbolDisplayPartKind.interfaceName,
|
|
782
|
+
text: "Array"
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
kind: SymbolDisplayPartKind.punctuation,
|
|
786
|
+
text: "<"
|
|
787
|
+
},
|
|
788
|
+
...createTSDocString(node.elementType),
|
|
789
|
+
{
|
|
790
|
+
kind: SymbolDisplayPartKind.punctuation,
|
|
791
|
+
text: ">"
|
|
792
|
+
}
|
|
793
|
+
];
|
|
794
|
+
}
|
|
795
|
+
if (node.type === "record") {
|
|
796
|
+
return [
|
|
797
|
+
{
|
|
798
|
+
kind: SymbolDisplayPartKind.interfaceName,
|
|
799
|
+
text: "Record"
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
kind: SymbolDisplayPartKind.punctuation,
|
|
803
|
+
text: "<"
|
|
804
|
+
},
|
|
805
|
+
...createTSDocString(node.keyType),
|
|
806
|
+
{
|
|
807
|
+
kind: SymbolDisplayPartKind.punctuation,
|
|
808
|
+
text: ", "
|
|
809
|
+
},
|
|
810
|
+
...createTSDocString(node.valueType),
|
|
811
|
+
{
|
|
812
|
+
kind: SymbolDisplayPartKind.punctuation,
|
|
813
|
+
text: ">"
|
|
814
|
+
}
|
|
815
|
+
];
|
|
816
|
+
}
|
|
817
|
+
if ((node.type === "string" || node.type === "boolean" || node.type === "number") && node.const !== void 0) {
|
|
818
|
+
return [
|
|
819
|
+
{
|
|
820
|
+
kind: SymbolDisplayPartKind.keyword,
|
|
821
|
+
text: typeof node.const === "string" ? `"${node.const}"` : String(node.const)
|
|
822
|
+
}
|
|
823
|
+
];
|
|
824
|
+
}
|
|
825
|
+
if (isPrimitiveTypeNode(node) && node.type !== "null") {
|
|
826
|
+
return [
|
|
827
|
+
{
|
|
828
|
+
kind: SymbolDisplayPartKind.keyword,
|
|
829
|
+
text: node.type
|
|
830
|
+
}
|
|
831
|
+
];
|
|
832
|
+
}
|
|
833
|
+
if (node.type === "object" && node.name) {
|
|
834
|
+
return [
|
|
835
|
+
{
|
|
836
|
+
kind: SymbolDisplayPartKind.interfaceName,
|
|
837
|
+
text: node.name
|
|
838
|
+
}
|
|
839
|
+
];
|
|
840
|
+
}
|
|
841
|
+
return [
|
|
842
|
+
{
|
|
843
|
+
kind: SymbolDisplayPartKind.localName,
|
|
844
|
+
text: node.type
|
|
845
|
+
}
|
|
846
|
+
];
|
|
847
|
+
}
|
|
848
|
+
function symbolDisplayToString(displayParts) {
|
|
849
|
+
return displayPartsToString(displayParts);
|
|
850
|
+
}
|
|
851
|
+
function createDocString(node) {
|
|
852
|
+
return symbolDisplayToString(createTSDocString(node));
|
|
853
|
+
}
|
|
854
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
855
|
+
0 && (module.exports = {
|
|
856
|
+
applyExcludeToNodeType,
|
|
857
|
+
applyPartialOrRequiredToNodeType,
|
|
858
|
+
applyPickOrOmitToNodeType,
|
|
859
|
+
buildTemplateRegex,
|
|
860
|
+
computeEffectiveObject,
|
|
861
|
+
computeExtends,
|
|
862
|
+
createDocString,
|
|
863
|
+
createTSDocString,
|
|
864
|
+
decorateNode,
|
|
865
|
+
fillInGenerics,
|
|
866
|
+
getReferencedType,
|
|
867
|
+
getStringLiteralsFromUnion,
|
|
868
|
+
isExportedDeclaration,
|
|
869
|
+
isGenericInterfaceDeclaration,
|
|
870
|
+
isGenericNamedType,
|
|
871
|
+
isGenericNodeType,
|
|
872
|
+
isGenericTypeDeclaration,
|
|
873
|
+
isNode,
|
|
874
|
+
isNodeExported,
|
|
875
|
+
isNonNullable,
|
|
876
|
+
isOptionalProperty,
|
|
877
|
+
isPrimitiveTypeNode,
|
|
878
|
+
isTopLevelDeclaration,
|
|
879
|
+
isTopLevelNode,
|
|
880
|
+
isTypeReferenceGeneric,
|
|
881
|
+
makePropertyMap,
|
|
882
|
+
propertyToTuple,
|
|
883
|
+
resolveConditional,
|
|
884
|
+
resolveReferenceNode,
|
|
885
|
+
symbolDisplayToString,
|
|
886
|
+
tsStripOptionalType
|
|
887
|
+
});
|
|
888
|
+
//# sourceMappingURL=index.cjs.map
|