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

cordis

Package Overview
Dependencies
Maintainers
1
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordis - npm Package Compare versions

Comparing version 3.6.1 to 3.7.0

11

lib/index.d.ts

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

runtime: MainScope<this>;
effect(callback: () => () => void): () => void;
effect<T extends DisposableLike>(callback: () => T): T;
/** @deprecated use `ctx.effect()` instead */

@@ -88,2 +88,5 @@ collect(label: string, callback: () => void): () => void;

export type Disposable = () => void;
export type DisposableLike = Disposable | {
dispose: Disposable;
};
export interface AcceptOptions {

@@ -97,3 +100,3 @@ passive?: boolean;

}
export enum ScopeStatus {
export const enum ScopeStatus {
PENDING = 0,

@@ -135,3 +138,5 @@ LOADING = 1,

assertActive(): void;
effect(callback: () => () => void): () => void;
effect(callback: () => DisposableLike): {
dispose: Disposable;
} | (() => void);
collect(label: string, callback: () => any): () => any;

@@ -138,0 +143,0 @@ restart(): void;

{
"name": "cordis",
"description": "AOP Framework for Modern JavaScript Applications",
"version": "3.6.1",
"version": "3.7.0",
"sideEffects": false,
"type": "module",
"main": "lib/index.cjs",
"module": "lib/index.mjs",
"typings": "lib/index.d.ts",
"exports": {
".": {
"require": "./lib/index.cjs",
"import": "./lib/index.mjs",
"types": "./lib/index.d.ts"
},
"./package.json": "./package.json"
},
"repository": {

@@ -39,3 +48,3 @@ "type": "git",

"chai-as-promised": "^7.1.1",
"dtsc": "^2.3.0",
"dtsc": "^3.0.1",
"esbuild": "^0.18.20",

@@ -42,0 +51,0 @@ "esbuild-register": "^3.5.0",

@@ -64,2 +64,10 @@ import { Awaitable, defineProperty, Promisify, remove } from 'cosmokit'

}), Context.static, root.scope)
defineProperty(this.on('internal/error', (error) => {
if (this._hooks['internal/error'].length > 1) return
console.error(error)
}), Context.static, root.scope)
defineProperty(this.on('internal/warning', (error) => {
if (this._hooks['internal/warning'].length > 1) return
console.warn(error)
}), Context.static, root.scope)
}

@@ -66,0 +74,0 @@

@@ -10,3 +10,3 @@ import { deepEqual, defineProperty, isNullable, remove } from 'cosmokit'

runtime: MainScope<this>
effect(callback: () => () => void): () => void
effect<T extends DisposableLike>(callback: () => T): T
/** @deprecated use `ctx.effect()` instead */

@@ -22,2 +22,4 @@ collect(label: string, callback: () => void): () => void

export type DisposableLike = Disposable | { dispose: Disposable }
export interface AcceptOptions {

@@ -33,3 +35,3 @@ passive?: boolean

export enum ScopeStatus {
export const enum ScopeStatus {
PENDING,

@@ -92,11 +94,15 @@ LOADING,

effect(callback: () => () => void) {
effect(callback: () => DisposableLike) {
this.assertActive()
const disposeRaw = callback()
const dispose = () => {
remove(this.disposables, dispose)
disposeRaw()
const result = callback()
const original = typeof result === 'function' ? result : result.dispose.bind(result)
const wrapped = () => {
// make sure the original callback is not called twice
if (!remove(this.disposables, wrapped)) return
return original()
}
this.disposables.push(dispose)
return dispose
this.disposables.push(wrapped)
if (typeof result === 'function') return wrapped
result.dispose = wrapped
return result
}

@@ -103,0 +109,0 @@

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