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