@typespec/emitter-framework 0.1.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.
Files changed (194) hide show
  1. package/LICENSE +21 -0
  2. package/babel.config.js +4 -0
  3. package/dist/src/core/context/index.d.ts +2 -0
  4. package/dist/src/core/context/index.d.ts.map +1 -0
  5. package/dist/src/core/context/index.js +1 -0
  6. package/dist/src/core/context/index.js.map +1 -0
  7. package/dist/src/core/context/name-policy-context.d.ts +5 -0
  8. package/dist/src/core/context/name-policy-context.d.ts.map +1 -0
  9. package/dist/src/core/context/name-policy-context.js +13 -0
  10. package/dist/src/core/context/name-policy-context.js.map +1 -0
  11. package/dist/src/core/index.d.ts +4 -0
  12. package/dist/src/core/index.d.ts.map +1 -0
  13. package/dist/src/core/index.js +4 -0
  14. package/dist/src/core/index.js.map +1 -0
  15. package/dist/src/core/transport-name-policy.d.ts +44 -0
  16. package/dist/src/core/transport-name-policy.d.ts.map +1 -0
  17. package/dist/src/core/transport-name-policy.js +42 -0
  18. package/dist/src/core/transport-name-policy.js.map +1 -0
  19. package/dist/src/core/write-output.d.ts +3 -0
  20. package/dist/src/core/write-output.d.ts.map +1 -0
  21. package/dist/src/core/write-output.js +20 -0
  22. package/dist/src/core/write-output.js.map +1 -0
  23. package/dist/src/lib.d.ts +23 -0
  24. package/dist/src/lib.d.ts.map +1 -0
  25. package/dist/src/lib.js +18 -0
  26. package/dist/src/lib.js.map +1 -0
  27. package/dist/src/testing/index.d.ts +4 -0
  28. package/dist/src/testing/index.d.ts.map +1 -0
  29. package/dist/src/testing/index.js +9 -0
  30. package/dist/src/testing/index.js.map +1 -0
  31. package/dist/src/testing/scenario-test/harness.d.ts +4 -0
  32. package/dist/src/testing/scenario-test/harness.d.ts.map +1 -0
  33. package/dist/src/testing/scenario-test/harness.js +278 -0
  34. package/dist/src/testing/scenario-test/harness.js.map +1 -0
  35. package/dist/src/testing/scenario-test/index.d.ts +4 -0
  36. package/dist/src/testing/scenario-test/index.d.ts.map +1 -0
  37. package/dist/src/testing/scenario-test/index.js +4 -0
  38. package/dist/src/testing/scenario-test/index.js.map +1 -0
  39. package/dist/src/testing/scenario-test/snippet-extractor.d.ts +30 -0
  40. package/dist/src/testing/scenario-test/snippet-extractor.d.ts.map +1 -0
  41. package/dist/src/testing/scenario-test/snippet-extractor.js +152 -0
  42. package/dist/src/testing/scenario-test/snippet-extractor.js.map +1 -0
  43. package/dist/src/testing/scenario-test/test-host.d.ts +8 -0
  44. package/dist/src/testing/scenario-test/test-host.d.ts.map +1 -0
  45. package/dist/src/testing/scenario-test/test-host.js +50 -0
  46. package/dist/src/testing/scenario-test/test-host.js.map +1 -0
  47. package/dist/src/typescript/components/array-expression.d.ts +6 -0
  48. package/dist/src/typescript/components/array-expression.d.ts.map +1 -0
  49. package/dist/src/typescript/components/array-expression.js +10 -0
  50. package/dist/src/typescript/components/array-expression.js.map +1 -0
  51. package/dist/src/typescript/components/class-method.d.ts +10 -0
  52. package/dist/src/typescript/components/class-method.d.ts.map +1 -0
  53. package/dist/src/typescript/components/class-method.js +39 -0
  54. package/dist/src/typescript/components/class-method.js.map +1 -0
  55. package/dist/src/typescript/components/enum-declaration.d.ts +14 -0
  56. package/dist/src/typescript/components/enum-declaration.d.ts.map +1 -0
  57. package/dist/src/typescript/components/enum-declaration.js +61 -0
  58. package/dist/src/typescript/components/enum-declaration.js.map +1 -0
  59. package/dist/src/typescript/components/function-declaration.d.ts +18 -0
  60. package/dist/src/typescript/components/function-declaration.d.ts.map +1 -0
  61. package/dist/src/typescript/components/function-declaration.js +71 -0
  62. package/dist/src/typescript/components/function-declaration.js.map +1 -0
  63. package/dist/src/typescript/components/index.d.ts +11 -0
  64. package/dist/src/typescript/components/index.d.ts.map +1 -0
  65. package/dist/src/typescript/components/index.js +11 -0
  66. package/dist/src/typescript/components/index.js.map +1 -0
  67. package/dist/src/typescript/components/interface-declaration.d.ts +13 -0
  68. package/dist/src/typescript/components/interface-declaration.d.ts.map +1 -0
  69. package/dist/src/typescript/components/interface-declaration.js +118 -0
  70. package/dist/src/typescript/components/interface-declaration.js.map +1 -0
  71. package/dist/src/typescript/components/interface-member.d.ts +7 -0
  72. package/dist/src/typescript/components/interface-member.d.ts.map +1 -0
  73. package/dist/src/typescript/components/interface-member.js +42 -0
  74. package/dist/src/typescript/components/interface-member.js.map +1 -0
  75. package/dist/src/typescript/components/record-expression.d.ts +6 -0
  76. package/dist/src/typescript/components/record-expression.d.ts.map +1 -0
  77. package/dist/src/typescript/components/record-expression.js +13 -0
  78. package/dist/src/typescript/components/record-expression.js.map +1 -0
  79. package/dist/src/typescript/components/static-serializers.d.ts +17 -0
  80. package/dist/src/typescript/components/static-serializers.d.ts.map +1 -0
  81. package/dist/src/typescript/components/static-serializers.js +190 -0
  82. package/dist/src/typescript/components/static-serializers.js.map +1 -0
  83. package/dist/src/typescript/components/type-alias-declaration.d.ts +9 -0
  84. package/dist/src/typescript/components/type-alias-declaration.d.ts.map +1 -0
  85. package/dist/src/typescript/components/type-alias-declaration.js +42 -0
  86. package/dist/src/typescript/components/type-alias-declaration.js.map +1 -0
  87. package/dist/src/typescript/components/type-declaration.d.ts +11 -0
  88. package/dist/src/typescript/components/type-declaration.d.ts.map +1 -0
  89. package/dist/src/typescript/components/type-declaration.js +35 -0
  90. package/dist/src/typescript/components/type-declaration.js.map +1 -0
  91. package/dist/src/typescript/components/type-expression.d.ts +7 -0
  92. package/dist/src/typescript/components/type-expression.d.ts.map +1 -0
  93. package/dist/src/typescript/components/type-expression.js +205 -0
  94. package/dist/src/typescript/components/type-expression.js.map +1 -0
  95. package/dist/src/typescript/components/type-transform.d.ts +65 -0
  96. package/dist/src/typescript/components/type-transform.d.ts.map +1 -0
  97. package/dist/src/typescript/components/type-transform.js +390 -0
  98. package/dist/src/typescript/components/type-transform.js.map +1 -0
  99. package/dist/src/typescript/components/union-declaration.d.ts +9 -0
  100. package/dist/src/typescript/components/union-declaration.d.ts.map +1 -0
  101. package/dist/src/typescript/components/union-declaration.js +45 -0
  102. package/dist/src/typescript/components/union-declaration.js.map +1 -0
  103. package/dist/src/typescript/components/union-expression.d.ts +8 -0
  104. package/dist/src/typescript/components/union-expression.d.ts.map +1 -0
  105. package/dist/src/typescript/components/union-expression.js +37 -0
  106. package/dist/src/typescript/components/union-expression.js.map +1 -0
  107. package/dist/src/typescript/index.d.ts +3 -0
  108. package/dist/src/typescript/index.d.ts.map +1 -0
  109. package/dist/src/typescript/index.js +3 -0
  110. package/dist/src/typescript/index.js.map +1 -0
  111. package/dist/src/typescript/lib.d.ts +113 -0
  112. package/dist/src/typescript/lib.d.ts.map +1 -0
  113. package/dist/src/typescript/lib.js +65 -0
  114. package/dist/src/typescript/lib.js.map +1 -0
  115. package/dist/src/typescript/utils/index.d.ts +2 -0
  116. package/dist/src/typescript/utils/index.d.ts.map +1 -0
  117. package/dist/src/typescript/utils/index.js +1 -0
  118. package/dist/src/typescript/utils/index.js.map +1 -0
  119. package/dist/src/typescript/utils/operation.d.ts +13 -0
  120. package/dist/src/typescript/utils/operation.d.ts.map +1 -0
  121. package/dist/src/typescript/utils/operation.js +47 -0
  122. package/dist/src/typescript/utils/operation.js.map +1 -0
  123. package/dist/test/testing/snippet-extractor-csharp.test.d.ts +2 -0
  124. package/dist/test/testing/snippet-extractor-csharp.test.d.ts.map +1 -0
  125. package/dist/test/testing/snippet-extractor-java.test.d.ts +2 -0
  126. package/dist/test/testing/snippet-extractor-java.test.d.ts.map +1 -0
  127. package/dist/test/testing/snippet-extractor-python.test.d.ts +2 -0
  128. package/dist/test/testing/snippet-extractor-python.test.d.ts.map +1 -0
  129. package/dist/test/testing/snippet-extractor-typescript.test.d.ts +2 -0
  130. package/dist/test/testing/snippet-extractor-typescript.test.d.ts.map +1 -0
  131. package/dist/test/typescript/components/enum-declaration.test.d.ts +2 -0
  132. package/dist/test/typescript/components/enum-declaration.test.d.ts.map +1 -0
  133. package/dist/test/typescript/components/function-declaration.test.d.ts +2 -0
  134. package/dist/test/typescript/components/function-declaration.test.d.ts.map +1 -0
  135. package/dist/test/typescript/components/interface-declaration.test.d.ts +2 -0
  136. package/dist/test/typescript/components/interface-declaration.test.d.ts.map +1 -0
  137. package/dist/test/typescript/components/member-expression.test.d.ts +2 -0
  138. package/dist/test/typescript/components/member-expression.test.d.ts.map +1 -0
  139. package/dist/test/typescript/components/type-alias-declaration.test.d.ts +2 -0
  140. package/dist/test/typescript/components/type-alias-declaration.test.d.ts.map +1 -0
  141. package/dist/test/typescript/components/type-transform.test.d.ts +2 -0
  142. package/dist/test/typescript/components/type-transform.test.d.ts.map +1 -0
  143. package/dist/test/typescript/components/union-declaration.test.d.ts +2 -0
  144. package/dist/test/typescript/components/union-declaration.test.d.ts.map +1 -0
  145. package/dist/test/typescript/test-host.d.ts +11 -0
  146. package/dist/test/typescript/test-host.d.ts.map +1 -0
  147. package/dist/test/utils.d.ts +4 -0
  148. package/dist/test/utils.d.ts.map +1 -0
  149. package/package.json +58 -0
  150. package/src/core/context/index.ts +1 -0
  151. package/src/core/context/name-policy-context.ts +16 -0
  152. package/src/core/index.ts +3 -0
  153. package/src/core/transport-name-policy.ts +67 -0
  154. package/src/core/write-output.ts +21 -0
  155. package/src/lib.ts +16 -0
  156. package/src/testing/index.ts +10 -0
  157. package/src/testing/scenario-test/harness.ts +398 -0
  158. package/src/testing/scenario-test/index.ts +3 -0
  159. package/src/testing/scenario-test/snippet-extractor.ts +200 -0
  160. package/src/testing/scenario-test/test-host.ts +83 -0
  161. package/src/typescript/components/array-expression.tsx +12 -0
  162. package/src/typescript/components/class-method.tsx +39 -0
  163. package/src/typescript/components/enum-declaration.tsx +63 -0
  164. package/src/typescript/components/function-declaration.tsx +128 -0
  165. package/src/typescript/components/index.ts +10 -0
  166. package/src/typescript/components/interface-declaration.tsx +137 -0
  167. package/src/typescript/components/interface-member.tsx +42 -0
  168. package/src/typescript/components/record-expression.tsx +13 -0
  169. package/src/typescript/components/static-serializers.tsx +136 -0
  170. package/src/typescript/components/type-alias-declaration.tsx +37 -0
  171. package/src/typescript/components/type-declaration.tsx +31 -0
  172. package/src/typescript/components/type-expression.tsx +166 -0
  173. package/src/typescript/components/type-transform.tsx +378 -0
  174. package/src/typescript/components/union-declaration.tsx +40 -0
  175. package/src/typescript/components/union-expression.tsx +37 -0
  176. package/src/typescript/index.ts +2 -0
  177. package/src/typescript/lib.ts +61 -0
  178. package/src/typescript/utils/index.ts +1 -0
  179. package/src/typescript/utils/operation.ts +61 -0
  180. package/test/testing/snippet-extractor-csharp.test.ts +113 -0
  181. package/test/testing/snippet-extractor-java.test.ts +122 -0
  182. package/test/testing/snippet-extractor-python.test.ts +43 -0
  183. package/test/testing/snippet-extractor-typescript.test.ts +181 -0
  184. package/test/typescript/components/enum-declaration.test.tsx +110 -0
  185. package/test/typescript/components/function-declaration.test.tsx +226 -0
  186. package/test/typescript/components/interface-declaration.test.tsx +690 -0
  187. package/test/typescript/components/member-expression.test.tsx +130 -0
  188. package/test/typescript/components/type-alias-declaration.test.tsx +120 -0
  189. package/test/typescript/components/type-transform.test.tsx +562 -0
  190. package/test/typescript/components/union-declaration.test.tsx +185 -0
  191. package/test/typescript/test-host.ts +41 -0
  192. package/test/utils.ts +14 -0
  193. package/tsconfig.json +21 -0
  194. package/vitest.config.js +22 -0
@@ -0,0 +1,30 @@
1
+ export interface SnippetExtractor {
2
+ getClass(fileContent: string, name: string): string | null;
3
+ getFunction(fileContent: string, name: string): string | null;
4
+ getInterface(fileContent: string, name: string): string | null;
5
+ getTypeAlias(fileContent: string, name: string): string | null;
6
+ getEnum(fileContent: string, name: string): string | null;
7
+ }
8
+ export declare function createCSharpExtractorConfig(): LanguageConfiguration;
9
+ export declare function createJavaExtractorConfig(): LanguageConfiguration;
10
+ export declare function createPythonExtractorConfig(): LanguageConfiguration;
11
+ export declare function createTypeScriptExtractorConfig(): LanguageConfiguration;
12
+ export type Language = {
13
+ name: string;
14
+ language: unknown;
15
+ nodeTypeInfo: unknown[];
16
+ };
17
+ export interface LanguageConfiguration {
18
+ language: Language;
19
+ format: (content: string) => Promise<string>;
20
+ codeBlockTypes: string[];
21
+ nodeKindMapping: {
22
+ classNodeType?: string;
23
+ functionNodeType?: string;
24
+ interfaceNodeType?: string;
25
+ typeAliasNodeType?: string;
26
+ enumNodeType?: string;
27
+ };
28
+ }
29
+ export declare function createSnipperExtractor(languageConfiguration: LanguageConfiguration): SnippetExtractor;
30
+ //# sourceMappingURL=snippet-extractor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snippet-extractor.d.ts","sourceRoot":"","sources":["../../../../src/testing/scenario-test/snippet-extractor.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC3D,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC9D,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC/D,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC/D,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CAC3D;AAED,wBAAgB,2BAA2B,IAAI,qBAAqB,CAYnE;AAED,wBAAgB,yBAAyB,IAAI,qBAAqB,CAYjE;AAED,wBAAgB,2BAA2B,IAAI,qBAAqB,CAUnE;AAED,wBAAgB,+BAA+B,IAAI,qBAAqB,CAavE;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,EAAE,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7C,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,eAAe,EAAE;QACf,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED,wBAAgB,sBAAsB,CACpC,qBAAqB,EAAE,qBAAqB,GAC3C,gBAAgB,CAElB"}
@@ -0,0 +1,152 @@
1
+ import { format } from "prettier";
2
+ import Parser from "tree-sitter";
3
+ import CSharpLanguage from "tree-sitter-c-sharp";
4
+ import JavaLanguage from "tree-sitter-java";
5
+ import PythonLanguage from "tree-sitter-python";
6
+ import TypeScriptLanguage from "tree-sitter-typescript";
7
+
8
+ // Interface for SnippetExtractor
9
+
10
+ export function createCSharpExtractorConfig() {
11
+ return {
12
+ codeBlockTypes: ["cs", "csharp"],
13
+ format: async content => content,
14
+ language: CSharpLanguage,
15
+ nodeKindMapping: {
16
+ classNodeType: "class_declaration",
17
+ functionNodeType: "local_function_statement",
18
+ interfaceNodeType: "interface_declaration",
19
+ enumNodeType: "enum_declaration"
20
+ }
21
+ };
22
+ }
23
+ export function createJavaExtractorConfig() {
24
+ return {
25
+ codeBlockTypes: ["java"],
26
+ format: async content => content,
27
+ language: JavaLanguage,
28
+ nodeKindMapping: {
29
+ classNodeType: "class_declaration",
30
+ functionNodeType: "method_declaration",
31
+ interfaceNodeType: "interface_declaration",
32
+ enumNodeType: "enum_declaration"
33
+ }
34
+ };
35
+ }
36
+ export function createPythonExtractorConfig() {
37
+ return {
38
+ codeBlockTypes: ["py", "python"],
39
+ format: async content => content,
40
+ language: PythonLanguage,
41
+ nodeKindMapping: {
42
+ classNodeType: "class_definition",
43
+ functionNodeType: "function_definition"
44
+ }
45
+ };
46
+ }
47
+ export function createTypeScriptExtractorConfig() {
48
+ return {
49
+ codeBlockTypes: ["ts", "typescript"],
50
+ language: TypeScriptLanguage.typescript,
51
+ format: async content => format(content, {
52
+ parser: "typescript"
53
+ }),
54
+ nodeKindMapping: {
55
+ classNodeType: "class_declaration",
56
+ functionNodeType: "function_declaration",
57
+ interfaceNodeType: "interface_declaration",
58
+ typeAliasNodeType: "type_alias_declaration",
59
+ enumNodeType: "enum_declaration"
60
+ }
61
+ };
62
+ }
63
+ export function createSnipperExtractor(languageConfiguration) {
64
+ return new SnippetExtractorImpl(languageConfiguration);
65
+ }
66
+ class SnippetExtractorImpl {
67
+ constructor(languageConfiguration) {
68
+ this.parser = new Parser();
69
+ this.parser.setLanguage(languageConfiguration.language);
70
+ this.languageConfiguration = languageConfiguration;
71
+ }
72
+ getClass(fileContent, name) {
73
+ const classNodeType = this.languageConfiguration.nodeKindMapping.classNodeType;
74
+ if (!classNodeType) {
75
+ throw new Error("Class node type is not defined in the language configuration");
76
+ }
77
+ const classNode = this.findNodeByTypeAndName(fileContent, classNodeType, name);
78
+ return classNode ? this.getCodeFromNode(classNode) : null;
79
+ }
80
+ getFunction(fileContent, name) {
81
+ const functionNodeType = this.languageConfiguration.nodeKindMapping.functionNodeType;
82
+ if (!functionNodeType) {
83
+ throw new Error("Function node type is not defined in the language configuration");
84
+ }
85
+ const classNode = this.findNodeByTypeAndName(fileContent, functionNodeType, name);
86
+ return classNode ? this.getCodeFromNode(classNode) : null;
87
+ }
88
+ getInterface(fileContent, name) {
89
+ const interfaceNodeType = this.languageConfiguration.nodeKindMapping.interfaceNodeType;
90
+ if (!interfaceNodeType) {
91
+ throw new Error("Interface node type is not defined in the language configuration");
92
+ }
93
+ const classNode = this.findNodeByTypeAndName(fileContent, interfaceNodeType, name);
94
+ return classNode ? this.getCodeFromNode(classNode) : null;
95
+ }
96
+ getTypeAlias(fileContent, name) {
97
+ const typeAliasNodeType = this.languageConfiguration.nodeKindMapping.typeAliasNodeType;
98
+ if (!typeAliasNodeType) {
99
+ throw new Error("Type Alias node type is not defined in the language configuration");
100
+ }
101
+ const typeAliasNode = this.findNodeByTypeAndName(fileContent, typeAliasNodeType, name);
102
+ return typeAliasNode ? this.getCodeFromNode(typeAliasNode) : null;
103
+ }
104
+ getEnum(fileContent, name) {
105
+ const enumNodeType = this.languageConfiguration.nodeKindMapping.enumNodeType;
106
+ if (!enumNodeType) {
107
+ throw new Error("Enum node type is not defined in the language configuration");
108
+ }
109
+ const enumNode = this.findNodeByTypeAndName(fileContent, enumNodeType, name);
110
+ return enumNode ? this.getCodeFromNode(enumNode) : null;
111
+ }
112
+
113
+ // Helper function to extract code from a node
114
+ getCodeFromNode(node) {
115
+ // Walk backward to include preceding nodes like 'export', 'public', etc.
116
+ let startIndex = node.startIndex;
117
+ let current = node.previousSibling;
118
+
119
+ // Check for any modifiers (like 'export') that appear before the node
120
+ while (current && (current.type === "export" || current.type === "modifier" || current.type === "annotation")) {
121
+ startIndex = current.startIndex;
122
+ current = current.previousSibling;
123
+ }
124
+
125
+ // Extract the full text from the adjusted start to the end of the node
126
+ const code = node.tree.rootNode.text.slice(startIndex, node.endIndex);
127
+ return code;
128
+ }
129
+
130
+ // Helper function to find a node by type and name in AST
131
+ findNodeByTypeAndName(fileContent, type, name) {
132
+ const tree = this.parser.parse(fileContent);
133
+ const rootNode = tree.rootNode; // Start from the root node
134
+
135
+ const traverse = node => {
136
+ if (node.type === type && node.childForFieldName("name")?.text === name) {
137
+ return node;
138
+ }
139
+ for (let i = 0; i < node.childCount; i++) {
140
+ const childNode = node.child(i);
141
+ if (childNode) {
142
+ // Ensure the childNode is not null
143
+ const found = traverse(childNode);
144
+ if (found) return found;
145
+ }
146
+ }
147
+ return null;
148
+ };
149
+ return traverse(rootNode); // Start traversal from the root node
150
+ }
151
+ }
152
+ //# sourceMappingURL=snippet-extractor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snippet-extractor.js","names":["format","Parser","CSharpLanguage","JavaLanguage","PythonLanguage","TypeScriptLanguage","createCSharpExtractorConfig","codeBlockTypes","content","language","nodeKindMapping","classNodeType","functionNodeType","interfaceNodeType","enumNodeType","createJavaExtractorConfig","createPythonExtractorConfig","createTypeScriptExtractorConfig","typescript","parser","typeAliasNodeType","createSnipperExtractor","languageConfiguration","SnippetExtractorImpl","constructor","setLanguage","getClass","fileContent","name","Error","classNode","findNodeByTypeAndName","getCodeFromNode","getFunction","getInterface","getTypeAlias","typeAliasNode","getEnum","enumNode","node","startIndex","current","previousSibling","type","code","tree","rootNode","text","slice","endIndex","parse","traverse","childForFieldName","i","childCount","childNode","child","found"],"sources":["../../../../src/testing/scenario-test/snippet-extractor.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,MAAM,QAAQ,UAAU;AACjC,OAAOC,MAAM,MAAM,aAAa;AAChC,OAAOC,cAAc,MAAM,qBAAqB;AAChD,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,OAAOC,kBAAkB,MAAM,wBAAwB;;AAEvD;;AASA,OAAO,SAASC,2BAA2BA,CAAA,EAA0B;EACnE,OAAO;IACLC,cAAc,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC;IAChCP,MAAM,EAAE,MAAOQ,OAAe,IAAKA,OAAO;IAC1CC,QAAQ,EAAEP,cAAc;IACxBQ,eAAe,EAAE;MACfC,aAAa,EAAE,mBAAmB;MAClCC,gBAAgB,EAAE,0BAA0B;MAC5CC,iBAAiB,EAAE,uBAAuB;MAC1CC,YAAY,EAAE;IAChB;EACF,CAAC;AACH;AAEA,OAAO,SAASC,yBAAyBA,CAAA,EAA0B;EACjE,OAAO;IACLR,cAAc,EAAE,CAAC,MAAM,CAAC;IACxBP,MAAM,EAAE,MAAOQ,OAAe,IAAKA,OAAO;IAC1CC,QAAQ,EAAEN,YAAY;IACtBO,eAAe,EAAE;MACfC,aAAa,EAAE,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,MAAM,CAAC+B,KAAK,CAACvB,WAAW,CAAC;IAC3C,MAAMmB,QAAQ,GAAGD,IAAI,CAACC,QAAQ,CAAC,CAAC;;IAEhC,MAAMK,QAAQ,GAAIZ,IAAuB,IAA+B;MACtE,IAAIA,IAAI,CAACI,IAAI,KAAKA,IAAI,IAAIJ,IAAI,CAACa,iBAAiB,CAAC,MAAM,CAAC,EAAEL,IAAI,KAAKnB,IAAI,EAAE;QACvE,OAAOW,IAAI;MACb;MAEA,KAAK,IAAIc,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGd,IAAI,CAACe,UAAU,EAAED,CAAC,EAAE,EAAE;QACxC,MAAME,SAAS,GAAGhB,IAAI,CAACiB,KAAK,CAACH,CAAC,CAAC;QAC/B,IAAIE,SAAS,EAAE;UACb;UACA,MAAME,KAAK,GAAGN,QAAQ,CAACI,SAAS,CAAC;UACjC,IAAIE,KAAK,EAAE,OAAOA,KAAK;QACzB;MACF;MAEA,OAAO,IAAI;IACb,CAAC;IAED,OAAON,QAAQ,CAACL,QAAQ,CAAC,CAAC,CAAC;EAC7B;AACF","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ import { Diagnostic } from "@typespec/compiler";
2
+ import { TypeSpecTestLibrary } from "@typespec/compiler/testing";
3
+ export interface EmittedFile {
4
+ path: string;
5
+ content: string;
6
+ }
7
+ export declare function emitWithDiagnostics(testLibrary: TypeSpecTestLibrary, emitterOutputDir: string, code: string): Promise<[EmittedFile[], readonly Diagnostic[]]>;
8
+ //# sourceMappingURL=test-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-host.d.ts","sourceRoot":"","sources":["../../../../src/testing/scenario-test/test-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAKL,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AAKpC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AA4BD,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,mBAAmB,EAChC,gBAAgB,EAAE,MAAM,EACxB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,SAAS,UAAU,EAAE,CAAC,CAAC,CAOjD"}
@@ -0,0 +1,50 @@
1
+ import { createTestHost, createTestWrapper } from "@typespec/compiler/testing";
2
+ import { HttpTestLibrary } from "@typespec/http/testing";
3
+ import { RestTestLibrary } from "@typespec/rest/testing";
4
+ import { join, relative } from "path";
5
+ async function createEmitterTestRunner(testLibrary, options = {}) {
6
+ const libraries = options.testHostConfig?.libraries ?? [testLibrary, HttpTestLibrary, RestTestLibrary];
7
+ const host = await createTestHost({
8
+ libraries
9
+ });
10
+ return createTestWrapper(host, {
11
+ autoImports: options.autoImports ?? ["@typespec/http", "@typespec/rest"],
12
+ autoUsings: options.autoUsings ?? ["TypeSpec.Http", "TypeSpec.Rest"],
13
+ compilerOptions: options.compilerOptions ?? {
14
+ noEmit: false,
15
+ emit: [testLibrary.name]
16
+ }
17
+ });
18
+ }
19
+ export async function emitWithDiagnostics(testLibrary, emitterOutputDir, code) {
20
+ const runner = await createEmitterTestRunner(testLibrary);
21
+ await runner.compileAndDiagnose(code, {
22
+ outputDir: "tsp-output"
23
+ });
24
+ const result = await readFilesRecursively(emitterOutputDir, emitterOutputDir, runner);
25
+ return [result, runner.program.diagnostics];
26
+ }
27
+ async function readFilesRecursively(currentDir, emitterOutputDir, runner) {
28
+ const entries = await runner.program.host.readDir(currentDir);
29
+ const result = [];
30
+ for (const entry of entries) {
31
+ const fullPath = join(currentDir, entry);
32
+ const stat = await runner.program.host.stat(fullPath);
33
+ if (stat.isDirectory()) {
34
+ // Recursively read files in the directory
35
+ const nestedFiles = await readFilesRecursively(fullPath, emitterOutputDir, runner);
36
+ result.push(...nestedFiles);
37
+ } else if (stat.isFile()) {
38
+ // Read the file
39
+ // Read the file and store it with a relative path
40
+ const relativePath = relative(emitterOutputDir, fullPath);
41
+ const fileContent = await runner.program.host.readFile(fullPath);
42
+ result.push({
43
+ path: relativePath,
44
+ content: fileContent.text
45
+ });
46
+ }
47
+ }
48
+ return result;
49
+ }
50
+ //# sourceMappingURL=test-host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-host.js","names":["createTestHost","createTestWrapper","HttpTestLibrary","RestTestLibrary","join","relative","createEmitterTestRunner","testLibrary","options","libraries","testHostConfig","host","autoImports","autoUsings","compilerOptions","noEmit","emit","name","emitWithDiagnostics","emitterOutputDir","code","runner","compileAndDiagnose","outputDir","result","readFilesRecursively","program","diagnostics","currentDir","entries","readDir","entry","fullPath","stat","isDirectory","nestedFiles","push","isFile","relativePath","fileContent","readFile","path","content","text"],"sources":["../../../../src/testing/scenario-test/test-host.ts"],"sourcesContent":[null],"mappings":"AACA,SAEEA,cAAc,EACdC,iBAAiB,QAGZ,4BAA4B;AACnC,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SAASC,IAAI,EAAEC,QAAQ,QAAQ,MAAM;AAOrC,eAAeC,uBAAuBA,CACpCC,WAAgC,EAChCC,OAKC,GAAG,CAAC,CAAC,EACN;EACA,MAAMC,SAAS,GAAGD,OAAO,CAACE,cAAc,EAAED,SAAS,IAAI,CACrDF,WAAW,EACXL,eAAe,EACfC,eAAe,CAChB;EACD,MAAMQ,IAAI,GAAG,MAAMX,cAAc,CAAC;IAAES;EAAU,CAAC,CAAC;EAEhD,OAAOR,iBAAiB,CAACU,IAAI,EAAE;IAC7BC,WAAW,EAAEJ,OAAO,CAACI,WAAW,IAAI,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IACxEC,UAAU,EAAEL,OAAO,CAACK,UAAU,IAAI,CAAC,eAAe,EAAE,eAAe,CAAC;IACpEC,eAAe,EAAEN,OAAO,CAACM,eAAe,IAAI;MAC1CC,MAAM,EAAE,KAAK;MACbC,IAAI,EAAE,CA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OAAO,CAACf,IAAI,CAAC6B,QAAQ,CAACR,QAAQ,CAAC;MAChER,MAAM,CAACY,IAAI,CAAC;QAAEK,IAAI,EAAEH,YAAY;QAAEI,OAAO,EAAEH,WAAW,CAACI;MAAK,CAAC,CAAC;IAChE;EACF;EAEA,OAAOnB,MAAM;AACf","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ import { Type } from "@typespec/compiler";
2
+ export interface ArrayExpressionProps {
3
+ elementType: Type;
4
+ }
5
+ export declare function ArrayExpression({ elementType }: ArrayExpressionProps): any;
6
+ //# sourceMappingURL=array-expression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array-expression.d.ts","sourceRoot":"","sources":["../../../../src/typescript/components/array-expression.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG1C,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,IAAI,CAAC;CACnB;AAED,wBAAgB,eAAe,CAAC,EAAE,WAAW,EAAE,EAAE,oBAAoB,OAIpE"}
@@ -0,0 +1,10 @@
1
+ import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
2
+ import { TypeExpression } from "./type-expression.js";
3
+ export function ArrayExpression({
4
+ elementType
5
+ }) {
6
+ return ["Array", "<", _$createComponent(TypeExpression, {
7
+ type: elementType
8
+ }), ">"];
9
+ }
10
+ //# sourceMappingURL=array-expression.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array-expression.js","names":["TypeExpression","ArrayExpression","elementType","_$createComponent","type"],"sources":["../../../../src/typescript/components/array-expression.tsx"],"sourcesContent":[null],"mappings":";AACA,SAASA,cAAc,QAAQ,sBAAsB;AAMrD,OAAO,SAASC,eAAeA,CAAC;EAAEC;AAAkC,CAAC,EAAE;EACrE,iBACU,GAAG,EAAAC,iBAAA,CAAEH,cAAc;IAACI,IAAI,EAAEF;EAAW,IAAK,GAAG;AAEzD","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import * as ts from "@alloy-js/typescript";
2
+ import { Operation } from "@typespec/compiler";
3
+ export interface ClassMethodPropsWithType extends Omit<ts.ClassMethodProps, "name"> {
4
+ type: Operation;
5
+ name?: string;
6
+ parametersMode?: "prepend" | "append" | "replace";
7
+ }
8
+ export type ClassMethodProps = ClassMethodPropsWithType | ts.ClassMethodProps;
9
+ export declare function ClassMethod(props: ClassMethodProps): any;
10
+ //# sourceMappingURL=class-method.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class-method.d.ts","sourceRoot":"","sources":["../../../../src/typescript/components/class-method.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI/C,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CAAC,EAAE,CAAC,gBAAgB,EAAE,MAAM,CAAC;IACjF,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;CACnD;AAED,MAAM,MAAM,gBAAgB,GAAG,wBAAwB,GAAG,EAAE,CAAC,gBAAgB,CAAC;AAE9E,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,OAoBlD"}
@@ -0,0 +1,39 @@
1
+ import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
2
+ import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
3
+ import { refkey as getRefkey } from "@alloy-js/core";
4
+ import * as ts from "@alloy-js/typescript";
5
+ import { buildParameterDescriptors, getReturnType } from "../utils/operation.js";
6
+ import { TypeExpression } from "./type-expression.js";
7
+ export function ClassMethod(props) {
8
+ if (!isTypedMethodDeclarationProps(props)) {
9
+ return _$createComponent(ts.ClassMethod, props);
10
+ }
11
+ const refkey = props.refkey ?? getRefkey(props.type, "method");
12
+ const name = props.name ? props.name : ts.useTSNamePolicy().getName(props.type.name, "function");
13
+ const returnType = props.returnType === null ? undefined : _$createComponent(TypeExpression, {
14
+ get type() {
15
+ return getReturnType(props.type);
16
+ }
17
+ });
18
+ return _$createComponent(ts.ClassMethod, {
19
+ refkey: refkey,
20
+ name: name,
21
+ get async() {
22
+ return props.async;
23
+ },
24
+ returnType: returnType,
25
+ get parameters() {
26
+ return buildParameterDescriptors(props.type.parameters, {
27
+ params: props.parameters,
28
+ mode: props.parametersMode
29
+ });
30
+ },
31
+ get children() {
32
+ return props.children;
33
+ }
34
+ });
35
+ }
36
+ function isTypedMethodDeclarationProps(props) {
37
+ return props.type !== undefined;
38
+ }
39
+ //# sourceMappingURL=class-method.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class-method.js","names":["refkey","getRefkey","ts","buildParameterDescriptors","getReturnType","TypeExpression","ClassMethod","props","isTypedMethodDeclarationProps","_$createComponent","type","name","useTSNamePolicy","getName","returnType","undefined","async","parameters","params","mode","parametersMode","children"],"sources":["../../../../src/typescript/components/class-method.tsx"],"sourcesContent":[null],"mappings":";;AAAA,SAASA,MAAM,IAAIC,SAAS,QAAQ,gBAAgB;AACpD,OAAO,KAAKC,EAAE,MAAM,sBAAsB;AAE1C,SAASC,yBAAyB,EAAEC,aAAa,QAAQ,uBAAuB;AAChF,SAASC,cAAc;AAUvB,OAAO,SAASC,WAAWA,CAACC,KAAuB,EAAE;EACnD,IAAI,CAACC,6BAA6B,CAACD,KAAK,CAAC,EAAE;IACzC,OAAAE,iBAAA,CAAQP,EAAE,CAACI,WAAW,EAAKC,KAAK;EAClC;EAEA,MAAMP,MAAM,GAAGO,KAAK,CAACP,MAAM,IAAIC,SAAS,CAACM,KAAK,CAACG,IAAI,EAAE,QAAQ,CAAC;EAE9D,MAAMC,IAAI,GAAGJ,KAAK,CAACI,IAAI,GAAGJ,KAAK,CAACI,IAAI,GAAGT,EAAE,CAACU,eAAe,CAAC,CAAC,CAACC,OAAO,CAACN,KAAK,CAACG,IAAI,CAACC,IAAI,EAAE,UAAU,CAAC;EAChG,MAAMG,UAAU,GACdP,KAAK,CAACO,UAAU,KAAK,IAAI,GAAGC,SAAS,GAAAN,iBAAA,CAAIJ,cAAc;IAAA,IAACK,IAAIA,CAAA;MAAA,OAAEN,aAAa,CAACG,KAAK,CAACG,IAAI,CAAC;IAAA;EAAA,EAAI;EAE7F,OAAAD,iBAAA,CAAQP,EAAE,CAACI,WAAW;IACpBN,MAAM,EAAEA,MAAM;IACdW,IAAI,EAAEA,IAAI;IAAA,IACVK,KAAKA,CAAA;MAAA,OAAET,KAAK,CAACS,KAAK;IAAA;IAClBF,UAAU,EAAEA,UAAU;IAAA,IACtBG,UAAUA,CAAA;MAAA,OAAEd,yBAAyB,CAACI,KAAK,CAACG,IAAI,CAACO,UAAU,EAAE;QAACC,MAAM,EAAEX,KAAK,CAACU,UAAU;QAAEE,IAAI,EAAEZ,KAAK,CAACa;MAAc,CAAC,CAAC;IAAA;IAAA,IAAAC,SAAA;MAAA,OAEnHd,KAAK,CAACc,QAAQ;IAAA;EAAA;AAEnB;AAEA,SAASb,6BAA6BA,CAACD,KAAuB,EAAqC;EACjG,OAAQA,KAAK,CAA8BG,IAAI,KAAKK,SAAS;AAC/D","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ import { Refkey } from "@alloy-js/core";
2
+ import * as ts from "@alloy-js/typescript";
3
+ import { Enum, EnumMember as TspEnumMember, Union } from "@typespec/compiler";
4
+ export interface EnumDeclarationProps extends Omit<ts.TypeDeclarationProps, "name"> {
5
+ name?: string;
6
+ type: Union | Enum;
7
+ }
8
+ export declare function EnumDeclaration(props: EnumDeclarationProps): any;
9
+ export interface EnumMemberProps {
10
+ type: TspEnumMember;
11
+ refkey?: Refkey;
12
+ }
13
+ export declare function EnumMember(props: EnumMemberProps): any;
14
+ //# sourceMappingURL=enum-declaration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enum-declaration.d.ts","sourceRoot":"","sources":["../../../../src/typescript/components/enum-declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAU,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,UAAU,IAAI,aAAa,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI9E,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,EAAE,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACjF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC;CACpB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,OAsC1D;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,OAMhD"}
@@ -0,0 +1,61 @@
1
+ import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
2
+ import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
3
+ import { mapJoin, refkey } from "@alloy-js/core";
4
+ import * as ts from "@alloy-js/typescript";
5
+ import { $ } from "@typespec/compiler/experimental/typekit";
6
+ import { reportDiagnostic } from "../../lib.js";
7
+ export function EnumDeclaration(props) {
8
+ let type;
9
+ if ($.union.is(props.type)) {
10
+ if (!$.union.isValidEnum(props.type)) {
11
+ throw new Error("The provided union type cannot be represented as an enum");
12
+ }
13
+ type = $.enum.createFromUnion(props.type);
14
+ } else {
15
+ type = props.type;
16
+ }
17
+ const members = mapJoin(type.members, (key, value) => {
18
+ return _$createComponent(EnumMember, {
19
+ type: value,
20
+ get refkey() {
21
+ return _$memo(() => !!$.union.is(props.type))() ? refkey(props.type.variants.get(key)) : refkey(value);
22
+ }
23
+ });
24
+ }, {
25
+ joiner: ",\n"
26
+ });
27
+ if (!props.type.name || props.type.name === "") {
28
+ reportDiagnostic($.program, {
29
+ code: "type-declaration-missing-name",
30
+ target: props.type
31
+ });
32
+ }
33
+ const name = props.name ?? ts.useTSNamePolicy().getName(props.type.name, "enum");
34
+ return _$createComponent(ts.EnumDeclaration, {
35
+ name: name,
36
+ get refkey() {
37
+ return refkey(props.type);
38
+ },
39
+ get ["default"]() {
40
+ return props.default;
41
+ },
42
+ get ["export"]() {
43
+ return props.export;
44
+ },
45
+ children: members
46
+ });
47
+ }
48
+ export function EnumMember(props) {
49
+ return _$createComponent(ts.EnumMember, {
50
+ get name() {
51
+ return props.type.name;
52
+ },
53
+ get jsValue() {
54
+ return props.type.value ?? props.type.name;
55
+ },
56
+ get refkey() {
57
+ return refkey(props.refkey ?? props.type);
58
+ }
59
+ });
60
+ }
61
+ //# sourceMappingURL=enum-declaration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enum-declaration.js","names":["mapJoin","refkey","ts","$","reportDiagnostic","EnumDeclaration","props","type","union","is","isValidEnum","Error","enum","createFromUnion","members","key","value","_$createComponent","EnumMember","_$memo","variants","get","joiner","name","program","code","target","useTSNamePolicy","getName","default","export","children","jsValue"],"sources":["../../../../src/typescript/components/enum-declaration.tsx"],"sourcesContent":[null],"mappings":";;AAAA,SAASA,OAAO,EAAUC,MAAM,QAAQ,gBAAgB;AACxD,OAAO,KAAKC,EAAE,MAAM,sBAAsB;AAE1C,SAASC,CAAC,QAAQ,yCAAyC;AAC3D,SAASC,gBAAgB,QAAQ,cAAc;AAO/C,OAAO,SAASC,eAAeA,CAACC,KAA2B,EAAE;EAC3D,IAAIC,IAAU;EACd,IAAIJ,CAAC,CAACK,KAAK,CAACC,EAAE,CAACH,KAAK,CAACC,IAAI,CAAC,EAAE;IAC1B,IAAI,CAACJ,CAAC,CAACK,KAAK,CAACE,WAAW,CAACJ,KAAK,CAACC,IAAI,CAAC,EAAE;MACpC,MAAM,IAAII,KAAK,CAAC,0DAA0D,CAAC;IAC7E;IACAJ,IAAI,GAAGJ,CAAC,CAACS,IAAI,CAACC,eAAe,CAACP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BjB;EAAO;AAEb;AAOA,OAAO,SAASI,UAAUA,CAACZ,KAAsB,EAAE;EACjD,OAAAW,iBAAA,CAAQf,EAAE,CAACgB,UAAU;IAAA,IACnBK,IAAIA,CAAA;MAAA,OAAEjB,KAAK,CAACC,IAAI,CAACgB,IAAI;IAAA;IAAA,IACrBS,OAAOA,CAAA;MAAA,OAAE1B,KAAK,CAACC,IAAI,CAACS,KAAK,IAAIV,KAAK,CAACC,IAAI,CAACgB,IAAI;IAAA;IAAA,IAC5CtB,MAAMA,CAAA;MAAA,OAAEA,MAAM,CAACK,KAAK,CAACL,MAAM,IAAIK,KAAK,CAACC,IAAI,CAAC;IAAA;EAAA;AAE9C","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ import * as ts from "@alloy-js/typescript";
2
+ import { Model, Operation } from "@typespec/compiler";
3
+ export interface FunctionDeclarationPropsWithType extends Omit<ts.FunctionDeclarationProps, "name"> {
4
+ type: Operation;
5
+ name?: string;
6
+ parametersMode?: "prepend" | "append" | "replace";
7
+ }
8
+ export type FunctionDeclarationProps = FunctionDeclarationPropsWithType | ts.FunctionDeclarationProps;
9
+ export declare function FunctionDeclaration(props: FunctionDeclarationProps): any;
10
+ export declare namespace FunctionDeclaration {
11
+ var Parameters: (props: FunctionParametersProps) => any;
12
+ }
13
+ export interface TypedFunctionParametersProps extends Omit<ts.FunctionDeclarationProps, "name"> {
14
+ type: Model;
15
+ name?: string;
16
+ }
17
+ export type FunctionParametersProps = TypedFunctionParametersProps | ts.FunctionParametersProps;
18
+ //# sourceMappingURL=function-declaration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function-declaration.d.ts","sourceRoot":"","sources":["../../../../src/typescript/components/function-declaration.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAItD,MAAM,WAAW,gCACf,SAAQ,IAAI,CAAC,EAAE,CAAC,wBAAwB,EAAE,MAAM,CAAC;IACjD,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;CACnD;AAED,MAAM,MAAM,wBAAwB,GAChC,gCAAgC,GAChC,EAAE,CAAC,wBAAwB,CAAC;AAEhC,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,OAkClE;yBAlCe,mBAAmB;4BA2CyB,uBAAuB;;AAPnF,MAAM,WAAW,4BAA6B,SAAQ,IAAI,CAAC,EAAE,CAAC,wBAAwB,EAAE,MAAM,CAAC;IAC7F,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,uBAAuB,GAAG,4BAA4B,GAAG,EAAE,CAAC,uBAAuB,CAAC"}
@@ -0,0 +1,71 @@
1
+ import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
2
+ import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
3
+ import { refkey as getRefkey } from "@alloy-js/core";
4
+ import * as ts from "@alloy-js/typescript";
5
+ import { buildParameterDescriptors, getReturnType } from "../utils/operation.js";
6
+ import { TypeExpression } from "./type-expression.js";
7
+ export function FunctionDeclaration(props) {
8
+ if (!isTypedFunctionDeclarationProps(props)) {
9
+ if (!props.name) {}
10
+ return _$createComponent(ts.FunctionDeclaration, props);
11
+ }
12
+ const refkey = props.refkey ?? getRefkey(props.type);
13
+ let name = props.name ? props.name : ts.useTSNamePolicy().getName(props.type.name, "function");
14
+
15
+ // TODO: This should probably be a broader check in alloy to guard\
16
+ // any identifier.
17
+ if (reservedFunctionKeywords.has(name)) {
18
+ name = `${name}_`;
19
+ }
20
+ const returnType = props.returnType ?? _$createComponent(TypeExpression, {
21
+ get type() {
22
+ return getReturnType(props.type);
23
+ }
24
+ });
25
+ const allParameters = buildParameterDescriptors(props.type.parameters, {
26
+ params: props.parameters,
27
+ mode: props.parametersMode
28
+ });
29
+ return _$createComponent(ts.FunctionDeclaration, {
30
+ refkey: refkey,
31
+ name: name,
32
+ get async() {
33
+ return props.async;
34
+ },
35
+ get ["default"]() {
36
+ return props.default;
37
+ },
38
+ get ["export"]() {
39
+ return props.export;
40
+ },
41
+ get kind() {
42
+ return props.kind;
43
+ },
44
+ returnType: returnType,
45
+ get children() {
46
+ return [_$createComponent(ts.FunctionDeclaration.Parameters, {
47
+ parameters: allParameters
48
+ }), "\n", _$memo(() => props.children)];
49
+ }
50
+ });
51
+ }
52
+ FunctionDeclaration.Parameters = function Parameters(props) {
53
+ if (!isTypedFunctionParametersProps(props)) {
54
+ return _$createComponent(ts.FunctionDeclaration.Parameters, props);
55
+ }
56
+ const parameterDescriptors = buildParameterDescriptors(props.type);
57
+ return _$createComponent(ts.FunctionDeclaration.Parameters, {
58
+ parameters: parameterDescriptors,
59
+ get children() {
60
+ return props.children;
61
+ }
62
+ });
63
+ };
64
+ function isTypedFunctionDeclarationProps(props) {
65
+ return "type" in props;
66
+ }
67
+ function isTypedFunctionParametersProps(props) {
68
+ return "type" in props;
69
+ }
70
+ const reservedFunctionKeywords = new Set(["break", "case", "catch", "class", "const", "continue", "debugger", "default", "delete", "do", "else", "enum", "export", "extends", "finally", "for", "function", "if", "import", "in", "instanceof", "new", "return", "super", "switch", "this", "throw", "try", "typeof", "var", "void", "while", "with", "yield", "let", "static", "implements", "interface", "package", "private", "protected", "public", "await"]);
71
+ //# sourceMappingURL=function-declaration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function-declaration.js","names":["refkey","getRefkey","ts","buildParameterDescriptors","getReturnType","TypeExpression","FunctionDeclaration","props","isTypedFunctionDeclarationProps","name","_$createComponent","type","useTSNamePolicy","getName","reservedFunctionKeywords","has","returnType","allParameters","parameters","params","mode","parametersMode","async","default","export","kind","children","Parameters","_$memo","isTypedFunctionParametersProps","parameterDescriptors","Set"],"sources":["../../../../src/typescript/components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,SAAS,EACT,SAAS,EACT,KAAK,EACL,UAAU,EACV,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,MAAM,EACN,OAAO,EACP,KAAK,EACL,QAAQ,EACR,KAAK,EACL,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,EACR,OAAO,CACR,CAAC","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ export * from "./class-method.js";
2
+ export * from "./function-declaration.js";
3
+ export * from "./interface-declaration.js";
4
+ export * from "./interface-member.js";
5
+ export * from "./static-serializers.js";
6
+ export * from "./type-declaration.js";
7
+ export * from "./type-expression.js";
8
+ export * from "./type-transform.js";
9
+ export * from "./union-declaration.js";
10
+ export * from "./union-expression.js";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/typescript/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,11 @@
1
+ export * from "./class-method.js";
2
+ export * from "./function-declaration.js";
3
+ export * from "./interface-declaration.js";
4
+ export * from "./interface-member.js";
5
+ export * from "./static-serializers.js";
6
+ export * from "./type-declaration.js";
7
+ export * from "./type-expression.js";
8
+ export * from "./type-transform.js";
9
+ export * from "./union-declaration.js";
10
+ export * from "./union-expression.js";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/typescript/components/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,2BAA2B;AACzC,cAAc,4BAA4B;AAC1C,cAAc,uBAAuB;AACrC,cAAc,yBAAyB;AACvC,cAAc,uBAAuB;AACrC,cAAc,sBAAsB;AACpC,cAAc,qBAAqB;AACnC,cAAc,wBAAwB;AACtC,cAAc,uBAAuB","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ import * as ts from "@alloy-js/typescript";
2
+ import { Interface, Model } from "@typespec/compiler";
3
+ export interface TypedInterfaceDeclarationProps extends Omit<ts.InterfaceDeclarationProps, "name"> {
4
+ type: Model | Interface;
5
+ name?: string;
6
+ }
7
+ export type InterfaceDeclarationProps = TypedInterfaceDeclarationProps | ts.InterfaceDeclarationProps;
8
+ export declare function InterfaceDeclaration(props: InterfaceDeclarationProps): any;
9
+ export interface InterfaceExpressionProps extends ts.InterfaceExpressionProps {
10
+ type: Model | Interface;
11
+ }
12
+ export declare function InterfaceExpression({ type, children }: InterfaceExpressionProps): any;
13
+ //# sourceMappingURL=interface-declaration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interface-declaration.d.ts","sourceRoot":"","sources":["../../../../src/typescript/components/interface-declaration.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,KAAK,EAA0C,MAAM,oBAAoB,CAAC;AAM9F,MAAM,WAAW,8BAA+B,SAAQ,IAAI,CAAC,EAAE,CAAC,yBAAyB,EAAE,MAAM,CAAC;IAChG,IAAI,EAAE,KAAK,GAAG,SAAS,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,yBAAyB,GACjC,8BAA8B,GAC9B,EAAE,CAAC,yBAAyB,CAAC;AAEjC,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,OAuCpE;AAQD,MAAM,WAAW,wBAAyB,SAAQ,EAAE,CAAC,wBAAwB;IAC3E,IAAI,EAAE,KAAK,GAAG,SAAS,CAAC;CACzB;AAED,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,wBAAwB,OAS/E"}