Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@adonisjs/fold

Package Overview
Dependencies
Maintainers
3
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adonisjs/fold - npm Package Compare versions

Comparing version 9.3.2-0 to 9.4.0-0

build/src/debug.d.ts

7

build/src/container.js
import { isClass } from './helpers.js';
import { ContainerResolver } from './resolver.js';
import { InvalidBindingKeyException } from './exceptions/invalid_binding_key_exception.js';
import debug from './debug.js';
export class Container {

@@ -32,2 +33,3 @@ #swaps = new Map();

}
debug('adding binding to container "%O"', binding);
this.#bindings.set(binding, { resolver, isSingleton: false });

@@ -39,2 +41,3 @@ }

}
debug('adding value to container "%O"', binding);
this.#bindingValues.set(binding, value);

@@ -46,2 +49,3 @@ }

}
debug('adding singleton to container "%O"', binding);
this.#bindings.set(binding, { resolver, isSingleton: true });

@@ -53,2 +57,3 @@ }

}
debug('defining swap for "%O"', binding);
this.#swaps.set(binding, resolver);

@@ -60,2 +65,3 @@ }

}
debug('removing swap for "%s"', binding);
this.#swaps.delete(binding);

@@ -65,2 +71,3 @@ }

if (!bindings) {
debug('removing all swaps');
this.#swaps.clear();

@@ -67,0 +74,0 @@ return;

8

build/src/module_expression.js

@@ -16,3 +16,3 @@ import { resolveDefault } from './helpers.js';

if (container) {
return async function (args) {
return async function (...args) {
defaultExport = defaultExport || (await resolveDefault(importPath, parentURL));

@@ -22,3 +22,3 @@ return container.call(await container.make(defaultExport), method, args);

}
return async function (resolver, args) {
return async function (resolver, ...args) {
defaultExport = defaultExport || (await resolveDefault(importPath, parentURL));

@@ -33,3 +33,3 @@ return resolver.call(await resolver.make(defaultExport), method, args);

return {
async handle(args) {
async handle(...args) {
defaultExport = defaultExport || (await resolveDefault(importPath, parentURL));

@@ -41,3 +41,3 @@ return container.call(await container.make(defaultExport), method, args);

return {
async handle(resolver, args) {
async handle(resolver, ...args) {
defaultExport = defaultExport || (await resolveDefault(importPath, parentURL));

@@ -44,0 +44,0 @@ return resolver.call(await resolver.make(defaultExport), method, args);

@@ -7,3 +7,3 @@ import { importDefault } from './helpers.js';

if (container) {
return async function (args) {
return async function (...args) {
defaultExport = defaultExport || (await importDefault(importFn));

@@ -13,3 +13,3 @@ return container.call(await container.make(defaultExport), method, args);

}
return async function (resolver, args) {
return async function (resolver, ...args) {
defaultExport = defaultExport || (await importDefault(importFn));

@@ -23,3 +23,3 @@ return resolver.call(await resolver.make(defaultExport), method, args);

return {
async handle(args) {
async handle(...args) {
defaultExport = defaultExport || (await importDefault(importFn));

@@ -31,3 +31,3 @@ return container.call(await container.make(defaultExport), method, args);

return {
async handle(resolver, args) {
async handle(resolver, ...args) {
defaultExport = defaultExport || (await importDefault(importFn));

@@ -34,0 +34,0 @@ return resolver.call(await resolver.make(defaultExport), method, args);

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

import debug from './debug.js';
import { inspect } from 'node:util';

@@ -12,2 +13,10 @@ import string from '@poppinss/utils/string';

if (values.length > injections.length) {
if (debug.enabled) {
debug('created resolver plan. target: "[class %s]", property: "%s", injections: %O', binding.name, property, values.map((value, index) => {
if (value !== undefined) {
return value;
}
return injections[index];
}));
}
return Promise.all(values.map((value, index) => {

@@ -24,2 +33,10 @@ if (value !== undefined) {

}
if (debug.enabled) {
debug('created resolver plan. target: "[class %s]", property: "%s", injections: %O', binding.name, property, injections.map((injection, index) => {
if (values[index] !== undefined) {
return values[index];
}
return injection;
}));
}
return Promise.all(injections.map((injection, index) => {

@@ -26,0 +43,0 @@ if (values[index] !== undefined) {

import { inspect } from 'node:util';
import string from '@poppinss/utils/string';
import debug from './debug.js';
import { isClass } from './helpers.js';

@@ -25,2 +26,3 @@ import { containerProvider } from './provider.js';

#emit(binding, value) {
debug('resolved from container. binding :%O, resolved value :%O', binding, value);
if (!this.#options.emitter) {

@@ -107,4 +109,5 @@ return;

}
debug('adding value to resolver "%O"', binding);
this.#bindingValues.set(binding, value);
}
}

@@ -38,7 +38,7 @@ import type { Container } from './container.js';

};
export type ModuleCallable<T, Args extends any[]> = T extends undefined ? (resolver: ContainerResolver<any> | Container<any>, args: Args) => Promise<any> : (args: Args) => Promise<any>;
export type ModuleCallable<T, Args extends any[]> = T extends undefined ? (resolver: ContainerResolver<any> | Container<any>, ...args: Args) => Promise<any> : (...args: Args) => Promise<any>;
export type ModuleHandler<T, Args extends any[]> = T extends undefined ? {
handle(resolver: ContainerResolver<any> | Container<any>, args: Args): Promise<any>;
handle(resolver: ContainerResolver<any> | Container<any>, ...args: Args): Promise<any>;
} : {
handle(args: Args): Promise<any>;
handle(...args: Args): Promise<any>;
};
{
"name": "@adonisjs/fold",
"version": "9.3.2-0",
"version": "9.4.0-0",
"description": "Simplest and straight forward implementation for IoC container in JavaScript",

@@ -24,3 +24,3 @@ "main": "build/index.js",

"vscode:test": "node --loader=ts-node/esm --experimental-import-meta-resolve bin/test.ts",
"test": "c8 npm run vscode:test",
"test": "NODE_DEBUG=adonisjs:fold c8 npm run vscode:test",
"clean": "del-cli build",

@@ -27,0 +27,0 @@ "benchmark": "npm run build && node --experimental-import-meta-resolve build/benchmark/module_expression.js && node --experimental-import-meta-resolve build/benchmark/module_importer.js",

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