Socket
Socket
Sign inDemoInstall

awilix

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awilix - npm Package Compare versions

Comparing version 3.0.8 to 3.0.9

128

CHANGELOG.md

@@ -0,10 +1,14 @@

# v3.0.9
- Updated packages.
# v3.0.8
* Add support for parsing async and generator functions; these no longer break the parser. ([#90](https://github.com/jeffijoe/awilix/issues/90))
* Update dependencies.
- Add support for parsing async and generator functions; these no longer break the parser. ([#90](https://github.com/jeffijoe/awilix/issues/90))
- Update dependencies.
# v3.0.7
* Skip code comments in parser ([#87](https://github.com/jeffijoe/awilix/issues/87))
* Make the parser smarter by including full member expression paths so we get less false positives
- Skip code comments in parser ([#87](https://github.com/jeffijoe/awilix/issues/87))
- Make the parser smarter by including full member expression paths so we get less false positives
when scanning for the constructor token.

@@ -14,26 +18,26 @@

* Update `container.cradle` typing to be `any` ([#83](https://github.com/jeffijoe/awilix/issues/83), [Ackos95](https://github.com/Ackos95))
- Update `container.cradle` typing to be `any` ([#83](https://github.com/jeffijoe/awilix/issues/83), [Ackos95](https://github.com/Ackos95))
# v3.0.5
* Updated dependencies
* Fix TS 2.7 compilation issue
* Fix the `GlobWithOptions` type to include `LifetimeType`
- Updated dependencies
- Fix TS 2.7 compilation issue
- Fix the `GlobWithOptions` type to include `LifetimeType`
# v3.0.4
* Fix [#76](https://github.com/jeffijoe/awilix/issues/76): don't overwrite declarations when building with Rollup.
- Fix [#76](https://github.com/jeffijoe/awilix/issues/76): don't overwrite declarations when building with Rollup.
# v3.0.3
* Adjust Rollup config to use latest [config format](https://gist.github.com/Rich-Harris/d472c50732dab03efeb37472b08a3f32)
- Adjust Rollup config to use latest [config format](https://gist.github.com/Rich-Harris/d472c50732dab03efeb37472b08a3f32)
# v3.0.2
* Updated packages, fix an internal typing issue as a result of updated typings.
- Updated packages, fix an internal typing issue as a result of updated typings.
# v3.0.1
* Use `Reflect.construct()` instead of `new` internally; fixes TS transpilation issue.
* Add note on browser support to README.
- Use `Reflect.construct()` instead of `new` internally; fixes TS transpilation issue.
- Add note on browser support to README.

@@ -139,4 +143,4 @@ # v3.0.0

* `ResolutionMode.js` renamed to `injection-mode.ts`
* `ResolutionMode` renamed to `InjectionMode`
- `ResolutionMode.js` renamed to `injection-mode.ts`
- `ResolutionMode` renamed to `InjectionMode`

@@ -147,6 +151,6 @@ ### "Registrations" are now "Resolvers" ([#51](https://github.com/jeffijoe/awilix/issues/51))

* TypeScript interfaces renamed
* `REGISTRATION` symbol renamed to `RESOLVER`
* `registrations.js` renamed to `resolvers.ts`
* `registrationOptions` in `loadModules` renamed to `resolverOptions`
- TypeScript interfaces renamed
- `REGISTRATION` symbol renamed to `RESOLVER`
- `registrations.js` renamed to `resolvers.ts`
- `registrationOptions` in `loadModules` renamed to `resolverOptions`

@@ -207,10 +211,10 @@ ### `registerClass`, `registerFunction` and `registerValue` removed ([#60](https://github.com/jeffijoe/awilix/issues/60))

* Code is now formatted with Prettier
* Awilix is now using `husky` + `lint-staged` to lint, format and test every
- Code is now formatted with Prettier
- Awilix is now using `husky` + `lint-staged` to lint, format and test every
commit to ensure top code quality.
* Switched to Jest from Mocha
* Switched from eslint to tslint
* Rewrote the function parameter parser, it is now much better at correctly
- Switched to Jest from Mocha
- Switched from eslint to tslint
- Rewrote the function parameter parser, it is now much better at correctly
skipping over default value expressions to reach the next parameter.
* Most (if not all) of the code is now documented and should be readable.
- Most (if not all) of the code is now documented and should be readable.

@@ -221,3 +225,3 @@ ---

* Deprecated the `registerFunction`, `registerValue` and `registerClass`
- Deprecated the `registerFunction`, `registerValue` and `registerClass`
shortcuts.

@@ -227,7 +231,7 @@

* Fix typings for `container.build`
- Fix typings for `container.build`
# 2.11.0
* Add support for `container.build()` - see
- Add support for `container.build()` - see
[relevant docs](https://github.com/jeffijoe/awilix#containerbuild)

@@ -237,8 +241,8 @@

* Add support for `Object.keys()` on the cradle; now returns the names of
- Add support for `Object.keys()` on the cradle; now returns the names of
available modules that can be resolved by accessing them.
* There's a gotcha though; `Object.getOwnPropertyDescriptor()` will return a
- There's a gotcha though; `Object.getOwnPropertyDescriptor()` will return a
gibberish descriptor. This is required for the keys to show up in the
result.
* Fix iterating over cradle - generator now yields registration names, thanks
- Fix iterating over cradle - generator now yields registration names, thanks
[@neerfri](https://github.com/neerfri)!

@@ -249,21 +253,21 @@ ([#40](https://github.com/jeffijoe/awilix/issues/40))

* Fix issue with `console.log` on the cradle throwing an error.
- Fix issue with `console.log` on the cradle throwing an error.
([#7](https://github.com/jeffijoe/awilix/issues/7))
* This _should_ not break anything, but just to be safe I did a minor version
- This _should_ not break anything, but just to be safe I did a minor version
bump.
* Add support for `Symbol`s (although not recommended).
- Add support for `Symbol`s (although not recommended).
# 2.8.4
* Change `RegistrationOptions` typing to union of string and options
- Change `RegistrationOptions` typing to union of string and options
# 2.8.3
* Fix typing for `REGISTRATION` symbol
- Fix typing for `REGISTRATION` symbol
# 2.8.2
* Fix typing for `loadModules` — it didn't allow the shortcut version of
- Fix typing for `loadModules` — it didn't allow the shortcut version of
`['glob.js', Lifetime.SCOPED]`
* Add Prettier formatting as well as `lint-staged` to keep the tests passing and
- Add Prettier formatting as well as `lint-staged` to keep the tests passing and
the code fresh before committing.

@@ -273,3 +277,3 @@

* Remove `is-plain-object` and `is-string`, use simple checks instead. Trying to
- Remove `is-plain-object` and `is-string`, use simple checks instead. Trying to
keep the dependencies as thin as possible.

@@ -279,3 +283,3 @@

* **[NEW]**: Support inline registration options
- **[NEW]**: Support inline registration options
([#34](https://github.com/jeffijoe/awilix/issues/34))

@@ -285,3 +289,3 @@

* **[FIXED]**: `container.loadModules()` typing fix, thanks
- **[FIXED]**: `container.loadModules()` typing fix, thanks
[@dboune](https://github.com/dboune)!

@@ -291,3 +295,3 @@

* **[BREAKING]**: Custom `isClass` function that will treat
- **[BREAKING]**: Custom `isClass` function that will treat
`function Capital () {}` as a class due to the capital first letter of the

@@ -297,3 +301,3 @@ function name. This is to improve compatibility with Babel's ES5 code

([#28](https://github.com/jeffijoe/awilix/issues/28))
* **[NEW]**: Added support for passing in a `register` function to
- **[NEW]**: Added support for passing in a `register` function to
`loadModules`. ([#28](https://github.com/jeffijoe/awilix/issues/28))

@@ -303,3 +307,3 @@

* **[FIXED]**: Parsing regression in 2.6.1
- **[FIXED]**: Parsing regression in 2.6.1
([#30](https://github.com/jeffijoe/awilix/issues/30))

@@ -309,3 +313,3 @@

* **[FIXED]**: Implemented a crude arguments parser to replace regex.
- **[FIXED]**: Implemented a crude arguments parser to replace regex.
([#30](https://github.com/jeffijoe/awilix/issues/30))

@@ -315,5 +319,5 @@

* **[NEW]**: infer function name for `registerClass`/`registerFunction`
- **[NEW]**: infer function name for `registerClass`/`registerFunction`
([#26](https://github.com/jeffijoe/awilix/issues/26))
* **[FIXED]**: Corrected some TypeScript typings related to `registerClass` and
- **[FIXED]**: Corrected some TypeScript typings related to `registerClass` and
`registerFunction`.

@@ -323,8 +327,8 @@

* **[NEW]**: Implemented per-module locals injection
- **[NEW]**: Implemented per-module locals injection
([#24](https://github.com/jeffijoe/awilix/issues/24)).
* Fixed issue where passing a `Lifetime` like
- Fixed issue where passing a `Lifetime` like
`.registerFunction('name', func, Lifetime.SCOPED)` didn't work.
* Documented `asClass`, `asValue` and `asFunction`.
* **[FIXED]**: nasty options leaking when using
- Documented `asClass`, `asValue` and `asFunction`.
- **[FIXED]**: nasty options leaking when using
`registerClass/Function({ test1: [Test1, { }], test2: [Test2, { }] })`.

@@ -334,3 +338,3 @@

* **[BREAKING]**: Guard assertions added to `asFunction` and `asClass`. This
- **[BREAKING]**: Guard assertions added to `asFunction` and `asClass`. This
will prevent some nasty runtime behaviors.

@@ -342,7 +346,7 @@ ([#20](https://github.com/jeffijoe/awilix/issues/20)), thanks

* **[NEW]**: Classic dependency resolution mode using parameter name matching
- **[NEW]**: Classic dependency resolution mode using parameter name matching
implemented, thanks to
[@cjhoward92](https://github.com/jeffijoe/awilix/pull/21)! This is an
alternative to the default proxy mechanism.
* **[BREAKING]**: The `registerX({ name: [value, options]})` pattern is not
- **[BREAKING]**: The `registerX({ name: [value, options]})` pattern is not
needed for `registerValue` because it is so simple is requires no

@@ -356,26 +360,26 @@ configuration. It was causing trouble when attempting to register an array as

the pre-2.3.0 behavior)**
* [chore]: Updated packages.
- [chore]: Updated packages.
# 2.2.6
* Pass in the module descriptor to `formatName` - thanks @anasinnyk!
* Fixed some issues with TypeScript definitions.
- Pass in the module descriptor to `formatName` - thanks @anasinnyk!
- Fixed some issues with TypeScript definitions.
# 2.2.5
* Fixed `registerFunction` return type definition - thanks @ycros!
- Fixed `registerFunction` return type definition - thanks @ycros!
# 2.2.4
* TypeScript definitions - thanks @blove!
- TypeScript definitions - thanks @blove!
# 2.2.3
* Webpack 2 compatibility - thanks @ewrogers!
- Webpack 2 compatibility - thanks @ewrogers!
# 2.2.2
* `console.log`ing the container will, instead of throwing an error, display a
- `console.log`ing the container will, instead of throwing an error, display a
string summary of the container. Fixes #7.
* started logging changes to a changelog (sorry about being so late to the
- started logging changes to a changelog (sorry about being so late to the
party)

@@ -42,4 +42,4 @@ /*! *****************************************************************************

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -446,8 +446,8 @@ case 0: case 1: t = op; break;

function nameValueToObject(name, value) {
var _a;
var obj = name;
if (typeof obj === 'string' || typeof obj === 'symbol') {
obj = (_a = {}, _a[name] = value, _a);
return _a = {}, _a[name] = value, _a;
}
return obj;
var _a;
}

@@ -1028,2 +1028,3 @@ /**

function createContainer(options, parentContainer) {
var _a;
options = __assign({ injectionMode: InjectionMode.PROXY }, options);

@@ -1065,3 +1066,3 @@ // The resolution stack is used to keep track

*/
set: function (target, name, value) {
set: function (_target, name, value) {
throw new Error("Attempted setting property \"" + name + "\" on container cradle - this is not allowed.");

@@ -1209,6 +1210,9 @@ },

*
* @param {string} name
* @param {string | symbol} name
* The name of the registration to resolve.
*
* @return {*}
* @param {ResolveOptions} resolveOpts
* The resolve options.
*
* @return {any}
* Whatever was resolved.

@@ -1341,5 +1345,4 @@ */

}
var _a;
}
export { ExtendableError, AwilixError, AwilixTypeError, AwilixResolutionError, createContainer, RESOLVER, asValue, asFunction, asClass, aliasTo, createBuildResolver, createDisposableResolver, InjectionMode, Lifetime };

@@ -393,3 +393,3 @@ import { sync } from 'glob';

if (typeof obj === 'string' || typeof obj === 'symbol') {
obj = { [name]: value };
return { [name]: value };
}

@@ -1134,3 +1134,3 @@ return obj;

*/
set: (target, name, value) => {
set: (_target, name, value) => {
throw new Error(`Attempted setting property "${name}" on container cradle - this is not allowed.`);

@@ -1252,6 +1252,9 @@ },

*
* @param {string} name
* @param {string | symbol} name
* The name of the registration to resolve.
*
* @return {*}
* @param {ResolveOptions} resolveOpts
* The resolve options.
*
* @return {any}
* Whatever was resolved.

@@ -1258,0 +1261,0 @@ */

@@ -48,4 +48,4 @@ (function (global, factory) {

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -452,8 +452,8 @@ case 0: case 1: t = op; break;

function nameValueToObject(name, value) {
var _a;
var obj = name;
if (typeof obj === 'string' || typeof obj === 'symbol') {
obj = (_a = {}, _a[name] = value, _a);
return _a = {}, _a[name] = value, _a;
}
return obj;
var _a;
}

@@ -1034,2 +1034,3 @@ /**

function createContainer(options, parentContainer) {
var _a;
options = __assign({ injectionMode: InjectionMode.PROXY }, options);

@@ -1071,3 +1072,3 @@ // The resolution stack is used to keep track

*/
set: function (target, name, value) {
set: function (_target, name, value) {
throw new Error("Attempted setting property \"" + name + "\" on container cradle - this is not allowed.");

@@ -1215,6 +1216,9 @@ },

*
* @param {string} name
* @param {string | symbol} name
* The name of the registration to resolve.
*
* @return {*}
* @param {ResolveOptions} resolveOpts
* The resolve options.
*
* @return {any}
* Whatever was resolved.

@@ -1347,3 +1351,2 @@ */

}
var _a;
}

@@ -1350,0 +1353,0 @@

@@ -128,5 +128,3 @@ import { GlobWithOptions } from './list-modules';

*/
export interface RegistrationHash {
[key: string]: Resolver<any>;
}
export declare type RegistrationHash = Record<string | symbol | number, Resolver<any>>;
/**

@@ -133,0 +131,0 @@ * Resolution stack.

@@ -70,3 +70,3 @@ "use strict";

*/
set: (target, name, value) => {
set: (_target, name, value) => {
throw new Error(`Attempted setting property "${name}" on container cradle - this is not allowed.`);

@@ -188,6 +188,9 @@ },

*
* @param {string} name
* @param {string | symbol} name
* The name of the registration to resolve.
*
* @return {*}
* @param {ResolveOptions} resolveOpts
* The resolve options.
*
* @return {any}
* Whatever was resolved.

@@ -194,0 +197,0 @@ */

@@ -23,5 +23,3 @@ import { Constructor } from './resolvers';

*/
export declare function nameValueToObject(name: string | symbol | object, value?: any): {
[key: string]: any;
};
export declare function nameValueToObject(name: string | symbol | object, value?: any): Record<string | symbol, any>;
/**

@@ -28,0 +26,0 @@ * Returns the last item in the array.

@@ -37,3 +37,3 @@ "use strict";

if (typeof obj === 'string' || typeof obj === 'symbol') {
obj = { [name]: value };
return { [name]: value };
}

@@ -40,0 +40,0 @@ return obj;

{
"name": "awilix",
"version": "3.0.8",
"version": "3.0.9",
"description": "Extremely powerful dependency injection container.",

@@ -54,25 +54,25 @@ "main": "lib/awilix.js",

"@types/glob": "^5.0.35",
"@types/jest": "^22.2.3",
"@types/node": "^10.1.2",
"@types/prettier": "^1.12.2",
"babel-jest": "^22.4.4",
"@types/jest": "^23.3.0",
"@types/node": "^10.5.2",
"@types/prettier": "^1.13.2",
"babel-jest": "^23.4.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.7.0",
"coveralls": "^3.0.1",
"coveralls": "^3.0.2",
"husky": "^0.14.3",
"istanbul": "^0.4.5",
"jest": "^22.4.4",
"lint-staged": "^7.1.1",
"prettier": "^1.12.1",
"rollup": "^0.59.1",
"jest": "^23.4.1",
"lint-staged": "^7.2.0",
"prettier": "^1.13.7",
"rollup": "^0.63.2",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-typescript2": "^0.14.0",
"rollup-plugin-typescript2": "^0.15.1",
"smid": "^0.1.1",
"ts-jest": "^22.4.6",
"tslint": "^5.10.0",
"ts-jest": "^23.0.1",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.13.0",
"tslint-config-standard": "^7.0.0",
"typescript": "^2.8.3"
"tslint-config-standard": "^7.1.0",
"typescript": "^2.9.2"
},

@@ -79,0 +79,0 @@ "dependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc