@travetto/transformer 4.1.1 → 5.0.0-rc.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/LICENSE +1 -1
- package/package.json +3 -3
- package/src/resolver/service.ts +1 -1
- package/src/state.ts +2 -3
- package/src/util/core.ts +2 -2
- package/src/util/import.ts +1 -1
package/LICENSE
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/transformer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-rc.0",
|
|
4
4
|
"description": "Functionality for AST transformations, with transformer registration, and general utils",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"directory": "module/transformer"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@travetto/manifest": "^
|
|
27
|
+
"@travetto/manifest": "^5.0.0-rc.0",
|
|
28
28
|
"tslib": "^2.6.3",
|
|
29
|
-
"typescript": "^5.
|
|
29
|
+
"typescript": "^5.5.3"
|
|
30
30
|
},
|
|
31
31
|
"travetto": {
|
|
32
32
|
"displayName": "Transformation",
|
package/src/resolver/service.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
2
|
|
|
3
|
-
import { ManifestIndex, ManifestModuleUtil
|
|
3
|
+
import { path, ManifestIndex, ManifestModuleUtil } from '@travetto/manifest';
|
|
4
4
|
|
|
5
5
|
import type { AnyType, TransformResolver } from './types';
|
|
6
6
|
import { TypeCategorize, TypeBuilder } from './builder';
|
package/src/state.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { path, ManifestIndex } from '@travetto/manifest';
|
|
4
4
|
|
|
5
5
|
import { ManagedType, AnyType, ForeignType } from './resolver/types';
|
|
6
6
|
import { State, DecoratorMeta, Transformer, ModuleNameⲐ } from './types/visitor';
|
|
@@ -46,7 +46,6 @@ export class TransformerState implements State {
|
|
|
46
46
|
this.#resolver = new SimpleResolver(checker, manifestIndex);
|
|
47
47
|
this.#imports = new ImportManager(source, factory, this.#resolver);
|
|
48
48
|
this.file = path.toPosix(this.source.fileName);
|
|
49
|
-
|
|
50
49
|
this.importName = this.#resolver.getFileImportName(this.file, true);
|
|
51
50
|
}
|
|
52
51
|
|
|
@@ -167,7 +166,7 @@ export class TransformerState implements State {
|
|
|
167
166
|
getDecoratorList(node: ts.Node): DecoratorMeta[] {
|
|
168
167
|
return ts.canHaveDecorators(node) ? (ts.getDecorators(node) ?? [])
|
|
169
168
|
.map(dec => this.getDecoratorMeta(dec))
|
|
170
|
-
.filter(
|
|
169
|
+
.filter(x => !!x) : [];
|
|
171
170
|
}
|
|
172
171
|
|
|
173
172
|
/**
|
package/src/util/core.ts
CHANGED
|
@@ -26,7 +26,7 @@ export class CoreUtil {
|
|
|
26
26
|
* @param m
|
|
27
27
|
*/
|
|
28
28
|
static getRangeOf<T extends ts.Node>(source: ts.SourceFile, o: T | undefined): [start: number, end: number] | undefined {
|
|
29
|
-
if (o) {
|
|
29
|
+
if (o && o.pos >= 0) {
|
|
30
30
|
const start = ts.getLineAndCharacterOfPosition(source, o.getStart(source));
|
|
31
31
|
const end = ts.getLineAndCharacterOfPosition(source, o.getEnd());
|
|
32
32
|
return [start.line + 1, end.line + 1];
|
|
@@ -106,7 +106,7 @@ export class CoreUtil {
|
|
|
106
106
|
factory.createCallExpression(
|
|
107
107
|
name,
|
|
108
108
|
undefined,
|
|
109
|
-
contents.filter(
|
|
109
|
+
contents.filter(x => !!x)
|
|
110
110
|
)
|
|
111
111
|
);
|
|
112
112
|
}
|
package/src/util/import.ts
CHANGED