@typespec/tspd 0.70.0-dev.2 → 0.70.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/src/cli.js +85 -103
- package/dist/src/gen-extern-signatures/components/decorator-signature-tests.d.ts +8 -0
- package/dist/src/gen-extern-signatures/components/decorator-signature-tests.d.ts.map +1 -0
- package/dist/src/gen-extern-signatures/components/decorator-signature-tests.js +16 -0
- package/dist/src/gen-extern-signatures/components/decorator-signature-tests.jsx +12 -0
- package/dist/src/gen-extern-signatures/components/decorator-signature-tests.jsx.map +1 -0
- package/dist/src/gen-extern-signatures/components/decorator-signature-type.d.ts +16 -0
- package/dist/src/gen-extern-signatures/components/decorator-signature-type.d.ts.map +1 -0
- package/dist/src/gen-extern-signatures/components/decorator-signature-type.js +404 -0
- package/dist/src/gen-extern-signatures/components/decorator-signature-type.jsx +316 -0
- package/dist/src/gen-extern-signatures/components/decorator-signature-type.jsx.map +1 -0
- package/dist/src/gen-extern-signatures/components/decorators-signatures.d.ts +12 -0
- package/dist/src/gen-extern-signatures/components/decorators-signatures.d.ts.map +1 -0
- package/dist/src/gen-extern-signatures/components/decorators-signatures.js +107 -0
- package/dist/src/gen-extern-signatures/components/decorators-signatures.jsx +60 -0
- package/dist/src/gen-extern-signatures/components/decorators-signatures.jsx.map +1 -0
- package/dist/src/gen-extern-signatures/components/dollar-decorators-type.d.ts +10 -0
- package/dist/src/gen-extern-signatures/components/dollar-decorators-type.d.ts.map +1 -0
- package/dist/src/gen-extern-signatures/components/dollar-decorators-type.js +39 -0
- package/dist/src/gen-extern-signatures/components/dollar-decorators-type.jsx +18 -0
- package/dist/src/gen-extern-signatures/components/dollar-decorators-type.jsx.map +1 -0
- package/dist/src/gen-extern-signatures/components/tspd-context.d.ts +10 -0
- package/dist/src/gen-extern-signatures/components/tspd-context.d.ts.map +1 -0
- package/dist/src/gen-extern-signatures/components/tspd-context.js +22 -0
- package/dist/src/gen-extern-signatures/components/tspd-context.js.map +1 -0
- package/dist/src/gen-extern-signatures/doc-builder.js +10 -12
- package/dist/src/gen-extern-signatures/external-packages/compiler.d.ts +17 -0
- package/dist/src/gen-extern-signatures/external-packages/compiler.d.ts.map +1 -0
- package/dist/src/gen-extern-signatures/external-packages/compiler.js +10 -0
- package/dist/src/gen-extern-signatures/external-packages/compiler.js.map +1 -0
- package/dist/src/gen-extern-signatures/gen-extern-signatures.d.ts.map +1 -1
- package/dist/src/gen-extern-signatures/gen-extern-signatures.js +109 -102
- package/dist/src/gen-extern-signatures/gen-extern-signatures.js.map +1 -1
- package/dist/src/gen-extern-signatures/types.js +1 -2
- package/dist/src/ref-doc/api-docs.js +56 -56
- package/dist/src/ref-doc/emitters/docusaurus.js +156 -209
- package/dist/src/ref-doc/emitters/markdown.js +278 -327
- package/dist/src/ref-doc/emitters/starlight.js +154 -190
- package/dist/src/ref-doc/experimental.js +48 -45
- package/dist/src/ref-doc/extractor.js +486 -449
- package/dist/src/ref-doc/index.js +1 -2
- package/dist/src/ref-doc/lib.js +29 -26
- package/dist/src/ref-doc/types.js +1 -2
- package/dist/src/ref-doc/utils/markdown.js +37 -44
- package/dist/src/ref-doc/utils/type-signature.js +89 -98
- package/package.json +12 -9
- package/dist/src/gen-extern-signatures/decorators-signatures.d.ts +0 -5
- package/dist/src/gen-extern-signatures/decorators-signatures.d.ts.map +0 -1
- package/dist/src/gen-extern-signatures/decorators-signatures.js +0 -338
- package/dist/src/gen-extern-signatures/decorators-signatures.js.map +0 -1
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import * as ay from "@alloy-js/core";
|
|
2
|
+
import * as ts from "@alloy-js/typescript";
|
|
3
|
+
import { getSourceLocation, isArrayModelType, isUnknownType, } from "@typespec/compiler";
|
|
4
|
+
import { SyntaxKind } from "@typespec/compiler/ast";
|
|
5
|
+
import { typespecCompiler } from "../external-packages/compiler.js";
|
|
6
|
+
import { useTspd } from "./tspd-context.js";
|
|
7
|
+
/** Render the type of decorator implementation function */
|
|
8
|
+
export function DecoratorSignatureType(props) {
|
|
9
|
+
const { program } = useTspd();
|
|
10
|
+
const decorator = props.signature.decorator;
|
|
11
|
+
const parameters = [
|
|
12
|
+
{
|
|
13
|
+
name: "context",
|
|
14
|
+
type: typespecCompiler.DecoratorContext,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: decorator.target.name,
|
|
18
|
+
type: <TargetParameterTsType type={decorator.target.type.type}/>,
|
|
19
|
+
},
|
|
20
|
+
...decorator.parameters.map((param) => ({
|
|
21
|
+
// https://github.com/alloy-framework/alloy/issues/144
|
|
22
|
+
name: param.rest ? `...${param.name}` : param.name,
|
|
23
|
+
type: param.rest ? (<>
|
|
24
|
+
(
|
|
25
|
+
{param.type ? (<ParameterTsType constraint={extractRestParamConstraint(program, param.type)}/>) : undefined}
|
|
26
|
+
)[]
|
|
27
|
+
</>) : (<ParameterTsType constraint={param.type}/>),
|
|
28
|
+
optional: param.optional,
|
|
29
|
+
})),
|
|
30
|
+
];
|
|
31
|
+
return (<ts.TypeDeclaration export name={props.signature.typeName} doc={getDocComment(props.signature.decorator)}>
|
|
32
|
+
<ts.FunctionType parameters={parameters}/>
|
|
33
|
+
</ts.TypeDeclaration>);
|
|
34
|
+
}
|
|
35
|
+
/** For a rest param of constraint T[] or valueof T[] return the T or valueof T */
|
|
36
|
+
function extractRestParamConstraint(program, constraint) {
|
|
37
|
+
let valueType;
|
|
38
|
+
let type;
|
|
39
|
+
if (constraint.valueType) {
|
|
40
|
+
if (constraint.valueType.kind === "Model" && isArrayModelType(program, constraint.valueType)) {
|
|
41
|
+
valueType = constraint.valueType.indexer.value;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (constraint.type) {
|
|
48
|
+
if (constraint.type.kind === "Model" && isArrayModelType(program, constraint.type)) {
|
|
49
|
+
type = constraint.type.indexer.value;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
entityKind: "MixedParameterConstraint",
|
|
57
|
+
type,
|
|
58
|
+
valueType,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export function ParameterTsType({ constraint }) {
|
|
62
|
+
if (constraint.type && constraint.valueType) {
|
|
63
|
+
return (<>
|
|
64
|
+
<TypeConstraintTSType type={constraint.type}/>
|
|
65
|
+
{" | "}
|
|
66
|
+
<ValueTsType type={constraint.valueType}/>
|
|
67
|
+
</>);
|
|
68
|
+
}
|
|
69
|
+
if (constraint.valueType) {
|
|
70
|
+
return <ValueTsType type={constraint.valueType}/>;
|
|
71
|
+
}
|
|
72
|
+
else if (constraint.type) {
|
|
73
|
+
return <TypeConstraintTSType type={constraint.type}/>;
|
|
74
|
+
}
|
|
75
|
+
return typespecCompiler.Type;
|
|
76
|
+
}
|
|
77
|
+
function TargetParameterTsType(props) {
|
|
78
|
+
const type = props.type;
|
|
79
|
+
if (type === undefined) {
|
|
80
|
+
return typespecCompiler.Type;
|
|
81
|
+
}
|
|
82
|
+
if (type.kind === "Union") {
|
|
83
|
+
const variants = [...type.variants.values()].map((x) => x.type).map(getTargetType);
|
|
84
|
+
return ay.join(new Set(variants).values(), { joiner: " | " });
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
return getTargetType(type);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function getTargetType(type) {
|
|
91
|
+
if (type === undefined || isUnknownType(type)) {
|
|
92
|
+
return typespecCompiler.Type;
|
|
93
|
+
}
|
|
94
|
+
else if (type.kind === "Model" && isReflectionType(type)) {
|
|
95
|
+
return typespecCompiler[type.name];
|
|
96
|
+
}
|
|
97
|
+
else if (type.kind === "Scalar") {
|
|
98
|
+
// Special case for target type if it is a scalar type(e.g. `string`) then it can only be a Scalar.
|
|
99
|
+
// In the case of regular parameter it could also be a union of the scalar, or a literal matching the scalar or union of both,
|
|
100
|
+
// so we only change that when isTarget is true.
|
|
101
|
+
return typespecCompiler.Scalar;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
return typespecCompiler.Type;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function TypeConstraintTSType({ type }) {
|
|
108
|
+
if (type.kind === "Model" && isReflectionType(type)) {
|
|
109
|
+
return typespecCompiler[type.name];
|
|
110
|
+
}
|
|
111
|
+
else if (type.kind === "Union") {
|
|
112
|
+
const variants = [...type.variants.values()].map((x) => x.type);
|
|
113
|
+
if (variants.every((x) => isReflectionType(x))) {
|
|
114
|
+
return ay.join([...new Set(variants)].map((x) => getCompilerType(x.name)), {
|
|
115
|
+
joiner: " | ",
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
return typespecCompiler.Type;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return typespecCompiler.Type;
|
|
123
|
+
}
|
|
124
|
+
function getCompilerType(name) {
|
|
125
|
+
return typespecCompiler[name];
|
|
126
|
+
}
|
|
127
|
+
function ValueTsType({ type }) {
|
|
128
|
+
const { program } = useTspd();
|
|
129
|
+
switch (type.kind) {
|
|
130
|
+
case "Boolean":
|
|
131
|
+
return `${type.value}`;
|
|
132
|
+
case "String":
|
|
133
|
+
return `"${type.value}"`;
|
|
134
|
+
case "Number":
|
|
135
|
+
return `${type.value}`;
|
|
136
|
+
case "Scalar":
|
|
137
|
+
return <ScalarTsType scalar={type}/>;
|
|
138
|
+
case "Union":
|
|
139
|
+
return ay.join([...type.variants.values()].map((x) => <ValueTsType type={x.type}/>), { joiner: " | " });
|
|
140
|
+
case "Model":
|
|
141
|
+
if (isArrayModelType(program, type)) {
|
|
142
|
+
return (<>
|
|
143
|
+
readonly (<ValueTsType type={type.indexer.value}/>
|
|
144
|
+
)[]
|
|
145
|
+
</>);
|
|
146
|
+
}
|
|
147
|
+
else if (isReflectionType(type)) {
|
|
148
|
+
return getValueOfReflectionType(type);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
// If its exactly the record type use Record<string, T> instead of the model name.
|
|
152
|
+
if (type.indexer && type.name === "Record" && type.namespace?.name === "TypeSpec") {
|
|
153
|
+
return (<>
|
|
154
|
+
Record{"<string, "}
|
|
155
|
+
<ValueTsType type={type.indexer.value}/>
|
|
156
|
+
{">"}
|
|
157
|
+
</>);
|
|
158
|
+
}
|
|
159
|
+
if (type.name) {
|
|
160
|
+
return <LocalTypeReference type={type}/>;
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
return <ValueOfModelTsType model={type}/>;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return "unknown";
|
|
168
|
+
}
|
|
169
|
+
function LocalTypeReference({ type }) {
|
|
170
|
+
const { addLocalType } = useTspd();
|
|
171
|
+
addLocalType(type);
|
|
172
|
+
return <ts.Reference refkey={ay.refkey(type)}/>;
|
|
173
|
+
}
|
|
174
|
+
function ValueOfModelTsType({ model }) {
|
|
175
|
+
return (<ts.InterfaceExpression>
|
|
176
|
+
<ValueOfModelTsInterfaceBody model={model}/>
|
|
177
|
+
</ts.InterfaceExpression>);
|
|
178
|
+
}
|
|
179
|
+
export function ValueOfModelTsInterfaceBody({ model }) {
|
|
180
|
+
return (<ay.List joiner=";" enderPunctuation>
|
|
181
|
+
{model.indexer?.value && (<ts.InterfaceMember readonly indexer="key: string" type={<ValueTsType type={model.indexer.value}/>}/>)}
|
|
182
|
+
<ay.For each={model.properties.values()}>
|
|
183
|
+
{(x) => (<ts.InterfaceMember readonly name={x.name} optional={x.optional} type={<ValueTsType type={x.type}/>}/>)}
|
|
184
|
+
</ay.For>
|
|
185
|
+
</ay.List>);
|
|
186
|
+
}
|
|
187
|
+
function ScalarTsType({ scalar }) {
|
|
188
|
+
const { program } = useTspd();
|
|
189
|
+
const isStd = program.checker.isStdType(scalar);
|
|
190
|
+
if (isStd) {
|
|
191
|
+
return getStdScalarTSType(scalar);
|
|
192
|
+
}
|
|
193
|
+
else if (scalar.baseScalar) {
|
|
194
|
+
return <ScalarTsType scalar={scalar.baseScalar}/>;
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
return "unknown";
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function getStdScalarTSType(scalar) {
|
|
201
|
+
switch (scalar.name) {
|
|
202
|
+
case "numeric":
|
|
203
|
+
case "decimal":
|
|
204
|
+
case "decimal128":
|
|
205
|
+
case "float":
|
|
206
|
+
case "integer":
|
|
207
|
+
case "int64":
|
|
208
|
+
case "uint64":
|
|
209
|
+
return typespecCompiler.Numeric;
|
|
210
|
+
case "int8":
|
|
211
|
+
case "int16":
|
|
212
|
+
case "int32":
|
|
213
|
+
case "safeint":
|
|
214
|
+
case "uint8":
|
|
215
|
+
case "uint16":
|
|
216
|
+
case "uint32":
|
|
217
|
+
case "float64":
|
|
218
|
+
case "float32":
|
|
219
|
+
return "number";
|
|
220
|
+
case "string":
|
|
221
|
+
case "url":
|
|
222
|
+
return "string";
|
|
223
|
+
case "boolean":
|
|
224
|
+
return "boolean";
|
|
225
|
+
case "plainDate":
|
|
226
|
+
case "utcDateTime":
|
|
227
|
+
case "offsetDateTime":
|
|
228
|
+
case "plainTime":
|
|
229
|
+
case "duration":
|
|
230
|
+
case "bytes":
|
|
231
|
+
return "unknown";
|
|
232
|
+
default:
|
|
233
|
+
const _assertNever = scalar.name;
|
|
234
|
+
return "unknown";
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
function isReflectionType(type) {
|
|
238
|
+
return (type.kind === "Model" &&
|
|
239
|
+
type.namespace?.name === "Reflection" &&
|
|
240
|
+
type.namespace?.namespace?.name === "TypeSpec");
|
|
241
|
+
}
|
|
242
|
+
function getValueOfReflectionType(type) {
|
|
243
|
+
switch (type.name) {
|
|
244
|
+
case "EnumMember":
|
|
245
|
+
case "Enum":
|
|
246
|
+
return typespecCompiler.EnumValue;
|
|
247
|
+
case "Model":
|
|
248
|
+
return "Record<string, unknown>";
|
|
249
|
+
default:
|
|
250
|
+
return "unknown";
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
function getDocComment(type) {
|
|
254
|
+
const docs = type.node?.docs;
|
|
255
|
+
if (docs === undefined || docs.length === 0) {
|
|
256
|
+
return "";
|
|
257
|
+
}
|
|
258
|
+
const mainContentLines = [];
|
|
259
|
+
const tagLines = [];
|
|
260
|
+
for (const doc of docs) {
|
|
261
|
+
for (const content of doc.content) {
|
|
262
|
+
for (const line of content.text.split("\n")) {
|
|
263
|
+
mainContentLines.push(line);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
for (const tag of doc.tags) {
|
|
267
|
+
tagLines.push();
|
|
268
|
+
let first = true;
|
|
269
|
+
const hasContentFirstLine = checkIfTagHasDocOnSameLine(tag);
|
|
270
|
+
const tagStart = tag.kind === SyntaxKind.DocParamTag || tag.kind === SyntaxKind.DocTemplateTag
|
|
271
|
+
? `@${tag.tagName.sv} ${tag.paramName.sv}`
|
|
272
|
+
: `@${tag.tagName.sv}`;
|
|
273
|
+
for (const content of tag.content) {
|
|
274
|
+
for (const line of content.text.split("\n")) {
|
|
275
|
+
const cleaned = sanitizeDocComment(line);
|
|
276
|
+
if (first) {
|
|
277
|
+
if (hasContentFirstLine) {
|
|
278
|
+
tagLines.push(`${tagStart} ${cleaned}`);
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
tagLines.push(tagStart, cleaned);
|
|
282
|
+
}
|
|
283
|
+
first = false;
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
tagLines.push(cleaned);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
const docLines = [...mainContentLines, ...(tagLines.length > 0 ? [""] : []), ...tagLines];
|
|
293
|
+
return docLines.join("\n");
|
|
294
|
+
}
|
|
295
|
+
function sanitizeDocComment(doc) {
|
|
296
|
+
// Issue to escape @internal and other tsdoc tags https://github.com/microsoft/TypeScript/issues/47679
|
|
297
|
+
return doc.replaceAll("@internal", `@_internal`);
|
|
298
|
+
}
|
|
299
|
+
function checkIfTagHasDocOnSameLine(tag) {
|
|
300
|
+
const start = tag.content[0]?.pos;
|
|
301
|
+
const end = tag.content[0]?.end;
|
|
302
|
+
const file = getSourceLocation(tag.content[0]).file;
|
|
303
|
+
let hasFirstLine = false;
|
|
304
|
+
for (let i = start; i < end; i++) {
|
|
305
|
+
const ch = file.text[i];
|
|
306
|
+
if (ch === "\n") {
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
// Todo reuse compiler whitespace logic or have a way to get this info from the parser.
|
|
310
|
+
if (ch !== " ") {
|
|
311
|
+
hasFirstLine = true;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return hasFirstLine;
|
|
315
|
+
}
|
|
316
|
+
//# sourceMappingURL=decorator-signature-type.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorator-signature-type.jsx","sourceRoot":"","sources":["../../../../src/gen-extern-signatures/components/decorator-signature-type.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAOL,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAU,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAM5C,4DAA4D;AAC5D,MAAM,UAAU,sBAAsB,CAAC,KAAwC;IAC7E,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC;IAC5C,MAAM,UAAU,GAA6B;QAC3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AAG,IAAI,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as ay from "@alloy-js/core";
|
|
2
|
+
import { Program } from "@typespec/compiler";
|
|
3
|
+
import { DecoratorSignature } from "../types.js";
|
|
4
|
+
export interface DecoratorSignaturesProps {
|
|
5
|
+
decorators: DecoratorSignature[];
|
|
6
|
+
namespaceName: string;
|
|
7
|
+
dollarDecoratorsRefKey: ay.Refkey;
|
|
8
|
+
}
|
|
9
|
+
export declare function DecoratorSignatures({ namespaceName, decorators, dollarDecoratorsRefKey: dollarDecoratorsRefkey, }: DecoratorSignaturesProps): ay.Children;
|
|
10
|
+
export declare function LocalTypes(): ay.Children;
|
|
11
|
+
export declare function generateSignatures(program: Program, decorators: DecoratorSignature[], libraryName: string, namespaceName: string): ay.OutputDirectory;
|
|
12
|
+
//# sourceMappingURL=decorators-signatures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators-signatures.d.ts","sourceRoot":"","sources":["../../../../src/gen-extern-signatures/components/decorators-signatures.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AASjD,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,kBAAkB,EAAE,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB,EAAE,EAAE,CAAC,MAAM,CAAC;CACnC;AAED,wBAAgB,mBAAmB,CAAC,EAClC,aAAa,EACb,UAAU,EACV,sBAAsB,EAAE,sBAAsB,GAC/C,EAAE,wBAAwB,eAoB1B;AAED,wBAAgB,UAAU,gBAezB;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,kBAAkB,EAAE,EAChC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,GACpB,EAAE,CAAC,eAAe,CAyCpB"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { createComponent as _$createComponent, createIntrinsic as _$createIntrinsic, memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import * as ay from "@alloy-js/core";
|
|
3
|
+
import * as ts from "@alloy-js/typescript";
|
|
4
|
+
import { typespecCompiler } from "../external-packages/compiler.js";
|
|
5
|
+
import { DecoratorSignatureTests } from "./decorator-signature-tests.js";
|
|
6
|
+
import { DecoratorSignatureType, ValueOfModelTsInterfaceBody } from "./decorator-signature-type.js";
|
|
7
|
+
import { DollarDecoratorsType } from "./dollar-decorators-type.js";
|
|
8
|
+
import { createTspdContext, TspdContext, useTspd } from "./tspd-context.js";
|
|
9
|
+
export function DecoratorSignatures({
|
|
10
|
+
namespaceName,
|
|
11
|
+
decorators,
|
|
12
|
+
dollarDecoratorsRefKey: dollarDecoratorsRefkey
|
|
13
|
+
}) {
|
|
14
|
+
return _$createComponent(ts.TypeRefContext, {
|
|
15
|
+
get children() {
|
|
16
|
+
return [_$createComponent(LocalTypes, {}), _$createIntrinsic("hbr", {}), _$createIntrinsic("hbr", {}), _$createComponent(ay.For, {
|
|
17
|
+
each: decorators,
|
|
18
|
+
doubleHardline: true,
|
|
19
|
+
children: signature => {
|
|
20
|
+
return _$createComponent(DecoratorSignatureType, {
|
|
21
|
+
signature: signature
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}), _$createIntrinsic("hbr", {}), _$createIntrinsic("hbr", {}), _$createComponent(DollarDecoratorsType, {
|
|
25
|
+
namespaceName: namespaceName,
|
|
26
|
+
decorators: decorators,
|
|
27
|
+
refkey: dollarDecoratorsRefkey
|
|
28
|
+
})];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export function LocalTypes() {
|
|
33
|
+
const {
|
|
34
|
+
localTypes
|
|
35
|
+
} = useTspd();
|
|
36
|
+
return _$createComponent(ay.StatementList, {
|
|
37
|
+
get children() {
|
|
38
|
+
return _$createComponent(ay.For, {
|
|
39
|
+
each: localTypes,
|
|
40
|
+
doubleHardline: true,
|
|
41
|
+
children: type => {
|
|
42
|
+
return _$createComponent(ts.InterfaceDeclaration, {
|
|
43
|
+
"export": true,
|
|
44
|
+
get name() {
|
|
45
|
+
return type.name;
|
|
46
|
+
},
|
|
47
|
+
get refkey() {
|
|
48
|
+
return ay.refkey(type);
|
|
49
|
+
},
|
|
50
|
+
get children() {
|
|
51
|
+
return _$createComponent(ValueOfModelTsInterfaceBody, {
|
|
52
|
+
model: type
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export function generateSignatures(program, decorators, libraryName, namespaceName) {
|
|
62
|
+
const context = createTspdContext(program);
|
|
63
|
+
const base = namespaceName === "" ? "__global__" : namespaceName;
|
|
64
|
+
const $decoratorsRef = ay.refkey();
|
|
65
|
+
const userLib = ts.createPackage({
|
|
66
|
+
name: libraryName,
|
|
67
|
+
version: "0.0.0",
|
|
68
|
+
descriptor: {
|
|
69
|
+
".": {
|
|
70
|
+
named: ["$decorators"]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
const jsxContent = _$createComponent(TspdContext.Provider, {
|
|
75
|
+
value: context,
|
|
76
|
+
get children() {
|
|
77
|
+
return _$createComponent(ay.Output, {
|
|
78
|
+
externals: [typespecCompiler, userLib],
|
|
79
|
+
get children() {
|
|
80
|
+
return [_$createComponent(ts.SourceFile, {
|
|
81
|
+
path: `${base}.ts`,
|
|
82
|
+
get children() {
|
|
83
|
+
return _$createComponent(DecoratorSignatures, {
|
|
84
|
+
namespaceName: namespaceName,
|
|
85
|
+
decorators: decorators,
|
|
86
|
+
dollarDecoratorsRefKey: $decoratorsRef
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}), _$memo(() => _$memo(() => !!!base.includes(".Private"))() && _$createComponent(ts.SourceFile, {
|
|
90
|
+
path: `${base}.ts-test.ts`,
|
|
91
|
+
headerComment: "An error in the imports would mean that the decorator is not exported or doesn't have the right name.",
|
|
92
|
+
get children() {
|
|
93
|
+
return _$createComponent(DecoratorSignatureTests, {
|
|
94
|
+
namespaceName: namespaceName,
|
|
95
|
+
get dollarDecoratorRefKey() {
|
|
96
|
+
return userLib.$decorators;
|
|
97
|
+
},
|
|
98
|
+
dollarDecoratorsTypeRefKey: $decoratorsRef
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}))];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
return ay.render(jsxContent);
|
|
107
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as ay from "@alloy-js/core";
|
|
2
|
+
import * as ts from "@alloy-js/typescript";
|
|
3
|
+
import { typespecCompiler } from "../external-packages/compiler.js";
|
|
4
|
+
import { DecoratorSignatureTests } from "./decorator-signature-tests.jsx";
|
|
5
|
+
import { DecoratorSignatureType, ValueOfModelTsInterfaceBody, } from "./decorator-signature-type.jsx";
|
|
6
|
+
import { DollarDecoratorsType } from "./dollar-decorators-type.jsx";
|
|
7
|
+
import { createTspdContext, TspdContext, useTspd } from "./tspd-context.js";
|
|
8
|
+
export function DecoratorSignatures({ namespaceName, decorators, dollarDecoratorsRefKey: dollarDecoratorsRefkey, }) {
|
|
9
|
+
return (<ts.TypeRefContext>
|
|
10
|
+
<LocalTypes />
|
|
11
|
+
<hbr />
|
|
12
|
+
<hbr />
|
|
13
|
+
<ay.For each={decorators} doubleHardline>
|
|
14
|
+
{(signature) => {
|
|
15
|
+
return <DecoratorSignatureType signature={signature}/>;
|
|
16
|
+
}}
|
|
17
|
+
</ay.For>
|
|
18
|
+
<hbr />
|
|
19
|
+
<hbr />
|
|
20
|
+
<DollarDecoratorsType namespaceName={namespaceName} decorators={decorators} refkey={dollarDecoratorsRefkey}/>
|
|
21
|
+
</ts.TypeRefContext>);
|
|
22
|
+
}
|
|
23
|
+
export function LocalTypes() {
|
|
24
|
+
const { localTypes } = useTspd();
|
|
25
|
+
return (<ay.StatementList>
|
|
26
|
+
<ay.For each={localTypes} doubleHardline>
|
|
27
|
+
{(type) => {
|
|
28
|
+
return (<ts.InterfaceDeclaration export name={type.name} refkey={ay.refkey(type)}>
|
|
29
|
+
<ValueOfModelTsInterfaceBody model={type}/>
|
|
30
|
+
</ts.InterfaceDeclaration>);
|
|
31
|
+
}}
|
|
32
|
+
</ay.For>
|
|
33
|
+
</ay.StatementList>);
|
|
34
|
+
}
|
|
35
|
+
export function generateSignatures(program, decorators, libraryName, namespaceName) {
|
|
36
|
+
const context = createTspdContext(program);
|
|
37
|
+
const base = namespaceName === "" ? "__global__" : namespaceName;
|
|
38
|
+
const $decoratorsRef = ay.refkey();
|
|
39
|
+
const userLib = ts.createPackage({
|
|
40
|
+
name: libraryName,
|
|
41
|
+
version: "0.0.0",
|
|
42
|
+
descriptor: {
|
|
43
|
+
".": {
|
|
44
|
+
named: ["$decorators"],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
const jsxContent = (<TspdContext.Provider value={context}>
|
|
49
|
+
<ay.Output externals={[typespecCompiler, userLib]}>
|
|
50
|
+
<ts.SourceFile path={`${base}.ts`}>
|
|
51
|
+
<DecoratorSignatures namespaceName={namespaceName} decorators={decorators} dollarDecoratorsRefKey={$decoratorsRef}/>
|
|
52
|
+
</ts.SourceFile>
|
|
53
|
+
{!base.includes(".Private") && (<ts.SourceFile path={`${base}.ts-test.ts`} headerComment="An error in the imports would mean that the decorator is not exported or doesn't have the right name.">
|
|
54
|
+
<DecoratorSignatureTests namespaceName={namespaceName} dollarDecoratorRefKey={userLib.$decorators} dollarDecoratorsTypeRefKey={$decoratorsRef}/>
|
|
55
|
+
</ts.SourceFile>)}
|
|
56
|
+
</ay.Output>
|
|
57
|
+
</TspdContext.Provider>);
|
|
58
|
+
return ay.render(jsxContent);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=decorators-signatures.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators-signatures.jsx","sourceRoot":"","sources":["../../../../src/gen-extern-signatures/components/decorators-signatures.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EACL,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAQ5E,MAAM,UAAU,mBAAmB,CAAC,EAClC,aAAa,EACb,UAAU,EACV,sBAAsB,EAAE,sBAAsB,GACrB;IACzB,OAAO,CACL,CAAC,EAAE,CAAC,cAAc,CAChB;MAAA,CAAC,UAAU,CAAC,AAAD,EACX;MAAA,CAAC,GAAG,CAAC,AAAD,EACJ;MAAA,CAAC,GAAG,CAAC,AAAD,EACJ;MAAA,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,cAAc,CACtC;QAAA,CAAC,CAAC,SAAS,EAAE,EAAE;YACb,OAAO,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,EAAG,CAAC;QAC1D,CAAC,CACH;MAAA,EAAE,EAAE,CAAC,GAAG,CACR;MAAA,CAAC,GAAG,CAAC,AAAD,EACJ;MAAA,CAAC,GAAG,CAAC,AAAD,E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;QAChB,UAAU,EAAE;YACV,GAAG,EAAE;gBACH,KAAK,EAAE,CAAC,aAAa,CAAC;aACvB;SACF;KACF,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,CACjB,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CACnC;MAAA,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAChD;QAAA,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,CAChC;UAAA,CAAC,mBAAmB,CAClB,aAAa,CAAC,CAAC,aAAa,CAAC,CAC7B,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,sBAAsB,CAAC,CAAC,cAAc,CAAC,EAE3C;QAAA,EAAE,EAAE,CAAC,UAAU,CACf;QAAA,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAC7B,CAAC,EAAE,CAAC,UAAU,CACZ,IAAI,CAAC,CAAC,GAAG,IAAI,aAAa,CAAC,CAC3B,aAAa,CAAC,uGAAuG,CAErH;YAAA,CAAC,uBAAuB,CACtB,aAAa,CAAC,CAAC,aAAa,CAAC,CAC7B,qBAAqB,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAC3C,0BAA0B,CAAC,CAAC,cAAc,CAAC,EAE/C;UAAA,EAAE,EAAE,CAAC,UAAU,CAAC,CACjB,CACH;MAAA,EAAE,EAAE,CAAC,MAAM,CACb;IAAA,EAAE,WAAW,CAAC,QAAQ,CAAC,CACxB,CAAC;IAEF,OAAO,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as ay from "@alloy-js/core";
|
|
2
|
+
import { DecoratorSignature } from "../types.js";
|
|
3
|
+
export interface DollarDecoratorsTypeProps {
|
|
4
|
+
namespaceName: string;
|
|
5
|
+
decorators: DecoratorSignature[];
|
|
6
|
+
refkey: ay.Refkey;
|
|
7
|
+
}
|
|
8
|
+
/** Type for the $decorators variable for the given namespace */
|
|
9
|
+
export declare function DollarDecoratorsType(props: Readonly<DollarDecoratorsTypeProps>): ay.Children;
|
|
10
|
+
//# sourceMappingURL=dollar-decorators-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dollar-decorators-type.d.ts","sourceRoot":"","sources":["../../../../src/gen-extern-signatures/components/dollar-decorators-type.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,kBAAkB,EAAE,CAAC;IACjC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,gEAAgE;AAChE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,yBAAyB,CAAC,eAgB9E"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import * as ay from "@alloy-js/core";
|
|
3
|
+
import * as ts from "@alloy-js/typescript";
|
|
4
|
+
/** Type for the $decorators variable for the given namespace */
|
|
5
|
+
export function DollarDecoratorsType(props) {
|
|
6
|
+
return _$createComponent(ts.TypeDeclaration, {
|
|
7
|
+
get name() {
|
|
8
|
+
return getDecoratorRecordForNamespaceName(props.namespaceName);
|
|
9
|
+
},
|
|
10
|
+
"export": true,
|
|
11
|
+
get refkey() {
|
|
12
|
+
return props.refkey;
|
|
13
|
+
},
|
|
14
|
+
get children() {
|
|
15
|
+
return _$createComponent(ts.InterfaceExpression, {
|
|
16
|
+
get children() {
|
|
17
|
+
return _$createComponent(ay.For, {
|
|
18
|
+
get each() {
|
|
19
|
+
return props.decorators;
|
|
20
|
+
},
|
|
21
|
+
children: signature => {
|
|
22
|
+
return _$createComponent(ts.InterfaceMember, {
|
|
23
|
+
get name() {
|
|
24
|
+
return signature.name.slice(1);
|
|
25
|
+
},
|
|
26
|
+
get type() {
|
|
27
|
+
return signature.typeName;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function getDecoratorRecordForNamespaceName(namespaceName) {
|
|
38
|
+
return `${namespaceName.replaceAll(".", "")}Decorators`;
|
|
39
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as ay from "@alloy-js/core";
|
|
2
|
+
import * as ts from "@alloy-js/typescript";
|
|
3
|
+
/** Type for the $decorators variable for the given namespace */
|
|
4
|
+
export function DollarDecoratorsType(props) {
|
|
5
|
+
return (<ts.TypeDeclaration name={getDecoratorRecordForNamespaceName(props.namespaceName)} export refkey={props.refkey}>
|
|
6
|
+
<ts.InterfaceExpression>
|
|
7
|
+
<ay.For each={props.decorators}>
|
|
8
|
+
{(signature) => {
|
|
9
|
+
return <ts.InterfaceMember name={signature.name.slice(1)} type={signature.typeName}/>;
|
|
10
|
+
}}
|
|
11
|
+
</ay.For>
|
|
12
|
+
</ts.InterfaceExpression>
|
|
13
|
+
</ts.TypeDeclaration>);
|
|
14
|
+
}
|
|
15
|
+
function getDecoratorRecordForNamespaceName(namespaceName) {
|
|
16
|
+
return `${namespaceName.replaceAll(".", "")}Decorators`;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=dollar-decorators-type.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dollar-decorators-type.jsx","sourceRoot":"","sources":["../../../../src/gen-extern-signatures/components/dollar-decorators-type.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAS3C,gEAAgE;AAChE,MAAM,UAAU,oBAAoB,CAAC,KAA0C;IAC7E,OAAO,CACL,CAAC,EAAE,CAAC,eAAe,CACjB,IAAI,CAAC,CAAC,kCAAkC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAC9D,MAAM,CACN,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAErB;MAAA,CAAC,EAAE,CAAC,mBAAmB,CACrB;QAAA,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAC7B;UAAA,CAAC,CAAC,SAAS,EAAE,EAAE;YACb,OAAO,CAAC,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAG,CAAC;QACzF,CAAC,CACH;QAAA,EAAE,EAAE,CAAC,GAAG,CACV;MAAA,EAAE,EAAE,CAAC,mBAAmB,CAC1B;IAAA,EAAE,EAAE,CAAC,eAAe,CAAC,CACtB,CAAC;AACJ,CAAC;AAED,SAAS,kCAAkC,CAAC,aAAqB;IAC/D,OAAO,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Model, Program } from "@typespec/compiler";
|
|
2
|
+
export type TspdContext = {
|
|
3
|
+
program: Program;
|
|
4
|
+
localTypes: Model[];
|
|
5
|
+
addLocalType: (type: Model) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const TspdContext: import("@alloy-js/core").ComponentContext<TspdContext>;
|
|
8
|
+
export declare function useTspd(): TspdContext;
|
|
9
|
+
export declare function createTspdContext(program: Program): TspdContext;
|
|
10
|
+
//# sourceMappingURL=tspd-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tspd-context.d.ts","sourceRoot":"","sources":["../../../../src/gen-extern-signatures/components/tspd-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,KAAK,EAAE,CAAC;IACpB,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,WAAW,wDAAiD,CAAC;AAE1E,wBAAgB,OAAO,IASH,WAAW,CAC9B;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,CAY/D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createNamedContext, shallowReactive, useContext } from "@alloy-js/core";
|
|
2
|
+
export const TspdContext = createNamedContext("TspdContext");
|
|
3
|
+
export function useTspd() {
|
|
4
|
+
const context = useContext(TspdContext);
|
|
5
|
+
if (!context) {
|
|
6
|
+
throw new Error("TspdContext is not set. Make sure the component is wrapped in TspdContext.Provider or the emitter framework Output component.");
|
|
7
|
+
}
|
|
8
|
+
return context;
|
|
9
|
+
}
|
|
10
|
+
export function createTspdContext(program) {
|
|
11
|
+
const localTypes = shallowReactive([]);
|
|
12
|
+
return {
|
|
13
|
+
program,
|
|
14
|
+
localTypes,
|
|
15
|
+
addLocalType(type) {
|
|
16
|
+
if (localTypes.some(t => t === type)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
localTypes.push(type);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tspd-context.js","sourceRoot":"","sources":["../../../../src/gen-extern-signatures/components/tspd-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AASjF,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAc,aAAa,CAAC,CAAC;AAE1E,MAAM,UAAU,OAAO;IACrB,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,CAAE,CAAC;IAEzC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,+HAA+H,CAChI,CAAC;IACJ,CAAC;IAED,OAAO,OAAsB,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAgB;IAChD,MAAM,UAAU,GAAG,eAAe,CAAU,EAAE,CAAC,CAAC;IAChD,OAAO;QACL,OAAO;QACP,UAAU;QACV,YAAY,CAAC,IAAW;YACtB,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC;gBACvC,OAAO;YACT,CAAC;YACD,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;KACF,CAAC;AACJ,CAAC"}
|