@travetto/di 3.0.2 → 3.0.3

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 +7 -9
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  <!-- This file was generated by @travetto/doc and should not be modified directly -->
2
- <!-- Please modify https://github.com/travetto/travetto/tree/main/module/di/DOC.ts and execute "npx trv doc" to rebuild -->
2
+ <!-- Please modify https://github.com/travetto/travetto/tree/main/module/di/DOC.tsx and execute "npx trv doc" to rebuild -->
3
3
  # Dependency Injection
4
+
4
5
  ## Dependency registration/management and injection support.
5
6
 
6
7
  **Install: @travetto/di**
@@ -100,12 +101,11 @@ Given the `static` method `initService`, the function will be provided as a vali
100
101
  **Note**: Other modules are able to provide aliases to [@Injectable](https://github.com/travetto/travetto/tree/main/module/di/src/decorator.ts#L31) that also provide additional functionality. For example, the [Configuration](https://github.com/travetto/travetto/tree/main/module/config#readme "Configuration support") module @Config or the [RESTful API](https://github.com/travetto/travetto/tree/main/module/rest#readme "Declarative api for RESTful APIs with support for the dependency injection module.") module @Controller decorator registers the associated class as an injectable element.
101
102
 
102
103
  ## Injection
104
+ Once all of your necessary dependencies are defined, now is the time to provide those [@Injectable](https://github.com/travetto/travetto/tree/main/module/di/src/decorator.ts#L31) instances to your code. There are three primary methods for injection:
103
105
 
104
- Once all of your necessary dependencies are defined, now is the time to provide those [@Injectable](https://github.com/travetto/travetto/tree/main/module/di/src/decorator.ts#L31) instances to your code. There are three primary methods for injection:
105
-
106
- The [@Inject](https://github.com/travetto/travetto/tree/main/module/di/src/decorator.ts#L31) decorator, which denotes a desire to inject a value directly. These will be set post construction.
106
+ The [@Inject](https://github.com/travetto/travetto/tree/main/module/di/src/decorator.ts#L31) decorator, which denotes a desire to inject a value directly. These will be set post construction.
107
107
 
108
- **Code: Example Injectable with dependencies as [@Inject](https://github.com/travetto/travetto/tree/main/module/di/src/decorator.ts#L31) fields**
108
+ **Code: Example Injectable with dependencies as Inject fields**
109
109
  ```typescript
110
110
  import { Injectable, Inject } from '@travetto/di';
111
111
  import { DependentService } from './dep';
@@ -155,8 +155,7 @@ class Config {
155
155
  ```
156
156
 
157
157
  ### Multiple Candidates for the Same Type
158
-
159
- If you are building modules for others to consume, often times it is possible to end up with multiple implementations for the same class.
158
+ If you are building modules for others to consume, often times it is possible to end up with multiple implementations for the same class.
160
159
 
161
160
  **Code: Example Multiple Candidate Types**
162
161
  ```typescript
@@ -197,8 +196,7 @@ class Config {
197
196
  ```
198
197
 
199
198
  ## Manual Invocation
200
-
201
- Some times you will need to lookup a dependency dynamically, or you want to control the injection process at a more granular level. To achieve that you will need to directly access the [DependencyRegistry](https://github.com/travetto/travetto/tree/main/module/di/src/registry.ts). The registry allows for requesting a dependency by class reference:
199
+ Some times you will need to lookup a dependency dynamically, or you want to control the injection process at a more granular level. To achieve that you will need to directly access the [DependencyRegistry](https://github.com/travetto/travetto/tree/main/module/di/src/registry.ts#L1). The registry allows for requesting a dependency by class reference:
202
200
 
203
201
  **Code: Example of Manual Lookup**
204
202
  ```typescript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/di",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "Dependency registration/management and injection support.",
5
5
  "keywords": [
6
6
  "ast-transformations",
@@ -27,10 +27,10 @@
27
27
  "directory": "module/di"
28
28
  },
29
29
  "dependencies": {
30
- "@travetto/registry": "^3.0.2"
30
+ "@travetto/registry": "^3.0.3"
31
31
  },
32
32
  "peerDependencies": {
33
- "@travetto/transformer": "^3.0.2"
33
+ "@travetto/transformer": "^3.0.3"
34
34
  },
35
35
  "peerDependenciesMeta": {
36
36
  "@travetto/transformer": {