@alloy-js/typescript 0.23.0-dev.0 → 0.23.0-dev.4
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/components/FunctionType.d.ts +1 -1
- package/dist/src/components/FunctionType.js +1 -1
- package/dist/src/components/FunctionType.js.map +1 -1
- package/dist/src/components/IfStatement.d.ts.map +1 -1
- package/dist/src/components/IfStatement.js +2 -3
- package/dist/src/components/IfStatement.js.map +1 -1
- package/dist/src/components/Interface.d.ts +1 -1
- package/dist/src/components/Interface.d.ts.map +1 -1
- package/dist/src/components/Interface.js +14 -9
- package/dist/src/components/Interface.js.map +1 -1
- package/dist/src/components/MemberScope.d.ts.map +1 -1
- package/dist/src/components/MemberScope.js +6 -2
- package/dist/src/components/MemberScope.js.map +1 -1
- package/dist/src/components/PackageDirectory.d.ts.map +1 -1
- package/dist/src/components/PackageDirectory.js +2 -2
- package/dist/src/components/PackageDirectory.js.map +1 -1
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.js +4 -2
- package/dist/src/components/SourceFile.js.map +1 -1
- package/dist/src/components/TryStatement.d.ts +80 -0
- package/dist/src/components/TryStatement.d.ts.map +1 -0
- package/dist/src/components/TryStatement.js +112 -0
- package/dist/src/components/TryStatement.js.map +1 -0
- package/dist/src/components/TryStatement.test.d.ts +2 -0
- package/dist/src/components/TryStatement.test.d.ts.map +1 -0
- package/dist/src/components/TryStatement.test.js +121 -0
- package/dist/src/components/TryStatement.test.js.map +1 -0
- package/dist/src/components/TypeDeclaration.d.ts +1 -1
- package/dist/src/components/TypeDeclaration.d.ts.map +1 -1
- package/dist/src/components/TypeDeclaration.js +1 -1
- package/dist/src/components/TypeDeclaration.js.map +1 -1
- package/dist/src/components/TypeRefContext.d.ts +1 -1
- package/dist/src/components/TypeRefContext.d.ts.map +1 -1
- package/dist/src/components/TypeRefContext.js +1 -1
- package/dist/src/components/TypeRefContext.js.map +1 -1
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +1 -0
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/context/type-ref-context.d.ts.map +1 -1
- package/dist/src/context/type-ref-context.js +2 -2
- package/dist/src/context/type-ref-context.js.map +1 -1
- package/dist/src/create-package.d.ts.map +1 -1
- package/dist/src/create-package.js +7 -6
- package/dist/src/create-package.js.map +1 -1
- package/dist/src/symbols/index.d.ts.map +1 -1
- package/dist/src/symbols/index.js +47 -11
- package/dist/src/symbols/index.js.map +1 -1
- package/dist/src/symbols/ts-module-scope.d.ts +1 -0
- package/dist/src/symbols/ts-module-scope.d.ts.map +1 -1
- package/dist/src/symbols/ts-module-scope.js +14 -3
- package/dist/src/symbols/ts-module-scope.js.map +1 -1
- package/dist/src/symbols/ts-output-symbol.d.ts +1 -0
- package/dist/src/symbols/ts-output-symbol.d.ts.map +1 -1
- package/dist/src/symbols/ts-output-symbol.js +20 -3
- package/dist/src/symbols/ts-output-symbol.js.map +1 -1
- package/dist/src/symbols/ts-package-scope.d.ts +1 -0
- package/dist/src/symbols/ts-package-scope.d.ts.map +1 -1
- package/dist/src/symbols/ts-package-scope.js +8 -0
- package/dist/src/symbols/ts-package-scope.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -5
- package/src/components/FunctionType.tsx +1 -1
- package/src/components/IfStatement.tsx +3 -3
- package/src/components/Interface.tsx +24 -13
- package/src/components/MemberScope.tsx +13 -3
- package/src/components/PackageDirectory.tsx +2 -1
- package/src/components/SourceFile.tsx +4 -1
- package/src/components/TryStatement.test.tsx +123 -0
- package/src/components/TryStatement.tsx +141 -0
- package/src/components/TypeDeclaration.tsx +15 -15
- package/src/components/TypeRefContext.tsx +2 -2
- package/src/components/index.ts +1 -0
- package/src/context/type-ref-context.tsx +6 -2
- package/src/create-package.ts +29 -15
- package/src/symbols/index.ts +36 -10
- package/src/symbols/ts-module-scope.ts +36 -9
- package/src/symbols/ts-output-symbol.ts +21 -2
- package/src/symbols/ts-package-scope.ts +9 -0
- package/temp/api.json +471 -63
package/src/symbols/index.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createComponent,
|
|
3
|
+
createScope,
|
|
4
|
+
createSymbol,
|
|
3
5
|
Namekey,
|
|
4
6
|
onCleanup,
|
|
5
7
|
OutputScopeOptions,
|
|
@@ -25,7 +27,8 @@ export function createTypeAndValueSymbol(
|
|
|
25
27
|
) {
|
|
26
28
|
const scope = useLexicalScope();
|
|
27
29
|
const spaces = scope ? [scope.types, scope.values] : [];
|
|
28
|
-
|
|
30
|
+
const binder = options.binder ?? scope?.binder;
|
|
31
|
+
return createSymbol(TSOutputSymbol, name, spaces, { ...options, binder });
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
export function createTypeSymbol(
|
|
@@ -39,7 +42,8 @@ export function createTypeSymbol(
|
|
|
39
42
|
);
|
|
40
43
|
}
|
|
41
44
|
const spaces = scope ? [scope.types] : [];
|
|
42
|
-
|
|
45
|
+
const binder = options.binder ?? scope?.binder;
|
|
46
|
+
return createSymbol(TSOutputSymbol, name, spaces, { ...options, binder });
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
export function createValueSymbol(
|
|
@@ -53,11 +57,12 @@ export function createValueSymbol(
|
|
|
53
57
|
);
|
|
54
58
|
}
|
|
55
59
|
const spaces = scope ? [scope.values] : [];
|
|
56
|
-
|
|
60
|
+
const binder = options.binder ?? scope?.binder;
|
|
61
|
+
return createSymbol(TSOutputSymbol, name, spaces, { ...options, binder });
|
|
57
62
|
}
|
|
58
63
|
|
|
59
64
|
export function createTransientValueSymbol() {
|
|
60
|
-
return
|
|
65
|
+
return createSymbol(TSOutputSymbol, "transient-value", undefined, {
|
|
61
66
|
transient: true,
|
|
62
67
|
});
|
|
63
68
|
}
|
|
@@ -67,7 +72,11 @@ export function createStaticMemberSymbol(
|
|
|
67
72
|
options: CreateTsSymbolOptions = {},
|
|
68
73
|
) {
|
|
69
74
|
const owner = useMemberOwner();
|
|
70
|
-
|
|
75
|
+
const binder = options.binder ?? owner.binder;
|
|
76
|
+
return createSymbol(TSOutputSymbol, name, owner.staticMembers, {
|
|
77
|
+
...options,
|
|
78
|
+
binder,
|
|
79
|
+
});
|
|
71
80
|
}
|
|
72
81
|
|
|
73
82
|
export function createInstanceMemberSymbol(
|
|
@@ -75,7 +84,11 @@ export function createInstanceMemberSymbol(
|
|
|
75
84
|
options: CreateTsSymbolOptions = {},
|
|
76
85
|
) {
|
|
77
86
|
const owner = useMemberOwner();
|
|
78
|
-
|
|
87
|
+
const binder = options.binder ?? owner.binder;
|
|
88
|
+
return createSymbol(TSOutputSymbol, name, owner.instanceMembers, {
|
|
89
|
+
...options,
|
|
90
|
+
binder,
|
|
91
|
+
});
|
|
79
92
|
}
|
|
80
93
|
|
|
81
94
|
export function createPrivateStaticMemberSymbol(
|
|
@@ -83,7 +96,11 @@ export function createPrivateStaticMemberSymbol(
|
|
|
83
96
|
options: CreateTsSymbolOptions = {},
|
|
84
97
|
) {
|
|
85
98
|
const owner = useMemberOwner();
|
|
86
|
-
|
|
99
|
+
const binder = options.binder ?? owner.binder;
|
|
100
|
+
return createSymbol(TSOutputSymbol, name, owner.privateStaticMembers, {
|
|
101
|
+
...options,
|
|
102
|
+
binder,
|
|
103
|
+
});
|
|
87
104
|
}
|
|
88
105
|
|
|
89
106
|
export function createPrivateInstanceMemberSymbol(
|
|
@@ -91,7 +108,11 @@ export function createPrivateInstanceMemberSymbol(
|
|
|
91
108
|
options: CreateTsSymbolOptions = {},
|
|
92
109
|
) {
|
|
93
110
|
const owner = useMemberOwner();
|
|
94
|
-
|
|
111
|
+
const binder = options.binder ?? owner.binder;
|
|
112
|
+
return createSymbol(TSOutputSymbol, name, owner.privateInstanceMembers, {
|
|
113
|
+
...options,
|
|
114
|
+
binder,
|
|
115
|
+
});
|
|
95
116
|
}
|
|
96
117
|
|
|
97
118
|
export function createMemberSymbol(
|
|
@@ -120,7 +141,8 @@ export function createLexicalScope(
|
|
|
120
141
|
) {
|
|
121
142
|
const parent = useTSScope();
|
|
122
143
|
|
|
123
|
-
|
|
144
|
+
const binder = options.binder ?? parent?.binder;
|
|
145
|
+
return createScope(TSLexicalScope, name, parent, { ...options, binder });
|
|
124
146
|
}
|
|
125
147
|
|
|
126
148
|
export function createMemberScope(
|
|
@@ -129,7 +151,11 @@ export function createMemberScope(
|
|
|
129
151
|
options: OutputScopeOptions = {},
|
|
130
152
|
) {
|
|
131
153
|
const parent = useTSScope();
|
|
132
|
-
|
|
154
|
+
const binder = options.binder ?? parent?.binder ?? ownerSymbol.binder;
|
|
155
|
+
return createScope(TSMemberScope, name, parent, ownerSymbol, {
|
|
156
|
+
...options,
|
|
157
|
+
binder,
|
|
158
|
+
});
|
|
133
159
|
}
|
|
134
160
|
|
|
135
161
|
export function decl(namekey: Namekey, options?: CreateTsSymbolOptions) {
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createSymbol,
|
|
3
|
+
reactive,
|
|
4
|
+
Refkey,
|
|
5
|
+
shallowReactive,
|
|
6
|
+
} from "@alloy-js/core";
|
|
2
7
|
import { TSLexicalScope } from "./ts-lexical-scope.js";
|
|
3
8
|
import { TSOutputSymbol, TSSymbolFlags } from "./ts-output-symbol.js";
|
|
4
9
|
|
|
@@ -52,18 +57,31 @@ export class TSModuleScope extends TSLexicalScope {
|
|
|
52
57
|
this.importedModules.set(targetModule, new Set());
|
|
53
58
|
}
|
|
54
59
|
|
|
60
|
+
const binder = this.binder;
|
|
55
61
|
let localSymbol;
|
|
56
62
|
|
|
57
63
|
if (options?.type) {
|
|
58
|
-
localSymbol =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
localSymbol = createSymbol(
|
|
65
|
+
TSOutputSymbol,
|
|
66
|
+
targetSymbol.name,
|
|
67
|
+
this.types,
|
|
68
|
+
{
|
|
69
|
+
binder,
|
|
70
|
+
aliasTarget: targetSymbol,
|
|
71
|
+
tsFlags: TSSymbolFlags.LocalImportSymbol,
|
|
72
|
+
},
|
|
73
|
+
);
|
|
62
74
|
} else {
|
|
63
|
-
localSymbol =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
75
|
+
localSymbol = createSymbol(
|
|
76
|
+
TSOutputSymbol,
|
|
77
|
+
targetSymbol.name,
|
|
78
|
+
this.values,
|
|
79
|
+
{
|
|
80
|
+
binder,
|
|
81
|
+
aliasTarget: targetSymbol,
|
|
82
|
+
tsFlags: TSSymbolFlags.LocalImportSymbol,
|
|
83
|
+
},
|
|
84
|
+
);
|
|
67
85
|
}
|
|
68
86
|
|
|
69
87
|
this.importedSymbols.set(targetSymbol, localSymbol);
|
|
@@ -85,4 +103,13 @@ export class TSModuleScope extends TSLexicalScope {
|
|
|
85
103
|
}
|
|
86
104
|
return allSymbols;
|
|
87
105
|
}
|
|
106
|
+
|
|
107
|
+
override get debugInfo(): Record<string, unknown> {
|
|
108
|
+
return {
|
|
109
|
+
...super.debugInfo,
|
|
110
|
+
exportedSymbolCount: this.#exportedSymbols.size,
|
|
111
|
+
importedSymbolCount: this.#importedSymbols.size,
|
|
112
|
+
importedModuleCount: this.#importedModules.size,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
88
115
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
createSymbol,
|
|
2
3
|
Namekey,
|
|
3
4
|
OutputSpace,
|
|
4
5
|
OutputSymbol,
|
|
@@ -68,8 +69,9 @@ export class TSOutputSymbol extends OutputSymbol {
|
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
copy() {
|
|
71
|
-
const
|
|
72
|
-
|
|
72
|
+
const binder = this.binder;
|
|
73
|
+
const copy = createSymbol(TSOutputSymbol, this.name, undefined, {
|
|
74
|
+
binder,
|
|
73
75
|
aliasTarget: this.aliasTarget,
|
|
74
76
|
default: this.default,
|
|
75
77
|
export: this.export,
|
|
@@ -199,4 +201,21 @@ export class TSOutputSymbol extends OutputSymbol {
|
|
|
199
201
|
get isValueSymbol() {
|
|
200
202
|
return this.spaces.some((s) => s.key === "values");
|
|
201
203
|
}
|
|
204
|
+
|
|
205
|
+
override get debugInfo(): Record<string, unknown> {
|
|
206
|
+
const info = super.debugInfo;
|
|
207
|
+
return {
|
|
208
|
+
...info,
|
|
209
|
+
export: this.export,
|
|
210
|
+
default: this.default,
|
|
211
|
+
tsFlags: this.tsFlags,
|
|
212
|
+
hasInstanceMembers: this.hasInstanceMembers,
|
|
213
|
+
isTypeSymbol: this.isTypeSymbol,
|
|
214
|
+
isValueSymbol: this.isValueSymbol,
|
|
215
|
+
isPrivateMemberSymbol: this.isPrivateMemberSymbol,
|
|
216
|
+
isInstanceMemberSymbol: this.isInstanceMemberSymbol,
|
|
217
|
+
isStaticMemberSymbol: this.isStaticMemberSymbol,
|
|
218
|
+
isPublicMemberSymbol: this.isPublicMemberSymbol,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
202
221
|
}
|
|
@@ -99,4 +99,13 @@ export class TSPackageScope extends OutputScope {
|
|
|
99
99
|
copyTo(): TSPackageScope {
|
|
100
100
|
throw new Error("Not supported");
|
|
101
101
|
}
|
|
102
|
+
|
|
103
|
+
override get debugInfo(): Record<string, unknown> {
|
|
104
|
+
return {
|
|
105
|
+
...super.debugInfo,
|
|
106
|
+
version: this.version,
|
|
107
|
+
path: this.path,
|
|
108
|
+
builtin: this.builtin,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
102
111
|
}
|