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

@injex/core

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@injex/core - npm Package Compare versions

Comparing version 3.3.1 to 3.3.2

3

lib/errors.d.ts
import { ModuleName } from "./interfaces";
export declare class BootstrapError extends Error {
constructor(message: string);
}
export declare class InitializeMuduleError extends Error {

@@ -3,0 +6,0 @@ constructor(moduleName: ModuleName);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FactoryModuleNotExistsError = exports.InvalidPluginError = exports.DuplicateDefinitionError = exports.InitializeMuduleError = void 0;
exports.FactoryModuleNotExistsError = exports.InvalidPluginError = exports.DuplicateDefinitionError = exports.InitializeMuduleError = exports.BootstrapError = void 0;
var tslib_1 = require("tslib");
var stdlib_1 = require("@injex/stdlib");
var BootstrapError = /** @class */ (function (_super) {
tslib_1.__extends(BootstrapError, _super);
function BootstrapError(message) {
return _super.call(this, "Bootstrap failed: " + message) || this;
}
return BootstrapError;
}(Error));
exports.BootstrapError = BootstrapError;
var InitializeMuduleError = /** @class */ (function (_super) {

@@ -7,0 +15,0 @@ tslib_1.__extends(InitializeMuduleError, _super);

@@ -8,2 +8,3 @@ import { IConstructor, Logger } from "@injex/stdlib";

private _logger;
private _didBootstrapCalled;
protected config: T;

@@ -10,0 +11,0 @@ hooks: IInjexHooks;

@@ -13,2 +13,3 @@ "use strict";

this._onInitModuleError = this._onInitModuleError.bind(this);
this._didBootstrapCalled = false;
this._moduleRegistry = new Map();

@@ -36,3 +37,8 @@ this._modules = new Map();

switch (_a.label) {
case 0: return [4 /*yield*/, this._initPlugins()];
case 0:
if (this._didBootstrapCalled) {
throw new errors_1.BootstrapError('container bootstrap should run only once.');
}
this._didBootstrapCalled = true;
return [4 /*yield*/, this._initPlugins()];
case 1:

@@ -426,2 +432,5 @@ _a.sent();

this._register(item);
if (!this._didBootstrapCalled) {
return Promise.resolve(this);
}
this._createModule(item);

@@ -428,0 +437,0 @@ var _a = this.getModuleDefinition(item), module = _a.module, metadata = _a.metadata;

6

package.json
{
"name": "@injex/core",
"version": "3.3.1",
"version": "3.3.2",
"description": "Simple, Decorated, Pluggable dependency-injection framework for TypeScript apps",

@@ -47,3 +47,3 @@ "keywords": [

"dependencies": {
"@injex/stdlib": "^3.3.1"
"@injex/stdlib": "^3.3.2"
},

@@ -57,3 +57,3 @@ "devDependencies": {

},
"gitHead": "a185c0956383c9d4e26c3684a17451d2e2b26434"
"gitHead": "6aec8de94c861c012398176bcc8e8fe9543ccd98"
}

@@ -5,2 +5,10 @@ // tslint:disable max-classes-per-file

export class BootstrapError extends Error {
constructor(message: string) {
super(
`Bootstrap failed: ${message}`
)
}
}
export class InitializeMuduleError extends Error {

@@ -7,0 +15,0 @@ constructor(moduleName: ModuleName) {

import { Hook, IConstructor, isFunction, isPromise, Logger, yieldToMain } from "@injex/stdlib";
import { ILazyModule } from "./interfaces";
import { bootstrapSymbol, EMPTY_ARGS, UNDEFINED } from "./constants";
import { DuplicateDefinitionError, FactoryModuleNotExistsError, InitializeMuduleError, InvalidPluginError } from "./errors";
import { BootstrapError, DuplicateDefinitionError, FactoryModuleNotExistsError, InitializeMuduleError, InvalidPluginError } from "./errors";
import { IModule, ModuleName, IInjexHooks, IContainerConfig, IBootstrap, IInjexPlugin, IDefinitionMetadata, AliasMap, AliasFactory } from "./interfaces";

@@ -13,2 +13,3 @@ import metadataHandlers from "./metadataHandlers";

private _logger: Logger;
private _didBootstrapCalled: boolean;

@@ -43,2 +44,3 @@ protected config: T;

this._onInitModuleError = this._onInitModuleError.bind(this);
this._didBootstrapCalled = false;

@@ -57,3 +59,8 @@ this._moduleRegistry = new Map<ModuleName, any>();

public async bootstrap(): Promise<InjexContainer<T>> {
if (this._didBootstrapCalled) {
throw new BootstrapError('container bootstrap should run only once.');
}
this._didBootstrapCalled = true;
await this._initPlugins();

@@ -433,2 +440,6 @@

if (!this._didBootstrapCalled) {
return Promise.resolve(this);
}
this._createModule(item);

@@ -435,0 +446,0 @@

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc