@travetto/transformer 7.0.2 → 7.0.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/README.md CHANGED
@@ -27,9 +27,9 @@ Below is an example of a transformer that upper cases all `class`, `method` and
27
27
 
28
28
  **Code: Sample Transformer - Upper case all declarations**
29
29
  ```typescript
30
- import ts from 'typescript';
30
+ import type ts from 'typescript';
31
31
 
32
- import { OnProperty, TransformerState, OnMethod, OnClass } from '@travetto/transformer';
32
+ import { TransformerHandler, type TransformerState } from '@travetto/transformer';
33
33
 
34
34
  export class MakeUpper {
35
35
 
@@ -37,7 +37,12 @@ export class MakeUpper {
37
37
  return state.importName !== '@travetto/transformer/doc/upper.ts';
38
38
  }
39
39
 
40
- @OnProperty()
40
+ static {
41
+ TransformerHandler(this, this.handleClass, 'before', 'class');
42
+ TransformerHandler(this, this.handleMethod, 'before', 'method');
43
+ TransformerHandler(this, this.handleProperty, 'before', 'property');
44
+ }
45
+
41
46
  static handleProperty(state: TransformerState, node: ts.PropertyDeclaration): ts.PropertyDeclaration {
42
47
  return !this.isValid(state) ? node : state.factory.updatePropertyDeclaration(
43
48
  node,
@@ -49,7 +54,6 @@ export class MakeUpper {
49
54
  );
50
55
  }
51
56
 
52
- @OnClass()
53
57
  static handleClass(state: TransformerState, node: ts.ClassDeclaration): ts.ClassDeclaration {
54
58
  return !this.isValid(state) ? node : state.factory.updateClassDeclaration(
55
59
  node,
@@ -61,7 +65,6 @@ export class MakeUpper {
61
65
  );
62
66
  }
63
67
 
64
- @OnMethod()
65
68
  static handleMethod(state: TransformerState, node: ts.MethodDeclaration): ts.MethodDeclaration {
66
69
  return !this.isValid(state) ? node : state.factory.updateMethodDeclaration(
67
70
  node,
@@ -96,9 +99,9 @@ export class Test {
96
99
  **Code: Sample Output**
97
100
  ```javascript
98
101
  import * as Δfunction from "@travetto/runtime/src/function.js";
99
- var mod_1 = ["@travetto/transformer", "doc/upper.ts"];
102
+ var Δm_1 = ["@travetto/transformer", "doc/upper.ts"];
100
103
  export class TEST {
101
- static { Δfunction.registerFunction(TEST, mod_1, { hash: 649563175, lines: [1, 9] }, { COMPUTEAGE: { hash: 1286718349, lines: [6, 8, 7] } }, false); }
104
+ static { Δfunction.registerFunction(TEST, Δm_1, { hash: 649563175, lines: [1, 9] }, { COMPUTEAGE: { hash: 1286718349, lines: [6, 8, 7] } }, false); }
102
105
  NAME;
103
106
  AGE;
104
107
  DOB;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/transformer",
3
- "version": "7.0.2",
3
+ "version": "7.0.4",
4
4
  "type": "module",
5
5
  "description": "Functionality for AST transformations, with transformer registration, and general utils",
6
6
  "keywords": [
@@ -25,7 +25,7 @@
25
25
  "directory": "module/transformer"
26
26
  },
27
27
  "dependencies": {
28
- "@travetto/manifest": "^7.0.1",
28
+ "@travetto/manifest": "^7.0.3",
29
29
  "tslib": "^2.8.1",
30
30
  "typescript": "^5.9.3"
31
31
  },
package/src/importer.ts CHANGED
@@ -2,10 +2,10 @@ import ts from 'typescript';
2
2
 
3
3
  import { ManifestModuleUtil, PackageUtil, path } from '@travetto/manifest';
4
4
 
5
- import { AnyType, TransformResolver, ManagedType, MappedType } from './resolver/types.ts';
5
+ import type { AnyType, TransformResolver, ManagedType, MappedType } from './resolver/types.ts';
6
6
  import { ImportUtil } from './util/import.ts';
7
7
  import { CoreUtil } from './util/core.ts';
8
- import { Import } from './types/shared.ts';
8
+ import type { Import } from './types/shared.ts';
9
9
  import { LiteralUtil } from './util/literal.ts';
10
10
  import { DeclarationUtil } from './util/declaration.ts';
11
11
 
package/src/manager.ts CHANGED
@@ -1,8 +1,8 @@
1
- import ts from 'typescript';
1
+ import type ts from 'typescript';
2
2
 
3
- import { ManifestIndex, ManifestModuleUtil } from '@travetto/manifest';
3
+ import type { ManifestIndex } from '@travetto/manifest';
4
4
 
5
- import { NodeTransformer } from './types/visitor.ts';
5
+ import type { NodeTransformer } from './types/visitor.ts';
6
6
  import { VisitorFactory } from './visitor.ts';
7
7
  import { TransformerState } from './state.ts';
8
8
  import { getAllTransformers } from './register.ts';
@@ -25,7 +25,7 @@ export class TransformerManager {
25
25
 
26
26
  for (const file of transformerFiles) { // Exclude based on blacklist
27
27
  const entry = manifestIndex.getEntry(file)!;
28
- transformers.push(...getAllTransformers(await import(ManifestModuleUtil.withOutputExtension(entry.import)), entry.module));
28
+ transformers.push(...getAllTransformers(await import(entry.import), entry.module));
29
29
  }
30
30
 
31
31
  for (const transformer of transformers) {
package/src/register.ts CHANGED
@@ -1,6 +1,4 @@
1
- import ts from 'typescript';
2
-
3
- import { DecoratorMeta, NodeTransformer, State, TransformPhase, TransformerType, Transformer, ModuleNameSymbol } from './types/visitor.ts';
1
+ import { type NodeTransformer, type TransformPhase, type TransformerType, type Transformer, ModuleNameSymbol } from './types/visitor.ts';
4
2
 
5
3
  const HandlersSymbol = Symbol();
6
4
 
@@ -30,240 +28,6 @@ export function getAllTransformers(inputs: Record<string, { [HandlersSymbol]?: N
30
28
  }
31
29
 
32
30
  // Store handlers in class
33
- function storeHandler(cls: TransformerWithHandlers, fn: Function, phase: TransformPhase, type: TransformerType, target?: string[]): void {
31
+ export function TransformerHandler(cls: TransformerWithHandlers, fn: Function, phase: TransformPhase, type: TransformerType, target?: string[]): void {
34
32
  (cls[HandlersSymbol] ??= []).push({ key: fn.name, [phase]: fn.bind(cls), type, target });
35
- }
36
-
37
- /**
38
- * Wraps entire file before transforming
39
- */
40
- export function OnFile(...target: string[]) {
41
- return <S extends State = State, R extends ts.Node = ts.Node>(
42
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.SourceFile) => R>
43
- ): void => storeHandler(instance, descriptor.value!, 'before', 'file', target);
44
- }
45
-
46
- /**
47
- * Wraps entire file after transforming
48
- */
49
- export function AfterFile(...target: string[]) {
50
- return <S extends State = State, R extends ts.Node = ts.Node>(
51
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.SourceFile) => R>
52
- ): void => storeHandler(instance, descriptor.value!, 'before', 'file', target);
53
- }
54
-
55
- /**
56
- * Listens for a `ts.CallExpression`, on descent
57
- */
58
- export function OnCall(...target: string[]) {
59
- return <S extends State = State, R extends ts.Node = ts.Node>(
60
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.CallExpression) => R>
61
- ): void => storeHandler(instance, descriptor.value!, 'before', 'call', target);
62
- }
63
-
64
- /**
65
- * Listens for a `ts.FunctionDeclaration`, on descent
66
- */
67
- export function OnFunction(...target: string[]) {
68
- return <S extends State = State, R extends ts.Node = ts.Node>(
69
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.FunctionDeclaration | ts.FunctionExpression) => R>
70
- ): void => storeHandler(instance, descriptor.value!, 'before', 'function', target);
71
- }
72
-
73
- /**
74
- * Listens for a `ts.ParameterDeclaration`, on descent
75
- */
76
- export function OnParameter(...target: string[]) {
77
- return <S extends State = State, R extends ts.Node = ts.Node>(
78
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.ParameterDeclaration, meta?: DecoratorMeta) => R>
79
- ): void => storeHandler(instance, descriptor.value!, 'before', 'parameter', target);
80
- }
81
-
82
- /**
83
- * Listens for a `ts.PropertyDeclaration`, on descent
84
- */
85
- export function OnProperty(...target: string[]) {
86
- return <S extends State = State, R extends ts.Node = ts.Node>(
87
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.PropertyDeclaration, meta?: DecoratorMeta) => R>
88
- ): void => storeHandler(instance, descriptor.value!, 'before', 'property', target);
89
- }
90
-
91
- /**
92
- * Listens for a `ts.GetAccessorDeclaration`, on descent
93
- */
94
- export function OnGetter(...target: string[]) {
95
- return <S extends State = State, R extends ts.Node = ts.Node>(
96
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.GetAccessorDeclaration, meta?: DecoratorMeta) => R>
97
- ): void => storeHandler(instance, descriptor.value!, 'before', 'getter', target);
98
- }
99
-
100
- /**
101
- * Listens for a `ts.SetAccessorDeclaration`, on descent
102
- */
103
- export function OnSetter(...target: string[]) {
104
- return <S extends State = State, R extends ts.Node = ts.Node>(
105
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.SetAccessorDeclaration, meta?: DecoratorMeta) => R>
106
- ): void => storeHandler(instance, descriptor.value!, 'before', 'setter', target);
107
- }
108
-
109
- /**
110
- * Listens for a `ts.MethodDeclaration`, on descent
111
- */
112
- export function OnMethod(...target: string[]) {
113
- return <S extends State = State, R extends ts.Node = ts.Node>(
114
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.MethodDeclaration, meta?: DecoratorMeta) => R>
115
- ): void => storeHandler(instance, descriptor.value!, 'before', 'method', target);
116
- }
117
-
118
- /**
119
- * Listens for a `ts.ConstructorDeclaration`, on descent
120
- */
121
- export function OnConstructor(...target: string[]) {
122
- return <S extends State = State, R extends ts.Node = ts.Node>(
123
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.ConstructorDeclaration, meta?: DecoratorMeta) => R>
124
- ): void => storeHandler(instance, descriptor.value!, 'before', 'constructor', target);
125
- }
126
-
127
- /**
128
- * Listens for a static `ts.MethodDeclaration`, on descent
129
- */
130
- export function OnStaticMethod(...target: string[]) {
131
- return <S extends State = State, R extends ts.Node = ts.Node>(
132
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.MethodDeclaration, meta?: DecoratorMeta) => R>
133
- ): void => storeHandler(instance, descriptor.value!, 'before', 'static-method', target);
134
- }
135
-
136
- /**
137
- * Listens for a `ts.ClassDeclaration`, on descent
138
- */
139
- export function OnClass(...target: string[]) {
140
- return <S extends State = State, R extends ts.Node = ts.Node>(
141
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.ClassDeclaration, meta?: DecoratorMeta) => R>
142
- ): void => storeHandler(instance, descriptor.value!, 'before', 'class', target);
143
- }
144
-
145
- /**
146
- * Listens for a `ts.TypeAliasDeclaration` on descent
147
- */
148
- export function OnTypeAlias(...target: string[]) {
149
- return <S extends State = State, R extends ts.Node = ts.Node>(
150
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.TypeAliasDeclaration) => R>
151
- ): void => storeHandler(instance, descriptor.value!, 'before', 'type', target);
152
- }
153
-
154
- /**
155
- * Listens for a `ts.InterfaceDeclaration` on descent
156
- */
157
- export function OnInterface(...target: string[]) {
158
- return <S extends State = State, R extends ts.Node = ts.Node>(
159
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.InterfaceDeclaration) => R>
160
- ): void => storeHandler(instance, descriptor.value!, 'before', 'interface', target);
161
- }
162
-
163
- /**
164
- * Listens for a `ts.CallExpression`, on ascent
165
- */
166
- export function AfterCall(...target: string[]) {
167
- return <S extends State = State, R extends ts.Node = ts.Node>(
168
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.CallExpression, meta?: DecoratorMeta) => R>
169
- ): void => storeHandler(instance, descriptor.value!, 'after', 'call', target);
170
- }
171
-
172
- /**
173
- * Listens for a `ts.FunctionDeclaration`, on descent
174
- */
175
- export function AfterFunction(...target: string[]) {
176
- return <S extends State = State, R extends ts.Node = ts.Node>(
177
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.FunctionDeclaration | ts.FunctionExpression) => R>
178
- ): void => storeHandler(instance, descriptor.value!, 'after', 'function', target);
179
- }
180
-
181
- /**
182
- * Listens for a `ts.ParameterDeclaration`, on ascent
183
- */
184
- export function AfterParameter(...target: string[]) {
185
- return <S extends State = State, R extends ts.Node = ts.Node>(
186
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.ParameterDeclaration, meta?: DecoratorMeta) => R>
187
- ): void => storeHandler(instance, descriptor.value!, 'after', 'parameter', target);
188
- }
189
-
190
- /**
191
- * Listens for a `ts.PropertyDeclaration`, on ascent
192
- */
193
- export function AfterProperty(...target: string[]) {
194
- return <S extends State = State, R extends ts.Node = ts.Node>(
195
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.PropertyDeclaration, meta?: DecoratorMeta) => R>
196
- ): void => storeHandler(instance, descriptor.value!, 'after', 'property', target);
197
- }
198
-
199
- /**
200
- * Listens for a `ts.GetAccessorDeclaration`, on ascent
201
- */
202
- export function AfterGetter(...target: string[]) {
203
- return <S extends State = State, R extends ts.Node = ts.Node>(
204
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.GetAccessorDeclaration, meta?: DecoratorMeta) => R>
205
- ): void => storeHandler(instance, descriptor.value!, 'after', 'getter', target);
206
- }
207
-
208
- /**
209
- * Listens for a `ts.SetAccessorDeclaration`, on ascent
210
- */
211
- export function AfterSetter(...target: string[]) {
212
- return <S extends State = State, R extends ts.Node = ts.Node>(
213
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.SetAccessorDeclaration, meta?: DecoratorMeta) => R>
214
- ): void => storeHandler(instance, descriptor.value!, 'after', 'setter', target);
215
- }
216
-
217
- /**
218
- * Listens for a `ts.MethodDeclaration`, on ascent
219
- */
220
- export function AfterMethod(...target: string[]) {
221
- return <S extends State = State, R extends ts.Node = ts.Node>(
222
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.MethodDeclaration, meta?: DecoratorMeta) => R>
223
- ): void => storeHandler(instance, descriptor.value!, 'after', 'method', target);
224
- }
225
-
226
- /**
227
- * Listens for a `ts.ConstructorDeclaration`, on ascent
228
- */
229
- export function AfterConstructor(...target: string[]) {
230
- return <S extends State = State, R extends ts.Node = ts.Node>(
231
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.ConstructorDeclaration, meta?: DecoratorMeta) => R>
232
- ): void => storeHandler(instance, descriptor.value!, 'after', 'constructor', target);
233
- }
234
-
235
- /**
236
- * Listens for a static `ts.MethodDeclaration`, on ascent
237
- */
238
- export function AfterStaticMethod(...target: string[]) {
239
- return <S extends State = State, R extends ts.Node = ts.Node>(
240
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.MethodDeclaration, meta?: DecoratorMeta) => R>
241
- ): void => storeHandler(instance, descriptor.value!, 'after', 'static-method', target);
242
- }
243
-
244
- /**
245
- * Listens for a `ts.ClassDeclaration`, on ascent
246
- */
247
- export function AfterClass(...target: string[]) {
248
- return <S extends State = State, R extends ts.Node = ts.Node>(
249
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.ClassDeclaration, meta?: DecoratorMeta) => R>
250
- ): void => storeHandler(instance, descriptor.value!, 'after', 'class', target);
251
- }
252
-
253
- /**
254
- * Listens for a `ts.TypeAliasDeclaration` on ascent
255
- */
256
- export function AfterTypeAlias(...target: string[]) {
257
- return <S extends State = State, R extends ts.Node = ts.Node>(
258
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.TypeAliasDeclaration) => R>
259
- ): void => storeHandler(instance, descriptor.value!, 'after', 'type', target);
260
- }
261
-
262
- /**
263
- * Listens for a `ts.InterfaceDeclaration` on ascent
264
- */
265
- export function AfterInterface(...target: string[]) {
266
- return <S extends State = State, R extends ts.Node = ts.Node>(
267
- instance: Transformer, __: unknown, descriptor: TypedPropertyDescriptor<(state: S, node: ts.InterfaceDeclaration) => R>
268
- ): void => storeHandler(instance, descriptor.value!, 'after', 'interface', target);
269
- }
33
+ }
@@ -7,9 +7,9 @@ import { DocUtil } from '../util/doc.ts';
7
7
  import { CoreUtil } from '../util/core.ts';
8
8
  import { DeclarationUtil } from '../util/declaration.ts';
9
9
  import { LiteralUtil } from '../util/literal.ts';
10
- import { transformCast, TemplateLiteralPart } from '../types/shared.ts';
10
+ import { transformCast, type TemplateLiteralPart } from '../types/shared.ts';
11
11
 
12
- import { Type, AnyType, CompositionType, TransformResolver, TemplateType, MappedType } from './types.ts';
12
+ import type { Type, AnyType, CompositionType, TransformResolver, TemplateType, MappedType } from './types.ts';
13
13
  import { CoerceUtil } from './coerce.ts';
14
14
 
15
15
  const UNDEFINED = Symbol();
@@ -1,4 +1,4 @@
1
- import ts from 'typescript';
1
+ import type ts from 'typescript';
2
2
  import type { AnyType } from './types.ts';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- const REGEX_PAT = /[\/](.*)[\/](i|g|m|s)?/;
1
+ const REGEX_PATTERN = /[\/](.*)[\/](i|g|m|s)?/;
2
2
 
3
3
  export class CoerceUtil {
4
4
  /**
@@ -18,9 +18,9 @@ export class CoerceUtil {
18
18
  static #toRegex(input: string | RegExp): RegExp {
19
19
  if (input instanceof RegExp) {
20
20
  return input;
21
- } else if (REGEX_PAT.test(input)) {
22
- const [, pat, mod] = input.match(REGEX_PAT) ?? [];
23
- return new RegExp(pat, mod);
21
+ } else if (REGEX_PATTERN.test(input)) {
22
+ const [, pattern, module] = input.match(REGEX_PATTERN) ?? [];
23
+ return new RegExp(pattern, module);
24
24
  } else {
25
25
  return new RegExp(input);
26
26
  }
@@ -1,6 +1,6 @@
1
- import ts from 'typescript';
1
+ import type ts from 'typescript';
2
2
 
3
- import { path, ManifestIndex, ManifestModuleUtil, IndexedFile } from '@travetto/manifest';
3
+ import { path, type ManifestIndex, ManifestModuleUtil, type IndexedFile } from '@travetto/manifest';
4
4
 
5
5
  import type { AnyType, TransformResolver } from './types.ts';
6
6
  import { TypeCategorize, TypeBuilder } from './builder.ts';
@@ -1,5 +1,5 @@
1
1
  import type ts from 'typescript';
2
- import { TemplateLiteral } from '../types/shared.ts';
2
+ import type { TemplateLiteral } from '../types/shared.ts';
3
3
 
4
4
  /**
5
5
  * Base type for a simplistic type structure
package/src/state.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import ts from 'typescript';
2
2
 
3
- import { path, ManifestIndex } from '@travetto/manifest';
3
+ import { path, type ManifestIndex } from '@travetto/manifest';
4
4
 
5
- import { ManagedType, AnyType, ForeignType, MappedType } from './resolver/types.ts';
6
- import { State, DecoratorMeta, Transformer, ModuleNameSymbol } from './types/visitor.ts';
5
+ import type { ManagedType, AnyType, ForeignType, MappedType } from './resolver/types.ts';
6
+ import { type State, type DecoratorMeta, type Transformer, ModuleNameSymbol } from './types/visitor.ts';
7
7
  import { SimpleResolver } from './resolver/service.ts';
8
8
  import { ImportManager } from './importer.ts';
9
- import { Import } from './types/shared.ts';
9
+ import type { Import } from './types/shared.ts';
10
10
 
11
11
  import { DocUtil } from './util/doc.ts';
12
12
  import { DecoratorUtil } from './util/decorator.ts';
@@ -169,11 +169,11 @@ export class TransformerState implements State {
169
169
  const type = this.#resolver.getType(identifier);
170
170
  const declaration = DeclarationUtil.getOptionalPrimaryDeclarationNode(type);
171
171
  const source = declaration?.getSourceFile().fileName;
172
- const mod = source ? this.#resolver.getFileImportName(source, true) : undefined;
173
- const file = this.#manifestIndex.getFromImport(mod ?? '')?.outputFile;
172
+ const moduleImport = source ? this.#resolver.getFileImportName(source, true) : undefined;
173
+ const file = this.#manifestIndex.getFromImport(moduleImport ?? '')?.outputFile;
174
174
  const targets = DocUtil.readAugments(type);
175
175
  const example = DocUtil.readExample(type);
176
- const module = file ? mod : undefined;
176
+ const module = file ? moduleImport : undefined;
177
177
  const name = identifier ?
178
178
  identifier.escapedText?.toString()! :
179
179
  undefined;
@@ -285,7 +285,7 @@ export class TransformerState implements State {
285
285
  */
286
286
  getModuleIdentifier(): ts.Expression {
287
287
  if (this.#moduleIdentifier === undefined) {
288
- this.#moduleIdentifier = this.factory.createUniqueName('mod');
288
+ this.#moduleIdentifier = this.factory.createUniqueName('Δm');
289
289
  const entry = this.#resolver.getFileImport(this.source.fileName);
290
290
  const declaration = this.factory.createVariableDeclaration(this.#moduleIdentifier, undefined, undefined,
291
291
  this.fromLiteral([entry?.module, entry?.relativeFile ?? ''])
@@ -304,10 +304,10 @@ export class TransformerState implements State {
304
304
  * @param name
305
305
  * @param module
306
306
  */
307
- findDecorator(mod: string | Transformer, node: ts.Node, name: string, module?: string): ts.Decorator | undefined {
307
+ findDecorator(input: string | Transformer, node: ts.Node, name: string, module?: string): ts.Decorator | undefined {
308
308
  module = module?.replace(/[.]ts$/, ''); // Replace extension if exists
309
- mod = typeof mod === 'string' ? mod : mod[ModuleNameSymbol]!;
310
- const target = `${mod}:${name}`;
309
+ const targetScope = typeof input === 'string' ? input : input[ModuleNameSymbol]!;
310
+ const target = `${targetScope}:${name}`;
311
311
  const list = this.getDecoratorList(node);
312
312
  return list.find(meta => meta.targets?.includes(target) && (!module || meta.name === name && meta.module === module))?.decorator;
313
313
  }
@@ -1,4 +1,4 @@
1
- import ts from 'typescript';
1
+ import type ts from 'typescript';
2
2
 
3
3
  /**
4
4
  * Decorator metadata
package/src/util/doc.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import ts from 'typescript';
2
2
 
3
- import { transformCast, DeclDocumentation } from '../types/shared.ts';
3
+ import { transformCast, type DeclDocumentation } from '../types/shared.ts';
4
4
  import { CoreUtil } from './core.ts';
5
5
  import { DeclarationUtil } from './declaration.ts';
6
6
 
@@ -2,7 +2,7 @@ import ts from 'typescript';
2
2
 
3
3
  import { path, ManifestModuleUtil, PackageUtil } from '@travetto/manifest';
4
4
 
5
- import { Import } from '../types/shared.ts';
5
+ import type { Import } from '../types/shared.ts';
6
6
 
7
7
  /**
8
8
  * Import utilities
@@ -1,6 +1,6 @@
1
1
  import ts from 'typescript';
2
2
 
3
- import { transformCast, TemplateLiteral } from '../types/shared.ts';
3
+ import { transformCast, type TemplateLiteral } from '../types/shared.ts';
4
4
 
5
5
  const TypedObject: {
6
6
  keys<T = unknown, K extends keyof T = keyof T>(value: T): K[];
package/src/visitor.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import ts from 'typescript';
2
2
 
3
- import { ManifestModuleFolderType, ManifestModuleUtil } from '@travetto/manifest';
3
+ import { type ManifestModuleFolderType, ManifestModuleUtil } from '@travetto/manifest';
4
4
 
5
- import { DecoratorMeta, TransformerType, NodeTransformer, TransformerSet, State, TransformPhase } from './types/visitor.ts';
5
+ import type { DecoratorMeta, TransformerType, NodeTransformer, TransformerSet, State, TransformPhase } from './types/visitor.ts';
6
6
  import { CoreUtil } from './util/core.ts';
7
7
 
8
8
  const COMPILER_SOURCE = new Set<ManifestModuleFolderType>(['support', 'src', '$index']);