@alloy-js/json 0.19.0-dev.1 → 0.20.0-dev.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 +7 -0
- package/dist/src/components/array.test.d.ts.map +1 -0
- package/dist/{test → src/components}/array.test.js +1 -1
- package/dist/src/components/index.d.ts +5 -5
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +5 -5
- package/dist/src/components/{JsonArray.d.ts → json-array.d.ts} +1 -1
- package/dist/src/components/json-array.d.ts.map +1 -0
- package/dist/src/components/{JsonArray.js → json-array.js} +1 -1
- package/dist/src/components/{JsonObject.d.ts → json-object.d.ts} +1 -1
- package/dist/src/components/json-object.d.ts.map +1 -0
- package/dist/src/components/{JsonObject.js → json-object.js} +1 -1
- package/dist/src/components/{JsonValue.d.ts → json-value.d.ts} +3 -3
- package/dist/src/components/json-value.d.ts.map +1 -0
- package/dist/src/components/{JsonValue.js → json-value.js} +6 -2
- package/dist/src/components/json-value.test.d.ts +2 -0
- package/dist/src/components/json-value.test.d.ts.map +1 -0
- package/dist/src/components/json-value.test.js +41 -0
- package/dist/src/components/object.test.d.ts.map +1 -0
- package/dist/{test → src/components}/object.test.js +3 -3
- package/dist/src/components/primitives.test.d.ts.map +1 -0
- package/dist/src/components/primitives.test.js +6 -0
- package/dist/src/components/{Reference.d.ts → reference.d.ts} +1 -1
- package/dist/src/components/reference.d.ts.map +1 -0
- package/dist/src/components/reference.test.d.ts.map +1 -0
- package/dist/{test → src/components}/reference.test.js +4 -4
- package/dist/src/components/{SourceFile.d.ts → source-file.d.ts} +1 -1
- package/dist/src/components/source-file.d.ts.map +1 -0
- package/dist/src/components/{SourceFile.js → source-file.js} +1 -1
- package/dist/test/utils.js +2 -2
- package/dist/test/vitest.setup.d.ts +2 -0
- package/dist/test/vitest.setup.d.ts.map +1 -0
- package/dist/test/vitest.setup.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -3
- package/{test → src/components}/array.test.tsx +1 -1
- package/src/components/index.ts +5 -5
- package/src/components/{JsonArray.tsx → json-array.tsx} +1 -1
- package/src/components/{JsonObject.tsx → json-object.tsx} +1 -1
- package/src/components/json-value.test.tsx +44 -0
- package/src/components/{JsonValue.tsx → json-value.tsx} +10 -5
- package/{test → src/components}/object.test.tsx +3 -6
- package/src/components/primitives.test.tsx +15 -0
- package/{test → src/components}/reference.test.tsx +4 -7
- package/src/components/{SourceFile.tsx → source-file.tsx} +1 -1
- package/temp/api.json +25 -29
- package/test/utils.tsx +2 -2
- package/test/vitest.setup.ts +1 -0
- package/vitest.config.ts +3 -0
- package/dist/src/components/JsonArray.d.ts.map +0 -1
- package/dist/src/components/JsonObject.d.ts.map +0 -1
- package/dist/src/components/JsonValue.d.ts.map +0 -1
- package/dist/src/components/Reference.d.ts.map +0 -1
- package/dist/src/components/SourceFile.d.ts.map +0 -1
- package/dist/test/array.test.d.ts.map +0 -1
- package/dist/test/object.test.d.ts.map +0 -1
- package/dist/test/primitives.test.d.ts.map +0 -1
- package/dist/test/primitives.test.js +0 -12
- package/dist/test/reference.test.d.ts.map +0 -1
- package/dist/test/vitest.d.js +0 -1
- package/test/primitives.test.tsx +0 -16
- package/test/vitest.d.ts +0 -16
- /package/dist/{test → src/components}/array.test.d.ts +0 -0
- /package/dist/{test → src/components}/object.test.d.ts +0 -0
- /package/dist/{test → src/components}/primitives.test.d.ts +0 -0
- /package/dist/src/components/{Reference.js → reference.js} +0 -0
- /package/dist/{test → src/components}/reference.test.d.ts +0 -0
- /package/src/components/{Reference.tsx → reference.tsx} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alloy-js/json",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0-dev.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -10,15 +10,18 @@
|
|
|
10
10
|
"import": "./dist/src/components/stc/index.js"
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
|
+
"imports": {
|
|
14
|
+
"#test/*": "./test/*"
|
|
15
|
+
},
|
|
13
16
|
"keywords": [],
|
|
14
17
|
"author": "brian.terlson@microsoft.com",
|
|
15
18
|
"license": "MIT",
|
|
16
19
|
"dependencies": {
|
|
17
|
-
"@alloy-js/core": "~0.
|
|
20
|
+
"@alloy-js/core": "~0.19.0 || >= 0.20.0-dev.0",
|
|
18
21
|
"pathe": "^2.0.3"
|
|
19
22
|
},
|
|
20
23
|
"devDependencies": {
|
|
21
|
-
"@alloy-js/cli": "~0.
|
|
24
|
+
"@alloy-js/cli": "~0.19.0 || >= 0.20.0-dev.0",
|
|
22
25
|
"@alloy-js/rollup-plugin": "~0.1.0 || >= 0.1.1-dev.0",
|
|
23
26
|
"@microsoft/api-extractor": "~7.52.8",
|
|
24
27
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
@@ -2,7 +2,7 @@ import { reactive, renderTree } from "@alloy-js/core";
|
|
|
2
2
|
import "@alloy-js/core/testing";
|
|
3
3
|
import { d, printTree } from "@alloy-js/core/testing";
|
|
4
4
|
import { expect, it } from "vitest";
|
|
5
|
-
import { jsonTest } from "
|
|
5
|
+
import { jsonTest } from "../../test/utils.jsx";
|
|
6
6
|
|
|
7
7
|
it("renders empty arrays", () => {
|
|
8
8
|
const template = jsonTest([]);
|
package/src/components/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
1
|
+
export * from "./json-array.jsx";
|
|
2
|
+
export * from "./json-object.jsx";
|
|
3
|
+
export * from "./json-value.jsx";
|
|
4
|
+
export * from "./reference.jsx";
|
|
5
|
+
export * from "./source-file.jsx";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
useMemberScope,
|
|
13
13
|
} from "@alloy-js/core";
|
|
14
14
|
import { JsonOutputSymbol } from "../symbols/json-symbol.js";
|
|
15
|
-
import { JsonValue } from "./
|
|
15
|
+
import { JsonValue } from "./json-value.jsx";
|
|
16
16
|
|
|
17
17
|
export interface JsonArrayPropsBase {
|
|
18
18
|
/**
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
useMemberDeclaration,
|
|
13
13
|
} from "@alloy-js/core";
|
|
14
14
|
import { JsonOutputSymbol } from "../symbols/json-symbol.js";
|
|
15
|
-
import { JsonValue } from "./
|
|
15
|
+
import { JsonValue } from "./json-value.jsx";
|
|
16
16
|
|
|
17
17
|
export interface JsonObjectPropsBase {
|
|
18
18
|
/**
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Output } from "@alloy-js/core";
|
|
2
|
+
import { expect, it } from "vitest";
|
|
3
|
+
import { JsonValue } from "./json-value.jsx";
|
|
4
|
+
import { SourceFile } from "./source-file.jsx";
|
|
5
|
+
|
|
6
|
+
const TestingJsonObject = () => {
|
|
7
|
+
return (
|
|
8
|
+
<JsonValue
|
|
9
|
+
jsValue={{
|
|
10
|
+
id: "test-id",
|
|
11
|
+
name: "Test Name",
|
|
12
|
+
nested: () => <Bar />,
|
|
13
|
+
}}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const Bar = () => {
|
|
19
|
+
return (
|
|
20
|
+
<JsonValue
|
|
21
|
+
jsValue={{
|
|
22
|
+
bar: "Foo",
|
|
23
|
+
}}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
it("compose json data with components", () => {
|
|
29
|
+
expect(
|
|
30
|
+
<Output>
|
|
31
|
+
<SourceFile path="test.json">
|
|
32
|
+
<TestingJsonObject />
|
|
33
|
+
</SourceFile>
|
|
34
|
+
</Output>,
|
|
35
|
+
).toRenderTo(`
|
|
36
|
+
{
|
|
37
|
+
"id": "test-id",
|
|
38
|
+
"name": "Test Name",
|
|
39
|
+
"nested": {
|
|
40
|
+
"bar": "Foo"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
`);
|
|
44
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Refkey, useMemberDeclaration } from "@alloy-js/core";
|
|
2
|
-
import { JsonArray } from "./
|
|
3
|
-
import { JsonObject } from "./
|
|
1
|
+
import { Children, Refkey, useMemberDeclaration } from "@alloy-js/core";
|
|
2
|
+
import { JsonArray } from "./json-array.jsx";
|
|
3
|
+
import { JsonObject } from "./json-object.jsx";
|
|
4
4
|
|
|
5
5
|
export interface JsonValueProps {
|
|
6
6
|
/**
|
|
@@ -22,7 +22,7 @@ export interface JsonValueProps {
|
|
|
22
22
|
* value will be serialized to a string, number, boolean, or null as
|
|
23
23
|
* appropriate.
|
|
24
24
|
*/
|
|
25
|
-
export function JsonValue(props: JsonValueProps) {
|
|
25
|
+
export function JsonValue(props: JsonValueProps): Children {
|
|
26
26
|
const refkeys = [props.refkey ?? []].flat();
|
|
27
27
|
if (props.jsValue === null) {
|
|
28
28
|
setMemberRefkey(refkeys);
|
|
@@ -44,7 +44,12 @@ export function JsonValue(props: JsonValueProps) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
if (typeof props.jsValue === "object") {
|
|
47
|
-
return <JsonObject jsValue={props.jsValue as
|
|
47
|
+
return <JsonObject jsValue={props.jsValue as Record<string, unknown>} />;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (typeof props.jsValue === "function") {
|
|
51
|
+
// functions are inserted as-is.
|
|
52
|
+
return props.jsValue as () => Children;
|
|
48
53
|
}
|
|
49
54
|
|
|
50
55
|
throw new Error("Cannot emit js value with type of " + typeof props.jsValue);
|
|
@@ -2,12 +2,9 @@ import { List, Output, reactive, renderTree } from "@alloy-js/core";
|
|
|
2
2
|
import "@alloy-js/core/testing";
|
|
3
3
|
import { d, printTree } from "@alloy-js/core/testing";
|
|
4
4
|
import { expect, it } from "vitest";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "../src/components/JsonObject.jsx";
|
|
9
|
-
import { SourceFile } from "../src/components/SourceFile.jsx";
|
|
10
|
-
import { jsonTest } from "./utils.jsx";
|
|
5
|
+
import { jsonTest } from "../../test/utils.jsx";
|
|
6
|
+
import { JsonObject, JsonObjectProperty } from "./json-object.jsx";
|
|
7
|
+
import { SourceFile } from "./source-file.jsx";
|
|
11
8
|
|
|
12
9
|
it("renders objects", () => {
|
|
13
10
|
const template = jsonTest({ a: 1, b: "hello" });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsonTest } from "#test/utils.jsx";
|
|
2
|
+
import "@alloy-js/core/testing";
|
|
3
|
+
import { expect, it } from "vitest";
|
|
4
|
+
|
|
5
|
+
it.each([
|
|
6
|
+
["boolean (true)", true, "true"],
|
|
7
|
+
["boolean (false)", false, "false"],
|
|
8
|
+
["integer", 10, "10"],
|
|
9
|
+
["negative integer", -10, "-10"],
|
|
10
|
+
["float", 1.314, "1.314"],
|
|
11
|
+
["string", "Hello, world!", `"Hello, world!"`],
|
|
12
|
+
["null", null, "null"],
|
|
13
|
+
])("%s", (_, data, expected) => {
|
|
14
|
+
expect(jsonTest(data)).toRenderTo(expected);
|
|
15
|
+
});
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { Output, refkey, SourceDirectory } from "@alloy-js/core";
|
|
2
2
|
import "@alloy-js/core/testing";
|
|
3
3
|
import { expect, it } from "vitest";
|
|
4
|
-
import { JsonArray, JsonArrayElement } from "
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "../src/components/JsonObject.jsx";
|
|
9
|
-
import { JsonValue } from "../src/components/JsonValue.jsx";
|
|
10
|
-
import { SourceFile } from "../src/components/SourceFile.jsx";
|
|
4
|
+
import { JsonArray, JsonArrayElement } from "./json-array.jsx";
|
|
5
|
+
import { JsonObject, JsonObjectProperty } from "./json-object.jsx";
|
|
6
|
+
import { JsonValue } from "./json-value.jsx";
|
|
7
|
+
import { SourceFile } from "./source-file.jsx";
|
|
11
8
|
|
|
12
9
|
it("references objects within the same file", () => {
|
|
13
10
|
const objectValue = refkey();
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "@alloy-js/core";
|
|
7
7
|
import { JsonFileContext } from "../context/JsonFileContext.js";
|
|
8
8
|
import { JsonOutputSymbol } from "../symbols/json-symbol.js";
|
|
9
|
-
import { Reference } from "./
|
|
9
|
+
import { Reference } from "./reference.jsx";
|
|
10
10
|
|
|
11
11
|
export interface SourceFileProps {
|
|
12
12
|
/** The path for this source file relative to the parent directory */
|
package/temp/api.json
CHANGED
|
@@ -260,7 +260,7 @@
|
|
|
260
260
|
"text": ";"
|
|
261
261
|
}
|
|
262
262
|
],
|
|
263
|
-
"fileUrlPath": "src/components/
|
|
263
|
+
"fileUrlPath": "src/components/json-array.tsx",
|
|
264
264
|
"returnTypeTokenRange": {
|
|
265
265
|
"startIndex": 3,
|
|
266
266
|
"endIndex": 4
|
|
@@ -307,7 +307,7 @@
|
|
|
307
307
|
"text": ";"
|
|
308
308
|
}
|
|
309
309
|
],
|
|
310
|
-
"fileUrlPath": "src/components/
|
|
310
|
+
"fileUrlPath": "src/components/json-array.tsx",
|
|
311
311
|
"returnTypeTokenRange": {
|
|
312
312
|
"startIndex": 3,
|
|
313
313
|
"endIndex": 4
|
|
@@ -354,7 +354,7 @@
|
|
|
354
354
|
"text": ";"
|
|
355
355
|
}
|
|
356
356
|
],
|
|
357
|
-
"fileUrlPath": "src/components/
|
|
357
|
+
"fileUrlPath": "src/components/json-array.tsx",
|
|
358
358
|
"releaseTag": "Public",
|
|
359
359
|
"name": "JsonArrayElementProps",
|
|
360
360
|
"typeTokenRange": {
|
|
@@ -372,7 +372,7 @@
|
|
|
372
372
|
"text": "export interface JsonArrayElementPropsWithChildren "
|
|
373
373
|
}
|
|
374
374
|
],
|
|
375
|
-
"fileUrlPath": "src/components/
|
|
375
|
+
"fileUrlPath": "src/components/json-array.tsx",
|
|
376
376
|
"releaseTag": "Public",
|
|
377
377
|
"name": "JsonArrayElementPropsWithChildren",
|
|
378
378
|
"preserveMemberOrder": false,
|
|
@@ -418,7 +418,7 @@
|
|
|
418
418
|
"text": "export interface JsonArrayElementPropsWithJsValue "
|
|
419
419
|
}
|
|
420
420
|
],
|
|
421
|
-
"fileUrlPath": "src/components/
|
|
421
|
+
"fileUrlPath": "src/components/json-array.tsx",
|
|
422
422
|
"releaseTag": "Public",
|
|
423
423
|
"name": "JsonArrayElementPropsWithJsValue",
|
|
424
424
|
"preserveMemberOrder": false,
|
|
@@ -481,7 +481,7 @@
|
|
|
481
481
|
"text": ";"
|
|
482
482
|
}
|
|
483
483
|
],
|
|
484
|
-
"fileUrlPath": "src/components/
|
|
484
|
+
"fileUrlPath": "src/components/json-array.tsx",
|
|
485
485
|
"releaseTag": "Public",
|
|
486
486
|
"name": "JsonArrayProps",
|
|
487
487
|
"typeTokenRange": {
|
|
@@ -499,7 +499,7 @@
|
|
|
499
499
|
"text": "export interface JsonArrayPropsBase "
|
|
500
500
|
}
|
|
501
501
|
],
|
|
502
|
-
"fileUrlPath": "src/components/
|
|
502
|
+
"fileUrlPath": "src/components/json-array.tsx",
|
|
503
503
|
"releaseTag": "Public",
|
|
504
504
|
"name": "JsonArrayPropsBase",
|
|
505
505
|
"preserveMemberOrder": false,
|
|
@@ -567,7 +567,7 @@
|
|
|
567
567
|
"text": " "
|
|
568
568
|
}
|
|
569
569
|
],
|
|
570
|
-
"fileUrlPath": "src/components/
|
|
570
|
+
"fileUrlPath": "src/components/json-array.tsx",
|
|
571
571
|
"releaseTag": "Public",
|
|
572
572
|
"name": "JsonArrayPropsWithChildren",
|
|
573
573
|
"preserveMemberOrder": false,
|
|
@@ -627,7 +627,7 @@
|
|
|
627
627
|
"text": " "
|
|
628
628
|
}
|
|
629
629
|
],
|
|
630
|
-
"fileUrlPath": "src/components/
|
|
630
|
+
"fileUrlPath": "src/components/json-array.tsx",
|
|
631
631
|
"releaseTag": "Public",
|
|
632
632
|
"name": "JsonArrayPropsWithJsValue",
|
|
633
633
|
"preserveMemberOrder": false,
|
|
@@ -832,7 +832,7 @@
|
|
|
832
832
|
"text": ";"
|
|
833
833
|
}
|
|
834
834
|
],
|
|
835
|
-
"fileUrlPath": "src/components/
|
|
835
|
+
"fileUrlPath": "src/components/json-object.tsx",
|
|
836
836
|
"returnTypeTokenRange": {
|
|
837
837
|
"startIndex": 3,
|
|
838
838
|
"endIndex": 4
|
|
@@ -879,7 +879,7 @@
|
|
|
879
879
|
"text": ";"
|
|
880
880
|
}
|
|
881
881
|
],
|
|
882
|
-
"fileUrlPath": "src/components/
|
|
882
|
+
"fileUrlPath": "src/components/json-object.tsx",
|
|
883
883
|
"returnTypeTokenRange": {
|
|
884
884
|
"startIndex": 3,
|
|
885
885
|
"endIndex": 4
|
|
@@ -926,7 +926,7 @@
|
|
|
926
926
|
"text": ";"
|
|
927
927
|
}
|
|
928
928
|
],
|
|
929
|
-
"fileUrlPath": "src/components/
|
|
929
|
+
"fileUrlPath": "src/components/json-object.tsx",
|
|
930
930
|
"releaseTag": "Public",
|
|
931
931
|
"name": "JsonObjectProps",
|
|
932
932
|
"typeTokenRange": {
|
|
@@ -944,7 +944,7 @@
|
|
|
944
944
|
"text": "export interface JsonObjectPropsBase "
|
|
945
945
|
}
|
|
946
946
|
],
|
|
947
|
-
"fileUrlPath": "src/components/
|
|
947
|
+
"fileUrlPath": "src/components/json-object.tsx",
|
|
948
948
|
"releaseTag": "Public",
|
|
949
949
|
"name": "JsonObjectPropsBase",
|
|
950
950
|
"preserveMemberOrder": false,
|
|
@@ -1039,7 +1039,7 @@
|
|
|
1039
1039
|
"text": " "
|
|
1040
1040
|
}
|
|
1041
1041
|
],
|
|
1042
|
-
"fileUrlPath": "src/components/
|
|
1042
|
+
"fileUrlPath": "src/components/json-object.tsx",
|
|
1043
1043
|
"releaseTag": "Public",
|
|
1044
1044
|
"name": "JsonObjectPropsWithChildren",
|
|
1045
1045
|
"preserveMemberOrder": false,
|
|
@@ -1099,7 +1099,7 @@
|
|
|
1099
1099
|
"text": " "
|
|
1100
1100
|
}
|
|
1101
1101
|
],
|
|
1102
|
-
"fileUrlPath": "src/components/
|
|
1102
|
+
"fileUrlPath": "src/components/json-object.tsx",
|
|
1103
1103
|
"releaseTag": "Public",
|
|
1104
1104
|
"name": "JsonObjectPropsWithJsValue",
|
|
1105
1105
|
"preserveMemberOrder": false,
|
|
@@ -1376,10 +1376,6 @@
|
|
|
1376
1376
|
"kind": "Content",
|
|
1377
1377
|
"text": "): "
|
|
1378
1378
|
},
|
|
1379
|
-
{
|
|
1380
|
-
"kind": "Content",
|
|
1381
|
-
"text": "import(\"@alloy-js/core\")."
|
|
1382
|
-
},
|
|
1383
1379
|
{
|
|
1384
1380
|
"kind": "Reference",
|
|
1385
1381
|
"text": "Children",
|
|
@@ -1390,10 +1386,10 @@
|
|
|
1390
1386
|
"text": ";"
|
|
1391
1387
|
}
|
|
1392
1388
|
],
|
|
1393
|
-
"fileUrlPath": "src/components/
|
|
1389
|
+
"fileUrlPath": "src/components/json-value.tsx",
|
|
1394
1390
|
"returnTypeTokenRange": {
|
|
1395
1391
|
"startIndex": 3,
|
|
1396
|
-
"endIndex":
|
|
1392
|
+
"endIndex": 4
|
|
1397
1393
|
},
|
|
1398
1394
|
"releaseTag": "Public",
|
|
1399
1395
|
"overloadIndex": 1,
|
|
@@ -1419,7 +1415,7 @@
|
|
|
1419
1415
|
"text": "export interface JsonValueProps "
|
|
1420
1416
|
}
|
|
1421
1417
|
],
|
|
1422
|
-
"fileUrlPath": "src/components/
|
|
1418
|
+
"fileUrlPath": "src/components/json-value.tsx",
|
|
1423
1419
|
"releaseTag": "Public",
|
|
1424
1420
|
"name": "JsonValueProps",
|
|
1425
1421
|
"preserveMemberOrder": false,
|
|
@@ -1523,7 +1519,7 @@
|
|
|
1523
1519
|
"text": ";"
|
|
1524
1520
|
}
|
|
1525
1521
|
],
|
|
1526
|
-
"fileUrlPath": "src/components/
|
|
1522
|
+
"fileUrlPath": "src/components/json-object.tsx",
|
|
1527
1523
|
"releaseTag": "Public",
|
|
1528
1524
|
"name": "ObjectPropertyProps",
|
|
1529
1525
|
"typeTokenRange": {
|
|
@@ -1541,7 +1537,7 @@
|
|
|
1541
1537
|
"text": "export interface ObjectPropertyPropsWithChildren "
|
|
1542
1538
|
}
|
|
1543
1539
|
],
|
|
1544
|
-
"fileUrlPath": "src/components/
|
|
1540
|
+
"fileUrlPath": "src/components/json-object.tsx",
|
|
1545
1541
|
"releaseTag": "Public",
|
|
1546
1542
|
"name": "ObjectPropertyPropsWithChildren",
|
|
1547
1543
|
"preserveMemberOrder": false,
|
|
@@ -1614,7 +1610,7 @@
|
|
|
1614
1610
|
"text": "export interface ObjectPropertyPropsWithJsValue "
|
|
1615
1611
|
}
|
|
1616
1612
|
],
|
|
1617
|
-
"fileUrlPath": "src/components/
|
|
1613
|
+
"fileUrlPath": "src/components/json-object.tsx",
|
|
1618
1614
|
"releaseTag": "Public",
|
|
1619
1615
|
"name": "ObjectPropertyPropsWithJsValue",
|
|
1620
1616
|
"preserveMemberOrder": false,
|
|
@@ -1754,7 +1750,7 @@
|
|
|
1754
1750
|
"text": ";"
|
|
1755
1751
|
}
|
|
1756
1752
|
],
|
|
1757
|
-
"fileUrlPath": "src/components/
|
|
1753
|
+
"fileUrlPath": "src/components/reference.tsx",
|
|
1758
1754
|
"returnTypeTokenRange": {
|
|
1759
1755
|
"startIndex": 3,
|
|
1760
1756
|
"endIndex": 5
|
|
@@ -1783,7 +1779,7 @@
|
|
|
1783
1779
|
"text": "export interface ReferenceProps "
|
|
1784
1780
|
}
|
|
1785
1781
|
],
|
|
1786
|
-
"fileUrlPath": "src/components/
|
|
1782
|
+
"fileUrlPath": "src/components/reference.tsx",
|
|
1787
1783
|
"releaseTag": "Public",
|
|
1788
1784
|
"name": "ReferenceProps",
|
|
1789
1785
|
"preserveMemberOrder": false,
|
|
@@ -1847,7 +1843,7 @@
|
|
|
1847
1843
|
"text": ";"
|
|
1848
1844
|
}
|
|
1849
1845
|
],
|
|
1850
|
-
"fileUrlPath": "src/components/
|
|
1846
|
+
"fileUrlPath": "src/components/source-file.tsx",
|
|
1851
1847
|
"returnTypeTokenRange": {
|
|
1852
1848
|
"startIndex": 3,
|
|
1853
1849
|
"endIndex": 4
|
|
@@ -1876,7 +1872,7 @@
|
|
|
1876
1872
|
"text": "export interface SourceFileProps "
|
|
1877
1873
|
}
|
|
1878
1874
|
],
|
|
1879
|
-
"fileUrlPath": "src/components/
|
|
1875
|
+
"fileUrlPath": "src/components/source-file.tsx",
|
|
1880
1876
|
"releaseTag": "Public",
|
|
1881
1877
|
"name": "SourceFileProps",
|
|
1882
1878
|
"preserveMemberOrder": false,
|
package/test/utils.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Output } from "@alloy-js/core";
|
|
2
|
-
import { JsonValue } from "../src/components/
|
|
3
|
-
import { SourceFile } from "../src/components/
|
|
2
|
+
import { JsonValue } from "../src/components/json-value.jsx";
|
|
3
|
+
import { SourceFile } from "../src/components/source-file.jsx";
|
|
4
4
|
|
|
5
5
|
export function jsonTest(jsValue: unknown) {
|
|
6
6
|
return (
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@alloy-js/core/testing";
|
package/vitest.config.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JsonArray.d.ts","sourceRoot":"","sources":["../../../src/components/JsonArray.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQR,MAAM,EAGP,MAAM,gBAAgB,CAAC;AAIxB,MAAM,WAAW,kBAAkB;IACjC;;;QAGI;IACJ,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,kBAAkB;IACnE;;OAEG;IACH,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA2B,SAAQ,kBAAkB;IACpE;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,MAAM,cAAc,GACtB,yBAAyB,GACzB,0BAA0B,CAAC;AAE/B;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,YA0C9C;AAED;;;GAGG;AACH,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,MAAM,qBAAqB,GAC7B,gCAAgC,GAChC,iCAAiC,CAAC;AAEtC;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,YA4B5D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JsonObject.d.ts","sourceRoot":"","sources":["../../../src/components/JsonObject.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EASR,MAAM,EAEP,MAAM,gBAAgB,CAAC;AAIxB,MAAM,WAAW,mBAAmB;IAClC;;;QAGI;IACJ,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE3B,KAAK,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACtE;;;OAGG;IACH,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,mBAAmB;IACrE;;;OAGG;IACH,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/E;AAED,MAAM,MAAM,eAAe,GACvB,2BAA2B,GAC3B,0BAA0B,CAAC;AAE/B;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,YA+DhD;AAED;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,mBAAmB,GAC3B,+BAA+B,GAC/B,8BAA8B,CAAC;AAEnC;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,mBAAmB,YAsB5D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JsonValue.d.ts","sourceRoot":"","sources":["../../../src/components/JsonValue.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAwB,MAAM,gBAAgB,CAAC;AAI9D,MAAM,WAAW,cAAc;IAC7B;;;QAGI;IACJ,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE3B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,qCA0B9C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Reference.d.ts","sourceRoot":"","sources":["../../../src/components/Reference.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,qCAG9C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SourceFile.d.ts","sourceRoot":"","sources":["../../../src/components/SourceFile.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAIT,MAAM,gBAAgB,CAAC;AAKxB,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IAEb,sCAAsC;IACtC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,YAsBhD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.test.d.ts","sourceRoot":"","sources":["../../test/array.test.tsx"],"names":[],"mappings":"AACA,OAAO,wBAAwB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"object.test.d.ts","sourceRoot":"","sources":["../../test/object.test.tsx"],"names":[],"mappings":"AACA,OAAO,wBAAwB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.test.d.ts","sourceRoot":"","sources":["../../test/primitives.test.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import "@alloy-js/core/testing";
|
|
2
|
-
import { expect, it } from "vitest";
|
|
3
|
-
import { jsonTest } from "./utils.js";
|
|
4
|
-
it("renders primitives", () => {
|
|
5
|
-
expect(jsonTest(true)).toRenderTo("true");
|
|
6
|
-
expect(jsonTest(false)).toRenderTo("false");
|
|
7
|
-
expect(jsonTest(10)).toRenderTo("10");
|
|
8
|
-
expect(jsonTest(-10)).toRenderTo("-10");
|
|
9
|
-
expect(jsonTest(1.314)).toRenderTo("1.314");
|
|
10
|
-
expect(jsonTest("hello")).toRenderTo('"hello"');
|
|
11
|
-
expect(jsonTest(null)).toRenderTo("null");
|
|
12
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reference.test.d.ts","sourceRoot":"","sources":["../../test/reference.test.tsx"],"names":[],"mappings":"AACA,OAAO,wBAAwB,CAAC"}
|
package/dist/test/vitest.d.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "vitest";
|
package/test/primitives.test.tsx
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import "@alloy-js/core/testing";
|
|
2
|
-
import { expect, it } from "vitest";
|
|
3
|
-
import { jsonTest } from "./utils.jsx";
|
|
4
|
-
|
|
5
|
-
it("renders primitives", () => {
|
|
6
|
-
expect(jsonTest(true)).toRenderTo("true");
|
|
7
|
-
expect(jsonTest(false)).toRenderTo("false");
|
|
8
|
-
|
|
9
|
-
expect(jsonTest(10)).toRenderTo("10");
|
|
10
|
-
expect(jsonTest(-10)).toRenderTo("-10");
|
|
11
|
-
expect(jsonTest(1.314)).toRenderTo("1.314");
|
|
12
|
-
|
|
13
|
-
expect(jsonTest("hello")).toRenderTo('"hello"');
|
|
14
|
-
|
|
15
|
-
expect(jsonTest(null)).toRenderTo("null");
|
|
16
|
-
});
|
package/test/vitest.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import "vitest";
|
|
2
|
-
|
|
3
|
-
interface ToRenderToRenderOptions {
|
|
4
|
-
printWidth?: number;
|
|
5
|
-
tabWidth?: number;
|
|
6
|
-
useTabs?: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface CustomMatchers<R = unknown> {
|
|
10
|
-
toRenderTo: (str: string, options?: ToRenderToRenderOptions) => R;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
declare module "vitest" {
|
|
14
|
-
interface Assertion<T = any> extends CustomMatchers<T> {}
|
|
15
|
-
interface AsymmetricMatchersContaining extends CustomMatchers {}
|
|
16
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|