node-dependency-injection 3.0.0-alpha.8 → 3.0.0-beta.1

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.
package/CHANGELOG-3.md CHANGED
@@ -1,7 +1,10 @@
1
1
  # Change Log
2
2
 
3
- # [3.0.0] - 2022-05-09
3
+ # [3.0.0] - 2022-05-19
4
4
  ### Changed
5
+ - File Loader load method is now Promised
6
+ - ContainerBuilder compile is now Promised
7
+ - Custom Compiler Pass process needs to be Promised
5
8
  ### Added
6
9
  - Autowire support for TypeScript
7
10
  - Get container service from a class instance
package/README.md CHANGED
@@ -9,8 +9,6 @@ The Node Dependency Injection component allows you to standardize and centralize
9
9
 
10
10
  [![Npm Version](https://badge.fury.io/js/node-dependency-injection.svg)](https://badge.fury.io/js/node-dependency-injection)
11
11
  [![Build Status](https://travis-ci.org/zazoomauro/node-dependency-injection.svg?branch=master)](https://travis-ci.org/zazoomauro/node-dependency-injection)
12
- [![Dependencies](https://david-dm.org/zazoomauro/node-dependency-injection.svg)](https://david-dm.org/zazoomauro/node-dependency-injection)
13
- [![DevDependencies](https://david-dm.org/zazoomauro/node-dependency-injection/dev-status.svg)](https://david-dm.org/zazoomauro/node-dependency-injection#info=devDependencies)
14
12
  [![Code Coverage](https://codecov.io/gh/zazoomauro/node-dependency-injection/branch/master/graph/badge.svg)](https://codecov.io/gh/zazoomauro/node-dependency-injection)
15
13
  [![Code Climate](https://codeclimate.com/github/zazoomauro/node-dependency-injection/badges/gpa.svg)](https://codeclimate.com/github/zazoomauro/node-dependency-injection)
16
14
  [![Coding Standard](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
@@ -68,6 +66,43 @@ And get services from your container
68
66
  const mailer = container.get('service.mailer')
69
67
  ```
70
68
 
69
+ Autowire for TypeScript
70
+ ------------
71
+
72
+ > WARNING: Is only available for node-ts or node with ts-node-register.
73
+
74
+ > WARNING: It doesn´t work with `babel` or `tsc` or any other transpilation/compilation process.
75
+
76
+ ```ts
77
+ import {ContainerBuilder, Autowire} from 'node-dependency-injection'
78
+
79
+ const container = new ContainerBuilder(
80
+ true,
81
+ '/path/to/src'
82
+ )
83
+ const autowire = new Autowire(container)
84
+ await autowire.process()
85
+
86
+ ```
87
+
88
+ or from yaml-json-js configuration
89
+
90
+ ```yaml
91
+ # /path/to/services.yml
92
+ services:
93
+ _defaults:
94
+ autowire: true
95
+ rootDir: "/path/to/src"
96
+ ```
97
+
98
+ You can also get a service from a class definition
99
+
100
+ ```ts
101
+ import SomeService from '@src/service/SomeService'
102
+
103
+ container.get(SomeService)
104
+ ```
105
+
71
106
 
72
107
  Configuration files: how to load and use configuration files
73
108
  ------------
@@ -90,7 +125,7 @@ import {ContainerBuilder, YamlFileLoader} from 'node-dependency-injection'
90
125
 
91
126
  let container = new ContainerBuilder()
92
127
  let loader = new YamlFileLoader(container)
93
- loader.load('/path/to/file.yml')
128
+ await loader.load('/path/to/file.yml')
94
129
  ```
95
130
 
96
131
  And get services from your container easily
@@ -103,6 +138,7 @@ const mailer = container.get('service.mailer')
103
138
  List of features
104
139
  ------------
105
140
 
141
+ - Autowire only for TypeScript
106
142
  - Configuration files with JS, YAML or JSON.
107
143
  - Multiple configuration files
108
144
  - Custom relative service directory
package/UPGRADE-3.0.md CHANGED
@@ -3,4 +3,6 @@ UPGRADE FROM 2.x to 3.x
3
3
 
4
4
  ### Removed deprecations
5
5
 
6
- - Nothing
6
+ - FileLoader load method is now Promised. Add await to be sync
7
+ - ContainerBuilder compile method is now Promised. Add await to be sync
8
+ - All your custom Compiler Pass process method needs to be promised