@rsbuild/core 2.0.0-beta.0 → 2.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/chokidar/index.d.ts +197 -29
- package/compiled/chokidar/package.json +1 -1
- package/compiled/connect-next/index.d.ts +56 -0
- package/compiled/connect-next/license +26 -0
- package/compiled/connect-next/package.json +1 -0
- package/compiled/cors/index.d.ts +56 -0
- package/compiled/cors/license +22 -0
- package/compiled/cors/package.json +1 -0
- package/compiled/css-loader/index.js +2 -2
- package/compiled/css-loader/package.json +1 -1
- package/compiled/html-rspack-plugin/index.d.ts +102 -1
- package/compiled/html-rspack-plugin/index.js +863 -20
- package/compiled/html-rspack-plugin/package.json +1 -1
- package/compiled/http-proxy-middleware/index.d.ts +268 -43
- package/compiled/http-proxy-middleware/package.json +1 -1
- package/compiled/jiti/LICENSE +21 -0
- package/compiled/jiti/README.md +243 -0
- package/compiled/jiti/dist/babel.cjs +46699 -0
- package/compiled/jiti/dist/jiti.cjs +4842 -0
- package/compiled/jiti/lib/jiti-cli.mjs +19 -0
- package/compiled/jiti/lib/jiti-hooks.mjs +89 -0
- package/compiled/jiti/lib/jiti-native.mjs +76 -0
- package/compiled/jiti/lib/jiti-register.d.mts +1 -0
- package/compiled/jiti/lib/jiti-register.mjs +2 -0
- package/compiled/jiti/lib/jiti.cjs +24 -0
- package/compiled/jiti/lib/jiti.d.cts +8 -0
- package/compiled/jiti/lib/jiti.d.mts +8 -0
- package/compiled/jiti/lib/jiti.mjs +23 -0
- package/compiled/jiti/lib/types.d.ts +363 -0
- package/compiled/jiti/package.json +133 -0
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss/lib/at-rule.d.ts +1 -1
- package/compiled/postcss/lib/comment.d.ts +1 -1
- package/compiled/postcss/lib/container.d.ts +1 -1
- package/compiled/postcss/lib/css-syntax-error.d.ts +1 -1
- package/compiled/postcss/lib/declaration.d.ts +1 -1
- package/compiled/postcss/lib/document.d.ts +1 -1
- package/compiled/postcss/lib/input.d.ts +1 -1
- package/compiled/postcss/lib/lazy-result.d.ts +1 -1
- package/compiled/postcss/lib/no-work-result.d.ts +1 -1
- package/compiled/postcss/lib/node.d.ts +1 -1
- package/compiled/postcss/lib/previous-map.d.ts +1 -1
- package/compiled/postcss/lib/processor.d.ts +1 -1
- package/compiled/postcss/lib/result.d.ts +1 -1
- package/compiled/postcss/lib/root.d.ts +1 -1
- package/compiled/postcss/lib/rule.d.ts +1 -1
- package/compiled/postcss/lib/stringifier.d.ts +1 -1
- package/compiled/postcss/lib/warning.d.ts +1 -1
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +10 -9
- package/compiled/postcss-loader/package.json +1 -1
- package/compiled/rslog/index.d.ts +33 -2
- package/compiled/rslog/package.json +1 -1
- package/compiled/rspack-chain/package.json +1 -1
- package/compiled/rspack-chain/types/index.d.ts +0 -5
- package/compiled/rspack-manifest-plugin/index.d.ts +48 -0
- package/compiled/rspack-manifest-plugin/license +21 -0
- package/compiled/rspack-manifest-plugin/package.json +1 -0
- package/compiled/style-loader/index.js +37 -94
- package/compiled/style-loader/package.json +1 -1
- package/dist/{131.js → 958.js} +1706 -1655
- package/dist/chokidar.js +59 -57
- package/dist/client/hmr.js +3 -3
- package/dist/client/overlay.js +2 -2
- package/dist/connect-next.js +268 -0
- package/dist/{connect.js.LICENSE.txt → connect-next.js.LICENSE.txt} +3 -13
- package/dist/cors.js +2 -2
- package/dist/http-proxy-middleware.js +2985 -0
- package/dist/http-proxy-middleware.js.LICENSE.txt +69 -0
- package/dist/index.js +1 -1
- package/dist/launch-editor-middleware.js +96 -16
- package/dist/manifest-plugin.js +543 -21
- package/dist/memfs.js +241 -776
- package/dist/{710.js → mrmime.js} +2 -1
- package/dist/open.js +32 -28
- package/dist/range-parser.js +2 -2
- package/dist/remapping.js +2 -2
- package/dist/rslib-runtime.js +4 -4
- package/dist/sirv.js +14 -14
- package/dist/src.js +510 -0
- package/dist/tinyglobby.js +114 -69
- package/dist/transformLoader.mjs +38 -1
- package/dist/transformRawLoader.mjs +1 -1
- package/dist/ws.js +1549 -0
- package/dist-types/createContext.d.ts +3 -2
- package/dist-types/helpers/format.d.ts +2 -1
- package/dist-types/helpers/fs.d.ts +2 -1
- package/dist-types/helpers/index.d.ts +1 -1
- package/dist-types/helpers/stats.d.ts +4 -3
- package/dist-types/helpers/vendors.d.ts +0 -2
- package/dist-types/hooks.d.ts +3 -3
- package/dist-types/index.d.ts +4 -3
- package/dist-types/initPlugins.d.ts +2 -1
- package/dist-types/logger.d.ts +9 -3
- package/dist-types/pluginManager.d.ts +2 -1
- package/dist-types/restart.d.ts +4 -2
- package/dist-types/server/assets-middleware/index.d.ts +3 -2
- package/dist-types/server/assets-middleware/setupWriteToDisk.d.ts +2 -1
- package/dist-types/server/cliShortcuts.d.ts +4 -1
- package/dist-types/server/devMiddlewares.d.ts +4 -6
- package/dist-types/server/devServer.d.ts +8 -42
- package/dist-types/server/helper.d.ts +50 -16
- package/dist-types/server/historyApiFallback.d.ts +2 -1
- package/dist-types/server/middlewares.d.ts +5 -3
- package/dist-types/server/open.d.ts +4 -2
- package/dist-types/server/previewServer.d.ts +4 -0
- package/dist-types/server/proxy.d.ts +3 -2
- package/dist-types/server/runner/asModule.d.ts +1 -1
- package/dist-types/server/serverSetup.d.ts +2 -0
- package/dist-types/server/socketServer.d.ts +4 -1
- package/dist-types/server/watchFiles.d.ts +1 -1
- package/dist-types/types/config.d.ts +123 -25
- package/dist-types/types/context.d.ts +3 -0
- package/dist-types/types/hooks.d.ts +17 -15
- package/dist-types/types/plugin.d.ts +14 -11
- package/dist-types/types/rsbuild.d.ts +11 -4
- package/dist-types/types/thirdParty.d.ts +15 -6
- package/package.json +23 -26
- package/compiled/chokidar/handler.d.ts +0 -90
- package/compiled/http-proxy-middleware/index.js +0 -5284
- package/compiled/ws/index.d.ts +0 -437
- package/compiled/ws/index.js +0 -3166
- package/compiled/ws/license +0 -20
- package/compiled/ws/package.json +0 -1
- package/dist/397.js +0 -11
- package/dist/7.js +0 -1
- package/dist/743.js +0 -7
- package/dist/88.js +0 -40
- package/dist/connect.js +0 -581
- package/dist-types/server/prodServer.d.ts +0 -24
- /package/compiled/html-rspack-plugin/{loader.js → htmlLoader.js} +0 -0
- /package/dist/{131.js.LICENSE.txt → 958.js.LICENSE.txt} +0 -0
- /package/dist/client/{59.js → 797.js} +0 -0
- /package/dist/{31.js → trace-mapping.js} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
581: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4
4
|
"use strict";
|
|
5
|
-
const { HtmlWebpackChildCompiler } = __nccwpck_require__(
|
|
5
|
+
const { HtmlWebpackChildCompiler } = __nccwpck_require__(62);
|
|
6
6
|
const compilerMap = new WeakMap();
|
|
7
7
|
class CachedChildCompilation {
|
|
8
8
|
constructor(compiler) {
|
|
@@ -311,7 +311,7 @@
|
|
|
311
311
|
}
|
|
312
312
|
module.exports = { CachedChildCompilation };
|
|
313
313
|
},
|
|
314
|
-
|
|
314
|
+
62: (module) => {
|
|
315
315
|
"use strict";
|
|
316
316
|
class HtmlWebpackChildCompiler {
|
|
317
317
|
constructor(templates) {
|
|
@@ -480,7 +480,7 @@
|
|
|
480
480
|
}
|
|
481
481
|
module.exports = { HtmlWebpackChildCompiler };
|
|
482
482
|
},
|
|
483
|
-
|
|
483
|
+
966: (module) => {
|
|
484
484
|
"use strict";
|
|
485
485
|
module.exports = {};
|
|
486
486
|
module.exports.none = (chunks) => chunks;
|
|
@@ -499,7 +499,7 @@
|
|
|
499
499
|
};
|
|
500
500
|
module.exports.auto = module.exports.none;
|
|
501
501
|
},
|
|
502
|
-
|
|
502
|
+
649: (module) => {
|
|
503
503
|
"use strict";
|
|
504
504
|
module.exports = function (err) {
|
|
505
505
|
return {
|
|
@@ -523,9 +523,9 @@
|
|
|
523
523
|
};
|
|
524
524
|
};
|
|
525
525
|
},
|
|
526
|
-
|
|
526
|
+
784: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
527
527
|
"use strict";
|
|
528
|
-
const { AsyncSeriesWaterfallHook } = __nccwpck_require__(
|
|
528
|
+
const { AsyncSeriesWaterfallHook } = __nccwpck_require__(159);
|
|
529
529
|
const htmlWebpackPluginHooksMap = new WeakMap();
|
|
530
530
|
function getHtmlRspackPluginHooks(compilation) {
|
|
531
531
|
let hooks = htmlWebpackPluginHooksMap.get(compilation);
|
|
@@ -549,7 +549,7 @@
|
|
|
549
549
|
}
|
|
550
550
|
module.exports = { getHtmlRspackPluginHooks };
|
|
551
551
|
},
|
|
552
|
-
|
|
552
|
+
829: (module) => {
|
|
553
553
|
const voidTags = [
|
|
554
554
|
"area",
|
|
555
555
|
"base",
|
|
@@ -617,19 +617,19 @@
|
|
|
617
617
|
htmlTagObjectToString,
|
|
618
618
|
};
|
|
619
619
|
},
|
|
620
|
-
|
|
620
|
+
664: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
621
621
|
"use strict";
|
|
622
622
|
const promisify = __nccwpck_require__(23).promisify;
|
|
623
623
|
const vm = __nccwpck_require__(154);
|
|
624
624
|
const fs = __nccwpck_require__(896);
|
|
625
625
|
const path = __nccwpck_require__(928);
|
|
626
|
-
const { CachedChildCompilation } = __nccwpck_require__(
|
|
626
|
+
const { CachedChildCompilation } = __nccwpck_require__(581);
|
|
627
627
|
const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
|
|
628
|
-
__nccwpck_require__(
|
|
629
|
-
const prettyError = __nccwpck_require__(
|
|
630
|
-
const chunkSorter = __nccwpck_require__(
|
|
628
|
+
__nccwpck_require__(829);
|
|
629
|
+
const prettyError = __nccwpck_require__(649);
|
|
630
|
+
const chunkSorter = __nccwpck_require__(966);
|
|
631
631
|
const getHtmlRspackPluginHooks =
|
|
632
|
-
__nccwpck_require__(
|
|
632
|
+
__nccwpck_require__(784).getHtmlRspackPluginHooks;
|
|
633
633
|
const WITH_PLACEHOLDER = "function __with_placeholder__";
|
|
634
634
|
class HtmlRspackPlugin {
|
|
635
635
|
constructor(userOptions = {}) {
|
|
@@ -758,7 +758,7 @@
|
|
|
758
758
|
}
|
|
759
759
|
}
|
|
760
760
|
if (template.indexOf("!") === -1) {
|
|
761
|
-
const loader = __nccwpck_require__.ab + "
|
|
761
|
+
const loader = __nccwpck_require__.ab + "htmlLoader.js";
|
|
762
762
|
template = loader + "!" + path.resolve(context, template);
|
|
763
763
|
}
|
|
764
764
|
return template.replace(
|
|
@@ -1557,10 +1557,6 @@
|
|
|
1557
1557
|
HtmlRspackPlugin.createHtmlTagObject = createHtmlTagObject;
|
|
1558
1558
|
module.exports = HtmlRspackPlugin;
|
|
1559
1559
|
},
|
|
1560
|
-
408: (module) => {
|
|
1561
|
-
"use strict";
|
|
1562
|
-
module.exports = require("@rspack/lite-tapable");
|
|
1563
|
-
},
|
|
1564
1560
|
896: (module) => {
|
|
1565
1561
|
"use strict";
|
|
1566
1562
|
module.exports = require("fs");
|
|
@@ -1577,6 +1573,853 @@
|
|
|
1577
1573
|
"use strict";
|
|
1578
1574
|
module.exports = require("vm");
|
|
1579
1575
|
},
|
|
1576
|
+
159: (__unused_webpack_module, exports) => {
|
|
1577
|
+
"use strict";
|
|
1578
|
+
var __nested_webpack_require_18__ = {};
|
|
1579
|
+
(() => {
|
|
1580
|
+
__nested_webpack_require_18__.d = (exports1, definition) => {
|
|
1581
|
+
for (var key in definition)
|
|
1582
|
+
if (
|
|
1583
|
+
__nested_webpack_require_18__.o(definition, key) &&
|
|
1584
|
+
!__nested_webpack_require_18__.o(exports1, key)
|
|
1585
|
+
)
|
|
1586
|
+
Object.defineProperty(exports1, key, {
|
|
1587
|
+
enumerable: true,
|
|
1588
|
+
get: definition[key],
|
|
1589
|
+
});
|
|
1590
|
+
};
|
|
1591
|
+
})();
|
|
1592
|
+
(() => {
|
|
1593
|
+
__nested_webpack_require_18__.o = (obj, prop) =>
|
|
1594
|
+
Object.prototype.hasOwnProperty.call(obj, prop);
|
|
1595
|
+
})();
|
|
1596
|
+
(() => {
|
|
1597
|
+
__nested_webpack_require_18__.r = (exports1) => {
|
|
1598
|
+
if ("undefined" != typeof Symbol && Symbol.toStringTag)
|
|
1599
|
+
Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
1600
|
+
value: "Module",
|
|
1601
|
+
});
|
|
1602
|
+
Object.defineProperty(exports1, "__esModule", { value: true });
|
|
1603
|
+
};
|
|
1604
|
+
})();
|
|
1605
|
+
var __nested_webpack_exports__ = {};
|
|
1606
|
+
__nested_webpack_require_18__.r(__nested_webpack_exports__);
|
|
1607
|
+
__nested_webpack_require_18__.d(__nested_webpack_exports__, {
|
|
1608
|
+
AsyncParallelHook: () => AsyncParallelHook,
|
|
1609
|
+
AsyncSeriesBailHook: () => AsyncSeriesBailHook,
|
|
1610
|
+
AsyncSeriesHook: () => AsyncSeriesHook,
|
|
1611
|
+
AsyncSeriesWaterfallHook: () => AsyncSeriesWaterfallHook,
|
|
1612
|
+
HookBase: () => HookBase,
|
|
1613
|
+
HookMap: () => HookMap,
|
|
1614
|
+
MultiHook: () => MultiHook,
|
|
1615
|
+
QueriedHook: () => QueriedHook,
|
|
1616
|
+
QueriedHookMap: () => QueriedHookMap,
|
|
1617
|
+
SyncBailHook: () => SyncBailHook,
|
|
1618
|
+
SyncHook: () => SyncHook,
|
|
1619
|
+
SyncWaterfallHook: () => SyncWaterfallHook,
|
|
1620
|
+
maxStage: () => maxStage,
|
|
1621
|
+
minStage: () => minStage,
|
|
1622
|
+
safeStage: () => safeStage,
|
|
1623
|
+
});
|
|
1624
|
+
function _define_property(obj, key, value) {
|
|
1625
|
+
if (key in obj)
|
|
1626
|
+
Object.defineProperty(obj, key, {
|
|
1627
|
+
value,
|
|
1628
|
+
enumerable: true,
|
|
1629
|
+
configurable: true,
|
|
1630
|
+
writable: true,
|
|
1631
|
+
});
|
|
1632
|
+
else obj[key] = value;
|
|
1633
|
+
return obj;
|
|
1634
|
+
}
|
|
1635
|
+
class HookBase {
|
|
1636
|
+
intercept(interceptor) {
|
|
1637
|
+
this.interceptors.push(Object.assign({}, interceptor));
|
|
1638
|
+
if (interceptor.register)
|
|
1639
|
+
for (let i = 0; i < this.taps.length; i++)
|
|
1640
|
+
this.taps[i] = interceptor.register(this.taps[i]);
|
|
1641
|
+
}
|
|
1642
|
+
_runRegisterInterceptors(options) {
|
|
1643
|
+
return this.interceptors.reduce(
|
|
1644
|
+
(options, interceptor) =>
|
|
1645
|
+
interceptor.register?.(options) ?? options,
|
|
1646
|
+
options,
|
|
1647
|
+
);
|
|
1648
|
+
}
|
|
1649
|
+
_runCallInterceptors(...args) {
|
|
1650
|
+
for (const interceptor of this.interceptors)
|
|
1651
|
+
if (interceptor.call) interceptor.call(...args);
|
|
1652
|
+
}
|
|
1653
|
+
_runErrorInterceptors(e) {
|
|
1654
|
+
for (const interceptor of this.interceptors)
|
|
1655
|
+
if (interceptor.error) interceptor.error(e);
|
|
1656
|
+
}
|
|
1657
|
+
_runTapInterceptors(tap) {
|
|
1658
|
+
for (const interceptor of this.interceptors)
|
|
1659
|
+
if (interceptor.tap) interceptor.tap(tap);
|
|
1660
|
+
}
|
|
1661
|
+
_runDoneInterceptors() {
|
|
1662
|
+
for (const interceptor of this.interceptors)
|
|
1663
|
+
if (interceptor.done) interceptor.done();
|
|
1664
|
+
}
|
|
1665
|
+
_runResultInterceptors(r) {
|
|
1666
|
+
for (const interceptor of this.interceptors)
|
|
1667
|
+
if (interceptor.result) interceptor.result(r);
|
|
1668
|
+
}
|
|
1669
|
+
withOptions(options) {
|
|
1670
|
+
const mergeOptions = (opt) =>
|
|
1671
|
+
Object.assign(
|
|
1672
|
+
{},
|
|
1673
|
+
options,
|
|
1674
|
+
"string" == typeof opt ? { name: opt } : opt,
|
|
1675
|
+
);
|
|
1676
|
+
return {
|
|
1677
|
+
name: this.name,
|
|
1678
|
+
tap: (opt, fn) => this.tap(mergeOptions(opt), fn),
|
|
1679
|
+
tapAsync: (opt, fn) => this.tapAsync(mergeOptions(opt), fn),
|
|
1680
|
+
tapPromise: (opt, fn) => this.tapPromise(mergeOptions(opt), fn),
|
|
1681
|
+
intercept: (interceptor) => this.intercept(interceptor),
|
|
1682
|
+
isUsed: () => this.isUsed(),
|
|
1683
|
+
withOptions: (opt) => this.withOptions(mergeOptions(opt)),
|
|
1684
|
+
queryStageRange: (stageRange) => this.queryStageRange(stageRange),
|
|
1685
|
+
};
|
|
1686
|
+
}
|
|
1687
|
+
isUsed() {
|
|
1688
|
+
return this.taps.length > 0 || this.interceptors.length > 0;
|
|
1689
|
+
}
|
|
1690
|
+
queryStageRange(stageRange) {
|
|
1691
|
+
return new QueriedHook(stageRange, this);
|
|
1692
|
+
}
|
|
1693
|
+
callAsyncStageRange(queried) {
|
|
1694
|
+
throw new Error(
|
|
1695
|
+
"Hook should implement there own _callAsyncStageRange",
|
|
1696
|
+
);
|
|
1697
|
+
}
|
|
1698
|
+
callAsync(...args) {
|
|
1699
|
+
return this.callAsyncStageRange(
|
|
1700
|
+
this.queryStageRange(allStageRange),
|
|
1701
|
+
...args,
|
|
1702
|
+
);
|
|
1703
|
+
}
|
|
1704
|
+
promiseStageRange(queried, ...args) {
|
|
1705
|
+
return new Promise((resolve, reject) => {
|
|
1706
|
+
this.callAsyncStageRange(queried, ...args, (e, r) => {
|
|
1707
|
+
if (e) return reject(e);
|
|
1708
|
+
return resolve(r);
|
|
1709
|
+
});
|
|
1710
|
+
});
|
|
1711
|
+
}
|
|
1712
|
+
promise(...args) {
|
|
1713
|
+
return this.promiseStageRange(
|
|
1714
|
+
this.queryStageRange(allStageRange),
|
|
1715
|
+
...args,
|
|
1716
|
+
);
|
|
1717
|
+
}
|
|
1718
|
+
tap(options, fn) {
|
|
1719
|
+
this._tap("sync", options, fn);
|
|
1720
|
+
}
|
|
1721
|
+
tapAsync(options, fn) {
|
|
1722
|
+
this._tap("async", options, fn);
|
|
1723
|
+
}
|
|
1724
|
+
tapPromise(options, fn) {
|
|
1725
|
+
this._tap("promise", options, fn);
|
|
1726
|
+
}
|
|
1727
|
+
_tap(type, options, fn) {
|
|
1728
|
+
let normalizedOptions = options;
|
|
1729
|
+
if ("string" == typeof options)
|
|
1730
|
+
normalizedOptions = { name: options.trim() };
|
|
1731
|
+
else if ("object" != typeof options || null === options)
|
|
1732
|
+
throw new Error("Invalid tap options");
|
|
1733
|
+
if (
|
|
1734
|
+
"string" != typeof normalizedOptions.name ||
|
|
1735
|
+
"" === normalizedOptions.name
|
|
1736
|
+
)
|
|
1737
|
+
throw new Error("Missing name for tap");
|
|
1738
|
+
this._insert(
|
|
1739
|
+
this._runRegisterInterceptors(
|
|
1740
|
+
Object.assign({ type, fn }, normalizedOptions),
|
|
1741
|
+
),
|
|
1742
|
+
);
|
|
1743
|
+
}
|
|
1744
|
+
_insert(item) {
|
|
1745
|
+
let before;
|
|
1746
|
+
if ("string" == typeof item.before) before = new Set([item.before]);
|
|
1747
|
+
else if (Array.isArray(item.before)) before = new Set(item.before);
|
|
1748
|
+
let stage = 0;
|
|
1749
|
+
if ("number" == typeof item.stage) stage = item.stage;
|
|
1750
|
+
let i = this.taps.length;
|
|
1751
|
+
while (i > 0) {
|
|
1752
|
+
i--;
|
|
1753
|
+
const x = this.taps[i];
|
|
1754
|
+
this.taps[i + 1] = x;
|
|
1755
|
+
const xStage = x.stage || 0;
|
|
1756
|
+
if (before) {
|
|
1757
|
+
if (before.has(x.name)) {
|
|
1758
|
+
before.delete(x.name);
|
|
1759
|
+
continue;
|
|
1760
|
+
}
|
|
1761
|
+
if (before.size > 0) continue;
|
|
1762
|
+
}
|
|
1763
|
+
if (xStage > stage) continue;
|
|
1764
|
+
i++;
|
|
1765
|
+
break;
|
|
1766
|
+
}
|
|
1767
|
+
this.taps[i] = item;
|
|
1768
|
+
}
|
|
1769
|
+
_prepareArgs(args) {
|
|
1770
|
+
const len = this.args.length;
|
|
1771
|
+
if (args.length < len) {
|
|
1772
|
+
args.length = len;
|
|
1773
|
+
return args.fill(void 0, args.length, len);
|
|
1774
|
+
}
|
|
1775
|
+
if (args.length > len) args.length = len;
|
|
1776
|
+
return args;
|
|
1777
|
+
}
|
|
1778
|
+
constructor(args = [], name) {
|
|
1779
|
+
_define_property(this, "args", void 0);
|
|
1780
|
+
_define_property(this, "name", void 0);
|
|
1781
|
+
_define_property(this, "taps", void 0);
|
|
1782
|
+
_define_property(this, "interceptors", void 0);
|
|
1783
|
+
this.args = args;
|
|
1784
|
+
this.name = name;
|
|
1785
|
+
this.taps = [];
|
|
1786
|
+
this.interceptors = [];
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
const minStage = -1 / 0;
|
|
1790
|
+
const maxStage = 1 / 0;
|
|
1791
|
+
const allStageRange = [minStage, maxStage];
|
|
1792
|
+
const i32MIN = -(2 ** 31);
|
|
1793
|
+
const i32MAX = 2 ** 31 - 1;
|
|
1794
|
+
const safeStage = (stage) => {
|
|
1795
|
+
if (stage < i32MIN) return i32MIN;
|
|
1796
|
+
if (stage > i32MAX) return i32MAX;
|
|
1797
|
+
return stage;
|
|
1798
|
+
};
|
|
1799
|
+
class QueriedHook {
|
|
1800
|
+
isUsed() {
|
|
1801
|
+
if (this.tapsInRange.length > 0) return true;
|
|
1802
|
+
if (
|
|
1803
|
+
this.stageRange[0] === minStage &&
|
|
1804
|
+
this.hook.interceptors.some((i) => i.call)
|
|
1805
|
+
)
|
|
1806
|
+
return true;
|
|
1807
|
+
if (
|
|
1808
|
+
this.stageRange[1] === maxStage &&
|
|
1809
|
+
this.hook.interceptors.some((i) => i.done)
|
|
1810
|
+
)
|
|
1811
|
+
return true;
|
|
1812
|
+
return false;
|
|
1813
|
+
}
|
|
1814
|
+
call(...args) {
|
|
1815
|
+
if ("function" != typeof this.hook.callStageRange)
|
|
1816
|
+
throw new Error(
|
|
1817
|
+
"hook is not a SyncHook, call methods only exists on SyncHook",
|
|
1818
|
+
);
|
|
1819
|
+
return this.hook.callStageRange(this, ...args);
|
|
1820
|
+
}
|
|
1821
|
+
callAsync(...args) {
|
|
1822
|
+
return this.hook.callAsyncStageRange(this, ...args);
|
|
1823
|
+
}
|
|
1824
|
+
promise(...args) {
|
|
1825
|
+
return this.hook.promiseStageRange(this, ...args);
|
|
1826
|
+
}
|
|
1827
|
+
constructor(stageRange, hook) {
|
|
1828
|
+
_define_property(this, "stageRange", void 0);
|
|
1829
|
+
_define_property(this, "hook", void 0);
|
|
1830
|
+
_define_property(this, "tapsInRange", void 0);
|
|
1831
|
+
const tapsInRange = [];
|
|
1832
|
+
const [from, to] = stageRange;
|
|
1833
|
+
for (const tap of hook.taps) {
|
|
1834
|
+
const stage = tap.stage ?? 0;
|
|
1835
|
+
if (from <= stage && stage < to) tapsInRange.push(tap);
|
|
1836
|
+
else if (to === maxStage && stage === maxStage)
|
|
1837
|
+
tapsInRange.push(tap);
|
|
1838
|
+
}
|
|
1839
|
+
this.stageRange = stageRange;
|
|
1840
|
+
this.hook = hook;
|
|
1841
|
+
this.tapsInRange = tapsInRange;
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
class SyncHook extends HookBase {
|
|
1845
|
+
callAsyncStageRange(queried, ...args) {
|
|
1846
|
+
const {
|
|
1847
|
+
stageRange: [from, to],
|
|
1848
|
+
tapsInRange,
|
|
1849
|
+
} = queried;
|
|
1850
|
+
const argsWithoutCb = args.slice(0, args.length - 1);
|
|
1851
|
+
const cb = args[args.length - 1];
|
|
1852
|
+
const args2 = this._prepareArgs(argsWithoutCb);
|
|
1853
|
+
if (from === minStage) this._runCallInterceptors(...args2);
|
|
1854
|
+
for (const tap of tapsInRange) {
|
|
1855
|
+
this._runTapInterceptors(tap);
|
|
1856
|
+
try {
|
|
1857
|
+
tap.fn(...args2);
|
|
1858
|
+
} catch (e) {
|
|
1859
|
+
const err = e;
|
|
1860
|
+
this._runErrorInterceptors(err);
|
|
1861
|
+
return cb(err);
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
if (to === maxStage) {
|
|
1865
|
+
this._runDoneInterceptors();
|
|
1866
|
+
cb(null);
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
call(...args) {
|
|
1870
|
+
return this.callStageRange(
|
|
1871
|
+
this.queryStageRange(allStageRange),
|
|
1872
|
+
...args,
|
|
1873
|
+
);
|
|
1874
|
+
}
|
|
1875
|
+
callStageRange(queried, ...args) {
|
|
1876
|
+
let result;
|
|
1877
|
+
let error;
|
|
1878
|
+
this.callAsyncStageRange(queried, ...args, (e, r) => {
|
|
1879
|
+
error = e;
|
|
1880
|
+
result = r;
|
|
1881
|
+
});
|
|
1882
|
+
if (error) throw error;
|
|
1883
|
+
return result;
|
|
1884
|
+
}
|
|
1885
|
+
tapAsync() {
|
|
1886
|
+
throw new Error("tapAsync is not supported on a SyncHook");
|
|
1887
|
+
}
|
|
1888
|
+
tapPromise() {
|
|
1889
|
+
throw new Error("tapPromise is not supported on a SyncHook");
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
class SyncBailHook extends HookBase {
|
|
1893
|
+
callAsyncStageRange(queried, ...args) {
|
|
1894
|
+
const {
|
|
1895
|
+
stageRange: [from, to],
|
|
1896
|
+
tapsInRange,
|
|
1897
|
+
} = queried;
|
|
1898
|
+
const argsWithoutCb = args.slice(0, args.length - 1);
|
|
1899
|
+
const cb = args[args.length - 1];
|
|
1900
|
+
const args2 = this._prepareArgs(argsWithoutCb);
|
|
1901
|
+
if (from === minStage) this._runCallInterceptors(...args2);
|
|
1902
|
+
for (const tap of tapsInRange) {
|
|
1903
|
+
this._runTapInterceptors(tap);
|
|
1904
|
+
let r;
|
|
1905
|
+
try {
|
|
1906
|
+
r = tap.fn(...args2);
|
|
1907
|
+
} catch (e) {
|
|
1908
|
+
const err = e;
|
|
1909
|
+
this._runErrorInterceptors(err);
|
|
1910
|
+
return cb(err);
|
|
1911
|
+
}
|
|
1912
|
+
if (void 0 !== r) {
|
|
1913
|
+
this._runResultInterceptors(r);
|
|
1914
|
+
return cb(null, r);
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
if (to === maxStage) {
|
|
1918
|
+
this._runDoneInterceptors();
|
|
1919
|
+
cb(null);
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
call(...args) {
|
|
1923
|
+
return this.callStageRange(
|
|
1924
|
+
this.queryStageRange(allStageRange),
|
|
1925
|
+
...args,
|
|
1926
|
+
);
|
|
1927
|
+
}
|
|
1928
|
+
callStageRange(queried, ...args) {
|
|
1929
|
+
let result;
|
|
1930
|
+
let error;
|
|
1931
|
+
this.callAsyncStageRange(queried, ...args, (e, r) => {
|
|
1932
|
+
error = e;
|
|
1933
|
+
result = r;
|
|
1934
|
+
});
|
|
1935
|
+
if (error) throw error;
|
|
1936
|
+
return result;
|
|
1937
|
+
}
|
|
1938
|
+
tapAsync() {
|
|
1939
|
+
throw new Error("tapAsync is not supported on a SyncBailHook");
|
|
1940
|
+
}
|
|
1941
|
+
tapPromise() {
|
|
1942
|
+
throw new Error("tapPromise is not supported on a SyncBailHook");
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
class SyncWaterfallHook extends HookBase {
|
|
1946
|
+
callAsyncStageRange(queried, ...args) {
|
|
1947
|
+
const {
|
|
1948
|
+
stageRange: [from, to],
|
|
1949
|
+
tapsInRange,
|
|
1950
|
+
} = queried;
|
|
1951
|
+
const argsWithoutCb = args.slice(0, args.length - 1);
|
|
1952
|
+
const cb = args[args.length - 1];
|
|
1953
|
+
const args2 = this._prepareArgs(argsWithoutCb);
|
|
1954
|
+
if (from === minStage) this._runCallInterceptors(...args2);
|
|
1955
|
+
for (const tap of tapsInRange) {
|
|
1956
|
+
this._runTapInterceptors(tap);
|
|
1957
|
+
try {
|
|
1958
|
+
const r = tap.fn(...args2);
|
|
1959
|
+
if (void 0 !== r) args2[0] = r;
|
|
1960
|
+
} catch (e) {
|
|
1961
|
+
const err = e;
|
|
1962
|
+
this._runErrorInterceptors(err);
|
|
1963
|
+
return cb(err);
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
if (to === maxStage) {
|
|
1967
|
+
this._runDoneInterceptors();
|
|
1968
|
+
cb(null, args2[0]);
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
call(...args) {
|
|
1972
|
+
return this.callStageRange(
|
|
1973
|
+
this.queryStageRange(allStageRange),
|
|
1974
|
+
...args,
|
|
1975
|
+
);
|
|
1976
|
+
}
|
|
1977
|
+
callStageRange(queried, ...args) {
|
|
1978
|
+
let result;
|
|
1979
|
+
let error;
|
|
1980
|
+
this.callAsyncStageRange(queried, ...args, (e, r) => {
|
|
1981
|
+
error = e;
|
|
1982
|
+
result = r;
|
|
1983
|
+
});
|
|
1984
|
+
if (error) throw error;
|
|
1985
|
+
return result;
|
|
1986
|
+
}
|
|
1987
|
+
tapAsync() {
|
|
1988
|
+
throw new Error("tapAsync is not supported on a SyncWaterfallHook");
|
|
1989
|
+
}
|
|
1990
|
+
tapPromise() {
|
|
1991
|
+
throw new Error("tapPromise is not supported on a SyncWaterfallHook");
|
|
1992
|
+
}
|
|
1993
|
+
constructor(args = [], name) {
|
|
1994
|
+
if (args.length < 1)
|
|
1995
|
+
throw new Error("Waterfall hooks must have at least one argument");
|
|
1996
|
+
super(args, name);
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
class AsyncParallelHook extends HookBase {
|
|
2000
|
+
callAsyncStageRange(queried, ...args) {
|
|
2001
|
+
const {
|
|
2002
|
+
stageRange: [from],
|
|
2003
|
+
tapsInRange,
|
|
2004
|
+
} = queried;
|
|
2005
|
+
const argsWithoutCb = args.slice(0, args.length - 1);
|
|
2006
|
+
const cb = args[args.length - 1];
|
|
2007
|
+
const args2 = this._prepareArgs(argsWithoutCb);
|
|
2008
|
+
if (from === minStage) this._runCallInterceptors(...args2);
|
|
2009
|
+
const done = () => {
|
|
2010
|
+
this._runDoneInterceptors();
|
|
2011
|
+
cb(null);
|
|
2012
|
+
};
|
|
2013
|
+
const error = (e) => {
|
|
2014
|
+
this._runErrorInterceptors(e);
|
|
2015
|
+
cb(e);
|
|
2016
|
+
};
|
|
2017
|
+
if (0 === tapsInRange.length) return done();
|
|
2018
|
+
let counter = tapsInRange.length;
|
|
2019
|
+
for (const tap of tapsInRange) {
|
|
2020
|
+
this._runTapInterceptors(tap);
|
|
2021
|
+
if ("promise" === tap.type) {
|
|
2022
|
+
const promise = tap.fn(...args2);
|
|
2023
|
+
if (!promise || !promise.then)
|
|
2024
|
+
throw new Error(
|
|
2025
|
+
`Tap function (tapPromise) did not return promise (returned ${promise})`,
|
|
2026
|
+
);
|
|
2027
|
+
promise.then(
|
|
2028
|
+
() => {
|
|
2029
|
+
counter -= 1;
|
|
2030
|
+
if (0 === counter) done();
|
|
2031
|
+
},
|
|
2032
|
+
(e) => {
|
|
2033
|
+
counter = 0;
|
|
2034
|
+
error(e);
|
|
2035
|
+
},
|
|
2036
|
+
);
|
|
2037
|
+
} else if ("async" === tap.type)
|
|
2038
|
+
tap.fn(...args2, (e) => {
|
|
2039
|
+
if (e) {
|
|
2040
|
+
counter = 0;
|
|
2041
|
+
error(e);
|
|
2042
|
+
} else {
|
|
2043
|
+
counter -= 1;
|
|
2044
|
+
if (0 === counter) done();
|
|
2045
|
+
}
|
|
2046
|
+
});
|
|
2047
|
+
else {
|
|
2048
|
+
let hasError = false;
|
|
2049
|
+
try {
|
|
2050
|
+
tap.fn(...args2);
|
|
2051
|
+
} catch (e) {
|
|
2052
|
+
hasError = true;
|
|
2053
|
+
counter = 0;
|
|
2054
|
+
error(e);
|
|
2055
|
+
}
|
|
2056
|
+
if (!hasError && 0 === --counter) done();
|
|
2057
|
+
}
|
|
2058
|
+
if (counter <= 0) return;
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
class AsyncSeriesHook extends HookBase {
|
|
2063
|
+
callAsyncStageRange(queried, ...args) {
|
|
2064
|
+
const {
|
|
2065
|
+
stageRange: [from],
|
|
2066
|
+
tapsInRange,
|
|
2067
|
+
} = queried;
|
|
2068
|
+
const argsWithoutCb = args.slice(0, args.length - 1);
|
|
2069
|
+
const cb = args[args.length - 1];
|
|
2070
|
+
const args2 = this._prepareArgs(argsWithoutCb);
|
|
2071
|
+
if (from === minStage) this._runCallInterceptors(...args2);
|
|
2072
|
+
const done = () => {
|
|
2073
|
+
this._runDoneInterceptors();
|
|
2074
|
+
cb(null);
|
|
2075
|
+
};
|
|
2076
|
+
const error = (e) => {
|
|
2077
|
+
this._runErrorInterceptors(e);
|
|
2078
|
+
cb(e);
|
|
2079
|
+
};
|
|
2080
|
+
if (0 === tapsInRange.length) return done();
|
|
2081
|
+
let index = 0;
|
|
2082
|
+
const next = () => {
|
|
2083
|
+
const tap = tapsInRange[index];
|
|
2084
|
+
this._runTapInterceptors(tap);
|
|
2085
|
+
if ("promise" === tap.type) {
|
|
2086
|
+
const promise = tap.fn(...args2);
|
|
2087
|
+
if (!promise || !promise.then)
|
|
2088
|
+
throw new Error(
|
|
2089
|
+
`Tap function (tapPromise) did not return promise (returned ${promise})`,
|
|
2090
|
+
);
|
|
2091
|
+
promise.then(
|
|
2092
|
+
() => {
|
|
2093
|
+
index += 1;
|
|
2094
|
+
if (index === tapsInRange.length) done();
|
|
2095
|
+
else next();
|
|
2096
|
+
},
|
|
2097
|
+
(e) => {
|
|
2098
|
+
index = tapsInRange.length;
|
|
2099
|
+
error(e);
|
|
2100
|
+
},
|
|
2101
|
+
);
|
|
2102
|
+
} else if ("async" === tap.type)
|
|
2103
|
+
tap.fn(...args2, (e) => {
|
|
2104
|
+
if (e) {
|
|
2105
|
+
index = tapsInRange.length;
|
|
2106
|
+
error(e);
|
|
2107
|
+
} else {
|
|
2108
|
+
index += 1;
|
|
2109
|
+
if (index === tapsInRange.length) done();
|
|
2110
|
+
else next();
|
|
2111
|
+
}
|
|
2112
|
+
});
|
|
2113
|
+
else {
|
|
2114
|
+
let hasError = false;
|
|
2115
|
+
try {
|
|
2116
|
+
tap.fn(...args2);
|
|
2117
|
+
} catch (e) {
|
|
2118
|
+
hasError = true;
|
|
2119
|
+
index = tapsInRange.length;
|
|
2120
|
+
error(e);
|
|
2121
|
+
}
|
|
2122
|
+
if (!hasError) {
|
|
2123
|
+
index += 1;
|
|
2124
|
+
if (index === tapsInRange.length) done();
|
|
2125
|
+
else next();
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
if (index === tapsInRange.length) return;
|
|
2129
|
+
};
|
|
2130
|
+
next();
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
class AsyncSeriesBailHook extends HookBase {
|
|
2134
|
+
callAsyncStageRange(queried, ...args) {
|
|
2135
|
+
const {
|
|
2136
|
+
stageRange: [from],
|
|
2137
|
+
tapsInRange,
|
|
2138
|
+
} = queried;
|
|
2139
|
+
const argsWithoutCb = args.slice(0, args.length - 1);
|
|
2140
|
+
const cb = args[args.length - 1];
|
|
2141
|
+
const args2 = this._prepareArgs(argsWithoutCb);
|
|
2142
|
+
if (from === minStage) this._runCallInterceptors(...args2);
|
|
2143
|
+
const done = () => {
|
|
2144
|
+
this._runDoneInterceptors();
|
|
2145
|
+
cb(null);
|
|
2146
|
+
};
|
|
2147
|
+
const error = (e) => {
|
|
2148
|
+
this._runErrorInterceptors(e);
|
|
2149
|
+
cb(e);
|
|
2150
|
+
};
|
|
2151
|
+
const result = (r) => {
|
|
2152
|
+
this._runResultInterceptors(r);
|
|
2153
|
+
cb(null, r);
|
|
2154
|
+
};
|
|
2155
|
+
if (0 === tapsInRange.length) return done();
|
|
2156
|
+
let index = 0;
|
|
2157
|
+
const next = () => {
|
|
2158
|
+
const tap = tapsInRange[index];
|
|
2159
|
+
this._runTapInterceptors(tap);
|
|
2160
|
+
if ("promise" === tap.type) {
|
|
2161
|
+
const promise = tap.fn(...args2);
|
|
2162
|
+
if (!promise || !promise.then)
|
|
2163
|
+
throw new Error(
|
|
2164
|
+
`Tap function (tapPromise) did not return promise (returned ${promise})`,
|
|
2165
|
+
);
|
|
2166
|
+
promise.then(
|
|
2167
|
+
(r) => {
|
|
2168
|
+
index += 1;
|
|
2169
|
+
if (void 0 !== r) result(r);
|
|
2170
|
+
else if (index === tapsInRange.length) done();
|
|
2171
|
+
else next();
|
|
2172
|
+
},
|
|
2173
|
+
(e) => {
|
|
2174
|
+
index = tapsInRange.length;
|
|
2175
|
+
error(e);
|
|
2176
|
+
},
|
|
2177
|
+
);
|
|
2178
|
+
} else if ("async" === tap.type)
|
|
2179
|
+
tap.fn(...args2, (e, r) => {
|
|
2180
|
+
if (e) {
|
|
2181
|
+
index = tapsInRange.length;
|
|
2182
|
+
error(e);
|
|
2183
|
+
} else {
|
|
2184
|
+
index += 1;
|
|
2185
|
+
if (void 0 !== r) result(r);
|
|
2186
|
+
else if (index === tapsInRange.length) done();
|
|
2187
|
+
else next();
|
|
2188
|
+
}
|
|
2189
|
+
});
|
|
2190
|
+
else {
|
|
2191
|
+
let hasError = false;
|
|
2192
|
+
let r;
|
|
2193
|
+
try {
|
|
2194
|
+
r = tap.fn(...args2);
|
|
2195
|
+
} catch (e) {
|
|
2196
|
+
hasError = true;
|
|
2197
|
+
index = tapsInRange.length;
|
|
2198
|
+
error(e);
|
|
2199
|
+
}
|
|
2200
|
+
if (!hasError) {
|
|
2201
|
+
index += 1;
|
|
2202
|
+
if (void 0 !== r) result(r);
|
|
2203
|
+
else if (index === tapsInRange.length) done();
|
|
2204
|
+
else next();
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
if (index === tapsInRange.length) return;
|
|
2208
|
+
};
|
|
2209
|
+
next();
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
class AsyncSeriesWaterfallHook extends HookBase {
|
|
2213
|
+
callAsyncStageRange(queried, ...args) {
|
|
2214
|
+
const {
|
|
2215
|
+
stageRange: [from],
|
|
2216
|
+
tapsInRange,
|
|
2217
|
+
} = queried;
|
|
2218
|
+
const argsWithoutCb = args.slice(0, args.length - 1);
|
|
2219
|
+
const cb = args[args.length - 1];
|
|
2220
|
+
const args2 = this._prepareArgs(argsWithoutCb);
|
|
2221
|
+
if (from === minStage) this._runCallInterceptors(...args2);
|
|
2222
|
+
const result = (r) => {
|
|
2223
|
+
this._runResultInterceptors(r);
|
|
2224
|
+
cb(null, r);
|
|
2225
|
+
};
|
|
2226
|
+
const error = (e) => {
|
|
2227
|
+
this._runErrorInterceptors(e);
|
|
2228
|
+
cb(e);
|
|
2229
|
+
};
|
|
2230
|
+
if (0 === tapsInRange.length) return result(args2[0]);
|
|
2231
|
+
let index = 0;
|
|
2232
|
+
const next = () => {
|
|
2233
|
+
const tap = tapsInRange[index];
|
|
2234
|
+
this._runTapInterceptors(tap);
|
|
2235
|
+
if ("promise" === tap.type) {
|
|
2236
|
+
const promise = tap.fn(...args2);
|
|
2237
|
+
if (!promise || !promise.then)
|
|
2238
|
+
throw new Error(
|
|
2239
|
+
`Tap function (tapPromise) did not return promise (returned ${promise})`,
|
|
2240
|
+
);
|
|
2241
|
+
promise.then(
|
|
2242
|
+
(r) => {
|
|
2243
|
+
index += 1;
|
|
2244
|
+
if (void 0 !== r) args2[0] = r;
|
|
2245
|
+
if (index === tapsInRange.length) result(args2[0]);
|
|
2246
|
+
else next();
|
|
2247
|
+
},
|
|
2248
|
+
(e) => {
|
|
2249
|
+
index = tapsInRange.length;
|
|
2250
|
+
error(e);
|
|
2251
|
+
},
|
|
2252
|
+
);
|
|
2253
|
+
} else if ("async" === tap.type)
|
|
2254
|
+
tap.fn(...args2, (e, r) => {
|
|
2255
|
+
if (e) {
|
|
2256
|
+
index = tapsInRange.length;
|
|
2257
|
+
error(e);
|
|
2258
|
+
} else {
|
|
2259
|
+
index += 1;
|
|
2260
|
+
if (void 0 !== r) args2[0] = r;
|
|
2261
|
+
if (index === tapsInRange.length) result(args2[0]);
|
|
2262
|
+
else next();
|
|
2263
|
+
}
|
|
2264
|
+
});
|
|
2265
|
+
else {
|
|
2266
|
+
let hasError = false;
|
|
2267
|
+
try {
|
|
2268
|
+
const r = tap.fn(...args2);
|
|
2269
|
+
if (void 0 !== r) args2[0] = r;
|
|
2270
|
+
} catch (e) {
|
|
2271
|
+
hasError = true;
|
|
2272
|
+
index = tapsInRange.length;
|
|
2273
|
+
error(e);
|
|
2274
|
+
}
|
|
2275
|
+
if (!hasError) {
|
|
2276
|
+
index += 1;
|
|
2277
|
+
if (index === tapsInRange.length) result(args2[0]);
|
|
2278
|
+
else next();
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
if (index === tapsInRange.length) return;
|
|
2282
|
+
};
|
|
2283
|
+
next();
|
|
2284
|
+
}
|
|
2285
|
+
constructor(args = [], name) {
|
|
2286
|
+
if (args.length < 1)
|
|
2287
|
+
throw new Error("Waterfall hooks must have at least one argument");
|
|
2288
|
+
super(args, name);
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
const defaultFactory = (key, hook) => hook;
|
|
2292
|
+
class HookMap {
|
|
2293
|
+
get(key) {
|
|
2294
|
+
return this._map.get(key);
|
|
2295
|
+
}
|
|
2296
|
+
for(key) {
|
|
2297
|
+
const hook = this.get(key);
|
|
2298
|
+
if (void 0 !== hook) return hook;
|
|
2299
|
+
let newHook = this._factory(key);
|
|
2300
|
+
const interceptors = this._interceptors;
|
|
2301
|
+
for (let i = 0; i < interceptors.length; i++) {
|
|
2302
|
+
const factory = interceptors[i].factory;
|
|
2303
|
+
if (factory) newHook = factory(key, newHook);
|
|
2304
|
+
}
|
|
2305
|
+
this._map.set(key, newHook);
|
|
2306
|
+
return newHook;
|
|
2307
|
+
}
|
|
2308
|
+
intercept(interceptor) {
|
|
2309
|
+
this._interceptors.push(
|
|
2310
|
+
Object.assign({ factory: defaultFactory }, interceptor),
|
|
2311
|
+
);
|
|
2312
|
+
}
|
|
2313
|
+
isUsed() {
|
|
2314
|
+
for (const key of this._map.keys()) {
|
|
2315
|
+
const hook = this.get(key);
|
|
2316
|
+
if (hook?.isUsed()) return true;
|
|
2317
|
+
}
|
|
2318
|
+
return false;
|
|
2319
|
+
}
|
|
2320
|
+
queryStageRange(stageRange) {
|
|
2321
|
+
return new QueriedHookMap(stageRange, this);
|
|
2322
|
+
}
|
|
2323
|
+
constructor(factory, name) {
|
|
2324
|
+
_define_property(this, "_map", new Map());
|
|
2325
|
+
_define_property(this, "_factory", void 0);
|
|
2326
|
+
_define_property(this, "name", void 0);
|
|
2327
|
+
_define_property(this, "_interceptors", void 0);
|
|
2328
|
+
this.name = name;
|
|
2329
|
+
this._factory = factory;
|
|
2330
|
+
this._interceptors = [];
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
class QueriedHookMap {
|
|
2334
|
+
get(key) {
|
|
2335
|
+
return this.hookMap.get(key)?.queryStageRange(this.stageRange);
|
|
2336
|
+
}
|
|
2337
|
+
for(key) {
|
|
2338
|
+
return this.hookMap.for(key).queryStageRange(this.stageRange);
|
|
2339
|
+
}
|
|
2340
|
+
isUsed() {
|
|
2341
|
+
for (const key of this.hookMap._map.keys())
|
|
2342
|
+
if (this.get(key)?.isUsed()) return true;
|
|
2343
|
+
return false;
|
|
2344
|
+
}
|
|
2345
|
+
constructor(stageRange, hookMap) {
|
|
2346
|
+
_define_property(this, "stageRange", void 0);
|
|
2347
|
+
_define_property(this, "hookMap", void 0);
|
|
2348
|
+
this.stageRange = stageRange;
|
|
2349
|
+
this.hookMap = hookMap;
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2352
|
+
class MultiHook {
|
|
2353
|
+
tap(options, fn) {
|
|
2354
|
+
for (const hook of this.hooks) hook.tap(options, fn);
|
|
2355
|
+
}
|
|
2356
|
+
tapAsync(options, fn) {
|
|
2357
|
+
for (const hook of this.hooks) hook.tapAsync(options, fn);
|
|
2358
|
+
}
|
|
2359
|
+
tapPromise(options, fn) {
|
|
2360
|
+
for (const hook of this.hooks) hook.tapPromise(options, fn);
|
|
2361
|
+
}
|
|
2362
|
+
isUsed() {
|
|
2363
|
+
for (const hook of this.hooks) if (hook.isUsed()) return true;
|
|
2364
|
+
return false;
|
|
2365
|
+
}
|
|
2366
|
+
intercept(interceptor) {
|
|
2367
|
+
for (const hook of this.hooks) hook.intercept(interceptor);
|
|
2368
|
+
}
|
|
2369
|
+
withOptions(options) {
|
|
2370
|
+
return new MultiHook(
|
|
2371
|
+
this.hooks.map((h) => h.withOptions(options)),
|
|
2372
|
+
this.name,
|
|
2373
|
+
);
|
|
2374
|
+
}
|
|
2375
|
+
constructor(hooks, name) {
|
|
2376
|
+
_define_property(this, "hooks", void 0);
|
|
2377
|
+
_define_property(this, "name", void 0);
|
|
2378
|
+
this.hooks = hooks;
|
|
2379
|
+
this.name = name;
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
exports.AsyncParallelHook = __nested_webpack_exports__.AsyncParallelHook;
|
|
2383
|
+
exports.AsyncSeriesBailHook =
|
|
2384
|
+
__nested_webpack_exports__.AsyncSeriesBailHook;
|
|
2385
|
+
exports.AsyncSeriesHook = __nested_webpack_exports__.AsyncSeriesHook;
|
|
2386
|
+
exports.AsyncSeriesWaterfallHook =
|
|
2387
|
+
__nested_webpack_exports__.AsyncSeriesWaterfallHook;
|
|
2388
|
+
exports.HookBase = __nested_webpack_exports__.HookBase;
|
|
2389
|
+
exports.HookMap = __nested_webpack_exports__.HookMap;
|
|
2390
|
+
exports.MultiHook = __nested_webpack_exports__.MultiHook;
|
|
2391
|
+
exports.QueriedHook = __nested_webpack_exports__.QueriedHook;
|
|
2392
|
+
exports.QueriedHookMap = __nested_webpack_exports__.QueriedHookMap;
|
|
2393
|
+
exports.SyncBailHook = __nested_webpack_exports__.SyncBailHook;
|
|
2394
|
+
exports.SyncHook = __nested_webpack_exports__.SyncHook;
|
|
2395
|
+
exports.SyncWaterfallHook = __nested_webpack_exports__.SyncWaterfallHook;
|
|
2396
|
+
exports.maxStage = __nested_webpack_exports__.maxStage;
|
|
2397
|
+
exports.minStage = __nested_webpack_exports__.minStage;
|
|
2398
|
+
exports.safeStage = __nested_webpack_exports__.safeStage;
|
|
2399
|
+
for (var __webpack_i__ in __nested_webpack_exports__)
|
|
2400
|
+
if (
|
|
2401
|
+
-1 ===
|
|
2402
|
+
[
|
|
2403
|
+
"AsyncParallelHook",
|
|
2404
|
+
"AsyncSeriesBailHook",
|
|
2405
|
+
"AsyncSeriesHook",
|
|
2406
|
+
"AsyncSeriesWaterfallHook",
|
|
2407
|
+
"HookBase",
|
|
2408
|
+
"HookMap",
|
|
2409
|
+
"MultiHook",
|
|
2410
|
+
"QueriedHook",
|
|
2411
|
+
"QueriedHookMap",
|
|
2412
|
+
"SyncBailHook",
|
|
2413
|
+
"SyncHook",
|
|
2414
|
+
"SyncWaterfallHook",
|
|
2415
|
+
"maxStage",
|
|
2416
|
+
"minStage",
|
|
2417
|
+
"safeStage",
|
|
2418
|
+
].indexOf(__webpack_i__)
|
|
2419
|
+
)
|
|
2420
|
+
exports[__webpack_i__] = __nested_webpack_exports__[__webpack_i__];
|
|
2421
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2422
|
+
},
|
|
1580
2423
|
};
|
|
1581
2424
|
var __webpack_module_cache__ = {};
|
|
1582
2425
|
function __nccwpck_require__(moduleId) {
|
|
@@ -1600,6 +2443,6 @@
|
|
|
1600
2443
|
}
|
|
1601
2444
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
1602
2445
|
__nccwpck_require__.ab = __dirname + "/";
|
|
1603
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
2446
|
+
var __webpack_exports__ = __nccwpck_require__(664);
|
|
1604
2447
|
module.exports = __webpack_exports__;
|
|
1605
2448
|
})();
|