Comparing version 4.2.4 to 4.2.5
@@ -0,1 +1,5 @@ | ||
# v4.2.5 | ||
- Add optional generic parameter to container typing. Allows for a typed `ICradle`. ([#169](https://github.com/jeffijoe/awilix/pull/169), [roikoren755](https://github.com/roikoren755)) | ||
# v4.2.4 | ||
@@ -7,3 +11,3 @@ | ||
- Fix issue where calling `JSON.stringify` on the cradle would result in memory leak ([#153](https://github.com/jeffijoe/awilix/pull/119), [berndartmueller](https://github.com/berndartmueller)) | ||
- Fix issue where calling `JSON.stringify` on the cradle would result in memory leak ([#153](https://github.com/jeffijoe/awilix/pull/153), [berndartmueller](https://github.com/berndartmueller)) | ||
- Update packages | ||
@@ -10,0 +14,0 @@ |
@@ -1213,3 +1213,3 @@ import { sync } from 'glob'; | ||
options, | ||
cradle: cradle, | ||
cradle, | ||
inspect: inspect$1, | ||
@@ -1216,0 +1216,0 @@ cache: new Map(), |
@@ -9,3 +9,3 @@ import { GlobWithOptions } from './list-modules'; | ||
*/ | ||
export interface AwilixContainer { | ||
export interface AwilixContainer<Cradle extends object = any> { | ||
/** | ||
@@ -19,3 +19,3 @@ * Options the container was configured with. | ||
*/ | ||
readonly cradle: any; | ||
readonly cradle: Cradle; | ||
/** | ||
@@ -32,3 +32,3 @@ * Getter for the rolled up registrations that merges the container family tree. | ||
*/ | ||
createScope(): AwilixContainer; | ||
createScope<T extends object = any>(): AwilixContainer<Cradle & T>; | ||
/** | ||
@@ -55,3 +55,3 @@ * Used by `util.inspect`. | ||
*/ | ||
register(nameAndRegistrationPair: NameAndRegistrationPair): this; | ||
register(nameAndRegistrationPair: NameAndRegistrationPair<Cradle>): this; | ||
/** | ||
@@ -106,11 +106,11 @@ * Resolves the registration with the given name. | ||
*/ | ||
export interface CacheEntry { | ||
export interface CacheEntry<T = any> { | ||
/** | ||
* The resolver that resolved the value. | ||
*/ | ||
resolver: Resolver<any>; | ||
resolver: Resolver<T>; | ||
/** | ||
* The resolved value. | ||
*/ | ||
value: any; | ||
value: T; | ||
} | ||
@@ -121,5 +121,5 @@ /** | ||
*/ | ||
export interface NameAndRegistrationPair { | ||
[key: string]: Resolver<any>; | ||
} | ||
export declare type NameAndRegistrationPair<T> = { | ||
[U in keyof T]?: Resolver<T[U]>; | ||
}; | ||
/** | ||
@@ -162,2 +162,2 @@ * Function that returns T. | ||
*/ | ||
export declare function createContainer(options?: ContainerOptions, parentContainer?: AwilixContainer): AwilixContainer; | ||
export declare function createContainer<T extends object = any, U extends object = any>(options?: ContainerOptions, parentContainer?: AwilixContainer<U>): AwilixContainer<T>; |
@@ -98,3 +98,3 @@ "use strict"; | ||
options, | ||
cradle: cradle, | ||
cradle, | ||
inspect, | ||
@@ -101,0 +101,0 @@ cache: new Map(), |
@@ -16,3 +16,3 @@ import { LifetimeType } from './lifetime'; | ||
*/ | ||
export declare type InjectorFunction = (container: AwilixContainer) => object; | ||
export declare type InjectorFunction = <T extends object>(container: AwilixContainer<T>) => object; | ||
/** | ||
@@ -22,3 +22,3 @@ * A resolver object returned by asClass(), asFunction() or asValue(). | ||
export interface Resolver<T> extends ResolverOptions<T> { | ||
resolve(container: AwilixContainer): T; | ||
resolve<U extends object>(container: AwilixContainer<U>): T; | ||
} | ||
@@ -25,0 +25,0 @@ /** |
{ | ||
"name": "awilix", | ||
"version": "4.2.4", | ||
"version": "4.2.5", | ||
"description": "Extremely powerful dependency injection container.", | ||
@@ -53,9 +53,9 @@ "main": "lib/awilix.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.8.4", | ||
"@babel/core": "^7.8.6", | ||
"@babel/plugin-transform-runtime": "^7.8.3", | ||
"@babel/preset-env": "^7.8.4", | ||
"@babel/preset-env": "^7.8.6", | ||
"@babel/runtime": "^7.8.4", | ||
"@types/glob": "^7.1.1", | ||
"@types/jest": "^25.1.3", | ||
"@types/node": "^13.7.4", | ||
"@types/node": "^13.7.6", | ||
"@types/prettier": "^1.19.0", | ||
@@ -67,5 +67,5 @@ "babel-jest": "^25.1.0", | ||
"jest": "^25.1.0", | ||
"lint-staged": "^10.0.7", | ||
"lint-staged": "^10.0.8", | ||
"prettier": "^1.19.1", | ||
"rollup": "^1.31.1", | ||
"rollup": "^1.32.0", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
@@ -77,7 +77,7 @@ "rollup-plugin-node-resolve": "^5.2.0", | ||
"ts-jest": "^25.2.1", | ||
"tslib": "^1.10.0", | ||
"tslib": "^1.11.1", | ||
"tslint": "^6.0.0", | ||
"tslint-config-prettier": "^1.18.0", | ||
"tslint-config-standard": "^9.0.0", | ||
"typescript": "^3.7.5" | ||
"typescript": "^3.8.2" | ||
}, | ||
@@ -84,0 +84,0 @@ "dependencies": { |
@@ -1338,6 +1338,6 @@ # Awilix | ||
Clone repo, run `npm i` to install all dependencies, run `npm run build` to create an initial build, and then | ||
`npm run test -- --watchAll` to start writing code. | ||
Clone repo, run `yarn` to install all dependencies, run `yarn build` to create an initial build, and then | ||
`yarn test --watchAll` to start writing code. | ||
For code coverage, run `npm run cover`. | ||
For code coverage, run `yarn cover`. | ||
@@ -1344,0 +1344,0 @@ If you submit a PR, please aim for 100% code coverage and no linting errors. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
305336