@aurelia/kernel
Advanced tools
Comparing version 2.1.0-dev.202305021031 to 2.1.0-dev.202305122230
{ | ||
"name": "@aurelia/kernel", | ||
"version": "2.1.0-dev.202305021031", | ||
"version": "2.1.0-dev.202305122230", | ||
"main": "dist/cjs/index.cjs", | ||
@@ -51,4 +51,4 @@ "module": "dist/esm/index.mjs", | ||
"dependencies": { | ||
"@aurelia/metadata": "2.1.0-dev.202305021031", | ||
"@aurelia/platform": "2.1.0-dev.202305021031" | ||
"@aurelia/metadata": "2.1.0-dev.202305122230", | ||
"@aurelia/platform": "2.1.0-dev.202305122230" | ||
}, | ||
@@ -55,0 +55,0 @@ "devDependencies": { |
@@ -32,8 +32,2 @@ /* eslint-disable @typescript-eslint/no-this-alias */ | ||
type IOptionalResolver, | ||
all, | ||
lazy, | ||
factory, | ||
optional, | ||
newInstanceForScope, | ||
newInstanceOf | ||
} from './di'; | ||
@@ -354,3 +348,2 @@ | ||
if (current == null) { | ||
currentContainer = previousContainer; | ||
return emptyArray; | ||
@@ -617,20 +610,2 @@ } | ||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/ban-ts-comment, prefer-const */ | ||
function testResolve() { | ||
class Abc { public a = 1; } | ||
class Def { public b = 2; } | ||
class Abc2 { public c = '3'; } | ||
const [{ a: _ }] = resolve(all(Abc)); | ||
const [ [{ a: a_ }], [{ b: b_ }], [{ c: c_ }]] = resolve(all(Abc), all(Def), all(Abc2)); | ||
let [{ a }, { b }, { c }, lazyDef, factoryAbc2, optionalAbc, newDef, newAbc] = resolve(Abc, Def, Abc2, lazy(Def), factory(Abc2), optional(Abc), newInstanceForScope(Def), newInstanceOf(Abc)); | ||
a = 3; b = 4; c = '1'; | ||
lazyDef().b = 5; | ||
factoryAbc2(1, 2, 3).c = '2'; | ||
// @ts-expect-error | ||
if (optionalAbc.a) {/* */} | ||
newDef.b = 4; | ||
newAbc.a = 2; | ||
} | ||
/* eslint-enable @typescript-eslint/no-unused-vars, @typescript-eslint/ban-ts-comment, prefer-const */ | ||
const buildAllResponse = (resolver: IResolver, handler: IContainer, requestor: IContainer): any[] => { | ||
@@ -637,0 +612,0 @@ if (resolver instanceof Resolver && resolver._strategy === ResolverStrategy.array) { |
@@ -582,22 +582,2 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
function testAll() { | ||
const d = DI.createContainer(); | ||
const I = DI.createInterface<I>(); | ||
interface I { | ||
c: number; | ||
} | ||
const instances = d.get(all(class Abc { public b: number = 5; })); | ||
instances.forEach(i => i.b); | ||
const ii = d.get(all(I)); | ||
ii.forEach(i => i.c); | ||
class Def { | ||
public constructor(@all(I) private readonly i: I) {} | ||
} | ||
@inject(all(I)) | ||
class G {} | ||
} | ||
/** | ||
@@ -640,24 +620,2 @@ * Lazily inject a dependency depending on whether the [[`Key`]] is present at the time of function call. | ||
function testLazy() { | ||
const d = DI.createContainer(); | ||
const I = DI.createInterface<I>(); | ||
interface I { | ||
c: number; | ||
} | ||
const instance = d.get(lazy(class Abc { public b: number = 5; })); | ||
if (instance().b === 5) { | ||
// good | ||
} | ||
class Def { | ||
public constructor(@lazy(I) private readonly i: I) {} | ||
} | ||
@inject(lazy(I)) | ||
class G { | ||
public i = resolve(lazy(I)); | ||
public b: I = this.i(); | ||
} | ||
} | ||
/** | ||
@@ -699,28 +657,2 @@ * Allows you to optionally inject a dependency depending on whether the [[`Key`]] is present, for example | ||
function testOptional() { | ||
const d = DI.createContainer(); | ||
const I = DI.createInterface<I>(); | ||
interface I { | ||
c: number; | ||
} | ||
const instance = d.get(optional(class Abc { public b: number = 5; })); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-expect-error | ||
if (instance.b === 5) { | ||
// good | ||
} | ||
class Def { | ||
public constructor(@optional(I) private readonly i: I) {} | ||
} | ||
@inject(optional(I)) | ||
class G { | ||
public i = resolve(optional(I)); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-expect-error | ||
public b: I = this.i; | ||
} | ||
} | ||
/** | ||
@@ -808,33 +740,2 @@ * ignore tells the container not to try to inject a dependency | ||
function testNewInstance() { | ||
const d = DI.createContainer(); | ||
const I = DI.createInterface<I>(); | ||
interface I { | ||
c: number; | ||
} | ||
const instance = d.get(newInstanceOf(class Abc { public b: number = 5; })); | ||
if (instance.b === 5) { | ||
// good | ||
} | ||
const instance2 = d.get(newInstanceForScope(class Abc { public b: number = 5; })); | ||
if (instance2.b === 5) { | ||
// good | ||
} | ||
class Def { | ||
public constructor( | ||
@newInstanceOf(I) private readonly i: I, | ||
@newInstanceForScope(I) private readonly j: I, | ||
) {} | ||
} | ||
@inject(newInstanceOf(I)) | ||
class G { | ||
public i = resolve(newInstanceOf(I)); | ||
public ii: I = this.i; | ||
public j = resolve(newInstanceForScope(I)); | ||
public jj: I = this.j; | ||
} | ||
} | ||
_START_CONST_ENUM(); | ||
@@ -841,0 +742,0 @@ /** @internal */ |
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
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
37
732918
14779
+ Added@aurelia/metadata@2.1.0-dev.202305122230(transitive)
+ Added@aurelia/platform@2.1.0-dev.202305122230(transitive)
- Removed@aurelia/metadata@2.1.0-dev.202305021031(transitive)
- Removed@aurelia/platform@2.1.0-dev.202305021031(transitive)