UNPKG

1.19 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const utils_1 = require("./utils");
4class DepBuilder {
5 constructor(name) {
6 if (utils_1.Is.str(name)) {
7 name = { name };
8 }
9 else if (name instanceof DepBuilder) {
10 name = name.toTaskDep();
11 }
12 this._dep = name;
13 }
14 async() {
15 this._dep.async = true;
16 return this;
17 }
18 force() {
19 this._dep.force = true;
20 return this;
21 }
22 options(opts) {
23 if (utils_1.Is.fn(opts)) {
24 this._dep.resolveOptions = opts;
25 }
26 else {
27 this._dep.options = opts;
28 }
29 return this;
30 }
31 toTaskDep() {
32 return this._dep;
33 }
34}
35exports.DepBuilder = DepBuilder;
36function dep(dep) {
37 if (utils_1.Is.str(dep)) {
38 dep = { name: dep };
39 }
40 return new DepBuilder(dep);
41}
42exports.dep = dep;
43String.prototype.async = function () {
44 return dep(this).async();
45};
46String.prototype.force = function () {
47 return dep(this).force();
48};
49String.prototype.options = function (opts) {
50 return dep(this).options(opts);
51};
52//# sourceMappingURL=dep-builder.js.map
\No newline at end of file