Detalhes do pacote

aurelia-dependency-injection

aurelia56.2kMIT1.6.1

A lightweight, extensible dependency injection container for JavaScript.

aurelia, di, dependency injection, ioc

readme (leia-me)

Aurelia

License: MIT npm Version ci Discourse status Twitter Discord Chat

aurelia-dependency-injection

This library is part of the Aurelia platform and contains a lightweight, extensible dependency injection container for JavaScript.

Documentation

You can read documentation on dependency injection here. If you would like to help improve this documentation, the source for the above can be found in the doc folder within this repository.

Platform Support

This library can be used in the browser as well as on the server.

Reporting Issues

Please refer to the issue template. Accompany any bug report with a demo of the issue using a runnable Gist.

Building

npm run build

Tests

npm run test

Developing

Run the tests in watch mode:

npm run develop

Publishing

  1. Bump the version

    npm run bump-version [<newversion> | major | minor | patch]
    
  2. Prepare the release (run tests, run build, docs, release notes)

    npm run prepare-release
    
  3. Commit, tag, npm publish (not automated)

changelog (log de mudanças)

Changelog

All notable changes to this project will be documented in this file. See commit-and-tag-version for commit guidelines.

1.6.1 (2024-08-27)

Bug Fixes

  • correctly infer type from abstract classes (230e7bd)

1.6.0 (2024-08-11)

Features

1.5.2 (2019-11-20)

Bug Fixes

  • typings: dont use const enum (28bad61)

1.5.1 (2019-09-10)

Bug Fixes

  • all: change package.json module from es2015 back to native-modules (86e2699)

1.5.0 (2019-08-06)

Bug Fixes

Breaking Changes

  • Added typings to a majority of the framework. Previously all instances retrieved from a container or functor were cast to any. Now they're typed by inference to the key. If the key is a class the instance will be typed to an instance of that class. If the key is a functor, it will be resolved to the return type of the functor. All other keys will be typed to any.

    (e5e277df)

1.4.2 (2018-12-18)

Bug Fixes

  • dependency-injection: add more tests using cases suggested by @fkleuver (ac4e6f9), closes #171
  • dependency-injection: adjust based on review (dc756f4), closes #171
  • dependency-injection: ignore ...rest TypeScript metadata (c093756), closes #171

1.4.0 (2018-06-18)

Bug Fixes

  • injection: fail with autoinject and own static inject (e230bda)
  • resolver: use own property 'inject' in autoinject and parameter decorators (724ff08)
  • resolvers: remove unusable asValue option of the factory decorator (5739152)

Features

  • resolvers: allow using Factory.of and NewInstance.of with registered handlers (991cbb5)

1.3.2 (2017-08-22)

Performance Improvements

  • container: improve dynamic construction of static depencies (01b2988)

1.3.1 (2017-04-05)

  • Documentation update.

1.3.0 (2017-01-12)

Bug Fixes

  • registrations: incorrect behavior for auto resolution when... (708b5fd)

1.2.1 (2016-12-13)

Bug Fixes

  • autoinject: prevent changing inject of parent classes (aa38a34)
  • container: check for custom registration before bubbling (98739f2)

1.2.0

Bug Fixes

  • autoinject: merge issue caused incorrect branching logic
  • invokers: remove duplicate export name

1.1.0 (2016-10-05)

Bug Fixes

  • injection: correct internal loop error and enable inheritence with autoinject

Features

  • resolvers: let NewInstance have resolved dynamics dependencies (0fcda8b)
  • resolvers: let NewInstance resolver have dynamics dependencies (c6275a5)

1.0.0 (2016-07-27)

Bug Fixes

Features

  • resolver: added decorators for lazy, all, optional, parent, factory and newInstance (24e19a2)
  • resolvers: add asValue to factory argument decorator (28db168)

1.0.0-rc.1.0.1 (2016-07-12)

Bug Fixes

  • Optional: change checkParent default to true (a8a8620), closes #94

Features

  • container: return Resolvers from registration methods (3fc10cb), closes #82

1.0.0-rc.1.0.0 (2016-06-22)

1.0.0-beta.1.2.3 (2016-05-10)

1.0.0-beta.1.2.2 (2016-04-29)

  • docs update

1.0.0-beta.1.2.1 (2016-04-29)

  • docs release

1.0.0-beta.1.2.0 (2016-03-22)

Features

  • inheritence: allow injection w/ inheritence (0615ac1d)

1.0.0-beta.1.1.5 (2016-03-04)

Features

  • resolver: add factory resolver (0d59042d)

1.0.0-beta.1.1.4 (2016-03-01)

Bug Fixes

  • all: remove core-js dependency (4dff5f15)

1.0.0-beta.1.1.3 (2016-02-08)

1.0.0-beta.1.1.1 (2016-01-28)

  • fix package metadata for jspm

1.0.0-beta.1.1.0 (2016-01-28)

Bug Fixes

  • container: correct inconsistent return type from getAll (bbbef9e5, closes #71)

Features

  • all: update for jspm; update core-js; update aurelia deps (11d16867)

1.0.0-beta.1.0.1 (2016-01-08)

  • minor perf work

1.0.0-beta.1 (2015-11-16)

0.12.1 (2015-11-11)

Bug Fixes

  • all: TS fixes for decorators (04257368)

0.12.0 (2015-11-09)

Bug Fixes

  • container: bug with build combining and renamed imports (090c041a)
  • resolvers: typo in resolver protocol name (befe9668)

Features

  • all:
    • further refining of data structures and hooks; api lockdown and docs complete (0ee0c34c)
    • new resolver marker, fixed registrations, onActivate hook, invokers (ca5ccf7d)

0.11.2 (2015-10-15)

Bug Fixes

  • registrations: move configuration to correct instance (e6d4b542)

0.11.1 (2015-10-15)

Bug Fixes

  • registrations: properly handle registrations that want to target different containers (b60c1039)

0.11.0 (2015-10-13)

Bug Fixes

  • repair error msg for broken view model (60880447)
  • Container: remove new in function call (08cd06fd)
  • all:
    • update to latest metadata api (bfa78327)
    • address lint errors (d2e36a57)
    • improve some type info (2aa55dea)
    • switch to new metadata abstraction (05f3bfde)
    • update compiler to latest version (b6a3dd03)
    • explicit import of core-js and switch to Reflect.construct (5ebe60be)
    • switch to metadata api (19c60ad9)
  • bower: correct semver range (3b7670c3)
  • build:
    • update linting, testing and tools (97d032c8)
    • add missing bower bump (39ab3d07)
  • container:
    • improved alias handling (a2eb66c3)
    • prevent a breaking api change (9198b164)
    • add generics to Map type info (072262ef)
    • dry out bad key error message (58a1036f)
    • Improve error message on bad key for DI (6495ad3b, closes #36)
    • enable autoregister of non-functions (c40ac432, closes #31)
    • remove initialize hack (5c9fdd09)
    • better errors for instantiation failures (8c5e3a64)
    • factories are explicit (667a16e4, closes #13)
    • remove bogus createTypedChild api (42b2ae2a)
    • discover registration attributes on base classes (b7af69d1)
  • decorators: remove unnecessary returns (150607d1)
  • dependency-injection: Use correct import for core-js We were previously using `import core from core-j (625c1eea)
  • emptyParameters: import from ./container (7d4cfc92)
  • optional: add Optional annotation to public api (1d688334)
  • package:
  • singleton: alway register in the root container (186b573e, closes #22)
  • util:
    • fix ridiculously dumb error (8cfe89f0)
    • function name polyfill should minify correctly (85358c53)

Features

  • all:
  • annotations: add optional resolver (27a580d3)
  • build: update compiler and switch to register module format (e959d7bb)
  • container:
    • add ability to register aliases for any DI key (d4451482)
    • enable the invoke helper to take additional deps (eec36d2a)
    • turn a container instance into a globally reachable singleton instance (3c02164b)
    • improve helpfulness of activation errors (47aa4871)
    • remove AtScript support (6ed8891a)
    • use new logging AggregateError (6e2548ef)
    • add unregister method (2755688c, closes #19)
    • consume atscript annotation parameters as arrays (7303cb36, closes #15)
    • enable custom class init before constructor (33b4cc1c)
    • enable simple registration when key and value are the same (9f1f502c)
  • cotainer: add InstanceActivator abstraction (0fc2a317)
  • docs: generate api.json from .d.ts file (c6acb7cf)
  • metadata: singleton metadata can now indicate root container target (4a99d4f5)
  • package: switch from es6-shim to core-js (90a501d4)
  • resolver: add parent resolver (f035f1f5)

Breaking Changes

  • Removed base classes for registrations and instance activators since metadata now uses key/value pairs rather than inheritance.

    (51bfdd1e)

0.10.1 (2015-09-06)

Bug Fixes

  • repair error msg for broken view model (60880447)

0.10.0 (2015-09-04)

Bug Fixes

  • all: address lint errors (d2e36a57)
  • build: update linting, testing and tools (97d032c8)

Features

  • docs: generate api.json from .d.ts file (c6acb7cf)

0.9.2 (2015-08-14)

Bug Fixes

  • all: improve some type info (2aa55dea)
  • dependency-injection: Use correct import for core-js We were previously using `import core from core-j (625c1eea)

0.9.1 (2015-07-29)

  • improve output file name

0.9.0 (2015-07-01)

Bug Fixes

  • all: switch to new metadata abstraction (05f3bfde)
  • container:
    • add generics to Map type info (072262ef)
    • dry out bad key error message (58a1036f)
    • Improve error message on bad key for DI (6495ad3b, closes #36)
  • package: update aurelia tools and dts generator (83c1e2cb)

Features

  • container:
    • enable the invoke helper to take additional deps (eec36d2a)
    • turn a container instance into a globally reachable singleton instance (3c02164b)

0.8.0 (2015-06-08)

Bug Fixes

  • container: enable autoregister of non-functions (c40ac432, closes #31)

Features

  • container: improve helpfulness of activation errors (47aa4871)

0.7.1 (2015-05-06)

Bug Fixes

  • emptyParameters: import from ./container (7d4cfc92)

0.7.0 (2015-04-30)

Features

  • all: update to using the new metadata api (51bfdd1e)

Breaking Changes

  • Removed base classes for registrations and instance activators since metadata now uses key/value pairs rather than inheritance.

    (51bfdd1e)

0.6.0 (2015-04-09)

Bug Fixes

  • Container: remove new in function call (08cd06fd)
  • all:
    • update compiler to latest version (b6a3dd03)
    • explicit import of core-js and switch to Reflect.construct (5ebe60be)
  • container: remove initialize hack (5c9fdd09)
  • decorators: remove unnecessary returns (150607d1)

Features

  • all: add decorator support (120e61a3)
  • container: remove AtScript support (6ed8891a)
  • cotainer: add InstanceActivator abstraction (0fc2a317)

0.5.1 (2015-03-27)

Bug Fixes

  • container: better errors for instantiation failures (8c5e3a64)

0.5.0 (2015-03-24)

Bug Fixes

  • container: factories are explicit (667a16e4, closes #13)
  • singleton: always register in the root container (186b573e, closes #22)

Features

  • container:

0.4.5 (2015-02-28)

Bug Fixes

  • package: change jspm directories (cef0da35)

0.4.4 (2015-02-27)

Bug Fixes

  • package: update dependencies (25e924ca)

0.4.3 (2015-02-18)

Bug Fixes

  • build: add missing bower bump (39ab3d07)

Features

  • metadata: singleton metadata can now indicate root container target (4a99d4f5)

0.4.2 (2015-02-03)

Bug Fixes

  • util:
    • fix ridiculously dumb error (8cfe89f0)
    • function name polyfill should minify correctly (85358c53)

Features

  • container: consume atscript annotation parameters as arrays (7303cb36, closes #15)

0.4.1 (2015-01-24)

Bug Fixes

  • bower: correct semver range (3b7670c3)

0.4.0 (2015-01-22)

Bug Fixes

  • all: switch to metadata api (19c60ad9)
  • package: update dependencies (247d9ff9)

Features

  • all: update to fluent metadata and add helpers (8e3b7576)
  • container: enable custom class init before constructor (33b4cc1c)

0.3.1 (2015-01-12)

  • Update compiled output.

0.3.0 (2015-01-12)

Bug Fixes

  • container: remove bogus createTypedChild api (42b2ae2a)
  • package: update Aurelia dependencies (ccf09589)

Features

  • resolver: add parent resolver (f035f1f5)

0.2.1 (2015-01-06)

Bug Fixes

  • package: change doc json media type (b82feb82)

0.2.0 (2015-01-06)

Bug Fixes

  • container: discover registration attributes on base classes (b7af69d1)
  • optional: add Optional annotation to public api (1d688334)

Features

  • annotations: add optional resolver (27a580d3)
  • build: update compiler and switch to register module format (e959d7bb)
  • container: enable simple registration when key and value are the same (9f1f502c)
  • package: switch from es6-shim to core-js (90a501d4)

0.1.1 (2014-12-17)

Bug Fixes

  • package: update dependencies to latest (54a0bda1)

0.1.0 (2014-12-11)

Bug Fixes

  • package: add es6-shim polyfill (4732acee)