dependency-injection-cat
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -8,4 +8,4 @@ export declare type TClassConstructor<T> = new (...args: any[]) => T; | ||
export declare function Bean<T>(target: any, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): void; | ||
export declare function Bean<T>(beanProps: IBeanInfo): typeof Bean; | ||
export declare function Bean(beanProps: IBeanInfo): typeof Bean; | ||
export declare function Bean<T>(classIml: TClassConstructor<T>, beanProps?: IBeanInfo): T; | ||
export declare function Bean<T>(target: any, propertyKey: string | symbol): void; | ||
export declare function Bean(target: any, propertyKey: string | symbol): void; |
@@ -1,1 +0,1 @@ | ||
export declare function Qualifier(beanName: string): (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; | ||
export declare function Qualifier(beanName: string): (target: object, propertyKey: string | symbol, parameterIndex: number) => void; |
"use strict"; | ||
/* eslint-disable @typescript-eslint/ban-types */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -3,0 +4,0 @@ exports.Qualifier = void 0; |
"use strict"; | ||
/* eslint-disable @typescript-eslint/ban-types */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -3,0 +4,0 @@ exports.Singleton = void 0; |
@@ -21,3 +21,3 @@ "use strict"; | ||
Graph.prototype.hasNode = function (node) { | ||
return this.g.hasOwnProperty(node); | ||
return Object.prototype.hasOwnProperty.call(this.g, node); | ||
}; | ||
@@ -24,0 +24,0 @@ Graph.prototype.addEdges = function (node) { |
@@ -20,3 +20,3 @@ "use strict"; | ||
var resolvedPath = PathResolver_1.PathResolver.resolveWithoutExtension(sourceFilePath, importPath); | ||
var pathWithoutExtension = resolvedPath.replace(/\.[^/.]+$/, ""); | ||
var pathWithoutExtension = resolvedPath.replace(/\.[^/.]+$/, ''); | ||
return ts.updateImportDeclaration(node, node.decorators, node.modifiers, node.importClause, ts.createLiteral(pathWithoutExtension)); | ||
@@ -23,0 +23,0 @@ } |
{ | ||
"name": "dependency-injection-cat", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"main": "index.js", | ||
@@ -25,4 +25,8 @@ "types": "index.d.ts", | ||
"@types/webpack": "^4.41.21", | ||
"@typescript-eslint/eslint-plugin": "^4.3.0", | ||
"@typescript-eslint/parser": "^4.3.0", | ||
"awesome-typescript-loader": "^5.2.1", | ||
"clean-webpack-plugin": "^3.0.0", | ||
"dependency-injection-cat": "./dist/src", | ||
"eslint": "^7.10.0", | ||
"html-webpack-plugin": "^4.3.0", | ||
@@ -41,3 +45,2 @@ "jest": "^26.1.0", | ||
"ts-node": "^8.10.2", | ||
"dependency-injection-cat": "./dist/src", | ||
"tsconfig-paths-webpack-plugin": "^3.3.0", | ||
@@ -44,0 +47,0 @@ "ttypescript": "^1.5.10", |
@@ -243,2 +243,3 @@ ![npm](https://img.shields.io/npm/v/dependency-injection-cat?style=flat) | ||
//First argument in Bean should always be implementation of interface, second is configuration object | ||
//When using this syntax, implementation should be a class | ||
//You should pass Bean type in generic | ||
@@ -245,0 +246,0 @@ someBeanProperty = Bean<Interface>(ImplementationOfInterface, { qualifier: 'someCoolImpl' }); |
import { SyntaxKind } from 'typescript'; | ||
export declare const typeKeywords: SyntaxKind[]; | ||
export declare const typeKeywordsDictionary: Record<number, string>; | ||
export declare const typescriptUtilityTypes: Array<string>; |
"use strict"; | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.typeKeywordsDictionary = exports.typeKeywords = void 0; | ||
exports.typescriptUtilityTypes = exports.typeKeywordsDictionary = exports.typeKeywords = void 0; | ||
var typescript_1 = require("typescript"); | ||
@@ -36,1 +36,19 @@ exports.typeKeywords = [ | ||
_a); | ||
exports.typescriptUtilityTypes = [ | ||
'Partial', | ||
'Readonly', | ||
'Record', | ||
'Pick', | ||
'Omit', | ||
'Exclude', | ||
'Extract', | ||
'NonNullable', | ||
'Parameters', | ||
'ConstructorParameters', | ||
'ReturnType', | ||
'InstanceType', | ||
'Required', | ||
'ThisParameterType', | ||
'OmitThisParameter', | ||
'ThisType', | ||
]; |
@@ -10,1 +10,3 @@ export declare const OPEN_TYPE_ARGUMENTS_TOKEN = "<"; | ||
export declare const END_QUALIFIER_TOKEN = "$END_QUALIFIER$"; | ||
export declare const START_UTILITY_TYPE = "$START_UTILITY_TYPE$"; | ||
export declare const END_UTILITY_TYPE = "$END_UTILITY_TYPE$"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.END_QUALIFIER_TOKEN = exports.START_QUALIFIER_TOKEN = exports.END_PATH_TOKEN = exports.START_PATH_TOKEN = exports.ARRAY_TYPE_TOKEN = exports.UNION_TYPE_TOKEN = exports.TUPLE_TYPE_TOKEN = exports.CLOSE_TYPE_ARGUMENTS_TOKEN = exports.OPEN_TYPE_ARGUMENTS_TOKEN = void 0; | ||
exports.END_UTILITY_TYPE = exports.START_UTILITY_TYPE = exports.END_QUALIFIER_TOKEN = exports.START_QUALIFIER_TOKEN = exports.END_PATH_TOKEN = exports.START_PATH_TOKEN = exports.ARRAY_TYPE_TOKEN = exports.UNION_TYPE_TOKEN = exports.TUPLE_TYPE_TOKEN = exports.CLOSE_TYPE_ARGUMENTS_TOKEN = exports.OPEN_TYPE_ARGUMENTS_TOKEN = void 0; | ||
exports.OPEN_TYPE_ARGUMENTS_TOKEN = '<'; | ||
@@ -13,1 +13,3 @@ exports.CLOSE_TYPE_ARGUMENTS_TOKEN = '>'; | ||
exports.END_QUALIFIER_TOKEN = '$END_QUALIFIER$'; | ||
exports.START_UTILITY_TYPE = '$START_UTILITY_TYPE$'; | ||
exports.END_UTILITY_TYPE = '$END_UTILITY_TYPE$'; |
@@ -7,11 +7,15 @@ "use strict"; | ||
var node_source_descriptor_1 = require("../../node-source-descriptor"); | ||
var constants_1 = require("./constants"); | ||
function typeIdQualifierBase(node) { | ||
var sourceFile = node.getSourceFile(); | ||
var nameToFind = node.getText(); | ||
var nameToFind = node.typeName.getText(); | ||
var nodeSourceDescriptor = node_source_descriptor_1.getNodeSourceDescriptorDeep(sourceFile, nameToFind); | ||
if (nodeSourceDescriptor === null) { | ||
throw new Error(TypeQualifierError_1.TypeQualifierError.CanNotGenerateType); | ||
if (nodeSourceDescriptor !== null) { | ||
return "" + parseTokens_1.START_PATH_TOKEN + nodeSourceDescriptor.path + parseTokens_1.END_PATH_TOKEN + nodeSourceDescriptor.name; | ||
} | ||
return "" + parseTokens_1.START_PATH_TOKEN + nodeSourceDescriptor.path + parseTokens_1.END_PATH_TOKEN + nodeSourceDescriptor.name; | ||
if (constants_1.typescriptUtilityTypes.includes(nameToFind)) { | ||
return "" + parseTokens_1.START_UTILITY_TYPE + nameToFind + parseTokens_1.END_UTILITY_TYPE; | ||
} | ||
throw new Error(TypeQualifierError_1.TypeQualifierError.CanNotGenerateType); | ||
} | ||
exports.typeIdQualifierBase = typeIdQualifierBase; |
export declare enum TypeQualifierError { | ||
TypeIsPrimitive = "TypeIsPrimitive", | ||
NoTypeNameFound = "NoTypeNameFound", | ||
CanNotGenerateType = "CanNotGenerateType" | ||
} |
@@ -7,4 +7,3 @@ "use strict"; | ||
TypeQualifierError["TypeIsPrimitive"] = "TypeIsPrimitive"; | ||
TypeQualifierError["NoTypeNameFound"] = "NoTypeNameFound"; | ||
TypeQualifierError["CanNotGenerateType"] = "CanNotGenerateType"; | ||
})(TypeQualifierError = exports.TypeQualifierError || (exports.TypeQualifierError = {})); |
@@ -1,16 +0,2 @@ | ||
import { ClassDeclaration, InterfaceDeclaration, TypeAliasDeclaration, NamespaceExportDeclaration, Identifier, NodeArray, TypeNode, TypeReferenceNode, PropertyDeclaration, CallExpression } from 'typescript'; | ||
export declare type TAvailableTypes = ClassDeclaration | InterfaceDeclaration | TypeAliasDeclaration | NamespaceExportDeclaration; | ||
export declare type TNamedAvailableTypes = NamedClassDeclaration | NamedInterfaceDeclaration | NamedTypeAliasDeclaration | NamedNamespaceExportDeclaration; | ||
interface NamedClassDeclaration extends ClassDeclaration { | ||
name: Identifier; | ||
} | ||
interface NamedInterfaceDeclaration extends InterfaceDeclaration { | ||
name: Identifier; | ||
} | ||
interface NamedTypeAliasDeclaration extends TypeAliasDeclaration { | ||
name: Identifier; | ||
} | ||
interface NamedNamespaceExportDeclaration extends NamespaceExportDeclaration { | ||
name: Identifier; | ||
} | ||
import { NodeArray, TypeNode, TypeReferenceNode, PropertyDeclaration, CallExpression } from 'typescript'; | ||
export interface ITypeReferenceNode extends TypeReferenceNode { | ||
@@ -26,2 +12,1 @@ typeArguments: NodeArray<TypeNode>; | ||
} | ||
export {}; |
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
137321
2517
337
34