ts-ioc-container 50.2.3 → 50.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +9 -16
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -12,11 +12,6 @@ container for applications that need more than basic constructor injection:
12
12
  scoped lifecycles, decorators, typed tokens, lazy dependencies, lifecycle hooks,
13
13
  provider pipelines, aliases, and custom injector strategies.
14
14
 
15
- Use it as a `tsyringe` alternative when you want a clear API with more flexible
16
- customization for real application architecture. Use it as an Inversify or
17
- Awilix alternative when you want a thinner, cleaner API with explicit scopes and
18
- no global container objects.
19
-
20
15
  ## Advantages
21
16
 
22
17
  - fast TypeScript dependency resolution
@@ -34,8 +29,6 @@ no global container objects.
34
29
  - [Setup](#setup)
35
30
  - [Quickstart](#quickstart)
36
31
  - [Cheatsheet](#cheatsheet)
37
- - [tsyringe alternative](https://igorbabkin.github.io/ts-ioc-container/tsyringe-alternative)
38
- - [Inversify and Awilix alternative](https://igorbabkin.github.io/ts-ioc-container/inversify-awilix-alternative)
39
32
  - [Container](#container)
40
33
  - [Basic usage](#basic-usage)
41
34
  - [Scope](#scope) `tags`
@@ -54,7 +47,7 @@ no global container objects.
54
47
  - [Alias](#alias) `asAlias`
55
48
  - [Decorator](#decorator) `decorate`
56
49
  - [Registration](#registration) `@register`
57
- - [Key](#key) `asKey`
50
+ - [Key](#key) `bindTo`
58
51
  - [Scope](#scope) `scope`
59
52
  - [Module](#module)
60
53
  - [Hook](#hook) `@hook`
@@ -133,8 +126,8 @@ describe('Quickstart', function () {
133
126
  ## Cheatsheet
134
127
 
135
128
  - Register class with key (preferred): `@register(bindTo('Key')) class Service {}` then `container.addRegistration(R.fromClass(Service))`
136
- - Register value: `R.fromValue(config).bindToKey('Config')`
137
- - Register factory: `R.fromFn((c) => createX(c)).bindToKey('X')`
129
+ - Register value: `R.fromValue(config).bindTo('Config')`
130
+ - Register factory: `R.fromFn((c) => createX(c)).bindTo('X')`
138
131
  - Singleton: `@register(singleton())`
139
132
  - Scoped registration: `@register(scope((s) => s.hasTag('request')))`
140
133
  - Resolve by alias: `container.resolveByAlias('Alias')`
@@ -145,9 +138,9 @@ describe('Quickstart', function () {
145
138
 
146
139
  > [!TIP]
147
140
  > For classes, prefer the `@register(bindTo('Key'))` decorator over the fluent
148
- > `R.fromClass(Class).bindToKey('Key')` chain. The decorator co-locates the binding
141
+ > `R.fromClass(Class).bindTo('Key')` chain. The decorator co-locates the binding
149
142
  > with the class and reads consistently with other registration pipes
150
- > (`scope`, `singleton`, `appendArgsFn`, ...). Use the fluent `bindToKey` chain only
143
+ > (`scope`, `singleton`, `appendArgsFn`, ...). Use the fluent `bindTo` chain only
151
144
  > for `R.fromValue(...)` and `R.fromFn(...)` (which have no class to decorate)
152
145
  > or for third-party classes you don't own.
153
146
 
@@ -1292,7 +1285,7 @@ Provider is dependency factory which creates dependency.
1292
1285
 
1293
1286
  - `Provider.fromClass(Logger)`
1294
1287
  - `Provider.fromValue(logger)`
1295
- - `new Provider((container, ...args) => container.resolve(Logger, {args}))`
1288
+ - `new Provider((container, options) => container.resolve(Logger, options))`
1296
1289
 
1297
1290
  ```typescript
1298
1291
  import {
@@ -2147,11 +2140,11 @@ describe('Decorator Pattern', () => {
2147
2140
 
2148
2141
  Registration is provider factory which registers provider in container.
2149
2142
 
2150
- - `@register(asKey('logger'))`
2151
- - `Registration.fromClass(Logger).to('logger')`
2143
+ - `@register(bindTo('logger'))`
2144
+ - `Registration.fromClass(Logger).bindTo('logger')`
2152
2145
  - `Registration.fromClass(Logger)`
2153
2146
  - `Registration.fromValue(Logger)`
2154
- - `Registration.fromFn((container, ...args) => container.resolve(Logger, {args}))`
2147
+ - `Registration.fromFn((container, options) => container.resolve(Logger, options))`
2155
2148
 
2156
2149
  ### Key
2157
2150
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-ioc-container",
3
- "version": "50.2.3",
3
+ "version": "50.2.5",
4
4
  "description": "Fast, lightweight TypeScript dependency injection container with a clean API, scoped lifecycles, decorators, tokens, hooks, lazy injection, customizable providers, and no global container objects.",
5
5
  "workspaces": [
6
6
  "docs"