Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aurelia/kernel

Package Overview
Dependencies
Maintainers
0
Versions
1117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aurelia/kernel - npm Package Compare versions

Comparing version 2.0.1-dev.202407111120 to 2.0.1-dev.202408081231

7

CHANGELOG.md

@@ -6,2 +6,9 @@ # Change Log

<a name="2.0.0-beta.21"></a>
# 2.0.0-beta.21 (2024-08-08)
### Bug Fixes:
* **state:** ensure all actions queued are called (#2023) ([062f398](https://github.com/aurelia/aurelia/commit/062f398))
<a name="2.0.0-beta.20"></a>

@@ -8,0 +15,0 @@ # 2.0.0-beta.20 (2024-07-07)

6

dist/types/di.d.ts

@@ -110,3 +110,3 @@ import { Constructable, IDisposable } from './interfaces';

export declare const DI: {
createContainer: (config?: Partial<IContainerConfiguration> | undefined) => IContainer;
createContainer: (config?: Partial<IContainerConfiguration>) => IContainer;
getDesignParamtypes: (Type: Constructable | Injectable) => readonly Key[] | undefined;

@@ -155,3 +155,3 @@ getDependencies: (Type: Constructable | Injectable) => Key[];

*/
createInterface: <K extends Key>(configureOrName?: string | ((builder: ResolverBuilder<K>) => IResolver<K>) | undefined, configuror?: ((builder: ResolverBuilder<K>) => IResolver<K>) | undefined) => InterfaceSymbol<K>;
createInterface: <K extends Key>(configureOrName?: string | ((builder: ResolverBuilder<K>) => IResolver<K>), configuror?: (builder: ResolverBuilder<K>) => IResolver<K>) => InterfaceSymbol<K>;
inject: (...dependencies: Key[]) => (decorated: unknown, context: DecoratorContext) => void;

@@ -194,3 +194,3 @@ /**

*/
singleton<T_1 extends Constructable>(target: T_1 & Partial<RegisterSelf<T_1>>, options?: SingletonOptions): T_1 & RegisterSelf<T_1>;
singleton<T extends Constructable>(target: T & Partial<RegisterSelf<T>>, options?: SingletonOptions): T & RegisterSelf<T>;
};

@@ -197,0 +197,0 @@ export declare const IContainer: InterfaceSymbol<IContainer>;

@@ -35,3 +35,3 @@ import { type Key, IRegistration, type ResolveCallback, type Resolved, type IRegistry, type IContainer, InterfaceSymbol } from './di';

*/
singleton: <T_1 extends Constructable>(key: Key, value: T_1) => IRegistration<InstanceType<T_1>>;
singleton: <T extends Constructable>(key: Key, value: T) => IRegistration<InstanceType<T>>;
/**

@@ -47,3 +47,3 @@ * Creates an instance from a class.

*/
transient: <T_2 extends Constructable>(key: Key, value: T_2) => IRegistration<InstanceType<T_2>>;
transient: <T extends Constructable>(key: Key, value: T) => IRegistration<InstanceType<T>>;
/**

@@ -60,3 +60,3 @@ * Creates an instance from the method passed.

*/
callback: <T_3>(key: Key, callback: ResolveCallback<T_3>) => IRegistration<Resolved<T_3>>;
callback: <T>(key: Key, callback: ResolveCallback<T>) => IRegistration<Resolved<T>>;
/**

@@ -76,3 +76,3 @@ * Creates an instance from the method passed.

*/
cachedCallback: <T_4>(key: Key, callback: ResolveCallback<T_4>) => IRegistration<Resolved<T_4>>;
cachedCallback: <T>(key: Key, callback: ResolveCallback<T>) => IRegistration<Resolved<T>>;
/**

@@ -91,3 +91,3 @@ * creates an alternate {@linkcode Key} to retrieve an instance by.

*/
aliasTo: <T_5>(originalKey: T_5, aliasKey: Key) => IRegistration<Resolved<T_5>>;
aliasTo: <T>(originalKey: T, aliasKey: Key) => IRegistration<Resolved<T>>;
/**

@@ -94,0 +94,0 @@ * @internal

import { Constructable, Overwrite } from './interfaces';
import { MaybePromise } from './utilities';
/**

@@ -12,3 +13,3 @@ * Efficiently determine whether the provided property key is numeric

*/
export declare const isArrayIndex: (value: unknown) => value is string | number;
export declare const isArrayIndex: (value: unknown) => value is number | string;
/**

@@ -82,4 +83,2 @@ * Efficiently convert a string to camelCase.

export declare const isNativeFunction: (fn: Function) => boolean;
type UnwrapPromise<T> = T extends Promise<infer R> ? R : T;
type MaybePromise<T> = T extends Promise<infer R> ? (T | R) : (T | Promise<T>);
/**

@@ -90,3 +89,7 @@ * Normalize a potential promise via a callback, to ensure things stay synchronous when they can.

*/
export declare const onResolve: <TValue, TRet>(maybePromise: TValue, resolveCallback: (value: UnwrapPromise<TValue>) => TRet) => MaybePromise<TRet>;
export declare const onResolve: {
<TValue, TRet>(maybePromise: Promise<TValue>, resolveCallback: (value: TValue) => MaybePromise<TRet>): Promise<TRet>;
<TValue, TRet>(maybePromise: TValue extends Promise<unknown> ? never : TValue, resolveCallback: (value: TValue) => TRet): TRet extends Promise<infer R> ? Promise<R> : TRet;
<TValue, TRet>(maybePromise: MaybePromise<TValue>, resolveCallback: (value: TValue) => MaybePromise<TRet>): MaybePromise<TRet>;
};
/**

@@ -102,3 +105,2 @@ * Normalize an array of potential promises, to ensure things stay synchronous when they can.

export declare const onResolveAll: (...maybePromises: unknown[]) => void | Promise<void>;
export {};
//# sourceMappingURL=functions.d.ts.map

@@ -156,3 +156,3 @@ import { IContainer, IRegistry } from './di';

define<TSink extends Constructable<ISink>>(target: TSink, definition: SinkDefinition): void;
getHandles<TSink_1 extends ISink>(target: TSink_1): Exclude<LogLevel, typeof none>[] | undefined;
getHandles<TSink extends ISink>(target: TSink): Exclude<LogLevel, typeof none>[] | undefined;
}>;

@@ -168,9 +168,9 @@ export declare const sink: (definition: SinkDefinition) => <TSink extends Constructable<ISink>>(_target: TSink, context: ClassDecoratorContext<TSink>) => void;

readonly red: <T extends string>(str: T) => T;
readonly green: <T_1 extends string>(str: T_1) => T_1;
readonly yellow: <T_2 extends string>(str: T_2) => T_2;
readonly blue: <T_3 extends string>(str: T_3) => T_3;
readonly magenta: <T_4 extends string>(str: T_4) => T_4;
readonly cyan: <T_5 extends string>(str: T_5) => T_5;
readonly white: <T_6 extends string>(str: T_6) => T_6;
readonly grey: <T_7 extends string>(str: T_7) => T_7;
readonly green: <T extends string>(str: T) => T;
readonly yellow: <T extends string>(str: T) => T;
readonly blue: <T extends string>(str: T) => T;
readonly magenta: <T extends string>(str: T) => T;
readonly cyan: <T extends string>(str: T) => T;
readonly white: <T extends string>(str: T) => T;
readonly grey: <T extends string>(str: T) => T;
};

@@ -177,0 +177,0 @@ export interface ILogEvent {

{
"name": "@aurelia/kernel",
"version": "2.0.1-dev.202407111120",
"version": "2.0.1-dev.202408081231",
"main": "dist/cjs/index.cjs",

@@ -57,4 +57,4 @@ "module": "dist/esm/index.mjs",

"dependencies": {
"@aurelia/metadata": "2.0.1-dev.202407111120",
"@aurelia/platform": "2.0.1-dev.202407111120"
"@aurelia/metadata": "2.0.1-dev.202408081231",
"@aurelia/platform": "2.0.1-dev.202408081231"
},

@@ -61,0 +61,0 @@ "devDependencies": {

import { ErrorNames, createMappedError } from './errors';
import { Constructable, Overwrite } from './interfaces';
import { createLookup, isPromise, objectAssign } from './utilities';
import { createLookup, isPromise, MaybePromise, objectAssign } from './utilities';

@@ -403,5 +403,2 @@ /**

type UnwrapPromise<T> = T extends Promise<infer R> ? R : T;
type MaybePromise<T> = T extends Promise<infer R> ? (T | R) : (T | Promise<T>);
/**

@@ -412,12 +409,69 @@ * Normalize a potential promise via a callback, to ensure things stay synchronous when they can.

*/
export const onResolve = <TValue, TRet>(
maybePromise: TValue,
resolveCallback: (value: UnwrapPromise<TValue>) => TRet,
): MaybePromise<TRet> => {
if (maybePromise instanceof Promise) {
return maybePromise.then(resolveCallback) as MaybePromise<TRet>;
export const onResolve: {
// used for async code paths
<TValue, TRet>(
maybePromise: Promise<TValue>,
resolveCallback: (value: TValue) => MaybePromise<TRet>,
): Promise<TRet>;
// used for express synchronous only code paths
<TValue, TRet>(
maybePromise: TValue extends Promise<unknown> ? never : TValue,
resolveCallback: (value: TValue) => TRet,
): TRet extends Promise<infer R> ? Promise<R> : TRet;
// used for mixed code paths
<TValue, TRet>(
maybePromise: MaybePromise<TValue>,
resolveCallback: (value: TValue) => MaybePromise<TRet>,
): MaybePromise<TRet>;
}
// implementation
= (maybePromise, resolveCallback) => {
if (isPromise(maybePromise)) {
return maybePromise.then(resolveCallback);
}
return resolveCallback(maybePromise as UnwrapPromise<TValue>) as MaybePromise<TRet>;
return resolveCallback(maybePromise);
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function testOnResolve() {
/* eslint-disable @typescript-eslint/no-floating-promises, @typescript-eslint/ban-ts-comment */
onResolve(Promise.resolve(1), (value) => value === 1);
onResolve(1, value => value === 1);
// @ts-expect-error
onResolve(1, value => value === Promise.resolve(1));
// @ts-expect-error
onResolve(Promise.resolve(1), value => value === Promise.resolve(1));
const ret = onResolve(Promise.resolve(1), (value) => value === 1);
// @ts-expect-error
if (ret === false) {
// nothing
}
// @ts-expect-error
const ret2 = onResolve(1, value => value === Promise.resolve(1));
if (ret2 === false) {
// nothing
}
type Component = {
canDeactivate?: () => boolean | Promise<boolean>;
};
const cmp: Component = {};
onResolve(
cmp.canDeactivate?.(),
canDeactivate => {
if (canDeactivate === false) {
// nothing
}
});
/* eslint-enable @typescript-eslint/no-floating-promises, @typescript-eslint/ban-ts-comment */
}
/**

@@ -424,0 +478,0 @@ * Normalize an array of potential promises, to ensure things stay synchronous when they can.

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc