@alloy-js/core 0.20.0-dev.4 → 0.20.0-dev.6
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/src/binder.d.ts +62 -38
- package/dist/src/binder.d.ts.map +1 -1
- package/dist/src/binder.js +214 -173
- package/dist/src/components/Declaration.d.ts +2 -2
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js +8 -2
- package/dist/src/components/MemberDeclaration.d.ts +2 -2
- package/dist/src/components/MemberDeclaration.d.ts.map +1 -1
- package/dist/src/components/MemberDeclaration.js +9 -5
- package/dist/src/components/MemberScope.d.ts +30 -13
- package/dist/src/components/MemberScope.d.ts.map +1 -1
- package/dist/src/components/MemberScope.js +37 -15
- package/dist/src/components/Output.d.ts.map +1 -1
- package/dist/src/components/Output.js +2 -5
- package/dist/src/components/ReferenceOrContent.d.ts +1 -1
- package/dist/src/components/ReferenceOrContent.d.ts.map +1 -1
- package/dist/src/components/Scope.d.ts +5 -5
- package/dist/src/components/Scope.d.ts.map +1 -1
- package/dist/src/components/Scope.js +9 -5
- package/dist/src/context/member-scope.d.ts +7 -8
- package/dist/src/context/member-scope.d.ts.map +1 -1
- package/dist/src/context/member-scope.js +5 -5
- package/dist/src/context/name-policy.d.ts.map +1 -1
- package/dist/src/context/name-policy.js +3 -0
- package/dist/src/context/scope.d.ts +1 -0
- package/dist/src/context/scope.d.ts.map +1 -1
- package/dist/src/context/scope.js +7 -0
- package/dist/src/inspect.browser.d.ts +5 -0
- package/dist/src/inspect.browser.d.ts.map +1 -0
- package/dist/src/inspect.browser.js +5 -0
- package/dist/src/inspect.d.ts +2 -0
- package/dist/src/inspect.d.ts.map +1 -0
- package/dist/src/inspect.js +1 -0
- package/dist/src/name-policy.d.ts +11 -0
- package/dist/src/name-policy.d.ts.map +1 -1
- package/dist/src/name-policy.js +3 -0
- package/dist/src/reactive-union-set.d.ts.map +1 -1
- package/dist/src/reactive-union-set.js +12 -8
- package/dist/src/refkey.d.ts +39 -3
- package/dist/src/refkey.d.ts.map +1 -1
- package/dist/src/refkey.js +52 -8
- package/dist/src/symbols/basic-scope.d.ts +14 -0
- package/dist/src/symbols/basic-scope.d.ts.map +1 -0
- package/dist/src/symbols/basic-scope.js +20 -0
- package/dist/src/symbols/basic-symbol.d.ts +19 -0
- package/dist/src/symbols/basic-symbol.d.ts.map +1 -0
- package/dist/src/symbols/basic-symbol.js +28 -0
- package/dist/src/symbols/index.d.ts +3 -1
- package/dist/src/symbols/index.d.ts.map +1 -1
- package/dist/src/symbols/index.js +3 -1
- package/dist/src/symbols/output-scope.d.ts +70 -41
- package/dist/src/symbols/output-scope.d.ts.map +1 -1
- package/dist/src/symbols/output-scope.js +98 -130
- package/dist/src/symbols/output-space.d.ts +25 -0
- package/dist/src/symbols/output-space.d.ts.map +1 -0
- package/dist/src/symbols/output-space.js +35 -0
- package/dist/src/symbols/output-symbol.d.ts +213 -37
- package/dist/src/symbols/output-symbol.d.ts.map +1 -1
- package/dist/src/symbols/output-symbol.js +323 -203
- package/dist/src/symbols/symbol-flow.d.ts +1 -1
- package/dist/src/symbols/symbol-flow.d.ts.map +1 -1
- package/dist/src/symbols/symbol-flow.js +22 -7
- package/dist/src/symbols/symbol-slot.d.ts +27 -9
- package/dist/src/symbols/symbol-slot.d.ts.map +1 -1
- package/dist/src/symbols/symbol-slot.js +20 -4
- package/dist/src/symbols/symbol-table.d.ts +19 -8
- package/dist/src/symbols/symbol-table.d.ts.map +1 -1
- package/dist/src/symbols/symbol-table.js +65 -16
- package/dist/src/tracer.d.ts +15 -3
- package/dist/src/tracer.d.ts.map +1 -1
- package/dist/src/tracer.js +39 -63
- package/dist/test/components/declaration.test.js +9 -14
- package/dist/test/components/reference-or-content.test.js +2 -2
- package/dist/test/symbols/output-scope.test.js +33 -198
- package/dist/test/symbols/output-symbol.test.js +139 -385
- package/dist/test/symbols/resolution.test.js +431 -114
- package/dist/test/symbols/symbol-table.test.d.ts +2 -0
- package/dist/test/symbols/symbol-table.test.d.ts.map +1 -0
- package/dist/test/symbols/symbol-table.test.js +14 -0
- package/dist/test/symbols/utils.d.ts +10 -24
- package/dist/test/symbols/utils.d.ts.map +1 -1
- package/dist/test/symbols/utils.js +23 -45
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -2
- package/src/binder.ts +348 -273
- package/src/components/Declaration.tsx +13 -3
- package/src/components/MemberDeclaration.tsx +15 -8
- package/src/components/MemberScope.tsx +61 -20
- package/src/components/Output.tsx +0 -4
- package/src/components/Scope.tsx +16 -9
- package/src/context/member-scope.ts +10 -10
- package/src/context/name-policy.ts +3 -0
- package/src/context/scope.ts +9 -0
- package/src/inspect.browser.ts +6 -0
- package/src/inspect.ts +1 -0
- package/src/name-policy.ts +14 -0
- package/src/reactive-union-set.ts +14 -8
- package/src/refkey.ts +88 -14
- package/src/symbols/basic-scope.ts +23 -0
- package/src/symbols/basic-symbol.ts +32 -0
- package/src/symbols/index.ts +3 -1
- package/src/symbols/output-scope.ts +131 -170
- package/src/symbols/output-space.ts +49 -0
- package/src/symbols/output-symbol.ts +434 -258
- package/src/symbols/symbol-flow.ts +38 -9
- package/src/symbols/symbol-slot.tsx +46 -8
- package/src/symbols/symbol-table.ts +95 -21
- package/src/tracer.ts +53 -83
- package/temp/api.json +5559 -3079
- package/test/components/declaration.test.tsx +6 -19
- package/test/components/reference-or-content.test.tsx +2 -2
- package/test/symbols/output-scope.test.ts +33 -125
- package/test/symbols/output-symbol.test.ts +128 -348
- package/test/symbols/resolution.test.ts +530 -117
- package/test/symbols/symbol-table.test.ts +15 -0
- package/test/symbols/utils.ts +38 -74
- package/tsdoc.json +4 -0
- package/dist/src/slot.d.ts +0 -15
- package/dist/src/slot.d.ts.map +0 -1
- package/dist/src/slot.js +0 -50
- package/dist/src/symbols/flags.d.ts +0 -70
- package/dist/src/symbols/flags.d.ts.map +0 -1
- package/dist/src/symbols/flags.js +0 -72
- package/dist/test/components/slot.test.d.ts +0 -2
- package/dist/test/components/slot.test.d.ts.map +0 -1
- package/dist/test/components/slot.test.js +0 -134
- package/src/slot.ts +0 -89
- package/src/symbols/flags.ts +0 -82
- package/test/components/slot.test.tsx +0 -174
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { it } from "vitest";
|
|
2
|
-
import { Output } from "../../src/components/Output.jsx";
|
|
3
|
-
import { SourceFile } from "../../src/components/SourceFile.jsx";
|
|
4
|
-
import {
|
|
5
|
-
Declaration,
|
|
6
|
-
Name,
|
|
7
|
-
Ref,
|
|
8
|
-
refkey,
|
|
9
|
-
Scope,
|
|
10
|
-
useBinder,
|
|
11
|
-
} from "../../src/index.js";
|
|
12
|
-
import { render } from "../../src/render.js";
|
|
13
|
-
import { defineSlot, rename, replace } from "../../src/slot.js";
|
|
14
|
-
import { OutputSymbol } from "../../src/symbols/output-symbol.js";
|
|
15
|
-
import "../../testing/extend-expect.js";
|
|
16
|
-
|
|
17
|
-
it("works with string keys", () => {
|
|
18
|
-
interface FunctionSlotProps extends FunctionComponentProps {
|
|
19
|
-
additionalProp: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const FunctionSlot = defineSlot<FunctionSlotProps>(
|
|
23
|
-
(query: { name: string }) => query.name,
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
interface FunctionComponentProps {
|
|
27
|
-
name: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function MyFunctionComponent(props: FunctionComponentProps) {
|
|
31
|
-
const FunctionSlotInstance = FunctionSlot.create(
|
|
32
|
-
props.name,
|
|
33
|
-
{ ...props, additionalProp: "hi" },
|
|
34
|
-
<>
|
|
35
|
-
function {props.name}() {"{"}
|
|
36
|
-
console.log("hello world");
|
|
37
|
-
{"}"}
|
|
38
|
-
</>,
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
return <FunctionSlotInstance />;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// extension.tsx
|
|
45
|
-
replace(FunctionSlot.find({ name: "foo" }), (props: any) => {
|
|
46
|
-
return (
|
|
47
|
-
<>
|
|
48
|
-
// original
|
|
49
|
-
{props.original}
|
|
50
|
-
</>
|
|
51
|
-
);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const _tree = render(
|
|
55
|
-
<Output>
|
|
56
|
-
<SourceFile path="test.ts" filetype="ts">
|
|
57
|
-
<MyFunctionComponent name="foo" />
|
|
58
|
-
</SourceFile>
|
|
59
|
-
</Output>,
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
// console.log(tree.contents[0].contents);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it("works with symbols", () => {
|
|
66
|
-
interface FunctionSlotProps extends FunctionComponentProps {
|
|
67
|
-
additionalProp: string;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const FunctionSlot = defineSlot<FunctionSlotProps>(
|
|
71
|
-
(query: { fqn: string }) => {
|
|
72
|
-
const binder = useBinder();
|
|
73
|
-
return binder!.resolveFQN(query.fqn);
|
|
74
|
-
},
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
interface FunctionComponentProps {
|
|
78
|
-
name: string;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function MyFunctionComponent(props: FunctionComponentProps) {
|
|
82
|
-
const sym = new OutputSymbol(props.name, {
|
|
83
|
-
refkeys: refkey(),
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
const FunctionSlotInstance = FunctionSlot.create(
|
|
87
|
-
sym,
|
|
88
|
-
{ ...props, additionalProp: "hi" },
|
|
89
|
-
<Declaration symbol={sym}>
|
|
90
|
-
function <Name />
|
|
91
|
-
() {"{"}
|
|
92
|
-
console.log("hello world");
|
|
93
|
-
{"}"}
|
|
94
|
-
</Declaration>,
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
return <FunctionSlotInstance />;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// extension.tsx
|
|
101
|
-
replace(FunctionSlot.find({ fqn: "foo.bar" }), (props: any) => {
|
|
102
|
-
return (
|
|
103
|
-
<>
|
|
104
|
-
// original
|
|
105
|
-
{props.original}
|
|
106
|
-
</>
|
|
107
|
-
);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
const _tree = render(
|
|
111
|
-
<Output>
|
|
112
|
-
<SourceFile path="test.ts" filetype="ts">
|
|
113
|
-
<Scope name="foo">
|
|
114
|
-
<MyFunctionComponent name="bar" />
|
|
115
|
-
</Scope>
|
|
116
|
-
</SourceFile>
|
|
117
|
-
</Output>,
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
// console.log(tree.contents[0].contents);
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it("can rename", () => {
|
|
124
|
-
interface FunctionSlotProps extends FunctionComponentProps {
|
|
125
|
-
additionalProp: string;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
const FunctionSlot = defineSlot<FunctionSlotProps>(
|
|
129
|
-
(query: { fqn: string }) => {
|
|
130
|
-
const binder = useBinder()!;
|
|
131
|
-
return binder.resolveFQN(query.fqn);
|
|
132
|
-
},
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
interface FunctionComponentProps {
|
|
136
|
-
name: string;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function MyFunctionComponent(props: FunctionComponentProps) {
|
|
140
|
-
const sym = new OutputSymbol(props.name, {
|
|
141
|
-
refkeys: refkey(),
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
const FunctionSlotInstance = FunctionSlot.create(
|
|
145
|
-
sym,
|
|
146
|
-
{ ...props, additionalProp: "hi" },
|
|
147
|
-
<Declaration symbol={sym}>
|
|
148
|
-
function <Name />
|
|
149
|
-
() {"{"}
|
|
150
|
-
console.log("hello world");
|
|
151
|
-
{"}"}
|
|
152
|
-
</Declaration>,
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
return <FunctionSlotInstance />;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
rename(() => {
|
|
159
|
-
const binder = useBinder();
|
|
160
|
-
return binder!.resolveFQN("foo.bar") as Ref<OutputSymbol | undefined>;
|
|
161
|
-
}, "bazxxx");
|
|
162
|
-
|
|
163
|
-
const _tree = render(
|
|
164
|
-
<Output>
|
|
165
|
-
<SourceFile path="test.ts" filetype="ts">
|
|
166
|
-
<Scope name="foo">
|
|
167
|
-
<MyFunctionComponent name="bar" />
|
|
168
|
-
</Scope>
|
|
169
|
-
</SourceFile>
|
|
170
|
-
</Output>,
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
// console.log(tree.contents[0].contents);
|
|
174
|
-
});
|