@alloy-js/core 0.15.0 → 0.17.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 +23 -0
- package/dist/src/binder.d.ts +18 -235
- package/dist/src/binder.d.ts.map +1 -1
- package/dist/src/binder.js +85 -386
- package/dist/src/components/Block.d.ts +1 -1
- package/dist/src/components/Block.d.ts.map +1 -1
- package/dist/src/components/Block.js +3 -1
- 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 +5 -4
- package/dist/src/components/For.d.ts +1 -1
- package/dist/src/components/For.d.ts.map +1 -1
- package/dist/src/components/For.js +1 -1
- package/dist/src/components/Indent.d.ts +1 -1
- package/dist/src/components/Indent.d.ts.map +1 -1
- package/dist/src/components/List.d.ts +1 -1
- package/dist/src/components/List.d.ts.map +1 -1
- package/dist/src/components/List.js +2 -1
- package/dist/src/components/MemberDeclaration.d.ts +1 -1
- package/dist/src/components/MemberDeclaration.d.ts.map +1 -1
- package/dist/src/components/MemberDeclaration.js +3 -4
- package/dist/src/components/MemberScope.d.ts +1 -1
- package/dist/src/components/MemberScope.d.ts.map +1 -1
- package/dist/src/components/MemberScope.js +0 -2
- package/dist/src/components/Prose.d.ts +1 -1
- package/dist/src/components/Prose.d.ts.map +1 -1
- 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 +1 -1
- package/dist/src/components/Scope.d.ts.map +1 -1
- package/dist/src/components/Scope.js +3 -6
- package/dist/src/components/Show.d.ts +1 -1
- package/dist/src/components/Show.d.ts.map +1 -1
- package/dist/src/components/StatementList.d.ts +1 -1
- package/dist/src/components/StatementList.d.ts.map +1 -1
- package/dist/src/components/StatementList.js +1 -1
- package/dist/src/components/Switch.d.ts +1 -1
- package/dist/src/components/Switch.d.ts.map +1 -1
- package/dist/src/components/Switch.js +1 -1
- package/dist/src/components/Wrap.d.ts +1 -1
- package/dist/src/components/Wrap.d.ts.map +1 -1
- package/dist/src/context/assignment.d.ts +1 -1
- package/dist/src/context/assignment.d.ts.map +1 -1
- package/dist/src/context/binder.d.ts +2 -2
- package/dist/src/context/binder.d.ts.map +1 -1
- package/dist/src/context/declaration.d.ts +1 -1
- package/dist/src/context/declaration.d.ts.map +1 -1
- package/dist/src/context/member-declaration.d.ts +1 -1
- package/dist/src/context/member-declaration.d.ts.map +1 -1
- package/dist/src/context/member-declaration.js +0 -1
- package/dist/src/context/member-scope.d.ts +1 -1
- package/dist/src/context/member-scope.d.ts.map +1 -1
- package/dist/src/context/name-policy.d.ts +1 -1
- package/dist/src/context/name-policy.d.ts.map +1 -1
- package/dist/src/context/scope.d.ts +1 -1
- package/dist/src/context/scope.d.ts.map +1 -1
- package/dist/src/context/source-directory.d.ts +1 -1
- package/dist/src/context/source-directory.d.ts.map +1 -1
- package/dist/src/context/source-file.d.ts +2 -2
- package/dist/src/context/source-file.d.ts.map +1 -1
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -1
- package/dist/src/jsx-runtime.d.ts +12 -3
- package/dist/src/jsx-runtime.d.ts.map +1 -1
- package/dist/src/jsx-runtime.js +6 -2
- package/dist/src/reactive-union-set.d.ts +29 -0
- package/dist/src/reactive-union-set.d.ts.map +1 -0
- package/dist/src/reactive-union-set.js +183 -0
- package/dist/src/refkey.d.ts +36 -0
- package/dist/src/refkey.d.ts.map +1 -1
- package/dist/src/refkey.js +40 -0
- package/dist/src/scheduler.d.ts +2 -2
- package/dist/src/scheduler.d.ts.map +1 -1
- package/dist/src/scheduler.js +27 -6
- package/dist/src/slot.d.ts +1 -1
- package/dist/src/slot.d.ts.map +1 -1
- package/dist/src/stc.d.ts +1 -1
- package/dist/src/stc.d.ts.map +1 -1
- package/dist/src/sti.d.ts +1 -1
- package/dist/src/sti.d.ts.map +1 -1
- package/dist/src/sti.js +1 -1
- package/dist/src/symbols/index.d.ts +6 -0
- package/dist/src/symbols/index.d.ts.map +1 -0
- package/dist/src/symbols/index.js +5 -0
- package/dist/src/symbols/output-scope.d.ts +116 -0
- package/dist/src/symbols/output-scope.d.ts.map +1 -0
- package/dist/src/symbols/output-scope.js +246 -0
- package/dist/src/symbols/output-symbol.d.ts +134 -0
- package/dist/src/symbols/output-symbol.d.ts.map +1 -0
- package/dist/src/symbols/output-symbol.js +379 -0
- package/dist/src/symbols/symbol-flow.d.ts +13 -0
- package/dist/src/symbols/symbol-flow.d.ts.map +1 -0
- package/dist/src/symbols/symbol-flow.js +74 -0
- package/dist/src/symbols/symbol-slot.d.ts +12 -0
- package/dist/src/symbols/symbol-slot.d.ts.map +1 -0
- package/dist/src/symbols/symbol-slot.js +36 -0
- package/dist/src/symbols/symbol-table.d.ts +14 -0
- package/dist/src/symbols/symbol-table.d.ts.map +1 -0
- package/dist/src/symbols/symbol-table.js +42 -0
- package/dist/src/tap.d.ts +2 -1
- package/dist/src/tap.d.ts.map +1 -1
- package/dist/src/tracer.d.ts +181 -0
- package/dist/src/tracer.d.ts.map +1 -0
- package/dist/src/tracer.js +441 -0
- package/dist/src/tsdoc-metadata.json +1 -1
- package/dist/test/components/slot.test.js +5 -7
- package/dist/test/reactive-union-set.test.d.ts +2 -0
- package/dist/test/reactive-union-set.test.d.ts.map +1 -0
- package/dist/test/reactive-union-set.test.js +170 -0
- package/dist/test/symbols/output-scope.test.d.ts +2 -0
- package/dist/test/symbols/output-scope.test.d.ts.map +1 -0
- package/dist/test/symbols/output-scope.test.js +342 -0
- package/dist/test/symbols/output-symbol.test.d.ts +2 -0
- package/dist/test/symbols/output-symbol.test.d.ts.map +1 -0
- package/dist/test/symbols/output-symbol.test.js +446 -0
- package/dist/test/symbols/resolution.test.d.ts +2 -0
- package/dist/test/symbols/resolution.test.d.ts.map +1 -0
- package/dist/test/symbols/resolution.test.js +140 -0
- package/dist/test/symbols/utils.d.ts +24 -0
- package/dist/test/symbols/utils.d.ts.map +1 -0
- package/dist/test/symbols/utils.js +46 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/binder.ts +148 -672
- package/src/components/Block.tsx +4 -1
- package/src/components/Declaration.tsx +6 -6
- package/src/components/For.tsx +1 -1
- package/src/components/Indent.tsx +1 -1
- package/src/components/List.tsx +1 -1
- package/src/components/MemberDeclaration.tsx +4 -4
- package/src/components/MemberScope.tsx +2 -5
- package/src/components/Prose.tsx +1 -1
- package/src/components/ReferenceOrContent.tsx +1 -1
- package/src/components/Scope.tsx +2 -6
- package/src/components/Show.tsx +1 -1
- package/src/components/StatementList.tsx +2 -1
- package/src/components/Switch.tsx +1 -1
- package/src/components/Wrap.tsx +1 -1
- package/src/context/assignment.ts +1 -1
- package/src/context/binder.ts +2 -2
- package/src/context/declaration.ts +1 -1
- package/src/context/member-declaration.ts +1 -1
- package/src/context/member-scope.ts +1 -1
- package/src/context/name-policy.ts +1 -1
- package/src/context/scope.ts +1 -1
- package/src/context/source-directory.ts +1 -1
- package/src/context/source-file.ts +2 -2
- package/src/index.ts +15 -0
- package/src/jsx-runtime.ts +18 -2
- package/src/reactive-union-set.ts +238 -0
- package/src/refkey.ts +40 -0
- package/src/scheduler.ts +31 -6
- package/src/slot.ts +1 -1
- package/src/stc.ts +3 -3
- package/src/sti.ts +5 -5
- package/src/symbols/index.ts +5 -0
- package/src/symbols/output-scope.ts +323 -0
- package/src/symbols/output-symbol.ts +512 -0
- package/src/symbols/symbol-flow.ts +104 -0
- package/src/symbols/symbol-slot.tsx +47 -0
- package/src/symbols/symbol-table.ts +72 -0
- package/src/tap.ts +2 -1
- package/src/tracer.ts +440 -0
- package/temp/api.json +4172 -1582
- package/test/components/slot.test.tsx +8 -11
- package/test/reactive-union-set.test.tsx +191 -0
- package/test/symbols/output-scope.test.ts +302 -0
- package/test/symbols/output-symbol.test.ts +459 -0
- package/test/symbols/resolution.test.ts +172 -0
- package/test/symbols/utils.ts +95 -0
- package/dist/test/symbols.test.d.ts +0 -2
- package/dist/test/symbols.test.d.ts.map +0 -1
- package/dist/test/symbols.test.js +0 -884
- package/test/symbols.test.ts +0 -1006
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Binder } from "../../src/index.browser.js";
|
|
2
|
+
import { Refkey, refkey } from "../../src/refkey.js";
|
|
3
|
+
import {
|
|
4
|
+
OutputScope,
|
|
5
|
+
OutputScopeFlags,
|
|
6
|
+
} from "../../src/symbols/output-scope.js";
|
|
7
|
+
import {
|
|
8
|
+
OutputSymbol,
|
|
9
|
+
OutputSymbolFlags,
|
|
10
|
+
} from "../../src/symbols/output-symbol.js";
|
|
11
|
+
|
|
12
|
+
type ScopeRecords = Record<string, ScopeDescriptor>;
|
|
13
|
+
type SymbolRecords = Record<string, SymbolDescriptor>;
|
|
14
|
+
|
|
15
|
+
interface ScopeDescriptor {
|
|
16
|
+
flags?: OutputScopeFlags;
|
|
17
|
+
scopes?: ScopeRecords;
|
|
18
|
+
symbols: SymbolRecords;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface SymbolDescriptor {
|
|
22
|
+
refkey?: Refkey;
|
|
23
|
+
flags?: OutputSymbolFlags;
|
|
24
|
+
instanceMembers?: SymbolRecords;
|
|
25
|
+
staticMembers?: SymbolRecords;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface ScopeTreeResult {
|
|
29
|
+
symbols: Record<string, OutputSymbol>;
|
|
30
|
+
scopes: Record<string, OutputScope>;
|
|
31
|
+
}
|
|
32
|
+
export function createScopeTree(
|
|
33
|
+
binder: Binder,
|
|
34
|
+
tree: ScopeRecords,
|
|
35
|
+
): ScopeTreeResult {
|
|
36
|
+
const createdItems: ScopeTreeResult = {
|
|
37
|
+
symbols: {},
|
|
38
|
+
scopes: {},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
for (const [name, desc] of Object.entries(tree)) {
|
|
42
|
+
createScope(name, desc);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return createdItems;
|
|
46
|
+
|
|
47
|
+
function createScope(
|
|
48
|
+
name: string,
|
|
49
|
+
descriptor: ScopeDescriptor,
|
|
50
|
+
parent = binder.globalScope,
|
|
51
|
+
) {
|
|
52
|
+
const scope = new OutputScope(name, {
|
|
53
|
+
binder,
|
|
54
|
+
parent,
|
|
55
|
+
flags: descriptor.flags,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
createdItems.scopes[name] = scope;
|
|
59
|
+
|
|
60
|
+
for (const [name, desc] of Object.entries(descriptor.symbols)) {
|
|
61
|
+
createSymbol(name, desc, scope);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
for (const [name, desc] of Object.entries(descriptor.scopes ?? {})) {
|
|
65
|
+
createScope(name, desc, scope);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function createSymbol(
|
|
70
|
+
name: string,
|
|
71
|
+
descriptor: SymbolDescriptor,
|
|
72
|
+
parent: OutputScope,
|
|
73
|
+
) {
|
|
74
|
+
const symbol = new OutputSymbol(name, {
|
|
75
|
+
binder,
|
|
76
|
+
scope: parent,
|
|
77
|
+
refkeys: [descriptor.refkey ?? refkey()],
|
|
78
|
+
flags: descriptor.flags ?? OutputSymbolFlags.None,
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
createdItems.symbols[name] = symbol;
|
|
82
|
+
|
|
83
|
+
if (descriptor.instanceMembers) {
|
|
84
|
+
for (const [name, desc] of Object.entries(descriptor.instanceMembers)) {
|
|
85
|
+
createSymbol(name, desc, symbol.instanceMemberScope!);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (descriptor.staticMembers) {
|
|
90
|
+
for (const [name, desc] of Object.entries(descriptor.staticMembers)) {
|
|
91
|
+
createSymbol(name, desc, symbol.staticMemberScope!);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"symbols.test.d.ts","sourceRoot":"","sources":["../../test/symbols.test.ts"],"names":[],"mappings":""}
|