@travetto/transformer
Advanced tools
Comparing version 2.0.0-alpha.5 to 2.0.0-alpha.6
{ | ||
"name": "@travetto/transformer", | ||
"displayName": "Transformation", | ||
"version": "2.0.0-alpha.5", | ||
"version": "2.0.0-alpha.6", | ||
"description": "Functionality for AST transformations, with transformer registration, and general utils", | ||
@@ -29,3 +29,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@travetto/base": "^2.0.0-alpha.5" | ||
"@travetto/base": "^2.0.0-alpha.6" | ||
}, | ||
@@ -32,0 +32,0 @@ "publishConfig": { |
@@ -43,2 +43,7 @@ import * as ts from 'typescript'; | ||
// Allow for node classes to be imported directly | ||
if (/@types\/node/.test(file)) { | ||
file = require.resolve(file.replace(/.*@types\/node\//, '').replace(/[.]d([.]ts)?$/, '')); | ||
} | ||
// Handle relative imports | ||
@@ -56,3 +61,3 @@ if (file.startsWith('.') && base && | ||
if (!file.endsWith('.d.ts') && !this.#newImports.has(file)) { | ||
if (!/[.]d([.]ts)?$/.test(file) && !this.#newImports.has(file)) { | ||
const id = this.getId(file); | ||
@@ -59,0 +64,0 @@ |
@@ -64,11 +64,10 @@ /* eslint-disable no-bitwise */ | ||
if (!resolvedType.isClass()) { // Real type | ||
const source = DeclarationUtil.getPrimaryDeclarationNode(resolvedType).getSourceFile(); | ||
if (source && source.fileName.includes('typescript/lib')) { // Global Type | ||
return { category: 'literal', type }; | ||
} else { | ||
return { category: 'shape', type: resolvedType }; | ||
} | ||
const source = DeclarationUtil.getPrimaryDeclarationNode(resolvedType).getSourceFile(); | ||
if (source?.fileName.includes('@types/node/globals') || source?.fileName.includes('typescript/lib')) { | ||
return { category: 'literal', type }; | ||
} else if (!resolvedType.isClass()) { // Not a real type | ||
return { category: 'shape', type: resolvedType }; | ||
} else { | ||
return { category: 'external', type: resolvedType }; | ||
} | ||
return { category: 'external', type: resolvedType }; | ||
} else if (flags & ( | ||
@@ -75,0 +74,0 @@ ts.TypeFlags.Boolean | ts.TypeFlags.BooleanLiteral | |
@@ -9,3 +9,2 @@ import * as ts from 'typescript'; | ||
import { State, DecoratorMeta, Transformer, TransformerId } from './types/visitor'; | ||
import { TypeResolver } from './resolver/service'; | ||
@@ -12,0 +11,0 @@ import { ImportManager } from './importer'; |
@@ -61,3 +61,3 @@ import * as ts from 'typescript'; | ||
static getSymbol(type: ts.Type | ts.Symbol) { | ||
if ('valueDeclaration' in type) { | ||
if ('valueDeclaration' in type || 'escapedName' in type) { | ||
return type; | ||
@@ -64,0 +64,0 @@ } else { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67376
1793