@alloy-js/json 0.23.0-dev.0 → 0.23.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/src/components/array.test.js +51 -0
- package/dist/dev/src/components/array.test.js.map +1 -0
- package/dist/dev/src/components/index.js +6 -0
- package/dist/dev/src/components/index.js.map +1 -0
- package/dist/dev/src/components/json-array.js +163 -0
- package/dist/dev/src/components/json-array.js.map +1 -0
- package/dist/dev/src/components/json-object.js +187 -0
- package/dist/dev/src/components/json-object.js.map +1 -0
- package/dist/dev/src/components/json-value.js +62 -0
- package/dist/dev/src/components/json-value.js.map +1 -0
- package/dist/dev/src/components/json-value.test.js +66 -0
- package/dist/dev/src/components/json-value.test.js.map +1 -0
- package/dist/dev/src/components/object.test.js +118 -0
- package/dist/dev/src/components/object.test.js.map +1 -0
- package/dist/dev/src/components/primitives.test.js +7 -0
- package/dist/dev/src/components/primitives.test.js.map +1 -0
- package/dist/dev/src/components/reference.js +15 -0
- package/dist/dev/src/components/reference.js.map +1 -0
- package/dist/dev/src/components/reference.test.js +476 -0
- package/dist/dev/src/components/reference.test.js.map +1 -0
- package/dist/dev/src/components/source-file.js +52 -0
- package/dist/dev/src/components/source-file.js.map +1 -0
- package/dist/dev/src/components/stc/index.js +10 -0
- package/dist/dev/src/components/stc/index.js.map +1 -0
- package/dist/dev/src/context/JsonFileContext.js +10 -0
- package/dist/dev/src/context/JsonFileContext.js.map +1 -0
- package/dist/dev/src/context/index.js +2 -0
- package/dist/dev/src/context/index.js.map +1 -0
- package/dist/dev/src/index.js +4 -0
- package/dist/dev/src/index.js.map +1 -0
- package/dist/dev/src/symbols/index.js +51 -0
- package/dist/dev/src/symbols/index.js.map +1 -0
- package/dist/dev/src/symbols/json-symbol.js +59 -0
- package/dist/dev/src/symbols/json-symbol.js.map +1 -0
- package/dist/dev/test/utils.js +31 -0
- package/dist/dev/test/utils.js.map +1 -0
- package/dist/dev/test/vitest.setup.js +2 -0
- package/dist/dev/test/vitest.setup.js.map +1 -0
- package/dist/src/components/json-array.d.ts.map +1 -1
- package/dist/src/components/json-array.js +3 -3
- package/dist/src/components/json-array.js.map +1 -1
- package/dist/src/components/json-object.d.ts.map +1 -1
- package/dist/src/components/json-object.js +3 -3
- package/dist/src/components/json-object.js.map +1 -1
- package/dist/src/components/source-file.d.ts.map +1 -1
- package/dist/src/components/source-file.js +2 -2
- package/dist/src/components/source-file.js.map +1 -1
- package/dist/src/symbols/json-symbol.d.ts +1 -0
- package/dist/src/symbols/json-symbol.d.ts.map +1 -1
- package/dist/src/symbols/json-symbol.js +12 -2
- package/dist/src/symbols/json-symbol.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -6
- package/src/components/json-array.tsx +3 -2
- package/src/components/json-object.tsx +7 -2
- package/src/components/source-file.tsx +2 -1
- package/src/symbols/json-symbol.ts +13 -1
- package/temp/api.json +35 -0
- package/vitest.config.ts +8 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Children,
|
|
3
3
|
computed,
|
|
4
|
+
createSymbol,
|
|
4
5
|
emitSymbol,
|
|
5
6
|
For,
|
|
6
7
|
Indent,
|
|
@@ -61,7 +62,7 @@ export type JsonObjectProps =
|
|
|
61
62
|
* @see {@link @alloy-js/core#MemberScopeContext}
|
|
62
63
|
*/
|
|
63
64
|
export function JsonObject(props: JsonObjectProps) {
|
|
64
|
-
const objectSym =
|
|
65
|
+
const objectSym = createSymbol(JsonOutputSymbol, "object symbol", undefined, {
|
|
65
66
|
transient: true,
|
|
66
67
|
refkeys: props.refkey ? [props.refkey].flat() : undefined,
|
|
67
68
|
});
|
|
@@ -152,7 +153,11 @@ export type ObjectPropertyProps =
|
|
|
152
153
|
export function JsonObjectProperty(props: ObjectPropertyProps) {
|
|
153
154
|
const memberScope = useMemberScope();
|
|
154
155
|
const ownerSymbol = memberScope.ownerSymbol as JsonOutputSymbol;
|
|
155
|
-
const sym =
|
|
156
|
+
const sym = createSymbol(
|
|
157
|
+
JsonOutputSymbol,
|
|
158
|
+
props.name,
|
|
159
|
+
ownerSymbol.staticMembers,
|
|
160
|
+
);
|
|
156
161
|
moveTakenMembersTo(sym);
|
|
157
162
|
onCleanup(() => {
|
|
158
163
|
sym.delete();
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
Children,
|
|
3
3
|
SourceFile as CoreSourceFile,
|
|
4
4
|
createSourceFileTap,
|
|
5
|
+
createSymbol,
|
|
5
6
|
moveTakenMembersTo,
|
|
6
7
|
} from "@alloy-js/core";
|
|
7
8
|
import { JsonFileContext } from "../context/JsonFileContext.js";
|
|
@@ -25,7 +26,7 @@ export interface SourceFileProps {
|
|
|
25
26
|
*
|
|
26
27
|
*/
|
|
27
28
|
export function SourceFile(props: SourceFileProps) {
|
|
28
|
-
const jsonValueSym =
|
|
29
|
+
const jsonValueSym = createSymbol(JsonOutputSymbol, props.path, undefined);
|
|
29
30
|
moveTakenMembersTo(jsonValueSym);
|
|
30
31
|
const fileContext: JsonFileContext = {
|
|
31
32
|
symbol: jsonValueSym,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
createSymbol,
|
|
2
3
|
OutputSpace,
|
|
3
4
|
OutputSymbol,
|
|
4
5
|
OutputSymbolOptions,
|
|
@@ -52,14 +53,25 @@ export class JsonOutputSymbol extends OutputSymbol {
|
|
|
52
53
|
|
|
53
54
|
copy() {
|
|
54
55
|
const options = this.getCopyOptions();
|
|
55
|
-
const
|
|
56
|
+
const binder = this.binder;
|
|
57
|
+
const copy = createSymbol(JsonOutputSymbol, this.name, undefined, {
|
|
56
58
|
...options,
|
|
59
|
+
binder,
|
|
57
60
|
jsonFlags: this.#jsonFlags,
|
|
58
61
|
});
|
|
59
62
|
this.initializeCopy(copy);
|
|
60
63
|
return copy;
|
|
61
64
|
}
|
|
62
65
|
|
|
66
|
+
override get debugInfo(): Record<string, unknown> {
|
|
67
|
+
return {
|
|
68
|
+
...super.debugInfo,
|
|
69
|
+
jsonFlags: this.#jsonFlags,
|
|
70
|
+
isObject: Boolean(this.#jsonFlags & JsonSymbolFlags.Object),
|
|
71
|
+
isArray: Boolean(this.#jsonFlags & JsonSymbolFlags.Array),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
63
75
|
get staticMembers() {
|
|
64
76
|
return this.memberSpaceFor("static")!;
|
|
65
77
|
}
|
package/temp/api.json
CHANGED
|
@@ -1293,6 +1293,41 @@
|
|
|
1293
1293
|
"isAbstract": false,
|
|
1294
1294
|
"name": "copy"
|
|
1295
1295
|
},
|
|
1296
|
+
{
|
|
1297
|
+
"kind": "Property",
|
|
1298
|
+
"canonicalReference": "@alloy-js/json!JsonOutputSymbol#debugInfo:member",
|
|
1299
|
+
"docComment": "",
|
|
1300
|
+
"excerptTokens": [
|
|
1301
|
+
{
|
|
1302
|
+
"kind": "Content",
|
|
1303
|
+
"text": "get debugInfo(): "
|
|
1304
|
+
},
|
|
1305
|
+
{
|
|
1306
|
+
"kind": "Reference",
|
|
1307
|
+
"text": "Record",
|
|
1308
|
+
"canonicalReference": "!Record:type"
|
|
1309
|
+
},
|
|
1310
|
+
{
|
|
1311
|
+
"kind": "Content",
|
|
1312
|
+
"text": "<string, unknown>"
|
|
1313
|
+
},
|
|
1314
|
+
{
|
|
1315
|
+
"kind": "Content",
|
|
1316
|
+
"text": ";"
|
|
1317
|
+
}
|
|
1318
|
+
],
|
|
1319
|
+
"isReadonly": true,
|
|
1320
|
+
"isOptional": false,
|
|
1321
|
+
"releaseTag": "Public",
|
|
1322
|
+
"name": "debugInfo",
|
|
1323
|
+
"propertyTypeTokenRange": {
|
|
1324
|
+
"startIndex": 1,
|
|
1325
|
+
"endIndex": 3
|
|
1326
|
+
},
|
|
1327
|
+
"isStatic": false,
|
|
1328
|
+
"isProtected": false,
|
|
1329
|
+
"isAbstract": false
|
|
1330
|
+
},
|
|
1296
1331
|
{
|
|
1297
1332
|
"kind": "Property",
|
|
1298
1333
|
"canonicalReference": "@alloy-js/json!JsonOutputSymbol#jsonFlags:member",
|
package/vitest.config.ts
CHANGED
|
@@ -2,6 +2,14 @@ import alloyPlugin from "@alloy-js/rollup-plugin";
|
|
|
2
2
|
import { defineConfig } from "vitest/config";
|
|
3
3
|
|
|
4
4
|
export default defineConfig({
|
|
5
|
+
resolve: {
|
|
6
|
+
conditions: ["source"],
|
|
7
|
+
},
|
|
8
|
+
ssr: {
|
|
9
|
+
resolve: {
|
|
10
|
+
conditions: ["source"],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
5
13
|
esbuild: {
|
|
6
14
|
jsx: "preserve",
|
|
7
15
|
sourcemap: "both",
|