@aurelia/kernel
Advanced tools
Comparing version 2.1.0-dev.202401310648 to 2.1.0-dev.202402270447
@@ -6,2 +6,14 @@ # Change Log | ||
<a name="2.0.0-beta.11"></a> | ||
# 2.0.0-beta.11 (2024-02-13) | ||
### Features: | ||
* **state:** support redux devtools for the state plugin (#1888) ([bd07160](https://github.com/aurelia/aurelia/commit/bd07160)) | ||
### Bug Fixes: | ||
* ***:** upgrade rollup, tweak build scripts ([bd07160](https://github.com/aurelia/aurelia/commit/bd07160)) | ||
<a name="2.0.0-beta.10"></a> | ||
@@ -8,0 +20,0 @@ # 2.0.0-beta.10 (2024-01-26) |
import { type Key, type IResolver, type Resolved, type IFactoryResolver, type ILazyResolver, type INewInstanceResolver, type IResolvedFactory, type IResolvedLazy, type IAllResolver, type IOptionalResolver } from './di'; | ||
export type IResolvedInjection<K extends Key> = K extends IAllResolver<infer R> ? readonly Resolved<R>[] : K extends INewInstanceResolver<infer R> ? Resolved<R> : K extends ILazyResolver<infer R> ? IResolvedLazy<R> : K extends IOptionalResolver<infer R> ? Resolved<R> | undefined : K extends IFactoryResolver<infer R> ? IResolvedFactory<R> : K extends IResolver<infer R> ? Resolved<R> : K extends [infer R1 extends Key, ...infer R2] ? [IResolvedInjection<R1>, ...IResolvedInjection<R2>] : Resolved<K>; | ||
export type IResolvedInjection<K extends Key> = K extends IAllResolver<infer R> ? readonly Resolved<R>[] : K extends INewInstanceResolver<infer R> ? Resolved<R> : K extends ILazyResolver<infer R> ? IResolvedLazy<R> : K extends IOptionalResolver<infer R> ? Resolved<R> | undefined : K extends IFactoryResolver<infer R> ? IResolvedFactory<R> : K extends IResolver<infer R> ? Resolved<R> : K extends [infer R1 extends Key, ...infer R2] ? [IResolvedInjection<R1>, ...IResolvedInjection<R2>] : K extends { | ||
__resolved__: infer T; | ||
} ? T : Resolved<K>; | ||
/** | ||
@@ -4,0 +6,0 @@ * Retrieve the resolved value of a key, or values of a list of keys from the currently active container. |
{ | ||
"name": "@aurelia/kernel", | ||
"version": "2.1.0-dev.202401310648", | ||
"version": "2.1.0-dev.202402270447", | ||
"main": "dist/cjs/index.cjs", | ||
@@ -55,4 +55,4 @@ "module": "dist/esm/index.mjs", | ||
"dependencies": { | ||
"@aurelia/metadata": "2.1.0-dev.202401310648", | ||
"@aurelia/platform": "2.1.0-dev.202401310648" | ||
"@aurelia/metadata": "2.1.0-dev.202402270447", | ||
"@aurelia/platform": "2.1.0-dev.202402270447" | ||
}, | ||
@@ -59,0 +59,0 @@ "devDependencies": { |
@@ -288,7 +288,5 @@ /* eslint-disable @typescript-eslint/no-this-alias */ | ||
public has<K extends Key>(key: K, searchAncestors: boolean = false): boolean { | ||
return this._resolvers.has(key) || isResourceKey(key) && key in this.res | ||
? true | ||
: searchAncestors && this._parent != null | ||
? this._parent.has(key, true) | ||
: false; | ||
return this._resolvers.has(key) | ||
|| isResourceKey(key) && key in this.res | ||
|| ((searchAncestors && this._parent?.has(key, true)) ?? false); | ||
} | ||
@@ -516,20 +514,2 @@ | ||
if (hasResources(keyAsValue)) { | ||
const defs = getAllResources(keyAsValue); | ||
if (defs.length === 1) { | ||
// Fast path for the very common case | ||
defs[0].register(handler); | ||
} else { | ||
const len = defs.length; | ||
for (let d = 0; d < len; ++d) { | ||
defs[d].register(handler); | ||
} | ||
} | ||
const newResolver = handler._resolvers.get(keyAsValue); | ||
if (newResolver != null) { | ||
return newResolver; | ||
} | ||
throw createMappedError(ErrorNames.null_resolver_from_register, keyAsValue); | ||
} | ||
if (keyAsValue.$isInterface) { | ||
@@ -608,3 +588,5 @@ throw createMappedError(ErrorNames.no_jit_interface, keyAsValue.friendlyName); | ||
? [IResolvedInjection<R1>, ...IResolvedInjection<R2>] | ||
: Resolved<K>; | ||
: K extends { __resolved__: infer T } | ||
? T | ||
: Resolved<K>; | ||
@@ -611,0 +593,0 @@ /** |
@@ -752,5 +752,14 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
const hasDefault = isFunction((key as unknown as IRegistry).register); | ||
const resolver = handler.getResolver(key, hasDefault) as IResolver<Constructable<typeof key>>; | ||
const factory = resolver?.getFactory?.(handler); | ||
// 2.1 and has factory | ||
const resolver = handler.getResolver(key, false) as IResolver<Constructable<typeof key>>; | ||
let factory: IFactory | null | undefined; | ||
if (resolver == null) { | ||
if (hasDefault) { | ||
// creating a child as we do not want to pollute the resolver registry | ||
// there may be a better way but wasting a container probably isn't the worst | ||
factory = createContainer().getResolver(key, true)?.getFactory?.(handler); | ||
} | ||
} else { | ||
factory = resolver.getFactory?.(handler); | ||
} | ||
// 2.1 and has resolvable factory | ||
if (factory != null) { | ||
@@ -757,0 +766,0 @@ return factory.construct(requestor); |
@@ -55,3 +55,4 @@ /* eslint-disable prefer-template */ | ||
[ErrorNames.no_active_container_for_resolve]: `There is not a currently active container to resolve "{{0}}". Are you trying to "new Class(...)" that has a resolve(...) call?`, | ||
[ErrorNames.invalid_new_instance_on_interface]: `Failed to instantiate '{{0}}' via @newInstanceOf/@newInstanceForScope, there's no registration and no default implementation.`, | ||
[ErrorNames.invalid_new_instance_on_interface]: `Failed to instantiate '{{0}}' via @newInstanceOf/@newInstanceForScope, there's no registration and no default implementation,` | ||
+ ` or the default implementation does not result in factory for constructing the instances.`, | ||
[ErrorNames.event_aggregator_publish_invalid_event_name]: `Invalid channel name or instance: '{{0}}'.`, | ||
@@ -58,0 +59,0 @@ [ErrorNames.event_aggregator_subscribe_invalid_event_name]: `Invalid channel name or type: {{0}}.`, |
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
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
984336
17281
+ Added@aurelia/metadata@2.1.0-dev.202402270447(transitive)
+ Added@aurelia/platform@2.1.0-dev.202402270447(transitive)
- Removed@aurelia/metadata@2.1.0-dev.202401310648(transitive)
- Removed@aurelia/platform@2.1.0-dev.202401310648(transitive)