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

tapable-ts

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tapable-ts - npm Package Compare versions

Comparing version 0.0.2 to 0.1.0

15

dist/hooks.d.ts

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

interface Interceptor<Args extends any[], ReturnType, ContextType> {
declare type Interceptor<Args extends any[], ReturnType, ContextType> = {
name?: string;
tap?: (tap: Tap<Args, ReturnType, ContextType>) => void;
call?: (...args: Args) => void;
loop?: (...args: Args) => void;

@@ -9,3 +7,10 @@ error?: (err: Error) => void;

done?: () => void;
}
tap?: (tap: Tap<Args, ReturnType, ContextType>) => void;
} & ({
context?: false;
call?: (...args: Args) => void;
} | {
context: true;
call?: (context: ContextType, ...args: Args) => void;
});
declare type Tap<Args extends any[], ReturnType, ContextType = unknown> = {

@@ -43,3 +48,3 @@ key: Symbol;

tap(tap: Tap<Args, ReturnType, ContextType>): void;
call(...args: Args): void;
call(ctx: ContextType, ...args: Args): void;
loop(...args: Args): void;

@@ -46,0 +51,0 @@ error(err: unknown): void;

@@ -33,7 +33,11 @@ 'use strict';

}
call(...args) {
call(ctx, ...args) {
if (this.interceptionKeySet.has("call")) {
this.interceptions.forEach((i) => {
var _a;
(_a = i.call) == null ? void 0 : _a.call(i, ...args);
var _a, _b;
if (i.context) {
(_a = i.call) == null ? void 0 : _a.call(i, ctx, ...args);
} else {
(_b = i.call) == null ? void 0 : _b.call(i, ...args);
}
});

@@ -117,3 +121,3 @@ }

const ctx = {};
this.interceptions.call(...args);
this.interceptions.call(ctx, ...args);
try {

@@ -136,3 +140,3 @@ this.taps.forEach((t) => {

const ctx = {};
this.interceptions.call(...args);
this.interceptions.call(ctx, ...args);
for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {

@@ -151,3 +155,3 @@ const rtn = callTap(this.taps[tapIndex], args, ctx);

const ctx = {};
this.interceptions.call(...args);
this.interceptions.call(ctx, ...args);
let [rtn, ...rest] = args;

@@ -168,3 +172,3 @@ for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {

const ctx = {};
this.interceptions.call(...args);
this.interceptions.call(ctx, ...args);
try {

@@ -192,3 +196,3 @@ while (finished !== true) {

const ctx = {};
this.interceptions.call(...args);
this.interceptions.call(ctx, ...args);
await Promise.allSettled(this.taps.map((tap) => callTap(tap, args, ctx)));

@@ -201,3 +205,3 @@ this.interceptions.done();

const ctx = {};
this.interceptions.call(...args);
this.interceptions.call(ctx, ...args);
try {

@@ -216,3 +220,3 @@ const rtn = await Promise.race(this.taps.map((tap) => callTap(tap, args, ctx)));

const ctx = {};
this.interceptions.call(...args);
this.interceptions.call(ctx, ...args);
try {

@@ -232,3 +236,3 @@ for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {

const ctx = {};
this.interceptions.call(...args);
this.interceptions.call(ctx, ...args);
try {

@@ -253,3 +257,3 @@ for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {

const ctx = {};
this.interceptions.call(...args);
this.interceptions.call(ctx, ...args);
try {

@@ -274,3 +278,3 @@ for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {

const ctx = {};
this.interceptions.call(...args);
this.interceptions.call(ctx, ...args);
try {

@@ -277,0 +281,0 @@ while (finished !== true) {

{
"name": "tapable-ts",
"version": "0.0.2",
"version": "0.1.0",
"description": "A TS implementation of tapable",

@@ -5,0 +5,0 @@ "main": "./dist/hooks.js",

# tapable-ts
![npm](https://img.shields.io/npm/v/tapable-ts) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/tapable-ts) ![NPM](https://img.shields.io/npm/l/tapable-ts)
A TypeScript rewrite of [`tapable`](https://github.com/webpack/tapable)

@@ -4,0 +6,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

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