@wendellhu/redi
Advanced tools
Comparing version 0.10.0 to 0.11.0
@@ -104,6 +104,4 @@ (function (global, factory) { | ||
function DependencyDescriptorNotFoundError(index, target) { | ||
var _this = this; | ||
var msg = "Could not find dependency registered on the ".concat(index + 1, " parameter of the constructor of \"").concat(prettyPrintIdentifier(target), "\"."); | ||
_this = _super.call(this, msg) || this; | ||
return _this; | ||
return _super.call(this, msg) || this; | ||
} | ||
@@ -115,6 +113,4 @@ return DependencyDescriptorNotFoundError; | ||
function IdentifierUndefinedError(target, index) { | ||
var _this = this; | ||
var msg = "It seems that you register \"undefined\" as dependency on the ".concat(index + 1, " parameter of \"").concat(prettyPrintIdentifier(target), "\". Please make sure that there is not cyclic dependency among your TypeScript files, or consider using \"forwardRef\"."); | ||
_this = _super.call(this, msg) || this; | ||
return _this; | ||
return _super.call(this, msg) || this; | ||
} | ||
@@ -216,6 +212,4 @@ return IdentifierUndefinedError; | ||
function QuantityCheckError(id, quantity, actual) { | ||
var _this = this; | ||
var msg = "Expect \"".concat(quantity, "\" dependency items for id \"").concat(prettyPrintIdentifier(id), "\" but get ").concat(actual, "."); | ||
_this = _super.call(this, msg) || this; | ||
return _this; | ||
return _super.call(this, msg) || this; | ||
} | ||
@@ -303,6 +297,4 @@ return QuantityCheckError; | ||
function DependencyNotFoundError(id) { | ||
var _this = this; | ||
var msg = "Cannot find \"".concat(prettyPrintIdentifier(id), "\" registered by any injector."); | ||
_this = _super.call(this, msg) || this; | ||
return _this; | ||
return _super.call(this, msg) || this; | ||
} | ||
@@ -309,0 +301,0 @@ return DependencyNotFoundError; |
@@ -25,6 +25,4 @@ var __extends = (this && this.__extends) || (function () { | ||
function DependencyDescriptorNotFoundError(index, target) { | ||
var _this = this; | ||
var msg = "Could not find dependency registered on the ".concat(index + 1, " parameter of the constructor of \"").concat(prettyPrintIdentifier(target), "\"."); | ||
_this = _super.call(this, msg) || this; | ||
return _this; | ||
return _super.call(this, msg) || this; | ||
} | ||
@@ -36,6 +34,4 @@ return DependencyDescriptorNotFoundError; | ||
function IdentifierUndefinedError(target, index) { | ||
var _this = this; | ||
var msg = "It seems that you register \"undefined\" as dependency on the ".concat(index + 1, " parameter of \"").concat(prettyPrintIdentifier(target), "\". Please make sure that there is not cyclic dependency among your TypeScript files, or consider using \"forwardRef\"."); | ||
_this = _super.call(this, msg) || this; | ||
return _this; | ||
return _super.call(this, msg) || this; | ||
} | ||
@@ -42,0 +38,0 @@ return IdentifierUndefinedError; |
import { DependencyIdentifier } from './dependencyIdentifier'; | ||
import { Ctor, DependencyItem } from './dependencyItem'; | ||
import { Disposable } from './dispose'; | ||
import { IDisposable } from './dispose'; | ||
import { Quantity } from './types'; | ||
import { RediError } from './error'; | ||
export declare type DependencyPair<T> = [DependencyIdentifier<T>, DependencyItem<T>]; | ||
export declare type DependencyClass<T> = [Ctor<T>]; | ||
export declare type Dependency<T = any> = DependencyPair<T> | DependencyClass<T>; | ||
export declare type DependencyOrInstance<T = any> = Dependency<T> | [Ctor<T> | DependencyIdentifier<T>, T]; | ||
export type DependencyPair<T> = [DependencyIdentifier<T>, DependencyItem<T>]; | ||
export type DependencyClass<T> = [Ctor<T>]; | ||
export type Dependency<T = any> = DependencyPair<T> | DependencyClass<T>; | ||
export type DependencyOrInstance<T = any> = Dependency<T> | [Ctor<T> | DependencyIdentifier<T>, T]; | ||
export declare function isBareClassDependency<T>(thing: Dependency<T>): thing is DependencyClass<T>; | ||
@@ -19,3 +19,3 @@ export declare class DependencyNotFoundError extends RediError { | ||
*/ | ||
export declare class DependencyCollection implements Disposable { | ||
export declare class DependencyCollection implements IDisposable { | ||
private readonly dependencyMap; | ||
@@ -44,3 +44,3 @@ constructor(dependencies: Dependency[]); | ||
*/ | ||
export declare class ResolvedDependencyCollection implements Disposable { | ||
export declare class ResolvedDependencyCollection implements IDisposable { | ||
private readonly resolvedDependencies; | ||
@@ -47,0 +47,0 @@ add<T>(id: DependencyIdentifier<T>, val: T | null): void; |
@@ -27,6 +27,4 @@ var __extends = (this && this.__extends) || (function () { | ||
function DependencyNotFoundError(id) { | ||
var _this = this; | ||
var msg = "Cannot find \"".concat(prettyPrintIdentifier(id), "\" registered by any injector."); | ||
_this = _super.call(this, msg) || this; | ||
return _this; | ||
return _super.call(this, msg) || this; | ||
} | ||
@@ -33,0 +31,0 @@ return DependencyNotFoundError; |
import { Ctor } from './dependencyItem'; | ||
import { ForwardRef } from './dependencyForwardRef'; | ||
export declare const IdentifierDecoratorSymbol: unique symbol; | ||
export declare type IdentifierDecorator<T> = { | ||
export type IdentifierDecorator<T> = { | ||
[IdentifierDecoratorSymbol]: true; | ||
@@ -13,3 +13,3 @@ (...args: any[]): void; | ||
}; | ||
export declare type DependencyIdentifier<T> = string | Ctor<T> | ForwardRef<T> | IdentifierDecorator<T>; | ||
export declare type NormalizedDependencyIdentifier<T> = Exclude<DependencyIdentifier<T>, ForwardRef<T>>; | ||
export type DependencyIdentifier<T> = string | Ctor<T> | ForwardRef<T> | IdentifierDecorator<T>; | ||
export type NormalizedDependencyIdentifier<T> = Exclude<DependencyIdentifier<T>, ForwardRef<T>>; |
@@ -18,4 +18,4 @@ import { DependencyIdentifier } from './dependencyIdentifier'; | ||
export declare function isClassDependencyItem<T>(thing: unknown): thing is ClassDependencyItem<T>; | ||
export declare type FactoryDepModifier = typeof Self | typeof SkipSelf | typeof Optional | typeof Many | typeof WithNew; | ||
export declare type FactoryDep<T> = [...FactoryDepModifier[], DependencyIdentifier<T>] | DependencyIdentifier<T>; | ||
export type FactoryDepModifier = typeof Self | typeof SkipSelf | typeof Optional | typeof Many | typeof WithNew; | ||
export type FactoryDep<T> = [...FactoryDepModifier[], DependencyIdentifier<T>] | DependencyIdentifier<T>; | ||
export interface FactoryDependencyItem<T> extends DependencyItemHooks<T> { | ||
@@ -39,4 +39,4 @@ useFactory: (...deps: any[]) => T; | ||
export declare function isAsyncHook<T>(thing: unknown): thing is AsyncHook<T>; | ||
export declare type SyncDependencyItem<T> = ClassDependencyItem<T> | FactoryDependencyItem<T> | ValueDependencyItem<T>; | ||
export declare type DependencyItem<T> = SyncDependencyItem<T> | AsyncDependencyItem<T>; | ||
export type SyncDependencyItem<T> = ClassDependencyItem<T> | FactoryDependencyItem<T> | ValueDependencyItem<T>; | ||
export type DependencyItem<T> = SyncDependencyItem<T> | AsyncDependencyItem<T>; | ||
export declare function prettyPrintIdentifier<T>(id: DependencyIdentifier<T>): string; |
@@ -23,6 +23,4 @@ var __extends = (this && this.__extends) || (function () { | ||
function QuantityCheckError(id, quantity, actual) { | ||
var _this = this; | ||
var msg = "Expect \"".concat(quantity, "\" dependency items for id \"").concat(prettyPrintIdentifier(id), "\" but get ").concat(actual, "."); | ||
_this = _super.call(this, msg) || this; | ||
return _this; | ||
return _super.call(this, msg) || this; | ||
} | ||
@@ -29,0 +27,0 @@ return QuantityCheckError; |
@@ -1,4 +0,4 @@ | ||
export interface Disposable { | ||
export interface IDisposable { | ||
dispose(): void; | ||
} | ||
export declare function isDisposable(thing: unknown): thing is Disposable; | ||
export declare function isDisposable(thing: unknown): thing is IDisposable; |
@@ -1,2 +0,2 @@ | ||
import { Disposable } from './dispose'; | ||
import { IDisposable } from './dispose'; | ||
export interface IdleDeadline { | ||
@@ -6,3 +6,3 @@ readonly didTimeout: boolean; | ||
} | ||
export declare type DisposableCallback = () => void; | ||
export type DisposableCallback = () => void; | ||
/** | ||
@@ -18,3 +18,3 @@ * this run the callback when CPU is idle. Will fallback to setTimeout if | ||
*/ | ||
export declare class IdleValue<T> implements Disposable { | ||
export declare class IdleValue<T> implements IDisposable { | ||
private readonly executor; | ||
@@ -21,0 +21,0 @@ private readonly disposeCallback; |
@@ -9,3 +9,3 @@ export { createIdentifier } from './decorators'; | ||
export { DependencyIdentifier, IdentifierDecorator } from './dependencyIdentifier'; | ||
export { Disposable } from './dispose'; | ||
export { IDisposable } from './dispose'; | ||
export { setDependencies } from './dependencyDeclare'; | ||
@@ -12,0 +12,0 @@ export { WithNew } from './dependencyWithNew'; |
@@ -98,6 +98,4 @@ var IdentifierDecoratorSymbol = Symbol('$$IDENTIFIER_DECORATOR'); | ||
function DependencyDescriptorNotFoundError(index, target) { | ||
var _this = this; | ||
var msg = "Could not find dependency registered on the ".concat(index + 1, " parameter of the constructor of \"").concat(prettyPrintIdentifier(target), "\"."); | ||
_this = _super.call(this, msg) || this; | ||
return _this; | ||
return _super.call(this, msg) || this; | ||
} | ||
@@ -109,6 +107,4 @@ return DependencyDescriptorNotFoundError; | ||
function IdentifierUndefinedError(target, index) { | ||
var _this = this; | ||
var msg = "It seems that you register \"undefined\" as dependency on the ".concat(index + 1, " parameter of \"").concat(prettyPrintIdentifier(target), "\". Please make sure that there is not cyclic dependency among your TypeScript files, or consider using \"forwardRef\"."); | ||
_this = _super.call(this, msg) || this; | ||
return _this; | ||
return _super.call(this, msg) || this; | ||
} | ||
@@ -210,6 +206,4 @@ return IdentifierUndefinedError; | ||
function QuantityCheckError(id, quantity, actual) { | ||
var _this = this; | ||
var msg = "Expect \"".concat(quantity, "\" dependency items for id \"").concat(prettyPrintIdentifier(id), "\" but get ").concat(actual, "."); | ||
_this = _super.call(this, msg) || this; | ||
return _this; | ||
return _super.call(this, msg) || this; | ||
} | ||
@@ -297,6 +291,4 @@ return QuantityCheckError; | ||
function DependencyNotFoundError(id) { | ||
var _this = this; | ||
var msg = "Cannot find \"".concat(prettyPrintIdentifier(id), "\" registered by any injector."); | ||
_this = _super.call(this, msg) || this; | ||
return _this; | ||
return _super.call(this, msg) || this; | ||
} | ||
@@ -303,0 +295,0 @@ return DependencyNotFoundError; |
{ | ||
"$schema": "https://raw.githubusercontent.com/wzhudev/squirrel/master/src/schema/package.schema.json", | ||
"name": "@wendellhu/redi", | ||
"version": "0.10.0", | ||
"version": "0.11.0", | ||
"description": "A dependency library for TypeScript and JavaScript, along with a binding for React.", | ||
@@ -6,0 +6,0 @@ "author": "Wenzhao Hu<wzhudev@outlook.com>", |
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
422725
4250