@adonisjs/fold
Advanced tools
Comparing version 6.3.4 to 6.3.5
/// <reference types="node" /> | ||
import { EventEmitter } from 'events'; | ||
/** | ||
* Shape of class constructor | ||
*/ | ||
declare type Constructor<T> = new (...args: any[]) => T; | ||
/** | ||
* Shape of class constructor with `makePlain` property | ||
*/ | ||
declare type PlainConstructor = { | ||
new (...args: any[]): any; | ||
makePlain: boolean; | ||
}; | ||
/** | ||
* The intefered type of the `make` function | ||
*/ | ||
export declare type MakeInferedType<T extends any> = T extends string | LookupNode ? any : (T extends PlainConstructor ? T : (T extends Constructor<infer A> ? A : T)); | ||
/** | ||
* Custom traces must implement this interface | ||
@@ -20,6 +35,5 @@ */ | ||
/** | ||
* The resolve is used to resolve and cache IoC container | ||
* bindings that are meant to stay static through out | ||
* the application and reduce the cost of lookup | ||
* on each iteration. | ||
* The resolve is used to resolve and cache IoC container bindings that | ||
* are meant to stay static through out the application and reduce | ||
* the cost of lookup on each iteration. | ||
*/ | ||
@@ -46,3 +60,3 @@ export interface IocResolverContract { | ||
use<T extends any = any>(namespace: string | LookupNode): T; | ||
make<T extends any = any>(namespace: string | LookupNode, args?: any[]): T; | ||
make<T extends any>(namespace: T, args?: any[]): MakeInferedType<T>; | ||
useFake<T extends any = any>(namespace: string, value?: any): T; | ||
@@ -93,3 +107,10 @@ hasFake(namespace: string): boolean; | ||
}; | ||
/** | ||
* Shape of the bind callback method | ||
*/ | ||
export declare type BindCallback = (app: IocContract) => unknown; | ||
/** | ||
* Shape of the fake callback method | ||
*/ | ||
export declare type BindFakeCallback = (app: IocContract, value?: any) => unknown; | ||
export {}; |
import { IocResolver } from '../Resolver'; | ||
import { LookupNode, IocContract, BindCallback, BindFakeCallback } from '../Contracts'; | ||
import { LookupNode, IocContract, BindCallback, MakeInferedType, BindFakeCallback } from '../Contracts'; | ||
/** | ||
@@ -13,2 +13,5 @@ * Ioc container to manage and compose dependencies of your application | ||
private emitEvents; | ||
/** | ||
* For emitting emits | ||
*/ | ||
tracer: import("./Tracer").Tracer; | ||
@@ -23,3 +26,4 @@ /** | ||
* An array of autoloaded aliases, stored along side with | ||
* `autoloads` for a quick lookup on keys | ||
* `autoloads` for a quick lookup on keys vs doing | ||
* `Object.keys` everytime | ||
*/ | ||
@@ -49,2 +53,6 @@ autoloadedAliases: string[]; | ||
private proxiesEnabled; | ||
/** | ||
* Injector is used for injecting dependencies to the class constructor | ||
* and the methods | ||
*/ | ||
private injector; | ||
@@ -209,3 +217,3 @@ constructor(emitEvents?: boolean); | ||
*/ | ||
make<T extends any = any>(node: any, args?: any[]): T; | ||
make<T extends any>(node: T, args?: any[]): MakeInferedType<T>; | ||
/** | ||
@@ -212,0 +220,0 @@ * Use the fake for a given namespace. You don't have to manually |
@@ -33,2 +33,5 @@ "use strict"; | ||
this.emitEvents = emitEvents; | ||
/** | ||
* For emitting emits | ||
*/ | ||
this.tracer = Tracer_1.default(this.emitEvents); | ||
@@ -41,3 +44,4 @@ /** | ||
* An array of autoloaded aliases, stored along side with | ||
* `autoloads` for a quick lookup on keys | ||
* `autoloads` for a quick lookup on keys vs doing | ||
* `Object.keys` everytime | ||
*/ | ||
@@ -67,2 +71,6 @@ this.autoloadedAliases = []; | ||
this.proxiesEnabled = false; | ||
/** | ||
* Injector is used for injecting dependencies to the class constructor | ||
* and the methods | ||
*/ | ||
this.injector = new Injector_1.Injector(this); | ||
@@ -69,0 +77,0 @@ } |
@@ -34,8 +34,24 @@ "use strict"; | ||
getPrefixNamespace() { | ||
/** | ||
* Use fallback namespace, when lookup inside rcFile is not required | ||
*/ | ||
if (!this.rcNamespaceKey) { | ||
return this.fallbackNamespace; | ||
} | ||
/** | ||
* If container doesn't have `Application` binding, then there is no | ||
* way for us to read rcFile namespaces and hence we use the fallback | ||
* namespace | ||
*/ | ||
if (!this.container.hasBinding('Adonis/Core/Application')) { | ||
return this.fallbackNamespace; | ||
} | ||
/** | ||
* Attempt to resolve the rcNamespace key from the rcFile | ||
* For example: The rc file has following namespaces | ||
* { | ||
* "controllers": "App/Controllers/Http" | ||
* } | ||
* We will use the value next to the `controllers` key | ||
*/ | ||
const application = this.container.use('Adonis/Core/Application'); | ||
@@ -68,6 +84,6 @@ return application.namespacesMap.get(this.rcNamespaceKey) || this.fallbackNamespace; | ||
* Raise exception when unable to resolve the binding from the container. | ||
* NOTE: We are not making fetching the binding, we are just checking | ||
* for it's existence. In case of autoloads, it's quite possible | ||
* that the binding check passes and the actual file is missing | ||
* on the disk | ||
* NOTE: We are notfetching the binding, we are just checking for it's | ||
* existence. In case of autoloads, it's quite possible that the | ||
* binding check passes and the actual file is missing on the | ||
* disk | ||
*/ | ||
@@ -74,0 +90,0 @@ if (!lookupNode) { |
{ | ||
"name": "@adonisjs/fold", | ||
"version": "6.3.4", | ||
"version": "6.3.5", | ||
"description": "Dependency manager and ioc container for your next NodeJs application", | ||
@@ -42,6 +42,6 @@ "main": "build/index.js", | ||
"devDependencies": { | ||
"@adonisjs/mrm-preset": "^2.2.4", | ||
"@poppinss/dev-utils": "^1.0.4", | ||
"@types/node": "^13.7.7", | ||
"commitizen": "^4.0.3", | ||
"@adonisjs/mrm-preset": "^2.3.0", | ||
"@poppinss/dev-utils": "^1.0.5", | ||
"@types/node": "^13.11.1", | ||
"commitizen": "^4.0.4", | ||
"cz-conventional-changelog": "^3.1.0", | ||
@@ -51,9 +51,9 @@ "del-cli": "^3.0.0", | ||
"eslint": "^6.8.0", | ||
"eslint-plugin-adonis": "^1.0.8", | ||
"eslint-plugin-adonis": "^1.0.9", | ||
"husky": "^4.2.3", | ||
"japa": "^3.0.1", | ||
"mrm": "^2.1.0", | ||
"mrm": "^2.2.0", | ||
"np": "^5.2.1", | ||
"reflect-metadata": "^0.1.13", | ||
"ts-node": "^8.6.2", | ||
"ts-node": "^8.8.2", | ||
"typescript": "^3.8.3" | ||
@@ -84,4 +84,3 @@ }, | ||
"dependencies": { | ||
"@poppinss/utils": "^2.1.2", | ||
"resolve-from": "^5.0.0" | ||
"@poppinss/utils": "^2.2.0" | ||
}, | ||
@@ -88,0 +87,0 @@ "publishConfig": { |
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
73858
1
1865
- Removedresolve-from@^5.0.0
Updated@poppinss/utils@^2.2.0