@aurelia/kernel
Advanced tools
Comparing version 2.1.0-dev.202307101053 to 2.1.0-dev.202401061915
@@ -6,2 +6,24 @@ # Change Log | ||
<a name="2.0.0-beta.9"></a> | ||
# 2.0.0-beta.9 (2023-12-12) | ||
**Note:** Version bump only for package @aurelia/kernel | ||
<a name="2.0.0-beta.8"></a> | ||
# 2.0.0-beta.8 (2023-07-24) | ||
### Features: | ||
* **template:** access global (#1790) ([2486b58](https://github.com/aurelia/aurelia/commit/2486b58)) | ||
### Bug Fixes: | ||
* **au-slot:** correctly prepare resources for slotted view (#1802) ([bf1ca4c](https://github.com/aurelia/aurelia/commit/bf1ca4c)) | ||
### Refactorings: | ||
* **ref:** deprecate view-model.ref and introduce component.ref (#1803) ([97e8dad](https://github.com/aurelia/aurelia/commit/97e8dad)) | ||
<a name="2.0.0-beta.7"></a> | ||
@@ -8,0 +30,0 @@ # 2.0.0-beta.7 (2023-06-16) |
@@ -46,2 +46,3 @@ import { Constructable, IDisposable } from './interfaces'; | ||
readonly root: IContainer; | ||
readonly parent: IContainer | null; | ||
register(...params: any[]): IContainer; | ||
@@ -48,0 +49,0 @@ registerResolver<K extends Key, T = K>(key: K, resolver: IResolver<T>, isDisposable?: boolean): IResolver<T>; |
import { IContainer } from './di'; | ||
import { Constructable } from './interfaces'; | ||
export type ResourceType<TUserType extends Constructable = Constructable, TResInstance extends {} = {}, TResType extends {} = {}, TUserInstance extends InstanceType<TUserType> = InstanceType<TUserType>> = (new (...args: unknown[]) => TResInstance & TUserInstance) & { | ||
export type ResourceType<TUserType extends Constructable = Constructable, TResInstance extends {} = {}, TResType extends {} = {}, TUserInstance extends InstanceType<TUserType> = InstanceType<TUserType>> = (new (...args: any[]) => TResInstance & TUserInstance) & { | ||
readonly aliases?: readonly string[]; | ||
@@ -5,0 +5,0 @@ } & TResType & TUserType; |
{ | ||
"name": "@aurelia/kernel", | ||
"version": "2.1.0-dev.202307101053", | ||
"version": "2.1.0-dev.202401061915", | ||
"main": "dist/cjs/index.cjs", | ||
"module": "dist/esm/index.mjs", | ||
"exports": { | ||
"types": "./dist/types/index.d.ts", | ||
"require": "./dist/cjs/index.cjs", | ||
"import": "./dist/esm/index.mjs", | ||
"development": "./dist/esm/index.dev.mjs" | ||
".": { | ||
"types": "./dist/types/index.d.ts", | ||
"require": "./dist/cjs/index.cjs", | ||
"import": "./dist/esm/index.mjs", | ||
"development": "./dist/esm/index.dev.mjs" | ||
}, | ||
"./development": { | ||
"types": "./dist/types/index.d.ts", | ||
"require": "./dist/cjs/index.dev.cjs", | ||
"import": "./dist/esm/index.dev.mjs" | ||
} | ||
}, | ||
@@ -27,7 +34,3 @@ "types": "dist/types/index.d.ts", | ||
"files": [ | ||
"dist/**/*.cjs", | ||
"dist/**/*.dev.cjs.map", | ||
"dist/**/*.mjs", | ||
"dist/**/*.dev.mjs.map", | ||
"dist/**/*.d.ts", | ||
"dist", | ||
"src/**/*.ts", | ||
@@ -40,3 +43,3 @@ "README.md", | ||
"lint": "eslint --cache --ext .js,.ts src/", | ||
"lint:ci": "eslint --cache --ext .js,.ts --quiet --report-unused-disable-directives src/", | ||
"lint:ci": "eslint --ext .js,.ts --quiet --report-unused-disable-directives src/", | ||
"build": "rollup -c", | ||
@@ -54,7 +57,7 @@ "dev": "rollup -c -w", | ||
"dependencies": { | ||
"@aurelia/metadata": "2.1.0-dev.202307101053", | ||
"@aurelia/platform": "2.1.0-dev.202307101053" | ||
"@aurelia/metadata": "2.1.0-dev.202401061915", | ||
"@aurelia/platform": "2.1.0-dev.202401061915" | ||
}, | ||
"devDependencies": { | ||
"typescript": "5.0.2" | ||
"typescript": "5.2.2" | ||
}, | ||
@@ -61,0 +64,0 @@ "engines": { |
@@ -8,3 +8,3 @@ /* eslint-disable @typescript-eslint/no-this-alias */ | ||
import { type IResourceKind, type ResourceDefinition, type ResourceType, getAllResources, hasResources } from './resource'; | ||
import { createObject, getOwnMetadata, isFunction, isString } from './utilities'; | ||
import { getOwnMetadata, isFunction, isString } from './utilities'; | ||
import { | ||
@@ -50,3 +50,3 @@ IContainer, | ||
public get depth(): number { | ||
return this.parent === null ? 0 : this.parent.depth + 1; | ||
return this._parent === null ? 0 : this._parent.depth + 1; | ||
} | ||
@@ -78,7 +78,11 @@ public readonly root: Container; | ||
public get parent(): IContainer | null { | ||
return this._parent as (IContainer | null); | ||
} | ||
public constructor( | ||
private readonly parent: Container | null, | ||
private readonly _parent: Container | null, | ||
private readonly config: ContainerConfiguration | ||
) { | ||
if (parent === null) { | ||
if (_parent === null) { | ||
this.root = this; | ||
@@ -89,17 +93,17 @@ | ||
this.res = createObject(); | ||
this.res = {}; | ||
} else { | ||
this.root = parent.root; | ||
this.root = _parent.root; | ||
this._resolvers = new Map(); | ||
this._factories = parent._factories; | ||
this._factories = _parent._factories; | ||
this.res = {}; | ||
if (config.inheritParentResources) { | ||
this.res = Object.assign( | ||
createObject(), | ||
parent.res, | ||
this.root.res | ||
); | ||
} else { | ||
this.res = createObject(); | ||
// todo: when the simplify resource system work is commenced | ||
// this resource inheritance can just be a Object.create() call | ||
// with parent resources as the prototype of the child resources | ||
for (const key in _parent.res) { | ||
this.registerResolver(key, _parent.res[key]!); | ||
} | ||
} | ||
@@ -263,3 +267,3 @@ } | ||
if (resolver == null) { | ||
if (current.parent == null) { | ||
if (current._parent == null) { | ||
handler = (isRegisterInRequester(key as unknown as RegisterSelf<Constructable>)) ? this : current; | ||
@@ -272,3 +276,3 @@ if (autoRegister) { | ||
current = current.parent; | ||
current = current._parent; | ||
} else { | ||
@@ -286,6 +290,6 @@ return resolver; | ||
public has<K extends Key>(key: K, searchAncestors: boolean = false): boolean { | ||
return this._resolvers.has(key) | ||
return this._resolvers.has(key) || isResourceKey(key) && key in this.res | ||
? true | ||
: searchAncestors && this.parent != null | ||
? this.parent.has(key, true) | ||
: searchAncestors && this._parent != null | ||
? this._parent.has(key, true) | ||
: false; | ||
@@ -310,3 +314,3 @@ } | ||
if (resolver == null) { | ||
if (current.parent == null) { | ||
if (current._parent == null) { | ||
handler = (isRegisterInRequester(key as unknown as RegisterSelf<Constructable>)) ? this : current; | ||
@@ -316,3 +320,3 @@ resolver = this._jitRegister(key, handler); | ||
} | ||
current = current.parent; | ||
current = current._parent; | ||
} else { | ||
@@ -345,3 +349,3 @@ return resolver.resolve(current, this); | ||
} | ||
current = current.parent; | ||
current = current._parent; | ||
} | ||
@@ -355,3 +359,3 @@ return resolutions; | ||
if (resolver == null) { | ||
current = current.parent; | ||
current = current._parent; | ||
@@ -358,0 +362,0 @@ if (current == null) { |
@@ -71,2 +71,3 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
readonly root: IContainer; | ||
readonly parent: IContainer | null; | ||
register(...params: any[]): IContainer; | ||
@@ -73,0 +74,0 @@ registerResolver<K extends Key, T = K>(key: K, resolver: IResolver<T>, isDisposable?: boolean): IResolver<T>; |
@@ -12,3 +12,4 @@ import { IContainer } from './di'; | ||
> = ( | ||
new (...args: unknown[]) => TResInstance & TUserInstance | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
new (...args: any[]) => TResInstance & TUserInstance | ||
) & { | ||
@@ -15,0 +16,0 @@ readonly aliases?: readonly string[]; |
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
983904
56
17258
+ Added@aurelia/metadata@2.1.0-dev.202401061915(transitive)
+ Added@aurelia/platform@2.1.0-dev.202401061915(transitive)
- Removed@aurelia/metadata@2.1.0-dev.202307101053(transitive)
- Removed@aurelia/platform@2.1.0-dev.202307101053(transitive)