Skip to content

Commit

Permalink
merge: release 0.10.0 (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
NoNameProvided committed Jan 15, 2021
2 parents 7ba2005 + 0dec04d commit 0351f17
Show file tree
Hide file tree
Showing 19 changed files with 780 additions and 646 deletions.
60 changes: 60 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,65 @@
# Changelog

## 0.10.0 [BREAKING] - 2021.01.15

### BREAKING CHANGES

#### Container.remove signature change

The `Container.remove` method from now accepts one ID or an array of IDs.

```ts
// Old format
Container.remove(myServiceA, myServiceB);

// New format
Container.remove([myServiceA, myServiceB]);
```

#### Removed support for calling `Service([depA, depB], factory)`

This was an undocumented way of calling the `Service` function directly instead of using it as a decorator. This option
has been removed and the official supported way of achieving the same is with `Container.set`. Example:

```ts
const myToken = new Token('myToken');

Container.set(myToken, 'test-value');

// Old format:
const oldWayService = Service([myToken], function myFactory(myToken) {
return myToken.toUpperCase();
});
const oldResult = Container.get(oldWayService);
// New format
const newWayService = Container.set({
// ID can be anything, we use string for simplicity
id: 'my-custom-service',
factory: function myFactory(container) {
return container.get(myToken).toUppserCase();
},
});
const newResult = Container.get('my-custom-service');

oldResult === newResult; // -> true, both equals to "TEST-VALUE"
```

### Added

- added `eager` option to `ServiceOptions`, when enabled the class will be instantiated as soon as it's registered in the container
- added support for destroying removed services, when a service is removed and has a callable `destroy` property it will be called by TypeDI

### Changed

- [BREAKING] removed old, undocumented way of calling `@Service` decorator directly
- [BREAKING] renamed `MissingProvidedServiceTypeError` to `CannotInstantiateValueError`
- various internal refactors
- updated various dev dependencies

### Fixed

- generated sourcemaps contains the Typescript files preventing reference errors when using TypeDI with various build tools

## 0.9.1 - 2021.01.11

### Fixed
Expand Down
Loading

0 comments on commit 0351f17

Please sign in to comment.