diff --git a/CHANGELOG.md b/CHANGELOG.md index 0987d3f..b6c10a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,195 +1,387 @@ +## [2.2.6](https://github.com/wessberg/di-compiler/compare/v2.2.5...v2.2.6) (2021-11-19) + + +### Features + +* add TypeScript v4.5 support ([b3960ce](https://github.com/wessberg/di-compiler/commit/b3960cee9b13a36ba38a6f10d8627e43e73800df)) + + + ## [2.2.5](https://github.com/wessberg/di-compiler/compare/v2.2.4...v2.2.5) (2021-05-29) + + ## [2.2.4](https://github.com/wessberg/di-compiler/compare/v2.2.3...v2.2.4) (2021-05-29) + + ## [2.2.3](https://github.com/wessberg/di-compiler/compare/v2.2.2...v2.2.3) (2021-05-28) + + ## [2.2.2](https://github.com/wessberg/di-compiler/compare/v2.2.1...v2.2.2) (2021-05-28) + + ## [2.2.1](https://github.com/wessberg/di-compiler/compare/v2.2.0...v2.2.1) (2021-05-21) + ### Bug Fixes -- don't include type arguments as part of the service identifier inside parsed constructor arguments ([3a2f3ff](https://github.com/wessberg/di-compiler/commit/3a2f3ff2f825b0f85b073310da5d16bf3f0eaf98)) +* don't include type arguments as part of the service identifier inside parsed constructor arguments ([3a2f3ff](https://github.com/wessberg/di-compiler/commit/3a2f3ff2f825b0f85b073310da5d16bf3f0eaf98)) + + # [2.2.0](https://github.com/wessberg/di-compiler/compare/v2.1.1...v2.2.0) (2021-05-21) + ### Bug Fixes -- 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](https://github.com/wessberg/di-compiler/commit/76773ab5a0846c3858c86e111fac35656583070e)) -- **imports:** fix a bug where registering the same implementation multiple times will generate multiple imports ([f8c388b](https://github.com/wessberg/di-compiler/commit/f8c388b07351e737b51ff021a013c867f6a3c008)) -- make all tests pass on every TypeScript version in the range [3.0, 4.3-rc1] ([265ac93](https://github.com/wessberg/di-compiler/commit/265ac93282d58fab4d6ccc6ddd17e52592e27eff)) +* **imports:** fix a bug where registering the same implementation multiple times will generate multiple imports ([f8c388b](https://github.com/wessberg/di-compiler/commit/f8c388b07351e737b51ff021a013c867f6a3c008)) +* make all tests pass on every TypeScript version in the range [3.0, 4.3-rc1] ([265ac93](https://github.com/wessberg/di-compiler/commit/265ac93282d58fab4d6ccc6ddd17e52592e27eff)) +* 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](https://github.com/wessberg/di-compiler/commit/76773ab5a0846c3858c86e111fac35656583070e)) + + ## [2.1.1](https://github.com/wessberg/di-compiler/compare/v2.1.0...v2.1.1) (2020-06-01) + ### Bug Fixes -- remove throw statement for SystemJS as compiletarget ([c8d370e](https://github.com/wessberg/di-compiler/commit/c8d370e4116d19cdd8a50276a86619ac91beb6d6)) +* remove throw statement for SystemJS as compiletarget ([c8d370e](https://github.com/wessberg/di-compiler/commit/c8d370e4116d19cdd8a50276a86619ac91beb6d6)) + + # [2.1.0](https://github.com/wessberg/di-compiler/compare/v2.0.5...v2.1.0) (2020-05-27) + ### Features -- major refactoring with support for CommonJS, AMD, and SystemJS as targets ([bfeedef](https://github.com/wessberg/di-compiler/commit/bfeedef6db6c6624f1ed861db815b53f471cef30)) +* major refactoring with support for CommonJS, AMD, and SystemJS as targets ([bfeedef](https://github.com/wessberg/di-compiler/commit/bfeedef6db6c6624f1ed861db815b53f471cef30)) + + ## [2.0.5](https://github.com/wessberg/di-compiler/compare/v2.0.4...v2.0.5) (2019-06-21) + + ## [2.0.4](https://github.com/wessberg/di-compiler/compare/v2.0.3...v2.0.4) (2019-05-29) + + ## [2.0.3](https://github.com/wessberg/di-compiler/compare/v2.0.2...v2.0.3) (2019-05-29) + + ## [2.0.2](https://github.com/wessberg/di-compiler/compare/v2.0.1...v2.0.2) (2018-11-28) + + ## [2.0.1](https://github.com/wessberg/di-compiler/compare/v2.0.0...v2.0.1) (2018-11-14) + + # [2.0.0](https://github.com/wessberg/di-compiler/compare/v1.0.76...v2.0.0) (2018-11-12) + + ## [1.0.76](https://github.com/wessberg/di-compiler/compare/v1.0.75...v1.0.76) (2018-09-19) + + ## [1.0.75](https://github.com/wessberg/di-compiler/compare/v1.0.74...v1.0.75) (2018-07-31) + + ## [1.0.74](https://github.com/wessberg/di-compiler/compare/v1.0.73...v1.0.74) (2018-06-21) + + ## [1.0.73](https://github.com/wessberg/di-compiler/compare/v1.0.72...v1.0.73) (2018-06-21) + + ## [1.0.72](https://github.com/wessberg/di-compiler/compare/v1.0.71...v1.0.72) (2018-06-13) + + ## [1.0.71](https://github.com/wessberg/di-compiler/compare/v1.0.70...v1.0.71) (2018-06-13) + + ## [1.0.70](https://github.com/wessberg/di-compiler/compare/v1.0.69...v1.0.70) (2018-06-08) + + ## [1.0.69](https://github.com/wessberg/di-compiler/compare/v1.0.68...v1.0.69) (2018-05-10) + + ## [1.0.68](https://github.com/wessberg/di-compiler/compare/v1.0.67...v1.0.68) (2018-04-30) + + ## [1.0.67](https://github.com/wessberg/di-compiler/compare/v1.0.66...v1.0.67) (2018-04-25) + + ## [1.0.66](https://github.com/wessberg/di-compiler/compare/v1.0.65...v1.0.66) (2018-04-18) + + ## [1.0.65](https://github.com/wessberg/di-compiler/compare/v1.0.64...v1.0.65) (2018-04-03) + + ## [1.0.64](https://github.com/wessberg/di-compiler/compare/v1.0.63...v1.0.64) (2018-03-31) + + ## [1.0.63](https://github.com/wessberg/di-compiler/compare/v1.0.62...v1.0.63) (2018-03-31) + + ## [1.0.62](https://github.com/wessberg/di-compiler/compare/v1.0.61...v1.0.62) (2018-02-03) + + ## [1.0.61](https://github.com/wessberg/di-compiler/compare/v1.0.60...v1.0.61) (2017-10-21) + + ## [1.0.60](https://github.com/wessberg/di-compiler/compare/v1.0.59...v1.0.60) (2017-09-18) + + ## [1.0.59](https://github.com/wessberg/di-compiler/compare/v1.0.58...v1.0.59) (2017-09-10) + + ## [1.0.58](https://github.com/wessberg/di-compiler/compare/v1.0.57...v1.0.58) (2017-09-10) + + ## [1.0.57](https://github.com/wessberg/di-compiler/compare/v1.0.56...v1.0.57) (2017-09-10) + + ## [1.0.56](https://github.com/wessberg/di-compiler/compare/v1.0.55...v1.0.56) (2017-09-10) + + ## [1.0.55](https://github.com/wessberg/di-compiler/compare/v1.0.54...v1.0.55) (2017-09-04) + + ## [1.0.54](https://github.com/wessberg/di-compiler/compare/v1.0.53...v1.0.54) (2017-09-04) + + ## [1.0.53](https://github.com/wessberg/di-compiler/compare/v1.0.52...v1.0.53) (2017-09-04) + + ## [1.0.52](https://github.com/wessberg/di-compiler/compare/v1.0.51...v1.0.52) (2017-09-03) + + ## [1.0.51](https://github.com/wessberg/di-compiler/compare/v1.0.50...v1.0.51) (2017-09-03) + + ## [1.0.50](https://github.com/wessberg/di-compiler/compare/v1.0.49...v1.0.50) (2017-09-03) + + ## [1.0.49](https://github.com/wessberg/di-compiler/compare/v1.0.48...v1.0.49) (2017-09-03) + + ## [1.0.48](https://github.com/wessberg/di-compiler/compare/v1.0.47...v1.0.48) (2017-09-03) + + ## [1.0.47](https://github.com/wessberg/di-compiler/compare/v1.0.46...v1.0.47) (2017-08-28) + + ## [1.0.46](https://github.com/wessberg/di-compiler/compare/v1.0.45...v1.0.46) (2017-08-28) + + ## [1.0.45](https://github.com/wessberg/di-compiler/compare/v1.0.44...v1.0.45) (2017-08-28) + + ## [1.0.44](https://github.com/wessberg/di-compiler/compare/v1.0.43...v1.0.44) (2017-08-28) + + ## [1.0.43](https://github.com/wessberg/di-compiler/compare/v1.0.42...v1.0.43) (2017-08-28) + + ## [1.0.42](https://github.com/wessberg/di-compiler/compare/v1.0.41...v1.0.42) (2017-08-28) + + ## [1.0.41](https://github.com/wessberg/di-compiler/compare/v1.0.40...v1.0.41) (2017-08-28) + + ## [1.0.40](https://github.com/wessberg/di-compiler/compare/v1.0.39...v1.0.40) (2017-08-17) + + ## [1.0.39](https://github.com/wessberg/di-compiler/compare/v1.0.38...v1.0.39) (2017-08-03) + + ## [1.0.38](https://github.com/wessberg/di-compiler/compare/v1.0.37...v1.0.38) (2017-07-28) + + ## [1.0.37](https://github.com/wessberg/di-compiler/compare/v1.0.36...v1.0.37) (2017-07-28) + + ## [1.0.36](https://github.com/wessberg/di-compiler/compare/v1.0.34...v1.0.36) (2017-07-28) + + ## [1.0.34](https://github.com/wessberg/di-compiler/compare/v1.0.33...v1.0.34) (2017-07-20) + + ## [1.0.33](https://github.com/wessberg/di-compiler/compare/v1.0.32...v1.0.33) (2017-07-19) + + ## [1.0.32](https://github.com/wessberg/di-compiler/compare/v1.0.31...v1.0.32) (2017-07-19) + + ## [1.0.31](https://github.com/wessberg/di-compiler/compare/v1.0.30...v1.0.31) (2017-07-19) + + ## [1.0.30](https://github.com/wessberg/di-compiler/compare/v1.0.29...v1.0.30) (2017-07-19) + + ## [1.0.29](https://github.com/wessberg/di-compiler/compare/v1.0.28...v1.0.29) (2017-07-19) + + ## [1.0.28](https://github.com/wessberg/di-compiler/compare/v1.0.27...v1.0.28) (2017-07-19) + + ## [1.0.27](https://github.com/wessberg/di-compiler/compare/v1.0.26...v1.0.27) (2017-07-18) + + ## [1.0.26](https://github.com/wessberg/di-compiler/compare/v1.0.25...v1.0.26) (2017-07-18) + + ## [1.0.25](https://github.com/wessberg/di-compiler/compare/v1.0.24...v1.0.25) (2017-07-06) + + ## [1.0.24](https://github.com/wessberg/di-compiler/compare/v1.0.23...v1.0.24) (2017-07-06) + + ## [1.0.23](https://github.com/wessberg/di-compiler/compare/v1.0.22...v1.0.23) (2017-07-05) + + ## [1.0.22](https://github.com/wessberg/di-compiler/compare/v1.0.21...v1.0.22) (2017-07-05) + + ## [1.0.21](https://github.com/wessberg/di-compiler/compare/v1.0.20...v1.0.21) (2017-07-05) + + ## [1.0.20](https://github.com/wessberg/di-compiler/compare/v1.0.19...v1.0.20) (2017-07-05) + + ## [1.0.19](https://github.com/wessberg/di-compiler/compare/v1.0.18...v1.0.19) (2017-07-05) + + ## [1.0.18](https://github.com/wessberg/di-compiler/compare/v1.0.17...v1.0.18) (2017-05-31) + + ## [1.0.17](https://github.com/wessberg/di-compiler/compare/v1.0.16...v1.0.17) (2017-05-31) + + ## [1.0.16](https://github.com/wessberg/di-compiler/compare/v1.0.15...v1.0.16) (2017-05-31) + + ## [1.0.15](https://github.com/wessberg/di-compiler/compare/v1.0.14...v1.0.15) (2017-05-31) + + ## [1.0.14](https://github.com/wessberg/di-compiler/compare/v1.0.13...v1.0.14) (2017-05-31) + + ## [1.0.13](https://github.com/wessberg/di-compiler/compare/v1.0.12...v1.0.13) (2017-05-31) + + ## [1.0.12](https://github.com/wessberg/di-compiler/compare/v1.0.11...v1.0.12) (2017-05-31) + + ## [1.0.11](https://github.com/wessberg/di-compiler/compare/v1.0.10...v1.0.11) (2017-05-31) + + ## [1.0.10](https://github.com/wessberg/di-compiler/compare/v1.0.9...v1.0.10) (2017-05-31) + + ## [1.0.9](https://github.com/wessberg/di-compiler/compare/v1.0.8...v1.0.9) (2017-05-31) + + ## [1.0.8](https://github.com/wessberg/di-compiler/compare/v1.0.7...v1.0.8) (2017-05-30) + + ## [1.0.7](https://github.com/wessberg/di-compiler/compare/v1.0.6...v1.0.7) (2017-05-30) + + ## [1.0.6](https://github.com/wessberg/di-compiler/compare/v1.0.5...v1.0.6) (2017-05-30) + + ## [1.0.5](https://github.com/wessberg/di-compiler/compare/v1.0.4...v1.0.5) (2017-05-30) + + ## [1.0.4](https://github.com/wessberg/di-compiler/compare/v1.0.3...v1.0.4) (2017-05-25) + + ## [1.0.3](https://github.com/wessberg/di-compiler/compare/v1.0.2...v1.0.3) (2017-05-25) + + ## [1.0.2](https://github.com/wessberg/di-compiler/compare/v1.0.1...v1.0.2) (2017-05-24) + + ## 1.0.1 (2017-05-24) + + + diff --git a/README.md b/README.md index 108ab88..bc4994f 100644 --- a/README.md +++ b/README.md @@ -50,9 +50,9 @@ This has been implemented as a TypeScript Custom Transformer in order to be so l ## Backers -| Bubbles | Christopher Blanchard | Ideal Postcodes | Xerox | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- | -| [Bubbles](https://usebubbles.com)
Twitter: [@usebubbles](https://twitter.com/usebubbles) | [Christopher Blanchard](https://github.com/cblanc) | [Ideal Postcodes](https://github.com/ideal-postcodes) | [Xerox](https://www.xerox.com) | +| Bubbles | Christopher Blanchard | Ideal Postcodes | Xerox | Trent Raymond | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | +| [Bubbles](https://usebubbles.com)
Twitter: [@usebubbles](https://twitter.com/usebubbles) | [Christopher Blanchard](https://github.com/cblanc) | [Ideal Postcodes](https://github.com/ideal-postcodes) | [Xerox](https://www.xerox.com) | [Trent Raymond](https://changelog.me) | ### Patreon @@ -136,12 +136,8 @@ The most obvious place would be to use it directly with Typescript's compiler AP There's several ways to do this, but here's a simple example: ```typescript -import { - createProgram, - getDefaultCompilerOptions, - createCompilerHost, -} from "typescript"; -import { di } from "@wessberg/di-compiler"; +import {createProgram, getDefaultCompilerOptions, createCompilerHost} from "typescript"; +import {di} from "@wessberg/di-compiler"; const compilerOptions = getDefaultCompilerOptions(); const compilerHost = createCompilerHost(compilerOptions); @@ -154,7 +150,7 @@ const program = createProgram( ); // Transform the SourceFiles within the program, and pass them through the 'di' transformer -program.emit(undefined, undefined, undefined, undefined, di({ program })); +program.emit(undefined, undefined, undefined, undefined, di({program})); ``` ### Usage with ts-node @@ -168,20 +164,16 @@ node -r @wessberg/di-compiler/register You can also do it programmatically. Here's an example using CommonJS: ```typescript -const { di } = require("@wessberg/rollup-plugin-ts"); +const {di} = require("@wessberg/rollup-plugin-ts"); require("ts-node").register({ - transformers: (program) => di({ program }), + transformers: program => di({program}) }); ``` ```typescript -import { - createProgram, - getDefaultCompilerOptions, - createCompilerHost, -} from "typescript"; -import { di } from "@wessberg/di-compiler"; +import {createProgram, getDefaultCompilerOptions, createCompilerHost} from "typescript"; +import {di} from "@wessberg/di-compiler"; const compilerOptions = getDefaultCompilerOptions(); const compilerHost = createCompilerHost(compilerOptions); @@ -194,7 +186,7 @@ const program = createProgram( ); // Transform the SourceFiles within the program, and pass them through the 'di' transformer -program.emit(undefined, undefined, undefined, undefined, di({ program })); +program.emit(undefined, undefined, undefined, undefined, di({program})); ``` ### Usage with Rollup @@ -208,7 +200,7 @@ There are two popular TypeScript plugins for Rollup that support Custom Transfor ```typescript import ts from "@wessberg/rollup-plugin-ts"; -import { di } from "@wessberg/di-compiler"; +import {di} from "@wessberg/di-compiler"; export default { input: "...", @@ -217,9 +209,9 @@ export default { ], plugins: [ ts({ - transformers: [di], - }), - ], + transformers: [di] + }) + ] }; ``` @@ -227,7 +219,7 @@ export default { ```typescript import ts from "rollup-plugin-typescript2"; -import { di } from "@wessberg/di-compiler"; +import {di} from "@wessberg/di-compiler"; export default { input: "...", @@ -236,9 +228,9 @@ export default { ], plugins: [ ts({ - transformers: [(service) => di({ program: service.getProgram() })], - }), - ], + transformers: [service => di({program: service.getProgram()})] + }) + ] }; ``` @@ -252,7 +244,7 @@ There are two popular TypeScript loaders for Webpack that support Custom Transfo #### Usage with awesome-typescript-loader ```typescript -import { di } from "@wessberg/di-compiler"; +import {di} from "@wessberg/di-compiler"; const config = { // ... module: { @@ -263,11 +255,11 @@ const config = { loader: "awesome-typescript-loader", options: { // ... - getCustomTransformers: (program) => di({ program }), - }, - }, - ], - }, + getCustomTransformers: program => di({program}) + } + } + ] + } // ... }; ``` @@ -275,7 +267,7 @@ const config = { #### Usage with ts-loader ```typescript -import { di } from "@wessberg/di"; +import {di} from "@wessberg/di"; const config = { // ... module: { @@ -286,11 +278,11 @@ const config = { loader: "ts-loader", options: { // ... - getCustomTransformers: (program) => di({ program }), - }, - }, - ], - }, + getCustomTransformers: program => di({program}) + } + } + ] + } // ... }; ``` @@ -304,7 +296,7 @@ with the `require` property in the `ava` configuration: { // Other options... extensions: ["ts"], - require: ["@wessberg/di-compiler/register"], + require: ["@wessberg/di-compiler/register"] } ``` @@ -348,9 +340,9 @@ Then, instances of the [DIContainer](https://github.com/wessberg/di) will be dis For example, an expression such as: ```typescript -import { DIContainer } from "@wessberg/di"; -import { MyInterface } from "./my-interface"; -import { MyImplementation } from "./my-implementation"; +import {DIContainer} from "@wessberg/di"; +import {MyInterface} from "./my-interface"; +import {MyImplementation} from "./my-implementation"; const container = new DIContainer(); container.registerSingleton(); @@ -362,7 +354,7 @@ Will be compiled into: // ... container.registerSingleton(undefined, { identifier: `MyInterface`, - implementation: MyImplementation, + implementation: MyImplementation }); ``` diff --git a/package.json b/package.json index fa9324f..254b1d1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wessberg/di-compiler", - "version": "2.2.5", + "version": "2.2.6", "description": "A Custom Transformer for Typescript that enables compile-time Dependency Injection", "scripts": { "generate:sandhog": "sandhog all --yes", @@ -77,17 +77,17 @@ "ts-node": "^10.4.0", "npm-check-updates": "^12.0.2", "typescript": "^4.5.2", - "typescript-3-4-1": "npm:typescript@3.4.1", - "typescript-3-5-1": "npm:typescript@3.5.1", - "typescript-3-6-2": "npm:typescript@3.6.2", - "typescript-3-7-2": "npm:typescript@3.7.2", - "typescript-3-8-3": "npm:typescript@3.8.3", - "typescript-3-9-2": "npm:typescript@3.9.2", - "typescript-4-0-3": "npm:typescript@4.0.3", - "typescript-4-1-2": "npm:typescript@4.1.2", - "typescript-4-2-4": "npm:typescript@4.2.4", - "typescript-4-3-5": "npm:typescript@4.3.5", - "typescript-4-4-2": "npm:typescript@4.4.2", + "typescript-3-4-1": "npm:typescript@3.4.1", + "typescript-3-5-1": "npm:typescript@3.5.1", + "typescript-3-6-2": "npm:typescript@3.6.2", + "typescript-3-7-2": "npm:typescript@3.7.2", + "typescript-3-8-3": "npm:typescript@3.8.3", + "typescript-3-9-2": "npm:typescript@3.9.2", + "typescript-4-0-3": "npm:typescript@4.0.3", + "typescript-4-1-2": "npm:typescript@4.1.2", + "typescript-4-2-4": "npm:typescript@4.2.4", + "typescript-4-3-5": "npm:typescript@4.3.5", + "typescript-4-4-2": "npm:typescript@4.4.2", "tslib": "^2.3.1" }, "dependencies": {