1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const utils_1 = require("./utils");
|
4 | class 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 | }
|
35 | exports.DepBuilder = DepBuilder;
|
36 | function dep(dep) {
|
37 | if (utils_1.Is.str(dep)) {
|
38 | dep = { name: dep };
|
39 | }
|
40 | return new DepBuilder(dep);
|
41 | }
|
42 | exports.dep = dep;
|
43 | String.prototype.async = function () {
|
44 | return dep(this).async();
|
45 | };
|
46 | String.prototype.force = function () {
|
47 | return dep(this).force();
|
48 | };
|
49 | String.prototype.options = function (opts) {
|
50 | return dep(this).options(opts);
|
51 | };
|
52 |
|
\ | No newline at end of file |