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

@cordisjs/core

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cordisjs/core - npm Package Compare versions

Comparing version 3.10.1 to 3.10.2

3

lib/index.d.ts

@@ -314,3 +314,2 @@ import { Awaitable, Promisify, Dict } from 'cosmokit';

}
declare const kSetup: unique symbol;
export namespace Service {

@@ -334,3 +333,3 @@ interface Options {

[Context.filter](ctx: Context): boolean;
[kSetup](ctx: C | undefined, name: string, options?: boolean | Service.Options): this;
static [Symbol.hasInstance](instance: any): boolean;
}
{
"name": "@cordisjs/core",
"description": "Meta-Framework for Modern JavaScript Applications",
"version": "3.10.1",
"version": "3.10.2",
"sideEffects": false,

@@ -6,0 +6,0 @@ "type": "module",

import { Awaitable, defineProperty } from 'cosmokit'
import { Context } from './context.ts'
const kSetup = Symbol.for('cordis.service.setup')
export namespace Service {

@@ -17,8 +15,5 @@ export interface Options {

const result = Object.create(makeFunctional(Object.getPrototypeOf(proto)))
for (const key of Object.getOwnPropertyNames(proto)) {
for (const key of Reflect.ownKeys(proto)) {
Object.defineProperty(result, key, Object.getOwnPropertyDescriptor(proto, key)!)
}
for (const key of Object.getOwnPropertySymbols(proto)) {
Object.defineProperty(result, key, Object.getOwnPropertyDescriptor(proto, key)!)
}
return result

@@ -39,3 +34,3 @@ }

constructor(ctx: C | undefined, public readonly name: string, options?: boolean | Service.Options) {
let self: any = this
let self = this
if (self[Context.invoke]) {

@@ -46,35 +41,40 @@ // functional service

return Context.applyProxy(proxy, self, this, args)
}
} as any
defineProperty(self, 'name', name)
Object.setPrototypeOf(self, makeFunctional(Object.getPrototypeOf(this)))
}
return self[kSetup](ctx, name, options)
}
[Context.filter](ctx: Context) {
return ctx[Context.shadow][this.name] === this.ctx[Context.shadow][this.name]
}
self.ctx = ctx ?? new (self.constructor as any).Context()
self.ctx.provide(name)
defineProperty(self, Context.current, ctx)
[kSetup](ctx: C | undefined, name: string, options?: boolean | Service.Options) {
this.ctx = ctx ?? new (this.constructor as any).Context()
this.ctx.provide(name)
defineProperty(this, Context.current, ctx)
const resolved = typeof options === 'boolean' ? { immediate: options } : options ?? {}
if (!resolved.standalone && resolved.immediate) {
if (ctx) this[Context.expose] = name
else this.ctx[name] = this
if (ctx) self[Context.expose] = name
else self.ctx[name] = self
}
this.ctx.on('ready', async () => {
self.ctx.on('ready', async () => {
// await until next tick because derived class has not been initialized yet
await Promise.resolve()
await this.start()
if (!resolved.standalone && !resolved.immediate) this.ctx[name] = this
await self.start()
if (!resolved.standalone && !resolved.immediate) self.ctx[name] = self
})
this.ctx.on('dispose', () => this.stop())
self.ctx.on('dispose', () => self.stop())
return Context.associate(self, name)
}
return Context.associate(this, name)
[Context.filter](ctx: Context) {
return ctx[Context.shadow][this.name] === this.ctx[Context.shadow][this.name]
}
static [Symbol.hasInstance](instance: any) {
let constructor = instance.constructor
while (constructor) {
if (constructor === this) return true
constructor = Object.getPrototypeOf(constructor)
}
return false
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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