DI-compiler

A Custom Transformer for Typescript that enables compile-time Dependency Injection

MIT License

Downloads
2.4K
Stars
82
Committers
5
DI-compiler -

Published by wessberg 17 days ago

  • chore: fix compatibility with verbatimModuleSyntax 4b9dcee

https://github.com/wessberg/di-compiler/compare/v4.0.0...v4.0.1

DI-compiler -

Published by wessberg 18 days ago

BREAKING CHANGES

  • DI-Compiler now requires Node v.18.20.0 or newer, as it has switched to the new --import loader mechanism and Import Attributes.

Major Changes

  • feat: add TypeScript v5.6 support c502c7d

Other Changes

  • Merge pull request #30 from Intellisplash/use-correct-tsconfig a6a8e11
  • Merge pull request #26 from Cropster/issue-24 55bde11
  • Support custom tsconfig paths 8954862
  • JSX support for transform() API method f215a91
  • style: run prettier d154167
  • chore: move from pretty-quick to lint-staged to support Prettier v3 90bc74e
    • chore: bump dependencies 6ece5b6
  • chore: remove console.log f607138

https://github.com/wessberg/di-compiler/compare/v3.3.0...v4.0.0-beta.1
https://github.com/wessberg/di-compiler/compare/v4.0.0-beta.1...v4.0.0

DI-compiler - Latest Release

Published by wessberg 27 days ago

BREAKING CHANGES

  • DI-Compiler now requires Node v.18.20.0 or newer, as it has switched to the new --import loader mechanism and Import Attributes.

Major Changes

  • feat: add TypeScript v5.6 support c502c7d
  • Merge pull request #30 from Intellisplash/use-correct-tsconfig a6a8e11
  • Merge pull request #26 from Cropster/issue-24 55bde11
  • Support custom tsconfig paths 8954862
  • JSX support for transform() API method f215a91
  • style: run prettier d154167
  • chore: move from pretty-quick to lint-staged to support Prettier v3 90bc74e

https://github.com/wessberg/di-compiler/compare/v3.3.0...v4.0.0-beta.1

DI-compiler -

Published by wessberg about 1 year ago

  • feat: add TypeScript v5.1 support 3d0b582

https://github.com/wessberg/di-compiler/compare/v3.2.0...v3.3.0

DI-compiler -

Published by wessberg almost 2 years ago

  • feat: add .js extensions to built types to make them compatible with codebases running with Node16 or NodeNext module resolution 87b74d1

https://github.com/wessberg/di-compiler/compare/v3.1.0...v3.2.0

DI-compiler -

Published by wessberg almost 2 years ago

DI-compiler -

Published by wessberg about 2 years ago

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.

https://github.com/wessberg/di-compiler/compare/v2.2.6...v3.0.0

DI-compiler -

Published by wessberg almost 3 years ago

  • feat: add TypeScript v4.5 support b3960ce

https://github.com/wessberg/di-compiler/compare/v2.2.5...v2.2.6

DI-compiler -

Published by wessberg over 3 years ago

  • chore(build): bump dependencies 6364dc5

https://github.com/wessberg/di-compiler/compare/v2.2.4...v2.2.5

DI-compiler -

Published by wessberg over 3 years ago

  • chore(build): update lock file c17d862
  • chore(build): update lock file 6e046bc
  • chore(build): bump dependencies d88f89c
  • chore(build): fix scripts 6e794ce

https://github.com/wessberg/di-compiler/compare/v2.2.3...v2.2.4

DI-compiler -

Published by wessberg over 3 years ago

  • refactor: move tslib into devDependencies 76554d9
  • refactor: move unused dependency into devDependencies f7bd351

https://github.com/wessberg/di-compiler/compare/v2.2.2...v2.2.3

DI-compiler -

Published by wessberg over 3 years ago

  • fix: don't include type arguments as part of the service identifier inside parsed constructor arguments 3a2f3ff

https://github.com/wessberg/di-compiler/compare/v2.2.0...v2.2.1

DI-compiler -

Published by wessberg over 3 years ago

  • 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

https://github.com/wessberg/di-compiler/compare/v2.1.1...v2.2.0

DI-compiler -

Published by wessberg over 4 years ago

  • fix: remove throw statement for SystemJS as compiletarget c8d370e

https://github.com/wessberg/di-compiler/compare/v2.1.0...v2.1.1

DI-compiler -

Published by wessberg over 4 years ago

  • style(lint): fix lint 85af986
  • manually add unreferenced type-only imports back in f76b447
  • docs(readme): simplify part of README 0f7f786
  • chore: add Github Actions 8cd6de0
  • feat: major refactoring with support for CommonJS, and AMD as targets bfeedef

https://github.com/wessberg/di-compiler/compare/v2.0.5...v2.1.0

DI-compiler -

Published by wessberg over 5 years ago

  • build(npm): updates dependencies 06be133

https://github.com/wessberg/di-compiler/compare/v2.0.4...v2.0.5

DI-compiler -

Published by wessberg over 5 years ago

  • docs(readme): adds features e8b936c
  • docs(readme): adjusts logo size c856509

https://github.com/wessberg/di-compiler/compare/v2.0.3...v2.0.4

DI-compiler -

Published by wessberg over 5 years ago

  • build(npm): updates scripts 275951b
  • build(npm): updates scripts 45ce200
  • build(npm): updates dependencies. Upgraded project config. Refactoring 5df0b03

https://github.com/wessberg/di-compiler/compare/v2.0.2...v2.0.3

Package Rankings
Top 4.69% on Npmjs.org
Related Projects