Skip to content

Releases: wessberg/DI-compiler

v3.3.0

04 Aug 08:58
Compare
Choose a tag to compare
  • feat: add TypeScript v5.1 support 3d0b582

v3.2.0...v3.3.0

v3.2.0

23 Jan 14:09
Compare
Choose a tag to compare
  • feat: add .js extensions to built types to make them compatible with codebases running with Node16 or NodeNext module resolution 87b74d1

v3.1.0...v3.2.0

v3.1.0

10 Jan 00:20
Compare
Choose a tag to compare
  • feat: Add TypeScript v4.9 support

v3.0.0...v3.1.0

v3.0.0

01 Aug 23:36
Compare
Choose a tag to compare

New Features

DI-Compiler is now based on ESM and requires Node v14.19.0 (BREAKING CHANGE)

Now that TypeScript v4.7 is out, it has finally received great support for ES modules in a Node.js environment that aligns with how it has been implemented across Node.js and browsers.

Because of this, now is a good time to make DI-Compiler a type: "module" package. However, it still provides a CommonJS fallback. If your codebase is still based on CommonJS, you should be fine. Please know however, that di-compiler requires an environment running Node v14.19.0 or newer going forward.

Node.js loader support (BREAKING CHANGE)

In the past, you could use DI-Compiler as a CommonJS loader, like so:

node -r @wessberg/di-compiler/register

However, this had a few issues:

  • It only worked in CommonJS projects
  • It internally wrapped ts-node in a way that wasn't transparent to the user.

Now, both a CommonJS and an ESM loader is exposed, both of which are documented in the README. They don't wrap ts-node, so they can be used in conjunction with not only ts-node, but other loaders for Node.js as well that teach Node.js to handle TypeScript syntax, such as tsx or esm-loader.

To ease migration, if you want to continue using DI-Compiler as you did before where it directly wraps ts-node, a legacy loader is provided for your convenience, and here's how you can use it:

node -r @wessberg/di-compiler/ts-node-loader

Usage without a TypeScript Program

In the past years, TypeScript tooling has moved towards much faster builds in part by treating emit as purely a matter of syntax transformation, whereas it is traditionally coupled with type checking and diagnostics reporting in TypeScript. This is how tools like babel, swc, and esbuild treat TypeScript.

To allow integration with these tools, as well as to allow integration with the new Node.js loader system, DI-Compiler can now work without access to a TypeScript Program or a Type checker. When a Program isn't given, it will attempt to statically infer whether or not identifiers are instances of DIContainer, and you can help it out by passing exactly which identifiers should be treated at such. See this section in the README for more details.

TypeScript v4.7 support

DI-Compiler now supports TypeScript v4.7 and its new features.

v2.2.6...v3.0.0

v2.2.6

19 Nov 10:04
Compare
Choose a tag to compare
  • feat: add TypeScript v4.5 support b3960ce

v2.2.5...v2.2.6

v2.2.5

29 May 22:14
Compare
Choose a tag to compare
  • chore(build): bump dependencies 6364dc5

v2.2.4...v2.2.5

v2.2.4

29 May 21:17
Compare
Choose a tag to compare
  • chore(build): update lock file c17d862
  • chore(build): update lock file 6e046bc
  • chore(build): bump dependencies d88f89c
  • chore(build): fix scripts 6e794ce

v2.2.3...v2.2.4

v2.2.3

28 May 17:23
Compare
Choose a tag to compare
  • refactor: move tslib into devDependencies 76554d9
  • refactor: move unused dependency into devDependencies f7bd351

v2.2.2...v2.2.3

v2.2.1

21 May 12:26
Compare
Choose a tag to compare
  • fix: don't include type arguments as part of the service identifier inside parsed constructor arguments 3a2f3ff

v2.2.0...v2.2.1

v2.2.0

21 May 11:51
Compare
Choose a tag to compare
  • chore(build): remove @wessberg/di as a devDependency e25bb68
  • fix: type arguments passed to registerSingleton and registerTransient should themselves be allowed to receive type arguments, and these should not count towards the service/implementation name 76773ab
  • fix(imports): fix a bug where registering the same implementation multiple times will generate multiple imports f8c388b
  • fix: make all tests pass on every TypeScript version in the range [3.0, 4.3-rc1] 265ac93

v2.1.1...v2.2.0