Socket
Socket
Sign inDemoInstall

tsyringe

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsyringe - npm Package Compare versions

Comparing version 2.2.0 to 3.0.0

dist/cjs/decorators.js

12

package.json
{
"name": "tsyringe",
"version": "2.2.0",
"version": "3.0.0",
"description": "Lightweight dependency injection container for JavaScript/TypeScript",
"main": "dist/index.js",
"main": "dist/cjs/index.js",
"module": "./dist/esm5/index.js",
"es2015": "./dist/esm2015/index.js",
"typings": "./dist/typings/index.d.ts",
"scripts": {
"build": "rimraf ./dist && tsc",
"build": "rimraf ./dist && tsc && tsc -p tsconfig.esm5.json && tsc -p tsconfig.esm2015.json && tsc -p tsconfig.types.json",
"test": "npm run lint && jest",

@@ -34,3 +37,3 @@ "test:coverage": "jest --coverage",

"dependencies": {
"reflect-metadata": "^0.1.12"
"tslib": "^1.9.3"
},

@@ -42,2 +45,3 @@ "devDependencies": {

"jest": "^23.6.0",
"reflect-metadata": "^0.1.12",
"rimraf": "^2.6.2",

@@ -44,0 +48,0 @@ "ts-jest": "^23.10.5",

@@ -27,3 +27,3 @@ [![Travis](https://img.shields.io/travis/Microsoft/tsyringe.svg)](https://travis-ci.org/Microsoft/tsyringe/)

```sh
yarn install --save tsyringe
yarn add tsyringe
```

@@ -41,2 +41,10 @@

Add a polyfill for the Reflect API (examples below use reflect-metadata). You can use:
* [reflect-metadata](https://www.npmjs.com/package/reflect-metadata)
* [core-js (core-js/es7/reflect)](https://www.npmjs.com/package/core-js)
* [reflection](https://www.npmjs.com/package/@abraham/reflection)
The Reflect polyfill import should only be added once before DI is used.
## API

@@ -49,4 +57,3 @@ ### injectable()

```typescript
import {decorators} from "tsyringe";
const {injectable} = decorators;
import {injectable} from "tsyringe";

@@ -59,2 +66,3 @@ @injectable()

// some other file
import "reflect-metadata";
import {container} from "tsyringe";

@@ -72,4 +80,3 @@ import {Foo} from "./foo";

```typescript
import {decorators} from "tsyringe";
const {singleton} = decorators;
import {singleton} from "tsyringe";

@@ -82,2 +89,3 @@ @singleton()

// some other file
import "reflect-metadata";
import {container} from "tsyringe";

@@ -97,4 +105,3 @@ import {Foo} from "./foo";

```typescript
import {decorators} from "tsyringe";
const {autoInjectable} = decorators;
import {autoInjectable} from "tsyringe";

@@ -121,4 +128,3 @@ @autoInjectable()

```typescript
import {decorators} from "tsyringe";
const {injectable, inject} = decorators;
import {injectable, inject} from "tsyringe";

@@ -147,4 +153,3 @@ interface Database {

import {Foo} from "./Foo";
import {decorators} from "tsyringe";
const {injectable} = decorators;
import {injectable} from "tsyringe";

@@ -158,2 +163,3 @@ @injectable()

// main.ts
import "reflect-metadata";
import {container} from "tsyringe";

@@ -185,4 +191,3 @@ import {Bar} from "./Bar";

// Client.ts
import {decorators} from "tsyringe";
const {injectable, inject} = decorators;
import {injectable, inject} from "tsyringe";

@@ -196,2 +201,3 @@ @injectable()

// main.ts
import "reflect-metadata";
import {Client} from "./Client";

@@ -198,0 +204,0 @@ import {TestService} from "./TestService";

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