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 8.0.1 to 9.0.0

37

lib/awilix.browser.js

@@ -15,3 +15,3 @@ /******************************************************************************

***************************************************************************** */
/* global Reflect, Promise */
/* global Reflect, Promise, SuppressedError, Symbol */

@@ -82,2 +82,7 @@ var extendStatics = function(d, b) {

typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
/**

@@ -256,2 +261,3 @@ * Newline.

type = 'EOF';
// eslint-disable-next-line no-constant-condition
while (true) {

@@ -291,3 +297,3 @@ if (pos >= end) {

return (type = ch);
case '/':
case '/': {
pos++;

@@ -307,2 +313,3 @@ var nextCh = source.charAt(pos);

continue;
}
default:

@@ -517,3 +524,5 @@ // Scans an identifier.

*/
function isClass(fn) {
function isClass(
// eslint-disable-next-line @typescript-eslint/ban-types
fn) {
/*tslint:disable-next-line*/

@@ -540,3 +549,3 @@ if (typeof fn !== 'function') {

*
* @param {Any} val
* @param {unknown} val
* Any value to check if it's a function.

@@ -629,3 +638,3 @@ *

break;
case 'function':
case 'function': {
var next = nextToken();

@@ -637,2 +646,3 @@ if (next.type === 'ident' || next.type === '*') {

break;
}
case '(':

@@ -645,3 +655,3 @@ // Start parsing parameter names.

return params;
case 'ident':
case 'ident': {
// Likely a paren-less arrow function

@@ -654,4 +664,4 @@ // which can have no default args.

// case it is a single-arg arrow func.
var next_1 = nextToken();
if (next_1 && next_1.type !== '=') {
var next = nextToken();
if (next && next.type !== '=') {
break;

@@ -662,2 +672,3 @@ }

return params;
}
/* istanbul ignore next */

@@ -732,2 +743,4 @@ default:

// We parse the signature of any `Function`, so we want to allow `Function` types.
/* eslint-disable @typescript-eslint/ban-types */
/**

@@ -808,3 +821,7 @@ * RESOLVER symbol can be used by modules loaded by

var newClass = function newClass() {
return Reflect.construct(Type, arguments);
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return Reflect.construct(Type, args);
};

@@ -1447,3 +1464,3 @@ var resolve = generateResolve(newClass, Type);

return Promise.all(entries.map(function (_a) {
_a[0]; var entry = _a[1];
var entry = _a[1];
var resolver = entry.resolver, value = entry.value;

@@ -1450,0 +1467,0 @@ var disposable = resolver;

@@ -21,3 +21,3 @@ (function (global, factory) {

***************************************************************************** */
/* global Reflect, Promise */
/* global Reflect, Promise, SuppressedError, Symbol */

@@ -88,2 +88,7 @@ var extendStatics = function(d, b) {

typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
/**

@@ -262,2 +267,3 @@ * Newline.

type = 'EOF';
// eslint-disable-next-line no-constant-condition
while (true) {

@@ -297,3 +303,3 @@ if (pos >= end) {

return (type = ch);
case '/':
case '/': {
pos++;

@@ -313,2 +319,3 @@ var nextCh = source.charAt(pos);

continue;
}
default:

@@ -523,3 +530,5 @@ // Scans an identifier.

*/
function isClass(fn) {
function isClass(
// eslint-disable-next-line @typescript-eslint/ban-types
fn) {
/*tslint:disable-next-line*/

@@ -546,3 +555,3 @@ if (typeof fn !== 'function') {

*
* @param {Any} val
* @param {unknown} val
* Any value to check if it's a function.

@@ -635,3 +644,3 @@ *

break;
case 'function':
case 'function': {
var next = nextToken();

@@ -643,2 +652,3 @@ if (next.type === 'ident' || next.type === '*') {

break;
}
case '(':

@@ -651,3 +661,3 @@ // Start parsing parameter names.

return params;
case 'ident':
case 'ident': {
// Likely a paren-less arrow function

@@ -660,4 +670,4 @@ // which can have no default args.

// case it is a single-arg arrow func.
var next_1 = nextToken();
if (next_1 && next_1.type !== '=') {
var next = nextToken();
if (next && next.type !== '=') {
break;

@@ -668,2 +678,3 @@ }

return params;
}
/* istanbul ignore next */

@@ -738,2 +749,4 @@ default:

// We parse the signature of any `Function`, so we want to allow `Function` types.
/* eslint-disable @typescript-eslint/ban-types */
/**

@@ -814,3 +827,7 @@ * RESOLVER symbol can be used by modules loaded by

var newClass = function newClass() {
return Reflect.construct(Type, arguments);
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return Reflect.construct(Type, args);
};

@@ -1453,3 +1470,3 @@ var resolve = generateResolve(newClass, Type);

return Promise.all(entries.map(function (_a) {
_a[0]; var entry = _a[1];
var entry = _a[1];
var resolver = entry.resolver, value = entry.value;

@@ -1456,0 +1473,0 @@ var disposable = resolver;

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

*/
createScope<T extends object = {}>(): AwilixContainer<Cradle & T>;
createScope<T extends object = object>(): AwilixContainer<Cradle & T>;
/**

@@ -33,0 +33,0 @@ * Used by `util.inspect`.

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

container.cache.clear();
return Promise.all(entries.map(([name, entry]) => {
return Promise.all(entries.map(([, entry]) => {
const { resolver, value } = entry;

@@ -373,0 +373,0 @@ const disposable = resolver;

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

type = 'EOF';
// eslint-disable-next-line no-constant-condition
while (true) {

@@ -42,3 +43,3 @@ if (pos >= end) {

}
let ch = source.charAt(pos);
const ch = source.charAt(pos);
// Whitespace is irrelevant

@@ -73,3 +74,3 @@ if (isWhiteSpace(ch)) {

return (type = ch);
case '/':
case '/': {
pos++;

@@ -89,2 +90,3 @@ const nextCh = source.charAt(pos);

continue;
}
default:

@@ -150,3 +152,3 @@ // Scans an identifier.

while (pos < source.length) {
let ch = source.charAt(pos);
const ch = source.charAt(pos);
if (callback(ch)) {

@@ -153,0 +155,0 @@ return;

@@ -5,2 +5,4 @@ // This is kept in a separate .js file to prevent TypeScript re-writing the import() statement to a require() statement

}
// eslint-disable-next-line no-undef
module.exports = { importModule }

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

const container = dependencies.container;
opts = optsWithDefaults(opts, container);
opts = optsWithDefaults(opts);
const modules = dependencies.listModules(globPatterns, opts);

@@ -158,3 +158,3 @@ if (opts.esModules) {

*/
function optsWithDefaults(opts, container) {
function optsWithDefaults(opts) {
return Object.assign({

@@ -191,2 +191,3 @@ // Does a somewhat-deep merge on the registration options.

const regOpts = Object.assign(Object.assign(Object.assign({}, opts.resolverOptions), moduleDescriptorOpts), inlineConfig);
// eslint-disable-next-line @typescript-eslint/ban-types
const reg = regOpts.register

@@ -193,0 +194,0 @@ ? regOpts.register

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

break;
case 'function':
case 'function': {
const next = nextToken();

@@ -40,2 +40,3 @@ if (next.type === 'ident' || next.type === '*') {

break;
}
case '(':

@@ -48,3 +49,3 @@ // Start parsing parameter names.

return params;
case 'ident':
case 'ident': {
// Likely a paren-less arrow function

@@ -64,2 +65,3 @@ // which can have no default args.

return params;
}
/* istanbul ignore next */

@@ -66,0 +68,0 @@ default:

@@ -141,7 +141,7 @@ import { LifetimeType } from './lifetime';

*/
export declare function asClass<T = {}>(Type: Constructor<T>, opts?: BuildResolverOptions<T>): BuildResolver<T> & DisposableResolver<T>;
export declare function asClass<T = object>(Type: Constructor<T>, opts?: BuildResolverOptions<T>): BuildResolver<T> & DisposableResolver<T>;
/**
* Resolves to the specified registration.
*/
export declare function aliasTo<T>(name: string): Resolver<T>;
export declare function aliasTo<T>(name: Parameters<AwilixContainer['resolve']>[0]): Resolver<T>;
/**

@@ -148,0 +148,0 @@ * Given an options object, creates a fluid interface

@@ -9,2 +9,4 @@ "use strict";

const errors_1 = require("./errors");
// We parse the signature of any `Function`, so we want to allow `Function` types.
/* eslint-disable @typescript-eslint/ban-types */
/**

@@ -58,3 +60,3 @@ * RESOLVER symbol can be used by modules loaded by

const resolve = generateResolve(fn);
let result = Object.assign({ resolve }, opts);
const result = Object.assign({ resolve }, opts);
return createDisposableResolver(createBuildResolver(result));

@@ -87,4 +89,4 @@ }

// A function to handle object construction for us, as to make the generateResolve more reusable
const newClass = function newClass() {
return Reflect.construct(Type, arguments);
const newClass = function newClass(...args) {
return Reflect.construct(Type, args);
};

@@ -91,0 +93,0 @@ const resolve = generateResolve(newClass, Type);

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

*
* @param {Any} val
* @param {unknown} val
* Any value to check if it's a function.

@@ -51,3 +51,3 @@ *

*/
export declare function isFunction(val: any): boolean;
export declare function isFunction(val: unknown): boolean;
/**

@@ -54,0 +54,0 @@ * Returns the unique items in the array.

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

function nameValueToObject(name, value) {
let obj = name;
const obj = name;
if (typeof obj === 'string' || typeof obj === 'symbol') {

@@ -63,3 +63,5 @@ return { [name]: value };

*/
function isClass(fn) {
function isClass(
// eslint-disable-next-line @typescript-eslint/ban-types
fn) {
/*tslint:disable-next-line*/

@@ -87,3 +89,3 @@ if (typeof fn !== 'function') {

*
* @param {Any} val
* @param {unknown} val
* Any value to check if it's a function.

@@ -90,0 +92,0 @@ *

{
"name": "awilix",
"version": "8.0.1",
"version": "9.0.0",
"description": "Extremely powerful dependency injection container.",

@@ -13,3 +13,3 @@ "main": "lib/awilix.js",

"engines": {
"node": ">=12.0.0"
"node": ">=14.0.0"
},

@@ -20,3 +20,3 @@ "scripts": {

"test": "npm run check && jest",
"lint": "npm run check && tslint --project tsconfig.json --fix \"{src,examples}/**/*.ts\" && prettier --write \"{src,examples}/**/*.{ts,js}\"",
"lint": "npm run check && eslint --fix \"{src,examples}/**/*.ts\" && prettier --write \"{src,examples}/**/*.{ts,js}\"",
"cover": "npm run test -- --coverage",

@@ -54,36 +54,36 @@ "publish:pre": "npm run lint && npm run build && npm run cover",

"devDependencies": {
"@babel/core": "^7.21.4",
"@babel/plugin-transform-runtime": "^7.21.4",
"@babel/preset-env": "^7.21.4",
"@babel/runtime": "^7.21.0",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.11",
"babel-jest": "^29.5.0",
"@babel/core": "^7.23.2",
"@babel/plugin-transform-runtime": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"@babel/runtime": "^7.23.2",
"@types/jest": "^29.5.5",
"@types/node": "^20.8.4",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"babel-jest": "^29.7.0",
"eslint": "^8.51.0",
"husky": "^8.0.3",
"istanbul": "^0.4.5",
"jest": "^29.5.0",
"jest": "^29.7.0",
"lint-staged": "^13.2.0",
"prettier": "^2.8.7",
"rimraf": "^4.4.1",
"prettier": "^3.0.3",
"rimraf": "^5.0.5",
"rollup": "^3.20.2",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-typescript2": "^0.34.1",
"rollup-plugin-typescript2": "^0.36.0",
"smid": "^0.1.1",
"ts-jest": "^29.1.0",
"tslib": "^2.5.0",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"tslint-config-standard": "^9.0.0",
"typescript": "^5.0.3"
"ts-jest": "^29.1.1",
"tslib": "^2.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"camel-case": "^4.1.2",
"fast-glob": "^3.2.12"
"fast-glob": "^3.3.1"
},
"lint-staged": {
"*.ts": [
"tslint --project tsconfig.json --fix",
"eslint --fix",
"prettier --write"

@@ -90,0 +90,0 @@ ]

@@ -11,6 +11,8 @@ # Awilix

Extremely powerful **Dependency Injection** (DI) container for JavaScript/Node,
written in [TypeScript](http://typescriptlang.org). **Make IoC great again!**
Extremely powerful, performant, & battle-tested **Dependency Injection** (DI) container for JavaScript/Node,
written in [TypeScript](http://typescriptlang.org).
> Check out this
Awilix enables you to write **composable, testable software** using dependency injection **without special annotations**, which in turn decouples your core application code from the intricacies of the DI mechanism.
> 💡 Check out this
> [intro to Dependency Injection with Awilix](https://medium.com/@Jeffijoe/dependency-injection-in-node-js-2016-edition-f2a88efdd427)

@@ -54,3 +56,4 @@

- [Universal Module (Browser Support)](#universal-module-browser-support)
- [Contributing](#contributing)
- [Ecosystem](#ecosystem)
- [Contributing](#contributing)
- [What's in a name?](#whats-in-a-name)

@@ -551,3 +554,3 @@ - [Author](#author)

}
)
})

@@ -1349,4 +1352,12 @@ // We are now ready! We now have a userService, userRepository and emailService!

## Contributing
# Ecosystem
* [`awilix-manager`](https://github.com/kibertoad/awilix-manager): Wrapper that allows eager injection, asynchronous init methods and dependency lookup by tags.
* [`awilix-express`](https://github.com/jeffijoe/awilix-express): Bindings for the Express HTTP library.
* [`awilix-koa`](https://github.com/jeffijoe/awilix-koa): Bindings for the Koa HTTP library.
* [`awilix-router-core`](https://github.com/jeffijoe/awilix-router-core): Library for building HTTP bindings for Awilix with routing.
* [`fastify-awilix`](https://github.com/fastify/fastify-awilix): Bindings for the Fastify framework.
# Contributing
Please see our [contributing.md](./CONTRIBUTING.md)

@@ -1353,0 +1364,0 @@

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

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

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