@wocker/ws 1.0.2 → 1.0.4

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.
Files changed (107) hide show
  1. package/README.md +1 -1
  2. package/lib/App.d.ts +4 -3
  3. package/lib/App.js +98 -77
  4. package/lib/controllers/ImageController.d.ts +2 -2
  5. package/lib/controllers/ImageController.js +27 -27
  6. package/lib/controllers/PluginController.d.ts +2 -2
  7. package/lib/controllers/PluginController.js +78 -56
  8. package/lib/controllers/PresetController.d.ts +3 -1
  9. package/lib/controllers/PresetController.js +155 -136
  10. package/lib/controllers/ProjectController.d.ts +5 -5
  11. package/lib/controllers/ProjectController.js +653 -603
  12. package/lib/controllers/ProxyController.d.ts +4 -1
  13. package/lib/controllers/ProxyController.js +269 -245
  14. package/lib/controllers/index.js +19 -58
  15. package/lib/decorators/Inject.d.ts +1 -0
  16. package/lib/decorators/Inject.js +8 -0
  17. package/lib/decorators/Injectable.d.ts +4 -0
  18. package/lib/decorators/Injectable.js +17 -0
  19. package/lib/decorators/index.d.ts +1 -0
  20. package/lib/decorators/index.js +17 -0
  21. package/lib/env.js +33 -15
  22. package/lib/index.d.ts +3 -0
  23. package/lib/index.js +31 -16
  24. package/lib/makes/Controller.js +4 -8
  25. package/lib/makes/DI.d.ts +7 -0
  26. package/lib/makes/DI.js +27 -0
  27. package/lib/makes/Docker.js +298 -382
  28. package/lib/makes/FS.d.ts +3 -9
  29. package/lib/makes/FS.js +277 -305
  30. package/lib/makes/LineConvertStream.js +37 -40
  31. package/lib/makes/Logger.d.ts +9 -1
  32. package/lib/makes/Logger.js +22 -11
  33. package/lib/makes/Model.js +8 -12
  34. package/lib/makes/MySQL.js +6 -27
  35. package/lib/makes/Plugin.d.ts +1 -1
  36. package/lib/makes/Plugin.js +55 -37
  37. package/lib/makes/Preset.d.ts +46 -0
  38. package/lib/makes/Preset.js +33 -0
  39. package/lib/makes/Project.d.ts +45 -0
  40. package/lib/makes/Project.js +127 -0
  41. package/lib/makes/Repository.js +18 -21
  42. package/lib/makes/index.d.ts +3 -0
  43. package/lib/makes/index.js +23 -69
  44. package/lib/plugins/ElasticSearchPlugin.d.ts +3 -1
  45. package/lib/plugins/ElasticSearchPlugin.js +66 -66
  46. package/lib/plugins/LocaltunnelPlugin.d.ts +2 -2
  47. package/lib/plugins/LocaltunnelPlugin.js +256 -257
  48. package/lib/plugins/MaildevPlugin.d.ts +2 -2
  49. package/lib/plugins/MaildevPlugin.js +45 -44
  50. package/lib/plugins/MongodbPlugin.d.ts +2 -2
  51. package/lib/plugins/MongodbPlugin.js +303 -248
  52. package/lib/plugins/NgrokPlugin.d.ts +2 -2
  53. package/lib/plugins/NgrokPlugin.js +221 -231
  54. package/lib/plugins/PageKitePlugin.d.ts +2 -2
  55. package/lib/plugins/PageKitePlugin.js +150 -149
  56. package/lib/plugins/PostgresPlugin.d.ts +1 -1
  57. package/lib/plugins/PostgresPlugin.js +115 -89
  58. package/lib/plugins/ProxmoxPlugin.d.ts +1 -1
  59. package/lib/plugins/ProxmoxPlugin.js +50 -38
  60. package/lib/plugins/RedisPlugin.d.ts +3 -1
  61. package/lib/plugins/RedisPlugin.js +73 -72
  62. package/lib/plugins/index.js +25 -103
  63. package/lib/services/AppConfigService.d.ts +3 -3
  64. package/lib/services/AppConfigService.js +162 -157
  65. package/lib/services/AppEventsService.js +26 -24
  66. package/lib/services/DockerService.d.ts +37 -2
  67. package/lib/services/DockerService.js +185 -205
  68. package/lib/services/LogService.d.ts +3 -2
  69. package/lib/services/LogService.js +33 -34
  70. package/lib/services/PluginService.d.ts +2 -1
  71. package/lib/services/PluginService.js +11 -14
  72. package/lib/services/PresetService.d.ts +8 -3
  73. package/lib/services/PresetService.js +60 -59
  74. package/lib/services/ProjectService.d.ts +11 -4
  75. package/lib/services/ProjectService.js +140 -129
  76. package/lib/services/index.js +21 -80
  77. package/lib/types/Config.d.ts +4 -3
  78. package/lib/types/Config.js +1 -4
  79. package/lib/types/EnvConfig.js +1 -4
  80. package/lib/types/index.js +16 -25
  81. package/lib/utils/buildOptions.js +5 -8
  82. package/lib/utils/demuxOutput.js +16 -20
  83. package/lib/utils/escapeRegExp.js +4 -7
  84. package/lib/utils/exec.js +38 -39
  85. package/lib/utils/fetch.js +46 -30
  86. package/lib/utils/followProgress.js +66 -77
  87. package/lib/utils/format-size-units.js +16 -16
  88. package/lib/utils/get-config.d.ts +1 -1
  89. package/lib/utils/get-config.js +13 -16
  90. package/lib/utils/get-cursor-position.js +22 -29
  91. package/lib/utils/image-build.js +35 -23
  92. package/lib/utils/index.js +32 -191
  93. package/lib/utils/injectVariables.js +10 -13
  94. package/lib/utils/parse-table.js +20 -23
  95. package/lib/utils/set-config.d.ts +1 -1
  96. package/lib/utils/set-config.js +12 -15
  97. package/lib/utils/spawn.js +17 -20
  98. package/lib/utils/tty.js +2 -6
  99. package/lib/utils/volumeFormat.js +5 -12
  100. package/lib/utils/volumeParse.js +10 -13
  101. package/package.json +13 -39
  102. package/presets/bun/Dockerfile +11 -0
  103. package/presets/bun/config.json +3 -0
  104. package/presets/node/Dockerfile +4 -2
  105. package/presets/php-apache/Dockerfile +3 -2
  106. package/.github/workflows/publish.yml +0 -31
  107. package/plugins/mariadb/admin/conf/config.user.inc.php +0 -9
@@ -1,23 +1,19 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.demuxOutput = void 0;
7
- const demuxOutput = buffer => {
8
- let nextDataLength = null,
9
- output = Buffer.from([]);
10
- while (buffer.length > 0) {
11
- const header = bufferSlice(8);
12
- nextDataLength = header.readUInt32BE(4);
13
- const content = bufferSlice(nextDataLength);
14
- output = Buffer.concat([output, content]);
15
- }
16
- function bufferSlice(end) {
17
- const out = buffer.slice(0, end);
18
- buffer = Buffer.from(buffer.slice(end, buffer.length));
19
- return out;
20
- }
21
- return output;
4
+ const demuxOutput = (buffer) => {
5
+ let nextDataLength = null, output = Buffer.from([]);
6
+ while (buffer.length > 0) {
7
+ const header = bufferSlice(8);
8
+ nextDataLength = header.readUInt32BE(4);
9
+ const content = bufferSlice(nextDataLength);
10
+ output = Buffer.concat([output, content]);
11
+ }
12
+ function bufferSlice(end) {
13
+ const out = buffer.slice(0, end);
14
+ buffer = Buffer.from(buffer.slice(end, buffer.length));
15
+ return out;
16
+ }
17
+ return output;
22
18
  };
23
- exports.demuxOutput = demuxOutput;
19
+ exports.demuxOutput = demuxOutput;
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.escapeRegExp = void 0;
7
- const escapeRegExp = string => {
8
- return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4
+ const escapeRegExp = (string) => {
5
+ return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
9
6
  };
10
- exports.escapeRegExp = escapeRegExp;
7
+ exports.escapeRegExp = escapeRegExp;
package/lib/utils/exec.js CHANGED
@@ -1,43 +1,42 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.exec = void 0;
7
- var _core = require("@wocker/core");
8
- var _child_process = require("child_process");
9
- var _chalk = _interopRequireDefault(require("chalk"));
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- const exec = async command => {
12
- _core.Logger.info(` > ${command.trim().replace(/\s+/g, " ")}`);
13
- return new Promise((resolve, reject) => {
14
- const worker = (0, _child_process.exec)(command, {
15
- maxBuffer: Infinity
16
- }, (err, stdout, stderr) => {
17
- if (err) {
18
- return reject(err);
19
- }
20
- return resolve({
21
- stdout,
22
- stderr
23
- });
24
- });
25
- if (worker.stdout) {
26
- worker.stdout.on("data", data => {
27
- process.stdout.write(data);
28
- });
29
- }
30
- if (worker.stderr) {
31
- worker.stderr.on("data", data => {
32
- process.stderr.write(data);
33
- });
34
- }
35
- worker.on("close", code => {
36
- _core.Logger.info("close", _chalk.default.red(code));
37
- });
38
- worker.on("exit", code => {
39
- _core.Logger.info("exit", _chalk.default.red(code));
7
+ const child_process_1 = require("child_process");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const makes_1 = require("../makes");
10
+ const exec = async (command) => {
11
+ makes_1.Logger.info(` > ${command.trim().replace(/\s+/g, " ")}`);
12
+ return new Promise((resolve, reject) => {
13
+ const worker = (0, child_process_1.exec)(command, {
14
+ maxBuffer: Infinity
15
+ }, (err, stdout, stderr) => {
16
+ if (err) {
17
+ return reject(err);
18
+ }
19
+ return resolve({
20
+ stdout,
21
+ stderr
22
+ });
23
+ });
24
+ if (worker.stdout) {
25
+ worker.stdout.on("data", (data) => {
26
+ process.stdout.write(data);
27
+ });
28
+ }
29
+ if (worker.stderr) {
30
+ worker.stderr.on("data", (data) => {
31
+ process.stderr.write(data);
32
+ });
33
+ }
34
+ worker.on("close", (code) => {
35
+ makes_1.Logger.info("close", chalk_1.default.red(code));
36
+ });
37
+ worker.on("exit", (code) => {
38
+ makes_1.Logger.info("exit", chalk_1.default.red(code));
39
+ });
40
40
  });
41
- });
42
41
  };
43
- exports.exec = exec;
42
+ exports.exec = exec;
@@ -1,36 +1,52 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
5
17
  });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
6
26
  exports.fetch = void 0;
7
- var https = _interopRequireWildcard(require("https"));
8
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
27
+ const https = __importStar(require("https"));
10
28
  const fetch = async (url, options) => {
11
- const {
12
- method = "GET"
13
- } = options || {};
14
- const target = new URL(url);
15
- const params = {
16
- method,
17
- protocol: target.protocol,
18
- hostname: target.hostname,
19
- port: target.port,
20
- path: target.pathname
21
- };
22
- return new Promise((resolve, reject) => {
23
- const req = https.request(params, res => {
24
- let body = "";
25
- res.on("data", data => {
26
- body += data;
27
- });
28
- res.on("end", () => {
29
- resolve(body);
30
- });
29
+ const { method = "GET" } = options || {};
30
+ const target = new URL(url);
31
+ const params = {
32
+ method,
33
+ protocol: target.protocol,
34
+ hostname: target.hostname,
35
+ port: target.port,
36
+ path: target.pathname
37
+ };
38
+ return new Promise((resolve, reject) => {
39
+ const req = https.request(params, (res) => {
40
+ let body = "";
41
+ res.on("data", (data) => {
42
+ body += data;
43
+ });
44
+ res.on("end", () => {
45
+ resolve(body);
46
+ });
47
+ });
48
+ req.on("error", reject);
49
+ req.end();
31
50
  });
32
- req.on("error", reject);
33
- req.end();
34
- });
35
51
  };
36
- exports.fetch = fetch;
52
+ exports.fetch = fetch;
@@ -1,80 +1,69 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.followProgress = void 0;
7
- var _Logger = require("../makes/Logger");
8
- var _LineConvertStream = require("../makes/LineConvertStream");
9
- var _formatSizeUnits = require("./format-size-units");
10
- const followProgress = async stream => {
11
- const lineStream = new _LineConvertStream.LineConvertStream(stream);
12
- let line = 0;
13
- const mapLines = {};
14
- lineStream.on("data", chunk => {
15
- const data = JSON.parse(chunk.toString());
16
- const {
17
- stream,
18
- id,
19
- status,
20
- progressDetail: {
21
- current,
22
- total
23
- } = {},
24
- aux
25
- } = data;
26
- if (stream) {
27
- process.stdout.write(`${stream}`);
28
- line += stream.split("\n").length - 1;
29
- // line += Math.ceil(stream.length / process.stdout.columns);
30
- } else if (id) {
31
- if (typeof mapLines[id] === "undefined") {
32
- mapLines[id] = line;
33
- }
34
- const targetLine = typeof mapLines[id] !== "undefined" ? mapLines[id] : line;
35
- const dy = line - targetLine;
36
- if (dy > 0) {
37
- process.stdout.write("\x1b[s");
38
- process.stdout.write(`\x1b[${dy}A`);
39
- }
40
- process.stdout.write("\x1b[2K");
41
- let str = `${id}: ${status}\n`;
42
- if (status === "Downloading") {
43
- const width = process.stdout.columns;
44
- const sizeWidth = 19,
45
- totalWidth = width - id.length - status.length - sizeWidth - 7,
46
- currentWidth = Math.floor(totalWidth * (current / total)),
47
- formatSize = `${(0, _formatSizeUnits.formatSizeUnits)(current)}/${(0, _formatSizeUnits.formatSizeUnits)(total)}`;
48
- str = `${id}: ${status} [${"█".repeat(currentWidth)}${"░".repeat(totalWidth - currentWidth)}] ${formatSize}\n`;
49
- }
50
- process.stdout.write(str);
51
- if (dy > 0) {
52
- process.stdout.write("\x1b[u");
53
- } else {
54
- line++;
55
- }
56
- } else if (status) {
57
- process.stdout.write(`${status}\n`);
58
- line += Math.ceil(status.length / process.stdout.columns);
59
- } else if (aux) {
60
- const str = `auxID: ${aux.ID}`;
61
- process.stdout.write(`${str}\n`);
62
- line += Math.ceil(str.length / process.stdout.columns);
63
- } else {
64
- _Logger.Logger.warning("followProgress: unexpected data", data);
65
- }
66
- });
67
- return new Promise((resolve, reject) => {
68
- let isEnded = false;
69
- const handleEnd = () => {
70
- if (!isEnded) {
71
- resolve(null);
72
- }
73
- isEnded = true;
74
- };
75
- lineStream.on("end", handleEnd);
76
- lineStream.on("close", handleEnd);
77
- lineStream.on("error", reject);
78
- });
4
+ const LineConvertStream_1 = require("../makes/LineConvertStream");
5
+ const format_size_units_1 = require("./format-size-units");
6
+ const makes_1 = require("../makes");
7
+ const followProgress = async (stream) => {
8
+ const lineStream = new LineConvertStream_1.LineConvertStream(stream);
9
+ let line = 0;
10
+ const mapLines = {};
11
+ lineStream.on("data", (chunk) => {
12
+ const data = JSON.parse(chunk.toString());
13
+ const { stream, id, status, progressDetail: { current, total } = {}, aux } = data;
14
+ if (stream) {
15
+ process.stdout.write(`${stream}`);
16
+ line += stream.split("\n").length - 1;
17
+ }
18
+ else if (id) {
19
+ if (typeof mapLines[id] === "undefined") {
20
+ mapLines[id] = line;
21
+ }
22
+ const targetLine = typeof mapLines[id] !== "undefined" ? mapLines[id] : line;
23
+ const dy = line - targetLine;
24
+ if (dy > 0) {
25
+ process.stdout.write("\x1b[s");
26
+ process.stdout.write(`\x1b[${dy}A`);
27
+ }
28
+ process.stdout.write("\x1b[2K");
29
+ let str = `${id}: ${status}\n`;
30
+ if (status === "Downloading") {
31
+ const width = process.stdout.columns;
32
+ const sizeWidth = 19, totalWidth = width - id.length - status.length - sizeWidth - 7, currentWidth = Math.floor(totalWidth * (current / total)), formatSize = `${(0, format_size_units_1.formatSizeUnits)(current)}/${(0, format_size_units_1.formatSizeUnits)(total)}`;
33
+ str = `${id}: ${status} [${"█".repeat(currentWidth)}${"░".repeat(totalWidth - currentWidth)}] ${formatSize}\n`;
34
+ }
35
+ process.stdout.write(str);
36
+ if (dy > 0) {
37
+ process.stdout.write("\x1b[u");
38
+ }
39
+ else {
40
+ line++;
41
+ }
42
+ }
43
+ else if (status) {
44
+ process.stdout.write(`${status}\n`);
45
+ line += Math.ceil(status.length / process.stdout.columns);
46
+ }
47
+ else if (aux) {
48
+ const str = `auxID: ${aux.ID}`;
49
+ process.stdout.write(`${str}\n`);
50
+ line += Math.ceil(str.length / process.stdout.columns);
51
+ }
52
+ else {
53
+ makes_1.Logger.warn("followProgress: unexpected data", data);
54
+ }
55
+ });
56
+ return new Promise((resolve, reject) => {
57
+ let isEnded = false;
58
+ const handleEnd = () => {
59
+ if (!isEnded) {
60
+ resolve(null);
61
+ }
62
+ isEnded = true;
63
+ };
64
+ lineStream.on("end", handleEnd);
65
+ lineStream.on("close", handleEnd);
66
+ lineStream.on("error", reject);
67
+ });
79
68
  };
80
- exports.followProgress = followProgress;
69
+ exports.followProgress = followProgress;
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.formatSizeUnits = void 0;
7
- const formatSizeUnits = bytes => {
8
- if (bytes >= 1073741824) {
9
- return (bytes / 1073741824).toFixed(2) + "GB";
10
- } else if (bytes >= 1048576) {
11
- return (bytes / 1048576).toFixed(2) + "MB";
12
- } else if (bytes >= 1024) {
13
- return (bytes / 1024).toFixed(2) + "kB";
14
- } else if (bytes >= 1) {
15
- return bytes + "b";
16
- }
17
- return "0b";
4
+ const formatSizeUnits = (bytes) => {
5
+ if (bytes >= 1073741824) {
6
+ return (bytes / 1073741824).toFixed(2) + "GB";
7
+ }
8
+ else if (bytes >= 1048576) {
9
+ return (bytes / 1048576).toFixed(2) + "MB";
10
+ }
11
+ else if (bytes >= 1024) {
12
+ return (bytes / 1024).toFixed(2) + "kB";
13
+ }
14
+ else if (bytes >= 1) {
15
+ return bytes + "b";
16
+ }
17
+ return "0b";
18
18
  };
19
- exports.formatSizeUnits = formatSizeUnits;
19
+ exports.formatSizeUnits = formatSizeUnits;
@@ -1,2 +1,2 @@
1
- import { Config } from "src/types";
1
+ import { Config } from "../types";
2
2
  export declare const getConfig: () => Promise<Config>;
@@ -1,20 +1,17 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.getConfig = void 0;
7
- var _env = require("../env");
8
- var _FS = require("../makes/FS");
4
+ const env_1 = require("../env");
5
+ const FS_1 = require("../makes/FS");
9
6
  const getConfig = async () => {
10
- return _FS.FS.readJSON(_env.MAP_PATH).catch(err => {
11
- if (err.code === "ENOENT") {
12
- return Promise.resolve({
13
- env: {},
14
- projects: []
15
- });
16
- }
17
- throw err;
18
- });
7
+ return FS_1.FS.readJSON(env_1.MAP_PATH).catch((err) => {
8
+ if (err.code === "ENOENT") {
9
+ return Promise.resolve({
10
+ env: {},
11
+ projects: []
12
+ });
13
+ }
14
+ throw err;
15
+ });
19
16
  };
20
- exports.getConfig = getConfig;
17
+ exports.getConfig = getConfig;
@@ -1,34 +1,27 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.getCursorPosition = void 0;
7
- // import {} from "tty";
8
-
9
4
  const code = '\x1b[6n';
10
5
  const getCursorPosition = async () => {
11
- process.stdin.resume();
12
- process.stdin.setRawMode(true);
13
- const position = {};
14
- await new Promise((resolve, reject) => {
15
- const handleData = data => {
16
- const match = /\[(\d+);(\d+)R$/.exec(data.toString());
17
- if (match) {
18
- const [, col, row] = match.slice(1, 3).reverse().map(Number);
19
- position.row = row;
20
- position.col = col;
21
- resolve(undefined);
22
- }
23
-
24
- // process.stdin.setRawMode(false);
25
- process.stdin.off("data", handleData);
26
- process.stdin.pause();
27
- };
28
- process.stdin.once("data", handleData);
29
- process.stdout.write(code);
30
- process.stdout.emit("data", code);
31
- });
32
- return position;
6
+ process.stdin.resume();
7
+ process.stdin.setRawMode(true);
8
+ const position = {};
9
+ await new Promise((resolve, reject) => {
10
+ const handleData = (data) => {
11
+ const match = /\[(\d+);(\d+)R$/.exec(data.toString());
12
+ if (match) {
13
+ const [, col, row] = match.slice(1, 3).reverse().map(Number);
14
+ position.row = row;
15
+ position.col = col;
16
+ resolve(undefined);
17
+ }
18
+ process.stdin.off("data", handleData);
19
+ process.stdin.pause();
20
+ };
21
+ process.stdin.once("data", handleData);
22
+ process.stdout.write(code);
23
+ process.stdout.emit("data", code);
24
+ });
25
+ return position;
33
26
  };
34
- exports.getCursorPosition = getCursorPosition;
27
+ exports.getCursorPosition = getCursorPosition;
@@ -1,28 +1,40 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
5
17
  });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
6
26
  exports.imageBuild = void 0;
7
- var _exec = require("./exec");
8
- var Path = _interopRequireWildcard(require("path"));
9
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
- const imageBuild = async options => {
12
- const {
13
- tag,
14
- buildArgs = {},
15
- labels = {},
16
- context,
17
- src
18
- } = options;
19
- const buildArgsString = Object.keys(buildArgs).map(key => {
20
- return `--build-arg ${key}=${buildArgs[key]}`;
21
- }).join(" ");
22
- const labelsString = Object.keys(labels).map(key => {
23
- return `--label ${key}=${labels[key]}`;
24
- }).join(" ");
25
- await (0, _exec.exec)(`
27
+ const Path = __importStar(require("path"));
28
+ const exec_1 = require("./exec");
29
+ const imageBuild = async (options) => {
30
+ const { tag, buildArgs = {}, labels = {}, context, src } = options;
31
+ const buildArgsString = Object.keys(buildArgs).map((key) => {
32
+ return `--build-arg ${key}=${buildArgs[key]}`;
33
+ }).join(" ");
34
+ const labelsString = Object.keys(labels).map((key) => {
35
+ return `--label ${key}=${labels[key]}`;
36
+ }).join(" ");
37
+ await (0, exec_1.exec)(`
26
38
  docker build \
27
39
  --tag "${tag}" \
28
40
  ${buildArgsString} \
@@ -31,4 +43,4 @@ const imageBuild = async options => {
31
43
  ${context}
32
44
  `);
33
45
  };
34
- exports.imageBuild = imageBuild;
46
+ exports.imageBuild = imageBuild;