@alloy-js/core 0.16.0 → 0.18.0-dev.2
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 +15 -0
- package/dist/src/binder.d.ts +19 -235
- package/dist/src/binder.d.ts.map +1 -1
- package/dist/src/binder.js +85 -386
- package/dist/src/code.d.ts +1 -1
- package/dist/src/code.d.ts.map +1 -1
- 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 +2 -2
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js +6 -5
- 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 +3 -1
- package/dist/src/components/MemberDeclaration.d.ts +3 -3
- package/dist/src/components/MemberDeclaration.d.ts.map +1 -1
- package/dist/src/components/MemberDeclaration.js +4 -4
- package/dist/src/components/MemberScope.d.ts +2 -2
- package/dist/src/components/MemberScope.d.ts.map +1 -1
- package/dist/src/components/MemberScope.js +0 -2
- package/dist/src/components/Output.d.ts +1 -1
- package/dist/src/components/Output.d.ts.map +1 -1
- package/dist/src/components/Output.js +1 -1
- 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 +2 -2
- 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/SourceDirectory.d.ts +1 -1
- package/dist/src/components/SourceDirectory.d.ts.map +1 -1
- package/dist/src/components/SourceDirectory.js +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 +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 +2 -2
- package/dist/src/components/Switch.d.ts.map +1 -1
- package/dist/src/components/Switch.js +2 -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 +3 -3
- 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/context.d.ts +2 -2
- package/dist/src/context.d.ts.map +1 -1
- package/dist/src/context.js +1 -1
- package/dist/src/debug.d.ts +1 -0
- package/dist/src/debug.d.ts.map +1 -1
- package/dist/src/debug.js +4 -1
- package/dist/src/index.d.ts +8 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +8 -2
- package/dist/src/jsx-runtime.d.ts +4 -272
- package/dist/src/jsx-runtime.d.ts.map +1 -1
- package/dist/src/jsx-runtime.js +3 -315
- package/dist/src/props-combinators.d.ts +19 -0
- package/dist/src/props-combinators.d.ts.map +1 -0
- package/dist/src/props-combinators.js +108 -0
- 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/reactivity.d.ts +75 -0
- package/dist/src/reactivity.d.ts.map +1 -0
- package/dist/src/reactivity.js +141 -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/render.d.ts +5 -1
- package/dist/src/render.d.ts.map +1 -1
- package/dist/src/render.js +68 -15
- package/dist/src/runtime/component.d.ts +24 -0
- package/dist/src/runtime/component.d.ts.map +1 -0
- package/dist/src/runtime/component.js +19 -0
- package/dist/src/runtime/intrinsic.d.ts +168 -0
- package/dist/src/runtime/intrinsic.d.ts.map +1 -0
- package/dist/src/runtime/intrinsic.js +11 -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 +2 -2
- package/dist/src/slot.d.ts.map +1 -1
- package/dist/src/slot.js +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 +7 -6
- package/dist/src/sti.d.ts.map +1 -1
- package/dist/src/sti.js +1 -1
- package/dist/src/symbols/flags.d.ts +70 -0
- package/dist/src/symbols/flags.d.ts.map +1 -0
- package/dist/src/symbols/flags.js +72 -0
- package/dist/src/symbols/index.d.ts +7 -0
- package/dist/src/symbols/index.d.ts.map +1 -0
- package/dist/src/symbols/index.js +6 -0
- package/dist/src/symbols/output-scope.d.ts +94 -0
- package/dist/src/symbols/output-scope.d.ts.map +1 -0
- package/dist/src/symbols/output-scope.js +222 -0
- package/dist/src/symbols/output-symbol.d.ts +89 -0
- package/dist/src/symbols/output-symbol.d.ts.map +1 -0
- package/dist/src/symbols/output-symbol.js +333 -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 +3 -2
- package/dist/src/tap.d.ts.map +1 -1
- package/dist/src/tracer.d.ts +238 -0
- package/dist/src/tracer.d.ts.map +1 -0
- package/dist/src/tracer.js +496 -0
- package/dist/src/tsdoc-metadata.json +1 -1
- package/dist/src/utils.d.ts +4 -3
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +2 -1
- package/dist/test/components/slot.test.js +5 -7
- package/dist/test/props-with-defaults.test.js +1 -1
- 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/reactivity/cleanup.test.js +2 -1
- package/dist/test/reactivity/memo.test.js +1 -1
- package/dist/test/reactivity/untrack.test.js +1 -1
- package/dist/test/rendering/memoization.test.js +2 -1
- package/dist/test/split-props.test.js +1 -1
- 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 +343 -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 +447 -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 +141 -0
- package/dist/test/symbols/utils.d.ts +25 -0
- package/dist/test/symbols/utils.d.ts.map +1 -0
- package/dist/test/symbols/utils.js +47 -0
- package/dist/testing/extend-expect.d.ts +15 -0
- package/dist/testing/extend-expect.d.ts.map +1 -1
- package/dist/testing/extend-expect.js +2 -1
- package/dist/testing/render.d.ts +1 -1
- package/dist/testing/render.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +28 -24
- package/src/binder.ts +146 -672
- package/src/code.ts +1 -1
- package/src/components/Block.tsx +4 -1
- package/src/components/Declaration.tsx +8 -7
- package/src/components/For.tsx +2 -1
- package/src/components/Indent.tsx +1 -1
- package/src/components/List.tsx +3 -1
- package/src/components/MemberDeclaration.tsx +7 -6
- package/src/components/MemberScope.tsx +2 -5
- package/src/components/Output.tsx +2 -1
- package/src/components/Prose.tsx +1 -1
- package/src/components/ReferenceOrContent.tsx +1 -1
- package/src/components/Scope.tsx +3 -7
- package/src/components/Show.tsx +1 -1
- package/src/components/SourceDirectory.tsx +2 -1
- package/src/components/SourceFile.tsx +2 -1
- package/src/components/StatementList.tsx +2 -1
- package/src/components/Switch.tsx +2 -1
- package/src/components/Wrap.tsx +1 -1
- package/src/context/assignment.ts +1 -1
- package/src/context/binder.ts +3 -3
- 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/context.ts +3 -7
- package/src/debug.ts +5 -1
- package/src/index.ts +15 -1
- package/src/jsx-runtime.ts +15 -674
- package/src/props-combinators.ts +148 -0
- package/src/reactive-union-set.ts +238 -0
- package/src/reactivity.ts +230 -0
- package/src/refkey.ts +40 -0
- package/src/render.ts +97 -26
- package/src/runtime/component.ts +67 -0
- package/src/runtime/intrinsic.ts +199 -0
- package/src/scheduler.ts +31 -6
- package/src/slot.ts +3 -4
- package/src/stc.ts +2 -2
- package/src/sti.ts +11 -11
- package/src/symbols/flags.ts +82 -0
- package/src/symbols/index.ts +6 -0
- package/src/symbols/output-scope.ts +296 -0
- package/src/symbols/output-symbol.ts +459 -0
- package/src/symbols/symbol-flow.ts +100 -0
- package/src/symbols/symbol-slot.tsx +48 -0
- package/src/symbols/symbol-table.ts +72 -0
- package/src/tap.ts +3 -2
- package/src/tracer.ts +474 -0
- package/src/utils.tsx +7 -5
- package/temp/api.json +7446 -5133
- package/test/components/slot.test.tsx +8 -11
- package/test/props-with-defaults.test.ts +1 -1
- package/test/reactive-union-set.test.tsx +191 -0
- package/test/reactivity/cleanup.test.tsx +2 -1
- package/test/reactivity/memo.test.tsx +1 -1
- package/test/reactivity/untrack.test.ts +1 -1
- package/test/rendering/basic.test.tsx +1 -1
- package/test/rendering/memoization.test.tsx +1 -1
- package/test/split-props.test.ts +1 -1
- package/test/symbols/output-scope.test.ts +300 -0
- package/test/symbols/output-symbol.test.ts +456 -0
- package/test/symbols/resolution.test.ts +170 -0
- package/test/symbols/utils.ts +93 -0
- package/test/utils.test.tsx +1 -1
- package/testing/extend-expect.ts +16 -0
- package/testing/render.ts +1 -2
- package/LICENSE +0 -7
- 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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog - @alloy-js/core
|
|
2
2
|
|
|
3
|
+
## 0.17.0
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- [#157](https://github.com/alloy-framework/alloy/pull/157) Add tracing for symbols. Tracing can be enabled by setting ALLOY_TRACE environment variable to a comma-separated list of symbol, scope, and/or resolve.
|
|
8
|
+
- [#157](https://github.com/alloy-framework/alloy/pull/157) Symbols and member scopes now support copy and move operations. These are used in combination with instantiate to model such things as instantiating and applying types to variables.
|
|
9
|
+
- [#157](https://github.com/alloy-framework/alloy/pull/157) New symbol flag Transient which is a symbol that is merely a placeholder. For example, symbols created by expressions are generally transient, and their useful parts are copied into a declaration symbol when appropriate.
|
|
10
|
+
- [#157](https://github.com/alloy-framework/alloy/pull/157) Symbols can now be aliased. Alias symbols will look up to their alias target when accessing things like instance or static members.
|
|
11
|
+
|
|
12
|
+
### Breaking Changes
|
|
13
|
+
|
|
14
|
+
- [#157](https://github.com/alloy-framework/alloy/pull/157) Refactor symbols to drastically simplify and optimize their usage. Symbols and scopes are now classes, and languages subclass these to add additional behaviors. Many binder APIs which operated on scopes or symbols are now methods on scopes or symbols.
|
|
15
|
+
- [#157](https://github.com/alloy-framework/alloy/pull/157) New takeSymbol/emitSymbol APIs added for passing symbols up the render tree to components which accept them. This is a generalization of the pattern in AssignmentTargetContext, so that context has been deleted.
|
|
16
|
+
|
|
17
|
+
|
|
3
18
|
## 0.16.0
|
|
4
19
|
|
|
5
20
|
### Features
|
package/dist/src/binder.d.ts
CHANGED
|
@@ -1,206 +1,9 @@
|
|
|
1
1
|
import { Ref } from "@vue/reactivity";
|
|
2
2
|
import { Refkey } from "./refkey.js";
|
|
3
|
+
import { OutputSymbolFlags } from "./symbols/flags.js";
|
|
4
|
+
import { OutputScope } from "./symbols/output-scope.js";
|
|
5
|
+
import { type OutputSymbol } from "./symbols/output-symbol.js";
|
|
3
6
|
export type Metadata = object;
|
|
4
|
-
/**
|
|
5
|
-
* Flags that describe an output symbol.
|
|
6
|
-
*/
|
|
7
|
-
export declare enum OutputSymbolFlags {
|
|
8
|
-
None = 0,
|
|
9
|
-
/**
|
|
10
|
-
* The symbol is an instance member container. Symbols with this flag will have a
|
|
11
|
-
* instanceMemberScope property that contains symbols for instance members.
|
|
12
|
-
*/
|
|
13
|
-
InstanceMemberContainer = 1,
|
|
14
|
-
/**
|
|
15
|
-
* The symbol is a static member container. Symbols with this flag will have a
|
|
16
|
-
* staticMemberScope property that contains symbols for static members.
|
|
17
|
-
*/
|
|
18
|
-
StaticMemberContainer = 2,
|
|
19
|
-
/**
|
|
20
|
-
* Whether this symbol contains members of any kind.
|
|
21
|
-
*/
|
|
22
|
-
MemberContainer = 3,
|
|
23
|
-
/**
|
|
24
|
-
* Whether this symbol is an instance member of another symbol (i.e that it is
|
|
25
|
-
* stored in an instance member scope).
|
|
26
|
-
*/
|
|
27
|
-
InstanceMember = 4,
|
|
28
|
-
/**
|
|
29
|
-
* Whether this symbol is a static member of another symbol (i.e that it is
|
|
30
|
-
* stored in a static member scope).
|
|
31
|
-
*/
|
|
32
|
-
StaticMember = 8,
|
|
33
|
-
/**
|
|
34
|
-
* Whether this is an instance member or static member of another symbol.
|
|
35
|
-
*/
|
|
36
|
-
Member = 12
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* An output symbol is a named entity that can be referenced in your output
|
|
40
|
-
* code. Referencing symbols is generally accomplished by using a
|
|
41
|
-
* {@link Refkey}.
|
|
42
|
-
*
|
|
43
|
-
* @remarks
|
|
44
|
-
*
|
|
45
|
-
* This interface is the base implementation of symbol. Generally, most
|
|
46
|
-
* languages will have subtypes of this interface that provide additional,
|
|
47
|
-
* language-specific metadata about declared symbols. For example, symbols in
|
|
48
|
-
* TypeScript need to track whether they are exported or what kind of symbol
|
|
49
|
-
* they are (e.g. type, value, parameter, etc.)
|
|
50
|
-
*
|
|
51
|
-
* Symbols are reactive values, which allows you to observe changes to the symbol
|
|
52
|
-
* information. For example, a symbol's name may change if it becomes conflicted
|
|
53
|
-
* with a symbol that is added later.
|
|
54
|
-
*/
|
|
55
|
-
export interface OutputSymbol {
|
|
56
|
-
/**
|
|
57
|
-
* The original name of the symbol, before any conflicts were resolved.
|
|
58
|
-
*/
|
|
59
|
-
originalName: string;
|
|
60
|
-
/**
|
|
61
|
-
* The name of the symbol.
|
|
62
|
-
*/
|
|
63
|
-
name: string;
|
|
64
|
-
/**
|
|
65
|
-
* The symbol's flags.
|
|
66
|
-
*/
|
|
67
|
-
flags: OutputSymbolFlags;
|
|
68
|
-
/**
|
|
69
|
-
* The scope in which the symbol is defined.
|
|
70
|
-
*/
|
|
71
|
-
scope: OutputScope;
|
|
72
|
-
/**
|
|
73
|
-
* The binder instance that created this symbol.
|
|
74
|
-
*/
|
|
75
|
-
binder: Binder;
|
|
76
|
-
/**
|
|
77
|
-
* The unique values that reference this symbol.
|
|
78
|
-
*/
|
|
79
|
-
refkeys: Refkey[];
|
|
80
|
-
/**
|
|
81
|
-
* The instance members available on this symbol.
|
|
82
|
-
*
|
|
83
|
-
* @remarks
|
|
84
|
-
*
|
|
85
|
-
* Instance members are members that are available when this symbol is
|
|
86
|
-
* instantiated. Instantiation is language-specific. For example, in
|
|
87
|
-
* TypeScript, instance members of symbols for classes are available when the
|
|
88
|
-
* class is instantiated with a new expression.
|
|
89
|
-
*
|
|
90
|
-
* When a symbol cannot have instance members, this is undefined.
|
|
91
|
-
*/
|
|
92
|
-
instanceMemberScope?: OutputScope;
|
|
93
|
-
/**
|
|
94
|
-
* The static members available on this symbol.
|
|
95
|
-
*
|
|
96
|
-
* @remarks
|
|
97
|
-
*
|
|
98
|
-
* Static members are members that are available on the symbol itself. These symbols
|
|
99
|
-
* can be accessed off the parent symbol directly with a refkey. There is only ever
|
|
100
|
-
* one static member symbol in the output (i.e., the symbol is unique).
|
|
101
|
-
*/
|
|
102
|
-
staticMemberScope?: OutputScope;
|
|
103
|
-
/**
|
|
104
|
-
* Additional custom metadata about this symbol.
|
|
105
|
-
*/
|
|
106
|
-
metadata: Record<string, unknown>;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Flags that describe an output scope.
|
|
110
|
-
*/
|
|
111
|
-
export declare enum OutputScopeFlags {
|
|
112
|
-
None = 0,
|
|
113
|
-
/**
|
|
114
|
-
* This scope is a static member scope.
|
|
115
|
-
*/
|
|
116
|
-
StaticMemberScope = 1,
|
|
117
|
-
/**
|
|
118
|
-
* This scope is an instance member scope.
|
|
119
|
-
*/
|
|
120
|
-
InstanceMemberScope = 2,
|
|
121
|
-
/**
|
|
122
|
-
* This scope is a member scope. Scopes with this flag will have an `owner`
|
|
123
|
-
* property that points to the symbol whose member this scope holds.
|
|
124
|
-
*/
|
|
125
|
-
MemberScope = 3
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* A container of symbols accessible within some scope in your output code.
|
|
129
|
-
*
|
|
130
|
-
* @remarks
|
|
131
|
-
*
|
|
132
|
-
* Scopes form a tree. All scopes except the global scope have a parent scope
|
|
133
|
-
* identified by `parent`. Scopes can have nested scopes which can be accessed
|
|
134
|
-
* using the `children` property. Whether a child scope can be accessed from
|
|
135
|
-
* the parent scope is determined by each language's scoping rules.
|
|
136
|
-
*
|
|
137
|
-
* This interface is the base implementation of scope. Generally, most languages
|
|
138
|
-
* will have subtypes of this interface that provide additional metadata about
|
|
139
|
-
* the scope. For example, TypeScript scopes need to track whether the scope
|
|
140
|
-
* represents a package, module, class, function, etc.
|
|
141
|
-
*
|
|
142
|
-
* Scopes are reactive values, which allows you to observe changes to the scope
|
|
143
|
-
* within a reactive context.
|
|
144
|
-
*/
|
|
145
|
-
export interface OutputScope {
|
|
146
|
-
/**
|
|
147
|
-
* The kind of scope. Subtypes will likely provide a set of known scope kinds.
|
|
148
|
-
* The kind is not used by the binder itself.
|
|
149
|
-
*/
|
|
150
|
-
kind?: string;
|
|
151
|
-
/**
|
|
152
|
-
* The name of the scope.
|
|
153
|
-
*/
|
|
154
|
-
name: string;
|
|
155
|
-
/**
|
|
156
|
-
* The flags that describe this scope.
|
|
157
|
-
*/
|
|
158
|
-
flags: OutputScopeFlags;
|
|
159
|
-
/**
|
|
160
|
-
* The symbols defined within this scope.
|
|
161
|
-
*/
|
|
162
|
-
symbols: Set<OutputSymbol>;
|
|
163
|
-
/**
|
|
164
|
-
* The symbols defined within this scope, indexed by refkey.
|
|
165
|
-
*/
|
|
166
|
-
symbolsByRefkey: Map<Refkey, OutputSymbol>;
|
|
167
|
-
/**
|
|
168
|
-
* The scopes nested within this scope.
|
|
169
|
-
*/
|
|
170
|
-
children: Set<OutputScope>;
|
|
171
|
-
/**
|
|
172
|
-
* The container of this scope.
|
|
173
|
-
*/
|
|
174
|
-
parent: OutputScope | undefined;
|
|
175
|
-
/**
|
|
176
|
-
* The symbol that owns this scope. This is only defined for scopes that have
|
|
177
|
-
* the {@link OutputScopeFlags.StaticMemberScope} flag.
|
|
178
|
-
*/
|
|
179
|
-
owner?: OutputSymbol;
|
|
180
|
-
/**
|
|
181
|
-
* The binder that created this scope.
|
|
182
|
-
*/
|
|
183
|
-
binder: Binder;
|
|
184
|
-
/**
|
|
185
|
-
* Get the names of all symbols in this scope.
|
|
186
|
-
*/
|
|
187
|
-
getSymbolNames(): Set<string>;
|
|
188
|
-
}
|
|
189
|
-
export type CreateSymbolOptions<T extends OutputSymbol = OutputSymbol> = {
|
|
190
|
-
name: string;
|
|
191
|
-
scope?: OutputScope;
|
|
192
|
-
refkey?: Refkey | Refkey[];
|
|
193
|
-
flags?: OutputSymbolFlags;
|
|
194
|
-
metadata?: Record<string, unknown>;
|
|
195
|
-
} & Omit<T, keyof OutputSymbol>;
|
|
196
|
-
export type CreateScopeOptions<T extends OutputScope = OutputScope> = {
|
|
197
|
-
kind: T["kind"];
|
|
198
|
-
name: string;
|
|
199
|
-
parent?: OutputScope | undefined;
|
|
200
|
-
flags?: OutputScopeFlags;
|
|
201
|
-
owner?: OutputSymbol;
|
|
202
|
-
metadata?: Record<string, unknown>;
|
|
203
|
-
} & Omit<T, keyof OutputScope>;
|
|
204
7
|
/**
|
|
205
8
|
* The binder tracks all output scopes and symbols. Scopes are nested containers
|
|
206
9
|
* for symbols.
|
|
@@ -215,41 +18,6 @@ export type CreateScopeOptions<T extends OutputScope = OutputScope> = {
|
|
|
215
18
|
*
|
|
216
19
|
*/
|
|
217
20
|
export interface Binder {
|
|
218
|
-
/**
|
|
219
|
-
* Create a new scope. The scope will be added to the parent scope's children.
|
|
220
|
-
* The returned scope object is reactive.
|
|
221
|
-
*/
|
|
222
|
-
createScope<T extends OutputScope>(args: CreateScopeOptions<T>): T;
|
|
223
|
-
/**
|
|
224
|
-
* Create a new symbol. The symbol will be added to the parent scope's symbols.
|
|
225
|
-
* The returned symbol object is reactive.
|
|
226
|
-
*/
|
|
227
|
-
createSymbol<T extends OutputSymbol>(args: CreateSymbolOptions<T>): T;
|
|
228
|
-
/**
|
|
229
|
-
* Delete the given symbol. The symbol will be removed from its parent's
|
|
230
|
-
* scope. Any resolutions to this symbol will become undefined.
|
|
231
|
-
*/
|
|
232
|
-
deleteSymbol(symbol: OutputSymbol): void;
|
|
233
|
-
/**
|
|
234
|
-
* Instantiate the static members of a symbol into the instance members of
|
|
235
|
-
* another symbol.
|
|
236
|
-
*
|
|
237
|
-
* @param sourceSym - The symbol to add instance members to.
|
|
238
|
-
* @param targetSym - The symbol with the static members to instantiate.
|
|
239
|
-
*/
|
|
240
|
-
instantiateSymbolInto(sourceSym: OutputSymbol, targetSym: OutputSymbol): void;
|
|
241
|
-
/**
|
|
242
|
-
* Add static members to an existing symbol.
|
|
243
|
-
*
|
|
244
|
-
* @param symbol - The symbol to add static members to.
|
|
245
|
-
*/
|
|
246
|
-
addStaticMembersToSymbol(symbol: OutputSymbol): void;
|
|
247
|
-
/**
|
|
248
|
-
* Add instance members to an existing symbol.
|
|
249
|
-
*
|
|
250
|
-
* @param symbol - The symbol to add instance members to.
|
|
251
|
-
*/
|
|
252
|
-
addInstanceMembersToSymbol(symbol: OutputSymbol): void;
|
|
253
21
|
/**
|
|
254
22
|
* Resolve the given refkey in the current scope.
|
|
255
23
|
*
|
|
@@ -279,6 +47,22 @@ export interface Binder {
|
|
|
279
47
|
* The global scope. This is the root scope for all symbols.
|
|
280
48
|
*/
|
|
281
49
|
globalScope: OutputScope;
|
|
50
|
+
/**
|
|
51
|
+
* The name conflict resolver to use for this binder.
|
|
52
|
+
*/
|
|
53
|
+
nameConflictResolver?: NameConflictResolver;
|
|
54
|
+
/**
|
|
55
|
+
* Notifies the binder that a scope has been created.
|
|
56
|
+
*/
|
|
57
|
+
notifyScopeCreated(scope: OutputScope): void;
|
|
58
|
+
/**
|
|
59
|
+
* Notifies the binder that a symbol has been created.
|
|
60
|
+
*/
|
|
61
|
+
notifySymbolCreated(symbol: OutputSymbol): void;
|
|
62
|
+
/**
|
|
63
|
+
* Notifies the binder that a symbol has been deleted.
|
|
64
|
+
*/
|
|
65
|
+
notifySymbolDeleted(symbol: OutputSymbol): void;
|
|
282
66
|
}
|
|
283
67
|
/**
|
|
284
68
|
* A successful resolution of a refkey.
|
package/dist/src/binder.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binder.d.ts","sourceRoot":"","sources":["../../src/binder.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"binder.d.ts","sourceRoot":"","sources":["../../src/binder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,GAAG,EAA0B,MAAM,iBAAiB,CAAC;AAI7E,OAAO,EAAU,MAAM,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAQ/D,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,MAAM;IACrB;;;;;;OAMG;IACH,uBAAuB,CACrB,MAAM,SAAS,WAAW,GAAG,WAAW,EACxC,OAAO,SAAS,YAAY,GAAG,YAAY,EAE3C,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,kBAAkB,EAAE,MAAM,GAAG,SAAS,EACtC,GAAG,EAAE,MAAM,GACV,GAAG,CAAC,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CAAC;IAEtD,kBAAkB,CAAC,OAAO,SAAS,Y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