@pbinj/pbj
Advanced tools
Comparing version
@@ -1,3 +0,3 @@ | ||
import { c as t, C as i } from "./context-CsMjh-9s.mjs"; | ||
import { p as r } from "./pbjKey-BB1zrIQn.mjs"; | ||
import { c as t, C as i } from "./context-BBN0h2YC.mjs"; | ||
import { p as r } from "./pbjKey-B9p4Dcbj.mjs"; | ||
const s = process.env, o = r("@pbj/env"); | ||
@@ -4,0 +4,0 @@ t.register(o, () => s); |
@@ -1,8 +0,8 @@ | ||
import { h as a, t as c, p as l, a as d, i as h } from "./pbjKey-BB1zrIQn.mjs"; | ||
import { l as w, d as D, j as P, k as B, g as E, b as N, f as R, r as F, c as H, e as I, s as J } from "./pbjKey-BB1zrIQn.mjs"; | ||
import { c as o, C as n, S as u } from "./context-CsMjh-9s.mjs"; | ||
import { b as V, a as q, p as z, s as G } from "./context-CsMjh-9s.mjs"; | ||
import { g as y } from "./logger-DhRLFILv.mjs"; | ||
import { h as a, t as c, p as l, a as d, i as h } from "./pbjKey-B9p4Dcbj.mjs"; | ||
import { m as w, d as D, k as P, l as B, j as E, g as N, b as R, f as F, r as H, c as I, e as J, s as T } from "./pbjKey-B9p4Dcbj.mjs"; | ||
import { c as o, C as n, S as y } from "./context-BBN0h2YC.mjs"; | ||
import { b as q, a as z, p as G, s as L } from "./context-BBN0h2YC.mjs"; | ||
import { g as u } from "./logger-CSi4VZZO.mjs"; | ||
function f(e, s, t) { | ||
return (r = this.pbj(e)) => y(r, s, t); | ||
return (r = this.pbj(e)) => u(r, s, t); | ||
} | ||
@@ -14,3 +14,3 @@ n.prototype.pathOf = f; | ||
n.prototype.transform = m; | ||
const O = o.transform.bind(o), K = o.pathOf.bind(o), S = () => new b(); | ||
const K = o.transform.bind(o), O = o.pathOf.bind(o), S = () => new b(); | ||
class p { | ||
@@ -48,3 +48,3 @@ constructor(s = {}, t = []) { | ||
register(s, ...t) { | ||
return this._descriptions[s] = new u(s, t[0], t.slice(1)), this; | ||
return this._descriptions[s] = new y(s, t[0], t.slice(1)), this; | ||
} | ||
@@ -98,21 +98,22 @@ /** | ||
o as context, | ||
V as contextProxyKey, | ||
q as createNewContext, | ||
q as contextProxyKey, | ||
z as createNewContext, | ||
D as destroySymbol, | ||
P as isPBinJKey, | ||
B as isTypeAlias, | ||
K as pathOf, | ||
z as pbj, | ||
O as pathOf, | ||
G as pbj, | ||
l as pbjKey, | ||
E as pbjKeyName, | ||
N as proxyKey, | ||
R as proxyValueSymbol, | ||
F as removeSymbol, | ||
G as serviceDescriptor, | ||
H as serviceDescriptorKey, | ||
I as serviceProxySymbol, | ||
J as serviceSymbol, | ||
O as transform, | ||
N as pbjKeySymbol, | ||
R as proxyKey, | ||
F as proxyValueSymbol, | ||
H as removeSymbol, | ||
L as serviceDescriptor, | ||
I as serviceDescriptorKey, | ||
J as serviceProxySymbol, | ||
T as serviceSymbol, | ||
K as transform, | ||
c as typeAliasSymbol | ||
}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,3 +0,3 @@ | ||
import "./pbjKey-BB1zrIQn.mjs"; | ||
import { L as o, c as s, a as g, b as t } from "./logger-DhRLFILv.mjs"; | ||
import "./pbjKey-B9p4Dcbj.mjs"; | ||
import { L as o, c as s, a as g, b as t } from "./logger-CSi4VZZO.mjs"; | ||
export { | ||
@@ -4,0 +4,0 @@ o as Logger, |
@@ -1,2 +0,2 @@ | ||
import { l as e, j as i, k as p, p as y, g as j } from "./pbjKey-BB1zrIQn.mjs"; | ||
import { m as e, k as i, l as p, p as y, j } from "./pbjKey-B9p4Dcbj.mjs"; | ||
export { | ||
@@ -3,0 +3,0 @@ e as asString, |
@@ -1,4 +0,4 @@ | ||
import { a as S, m as g, e as o, h as p, i as l } from "./pbjKey-BB1zrIQn.mjs"; | ||
import { C as m, P as s, d as f, S as u } from "./context-CsMjh-9s.mjs"; | ||
import { k as d } from "./logger-DhRLFILv.mjs"; | ||
import { a as S, n as g, e as o, h as p, i as l } from "./pbjKey-B9p4Dcbj.mjs"; | ||
import { C as f, P as s, d as m, S as u } from "./context-BBN0h2YC.mjs"; | ||
import { k as d } from "./logger-CSi4VZZO.mjs"; | ||
class w { | ||
@@ -40,3 +40,3 @@ constructor() { | ||
t, | ||
new f( | ||
new m( | ||
this, | ||
@@ -64,4 +64,4 @@ new u( | ||
} | ||
m.prototype.scoped = y; | ||
f.prototype.scoped = y; | ||
const i = Symbol(); | ||
//# sourceMappingURL=scope.js.map |
@@ -1,3 +0,3 @@ | ||
import { c as n, b as c, a as u } from "./context-CsMjh-9s.mjs"; | ||
import { f as r, n as l } from "./pbjKey-BB1zrIQn.mjs"; | ||
import { c as n, b as c, a as u } from "./context-BBN0h2YC.mjs"; | ||
import { f as o, o as l } from "./pbjKey-B9p4Dcbj.mjs"; | ||
let a, t = 0; | ||
@@ -15,12 +15,12 @@ function y() { | ||
function i(e) { | ||
return l(e) && e[r] !== void 0; | ||
return l(e) && e[o] !== void 0; | ||
} | ||
function T(e, o) { | ||
const s = i(e), f = i(o); | ||
function T(e, r) { | ||
const s = i(e), f = i(r); | ||
if (s && f) | ||
return e[r] === o[r]; | ||
return e[o] === r[o]; | ||
if (s) | ||
return e[r] === o; | ||
return e[o] === r; | ||
if (f) | ||
return e === o[r]; | ||
return e === r[o]; | ||
} | ||
@@ -27,0 +27,0 @@ export { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.typeAliasSymbol = exports.proxyValueSymbol = exports.serviceProxySymbol = exports.serviceDescriptorKey = exports.proxyKey = exports.removeSymbol = exports.destroySymbol = exports.serviceSymbol = void 0; | ||
exports.pbjKeySymbol = exports.typeAliasSymbol = exports.proxyValueSymbol = exports.serviceProxySymbol = exports.serviceDescriptorKey = exports.proxyKey = exports.removeSymbol = exports.destroySymbol = exports.serviceSymbol = void 0; | ||
exports.serviceSymbol = Symbol("@pbj/Service"); | ||
@@ -12,1 +12,2 @@ exports.destroySymbol = Symbol("@pbj/Service.destroy"); | ||
exports.typeAliasSymbol = Symbol("@pbj/typeAlias"); | ||
exports.pbjKeySymbol = Symbol("@pbj/pbjKey"); |
@@ -7,4 +7,2 @@ import { type Registry } from "./registry.js"; | ||
import { RegisterArgs, ToInject } from "./context-types.js"; | ||
import { serviceSymbol } from "./symbols.js"; | ||
type serviceSymbolType = typeof serviceSymbol; | ||
export declare class Context<TRegistry extends RegistryType = Registry> { | ||
@@ -46,3 +44,3 @@ private readonly parent?; | ||
register<TKey extends PBinJKeyType, T extends TKey extends PBinJKeyType<infer V> ? V : never, TCon extends Constructor<T>>(key: TKey, fn: TCon, ...args: ToInject<ConstructorParameters<TCon>>): ServiceDescriptorI<TRegistry, T>; | ||
register<const TKey extends PBinJKeyType, const TFn extends Fn<TKey[serviceSymbolType]>>(key: TKey, fn: TFn, ...args: ToInject<Parameters<TFn>>): ServiceDescriptorI<TRegistry, TKey[serviceSymbolType]>; | ||
register<const TKey extends PBinJKeyType, const TFn extends Fn<TValue>, const TValue extends TKey extends PBinJKeyType<infer V> ? V : never>(key: TKey, fn: TFn, ...args: ToInject<Parameters<TFn>>): ServiceDescriptorI<TRegistry, TValue>; | ||
register<const TKey extends PBinJKeyType, const T extends TKey extends PBinJKeyType<infer V> ? V : never>(key: TKey, value: T): ServiceDescriptorI<TRegistry, T>; | ||
@@ -60,3 +58,3 @@ register<TKey extends PBinJKeyType<any>>(key: TKey): ServiceDescriptorI<TRegistry, TKey extends PBinJKeyType<infer T> ? T : never>; | ||
resolve<T extends keyof TRegistry, TCon extends Constructor<TRegistry[T]>>(key: T, fn: TCon, ...args: ToInject<ConstructorParameters<TCon>>): TRegistry[T]; | ||
resolve<TKey extends PBinJKeyType>(key: TKey): TKey[serviceSymbolType]; | ||
resolve<TKey extends PBinJKeyType>(key: TKey): TKey extends PBinJKeyType<infer T> ? T : never; | ||
resolve<T, TKey extends PBinJKeyType<T>>(key: TKey, alias: PBinJKeyType<T>): T; | ||
@@ -104,2 +102,1 @@ resolve<T, TKey extends PBinJKeyType<T>, TFn extends Fn<T>>(key: TKey, fn: TFn, ...args: ToInject<Parameters<TFn>>): T; | ||
export declare const context: Context<Registry>; | ||
export {}; |
@@ -9,1 +9,2 @@ export declare const serviceSymbol: unique symbol; | ||
export declare const typeAliasSymbol: unique symbol; | ||
export declare const pbjKeySymbol: unique symbol; |
@@ -9,1 +9,2 @@ export const serviceSymbol = Symbol("@pbj/Service"); | ||
export const typeAliasSymbol = Symbol("@pbj/typeAlias"); | ||
export const pbjKeySymbol = Symbol("@pbj/pbjKey"); |
@@ -1,2 +0,2 @@ | ||
import { destroySymbol, removeSymbol, serviceSymbol, typeAliasSymbol } from "./symbols.js"; | ||
import { destroySymbol, pbjKeySymbol, removeSymbol, serviceSymbol, typeAliasSymbol } from "./symbols.js"; | ||
export type Constructor<T = any> = new (...args: any[]) => T; | ||
@@ -15,4 +15,4 @@ export type Fn<T = any> = (...args: any[]) => T | Promise<T>; | ||
} | ||
export type PBinJKeyType<T = any> = symbol & { | ||
[serviceSymbol]: T; | ||
export type PBinJKeyType<T = any> = { | ||
[pbjKeySymbol]: T; | ||
}; | ||
@@ -19,0 +19,0 @@ export type OfA<T> = Constructor<T> | Fn<T> | T; |
@@ -1,2 +0,2 @@ | ||
import { serviceSymbol, typeAliasSymbol, } from "./symbols.js"; | ||
import { pbjKeySymbol, serviceSymbol, typeAliasSymbol, } from "./symbols.js"; | ||
const EMPTY = []; |
{ | ||
"name": "@pbinj/pbj", | ||
"version": "4.0.3", | ||
"version": "4.0.4", | ||
"license": "MIT", | ||
@@ -76,3 +76,3 @@ "description": "A lightweight Dependency Injection (DI) framework for Node.js, based on proxies.", | ||
"dependencies": { | ||
"@pbinj/pbj-guards": "4.0.3" | ||
"@pbinj/pbj-guards": "4.0.4" | ||
}, | ||
@@ -79,0 +79,0 @@ "sideEffects": false, |
376971
0.1%7220
0.03%+ Added
- Removed
Updated