@alloy-js/go 0.3.1-dev.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/dev/src/components/doc/comment.test.js +39 -40
- package/dist/dev/src/components/doc/comment.test.js.map +1 -1
- package/dist/dev/src/components/interface/declaration.js +16 -16
- package/dist/dev/src/components/interface/declaration.js.map +1 -1
- package/dist/dev/src/components/interface/interface.test.js +27 -28
- package/dist/dev/src/components/interface/interface.test.js.map +1 -1
- package/dist/dev/src/components/struct/declaration.js +13 -13
- package/dist/dev/src/components/struct/declaration.js.map +1 -1
- package/dist/dev/src/components/struct/struct.test.js +49 -51
- package/dist/dev/src/components/struct/struct.test.js.map +1 -1
- package/dist/dev/src/components/var/var-declaration.test.js +72 -67
- package/dist/dev/src/components/var/var-declaration.test.js.map +1 -1
- package/dist/dev/src/create-module.js.map +1 -1
- package/dist/dev/test/utils.js +5 -55
- package/dist/dev/test/utils.js.map +1 -1
- package/dist/src/components/doc/comment.test.d.ts +1 -1
- package/dist/src/components/doc/comment.test.d.ts.map +1 -1
- package/dist/src/components/doc/comment.test.js +0 -1
- package/dist/src/components/doc/comment.test.js.map +1 -1
- package/dist/src/components/interface/declaration.d.ts.map +1 -1
- package/dist/src/components/interface/declaration.js.map +1 -1
- package/dist/src/components/interface/interface.test.js +4 -5
- package/dist/src/components/interface/interface.test.js.map +1 -1
- package/dist/src/components/struct/declaration.d.ts.map +1 -1
- package/dist/src/components/struct/declaration.js.map +1 -1
- package/dist/src/components/struct/struct.test.js +6 -8
- package/dist/src/components/struct/struct.test.js.map +1 -1
- package/dist/src/components/var/var-declaration.test.d.ts +1 -1
- package/dist/src/components/var/var-declaration.test.d.ts.map +1 -1
- package/dist/src/components/var/var-declaration.test.js +16 -11
- package/dist/src/components/var/var-declaration.test.js.map +1 -1
- package/dist/src/create-module.d.ts.map +1 -1
- package/dist/src/create-module.js.map +1 -1
- package/dist/test/utils.d.ts +1 -4
- package/dist/test/utils.d.ts.map +1 -1
- package/dist/test/utils.js +1 -43
- package/dist/test/utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/api/components/index.md +0 -1
- package/docs/api/index.md +2 -2
- package/docs/api/types/ReferenceProps.md +7 -0
- package/docs/api/types/index.md +1 -0
- package/package.json +11 -10
- package/src/components/doc/comment.test.tsx +0 -1
- package/src/components/interface/declaration.tsx +1 -2
- package/src/components/interface/interface.test.tsx +4 -6
- package/src/components/struct/declaration.tsx +1 -2
- package/src/components/struct/struct.test.tsx +6 -10
- package/src/components/var/var-declaration.test.tsx +15 -13
- package/src/create-module.ts +12 -8
- package/temp/api.json +38 -14
- package/test/utils.tsx +1 -64
- package/tsconfig.json +1 -1
- package/tsdoc-metadata.json +1 -1
- package/vitest.config.ts +1 -0
- package/docs/api/components/Reference.md +0 -25
package/docs/api/index.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @alloy-js/go API Reference
|
|
2
2
|
|
|
3
|
-
- [components](components/index.md) (
|
|
3
|
+
- [components](components/index.md) (27 items)
|
|
4
4
|
- [contexts](contexts/index.md) (2 items)
|
|
5
5
|
- [functions](functions/index.md) (27 items)
|
|
6
|
-
- [types](types/index.md) (
|
|
6
|
+
- [types](types/index.md) (37 items)
|
|
7
7
|
- [variables](variables/index.md) (1 items)
|
package/docs/api/types/index.md
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
- [PackageDescriptor](PackageDescriptor.md) — Extends [NamedTypeDescriptor](../namedtypedescriptor/)\<M>
|
|
31
31
|
- [PackageSymbol](PackageSymbol.md) — A symbol for a package in Go.
|
|
32
32
|
- [PackageSymbolOptions](PackageSymbolOptions.md) — Extends [OutputSymbolOptions](../../../core/types/outputsymboloptions/)
|
|
33
|
+
- [ReferenceProps](ReferenceProps.md)
|
|
33
34
|
- [ResolveDescriptor](ResolveDescriptor.md) — type ResolveDescriptor<D> = D extends NamedTypeDescriptor<infer M> ?
|
|
34
35
|
- [SourceFileHeaderProps](SourceFileHeaderProps.md)
|
|
35
36
|
- [StrictDescriptor](StrictDescriptor.md) — type StrictDescriptor = PackageDescriptor<Record<string, StrictDescriptor>> | FieldDescriptor | FunctionDescriptor | Met
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alloy-js/go",
|
|
3
|
-
"version": "0.3.1
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Go bindings for Alloy",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,18 +27,19 @@
|
|
|
27
27
|
"author": "",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@alloy-js/core": "~0.23.0 || >= 0.24.0-dev.1",
|
|
31
30
|
"change-case": "^5.4.4",
|
|
32
|
-
"pathe": "^2.0.3"
|
|
31
|
+
"pathe": "^2.0.3",
|
|
32
|
+
"@alloy-js/core": "~0.24.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
35
|
+
"@microsoft/api-extractor": "~7.58.8",
|
|
36
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
37
|
+
"@types/node": "^25.9.2",
|
|
38
|
+
"concurrently": "^10.0.3",
|
|
39
|
+
"typescript": "^6.0.3",
|
|
40
|
+
"vitest": "4.1.8",
|
|
41
|
+
"@alloy-js/cli": "~0.24.0",
|
|
42
|
+
"@alloy-js/rollup-plugin": "~0.1.2"
|
|
42
43
|
},
|
|
43
44
|
"type": "module",
|
|
44
45
|
"scripts": {
|
|
@@ -56,8 +56,7 @@ export interface InterfaceDeclarationProps {
|
|
|
56
56
|
* This is a combination of `InterfaceDeclarationProps` and `TypeDeclarationProps`.
|
|
57
57
|
*/
|
|
58
58
|
export interface InterfaceTypeDeclarationProps
|
|
59
|
-
extends InterfaceDeclarationProps,
|
|
60
|
-
TypeDeclarationProps {}
|
|
59
|
+
extends InterfaceDeclarationProps, TypeDeclarationProps {}
|
|
61
60
|
|
|
62
61
|
/**
|
|
63
62
|
* Wrapper for creating a named interface type declaration.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { List, Output, refkey
|
|
1
|
+
import { List, Output, refkey } from "@alloy-js/core";
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
|
-
import {
|
|
3
|
+
import { TestPackage } from "../../../test/utils.js";
|
|
4
4
|
import { ModuleDirectory } from "../ModuleDirectory.jsx";
|
|
5
5
|
import { SourceDirectory } from "../SourceDirectory.jsx";
|
|
6
6
|
import { SourceFile } from "../SourceFile.jsx";
|
|
@@ -260,7 +260,7 @@ describe("embedded", () => {
|
|
|
260
260
|
const TestInterface = refkey("TestInterface");
|
|
261
261
|
const TestInterfaceEmbed = refkey("TestInterfaceEmbed");
|
|
262
262
|
|
|
263
|
-
|
|
263
|
+
expect(
|
|
264
264
|
<Output>
|
|
265
265
|
<ModuleDirectory name="github.com/alloy-framework/alloy">
|
|
266
266
|
<SourceDirectory path=".">
|
|
@@ -292,9 +292,7 @@ describe("embedded", () => {
|
|
|
292
292
|
</SourceDirectory>
|
|
293
293
|
</ModuleDirectory>
|
|
294
294
|
</Output>,
|
|
295
|
-
)
|
|
296
|
-
|
|
297
|
-
assertFileContents(res, {
|
|
295
|
+
).toRenderTo({
|
|
298
296
|
"hello/types.go": `
|
|
299
297
|
package hello
|
|
300
298
|
|
|
@@ -50,8 +50,7 @@ export interface StructDeclarationProps {
|
|
|
50
50
|
* This is a combination of `StructDeclarationProps` and `TypeDeclarationProps`.
|
|
51
51
|
*/
|
|
52
52
|
export interface StructTypeDeclarationProps
|
|
53
|
-
extends StructDeclarationProps,
|
|
54
|
-
TypeDeclarationProps {}
|
|
53
|
+
extends StructDeclarationProps, TypeDeclarationProps {}
|
|
55
54
|
|
|
56
55
|
/**
|
|
57
56
|
* Wrapper for creating a named struct type declaration.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { List, Output, refkey
|
|
1
|
+
import { List, Output, refkey } from "@alloy-js/core";
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
|
-
import {
|
|
3
|
+
import { TestPackage } from "../../../test/utils.js";
|
|
4
4
|
import { ModuleDirectory } from "../ModuleDirectory.js";
|
|
5
5
|
import { SourceDirectory } from "../SourceDirectory.js";
|
|
6
6
|
import { SourceFile } from "../SourceFile.js";
|
|
@@ -320,7 +320,7 @@ describe("embedded", () => {
|
|
|
320
320
|
const TestStruct = refkey("TestStruct");
|
|
321
321
|
const TestStructEmbed = refkey("TestStructEmbed");
|
|
322
322
|
|
|
323
|
-
|
|
323
|
+
expect(
|
|
324
324
|
<Output>
|
|
325
325
|
<ModuleDirectory name="github.com/alloy-framework/alloy">
|
|
326
326
|
<SourceDirectory path=".">
|
|
@@ -352,9 +352,7 @@ describe("embedded", () => {
|
|
|
352
352
|
</SourceDirectory>
|
|
353
353
|
</ModuleDirectory>
|
|
354
354
|
</Output>,
|
|
355
|
-
)
|
|
356
|
-
|
|
357
|
-
assertFileContents(res, {
|
|
355
|
+
).toRenderTo({
|
|
358
356
|
"hello/types.go": `
|
|
359
357
|
package hello
|
|
360
358
|
|
|
@@ -380,7 +378,7 @@ describe("embedded", () => {
|
|
|
380
378
|
const TestStruct = refkey("TestStruct");
|
|
381
379
|
const TestStructEmbed = refkey("TestStructEmbed");
|
|
382
380
|
|
|
383
|
-
|
|
381
|
+
expect(
|
|
384
382
|
<Output>
|
|
385
383
|
<ModuleDirectory name="github.com/alloy-framework/alloy">
|
|
386
384
|
<SourceDirectory path=".">
|
|
@@ -412,9 +410,7 @@ describe("embedded", () => {
|
|
|
412
410
|
</SourceDirectory>
|
|
413
411
|
</ModuleDirectory>
|
|
414
412
|
</Output>,
|
|
415
|
-
)
|
|
416
|
-
|
|
417
|
-
assertFileContents(res, {
|
|
413
|
+
).toRenderTo({
|
|
418
414
|
"hello/types.go": `
|
|
419
415
|
package hello
|
|
420
416
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Output, refkey, render } from "@alloy-js/core";
|
|
2
|
-
import "@alloy-js/core/testing";
|
|
3
2
|
import { expect, it } from "vitest";
|
|
4
|
-
import { assertFileContents } from "../../../test/utils.js";
|
|
5
3
|
import * as go from "../index.js";
|
|
6
4
|
|
|
7
5
|
it("works variable", () => {
|
|
@@ -82,7 +80,7 @@ it("works const group", () => {
|
|
|
82
80
|
it("works end-to-end", () => {
|
|
83
81
|
const TestType = refkey("TestType");
|
|
84
82
|
|
|
85
|
-
|
|
83
|
+
expect(
|
|
86
84
|
<Output>
|
|
87
85
|
<go.ModuleDirectory name="github.com/alloy-framework/alloy">
|
|
88
86
|
<go.SourceDirectory path=".">
|
|
@@ -99,9 +97,7 @@ it("works end-to-end", () => {
|
|
|
99
97
|
</go.SourceDirectory>
|
|
100
98
|
</go.ModuleDirectory>
|
|
101
99
|
</Output>,
|
|
102
|
-
)
|
|
103
|
-
|
|
104
|
-
assertFileContents(res, {
|
|
100
|
+
).toRenderTo({
|
|
105
101
|
"types.go": `
|
|
106
102
|
package alloy
|
|
107
103
|
|
|
@@ -147,7 +143,7 @@ it("throws end-to-end cross-package with unexported type", () => {
|
|
|
147
143
|
it("works end-to-end cross-package", () => {
|
|
148
144
|
const TestType = refkey("TestType");
|
|
149
145
|
|
|
150
|
-
|
|
146
|
+
expect(
|
|
151
147
|
<Output>
|
|
152
148
|
<go.ModuleDirectory name="github.com/alloy-framework/alloy">
|
|
153
149
|
<go.SourceDirectory path="hello">
|
|
@@ -166,9 +162,7 @@ it("works end-to-end cross-package", () => {
|
|
|
166
162
|
</go.SourceDirectory>
|
|
167
163
|
</go.ModuleDirectory>
|
|
168
164
|
</Output>,
|
|
169
|
-
)
|
|
170
|
-
|
|
171
|
-
assertFileContents(res, {
|
|
165
|
+
).toRenderTo({
|
|
172
166
|
"hello/types.go": `
|
|
173
167
|
package hello
|
|
174
168
|
|
|
@@ -188,7 +182,7 @@ it("works with conflict resolution", () => {
|
|
|
188
182
|
const TestType1 = refkey("TestType1");
|
|
189
183
|
const TestType2 = refkey("TestType2");
|
|
190
184
|
|
|
191
|
-
|
|
185
|
+
expect(
|
|
192
186
|
<Output>
|
|
193
187
|
<go.ModuleDirectory name="github.com/alloy-framework/alloy">
|
|
194
188
|
<go.SourceDirectory path="hello" name="hello">
|
|
@@ -218,9 +212,17 @@ it("works with conflict resolution", () => {
|
|
|
218
212
|
</go.SourceDirectory>
|
|
219
213
|
</go.ModuleDirectory>
|
|
220
214
|
</Output>,
|
|
221
|
-
)
|
|
215
|
+
).toRenderTo({
|
|
216
|
+
"hello/types.go": `
|
|
217
|
+
package hello
|
|
218
|
+
|
|
219
|
+
type TestType string
|
|
220
|
+
`,
|
|
221
|
+
"hello2/types.go": `
|
|
222
|
+
package hello
|
|
222
223
|
|
|
223
|
-
|
|
224
|
+
type TestType string
|
|
225
|
+
`,
|
|
224
226
|
"world/test.go": `
|
|
225
227
|
package world
|
|
226
228
|
|
package/src/create-module.ts
CHANGED
|
@@ -42,26 +42,30 @@ export interface NamedTypeDescriptor<M extends Record<string, Descriptor>> {
|
|
|
42
42
|
members: M;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export interface TypeDescriptor<
|
|
46
|
-
extends
|
|
45
|
+
export interface TypeDescriptor<
|
|
46
|
+
M extends Record<string, Descriptor>,
|
|
47
|
+
> extends NamedTypeDescriptor<M> {
|
|
47
48
|
kind: "type";
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
export interface PackageDescriptor<
|
|
51
|
-
extends
|
|
51
|
+
export interface PackageDescriptor<
|
|
52
|
+
M extends Record<string, Descriptor>,
|
|
53
|
+
> extends NamedTypeDescriptor<M> {
|
|
52
54
|
kind: "package";
|
|
53
55
|
path?: string;
|
|
54
56
|
name?: string;
|
|
55
57
|
members: M;
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
export interface StructDescriptor<
|
|
59
|
-
extends
|
|
60
|
+
export interface StructDescriptor<
|
|
61
|
+
M extends Record<string, Descriptor>,
|
|
62
|
+
> extends NamedTypeDescriptor<M> {
|
|
60
63
|
kind: "struct";
|
|
61
64
|
}
|
|
62
65
|
|
|
63
|
-
export interface InterfaceDescriptor<
|
|
64
|
-
extends
|
|
66
|
+
export interface InterfaceDescriptor<
|
|
67
|
+
M extends Record<string, Descriptor>,
|
|
68
|
+
> extends NamedTypeDescriptor<M> {
|
|
65
69
|
kind: "interface";
|
|
66
70
|
}
|
|
67
71
|
|
package/temp/api.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"metadata": {
|
|
3
3
|
"toolPackage": "@microsoft/api-extractor",
|
|
4
|
-
"toolVersion": "7.
|
|
4
|
+
"toolVersion": "7.58.8",
|
|
5
5
|
"schemaVersion": 1011,
|
|
6
6
|
"oldestForwardsCompatibleVersion": 1001,
|
|
7
7
|
"tsdocConfig": {
|
|
@@ -114,6 +114,22 @@
|
|
|
114
114
|
"tagName": "@virtual",
|
|
115
115
|
"syntaxKind": "modifier"
|
|
116
116
|
},
|
|
117
|
+
{
|
|
118
|
+
"tagName": "@jsx",
|
|
119
|
+
"syntaxKind": "block"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"tagName": "@jsxRuntime",
|
|
123
|
+
"syntaxKind": "block"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"tagName": "@jsxFrag",
|
|
127
|
+
"syntaxKind": "block"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"tagName": "@jsxImportSource",
|
|
131
|
+
"syntaxKind": "block"
|
|
132
|
+
},
|
|
117
133
|
{
|
|
118
134
|
"tagName": "@betaDocumentation",
|
|
119
135
|
"syntaxKind": "modifier"
|
|
@@ -175,7 +191,7 @@
|
|
|
175
191
|
{
|
|
176
192
|
"kind": "Function",
|
|
177
193
|
"canonicalReference": "@alloy-js/go!BlockComment:function(1)",
|
|
178
|
-
"docComment": "/**\n * A Go block comment. In go, line comments are the norm, so consider
|
|
194
|
+
"docComment": "/**\n * A Go block comment. In go, line comments are the norm, so consider using {@link LineComment} instead. The children of this component are joined with two hard linebreaks. This is useful for creating block comments with multiple paragraphs.\n */\n",
|
|
179
195
|
"excerptTokens": [
|
|
180
196
|
{
|
|
181
197
|
"kind": "Content",
|
|
@@ -2436,7 +2452,7 @@
|
|
|
2436
2452
|
{
|
|
2437
2453
|
"kind": "PropertySignature",
|
|
2438
2454
|
"canonicalReference": "@alloy-js/go!FunctionProps#singleLine:member",
|
|
2439
|
-
"docComment": "/**\n * Whether to render the function in a single line
|
|
2455
|
+
"docComment": "/**\n * Whether to render the function in a single line. This will only compile if `children` is a single line as well. This is not common in Go, so use with caution.\n */\n",
|
|
2440
2456
|
"excerptTokens": [
|
|
2441
2457
|
{
|
|
2442
2458
|
"kind": "Content",
|
|
@@ -3145,7 +3161,7 @@
|
|
|
3145
3161
|
{
|
|
3146
3162
|
"kind": "Class",
|
|
3147
3163
|
"canonicalReference": "@alloy-js/go!GoNamedTypeScope:class",
|
|
3148
|
-
"docComment": "/**\n * This scope contains NamedTypeSymbols for types that are declared in
|
|
3164
|
+
"docComment": "/**\n * This scope contains NamedTypeSymbols for types that are declared in containers like packages. This scope is a member scope which whose member symbol is a NamedTypeSymbol.\n */\n",
|
|
3149
3165
|
"excerptTokens": [
|
|
3150
3166
|
{
|
|
3151
3167
|
"kind": "Content",
|
|
@@ -3394,7 +3410,7 @@
|
|
|
3394
3410
|
{
|
|
3395
3411
|
"kind": "Property",
|
|
3396
3412
|
"canonicalReference": "@alloy-js/go!GoNamedTypeScope#typeParameters:member",
|
|
3397
|
-
"docComment": "/**\n * For now, we stuff type parameters into the member scope. This is to ensure
|
|
3413
|
+
"docComment": "/**\n * For now, we stuff type parameters into the member scope. This is to ensure name conflicts are handled correctly.\n */\n",
|
|
3398
3414
|
"excerptTokens": [
|
|
3399
3415
|
{
|
|
3400
3416
|
"kind": "Content",
|
|
@@ -3957,7 +3973,7 @@
|
|
|
3957
3973
|
{
|
|
3958
3974
|
"kind": "Class",
|
|
3959
3975
|
"canonicalReference": "@alloy-js/go!GoSymbol:class",
|
|
3960
|
-
"docComment": "/**\n * This is the base type for all symbols in Go.\n *\n * Many subtypes of this symbol exist for specific purposes. However, this symbol
|
|
3976
|
+
"docComment": "/**\n * This is the base type for all symbols in Go.\n *\n * Many subtypes of this symbol exist for specific purposes. However, this symbol may be used in cases where a more specific symbol is not required.\n */\n",
|
|
3961
3977
|
"excerptTokens": [
|
|
3962
3978
|
{
|
|
3963
3979
|
"kind": "Content",
|
|
@@ -4625,7 +4641,7 @@
|
|
|
4625
4641
|
{
|
|
4626
4642
|
"kind": "Interface",
|
|
4627
4643
|
"canonicalReference": "@alloy-js/go!InterfaceDeclarationProps:interface",
|
|
4628
|
-
"docComment": "/**\n * Properties for creating an interface declaration
|
|
4644
|
+
"docComment": "/**\n * Properties for creating an interface declaration. This can be used for both named and anonymous interfaces. For named interfaces, use `InterfaceTypeDeclarationProps` instead.\n */\n",
|
|
4629
4645
|
"excerptTokens": [
|
|
4630
4646
|
{
|
|
4631
4647
|
"kind": "Content",
|
|
@@ -4696,7 +4712,7 @@
|
|
|
4696
4712
|
{
|
|
4697
4713
|
"kind": "PropertySignature",
|
|
4698
4714
|
"canonicalReference": "@alloy-js/go!InterfaceDeclarationProps#singleLine:member",
|
|
4699
|
-
"docComment": "/**\n * Whether to render the interface in a single line
|
|
4715
|
+
"docComment": "/**\n * Whether to render the interface in a single line. This will only compile if `children` is a single line as well. This is not common in Go, so use with caution.\n */\n",
|
|
4700
4716
|
"excerptTokens": [
|
|
4701
4717
|
{
|
|
4702
4718
|
"kind": "Content",
|
|
@@ -5233,7 +5249,7 @@
|
|
|
5233
5249
|
{
|
|
5234
5250
|
"kind": "Interface",
|
|
5235
5251
|
"canonicalReference": "@alloy-js/go!InterfaceTypeDeclarationProps:interface",
|
|
5236
|
-
"docComment": "/**\n * Properties for creating a named interface type declaration
|
|
5252
|
+
"docComment": "/**\n * Properties for creating a named interface type declaration. This is a combination of `InterfaceDeclarationProps` and `TypeDeclarationProps`.\n */\n",
|
|
5237
5253
|
"excerptTokens": [
|
|
5238
5254
|
{
|
|
5239
5255
|
"kind": "Content",
|
|
@@ -5326,7 +5342,7 @@
|
|
|
5326
5342
|
{
|
|
5327
5343
|
"kind": "Function",
|
|
5328
5344
|
"canonicalReference": "@alloy-js/go!LineComment:function(1)",
|
|
5329
|
-
"docComment": "/**\n * A Go line comment block. The children of this component
|
|
5345
|
+
"docComment": "/**\n * A Go line comment block. The children of this component are joined with two hard linebreaks. This is useful for creating line comments with multiple paragraphs.\n */\n",
|
|
5330
5346
|
"excerptTokens": [
|
|
5331
5347
|
{
|
|
5332
5348
|
"kind": "Content",
|
|
@@ -6944,7 +6960,7 @@
|
|
|
6944
6960
|
"excerptTokens": [
|
|
6945
6961
|
{
|
|
6946
6962
|
"kind": "Content",
|
|
6947
|
-
"text": "export declare function Reference(
|
|
6963
|
+
"text": "export declare function Reference(input: "
|
|
6948
6964
|
},
|
|
6949
6965
|
{
|
|
6950
6966
|
"kind": "Reference",
|
|
@@ -6979,6 +6995,14 @@
|
|
|
6979
6995
|
"parameters": [
|
|
6980
6996
|
{
|
|
6981
6997
|
"parameterName": "{ refkey }",
|
|
6998
|
+
"parameterTypeTokenRange": {
|
|
6999
|
+
"startIndex": 0,
|
|
7000
|
+
"endIndex": 0
|
|
7001
|
+
},
|
|
7002
|
+
"isOptional": false
|
|
7003
|
+
},
|
|
7004
|
+
{
|
|
7005
|
+
"parameterName": "input",
|
|
6982
7006
|
"parameterTypeTokenRange": {
|
|
6983
7007
|
"startIndex": 1,
|
|
6984
7008
|
"endIndex": 2
|
|
@@ -7875,7 +7899,7 @@
|
|
|
7875
7899
|
{
|
|
7876
7900
|
"kind": "Interface",
|
|
7877
7901
|
"canonicalReference": "@alloy-js/go!StructDeclarationProps:interface",
|
|
7878
|
-
"docComment": "/**\n * Properties for creating a struct declaration
|
|
7902
|
+
"docComment": "/**\n * Properties for creating a struct declaration. This can be used for both named and anonymous structs. For named structs, use `StructTypeDeclarationProps` instead.\n */\n",
|
|
7879
7903
|
"excerptTokens": [
|
|
7880
7904
|
{
|
|
7881
7905
|
"kind": "Content",
|
|
@@ -7946,7 +7970,7 @@
|
|
|
7946
7970
|
{
|
|
7947
7971
|
"kind": "PropertySignature",
|
|
7948
7972
|
"canonicalReference": "@alloy-js/go!StructDeclarationProps#singleLine:member",
|
|
7949
|
-
"docComment": "/**\n * Whether to render the struct in a single line
|
|
7973
|
+
"docComment": "/**\n * Whether to render the struct in a single line. This will only compile if `children` is a single line as well. This is not common in Go, so use with caution.\n */\n",
|
|
7950
7974
|
"excerptTokens": [
|
|
7951
7975
|
{
|
|
7952
7976
|
"kind": "Content",
|
|
@@ -8487,7 +8511,7 @@
|
|
|
8487
8511
|
{
|
|
8488
8512
|
"kind": "Interface",
|
|
8489
8513
|
"canonicalReference": "@alloy-js/go!StructTypeDeclarationProps:interface",
|
|
8490
|
-
"docComment": "/**\n * Properties for creating a named struct type declaration
|
|
8514
|
+
"docComment": "/**\n * Properties for creating a named struct type declaration. This is a combination of `StructDeclarationProps` and `TypeDeclarationProps`.\n */\n",
|
|
8491
8515
|
"excerptTokens": [
|
|
8492
8516
|
{
|
|
8493
8517
|
"kind": "Content",
|
package/test/utils.tsx
CHANGED
|
@@ -1,69 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Children,
|
|
3
|
-
ContentOutputFile,
|
|
4
|
-
Output,
|
|
5
|
-
OutputDirectory,
|
|
6
|
-
OutputFile,
|
|
7
|
-
PrintTreeOptions,
|
|
8
|
-
render,
|
|
9
|
-
} from "@alloy-js/core";
|
|
10
|
-
import { dedent } from "@alloy-js/core/testing";
|
|
11
|
-
import { expect } from "vitest";
|
|
1
|
+
import { Children, Output } from "@alloy-js/core";
|
|
12
2
|
import * as go from "../src/index.js";
|
|
13
3
|
|
|
14
|
-
export function toSourceText(c: Children, options?: PrintTreeOptions): string {
|
|
15
|
-
const res = render(
|
|
16
|
-
<Output>
|
|
17
|
-
<go.SourceFile path="test.go">{c}</go.SourceFile>
|
|
18
|
-
</Output>,
|
|
19
|
-
options,
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
return findFile(res, "test.go").contents;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function findFile(
|
|
26
|
-
res: OutputDirectory,
|
|
27
|
-
path: string,
|
|
28
|
-
): ContentOutputFile {
|
|
29
|
-
const result = findFileWorker(res, path);
|
|
30
|
-
|
|
31
|
-
if (!result) {
|
|
32
|
-
throw new Error("Expected to find file " + path);
|
|
33
|
-
}
|
|
34
|
-
return result as ContentOutputFile;
|
|
35
|
-
|
|
36
|
-
function findFileWorker(
|
|
37
|
-
res: OutputDirectory,
|
|
38
|
-
path: string,
|
|
39
|
-
): OutputFile | null {
|
|
40
|
-
for (const item of res.contents) {
|
|
41
|
-
if (item.kind === "file") {
|
|
42
|
-
if (item.path === path) {
|
|
43
|
-
return item;
|
|
44
|
-
}
|
|
45
|
-
continue;
|
|
46
|
-
} else {
|
|
47
|
-
const found = findFileWorker(item, path);
|
|
48
|
-
if (found) {
|
|
49
|
-
return found;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function assertFileContents(
|
|
58
|
-
res: OutputDirectory,
|
|
59
|
-
expectedFiles: Record<string, string>,
|
|
60
|
-
) {
|
|
61
|
-
for (const [path, contents] of Object.entries(expectedFiles)) {
|
|
62
|
-
const file = findFile(res, path);
|
|
63
|
-
expect(file.contents.trim()).toBe(dedent(contents).trim());
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
4
|
export function TestPackage(props: { children: Children }): Children {
|
|
68
5
|
return (
|
|
69
6
|
<Output>
|
package/tsconfig.json
CHANGED
package/tsdoc-metadata.json
CHANGED
package/vitest.config.ts
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# Reference
|
|
2
|
-
|
|
3
|
-
* jsx
|
|
4
|
-
|
|
5
|
-
```tsx
|
|
6
|
-
import { Reference } from "@alloy-js/go";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<Reference refkey={Refkey} />
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
* stc
|
|
13
|
-
|
|
14
|
-
```ts
|
|
15
|
-
import { Reference } from "@alloy-js/go/stc";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Reference({ refkey: Refkey }).children(children)
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Props
|
|
22
|
-
|
|
23
|
-
| | | |
|
|
24
|
-
| ------ | ------------------------------------- | - |
|
|
25
|
-
| refkey | [Refkey](../../../core/types/refkey/) | |
|