@wessberg/di-compiler
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -11,2 +11,3 @@ import { IDIConfig } from "../DIConfig/Interface/IDIConfig"; | ||
private typeDetector; | ||
private identifierValidator; | ||
constructor(config: IDIConfig, typeDetector: ITypeDetector); | ||
@@ -13,0 +14,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const compiler_common_1 = require("@wessberg/compiler-common"); | ||
/** | ||
@@ -11,2 +12,3 @@ * Walks through all call expressions on the DIContainer instance and upgrades their arguments. | ||
this.typeDetector = typeDetector; | ||
this.identifierValidator = new compiler_common_1.IdentifierValidator(); | ||
} | ||
@@ -42,3 +44,4 @@ /** | ||
const classDeclaration = classes[implementation.name]; | ||
if (classDeclaration == null) | ||
// If the class hasn't been registered and it isn't a built-in part of the language or environment, throw an error. | ||
if (classDeclaration == null && !this.identifierValidator.isBuiltIn(implementation.name)) | ||
throw new ReferenceError(`${this.constructor.name} could not find a class declaration for the implementation: ${implementation.name}`); | ||
@@ -45,0 +48,0 @@ const config = { |
@@ -11,2 +11,3 @@ import { IDIConfig } from "../DIConfig/Interface/IDIConfig"; | ||
private typeDetector; | ||
private identifierValidator; | ||
constructor(config: IDIConfig, typeDetector: ITypeDetector); | ||
@@ -13,0 +14,0 @@ /** |
@@ -0,1 +1,2 @@ | ||
import { IdentifierValidator } from "@wessberg/compiler-common"; | ||
/** | ||
@@ -9,2 +10,3 @@ * Walks through all call expressions on the DIContainer instance and upgrades their arguments. | ||
this.typeDetector = typeDetector; | ||
this.identifierValidator = new IdentifierValidator(); | ||
} | ||
@@ -40,3 +42,4 @@ /** | ||
const classDeclaration = classes[implementation.name]; | ||
if (classDeclaration == null) | ||
// If the class hasn't been registered and it isn't a built-in part of the language or environment, throw an error. | ||
if (classDeclaration == null && !this.identifierValidator.isBuiltIn(implementation.name)) | ||
throw new ReferenceError(`${this.constructor.name} could not find a class declaration for the implementation: ${implementation.name}`); | ||
@@ -43,0 +46,0 @@ const config = { |
{ | ||
"name": "@wessberg/di-compiler", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "The compiler for https://www.npmjs.com/package/@wessberg/di", | ||
@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js", |
@@ -27,2 +27,6 @@ # DI-Compiler (The compiler for DI) [![NPM version][npm-image]][npm-url] | ||
**v1.0.11**: | ||
- Built-in constructors (for example "Proxy" or anything that is a native part of the environment) can now be added as services too. | ||
**v1.0.10**: | ||
@@ -29,0 +33,0 @@ |
76164
1466
81