@alloy-js/typescript 0.4.0 → 0.6.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/CHANGELOG.md +19 -0
- package/dist/src/components/ArrayExpression.d.ts +1 -1
- package/dist/src/components/ArrayExpression.d.ts.map +1 -1
- package/dist/src/components/ArrayExpression.js +18 -28
- package/dist/src/components/ArrayExpression.js.map +1 -1
- package/dist/src/components/BarrelFile.d.ts +1 -1
- package/dist/src/components/BarrelFile.d.ts.map +1 -1
- package/dist/src/components/BarrelFile.js +11 -9
- package/dist/src/components/BarrelFile.js.map +1 -1
- package/dist/src/components/ClassDeclaration.d.ts +4 -4
- package/dist/src/components/ClassDeclaration.d.ts.map +1 -1
- package/dist/src/components/ClassDeclaration.js +8 -9
- package/dist/src/components/ClassDeclaration.js.map +1 -1
- package/dist/src/components/CommaList.d.ts +12 -0
- package/dist/src/components/CommaList.d.ts.map +1 -0
- package/dist/src/components/CommaList.js +19 -0
- package/dist/src/components/CommaList.js.map +1 -0
- package/dist/src/components/Declaration.d.ts +1 -1
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js.map +1 -1
- package/dist/src/components/EnumDeclaration.d.ts +1 -1
- package/dist/src/components/EnumDeclaration.d.ts.map +1 -1
- package/dist/src/components/EnumDeclaration.js +19 -17
- package/dist/src/components/EnumDeclaration.js.map +1 -1
- package/dist/src/components/EnumMember.d.ts +1 -1
- package/dist/src/components/EnumMember.d.ts.map +1 -1
- package/dist/src/components/EnumMember.js.map +1 -1
- package/dist/src/components/ExportStatement.d.ts +1 -1
- package/dist/src/components/ExportStatement.d.ts.map +1 -1
- package/dist/src/components/ExportStatement.js.map +1 -1
- package/dist/src/components/FunctionCallExpression.d.ts +3 -3
- package/dist/src/components/FunctionCallExpression.d.ts.map +1 -1
- package/dist/src/components/FunctionCallExpression.js +26 -9
- package/dist/src/components/FunctionCallExpression.js.map +1 -1
- package/dist/src/components/FunctionDeclaration.d.ts +9 -2
- package/dist/src/components/FunctionDeclaration.d.ts.map +1 -1
- package/dist/src/components/FunctionDeclaration.js +135 -33
- package/dist/src/components/FunctionDeclaration.js.map +1 -1
- package/dist/src/components/ImportStatement.d.ts +1 -1
- package/dist/src/components/ImportStatement.d.ts.map +1 -1
- package/dist/src/components/ImportStatement.js +25 -31
- package/dist/src/components/ImportStatement.js.map +1 -1
- package/dist/src/components/Interface.d.ts +3 -3
- package/dist/src/components/Interface.d.ts.map +1 -1
- package/dist/src/components/Interface.js +5 -5
- package/dist/src/components/Interface.js.map +1 -1
- package/dist/src/components/JSDoc.d.ts +10 -0
- package/dist/src/components/JSDoc.d.ts.map +1 -0
- package/dist/src/components/JSDoc.js +24 -0
- package/dist/src/components/JSDoc.js.map +1 -0
- package/dist/src/components/JSDocComment.d.ts +11 -0
- package/dist/src/components/JSDocComment.d.ts.map +1 -0
- package/dist/src/components/JSDocComment.js +16 -0
- package/dist/src/components/JSDocComment.js.map +1 -0
- package/dist/src/components/JSDocExample.d.ts +12 -0
- package/dist/src/components/JSDocExample.d.ts.map +1 -0
- package/dist/src/components/JSDocExample.js +26 -0
- package/dist/src/components/JSDocExample.js.map +1 -0
- package/dist/src/components/JSDocParagraph.d.ts +10 -0
- package/dist/src/components/JSDocParagraph.d.ts.map +1 -0
- package/dist/src/components/JSDocParagraph.js +23 -0
- package/dist/src/components/JSDocParagraph.js.map +1 -0
- package/dist/src/components/MemberChainExpression.d.ts +11 -0
- package/dist/src/components/MemberChainExpression.d.ts.map +1 -0
- package/dist/src/components/MemberChainExpression.js +64 -0
- package/dist/src/components/MemberChainExpression.js.map +1 -0
- package/dist/src/components/ObjectExpression.d.ts +2 -2
- package/dist/src/components/ObjectExpression.d.ts.map +1 -1
- package/dist/src/components/ObjectExpression.js +45 -42
- package/dist/src/components/ObjectExpression.js.map +1 -1
- package/dist/src/components/PackageDirectory.d.ts +1 -1
- package/dist/src/components/PackageDirectory.d.ts.map +1 -1
- package/dist/src/components/PackageDirectory.js +1 -1
- package/dist/src/components/PackageDirectory.js.map +1 -1
- package/dist/src/components/PackageJson.d.ts +1 -1
- package/dist/src/components/PackageJson.d.ts.map +1 -1
- package/dist/src/components/PackageJson.js.map +1 -1
- package/dist/src/components/Reference.d.ts +1 -1
- package/dist/src/components/Reference.d.ts.map +1 -1
- package/dist/src/components/Reference.js +1 -1
- package/dist/src/components/Reference.js.map +1 -1
- package/dist/src/components/SourceFile.d.ts +1 -1
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.js +13 -6
- package/dist/src/components/SourceFile.js.map +1 -1
- package/dist/src/components/TsConfigJson.d.ts +1 -1
- package/dist/src/components/TsConfigJson.d.ts.map +1 -1
- package/dist/src/components/TsConfigJson.js.map +1 -1
- package/dist/src/components/TypeDeclaration.d.ts +1 -1
- package/dist/src/components/TypeDeclaration.d.ts.map +1 -1
- package/dist/src/components/TypeDeclaration.js.map +1 -1
- package/dist/src/components/ValueExpression.d.ts +2 -1
- package/dist/src/components/ValueExpression.d.ts.map +1 -1
- package/dist/src/components/ValueExpression.js.map +1 -1
- package/dist/src/components/VarDeclaration.d.ts +1 -1
- package/dist/src/components/VarDeclaration.d.ts.map +1 -1
- package/dist/src/components/VarDeclaration.js +2 -2
- package/dist/src/components/VarDeclaration.js.map +1 -1
- package/dist/src/components/index.d.ts +2 -1
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +2 -1
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/stc/index.d.ts +21 -21
- package/dist/src/components/stc/index.d.ts.map +1 -1
- package/dist/src/components/stc/index.js +1 -1
- package/dist/src/components/stc/index.js.map +1 -1
- package/dist/test/imports.test.d.ts.map +1 -1
- package/dist/test/jsdoc.test.d.ts +2 -0
- package/dist/test/jsdoc.test.d.ts.map +1 -0
- package/dist/test/member-chain.test.d.ts +2 -0
- package/dist/test/member-chain.test.d.ts.map +1 -0
- package/dist/test/utils.d.ts +2 -2
- package/dist/test/utils.d.ts.map +1 -1
- package/dist/test/values.test.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -6
- package/src/components/ArrayExpression.tsx +18 -32
- package/src/components/BarrelFile.tsx +7 -13
- package/src/components/ClassDeclaration.tsx +33 -28
- package/src/components/CommaList.tsx +23 -0
- package/src/components/Declaration.tsx +7 -3
- package/src/components/EnumDeclaration.tsx +21 -14
- package/src/components/EnumMember.tsx +7 -4
- package/src/components/ExportStatement.tsx +6 -1
- package/src/components/FunctionCallExpression.tsx +18 -9
- package/src/components/FunctionDeclaration.tsx +170 -55
- package/src/components/ImportStatement.tsx +6 -9
- package/src/components/Interface.tsx +20 -13
- package/src/components/JSDoc.tsx +28 -0
- package/src/components/JSDocComment.tsx +23 -0
- package/src/components/JSDocExample.tsx +30 -0
- package/src/components/JSDocParagraph.tsx +35 -0
- package/src/components/MemberChainExpression.tsx +59 -0
- package/src/components/ObjectExpression.tsx +53 -48
- package/src/components/PackageDirectory.tsx +11 -9
- package/src/components/PackageJson.tsx +9 -6
- package/src/components/SourceFile.tsx +15 -8
- package/src/components/TsConfigJson.tsx +5 -3
- package/src/components/TypeDeclaration.tsx +5 -3
- package/src/components/ValueExpression.tsx +7 -5
- package/src/components/VarDeclaration.tsx +11 -5
- package/src/components/index.ts +2 -1
- package/src/components/stc/index.ts +1 -1
- package/temp/api.json +618 -208
- package/test/array.test.tsx +28 -7
- package/test/basic.test.tsx +26 -21
- package/test/class.test.tsx +65 -53
- package/test/enum.test.tsx +18 -13
- package/test/externals.test.tsx +6 -7
- package/test/function-call-expression.test.tsx +39 -17
- package/test/function-declaration.test.tsx +96 -78
- package/test/imports.test.tsx +90 -65
- package/test/interface.test.tsx +29 -19
- package/test/jsdoc.test.tsx +154 -0
- package/test/member-chain.test.tsx +47 -0
- package/test/name-policy.test.tsx +33 -26
- package/test/package-external.test.tsx +8 -4
- package/test/package.test.tsx +1 -2
- package/test/reference.test.tsx +2 -6
- package/test/utils.tsx +3 -1
- package/test/value-expression.test.tsx +2 -6
- package/test/values.test.tsx +67 -73
- package/test/var-declaration.test.tsx +11 -5
- package/test/vitest.d.ts +6 -1
- package/tsconfig.json +8 -1
- package/dist/src/components/Block.d.ts +0 -6
- package/dist/src/components/Block.d.ts.map +0 -1
- package/dist/src/components/Block.js +0 -11
- package/dist/src/components/Block.js.map +0 -1
- package/src/components/Block.tsx +0 -12
package/test/values.test.tsx
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Output,
|
|
3
2
|
mapJoin,
|
|
3
|
+
Output,
|
|
4
|
+
printTree,
|
|
4
5
|
reactive,
|
|
5
6
|
refkey,
|
|
6
7
|
render,
|
|
7
8
|
renderTree,
|
|
9
|
+
StatementList,
|
|
8
10
|
} from "@alloy-js/core";
|
|
9
11
|
import "@alloy-js/core/testing";
|
|
10
12
|
import { describe, expect, it } from "vitest";
|
|
11
13
|
|
|
12
|
-
import { d
|
|
14
|
+
import { d } from "@alloy-js/core/testing";
|
|
13
15
|
import * as ts from "../src/index.js";
|
|
14
16
|
import { assertFileContents } from "./utils.jsx";
|
|
15
17
|
|
|
@@ -20,7 +22,7 @@ it("renders an object", () => {
|
|
|
20
22
|
it("renders an object with properties", () => {
|
|
21
23
|
expect(
|
|
22
24
|
<ts.ObjectExpression>
|
|
23
|
-
<ts.ObjectProperty name="foo" value="1"
|
|
25
|
+
<ts.ObjectProperty name="foo" value="1" />,<hbr />
|
|
24
26
|
<ts.ObjectProperty name="bar" value="2" />
|
|
25
27
|
</ts.ObjectExpression>,
|
|
26
28
|
).toRenderTo(`
|
|
@@ -37,17 +39,14 @@ it("renders an object with properties, mapped", () => {
|
|
|
37
39
|
["bar", "2"],
|
|
38
40
|
]);
|
|
39
41
|
const props = mapJoin(
|
|
40
|
-
propValues,
|
|
42
|
+
() => propValues,
|
|
41
43
|
(name, value) => {
|
|
42
44
|
return <ts.ObjectProperty name={name} value={value} />;
|
|
43
45
|
},
|
|
44
46
|
{ joiner: ",\n" },
|
|
45
47
|
);
|
|
46
48
|
|
|
47
|
-
expect(<ts.ObjectExpression>
|
|
48
|
-
{props}
|
|
49
|
-
</ts.ObjectExpression>)
|
|
50
|
-
.toRenderTo(`
|
|
49
|
+
expect(<ts.ObjectExpression>{props}</ts.ObjectExpression>).toRenderTo(`
|
|
51
50
|
{
|
|
52
51
|
foo: 1,
|
|
53
52
|
bar: 2
|
|
@@ -57,22 +56,23 @@ it("renders an object with properties, mapped", () => {
|
|
|
57
56
|
|
|
58
57
|
it("is reactive", () => {
|
|
59
58
|
const jsValue = reactive(new Map());
|
|
60
|
-
jsValue.set("hi", 1);
|
|
61
59
|
|
|
62
60
|
const tree = renderTree(<ts.ObjectExpression jsValue={jsValue} />);
|
|
63
61
|
|
|
64
|
-
expect(
|
|
62
|
+
expect(printTree(tree)).toEqual(`{}`);
|
|
63
|
+
jsValue.set("hi", 1);
|
|
64
|
+
expect(printTree(tree)).toEqual(d`
|
|
65
65
|
{
|
|
66
|
-
hi: 1
|
|
66
|
+
hi: 1,
|
|
67
67
|
}
|
|
68
68
|
`);
|
|
69
69
|
|
|
70
70
|
jsValue.set("bye", 2);
|
|
71
71
|
|
|
72
|
-
expect(
|
|
72
|
+
expect(printTree(tree)).toEqual(d`
|
|
73
73
|
{
|
|
74
74
|
hi: 1,
|
|
75
|
-
bye: 2
|
|
75
|
+
bye: 2,
|
|
76
76
|
}
|
|
77
77
|
`);
|
|
78
78
|
});
|
|
@@ -84,10 +84,7 @@ it("renders objects with arrays", () => {
|
|
|
84
84
|
|
|
85
85
|
expect(<ts.ObjectExpression jsValue={jsValue} />).toRenderTo(`
|
|
86
86
|
{
|
|
87
|
-
a: [
|
|
88
|
-
1,
|
|
89
|
-
2
|
|
90
|
-
]
|
|
87
|
+
a: [1, 2],
|
|
91
88
|
}
|
|
92
89
|
`);
|
|
93
90
|
});
|
|
@@ -108,12 +105,8 @@ it("renders complex objects", () => {
|
|
|
108
105
|
b: "hello",
|
|
109
106
|
c: true,
|
|
110
107
|
d: {
|
|
111
|
-
prop: [
|
|
112
|
-
|
|
113
|
-
2,
|
|
114
|
-
3
|
|
115
|
-
]
|
|
116
|
-
}
|
|
108
|
+
prop: [1, 2, 3],
|
|
109
|
+
},
|
|
117
110
|
}
|
|
118
111
|
`);
|
|
119
112
|
});
|
|
@@ -133,17 +126,14 @@ it("renders falsy values", () => {
|
|
|
133
126
|
b: "",
|
|
134
127
|
c: false,
|
|
135
128
|
d: null,
|
|
136
|
-
e: undefined
|
|
129
|
+
e: undefined,
|
|
137
130
|
}
|
|
138
131
|
`);
|
|
139
132
|
});
|
|
140
133
|
|
|
141
134
|
it("allows embedding things with functions", () => {
|
|
142
135
|
function Foo() {
|
|
143
|
-
return <>
|
|
144
|
-
a
|
|
145
|
-
b
|
|
146
|
-
</>;
|
|
136
|
+
return <>a b</>;
|
|
147
137
|
}
|
|
148
138
|
const jsValue = {
|
|
149
139
|
a: () => "hello",
|
|
@@ -153,8 +143,7 @@ it("allows embedding things with functions", () => {
|
|
|
153
143
|
expect(<ts.ObjectExpression jsValue={jsValue} />).toRenderTo(`
|
|
154
144
|
{
|
|
155
145
|
a: hello,
|
|
156
|
-
b: a
|
|
157
|
-
b
|
|
146
|
+
b: a b,
|
|
158
147
|
}
|
|
159
148
|
`);
|
|
160
149
|
});
|
|
@@ -163,22 +152,30 @@ describe("symbols", () => {
|
|
|
163
152
|
it("can reference members", () => {
|
|
164
153
|
const innerRefkey = refkey();
|
|
165
154
|
const outerRefkey = refkey();
|
|
166
|
-
const decl =
|
|
155
|
+
const decl = (
|
|
167
156
|
<Output>
|
|
168
157
|
<ts.SourceFile path="foo.ts">
|
|
169
|
-
<
|
|
170
|
-
<ts.
|
|
171
|
-
<ts.
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
158
|
+
<StatementList>
|
|
159
|
+
<ts.VarDeclaration name="refme" refkey={outerRefkey}>
|
|
160
|
+
<ts.ObjectExpression>
|
|
161
|
+
<ts.ObjectProperty
|
|
162
|
+
name="foo"
|
|
163
|
+
refkey={innerRefkey}
|
|
164
|
+
jsValue="hello"
|
|
165
|
+
/>
|
|
166
|
+
,
|
|
167
|
+
</ts.ObjectExpression>
|
|
168
|
+
</ts.VarDeclaration>
|
|
169
|
+
{innerRefkey}
|
|
170
|
+
</StatementList>
|
|
175
171
|
</ts.SourceFile>
|
|
176
|
-
</Output
|
|
172
|
+
</Output>
|
|
173
|
+
);
|
|
177
174
|
expect(decl).toRenderTo(`
|
|
178
175
|
const refme = {
|
|
179
|
-
foo: "hello"
|
|
176
|
+
foo: "hello",
|
|
180
177
|
};
|
|
181
|
-
refme.foo
|
|
178
|
+
refme.foo;
|
|
182
179
|
`);
|
|
183
180
|
});
|
|
184
181
|
|
|
@@ -186,30 +183,33 @@ describe("symbols", () => {
|
|
|
186
183
|
const varRefkey = refkey();
|
|
187
184
|
const fooRefkey = refkey();
|
|
188
185
|
const barRefkey = refkey();
|
|
189
|
-
const decl =
|
|
186
|
+
const decl = (
|
|
190
187
|
<Output>
|
|
191
188
|
<ts.SourceFile path="foo.ts">
|
|
192
|
-
<
|
|
193
|
-
<ts.
|
|
194
|
-
<ts.
|
|
195
|
-
<ts.
|
|
196
|
-
<ts.
|
|
197
|
-
"
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
189
|
+
<StatementList>
|
|
190
|
+
<ts.VarDeclaration name="refme" refkey={varRefkey}>
|
|
191
|
+
<ts.ObjectExpression>
|
|
192
|
+
<ts.ObjectProperty name="foo" refkey={fooRefkey}>
|
|
193
|
+
<ts.ObjectExpression>
|
|
194
|
+
<ts.ObjectProperty name="bar" refkey={barRefkey}>
|
|
195
|
+
"hello",
|
|
196
|
+
</ts.ObjectProperty>
|
|
197
|
+
</ts.ObjectExpression>
|
|
198
|
+
</ts.ObjectProperty>
|
|
199
|
+
</ts.ObjectExpression>
|
|
200
|
+
</ts.VarDeclaration>
|
|
201
|
+
{barRefkey}
|
|
202
|
+
</StatementList>
|
|
204
203
|
</ts.SourceFile>
|
|
205
|
-
</Output
|
|
204
|
+
</Output>
|
|
205
|
+
);
|
|
206
206
|
expect(decl).toRenderTo(`
|
|
207
207
|
const refme = {
|
|
208
208
|
foo: {
|
|
209
|
-
bar: "hello"
|
|
209
|
+
bar: "hello",
|
|
210
210
|
}
|
|
211
211
|
};
|
|
212
|
-
refme.foo.bar
|
|
212
|
+
refme.foo.bar;
|
|
213
213
|
`);
|
|
214
214
|
});
|
|
215
215
|
|
|
@@ -217,7 +217,7 @@ describe("symbols", () => {
|
|
|
217
217
|
const varRefkey = refkey();
|
|
218
218
|
const fooRefkey = refkey();
|
|
219
219
|
const barRefkey = refkey();
|
|
220
|
-
const decl =
|
|
220
|
+
const decl = (
|
|
221
221
|
<Output>
|
|
222
222
|
<ts.SourceFile path="foo.ts">
|
|
223
223
|
<ts.VarDeclaration export name="refme" refkey={varRefkey}>
|
|
@@ -225,7 +225,7 @@ describe("symbols", () => {
|
|
|
225
225
|
<ts.ObjectProperty name="foo" refkey={fooRefkey}>
|
|
226
226
|
<ts.ObjectExpression>
|
|
227
227
|
<ts.ObjectProperty name="bar" refkey={barRefkey}>
|
|
228
|
-
"hello"
|
|
228
|
+
"hello",
|
|
229
229
|
</ts.ObjectProperty>
|
|
230
230
|
</ts.ObjectExpression>
|
|
231
231
|
</ts.ObjectProperty>
|
|
@@ -233,22 +233,17 @@ describe("symbols", () => {
|
|
|
233
233
|
</ts.VarDeclaration>
|
|
234
234
|
</ts.SourceFile>
|
|
235
235
|
|
|
236
|
-
<ts.SourceFile path="bar.ts">
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
</Output>;
|
|
236
|
+
<ts.SourceFile path="bar.ts">console.log({barRefkey});</ts.SourceFile>
|
|
237
|
+
</Output>
|
|
238
|
+
);
|
|
241
239
|
expect(decl).toRenderTo(`
|
|
242
240
|
export const refme = {
|
|
243
241
|
foo: {
|
|
244
|
-
bar: "hello"
|
|
242
|
+
bar: "hello",
|
|
245
243
|
}
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
import { refme } from "./foo.js";
|
|
244
|
+
}import { refme } from "./foo.js";
|
|
249
245
|
|
|
250
246
|
console.log(refme.foo.bar);
|
|
251
|
-
|
|
252
247
|
`);
|
|
253
248
|
});
|
|
254
249
|
|
|
@@ -256,7 +251,7 @@ describe("symbols", () => {
|
|
|
256
251
|
const varRefkey = refkey();
|
|
257
252
|
const fooRefkey = refkey();
|
|
258
253
|
const barRefkey = refkey();
|
|
259
|
-
const decl =
|
|
254
|
+
const decl = (
|
|
260
255
|
<Output>
|
|
261
256
|
<ts.PackageDirectory name="SourcePackage" path="sp" version="1.0.0">
|
|
262
257
|
<ts.SourceFile export="." path="foo.ts">
|
|
@@ -275,11 +270,10 @@ describe("symbols", () => {
|
|
|
275
270
|
</ts.PackageDirectory>
|
|
276
271
|
|
|
277
272
|
<ts.PackageDirectory name="DepPackage" path="dp" version="1.0.0">
|
|
278
|
-
<ts.SourceFile path="bar.ts">
|
|
279
|
-
console.log({barRefkey});
|
|
280
|
-
</ts.SourceFile>
|
|
273
|
+
<ts.SourceFile path="bar.ts">console.log({barRefkey});</ts.SourceFile>
|
|
281
274
|
</ts.PackageDirectory>
|
|
282
|
-
</Output
|
|
275
|
+
</Output>
|
|
276
|
+
);
|
|
283
277
|
const res = render(decl);
|
|
284
278
|
assertFileContents(res, {
|
|
285
279
|
"dp/bar.ts": `
|
|
@@ -7,10 +7,10 @@ import { assertFileContents } from "./utils.js";
|
|
|
7
7
|
it("works", () => {
|
|
8
8
|
expect(
|
|
9
9
|
<Output>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
<ts.SourceFile path="test.js">
|
|
11
|
+
<ts.VarDeclaration name="hi" value="12" />;
|
|
12
|
+
</ts.SourceFile>
|
|
13
|
+
</Output>,
|
|
14
14
|
).toRenderTo("const hi = 12;");
|
|
15
15
|
});
|
|
16
16
|
|
|
@@ -25,9 +25,15 @@ it("works end-to-end", () => {
|
|
|
25
25
|
</ts.TypeDeclaration>
|
|
26
26
|
</ts.SourceFile>
|
|
27
27
|
<ts.SourceFile path="test.ts">
|
|
28
|
-
<ts.VarDeclaration
|
|
28
|
+
<ts.VarDeclaration
|
|
29
|
+
export
|
|
30
|
+
let
|
|
31
|
+
name="hi"
|
|
32
|
+
type={<ts.Reference refkey={TestType} />}
|
|
33
|
+
>
|
|
29
34
|
"hello"
|
|
30
35
|
</ts.VarDeclaration>
|
|
36
|
+
;
|
|
31
37
|
</ts.SourceFile>
|
|
32
38
|
</Output>,
|
|
33
39
|
);
|
package/test/vitest.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import "vitest";
|
|
2
2
|
|
|
3
|
+
interface ToRenderToRenderOptions {
|
|
4
|
+
printWidth?: number;
|
|
5
|
+
tabWidth?: number;
|
|
6
|
+
useTabs?: boolean;
|
|
7
|
+
}
|
|
3
8
|
interface CustomMatchers<R = unknown> {
|
|
4
|
-
toRenderTo: (str: string) => R;
|
|
9
|
+
toRenderTo: (str: string, options?: ToRenderToRenderOptions) => R;
|
|
5
10
|
}
|
|
6
11
|
|
|
7
12
|
declare module "vitest" {
|
package/tsconfig.json
CHANGED
|
@@ -6,6 +6,13 @@
|
|
|
6
6
|
"outDir": "dist"
|
|
7
7
|
},
|
|
8
8
|
"references": [{ "path": "../core" }],
|
|
9
|
-
"include": [
|
|
9
|
+
"include": [
|
|
10
|
+
"src/**/*.ts",
|
|
11
|
+
"src/**/*.tsx",
|
|
12
|
+
"test/**/*.ts",
|
|
13
|
+
"test/**/*.tsx",
|
|
14
|
+
"../core/src/components/Block.tsx",
|
|
15
|
+
"../core/src/components/StatementList.tsx"
|
|
16
|
+
],
|
|
10
17
|
"exclude": ["node_modules", "dist"]
|
|
11
18
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Block.d.ts","sourceRoot":"","sources":["../../../src/components/Block.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AACD,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,OAMtC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
3
|
-
import { Indent as _$Indent } from "@alloy-js/core";
|
|
4
|
-
export function Block(props) {
|
|
5
|
-
return ["{", _$createComponent(_$Indent, {
|
|
6
|
-
get children() {
|
|
7
|
-
return ["\n", _$memo(() => props.children)];
|
|
8
|
-
}
|
|
9
|
-
}), "\n", "}"];
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=Block.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Block.js","names":["Block","props","_$createComponent","_$Indent","children","_$memo"],"sources":["../../../src/components/Block.tsx"],"sourcesContent":[null],"mappings":";;;AAKA,OAAO,SAASA,KAAKA,CAACC,KAAiB,EAAE;EACvC,QACG,GAAG,EAAAC,iBAAA,CAAAC,QAAA;IAAA,IAAAC,SAAA;MAAA,cAAAC,MAAA,OACDJ,KAAK,CAACG,QAAQ;IAAA;EAAA,UAChB,GAAG;AAER","ignoreList":[]}
|