@furystack/inject
Advanced tools
Comparing version 7.1.9 to 8.0.0
{ | ||
"name": "@furystack/inject", | ||
"version": "7.1.9", | ||
"version": "8.0.0", | ||
"description": "Core FuryStack package", | ||
"main": "dist/index.js", | ||
"type": "module", | ||
"scripts": { | ||
"build:es6": "tsc --outDir ./esm" | ||
}, | ||
"exports": { | ||
".": { | ||
"import": "./esm/index.js", | ||
"types": "./types/index.d.ts" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"typesVersions": { | ||
"*": { | ||
"*": [ | ||
"types/*" | ||
] | ||
} | ||
}, | ||
"files": [ | ||
@@ -32,9 +49,9 @@ "dist", | ||
"dependencies": { | ||
"@furystack/utils": "^3.1.8" | ||
"@furystack/utils": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^29.5.0" | ||
"typescript": "^5.0.4", | ||
"vitest": "^0.30.1" | ||
}, | ||
"typings": "./types/index.d.ts", | ||
"gitHead": "1045d854bfd8c475b7035471d130d401417a2321" | ||
} |
import { Injectable } from './injectable' | ||
import { Injector } from './injector' | ||
import { describe, expect, it } from 'vitest' | ||
@@ -4,0 +5,0 @@ describe('@Injectable()', () => { |
@@ -20,3 +20,2 @@ import { Injector } from './injector' | ||
* Decorator method for tagging a class as injectable | ||
* | ||
* @param options The options object | ||
@@ -23,0 +22,0 @@ * @returns void |
import { Injected } from './injected' | ||
import { Injector } from './injector' | ||
import { describe, expect, it } from 'vitest' | ||
describe('@Injected()', () => { | ||
@@ -4,0 +5,0 @@ it('Should register into the injectable fields', () => { |
@@ -6,2 +6,3 @@ import type { Disposable } from '@furystack/utils' | ||
import { Injector } from './injector' | ||
import { describe, expect, it, vi } from 'vitest' | ||
@@ -136,6 +137,7 @@ describe('Injector', () => { | ||
it('Should dispose cached entries on dispose and tolerate non-disposable ones', (done) => { | ||
it('Should dispose cached entries on dispose and tolerate non-disposable ones', async () => { | ||
const doneCallback = vi.fn() | ||
class TestDisposable implements Disposable { | ||
public dispose() { | ||
done() | ||
doneCallback() | ||
} | ||
@@ -145,6 +147,7 @@ } | ||
usingAsync(new Injector(), async (i) => { | ||
await usingAsync(new Injector(), async (i) => { | ||
i.setExplicitInstance(new TestDisposable()) | ||
i.setExplicitInstance(new TestInstance()) | ||
}) | ||
expect(doneCallback).toBeCalledTimes(1) | ||
}) | ||
@@ -170,3 +173,3 @@ | ||
expect(() => i.getInstance(UndecoratedTestClass, [Injector])).toThrowError( | ||
`No metadata found for 'UndecoratedTestClass'. Dependencies: Injector. Be sure that it's decorated with '@Injectable()' or added explicitly with SetInstance()`, | ||
`No metadata found for 'UndecoratedTestClass'. Dependencies: _Injector. Be sure that it's decorated with '@Injectable()' or added explicitly with SetInstance()`, | ||
) | ||
@@ -173,0 +176,0 @@ }) |
@@ -119,3 +119,2 @@ import type { Disposable } from '@furystack/utils' | ||
* Sets explicitliy an instance for a key in the store | ||
* | ||
* @param instance The created instance | ||
@@ -135,3 +134,2 @@ * @param key The class key to be persisted (optional, calls back to the instance's constructor) | ||
* Creates a child injector instance | ||
* | ||
* @param options Additional injector options | ||
@@ -138,0 +136,0 @@ * @returns the created Injector |
@@ -14,3 +14,2 @@ import type { Constructable } from './models/constructable'; | ||
* Decorator method for tagging a class as injectable | ||
* | ||
* @param options The options object | ||
@@ -17,0 +16,0 @@ * @returns void |
@@ -34,3 +34,2 @@ import type { Disposable } from '@furystack/utils'; | ||
* Sets explicitliy an instance for a key in the store | ||
* | ||
* @param instance The created instance | ||
@@ -42,3 +41,2 @@ * @param key The class key to be persisted (optional, calls back to the instance's constructor) | ||
* Creates a child injector instance | ||
* | ||
* @param options Additional injector options | ||
@@ -45,0 +43,0 @@ * @returns the created Injector |
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
Yes
44276
2
25
478
+ Added@furystack/utils@4.0.17(transitive)
- Removed@furystack/utils@3.1.8(transitive)
Updated@furystack/utils@^4.0.0