Socket
Socket
Sign inDemoInstall

awilix

Package Overview
Dependencies
16
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0-rc.3 to 3.0.0-rc.4

lib/awilix.browser.js

1

lib/awilix.d.ts
export * from './errors';
export * from './list-modules';
export * from './container';

@@ -4,0 +3,0 @@ export * from './resolvers';

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

@@ -0,0 +0,0 @@ import { ResolutionStack } from './container';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const os_1 = require("os");
/**
* Newline.
*/
const EOL = '\n';
/**
* An extendable error class.

@@ -111,3 +114,3 @@ * @author https://github.com/bjyoungblood/es6-error/

}
msg += os_1.EOL + os_1.EOL;
msg += EOL + EOL;
msg += `Resolution path: ${resolutionPathString}`;

@@ -114,0 +117,0 @@ super(msg);

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ import * as glob from 'glob';

@@ -0,0 +0,0 @@ import { ModuleDescriptor, GlobWithOptions, listModules } from './list-modules';

@@ -0,0 +0,0 @@ /**

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

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

{
"name": "awilix",
"version": "3.0.0-rc.3",
"description": "Simple dependency injection container + helper utilities to facilitate wiring of modules",
"version": "3.0.0-rc.4",
"description": "Extremely powerful dependency injection container.",
"main": "lib/awilix.js",
"module": "lib/awilix.module.js",
"jsnext:main": "lib/awilix.module.js",
"browser": "lib/awilix.browser.js",
"umd:main": "lib/awilix.umd.js",
"react-native": "lib/awilix.module.js",
"typings": "lib/awilix.d.ts",

@@ -11,3 +16,3 @@ "engines": {

"scripts": {
"build": "rimraf lib && tsc -p tsconfig.build.json",
"build": "rimraf lib && tsc -p tsconfig.build.json && rollup -c",
"check": "tsc -p tsconfig.json --noEmit",

@@ -47,4 +52,7 @@ "test": "npm run check && jest",

"@types/jest": "^21.1.8",
"@types/node": "^8.0.53",
"@types/prettier": "^1.8.0",
"@types/node": "^8.0.57",
"@types/prettier": "^1.8.1",
"babel-jest": "^21.2.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.1",
"coveralls": "^3.0.0",

@@ -54,10 +62,13 @@ "husky": "^0.14.3",

"jest": "^21.2.1",
"lint-staged": "^5.0.0",
"prettier": "^1.8.2",
"lint-staged": "^6.0.0",
"prettier": "^1.9.1",
"rollup": "^0.52.1",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-typescript2": "^0.8.4",
"smid": "^0.1.1",
"ts-jest": "^21.2.3",
"ts-jest": "^21.2.4",
"tslint": "^5.8.0",
"tslint-config-prettier": "^1.6.0",
"tslint-config-standard": "^7.0.0",
"typescript": "^2.6.1"
"typescript": "^2.6.2"
},

@@ -67,3 +78,3 @@ "dependencies": {

"glob": "^7.1.2",
"tslib": "^1.8.0"
"tslib": "^1.8.1"
},

@@ -81,2 +92,18 @@ "lint-staged": {

},
"babel": {
"plugins": [
"transform-runtime"
],
"presets": [
[
"env",
{
"targets": {
"browsers": "last 2 versions",
"node": "6.0.0"
}
}
]
]
},
"jest": {

@@ -88,3 +115,4 @@ "mapCoverage": true,

"/node_modules/",
"__tests__"
"__tests__",
"lib"
],

@@ -97,5 +125,6 @@ "moduleFileExtensions": [

"transform": {
"^.+\\.(j|t)sx?$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
"^.+\\.tsx?$": "<rootDir>/node_modules/ts-jest/preprocessor.js",
"^.+\\.jsx?$": "<rootDir>/node_modules/babel-jest"
}
}
}

@@ -15,4 +15,4 @@ # Awilix

Extremely powerful **Inversion of Control** (IoC) container for Node with
dependency resolution support powered by `Proxy`. Make IoC great again!
Extremely powerful **Dependency Injection** (DI) container for JavaScript/Node,
written in [TypeScript](http://typescriptlang.org). **Make IoC great again!**

@@ -54,2 +54,3 @@ > Check out this

* [Contributing](#contributing)
* [Using Awilix in the browser](#using-awilix-in-the-browser)
* [What's in a name?](#whats-in-a-name)

@@ -60,2 +61,4 @@ * [Author](#author)

Install with `npm`
```

@@ -65,4 +68,17 @@ npm install awilix --save

_Requires Node v6 or above_
Or `yarn`
```
yarn add awilix
```
You can also use the [UMD](https://github.com/umdjs/umd) build from `unpkg`
```html
<script src="https://unpkg.com/awilix/lib/awilix.umd.js">
<script>
const container = Awilix.createContainer()
</script>
```
# Usage

@@ -437,4 +453,4 @@

* `UserService.js` - exports an ES6 `class UserService {}`
* `emailService.js` - exports a factory function `function
makeEmailService() {}`
* `emailService.js` - exports a factory function
`function makeEmailService() {}`
* `repositories`

@@ -826,4 +842,4 @@ * `UserRepository.js` - exports an ES6 `class UserRepository {}`

**Important**: `listModules` relies on `glob` and therefore does not with
bundlers like Webpack, Rollup and Browserify.
**Important**: `listModules` relies on `glob` and therefore is not supported
with bundlers like Webpack, Rollup and Browserify.

@@ -833,4 +849,4 @@ ## `AwilixResolutionError`

This is a special error thrown when Awilix is unable to resolve all dependencies
(due to missing or cyclic dependencies). You can catch this error and use `err
instanceof AwilixResolutionError` if you wish. It will tell you what
(due to missing or cyclic dependencies). You can catch this error and use
`err instanceof AwilixResolutionError` if you wish. It will tell you what
dependencies it could not find or which ones caused a cycle.

@@ -966,5 +982,5 @@

**This uses a heuristic to determine if it's a constructor function (`function
Database() {...}`); if the function name starts with a capital letter, it will
be `new`ed!**
**This uses a heuristic to determine if it's a constructor function
(`function Database() {...}`); if the function name starts with a capital
letter, it will be `new`ed!**

@@ -978,3 +994,3 @@ Args:

pass the name through as-is. The 2nd parameter is a full module descriptor.
* `resolverOptions`: An `object` passed to the resolvers. Used to configure the
* `opts.resolverOptions`: An `object` passed to the resolvers. Used to configure the
lifetime, injection mode and more of the loaded modules.

@@ -1042,2 +1058,5 @@

**Important**: `loadModules` depends on `glob` and is therefore not supported in
module bundlers like Webpack, Rollup and Browserify.
### `container.createScope()`

@@ -1220,6 +1239,25 @@

# Awilix is a Universal Module
**As of v3**, Awilix ships with official support for browser environments!
The package includes 4 flavors.
* CommonJS, the good ol' Node format - `lib/awilix.js`
* ES Modules, for use with module bundlers **in Node** - `lib/awilix.module.js`
* ES Modules, for use with module bundlers **in the browser** -
`lib/awilix.browser.js`
* UMD, for dropping it into a script tag - `lib/awilix.umd.js`
The `package.json` includes the proper fields for bundlers like Webpack, Rollup
and Browserify to pick the correct version, so you should not have to configure
anything. 😎
**Important**: the browser builds do not support `loadModules` or `listModules`,
because they depend on Node-specific packages.
# Contributing
Clone repo, run `npm i` to install all dependencies, and then `npm run
test-watch` + `npm run lint-watch` to start writing code.
Clone repo, run `npm i` to install all dependencies, and then
`npm run test -- --watchAll` to start writing code.

@@ -1226,0 +1264,0 @@ For code coverage, run `npm run cover`.

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc