🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

diject

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diject - npm Package Compare versions

Comparing version
0.1.1
to
0.1.2
+4
-5
dist/index.d.ts

@@ -169,9 +169,8 @@ declare class AlsToken<T = any> {

declare class AsyncLocalStorage<T> {
private store;
type AsyncLocalStorageInstance<T> = {
getStore(): T | undefined;
run<R>(store: T, callback: () => R): R;
getStore(): T | undefined;
}
};
declare class AlsStore<T extends Record<string, any> = any> {
protected readonly als: AsyncLocalStorage<Map<string, any>>;
protected readonly als: AsyncLocalStorageInstance<Map<string, any>>;
run<R>(data: Partial<T>, fn: () => R): R;

@@ -178,0 +177,0 @@ get<K extends keyof T>(key: K): T[K] | undefined;

@@ -1550,20 +1550,11 @@ var __defProp = Object.defineProperty;

// src/container/AlsStore.ts
var AsyncLocalStorage = class {
static {
__name(this, "AsyncLocalStorage");
var resolveAsyncLocalStorage = /* @__PURE__ */ __name(() => {
const runtimeProcess = process;
const AsyncLocalStorage = runtimeProcess.getBuiltinModule?.("node:async_hooks")?.AsyncLocalStorage ?? runtimeProcess.getBuiltinModule?.("async_hooks")?.AsyncLocalStorage;
if (!AsyncLocalStorage) {
throw new Error("AsyncLocalStorage is not available in this runtime.");
}
store;
run(store, callback) {
const previous = this.store;
this.store = store;
try {
return callback();
} finally {
this.store = previous;
}
}
getStore() {
return this.store;
}
};
return AsyncLocalStorage;
}, "resolveAsyncLocalStorage");
var AsyncLocalStorageImpl = resolveAsyncLocalStorage();
var AlsStore = class {

@@ -1573,3 +1564,3 @@ static {

}
als = new AsyncLocalStorage();
als = new AsyncLocalStorageImpl();
run(data, fn) {

@@ -1576,0 +1567,0 @@ const currentStore = this.als.getStore();

{
"name": "diject",
"version": "0.1.1",
"version": "0.1.2",
"description": "Lightweight TypeScript DI container with decorators, scopes, metadata queries, and AsyncLocalStorage support.",

@@ -5,0 +5,0 @@ "type": "module",