New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@travetto/di

Package Overview
Dependencies
Maintainers
1
Versions
319
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@travetto/di - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

10

package.json
{
"name": "@travetto/di",
"displayName": "Dependency Injection",
"version": "2.0.1",
"version": "2.0.2",
"description": "Dependency registration/management and injection support.",

@@ -32,8 +32,8 @@ "keywords": [

"dependencies": {
"@travetto/transformer": "^2.0.1",
"@travetto/registry": "^2.0.1"
"@travetto/transformer": "^2.0.3",
"@travetto/registry": "^2.0.2"
},
"devDependencies": {
"@travetto/config": "^2.0.1",
"@travetto/schema": "^2.0.1"
"@travetto/config": "^2.0.2",
"@travetto/schema": "^2.0.3"
},

@@ -40,0 +40,0 @@ "docDependencies": {

@@ -55,3 +55,3 @@ import { Class, ClassInstance } from '@travetto/base';

export function Inject(first?: InjectConfig | symbol, ...args: (InjectConfig | undefined)[]) {
return (target: unknown, propertyKey: string | symbol, idx?: number) => {
return (target: unknown, propertyKey: string | symbol, idx?: number | PropertyDescriptor) => {
if (typeof idx !== 'number') { // Only register if on property

@@ -58,0 +58,0 @@ const config: InjectConfig = collapseConfig(first, ...args);

import * as ts from 'typescript';
import {
TransformerState, DecoratorMeta, OnClass, OnProperty, OnStaticMethod, DecoratorUtil, LiteralUtil, TransformerId
TransformerState, DecoratorMeta, OnClass, OnProperty, OnStaticMethod, DecoratorUtil, LiteralUtil, TransformerId, OnSetter
} from '@travetto/transformer';

@@ -19,3 +19,3 @@

*/
static processDeclaration(state: TransformerState, param: ts.ParameterDeclaration | ts.PropertyDeclaration) {
static processDeclaration(state: TransformerState, param: ts.ParameterDeclaration | ts.SetAccessorDeclaration | ts.PropertyDeclaration) {
const existing = state.findDecorator(this, param, 'Inject', INJECTABLE_MOD);

@@ -36,3 +36,3 @@

args.unshift(state.fromLiteral({
target: state.getOrImport(state.resolveExternalType(param)),
target: state.getOrImport(state.resolveExternalType(ts.isSetAccessorDeclaration(param) ? param.parameters[0] : param)),
optional

@@ -108,2 +108,22 @@ }));

/**
* Handle Inject annotations for fields/args
*/
@OnSetter('Inject')
static registerInjectSetter(state: TransformerState, node: ts.SetAccessorDeclaration, dm?: DecoratorMeta) {
const decl = state.findDecorator(this, node, 'Inject', INJECTABLE_MOD);
// Doing decls
return state.factory.updateSetAccessorDeclaration(
node,
DecoratorUtil.spliceDecorators(node, decl, [
state.createDecorator(INJECTABLE_MOD, 'Inject', ...this.processDeclaration(state, node)),
], 0),
node.modifiers,
node.name,
node.parameters,
node.body
);
}
/**
* Handle InjectableFactory creation

@@ -110,0 +130,0 @@ */

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