@alloy-js/typescript 0.23.0-dev.2 → 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.
Files changed (61) hide show
  1. package/dist/src/components/FunctionType.d.ts +1 -1
  2. package/dist/src/components/FunctionType.js +1 -1
  3. package/dist/src/components/FunctionType.js.map +1 -1
  4. package/dist/src/components/Interface.d.ts +1 -1
  5. package/dist/src/components/Interface.d.ts.map +1 -1
  6. package/dist/src/components/Interface.js +14 -9
  7. package/dist/src/components/Interface.js.map +1 -1
  8. package/dist/src/components/MemberScope.d.ts.map +1 -1
  9. package/dist/src/components/MemberScope.js +6 -2
  10. package/dist/src/components/MemberScope.js.map +1 -1
  11. package/dist/src/components/PackageDirectory.d.ts.map +1 -1
  12. package/dist/src/components/PackageDirectory.js +2 -2
  13. package/dist/src/components/PackageDirectory.js.map +1 -1
  14. package/dist/src/components/SourceFile.d.ts.map +1 -1
  15. package/dist/src/components/SourceFile.js +4 -2
  16. package/dist/src/components/SourceFile.js.map +1 -1
  17. package/dist/src/components/TypeDeclaration.d.ts +1 -1
  18. package/dist/src/components/TypeDeclaration.d.ts.map +1 -1
  19. package/dist/src/components/TypeDeclaration.js +1 -1
  20. package/dist/src/components/TypeDeclaration.js.map +1 -1
  21. package/dist/src/components/TypeRefContext.d.ts +1 -1
  22. package/dist/src/components/TypeRefContext.d.ts.map +1 -1
  23. package/dist/src/components/TypeRefContext.js +1 -1
  24. package/dist/src/components/TypeRefContext.js.map +1 -1
  25. package/dist/src/context/type-ref-context.d.ts.map +1 -1
  26. package/dist/src/context/type-ref-context.js +2 -2
  27. package/dist/src/context/type-ref-context.js.map +1 -1
  28. package/dist/src/create-package.d.ts.map +1 -1
  29. package/dist/src/create-package.js +7 -6
  30. package/dist/src/create-package.js.map +1 -1
  31. package/dist/src/symbols/index.d.ts.map +1 -1
  32. package/dist/src/symbols/index.js +47 -11
  33. package/dist/src/symbols/index.js.map +1 -1
  34. package/dist/src/symbols/ts-module-scope.d.ts +1 -0
  35. package/dist/src/symbols/ts-module-scope.d.ts.map +1 -1
  36. package/dist/src/symbols/ts-module-scope.js +14 -3
  37. package/dist/src/symbols/ts-module-scope.js.map +1 -1
  38. package/dist/src/symbols/ts-output-symbol.d.ts +1 -0
  39. package/dist/src/symbols/ts-output-symbol.d.ts.map +1 -1
  40. package/dist/src/symbols/ts-output-symbol.js +20 -3
  41. package/dist/src/symbols/ts-output-symbol.js.map +1 -1
  42. package/dist/src/symbols/ts-package-scope.d.ts +1 -0
  43. package/dist/src/symbols/ts-package-scope.d.ts.map +1 -1
  44. package/dist/src/symbols/ts-package-scope.js +8 -0
  45. package/dist/src/symbols/ts-package-scope.js.map +1 -1
  46. package/dist/tsconfig.tsbuildinfo +1 -1
  47. package/package.json +9 -5
  48. package/src/components/FunctionType.tsx +1 -1
  49. package/src/components/Interface.tsx +24 -13
  50. package/src/components/MemberScope.tsx +13 -3
  51. package/src/components/PackageDirectory.tsx +2 -1
  52. package/src/components/SourceFile.tsx +4 -1
  53. package/src/components/TypeDeclaration.tsx +15 -15
  54. package/src/components/TypeRefContext.tsx +2 -2
  55. package/src/context/type-ref-context.tsx +6 -2
  56. package/src/create-package.ts +29 -15
  57. package/src/symbols/index.ts +36 -10
  58. package/src/symbols/ts-module-scope.ts +36 -9
  59. package/src/symbols/ts-output-symbol.ts +21 -2
  60. package/src/symbols/ts-package-scope.ts +9 -0
  61. package/temp/api.json +160 -63
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@alloy-js/typescript",
3
- "version": "0.23.0-dev.2",
3
+ "version": "0.23.0-dev.4",
4
4
  "description": "",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/alloy-framework/alloy.git"
8
+ },
5
9
  "exports": {
6
10
  ".": {
7
11
  "import": "./dist/src/index.js"
@@ -22,18 +26,18 @@
22
26
  "author": "brian.terlson@microsoft.com",
23
27
  "license": "MIT",
24
28
  "dependencies": {
25
- "@alloy-js/core": "~0.22.0 || >= 0.23.0-dev.0",
29
+ "@alloy-js/core": "~0.22.0 || >= 0.23.0-dev.8",
26
30
  "change-case": "^5.4.4",
27
31
  "pathe": "^2.0.3"
28
32
  },
29
33
  "devDependencies": {
30
- "@alloy-js/cli": "~0.22.0 || >= 0.23.0-dev.0",
31
- "@alloy-js/rollup-plugin": "~0.1.0 || >= 0.1.1-dev.0",
34
+ "@alloy-js/cli": "~0.22.0 || >= 0.23.0-dev.3",
35
+ "@alloy-js/rollup-plugin": "~0.1.0 || >= 0.1.1-dev.1",
32
36
  "@microsoft/api-extractor": "~7.52.8",
33
37
  "@rollup/plugin-typescript": "^12.1.2",
34
38
  "concurrently": "^9.2.0",
35
39
  "typescript": "^5.8.3",
36
- "vitest": "^3.2.4"
40
+ "vitest": "3.2.4"
37
41
  },
38
42
  "type": "module",
39
43
  "scripts": {
@@ -31,7 +31,7 @@ export interface FunctionTypeProps extends CallSignatureProps {
31
31
  }
32
32
 
33
33
  const FunctionTypeComponent = ensureTypeRefContext(
34
- (props: FunctionTypeProps) => {
34
+ function FunctionTypeComponent(props: FunctionTypeProps) {
35
35
  const children = childrenArray(() => props.children);
36
36
  const typeParametersChildren =
37
37
  findKeyedChild(children, TypeParameters.tag) ?? undefined;
@@ -2,6 +2,7 @@ import {
2
2
  Block,
3
3
  Children,
4
4
  childrenArray,
5
+ createSymbol,
5
6
  createSymbolSlot,
6
7
  effect,
7
8
  emitSymbol,
@@ -35,7 +36,7 @@ export interface InterfaceDeclarationProps extends CommonDeclarationProps {
35
36
  }
36
37
 
37
38
  const _InterfaceDeclaration = ensureTypeRefContext(
38
- (props: InterfaceDeclarationProps) => {
39
+ function InterfaceDeclaration(props: InterfaceDeclarationProps) {
39
40
  const ExprSlot = createSymbolSlot();
40
41
 
41
42
  effect(() => {
@@ -68,13 +69,15 @@ const _InterfaceDeclaration = ensureTypeRefContext(
68
69
  const filteredChildren = findUnkeyedChildren(children);
69
70
  const currentScope = useTSLexicalScope();
70
71
 
71
- const sym = new TSOutputSymbol(props.name, currentScope.types, {
72
+ const binder = currentScope?.binder;
73
+ const sym = createSymbol(TSOutputSymbol, props.name, currentScope.types, {
72
74
  refkeys: props.refkey,
73
75
  default: props.default,
74
76
  export: props.export,
75
77
  metadata: props.metadata,
76
78
  tsFlags: TSSymbolFlags.TypeSymbol,
77
79
  namePolicy: useTSNamePolicy().for("interface"),
80
+ binder,
78
81
  });
79
82
  return (
80
83
  <>
@@ -115,9 +118,11 @@ export interface InterfaceExpressionProps {
115
118
  }
116
119
 
117
120
  export const InterfaceExpression = ensureTypeRefContext(
118
- (props: InterfaceExpressionProps) => {
119
- const symbol = new TSOutputSymbol("", undefined, {
121
+ function InterfaceExpression(props: InterfaceExpressionProps) {
122
+ const scope = useTSLexicalScope();
123
+ const symbol = createSymbol(TSOutputSymbol, "", undefined, {
120
124
  transient: true,
125
+ binder: scope?.binder,
121
126
  });
122
127
 
123
128
  emitSymbol(symbol);
@@ -180,15 +185,21 @@ export function InterfaceMember(props: InterfaceMemberProps) {
180
185
 
181
186
  const optionality = props.optional ? "?" : "";
182
187
  const scope = useTSMemberScope();
183
- const sym = new TSOutputSymbol(props.name, scope.ownerSymbol.staticMembers, {
184
- refkeys: props.refkey,
185
- tsFlags:
186
- TSSymbolFlags.TypeSymbol |
187
- ((props.nullish ?? props.optional) ?
188
- TSSymbolFlags.Nullish
189
- : TSSymbolFlags.None),
190
- namePolicy: useTSNamePolicy().for("interface-member"),
191
- });
188
+ const sym = createSymbol(
189
+ TSOutputSymbol,
190
+ props.name,
191
+ scope.ownerSymbol.staticMembers,
192
+ {
193
+ refkeys: props.refkey,
194
+ tsFlags:
195
+ TSSymbolFlags.TypeSymbol |
196
+ ((props.nullish ?? props.optional) ?
197
+ TSSymbolFlags.Nullish
198
+ : TSSymbolFlags.None),
199
+ namePolicy: useTSNamePolicy().for("interface-member"),
200
+ binder: scope.binder,
201
+ },
202
+ );
192
203
 
193
204
  const taken = takeSymbols();
194
205
 
@@ -1,4 +1,8 @@
1
- import { Children, MemberScope as CoreMemberScope } from "@alloy-js/core";
1
+ import {
2
+ Children,
3
+ MemberScope as CoreMemberScope,
4
+ createScope,
5
+ } from "@alloy-js/core";
2
6
  import { useTSLexicalScopeIfPresent } from "../symbols/scopes.js";
3
7
  import { TSMemberScope } from "../symbols/ts-member-scope.js";
4
8
  import { TSOutputSymbol } from "../symbols/ts-output-symbol.js";
@@ -17,10 +21,16 @@ export interface MemberScopeProps {
17
21
  * in this scope, which will be added to the owner symbol's members.
18
22
  */
19
23
  export function MemberScope(props: MemberScopeProps) {
20
- const memberScope = new TSMemberScope(
24
+ const parentScope = useTSLexicalScopeIfPresent();
25
+ const binder = props.ownerSymbol.binder ?? parentScope?.binder;
26
+ const memberScope = createScope(
27
+ TSMemberScope,
21
28
  "member-scope",
22
- useTSLexicalScopeIfPresent(),
29
+ parentScope,
23
30
  props.ownerSymbol,
31
+ {
32
+ binder,
33
+ },
24
34
  );
25
35
 
26
36
  return (
@@ -2,6 +2,7 @@ import {
2
2
  Children,
3
3
  ComponentContext,
4
4
  createNamedContext,
5
+ createScope,
5
6
  Ref,
6
7
  Scope,
7
8
  shallowRef,
@@ -122,7 +123,7 @@ function createPackageContext(
122
123
  // todo: this can probably just use context.
123
124
  const fullPath = parentDir ? join(parentDir.path, path) : path;
124
125
 
125
- const scope = new TSPackageScope(name, version, fullPath);
126
+ const scope = createScope(TSPackageScope, name, version, fullPath);
126
127
 
127
128
  return {
128
129
  scope,
@@ -2,6 +2,7 @@ import {
2
2
  ComponentContext,
3
3
  SourceFile as CoreSourceFile,
4
4
  createNamedContext,
5
+ createScope,
5
6
  Scope,
6
7
  Show,
7
8
  SourceDirectoryContext,
@@ -41,7 +42,9 @@ export function SourceFile(props: SourceFileProps) {
41
42
  const currentDir = directoryContext.path;
42
43
  const path: string = join(currentDir, props.path);
43
44
  const parent = useScope();
44
- const scope = new TSModuleScope(path, parent);
45
+ const scope = createScope(TSModuleScope, path, parent, {
46
+ binder: parent?.binder,
47
+ });
45
48
  sdData.modules.add(scope);
46
49
  const pkg = useContext(PackageContext);
47
50
  if (pkg) {
@@ -5,18 +5,18 @@ import { ensureTypeRefContext } from "./TypeRefContext.jsx";
5
5
 
6
6
  export interface TypeDeclarationProps extends CommonDeclarationProps {}
7
7
 
8
- export const TypeDeclaration = ensureTypeRefContext(
9
- (props: TypeDeclarationProps) => {
10
- return (
11
- <>
12
- <Show when={Boolean(props.doc)}>
13
- <JSDoc children={props.doc} />
14
- <hbr />
15
- </Show>
16
- <Declaration {...props} kind="type" nameKind="type">
17
- type <Name /> = {props.children};
18
- </Declaration>
19
- </>
20
- );
21
- },
22
- );
8
+ export const TypeDeclaration = ensureTypeRefContext(function TypeDeclaration(
9
+ props: TypeDeclarationProps,
10
+ ) {
11
+ return (
12
+ <>
13
+ <Show when={Boolean(props.doc)}>
14
+ <JSDoc children={props.doc} />
15
+ <hbr />
16
+ </Show>
17
+ <Declaration {...props} kind="type" nameKind="type">
18
+ type <Name /> = {props.children};
19
+ </Declaration>
20
+ </>
21
+ );
22
+ });
@@ -33,8 +33,8 @@ export const TypeRefContext = ({ children }: TypeRefContextProps) => {
33
33
  */
34
34
  export function ensureTypeRefContext<TProps>(
35
35
  Comp: Component<TProps>,
36
- ): (props: TProps) => Children {
37
- return (props: TProps) => {
36
+ ): Component<TProps> {
37
+ return function EnsureTypeRefContext(props: TProps) {
38
38
  const ref = isTypeRefContext();
39
39
  if (!ref) {
40
40
  return (
@@ -1,4 +1,8 @@
1
- import { ComponentContext, createContext, useContext } from "@alloy-js/core";
1
+ import {
2
+ ComponentContext,
3
+ createNamedContext,
4
+ useContext,
5
+ } from "@alloy-js/core";
2
6
 
3
7
  interface TypeRefContext {
4
8
  /** If in a type context */
@@ -9,7 +13,7 @@ interface TypeRefContext {
9
13
  * Provides scopes for instance and static private members.
10
14
  */
11
15
  export const TypeRefContext: ComponentContext<TypeRefContext> =
12
- createContext<TypeRefContext>();
16
+ createNamedContext<TypeRefContext>("@alloy-js/typescript TypeRef");
13
17
 
14
18
  /**
15
19
  * @returns 'true' if in a type context, 'false' if in a value context.
@@ -1,5 +1,7 @@
1
1
  import {
2
2
  type Binder,
3
+ createScope,
4
+ createSymbol,
3
5
  getSymbolCreatorSymbol,
4
6
  OutputMemberSpace,
5
7
  type Refkey,
@@ -136,7 +138,7 @@ function assignMembers(
136
138
  const memberKey = keys[namespace][memberObj.name];
137
139
  if (!memberKey) continue; // Skip if key doesn't exist
138
140
 
139
- const memberSym = new TSOutputSymbol(memberObj.name, space, {
141
+ const memberSym = createSymbol(TSOutputSymbol, memberObj.name, space, {
140
142
  binder,
141
143
  refkeys: memberKey,
142
144
  export: false,
@@ -179,7 +181,8 @@ function createSymbols(
179
181
  props: CreatePackageProps<PackageDescriptor>,
180
182
  refkeys: Record<string | typeof packageScopeSymbol, any>,
181
183
  ) {
182
- const pkgScope = new TSPackageScope(
184
+ const pkgScope = createScope(
185
+ TSPackageScope,
183
186
  props.name,
184
187
  props.version,
185
188
  `node_modules/${props.name}`,
@@ -193,7 +196,7 @@ function createSymbols(
193
196
 
194
197
  for (const [path, symbols] of Object.entries(props.descriptor)) {
195
198
  const keys = path === "." ? refkeys : refkeys[path];
196
- const moduleScope = new TSModuleScope(path, pkgScope, {
199
+ const moduleScope = createScope(TSModuleScope, path, pkgScope, {
197
200
  binder,
198
201
  });
199
202
 
@@ -201,11 +204,17 @@ function createSymbols(
201
204
 
202
205
  if (symbols.default) {
203
206
  const key = keys.default;
204
- const sym = new TSOutputSymbol(symbols.default, moduleScope.values, {
205
- refkeys: key,
206
- export: true,
207
- default: true,
208
- });
207
+ const sym = createSymbol(
208
+ TSOutputSymbol,
209
+ symbols.default,
210
+ moduleScope.values,
211
+ {
212
+ binder,
213
+ refkeys: key,
214
+ export: true,
215
+ default: true,
216
+ },
217
+ );
209
218
  moduleScope.exportedSymbols.set(key, sym);
210
219
  }
211
220
 
@@ -215,13 +224,18 @@ function createSymbols(
215
224
  { name: exportedName }
216
225
  : exportedName;
217
226
  const key = keys[namedRef.name];
218
- const ownerSym = new TSOutputSymbol(namedRef.name, moduleScope.values, {
219
- binder,
220
- refkeys: key,
221
- export: true,
222
- default: false,
223
- hasInstanceMembers: !!namedRef.instanceMembers?.length,
224
- });
227
+ const ownerSym = createSymbol(
228
+ TSOutputSymbol,
229
+ namedRef.name,
230
+ moduleScope.values,
231
+ {
232
+ binder,
233
+ refkeys: key,
234
+ export: true,
235
+ default: false,
236
+ hasInstanceMembers: !!namedRef.instanceMembers?.length,
237
+ },
238
+ );
225
239
  moduleScope.exportedSymbols.set(key, ownerSym);
226
240
 
227
241
  assignMembers(
@@ -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
- return new TSOutputSymbol(name, spaces, options);
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
- return new TSOutputSymbol(name, spaces, options);
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
- return new TSOutputSymbol(name, spaces, options);
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 new TSOutputSymbol("transient-value", undefined, {
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
- return new TSOutputSymbol(name, owner.staticMembers, options);
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
- return new TSOutputSymbol(name, owner.instanceMembers, options);
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
- return new TSOutputSymbol(name, owner.privateStaticMembers, options);
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
- return new TSOutputSymbol(name, owner.privateInstanceMembers, options);
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
- return new TSLexicalScope(name, parent, options);
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
- return new TSMemberScope(name, parent, ownerSymbol, options);
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 { reactive, Refkey, shallowReactive } from "@alloy-js/core";
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 = new TSOutputSymbol(targetSymbol.name, this.types, {
59
- aliasTarget: targetSymbol,
60
- tsFlags: TSSymbolFlags.LocalImportSymbol,
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 = new TSOutputSymbol(targetSymbol.name, this.values, {
64
- aliasTarget: targetSymbol,
65
- tsFlags: TSSymbolFlags.LocalImportSymbol,
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 copy = new TSOutputSymbol(this.name, undefined, {
72
- binder: this.binder,
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
  }