Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

injection-js

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

injection-js - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

5

facade/errors.d.ts
/// <reference types="node" />
import { DebugContext } from './lang';
/**

@@ -13,5 +14,7 @@ * @license

export declare const ERROR_ORIGINAL_ERROR: string;
export declare const ERROR_LOGGER: string;
export declare function getType(error: Error): Function;
export declare function getDebugContext(error: Error): any;
export declare function getDebugContext(error: Error): DebugContext;
export declare function getOriginalError(error: Error): Error;
export declare function getErrorLogger(error: Error): (console: Console, ...values: any[]) => void;
export declare function wrappedError(message: string, originalError: any): Error;

@@ -12,2 +12,3 @@ /**

export var ERROR_ORIGINAL_ERROR = 'ngOriginalError';
export var ERROR_LOGGER = 'ngErrorLogger';
export function getType(error) {

@@ -22,2 +23,12 @@ return error[ERROR_TYPE];

}
function defaultErrorLogger(console) {
var values = [];
for (var _i = 1; _i < arguments.length; _i++) {
values[_i - 1] = arguments[_i];
}
console.error.apply(console, values);
}
export function getErrorLogger(error) {
return error[ERROR_LOGGER] || defaultErrorLogger;
}
export function wrappedError(message, originalError) {

@@ -24,0 +35,0 @@ var msg = message + " caused by: " + (originalError instanceof Error ? originalError.message : originalError);

@@ -0,1 +1,3 @@

/// <reference types="node" />
import { Injector } from '../injector';
/**

@@ -33,1 +35,14 @@ * @license

export declare function stringify(token: any): string;
export declare abstract class DebugContext {
readonly abstract nodeIndex: number | null;
readonly abstract injector: Injector;
readonly abstract component: any;
readonly abstract providerTokens: any[];
readonly abstract references: {
[key: string]: any;
};
readonly abstract context: any;
readonly abstract componentRenderElement: any;
readonly abstract renderNode: any;
abstract logError(console: Console, ...values: any[]): void;
}

54

facade/lang.js

@@ -1,8 +0,1 @@

/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var globalScope;

@@ -45,2 +38,49 @@ if (typeof window === 'undefined') {

}
export var DebugContext = (function () {
function DebugContext() {
}
Object.defineProperty(DebugContext.prototype, "nodeIndex", {
// We don't really need this
// abstract get view(): ViewData;
get: function () { },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext.prototype, "injector", {
get: function () { },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext.prototype, "component", {
get: function () { },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext.prototype, "providerTokens", {
get: function () { },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext.prototype, "references", {
get: function () { },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext.prototype, "context", {
get: function () { },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext.prototype, "componentRenderElement", {
get: function () { },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext.prototype, "renderNode", {
get: function () { },
enumerable: true,
configurable: true
});
return DebugContext;
}());
//# sourceMappingURL=lang.js.map

@@ -43,4 +43,4 @@ /**

*
* `InjectionToken` is parametrize on `T` which is the type of object which will be returned by the
* `Injector`. This provides additional level of type safety.
* `InjectionToken` is parameterized on `T` which is the type of object which will be returned by
* the `Injector`. This provides additional level of type safety.
*

@@ -55,3 +55,3 @@ * ```

*
* {@example core/di/ts/injector_spec.ts region='Injector'}
* {@example core/di/ts/injector_spec.ts region='InjectionToken'}
*

@@ -58,0 +58,0 @@ * @stable

@@ -50,4 +50,4 @@ /**

*
* `InjectionToken` is parametrize on `T` which is the type of object which will be returned by the
* `Injector`. This provides additional level of type safety.
* `InjectionToken` is parameterized on `T` which is the type of object which will be returned by
* the `Injector`. This provides additional level of type safety.
*

@@ -62,3 +62,3 @@ * ```

*
* {@example core/di/ts/injector_spec.ts region='Injector'}
* {@example core/di/ts/injector_spec.ts region='InjectionToken'}
*

@@ -65,0 +65,0 @@ * @stable

@@ -7,9 +7,2 @@ (function (global, factory) {

/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var globalScope;

@@ -31,5 +24,3 @@ if (typeof window === 'undefined') {

var _global = globalScope;
function isPresent(obj) {
return obj != null;
}
function stringify(token) {

@@ -52,2 +43,49 @@ if (typeof token === 'string') {

}
var DebugContext = (function () {
function DebugContext() {
}
Object.defineProperty(DebugContext.prototype, "nodeIndex", {
// We don't really need this
// abstract get view(): ViewData;
get: function () { },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext.prototype, "injector", {
get: function () { },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext.prototype, "component", {
get: function () { },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext.prototype, "providerTokens", {
get: function () { },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext.prototype, "references", {
get: function () { },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext.prototype, "context", {
get: function () { },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext.prototype, "componentRenderElement", {
get: function () { },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext.prototype, "renderNode", {
get: function () { },
enumerable: true,
configurable: true
});
return DebugContext;
}());

@@ -62,3 +100,3 @@ /**

var _nextClassId = 0;
var Reflect = _global.Reflect;
var Reflect = _global['Reflect'];
function extractAnnotation(annotation) {

@@ -191,2 +229,3 @@ if (typeof annotation === 'function' && annotation.hasOwnProperty('annotation')) {

* ```
* @suppress {globalThis}
* @stable

@@ -220,4 +259,6 @@ */

}
/**
* @suppress {globalThis}
*/
function makeDecorator(name, props, parentClass, chainFn) {
if (chainFn === void 0) { chainFn = null; }
var metaCtor = makeMetadataCtor([props]);

@@ -470,5 +511,7 @@ function DecoratorFactory(objOrType) {

function getOriginalError(error) {
return error[ERROR_ORIGINAL_ERROR];
}
function wrappedError(message, originalError) {

@@ -806,3 +849,3 @@ var msg = message + " caused by: " + (originalError instanceof Error ? originalError.message : originalError);

function ReflectionCapabilities(reflect) {
this._reflect = reflect || _global.Reflect;
this._reflect = reflect || _global['Reflect'];
}

@@ -839,3 +882,3 @@ ReflectionCapabilities.prototype.isReflectionEnabled = function () { return true; };

}
if (paramAnnotations && isPresent(paramAnnotations[i])) {
if (paramAnnotations && paramAnnotations[i] != null) {
result[i] = result[i].concat(paramAnnotations[i]);

@@ -874,3 +917,3 @@ }

// API for metadata created by invoking the decorators.
if (isPresent(this._reflect) && isPresent(this._reflect.getOwnMetadata)) {
if (this._reflect != null && this._reflect.getOwnMetadata != null) {
var paramAnnotations = this._reflect.getOwnMetadata('parameters', type);

@@ -918,2 +961,3 @@ var paramTypes = this._reflect.getOwnMetadata('design:paramtypes', type);

}
return null;
};

@@ -953,2 +997,3 @@ ReflectionCapabilities.prototype.annotations = function (typeOrFunc) {

}
return null;
};

@@ -1000,3 +1045,6 @@ ReflectionCapabilities.prototype.propMetadata = function (typeOrFunc) {

};
ReflectionCapabilities.prototype.resolveIdentifier = function (name, moduleUrl, runtime) { return runtime; };
ReflectionCapabilities.prototype.resourceUri = function (type) { return "./" + stringify(type); };
ReflectionCapabilities.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) {
return runtime;
};
ReflectionCapabilities.prototype.resolveEnum = function (enumIdentifier, name) { return enumIdentifier[name]; };

@@ -1081,4 +1129,5 @@ return ReflectionCapabilities;

Reflector.prototype.importUri = function (type) { return this.reflectionCapabilities.importUri(type); };
Reflector.prototype.resolveIdentifier = function (name, moduleUrl, runtime) {
return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, runtime);
Reflector.prototype.resourceUri = function (type) { return this.reflectionCapabilities.resourceUri(type); };
Reflector.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) {
return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime);
};

@@ -1153,4 +1202,4 @@ Reflector.prototype.resolveEnum = function (identifier, name) {

*
* `InjectionToken` is parametrize on `T` which is the type of object which will be returned by the
* `Injector`. This provides additional level of type safety.
* `InjectionToken` is parameterized on `T` which is the type of object which will be returned by
* the `Injector`. This provides additional level of type safety.
*

@@ -1165,3 +1214,3 @@ * ```

*
* {@example core/di/ts/injector_spec.ts region='Injector'}
* {@example core/di/ts/injector_spec.ts region='InjectionToken'}
*

@@ -1267,3 +1316,3 @@ * @stable

function resolveReflectiveProvider(provider) {
return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi);
return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false);
}

@@ -1501,3 +1550,2 @@ /**

ReflectiveInjector.resolveAndCreate = function (providers, parent) {
if (parent === void 0) { parent = null; }
var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);

@@ -1530,3 +1578,2 @@ return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent);

ReflectiveInjector.fromResolvedProviders = function (providers, parent) {
if (parent === void 0) { parent = null; }
return new ReflectiveInjector_(providers, parent);

@@ -1560,7 +1607,6 @@ };

function ReflectiveInjector_(_providers, _parent) {
if (_parent === void 0) { _parent = null; }
/** @internal */
this._constructionCounter = 0;
this._providers = _providers;
this._parent = _parent;
this._parent = _parent || null;
var len = _providers.length;

@@ -1567,0 +1613,0 @@ this.keyIds = new Array(len);

@@ -36,3 +36,3 @@ import { Type } from './facade/type';

/**
* @deprecated from v4.0.0 use Type<T> or InjectToken<T>
* @deprecated from v4.0.0 use Type<T> or InjectionToken<T>
* @suppress {duplicate}

@@ -39,0 +39,0 @@ */

{
"name": "injection-js",
"version": "2.0.1",
"version": "2.1.0",
"description": "Dependency Injection library for JavaScript and TypeScript",

@@ -5,0 +5,0 @@ "main": "injection.bundle.js",

@@ -5,5 +5,5 @@ [![Build Status](https://travis-ci.org/mgechev/injection-js.svg?branch=master)](https://travis-ci.org/mgechev/injection-js)

Dependency injection library for JavaScript and TypeScript in **5.1K**. It is an extraction of the Angular's dependency injection which means that it's feature complete, fast, reliable and well tested.
Dependency injection library for JavaScript and TypeScript in **5.2K**. It is an extraction of the Angular's dependency injection which means that it's feature complete, fast, reliable and well tested.
**Up-to-date with Angular 4**.
**Up-to-date with Angular 4.1**.

@@ -10,0 +10,0 @@ # How to use?

@@ -23,4 +23,5 @@ /**

importUri(type: Type<any>): string;
resolveIdentifier(name: string, moduleUrl: string, runtime: any): any;
resourceUri(type: Type<any>): string;
resolveIdentifier(name: string, moduleUrl: string, members: string[] | null, runtime: any): any;
resolveEnum(enumIdentifier: any, name: string): any;
}

@@ -26,4 +26,5 @@ import { Type } from '../facade/type';

importUri(type: any): string;
resolveIdentifier(name: string, moduleUrl: string, runtime: any): any;
resourceUri(type: any): string;
resolveIdentifier(name: string, moduleUrl: string, members: string[], runtime: any): any;
resolveEnum(enumIdentifier: any, name: string): any;
}

@@ -8,3 +8,3 @@ /**

*/
import { global, isPresent, stringify } from '../facade/lang';
import { global, stringify } from '../facade/lang';
import { Type, isType } from '../facade/type';

@@ -17,3 +17,3 @@ /**

function ReflectionCapabilities(reflect) {
this._reflect = reflect || global.Reflect;
this._reflect = reflect || global['Reflect'];
}

@@ -50,3 +50,3 @@ ReflectionCapabilities.prototype.isReflectionEnabled = function () { return true; };

}
if (paramAnnotations && isPresent(paramAnnotations[i])) {
if (paramAnnotations && paramAnnotations[i] != null) {
result[i] = result[i].concat(paramAnnotations[i]);

@@ -85,3 +85,3 @@ }

// API for metadata created by invoking the decorators.
if (isPresent(this._reflect) && isPresent(this._reflect.getOwnMetadata)) {
if (this._reflect != null && this._reflect.getOwnMetadata != null) {
var paramAnnotations = this._reflect.getOwnMetadata('parameters', type);

@@ -129,2 +129,3 @@ var paramTypes = this._reflect.getOwnMetadata('design:paramtypes', type);

}
return null;
};

@@ -164,2 +165,3 @@ ReflectionCapabilities.prototype.annotations = function (typeOrFunc) {

}
return null;
};

@@ -211,3 +213,6 @@ ReflectionCapabilities.prototype.propMetadata = function (typeOrFunc) {

};
ReflectionCapabilities.prototype.resolveIdentifier = function (name, moduleUrl, runtime) { return runtime; };
ReflectionCapabilities.prototype.resourceUri = function (type) { return "./" + stringify(type); };
ReflectionCapabilities.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) {
return runtime;
};
ReflectionCapabilities.prototype.resolveEnum = function (enumIdentifier, name) { return enumIdentifier[name]; };

@@ -214,0 +219,0 @@ return ReflectionCapabilities;

@@ -18,5 +18,6 @@ /**

};
abstract importUri(typeOrFunc: any): string;
abstract resolveIdentifier(name: string, moduleUrl: string, runtime: any): any;
abstract importUri(typeOrFunc: any): string | null;
abstract resourceUri(typeOrFunc: any): string;
abstract resolveIdentifier(name: string, moduleUrl: string, members: string[], runtime: any): any;
abstract resolveEnum(identifier: any, name: string): any;
}

@@ -33,4 +33,5 @@ /**

importUri(type: any): string;
resolveIdentifier(name: string, moduleUrl: string, runtime: any): any;
resourceUri(type: any): string;
resolveIdentifier(name: string, moduleUrl: string, members: string[] | null, runtime: any): any;
resolveEnum(identifier: any, name: string): any;
}

@@ -42,4 +42,5 @@ /**

Reflector.prototype.importUri = function (type) { return this.reflectionCapabilities.importUri(type); };
Reflector.prototype.resolveIdentifier = function (name, moduleUrl, runtime) {
return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, runtime);
Reflector.prototype.resourceUri = function (type) { return this.reflectionCapabilities.resourceUri(type); };
Reflector.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) {
return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime);
};

@@ -46,0 +47,0 @@ Reflector.prototype.resolveEnum = function (identifier, name) {

@@ -146,3 +146,3 @@ /**

*/
readonly abstract parent: Injector;
readonly abstract parent: Injector | null;
/**

@@ -262,3 +262,3 @@ * Resolves an array of providers and creates a child injector from those providers.

get(token: any, notFoundValue?: any): any;
readonly parent: Injector;
readonly parent: Injector | null;
resolveAndCreateChild(providers: Provider[]): ReflectiveInjector;

@@ -265,0 +265,0 @@ createChildFromResolved(providers: ResolvedReflectiveProvider[]): ReflectiveInjector;

@@ -116,3 +116,2 @@ /**

ReflectiveInjector.resolveAndCreate = function (providers, parent) {
if (parent === void 0) { parent = null; }
var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);

@@ -145,3 +144,2 @@ return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent);

ReflectiveInjector.fromResolvedProviders = function (providers, parent) {
if (parent === void 0) { parent = null; }
return new ReflectiveInjector_(providers, parent);

@@ -175,7 +173,6 @@ };

function ReflectiveInjector_(_providers, _parent) {
if (_parent === void 0) { _parent = null; }
/** @internal */
this._constructionCounter = 0;
this._providers = _providers;
this._parent = _parent;
this._parent = _parent || null;
var len = _providers.length;

@@ -182,0 +179,0 @@ this.keyIds = new Array(len);

@@ -11,4 +11,4 @@ import { Self, SkipSelf } from './metadata';

optional: boolean;
visibility: Self | SkipSelf;
constructor(key: ReflectiveKey, optional: boolean, visibility: Self | SkipSelf);
visibility: Self | SkipSelf | null;
constructor(key: ReflectiveKey, optional: boolean, visibility: Self | SkipSelf | null);
static fromKey(key: ReflectiveKey): ReflectiveDependency;

@@ -89,2 +89,2 @@ }

export declare function mergeResolvedReflectiveProviders(providers: ResolvedReflectiveProvider[], normalizedProvidersMap: Map<number, ResolvedReflectiveProvider>): Map<number, ResolvedReflectiveProvider>;
export declare function constructDependencies(typeOrFunc: any, dependencies: any[]): ReflectiveDependency[];
export declare function constructDependencies(typeOrFunc: any, dependencies?: any[]): ReflectiveDependency[];

@@ -96,3 +96,3 @@ /**

function resolveReflectiveProvider(provider) {
return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi);
return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false);
}

@@ -99,0 +99,0 @@ /**

@@ -7,3 +7,3 @@ import { Type } from '../facade/type';

*/
export interface ClassDefinition {
export declare type ClassDefinition = {
/**

@@ -23,2 +23,3 @@ * Optional argument for specifying the superclass.

constructor: Function | any[];
} & {
/**

@@ -29,3 +30,3 @@ * Other methods on the class. Note that values should have type 'Function' but TS requires

[x: string]: Type<any> | Function | any[];
}
};
/**

@@ -149,5 +150,9 @@ * An interface implemented by all Angular type decorators, which allows them to be used as ES7

* ```
* @suppress {globalThis}
* @stable
*/
export declare function Class(clsDef: ClassDefinition): Type<any>;
/**
* @suppress {globalThis}
*/
export declare function makeDecorator(name: string, props: {

@@ -154,0 +159,0 @@ [name: string]: any;

@@ -10,3 +10,3 @@ /**

var _nextClassId = 0;
var Reflect = global.Reflect;
var Reflect = global['Reflect'];
function extractAnnotation(annotation) {

@@ -139,2 +139,3 @@ if (typeof annotation === 'function' && annotation.hasOwnProperty('annotation')) {

* ```
* @suppress {globalThis}
* @stable

@@ -168,4 +169,6 @@ */

}
/**
* @suppress {globalThis}
*/
export function makeDecorator(name, props, parentClass, chainFn) {
if (chainFn === void 0) { chainFn = null; }
var metaCtor = makeMetadataCtor([props]);

@@ -172,0 +175,0 @@ function DecoratorFactory(objOrType) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc