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

@wessberg/di-compiler

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wessberg/di-compiler - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

6

dist/cjs/ClassConstructorArgumentsStringifier/ClassConstructorArgumentsStringifier.js

@@ -20,3 +20,4 @@ "use strict";

getClassConstructorArgumentsStringified(classes, mappedInterfaces) {
let map = `${globalobject_1.GlobalObjectIdentifier}.${this.config.interfaceConstructorArgumentsMapName} = {\n`;
const identifier = `${globalobject_1.GlobalObjectIdentifier}.${this.config.interfaceConstructorArgumentsMapName}`;
let map = "{\n";
const keys = Object.keys(mappedInterfaces);

@@ -36,3 +37,4 @@ const classKeys = Object.keys(classes);

map += "};";
return map;
const returnValue = `const ${this.config.interfaceConstructorArgumentsMapName} = ${map}`;
return returnValue + `\n${identifier} = ${identifier} != null ? Object.assign(${identifier}, ${this.config.interfaceConstructorArgumentsMapName}) : ${this.config.interfaceConstructorArgumentsMapName};`;
}

@@ -39,0 +41,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const codeanalyzer_1 = require("@wessberg/codeanalyzer");
/**

@@ -40,4 +41,10 @@ * The compiler will upgrade the source code. It looks for every time a service is registered and mimics reflection.

const statements = host.addFile(filepath, code);
const imports = host.getImportDeclarationsForFile(filepath, true);
const paths = new Set([filepath, ...imports.map(importDeclaration => {
if (importDeclaration.source instanceof codeanalyzer_1.BindingIdentifier)
return "";
return importDeclaration.source.fullPath();
}).filter(part => part.length > 0)]);
// Tracks class declarations so we can extract their constructor arguments and decide if we should dependency inject them.
Object.assign(Compiler.classes, host.getClassDeclarations(statements, true));
paths.forEach(path => Object.assign(Compiler.classes, host.getClassDeclarationsForFile(path, true)));
// Finds all references to the DIContainer instance.

@@ -44,0 +51,0 @@ const identifiers = this.containerReferenceFinder.find({ host, statements });

@@ -18,3 +18,4 @@ import { GlobalObjectIdentifier } from "@wessberg/globalobject";

getClassConstructorArgumentsStringified(classes, mappedInterfaces) {
let map = `${GlobalObjectIdentifier}.${this.config.interfaceConstructorArgumentsMapName} = {\n`;
const identifier = `${GlobalObjectIdentifier}.${this.config.interfaceConstructorArgumentsMapName}`;
let map = "{\n";
const keys = Object.keys(mappedInterfaces);

@@ -34,3 +35,4 @@ const classKeys = Object.keys(classes);

map += "};";
return map;
const returnValue = `const ${this.config.interfaceConstructorArgumentsMapName} = ${map}`;
return returnValue + `\n${identifier} = ${identifier} != null ? Object.assign(${identifier}, ${this.config.interfaceConstructorArgumentsMapName}) : ${this.config.interfaceConstructorArgumentsMapName};`;
}

@@ -37,0 +39,0 @@ /**

@@ -0,1 +1,2 @@

import { BindingIdentifier } from "@wessberg/codeanalyzer";
/**

@@ -38,4 +39,10 @@ * The compiler will upgrade the source code. It looks for every time a service is registered and mimics reflection.

const statements = host.addFile(filepath, code);
const imports = host.getImportDeclarationsForFile(filepath, true);
const paths = new Set([filepath, ...imports.map(importDeclaration => {
if (importDeclaration.source instanceof BindingIdentifier)
return "";
return importDeclaration.source.fullPath();
}).filter(part => part.length > 0)]);
// Tracks class declarations so we can extract their constructor arguments and decide if we should dependency inject them.
Object.assign(Compiler.classes, host.getClassDeclarations(statements, true));
paths.forEach(path => Object.assign(Compiler.classes, host.getClassDeclarationsForFile(path, true)));
// Finds all references to the DIContainer instance.

@@ -42,0 +49,0 @@ const identifiers = this.containerReferenceFinder.find({ host, statements });

{
"name": "@wessberg/di-compiler",
"version": "1.0.5",
"version": "1.0.6",
"description": "The compiler for https://www.npmjs.com/package/@wessberg/di",

@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js",

@@ -27,2 +27,7 @@ # DI-Compiler (The compiler for DI) [![NPM version][npm-image]][npm-url]

**v1.0.6**:
- The Compiler will now parse all imports for classes before proceeding.
- The Compiler will now check if another global constructor arguments map exists and assign to it if it exists instead of overwriting it.
**v1.0.5**:

@@ -29,0 +34,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