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

@savks/js-container

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@savks/js-container - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0-beta.1

dist/appFunction.d.ts

9

dist/Application.d.ts

@@ -1,9 +0,8 @@

import { Services } from './Services';
declare type MaybePromise<T> = T | Promise<T>;
declare type Concrete<Name extends keyof Services, Services> = ((app: Application<Services>) => MaybePromise<Services[Name]>);
declare type ServiceProvider<S> = {
type MaybePromise<T> = T | Promise<T>;
type Concrete<Name extends keyof S, S> = ((app: Application<S>) => MaybePromise<S[Name]>);
type ServiceProvider<S> = {
register?: (app: Application<S>) => void;
boot?: (app: Application<S>) => void;
};
declare class Application<S extends Record<string, any> = Services> {
declare class Application<S> {
#private;

@@ -10,0 +9,0 @@ get booted(): boolean;

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

import isPromise from 'is-promise';
class Application {

@@ -8,6 +7,3 @@ #sharedResolving = {};

#booted = false;
#watchers = {
onServiceBound: [],
onServiceResolved: [],
};
#watchers = { onServiceBound: [], onServiceResolved: [] };
get booted() {

@@ -29,3 +25,3 @@ return this.#booted;

}
const isReady = watcher.deps.every(dep => this.#bindings.hasOwnProperty(dep));
const isReady = watcher.deps.every(dep => Object.hasOwn(this.#bindings, dep));
if (!isReady) {

@@ -45,4 +41,4 @@ return;

make(name) {
if (!this.#bindings.hasOwnProperty(name)) {
throw new Error(`Undeclared service "${name}"`);
if (!Object.hasOwn(this.#bindings, name)) {
throw new Error(`Undeclared service "${typeof name === 'string' ? name : name.toString()}"`);
}

@@ -52,6 +48,6 @@ if (!this.#bindings[name].shared) {

}
if (this.#shared.hasOwnProperty(name)) {
if (Object.hasOwn(this.#shared, name)) {
return new Promise(resolve => resolve(this.#shared[name]));
}
if (this.#sharedResolving.hasOwnProperty(name)) {
if (Object.hasOwn(this.#sharedResolving, name)) {
return this.#sharedResolving[name];

@@ -76,3 +72,3 @@ }

waitFor(deps, callback) {
const isDepsReady = deps.every(dep => this.#bindings.hasOwnProperty(dep));
const isDepsReady = deps.every(dep => Object.hasOwn(this.#bindings, dep));
if (isDepsReady) {

@@ -146,4 +142,9 @@ const services = (async () => {

}
;
export default Application;
function isPromise(obj) {
return !!obj
&& (typeof obj === 'object' || typeof obj === 'function')
&& 'then' in obj
&& typeof obj.then === 'function';
}
//# sourceMappingURL=Application.js.map

@@ -1,3 +0,4 @@

import Application from './Application';
export { Services } from './Services';
import appFunction from './appFunction.js';
import Application from './Application.js';
export { appFunction };
export default Application;

@@ -1,3 +0,5 @@

import Application from './Application';
import appFunction from './appFunction.js';
import Application from './Application.js';
export { appFunction };
export default Application;
//# sourceMappingURL=index.js.map
{
"name": "@savks/js-container",
"version": "2.0.0",
"version": "3.0.0-beta.1",
"description": "JS Application Container",

@@ -9,2 +9,3 @@ "license": "MIT",

"types": "dist/index.d.ts",
"type": "module",
"scripts": {

@@ -15,6 +16,9 @@ "build": "tsc",

"devDependencies": {
"typescript": "^4.4.3"
"@tarik02/eslint-config-type-1": "^0.2.1",
"@tarik02/eslint-config-type-1-import": "^0.2.1",
"eslint": "^8.37.0",
"typescript": "^5.0.0"
},
"volta": {
"node": "17.9.0"
"node": "19.8.1"
},

@@ -26,5 +30,3 @@ "files": [

],
"dependencies": {
"is-promise": "^4.0.0"
}
"dependencies": {}
}

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