Comparing version 2.0.0-beta.0 to 2.0.0-beta.1
@@ -13,4 +13,3 @@ /* | ||
class Hook { | ||
constructor(args) { | ||
if (!Array.isArray(args)) args = []; | ||
constructor(args = []) { | ||
this._args = args; | ||
@@ -38,12 +37,17 @@ this.taps = []; | ||
tap(options, fn) { | ||
if (typeof options === "string") options = { name: options }; | ||
if (typeof options !== "object" || options === null) | ||
throw new Error( | ||
"Invalid arguments to tap(options: Object, fn: function)" | ||
); | ||
if (typeof options.name !== "string" || options.name === "") | ||
_tap(type, options, fn) { | ||
if (typeof options === "string") { | ||
options = { | ||
name: options | ||
}; | ||
} else if (typeof options !== "object" || options === null) { | ||
throw new Error("Invalid tap options"); | ||
} | ||
if (typeof options.name !== "string" || options.name === "") { | ||
throw new Error("Missing name for tap"); | ||
if (typeof options.context !== "undefined") deprecateContext(); | ||
options = Object.assign({ type: "sync", fn: fn }, options); | ||
} | ||
if (typeof options.context !== "undefined") { | ||
deprecateContext(); | ||
} | ||
options = Object.assign({ type, fn }, options); | ||
options = this._runRegisterInterceptors(options); | ||
@@ -53,28 +57,12 @@ this._insert(options); | ||
tap(options, fn) { | ||
this._tap("sync", options, fn); | ||
} | ||
tapAsync(options, fn) { | ||
if (typeof options === "string") options = { name: options }; | ||
if (typeof options !== "object" || options === null) | ||
throw new Error( | ||
"Invalid arguments to tapAsync(options: Object, fn: function)" | ||
); | ||
if (typeof options.name !== "string" || options.name === "") | ||
throw new Error("Missing name for tapAsync"); | ||
if (typeof options.context !== "undefined") deprecateContext(); | ||
options = Object.assign({ type: "async", fn: fn }, options); | ||
options = this._runRegisterInterceptors(options); | ||
this._insert(options); | ||
this._tap("async", options, fn); | ||
} | ||
tapPromise(options, fn) { | ||
if (typeof options === "string") options = { name: options }; | ||
if (typeof options !== "object" || options === null) | ||
throw new Error( | ||
"Invalid arguments to tapPromise(options: Object, fn: function)" | ||
); | ||
if (typeof options.name !== "string" || options.name === "") | ||
throw new Error("Missing name for tapPromise"); | ||
if (typeof options.context !== "undefined") deprecateContext(); | ||
options = Object.assign({ type: "promise", fn: fn }, options); | ||
options = this._runRegisterInterceptors(options); | ||
this._insert(options); | ||
this._tap("promise", options, fn); | ||
} | ||
@@ -181,9 +169,9 @@ | ||
}, | ||
_promise: { | ||
value: createCompileDelegate("promise", "promise"), | ||
_callAsync: { | ||
value: createCompileDelegate("callAsync", "async"), | ||
configurable: true, | ||
writable: true | ||
}, | ||
_callAsync: { | ||
value: createCompileDelegate("callAsync", "async"), | ||
_promise: { | ||
value: createCompileDelegate("promise", "promise"), | ||
configurable: true, | ||
@@ -190,0 +178,0 @@ writable: true |
@@ -8,3 +8,2 @@ /* | ||
exports.__esModule = true; | ||
exports.Tapable = require("./Tapable"); | ||
exports.SyncHook = require("./SyncHook"); | ||
@@ -18,4 +17,5 @@ exports.SyncBailHook = require("./SyncBailHook"); | ||
exports.AsyncSeriesBailHook = require("./AsyncSeriesBailHook"); | ||
exports.AsyncSeriesLoopHook = require("./AsyncSeriesLoopHook"); | ||
exports.AsyncSeriesWaterfallHook = require("./AsyncSeriesWaterfallHook"); | ||
exports.HookMap = require("./HookMap"); | ||
exports.MultiHook = require("./MultiHook"); |
{ | ||
"name": "tapable", | ||
"version": "2.0.0-beta.0", | ||
"version": "2.0.0-beta.1", | ||
"author": "Tobias Koppers @sokra", | ||
"description": "Just a little module for plugins.", | ||
"license": "MIT", | ||
"homepage": "https://github.com/webpack/tapable", | ||
"repository": { | ||
@@ -24,6 +25,7 @@ "type": "git", | ||
"files": [ | ||
"lib" | ||
"lib", | ||
"tapable.d.ts" | ||
], | ||
"homepage": "https://github.com/webpack/tapable", | ||
"main": "lib/index.js", | ||
"types": "./tapable.d.ts", | ||
"scripts": { | ||
@@ -30,0 +32,0 @@ "test": "jest", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
236416
32
2843