@cyberskill/shared 1.47.0 → 1.48.0
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/dist/_tsup-dts-rollup.d.cts +410 -30
- package/dist/_tsup-dts-rollup.d.ts +410 -30
- package/dist/cli.cjs +2136 -1
- package/dist/cli.d.cts +2 -1
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +2056 -1
- package/dist/configs/commitlint/base.cjs +64 -1
- package/dist/configs/commitlint/base.js +7 -1
- package/dist/configs/eslint/base.cjs +121 -1
- package/dist/configs/eslint/base.js +52 -1
- package/dist/configs/eslint/nestjs.cjs +155 -1
- package/dist/configs/eslint/nestjs.js +85 -1
- package/dist/configs/eslint/nextjs.cjs +155 -1
- package/dist/configs/eslint/nextjs.js +85 -1
- package/dist/configs/eslint/nodejs.cjs +156 -1
- package/dist/configs/eslint/nodejs.js +86 -1
- package/dist/configs/eslint/vite-react.cjs +159 -1
- package/dist/configs/eslint/vite-react.js +89 -1
- package/dist/configs/graphql/graphql-codegen.cjs +125 -1
- package/dist/configs/graphql/graphql-codegen.js +64 -1
- package/dist/configs/graphql/index.cjs +126 -1
- package/dist/configs/graphql/index.js +64 -1
- package/dist/configs/i18n/react/i18next.cjs +80 -1
- package/dist/configs/i18n/react/i18next.js +7 -1
- package/dist/configs/i18n/react/index.cjs +81 -1
- package/dist/configs/i18n/react/index.js +7 -1
- package/dist/configs/index.cjs +232 -1
- package/dist/configs/index.js +166 -1
- package/dist/configs/lint-staged/base.cjs +64 -1
- package/dist/configs/lint-staged/base.js +7 -1
- package/dist/configs/vitest/react/e2e.cjs +128 -1
- package/dist/configs/vitest/react/e2e.js +59 -1
- package/dist/configs/vitest/react/unit.cjs +305 -1
- package/dist/configs/vitest/react/unit.js +228 -1
- package/dist/configs/vitest/react/unit.setup.cjs +60 -1
- package/dist/configs/vitest/react/unit.setup.js +8 -1
- package/dist/constants/index.cjs +678 -1
- package/dist/constants/index.d.cts +31 -1
- package/dist/constants/index.d.ts +31 -1
- package/dist/constants/index.js +469 -1
- package/dist/constants/path.cjs +423 -1
- package/dist/constants/path.d.cts +31 -1
- package/dist/constants/path.d.ts +31 -1
- package/dist/constants/path.js +218 -1
- package/dist/constants/response-status.cjs +313 -1
- package/dist/constants/response-status.js +252 -1
- package/dist/index.cjs +4546 -1
- package/dist/index.d.cts +51 -7
- package/dist/index.d.ts +51 -7
- package/dist/index.js +4133 -1
- package/dist/nodejs/index.cjs +2138 -1
- package/dist/nodejs/index.js +2054 -1
- package/dist/nodejs/mongo.cjs +2137 -1
- package/dist/nodejs/mongo.js +2054 -1
- package/dist/react/apollo-client.cjs +177 -1
- package/dist/react/apollo-client.js +116 -1
- package/dist/react/index.cjs +990 -1
- package/dist/react/index.js +876 -1
- package/dist/react/loading.cjs +301 -1
- package/dist/react/loading.js +216 -1
- package/dist/react/next-intl.cjs +744 -1
- package/dist/react/next-intl.js +655 -1
- package/dist/react/storage.cjs +631 -1
- package/dist/react/storage.js +558 -1
- package/dist/typescript/api-response.cjs +48 -1
- package/dist/typescript/apollo.cjs +48 -1
- package/dist/typescript/command.cjs +68 -1
- package/dist/typescript/command.d.cts +4 -0
- package/dist/typescript/command.d.ts +4 -0
- package/dist/typescript/command.js +7 -1
- package/dist/typescript/config.cjs +48 -1
- package/dist/typescript/fs.cjs +48 -0
- package/dist/typescript/fs.d.cts +1 -0
- package/dist/typescript/fs.d.ts +1 -0
- package/dist/typescript/fs.js +0 -0
- package/dist/typescript/graphql-codegen.cjs +48 -1
- package/dist/typescript/index.cjs +175 -1
- package/dist/typescript/index.d.cts +5 -0
- package/dist/typescript/index.d.ts +5 -0
- package/dist/typescript/index.js +151 -1
- package/dist/typescript/loading.cjs +48 -1
- package/dist/typescript/log.cjs +48 -1
- package/dist/typescript/mongo.cjs +164 -1
- package/dist/typescript/mongo.js +145 -1
- package/dist/typescript/next-intl.cjs +48 -1
- package/dist/typescript/react.cjs +48 -1
- package/dist/typescript/serializer.cjs +48 -1
- package/dist/typescript/string.cjs +48 -1
- package/dist/utils/command.cjs +1387 -1
- package/dist/utils/command.d.cts +2 -0
- package/dist/utils/command.d.ts +2 -0
- package/dist/utils/command.js +1287 -1
- package/dist/utils/common.cjs +300 -1
- package/dist/utils/common.js +219 -1
- package/dist/utils/config.cjs +146 -1
- package/dist/utils/config.js +89 -1
- package/dist/utils/fs.cjs +118 -1
- package/dist/utils/fs.d.cts +4 -1
- package/dist/utils/fs.d.ts +4 -1
- package/dist/utils/fs.js +37 -1
- package/dist/utils/index-nodejs.cjs +1738 -1
- package/dist/utils/index-nodejs.d.cts +15 -6
- package/dist/utils/index-nodejs.d.ts +15 -6
- package/dist/utils/index-nodejs.js +1571 -1
- package/dist/utils/index.cjs +727 -1
- package/dist/utils/index.js +625 -1
- package/dist/utils/log.cjs +330 -1
- package/dist/utils/log.js +269 -1
- package/dist/utils/package.cjs +941 -0
- package/dist/utils/package.d.cts +3 -0
- package/dist/utils/package.d.ts +3 -0
- package/dist/utils/package.js +857 -0
- package/dist/utils/path.cjs +291 -0
- package/dist/utils/path.d.cts +6 -0
- package/dist/utils/path.d.ts +6 -0
- package/dist/utils/path.js +191 -0
- package/dist/utils/serializer.cjs +91 -1
- package/dist/utils/serializer.js +30 -1
- package/dist/utils/storage-client.cjs +349 -1
- package/dist/utils/storage-client.js +276 -1
- package/dist/utils/storage-server.cjs +636 -1
- package/dist/utils/storage-server.d.cts +1 -1
- package/dist/utils/storage-server.d.ts +1 -1
- package/dist/utils/storage-server.js +550 -1
- package/dist/utils/string.cjs +152 -1
- package/dist/utils/string.js +75 -1
- package/dist/utils/validate.cjs +90 -1
- package/dist/utils/validate.js +33 -1
- package/package.json +11 -11
- package/dist/utils/npm-package.cjs +0 -1
- package/dist/utils/npm-package.d.cts +0 -5
- package/dist/utils/npm-package.d.ts +0 -5
- package/dist/utils/npm-package.js +0 -1
package/dist/utils/command.js
CHANGED
|
@@ -1 +1,1287 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/command.ts
|
|
2
|
+
function _array_like_to_array(arr, len) {
|
|
3
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
4
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
5
|
+
return arr2;
|
|
6
|
+
}
|
|
7
|
+
function _array_with_holes(arr) {
|
|
8
|
+
if (Array.isArray(arr)) return arr;
|
|
9
|
+
}
|
|
10
|
+
function _array_without_holes(arr) {
|
|
11
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
12
|
+
}
|
|
13
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
14
|
+
try {
|
|
15
|
+
var info = gen[key](arg);
|
|
16
|
+
var value = info.value;
|
|
17
|
+
} catch (error) {
|
|
18
|
+
reject(error);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (info.done) {
|
|
22
|
+
resolve(value);
|
|
23
|
+
} else {
|
|
24
|
+
Promise.resolve(value).then(_next, _throw);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function _async_to_generator(fn) {
|
|
28
|
+
return function() {
|
|
29
|
+
var self = this, args = arguments;
|
|
30
|
+
return new Promise(function(resolve, reject) {
|
|
31
|
+
var gen = fn.apply(self, args);
|
|
32
|
+
function _next(value) {
|
|
33
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
34
|
+
}
|
|
35
|
+
function _throw(err) {
|
|
36
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
37
|
+
}
|
|
38
|
+
_next(undefined);
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function _iterable_to_array(iter) {
|
|
43
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
44
|
+
}
|
|
45
|
+
function _iterable_to_array_limit(arr, i) {
|
|
46
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
47
|
+
if (_i == null) return;
|
|
48
|
+
var _arr = [];
|
|
49
|
+
var _n = true;
|
|
50
|
+
var _d = false;
|
|
51
|
+
var _s, _e;
|
|
52
|
+
try {
|
|
53
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
54
|
+
_arr.push(_s.value);
|
|
55
|
+
if (i && _arr.length === i) break;
|
|
56
|
+
}
|
|
57
|
+
} catch (err) {
|
|
58
|
+
_d = true;
|
|
59
|
+
_e = err;
|
|
60
|
+
} finally{
|
|
61
|
+
try {
|
|
62
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
63
|
+
} finally{
|
|
64
|
+
if (_d) throw _e;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return _arr;
|
|
68
|
+
}
|
|
69
|
+
function _non_iterable_rest() {
|
|
70
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
71
|
+
}
|
|
72
|
+
function _non_iterable_spread() {
|
|
73
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
74
|
+
}
|
|
75
|
+
function _sliced_to_array(arr, i) {
|
|
76
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
77
|
+
}
|
|
78
|
+
function _to_consumable_array(arr) {
|
|
79
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
80
|
+
}
|
|
81
|
+
function _type_of(obj) {
|
|
82
|
+
"@swc/helpers - typeof";
|
|
83
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
84
|
+
}
|
|
85
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
86
|
+
if (!o) return;
|
|
87
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
88
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
89
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
90
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
91
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
92
|
+
}
|
|
93
|
+
function _ts_generator(thisArg, body) {
|
|
94
|
+
var f, y, t, g, _ = {
|
|
95
|
+
label: 0,
|
|
96
|
+
sent: function() {
|
|
97
|
+
if (t[0] & 1) throw t[1];
|
|
98
|
+
return t[1];
|
|
99
|
+
},
|
|
100
|
+
trys: [],
|
|
101
|
+
ops: []
|
|
102
|
+
};
|
|
103
|
+
return g = {
|
|
104
|
+
next: verb(0),
|
|
105
|
+
"throw": verb(1),
|
|
106
|
+
"return": verb(2)
|
|
107
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
108
|
+
return this;
|
|
109
|
+
}), g;
|
|
110
|
+
function verb(n) {
|
|
111
|
+
return function(v) {
|
|
112
|
+
return step([
|
|
113
|
+
n,
|
|
114
|
+
v
|
|
115
|
+
]);
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function step(op) {
|
|
119
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
120
|
+
while(_)try {
|
|
121
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
122
|
+
if (y = 0, t) op = [
|
|
123
|
+
op[0] & 2,
|
|
124
|
+
t.value
|
|
125
|
+
];
|
|
126
|
+
switch(op[0]){
|
|
127
|
+
case 0:
|
|
128
|
+
case 1:
|
|
129
|
+
t = op;
|
|
130
|
+
break;
|
|
131
|
+
case 4:
|
|
132
|
+
_.label++;
|
|
133
|
+
return {
|
|
134
|
+
value: op[1],
|
|
135
|
+
done: false
|
|
136
|
+
};
|
|
137
|
+
case 5:
|
|
138
|
+
_.label++;
|
|
139
|
+
y = op[1];
|
|
140
|
+
op = [
|
|
141
|
+
0
|
|
142
|
+
];
|
|
143
|
+
continue;
|
|
144
|
+
case 7:
|
|
145
|
+
op = _.ops.pop();
|
|
146
|
+
_.trys.pop();
|
|
147
|
+
continue;
|
|
148
|
+
default:
|
|
149
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
150
|
+
_ = 0;
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
154
|
+
_.label = op[1];
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
158
|
+
_.label = t[1];
|
|
159
|
+
t = op;
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
if (t && _.label < t[2]) {
|
|
163
|
+
_.label = t[2];
|
|
164
|
+
_.ops.push(op);
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
if (t[2]) _.ops.pop();
|
|
168
|
+
_.trys.pop();
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
op = body.call(thisArg, _);
|
|
172
|
+
} catch (e) {
|
|
173
|
+
op = [
|
|
174
|
+
6,
|
|
175
|
+
e
|
|
176
|
+
];
|
|
177
|
+
y = 0;
|
|
178
|
+
} finally{
|
|
179
|
+
f = t = 0;
|
|
180
|
+
}
|
|
181
|
+
if (op[0] & 5) throw op[1];
|
|
182
|
+
return {
|
|
183
|
+
value: op[0] ? op[1] : void 0,
|
|
184
|
+
done: true
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
import boxen from "boxen";
|
|
189
|
+
import chalk from "chalk";
|
|
190
|
+
import { exec } from "node:child_process";
|
|
191
|
+
import process3 from "node:process";
|
|
192
|
+
import * as util from "node:util";
|
|
193
|
+
// src/constants/path.ts
|
|
194
|
+
import process from "node:process";
|
|
195
|
+
import { fileURLToPath } from "node:url";
|
|
196
|
+
// src/utils/path.ts
|
|
197
|
+
import * as path from "node:path";
|
|
198
|
+
function resolveCyberSkillPath() {
|
|
199
|
+
for(var _len = arguments.length, urls = new Array(_len), _key = 0; _key < _len; _key++){
|
|
200
|
+
urls[_key] = arguments[_key];
|
|
201
|
+
}
|
|
202
|
+
var _path;
|
|
203
|
+
return (_path = path).resolve.apply(_path, [
|
|
204
|
+
CYBERSKILL_DIRECTORY
|
|
205
|
+
].concat(_to_consumable_array(urls)));
|
|
206
|
+
}
|
|
207
|
+
function resolveWorkingPath() {
|
|
208
|
+
for(var _len = arguments.length, urls = new Array(_len), _key = 0; _key < _len; _key++){
|
|
209
|
+
urls[_key] = arguments[_key];
|
|
210
|
+
}
|
|
211
|
+
var _path;
|
|
212
|
+
return (_path = path).resolve.apply(_path, [
|
|
213
|
+
WORKING_DIRECTORY
|
|
214
|
+
].concat(_to_consumable_array(urls)));
|
|
215
|
+
}
|
|
216
|
+
function resolve2() {
|
|
217
|
+
for(var _len = arguments.length, urls = new Array(_len), _key = 0; _key < _len; _key++){
|
|
218
|
+
urls[_key] = arguments[_key];
|
|
219
|
+
}
|
|
220
|
+
var _path;
|
|
221
|
+
return (_path = path).resolve.apply(_path, _to_consumable_array(urls));
|
|
222
|
+
}
|
|
223
|
+
function dirname2(url) {
|
|
224
|
+
return path.dirname(url);
|
|
225
|
+
}
|
|
226
|
+
function join2() {
|
|
227
|
+
for(var _len = arguments.length, urls = new Array(_len), _key = 0; _key < _len; _key++){
|
|
228
|
+
urls[_key] = arguments[_key];
|
|
229
|
+
}
|
|
230
|
+
var _path;
|
|
231
|
+
return (_path = path).join.apply(_path, _to_consumable_array(urls));
|
|
232
|
+
}
|
|
233
|
+
// src/constants/path.ts
|
|
234
|
+
var __filename2 = fileURLToPath(import.meta.url);
|
|
235
|
+
var __dirname2 = dirname2(__filename2);
|
|
236
|
+
var CYBERSKILL_DIRECTORY = resolve2(__dirname2, "../../");
|
|
237
|
+
var WORKING_DIRECTORY = process.env.INIT_CWD || process.cwd();
|
|
238
|
+
var CYBERSKILL_PACKAGE_NAME = "@cyberskill/shared";
|
|
239
|
+
var CYBERSKILL_STORAGE = ".cyberskill-storage";
|
|
240
|
+
var NODE_MODULES = "node_modules";
|
|
241
|
+
var BUILD_DIRECTORY = "dist";
|
|
242
|
+
var PACKAGE_JSON = "package.json";
|
|
243
|
+
var PACKAGE_LOCK_JSON = "package-lock.json";
|
|
244
|
+
var TSCONFIG_JSON = "tsconfig.json";
|
|
245
|
+
var GIT_IGNORE = ".gitignore";
|
|
246
|
+
var SIMPLE_GIT_HOOK_JSON = ".simple-git-hooks.json";
|
|
247
|
+
var PNPM_LOCK_YAML = "pnpm-lock.yaml";
|
|
248
|
+
var GIT_HOOK = ".git/hooks";
|
|
249
|
+
var GIT_COMMIT_EDITMSG = ".git/COMMIT_EDITMSG";
|
|
250
|
+
var CYBERSKILL_CLI = "cyberskill";
|
|
251
|
+
var ESLINT_CLI = "eslint";
|
|
252
|
+
var VITEST_CLI = "vitest";
|
|
253
|
+
var COMMIT_LINT_CLI = "commitlint";
|
|
254
|
+
var LINT_STAGED_CLI = "lint-staged";
|
|
255
|
+
var RIMRAF_CLI = "rimraf";
|
|
256
|
+
var TSC_CLI = "tsc";
|
|
257
|
+
var TSX_CLI = "tsx";
|
|
258
|
+
var GIT_CLI = "git";
|
|
259
|
+
var PNPM_CLI = "pnpm";
|
|
260
|
+
var PNPM_DLX_CLI = "pnpm dlx";
|
|
261
|
+
var PNPM_EXEC_CLI = "pnpm exec";
|
|
262
|
+
var SIMPLE_GIT_HOOK_CLI = "simple-git-hooks";
|
|
263
|
+
var ESLINT_INSPECT_CLI = "@eslint/config-inspector";
|
|
264
|
+
var NODE_MODULES_INSPECT_CLI = "node_modules-inspect";
|
|
265
|
+
var PATH = {
|
|
266
|
+
CYBERSKILL_DIRECTORY: CYBERSKILL_DIRECTORY,
|
|
267
|
+
WORKING_DIRECTORY: WORKING_DIRECTORY,
|
|
268
|
+
TS_CONFIG: resolveWorkingPath(TSCONFIG_JSON),
|
|
269
|
+
GIT_IGNORE: resolveWorkingPath(GIT_IGNORE),
|
|
270
|
+
GIT_HOOK: resolveWorkingPath(GIT_HOOK),
|
|
271
|
+
GIT_COMMIT_MSG: resolveWorkingPath(GIT_COMMIT_EDITMSG),
|
|
272
|
+
SIMPLE_GIT_HOOKS: resolveWorkingPath(SIMPLE_GIT_HOOK_JSON),
|
|
273
|
+
PACKAGE_JSON: resolveWorkingPath(PACKAGE_JSON),
|
|
274
|
+
PACKAGE_LOCK_JSON: resolveWorkingPath(PACKAGE_LOCK_JSON),
|
|
275
|
+
PNPM_LOCK_YAML: resolveWorkingPath(PNPM_LOCK_YAML),
|
|
276
|
+
NODE_MODULES: resolveWorkingPath(NODE_MODULES),
|
|
277
|
+
CYBERSKILL: {
|
|
278
|
+
LINT_STAGED_CONFIG: resolveCyberSkillPath("./configs/lint-staged/base.js"),
|
|
279
|
+
COMMITLINT_CONFIG: resolveCyberSkillPath("./configs/commitlint/base.js"),
|
|
280
|
+
UNIT_TEST_CONFIG: resolveCyberSkillPath("./configs/vitest/react/unit.js"),
|
|
281
|
+
E2E_TEST_CONFIG: resolveCyberSkillPath("./configs/vitest/react/e2e.js")
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
var COMMAND = {
|
|
285
|
+
SIMPLE_GIT_HOOKS: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(SIMPLE_GIT_HOOK_CLI)),
|
|
286
|
+
ESLINT_INSPECT: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(ESLINT_INSPECT_CLI)),
|
|
287
|
+
NODE_MODULES_INSPECT: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(NODE_MODULES_INSPECT_CLI)),
|
|
288
|
+
RESET: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(RIMRAF_CLI, " ").concat(NODE_MODULES, " ").concat(PNPM_LOCK_YAML)),
|
|
289
|
+
ESLINT_CHECK: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(ESLINT_CLI, " ").concat(PATH.WORKING_DIRECTORY)),
|
|
290
|
+
ESLINT_FIX: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(ESLINT_CLI, " ").concat(PATH.WORKING_DIRECTORY, " --fix")),
|
|
291
|
+
TYPESCRIPT_CHECK: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(TSC_CLI, " -p ").concat(PATH.TS_CONFIG, " --noEmit")),
|
|
292
|
+
CYBERSKILL: {
|
|
293
|
+
TEST_UNIT: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(VITEST_CLI, " --config ").concat(PATH.CYBERSKILL.UNIT_TEST_CONFIG)),
|
|
294
|
+
TEST_E2E: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(VITEST_CLI, " --config ").concat(PATH.CYBERSKILL.E2E_TEST_CONFIG)),
|
|
295
|
+
COMMIT_LINT: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(COMMIT_LINT_CLI, " --edit ").concat(PATH.GIT_COMMIT_MSG, " --config ").concat(PATH.CYBERSKILL.COMMITLINT_CONFIG)),
|
|
296
|
+
LINT_STAGED: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(LINT_STAGED_CLI, " --config ").concat(PATH.CYBERSKILL.LINT_STAGED_CONFIG))
|
|
297
|
+
},
|
|
298
|
+
CONFIGURE_GIT_HOOK: commandFormatter.raw("".concat(GIT_CLI, " config core.hooksPath ").concat(PATH.GIT_HOOK)),
|
|
299
|
+
BUILD: commandFormatter.raw("".concat(PNPM_CLI, " run build")),
|
|
300
|
+
STAGE_BUILD_DIRECTORY: commandFormatter.raw("".concat(GIT_CLI, " add ").concat(BUILD_DIRECTORY)),
|
|
301
|
+
PNPM_INSTALL_STANDARD: commandFormatter.raw("".concat(PNPM_CLI, " install")),
|
|
302
|
+
PNPM_INSTALL_LEGACY: commandFormatter.raw("".concat(PNPM_CLI, " install --legacy-peer-deps")),
|
|
303
|
+
PNPM_INSTALL_FORCE: commandFormatter.raw("".concat(PNPM_CLI, " install --force"))
|
|
304
|
+
};
|
|
305
|
+
// src/utils/package.ts
|
|
306
|
+
import fetch from "node-fetch";
|
|
307
|
+
// src/utils/fs.ts
|
|
308
|
+
import * as fs from "node:fs";
|
|
309
|
+
var existsSync2 = function(filePath) {
|
|
310
|
+
return fs.existsSync(filePath);
|
|
311
|
+
};
|
|
312
|
+
function readFileSync2(filePath, options) {
|
|
313
|
+
var content = fs.readFileSync(filePath, "utf-8");
|
|
314
|
+
if (options === null || options === void 0 ? void 0 : options.asJson) {
|
|
315
|
+
try {
|
|
316
|
+
var parsed = JSON.parse(content);
|
|
317
|
+
if ((typeof parsed === "undefined" ? "undefined" : _type_of(parsed)) === "object" && parsed !== null) {
|
|
318
|
+
return parsed;
|
|
319
|
+
}
|
|
320
|
+
throw new Error("Parsed JSON is not an object or array");
|
|
321
|
+
} catch (e) {
|
|
322
|
+
throw new Error("Failed to parse JSON from file: ".concat(filePath));
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return content;
|
|
326
|
+
}
|
|
327
|
+
// src/utils/storage-server.ts
|
|
328
|
+
import nodePersist from "node-persist";
|
|
329
|
+
import os from "node:os";
|
|
330
|
+
import path2 from "node:path";
|
|
331
|
+
import process2 from "node:process";
|
|
332
|
+
function getStorageDir() {
|
|
333
|
+
return process2.env.CYBERSKILL_STORAGE_DIR || path2.join(os.homedir(), CYBERSKILL_STORAGE);
|
|
334
|
+
}
|
|
335
|
+
function initNodePersist() {
|
|
336
|
+
return _initNodePersist.apply(this, arguments);
|
|
337
|
+
}
|
|
338
|
+
function _initNodePersist() {
|
|
339
|
+
_initNodePersist = _async_to_generator(function() {
|
|
340
|
+
return _ts_generator(this, function(_state) {
|
|
341
|
+
switch(_state.label){
|
|
342
|
+
case 0:
|
|
343
|
+
if (!!nodePersist.defaultInstance) return [
|
|
344
|
+
3,
|
|
345
|
+
2
|
|
346
|
+
];
|
|
347
|
+
return [
|
|
348
|
+
4,
|
|
349
|
+
nodePersist.init({
|
|
350
|
+
dir: getStorageDir(),
|
|
351
|
+
stringify: JSON.stringify,
|
|
352
|
+
parse: JSON.parse,
|
|
353
|
+
encoding: "utf8",
|
|
354
|
+
logging: false,
|
|
355
|
+
forgiveParseErrors: true
|
|
356
|
+
})
|
|
357
|
+
];
|
|
358
|
+
case 1:
|
|
359
|
+
_state.sent();
|
|
360
|
+
_state.label = 2;
|
|
361
|
+
case 2:
|
|
362
|
+
return [
|
|
363
|
+
2
|
|
364
|
+
];
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
});
|
|
368
|
+
return _initNodePersist.apply(this, arguments);
|
|
369
|
+
}
|
|
370
|
+
var storageServer = {
|
|
371
|
+
get: function get(key) {
|
|
372
|
+
return _async_to_generator(function() {
|
|
373
|
+
var result, error;
|
|
374
|
+
return _ts_generator(this, function(_state) {
|
|
375
|
+
switch(_state.label){
|
|
376
|
+
case 0:
|
|
377
|
+
_state.trys.push([
|
|
378
|
+
0,
|
|
379
|
+
3,
|
|
380
|
+
,
|
|
381
|
+
4
|
|
382
|
+
]);
|
|
383
|
+
return [
|
|
384
|
+
4,
|
|
385
|
+
initNodePersist()
|
|
386
|
+
];
|
|
387
|
+
case 1:
|
|
388
|
+
_state.sent();
|
|
389
|
+
return [
|
|
390
|
+
4,
|
|
391
|
+
nodePersist.getItem(key)
|
|
392
|
+
];
|
|
393
|
+
case 2:
|
|
394
|
+
result = _state.sent();
|
|
395
|
+
return [
|
|
396
|
+
2,
|
|
397
|
+
result !== null && result !== void 0 ? result : null
|
|
398
|
+
];
|
|
399
|
+
case 3:
|
|
400
|
+
error = _state.sent();
|
|
401
|
+
console.error('❌ [Storage:get] Error getting key "'.concat(key, '":'), error);
|
|
402
|
+
return [
|
|
403
|
+
2,
|
|
404
|
+
null
|
|
405
|
+
];
|
|
406
|
+
case 4:
|
|
407
|
+
return [
|
|
408
|
+
2
|
|
409
|
+
];
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
})();
|
|
413
|
+
},
|
|
414
|
+
set: function set(key, value) {
|
|
415
|
+
return _async_to_generator(function() {
|
|
416
|
+
var error;
|
|
417
|
+
return _ts_generator(this, function(_state) {
|
|
418
|
+
switch(_state.label){
|
|
419
|
+
case 0:
|
|
420
|
+
_state.trys.push([
|
|
421
|
+
0,
|
|
422
|
+
3,
|
|
423
|
+
,
|
|
424
|
+
4
|
|
425
|
+
]);
|
|
426
|
+
return [
|
|
427
|
+
4,
|
|
428
|
+
initNodePersist()
|
|
429
|
+
];
|
|
430
|
+
case 1:
|
|
431
|
+
_state.sent();
|
|
432
|
+
return [
|
|
433
|
+
4,
|
|
434
|
+
nodePersist.setItem(key, value)
|
|
435
|
+
];
|
|
436
|
+
case 2:
|
|
437
|
+
_state.sent();
|
|
438
|
+
return [
|
|
439
|
+
3,
|
|
440
|
+
4
|
|
441
|
+
];
|
|
442
|
+
case 3:
|
|
443
|
+
error = _state.sent();
|
|
444
|
+
console.error('❌ [Storage:set] Error setting key "'.concat(key, '":'), error);
|
|
445
|
+
return [
|
|
446
|
+
3,
|
|
447
|
+
4
|
|
448
|
+
];
|
|
449
|
+
case 4:
|
|
450
|
+
return [
|
|
451
|
+
2
|
|
452
|
+
];
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
})();
|
|
456
|
+
},
|
|
457
|
+
remove: function remove(key) {
|
|
458
|
+
return _async_to_generator(function() {
|
|
459
|
+
var error;
|
|
460
|
+
return _ts_generator(this, function(_state) {
|
|
461
|
+
switch(_state.label){
|
|
462
|
+
case 0:
|
|
463
|
+
_state.trys.push([
|
|
464
|
+
0,
|
|
465
|
+
3,
|
|
466
|
+
,
|
|
467
|
+
4
|
|
468
|
+
]);
|
|
469
|
+
return [
|
|
470
|
+
4,
|
|
471
|
+
initNodePersist()
|
|
472
|
+
];
|
|
473
|
+
case 1:
|
|
474
|
+
_state.sent();
|
|
475
|
+
return [
|
|
476
|
+
4,
|
|
477
|
+
nodePersist.removeItem(key)
|
|
478
|
+
];
|
|
479
|
+
case 2:
|
|
480
|
+
_state.sent();
|
|
481
|
+
return [
|
|
482
|
+
3,
|
|
483
|
+
4
|
|
484
|
+
];
|
|
485
|
+
case 3:
|
|
486
|
+
error = _state.sent();
|
|
487
|
+
console.error('❌ [Storage:remove] Error removing key "'.concat(key, '":'), error);
|
|
488
|
+
return [
|
|
489
|
+
3,
|
|
490
|
+
4
|
|
491
|
+
];
|
|
492
|
+
case 4:
|
|
493
|
+
return [
|
|
494
|
+
2
|
|
495
|
+
];
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
})();
|
|
499
|
+
},
|
|
500
|
+
keys: function keys() {
|
|
501
|
+
return _async_to_generator(function() {
|
|
502
|
+
var keys, error;
|
|
503
|
+
return _ts_generator(this, function(_state) {
|
|
504
|
+
switch(_state.label){
|
|
505
|
+
case 0:
|
|
506
|
+
_state.trys.push([
|
|
507
|
+
0,
|
|
508
|
+
3,
|
|
509
|
+
,
|
|
510
|
+
4
|
|
511
|
+
]);
|
|
512
|
+
return [
|
|
513
|
+
4,
|
|
514
|
+
initNodePersist()
|
|
515
|
+
];
|
|
516
|
+
case 1:
|
|
517
|
+
_state.sent();
|
|
518
|
+
return [
|
|
519
|
+
4,
|
|
520
|
+
nodePersist.keys()
|
|
521
|
+
];
|
|
522
|
+
case 2:
|
|
523
|
+
keys = _state.sent();
|
|
524
|
+
if (!Array.isArray(keys)) {
|
|
525
|
+
console.warn("⚠️ [Storage:keys] Invalid keys response:", keys);
|
|
526
|
+
return [
|
|
527
|
+
2,
|
|
528
|
+
[]
|
|
529
|
+
];
|
|
530
|
+
}
|
|
531
|
+
return [
|
|
532
|
+
2,
|
|
533
|
+
keys
|
|
534
|
+
];
|
|
535
|
+
case 3:
|
|
536
|
+
error = _state.sent();
|
|
537
|
+
console.error("❌ [Storage:keys] Error getting keys:", error);
|
|
538
|
+
return [
|
|
539
|
+
2,
|
|
540
|
+
[]
|
|
541
|
+
];
|
|
542
|
+
case 4:
|
|
543
|
+
return [
|
|
544
|
+
2
|
|
545
|
+
];
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
})();
|
|
549
|
+
},
|
|
550
|
+
getLogLink: function getLogLink(key) {
|
|
551
|
+
return _async_to_generator(function() {
|
|
552
|
+
var storagePath;
|
|
553
|
+
return _ts_generator(this, function(_state) {
|
|
554
|
+
try {
|
|
555
|
+
storagePath = getStorageDir();
|
|
556
|
+
return [
|
|
557
|
+
2,
|
|
558
|
+
"".concat(storagePath, " (key: ").concat(key, ")")
|
|
559
|
+
];
|
|
560
|
+
} catch (error) {
|
|
561
|
+
console.error("❌ [Storage:getLogLink] Error getting log link:", error);
|
|
562
|
+
return [
|
|
563
|
+
2,
|
|
564
|
+
null
|
|
565
|
+
];
|
|
566
|
+
}
|
|
567
|
+
return [
|
|
568
|
+
2
|
|
569
|
+
];
|
|
570
|
+
});
|
|
571
|
+
})();
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
// src/utils/package.ts
|
|
575
|
+
var CACHE_EXPIRATION_MS = 24 * 60 * 60 * 1e3;
|
|
576
|
+
function getPackageJson(packageName) {
|
|
577
|
+
var workingPackageJsonPath = join2(WORKING_DIRECTORY, PACKAGE_JSON);
|
|
578
|
+
if (existsSync2(workingPackageJsonPath)) {
|
|
579
|
+
try {
|
|
580
|
+
var pkg = readFileSync2(workingPackageJsonPath, {
|
|
581
|
+
asJson: true
|
|
582
|
+
});
|
|
583
|
+
if (pkg.name === packageName) {
|
|
584
|
+
return {
|
|
585
|
+
path: workingPackageJsonPath,
|
|
586
|
+
file: pkg
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
} catch (error) {
|
|
590
|
+
commandLog.warning("Failed to read local package.json: ".concat(error.message));
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
var externalPackageJsonPath = join2(WORKING_DIRECTORY, NODE_MODULES, packageName, PACKAGE_JSON);
|
|
594
|
+
if (existsSync2(externalPackageJsonPath)) {
|
|
595
|
+
try {
|
|
596
|
+
var pkg1 = readFileSync2(externalPackageJsonPath, {
|
|
597
|
+
asJson: true
|
|
598
|
+
});
|
|
599
|
+
if (pkg1.name === packageName) {
|
|
600
|
+
return {
|
|
601
|
+
path: externalPackageJsonPath,
|
|
602
|
+
file: pkg1
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
} catch (error) {
|
|
606
|
+
commandLog.warning("Failed to read node_modules package.json for ".concat(packageName, ": ").concat(error.message));
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
return false;
|
|
610
|
+
}
|
|
611
|
+
function getLatestPackageVersion(packageName) {
|
|
612
|
+
return _getLatestPackageVersion.apply(this, arguments);
|
|
613
|
+
}
|
|
614
|
+
function _getLatestPackageVersion() {
|
|
615
|
+
_getLatestPackageVersion = _async_to_generator(function(packageName) {
|
|
616
|
+
var forceRefresh, versionCacheKey, metadataCacheKey, cached, metadata, isCacheValid, headers, response, data, latestVersion, error;
|
|
617
|
+
var _arguments = arguments;
|
|
618
|
+
return _ts_generator(this, function(_state) {
|
|
619
|
+
switch(_state.label){
|
|
620
|
+
case 0:
|
|
621
|
+
forceRefresh = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : false;
|
|
622
|
+
versionCacheKey = "npm_version:".concat(packageName);
|
|
623
|
+
metadataCacheKey = "npm_metadata:".concat(packageName);
|
|
624
|
+
return [
|
|
625
|
+
4,
|
|
626
|
+
storageServer.get(versionCacheKey)
|
|
627
|
+
];
|
|
628
|
+
case 1:
|
|
629
|
+
cached = _state.sent();
|
|
630
|
+
return [
|
|
631
|
+
4,
|
|
632
|
+
storageServer.get(metadataCacheKey)
|
|
633
|
+
];
|
|
634
|
+
case 2:
|
|
635
|
+
metadata = _state.sent();
|
|
636
|
+
isCacheValid = cached && Date.now() - cached.timestamp < CACHE_EXPIRATION_MS;
|
|
637
|
+
if (!forceRefresh && isCacheValid) {
|
|
638
|
+
return [
|
|
639
|
+
2,
|
|
640
|
+
cached.version
|
|
641
|
+
];
|
|
642
|
+
}
|
|
643
|
+
headers = {};
|
|
644
|
+
if (metadata === null || metadata === void 0 ? void 0 : metadata.etag) {
|
|
645
|
+
headers["If-None-Match"] = metadata.etag;
|
|
646
|
+
}
|
|
647
|
+
if (metadata === null || metadata === void 0 ? void 0 : metadata.lastModified) {
|
|
648
|
+
headers["If-Modified-Since"] = metadata.lastModified;
|
|
649
|
+
}
|
|
650
|
+
_state.label = 3;
|
|
651
|
+
case 3:
|
|
652
|
+
_state.trys.push([
|
|
653
|
+
3,
|
|
654
|
+
8,
|
|
655
|
+
,
|
|
656
|
+
9
|
|
657
|
+
]);
|
|
658
|
+
return [
|
|
659
|
+
4,
|
|
660
|
+
fetch("https://registry.npmjs.org/".concat(packageName, "/latest"), {
|
|
661
|
+
headers: headers
|
|
662
|
+
})
|
|
663
|
+
];
|
|
664
|
+
case 4:
|
|
665
|
+
response = _state.sent();
|
|
666
|
+
if (response.status === 304 && cached) {
|
|
667
|
+
return [
|
|
668
|
+
2,
|
|
669
|
+
cached.version
|
|
670
|
+
];
|
|
671
|
+
}
|
|
672
|
+
if (!response.ok) {
|
|
673
|
+
throw new Error("Failed to fetch latest version: ".concat(response.statusText));
|
|
674
|
+
}
|
|
675
|
+
return [
|
|
676
|
+
4,
|
|
677
|
+
response.json()
|
|
678
|
+
];
|
|
679
|
+
case 5:
|
|
680
|
+
data = _state.sent();
|
|
681
|
+
latestVersion = data.version;
|
|
682
|
+
return [
|
|
683
|
+
4,
|
|
684
|
+
storageServer.set(versionCacheKey, {
|
|
685
|
+
version: latestVersion,
|
|
686
|
+
timestamp: Date.now()
|
|
687
|
+
})
|
|
688
|
+
];
|
|
689
|
+
case 6:
|
|
690
|
+
_state.sent();
|
|
691
|
+
return [
|
|
692
|
+
4,
|
|
693
|
+
storageServer.set(metadataCacheKey, {
|
|
694
|
+
etag: response.headers.get("ETag") || void 0,
|
|
695
|
+
lastModified: response.headers.get("Last-Modified") || void 0
|
|
696
|
+
})
|
|
697
|
+
];
|
|
698
|
+
case 7:
|
|
699
|
+
_state.sent();
|
|
700
|
+
return [
|
|
701
|
+
2,
|
|
702
|
+
latestVersion
|
|
703
|
+
];
|
|
704
|
+
case 8:
|
|
705
|
+
error = _state.sent();
|
|
706
|
+
commandLog.error("Error fetching latest version for ".concat(packageName, ": ").concat(error.message));
|
|
707
|
+
if (cached) {
|
|
708
|
+
commandLog.warning("Falling back to cached version for ".concat(packageName, ": ").concat(cached.version));
|
|
709
|
+
return [
|
|
710
|
+
2,
|
|
711
|
+
cached.version
|
|
712
|
+
];
|
|
713
|
+
}
|
|
714
|
+
throw error;
|
|
715
|
+
case 9:
|
|
716
|
+
return [
|
|
717
|
+
2
|
|
718
|
+
];
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
});
|
|
722
|
+
return _getLatestPackageVersion.apply(this, arguments);
|
|
723
|
+
}
|
|
724
|
+
function checkPackage(packageName) {
|
|
725
|
+
return _checkPackage.apply(this, arguments);
|
|
726
|
+
}
|
|
727
|
+
function _checkPackage() {
|
|
728
|
+
_checkPackage = _async_to_generator(function(packageName) {
|
|
729
|
+
var result, packageFound, cyberskillPackageJsonPath, isCurrentProject, _tmp, error;
|
|
730
|
+
return _ts_generator(this, function(_state) {
|
|
731
|
+
switch(_state.label){
|
|
732
|
+
case 0:
|
|
733
|
+
result = {
|
|
734
|
+
isInstalled: false,
|
|
735
|
+
isCurrentProject: false,
|
|
736
|
+
installedPath: "",
|
|
737
|
+
installedVersion: "",
|
|
738
|
+
latestVersion: "",
|
|
739
|
+
file: {}
|
|
740
|
+
};
|
|
741
|
+
_state.label = 1;
|
|
742
|
+
case 1:
|
|
743
|
+
_state.trys.push([
|
|
744
|
+
1,
|
|
745
|
+
5,
|
|
746
|
+
,
|
|
747
|
+
6
|
|
748
|
+
]);
|
|
749
|
+
packageFound = getPackageJson(packageName);
|
|
750
|
+
if (!packageFound) {
|
|
751
|
+
return [
|
|
752
|
+
2,
|
|
753
|
+
result
|
|
754
|
+
];
|
|
755
|
+
}
|
|
756
|
+
cyberskillPackageJsonPath = resolveCyberSkillPath(PACKAGE_JSON);
|
|
757
|
+
isCurrentProject = packageFound.path === cyberskillPackageJsonPath;
|
|
758
|
+
result.file = packageFound.file;
|
|
759
|
+
result.isInstalled = true;
|
|
760
|
+
result.installedPath = packageFound.path;
|
|
761
|
+
result.installedVersion = packageFound.file.version;
|
|
762
|
+
result.isCurrentProject = isCurrentProject;
|
|
763
|
+
if (!isCurrentProject) return [
|
|
764
|
+
3,
|
|
765
|
+
2
|
|
766
|
+
];
|
|
767
|
+
_tmp = packageFound.file.version;
|
|
768
|
+
return [
|
|
769
|
+
3,
|
|
770
|
+
4
|
|
771
|
+
];
|
|
772
|
+
case 2:
|
|
773
|
+
return [
|
|
774
|
+
4,
|
|
775
|
+
getLatestPackageVersion(packageName, true)
|
|
776
|
+
];
|
|
777
|
+
case 3:
|
|
778
|
+
_tmp = _state.sent();
|
|
779
|
+
_state.label = 4;
|
|
780
|
+
case 4:
|
|
781
|
+
result.latestVersion = _tmp;
|
|
782
|
+
return [
|
|
783
|
+
2,
|
|
784
|
+
result
|
|
785
|
+
];
|
|
786
|
+
case 5:
|
|
787
|
+
error = _state.sent();
|
|
788
|
+
commandLog.error('Error checking package "'.concat(packageName, '": ').concat(error.message));
|
|
789
|
+
return [
|
|
790
|
+
2,
|
|
791
|
+
result
|
|
792
|
+
];
|
|
793
|
+
case 6:
|
|
794
|
+
return [
|
|
795
|
+
2
|
|
796
|
+
];
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
});
|
|
800
|
+
return _checkPackage.apply(this, arguments);
|
|
801
|
+
}
|
|
802
|
+
// src/utils/command.ts
|
|
803
|
+
var DEBUG = process3.env.DEBUG === "true";
|
|
804
|
+
var execPromise = util.promisify(exec);
|
|
805
|
+
var gray = chalk.gray, blue = chalk.blue;
|
|
806
|
+
var getTimeStamp = function() {
|
|
807
|
+
return gray("[".concat(/* @__PURE__ */ new Date().toLocaleTimeString(), "]"));
|
|
808
|
+
};
|
|
809
|
+
function chalkKeyword(color) {
|
|
810
|
+
var chalkColor = chalk[color];
|
|
811
|
+
return typeof chalkColor === "function" ? chalkColor : chalk.green;
|
|
812
|
+
}
|
|
813
|
+
function printLog(type, color, icon, message) {
|
|
814
|
+
var chalkColor = chalkKeyword(color);
|
|
815
|
+
console.log("".concat(getTimeStamp(), " ").concat(chalkColor("".concat(icon, " ").concat(type)), " ").concat(message));
|
|
816
|
+
}
|
|
817
|
+
function printBoxedLog(title, content) {
|
|
818
|
+
var _ref = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, _ref_color = _ref.color, color = _ref_color === void 0 ? "green" : _ref_color, _ref_padding = _ref.padding, padding = _ref_padding === void 0 ? 1 : _ref_padding, _ref_margin = _ref.margin, margin = _ref_margin === void 0 ? 1 : _ref_margin, _ref_borderStyle = _ref.borderStyle, borderStyle = _ref_borderStyle === void 0 ? "round" : _ref_borderStyle, _ref_titleColor = _ref.titleColor, titleColor = _ref_titleColor === void 0 ? "bold" : _ref_titleColor;
|
|
819
|
+
var chalkColor = chalkKeyword(color);
|
|
820
|
+
var chalkTitleColor = chalkKeyword(titleColor);
|
|
821
|
+
if (typeof content === "string") {
|
|
822
|
+
console.log(boxen(chalkTitleColor(chalkColor("".concat(title, "\n").concat(content))), {
|
|
823
|
+
padding: padding,
|
|
824
|
+
margin: margin,
|
|
825
|
+
borderStyle: borderStyle,
|
|
826
|
+
borderColor: color
|
|
827
|
+
}));
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
if (Array.isArray(content) && content.length) {
|
|
831
|
+
content.forEach(function(param) {
|
|
832
|
+
var file = param.file, position = param.position, rule = param.rule, message = param.message;
|
|
833
|
+
console.log("".concat(getTimeStamp(), " ").concat(chalkColor("File:"), " ").concat(blue("".concat(file).concat(position ? ":".concat(position) : ""))));
|
|
834
|
+
if (rule) console.log(" ".concat(chalkColor("Rule:"), " ").concat(chalkColor(rule)));
|
|
835
|
+
console.log(" ".concat(chalkColor("Message:"), " ").concat(chalkColor(message)));
|
|
836
|
+
});
|
|
837
|
+
console.log(boxen(chalkTitleColor(chalkColor("".concat(title, ": ").concat(content.length))), {
|
|
838
|
+
padding: padding,
|
|
839
|
+
margin: margin,
|
|
840
|
+
borderStyle: borderStyle,
|
|
841
|
+
borderColor: color
|
|
842
|
+
}));
|
|
843
|
+
console.log(gray("\u2500".repeat(40)));
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
var commandLog = {
|
|
847
|
+
success: function(message) {
|
|
848
|
+
return printLog("SUCCESS", "green", "\u2714", message);
|
|
849
|
+
},
|
|
850
|
+
error: function(message) {
|
|
851
|
+
return printLog("ERROR", "red", "\u2716", message);
|
|
852
|
+
},
|
|
853
|
+
warning: function(message) {
|
|
854
|
+
return printLog("WARNING", "yellow", "\u26A0", message);
|
|
855
|
+
},
|
|
856
|
+
info: function(message) {
|
|
857
|
+
return printLog("INFO", "blue", "\u2139", message);
|
|
858
|
+
},
|
|
859
|
+
printBoxedLog: printBoxedLog
|
|
860
|
+
};
|
|
861
|
+
var getErrorListKey = function(timestamp) {
|
|
862
|
+
return "error_list:".concat(timestamp);
|
|
863
|
+
};
|
|
864
|
+
function saveErrorListToStorage(errorList) {
|
|
865
|
+
return _saveErrorListToStorage.apply(this, arguments);
|
|
866
|
+
}
|
|
867
|
+
function _saveErrorListToStorage() {
|
|
868
|
+
_saveErrorListToStorage = _async_to_generator(function(errorList) {
|
|
869
|
+
var timestamp, key, error;
|
|
870
|
+
return _ts_generator(this, function(_state) {
|
|
871
|
+
switch(_state.label){
|
|
872
|
+
case 0:
|
|
873
|
+
if (errorList.length === 0) {
|
|
874
|
+
return [
|
|
875
|
+
2
|
|
876
|
+
];
|
|
877
|
+
}
|
|
878
|
+
timestamp = Date.now();
|
|
879
|
+
key = getErrorListKey(timestamp);
|
|
880
|
+
_state.label = 1;
|
|
881
|
+
case 1:
|
|
882
|
+
_state.trys.push([
|
|
883
|
+
1,
|
|
884
|
+
3,
|
|
885
|
+
,
|
|
886
|
+
4
|
|
887
|
+
]);
|
|
888
|
+
return [
|
|
889
|
+
4,
|
|
890
|
+
storageServer.set(key, {
|
|
891
|
+
errors: errorList,
|
|
892
|
+
timestamp: timestamp
|
|
893
|
+
})
|
|
894
|
+
];
|
|
895
|
+
case 2:
|
|
896
|
+
_state.sent();
|
|
897
|
+
setTimeout(/*#__PURE__*/ _async_to_generator(function() {
|
|
898
|
+
var logPath;
|
|
899
|
+
return _ts_generator(this, function(_state) {
|
|
900
|
+
switch(_state.label){
|
|
901
|
+
case 0:
|
|
902
|
+
return [
|
|
903
|
+
4,
|
|
904
|
+
storageServer.getLogLink(key)
|
|
905
|
+
];
|
|
906
|
+
case 1:
|
|
907
|
+
logPath = _state.sent();
|
|
908
|
+
if (logPath) {
|
|
909
|
+
commandLog.info("\uD83D\uDCC2 Open the error list manually: ".concat(logPath));
|
|
910
|
+
}
|
|
911
|
+
return [
|
|
912
|
+
2
|
|
913
|
+
];
|
|
914
|
+
}
|
|
915
|
+
});
|
|
916
|
+
}), 10);
|
|
917
|
+
return [
|
|
918
|
+
3,
|
|
919
|
+
4
|
|
920
|
+
];
|
|
921
|
+
case 3:
|
|
922
|
+
error = _state.sent();
|
|
923
|
+
commandLog.error("Failed to save errors: ".concat(error.message));
|
|
924
|
+
return [
|
|
925
|
+
3,
|
|
926
|
+
4
|
|
927
|
+
];
|
|
928
|
+
case 4:
|
|
929
|
+
return [
|
|
930
|
+
2
|
|
931
|
+
];
|
|
932
|
+
}
|
|
933
|
+
});
|
|
934
|
+
});
|
|
935
|
+
return _saveErrorListToStorage.apply(this, arguments);
|
|
936
|
+
}
|
|
937
|
+
function getStoredErrorLists() {
|
|
938
|
+
return _getStoredErrorLists.apply(this, arguments);
|
|
939
|
+
}
|
|
940
|
+
function _getStoredErrorLists() {
|
|
941
|
+
_getStoredErrorLists = _async_to_generator(function() {
|
|
942
|
+
var keys, errorKeys, allErrors, error;
|
|
943
|
+
return _ts_generator(this, function(_state) {
|
|
944
|
+
switch(_state.label){
|
|
945
|
+
case 0:
|
|
946
|
+
_state.trys.push([
|
|
947
|
+
0,
|
|
948
|
+
3,
|
|
949
|
+
,
|
|
950
|
+
4
|
|
951
|
+
]);
|
|
952
|
+
return [
|
|
953
|
+
4,
|
|
954
|
+
storageServer.keys()
|
|
955
|
+
];
|
|
956
|
+
case 1:
|
|
957
|
+
keys = _state.sent();
|
|
958
|
+
errorKeys = Array.isArray(keys) ? keys.filter(function(key) {
|
|
959
|
+
var _key_startsWith;
|
|
960
|
+
return key === null || key === void 0 ? void 0 : (_key_startsWith = key.startsWith) === null || _key_startsWith === void 0 ? void 0 : _key_startsWith.call(key, "error_list:");
|
|
961
|
+
}) : [];
|
|
962
|
+
return [
|
|
963
|
+
4,
|
|
964
|
+
Promise.all(errorKeys.map(/*#__PURE__*/ function() {
|
|
965
|
+
var _ref = _async_to_generator(function(key) {
|
|
966
|
+
var entry;
|
|
967
|
+
return _ts_generator(this, function(_state) {
|
|
968
|
+
switch(_state.label){
|
|
969
|
+
case 0:
|
|
970
|
+
return [
|
|
971
|
+
4,
|
|
972
|
+
storageServer.get(key)
|
|
973
|
+
];
|
|
974
|
+
case 1:
|
|
975
|
+
entry = _state.sent();
|
|
976
|
+
return [
|
|
977
|
+
2,
|
|
978
|
+
(entry === null || entry === void 0 ? void 0 : entry.errors) || []
|
|
979
|
+
];
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
});
|
|
983
|
+
return function(key) {
|
|
984
|
+
return _ref.apply(this, arguments);
|
|
985
|
+
};
|
|
986
|
+
}()))
|
|
987
|
+
];
|
|
988
|
+
case 2:
|
|
989
|
+
allErrors = _state.sent();
|
|
990
|
+
return [
|
|
991
|
+
2,
|
|
992
|
+
allErrors.flat()
|
|
993
|
+
];
|
|
994
|
+
case 3:
|
|
995
|
+
error = _state.sent();
|
|
996
|
+
commandLog.error("Failed to retrieve stored errors: ".concat(error.message));
|
|
997
|
+
return [
|
|
998
|
+
2,
|
|
999
|
+
[]
|
|
1000
|
+
];
|
|
1001
|
+
case 4:
|
|
1002
|
+
return [
|
|
1003
|
+
2
|
|
1004
|
+
];
|
|
1005
|
+
}
|
|
1006
|
+
});
|
|
1007
|
+
});
|
|
1008
|
+
return _getStoredErrorLists.apply(this, arguments);
|
|
1009
|
+
}
|
|
1010
|
+
function clearAllErrorLists() {
|
|
1011
|
+
return _clearAllErrorLists.apply(this, arguments);
|
|
1012
|
+
}
|
|
1013
|
+
function _clearAllErrorLists() {
|
|
1014
|
+
_clearAllErrorLists = _async_to_generator(function() {
|
|
1015
|
+
var keys, errorKeys, error;
|
|
1016
|
+
return _ts_generator(this, function(_state) {
|
|
1017
|
+
switch(_state.label){
|
|
1018
|
+
case 0:
|
|
1019
|
+
_state.trys.push([
|
|
1020
|
+
0,
|
|
1021
|
+
3,
|
|
1022
|
+
,
|
|
1023
|
+
4
|
|
1024
|
+
]);
|
|
1025
|
+
return [
|
|
1026
|
+
4,
|
|
1027
|
+
storageServer.keys()
|
|
1028
|
+
];
|
|
1029
|
+
case 1:
|
|
1030
|
+
keys = _state.sent();
|
|
1031
|
+
errorKeys = Array.isArray(keys) ? keys.filter(function(key) {
|
|
1032
|
+
var _key_startsWith;
|
|
1033
|
+
return key === null || key === void 0 ? void 0 : (_key_startsWith = key.startsWith) === null || _key_startsWith === void 0 ? void 0 : _key_startsWith.call(key, "error_list:");
|
|
1034
|
+
}) : [];
|
|
1035
|
+
return [
|
|
1036
|
+
4,
|
|
1037
|
+
Promise.all(errorKeys.map(function(key) {
|
|
1038
|
+
return storageServer.remove(key);
|
|
1039
|
+
}))
|
|
1040
|
+
];
|
|
1041
|
+
case 2:
|
|
1042
|
+
_state.sent();
|
|
1043
|
+
return [
|
|
1044
|
+
3,
|
|
1045
|
+
4
|
|
1046
|
+
];
|
|
1047
|
+
case 3:
|
|
1048
|
+
error = _state.sent();
|
|
1049
|
+
commandLog.error("Failed to clear error lists: ".concat(error.message));
|
|
1050
|
+
return [
|
|
1051
|
+
3,
|
|
1052
|
+
4
|
|
1053
|
+
];
|
|
1054
|
+
case 4:
|
|
1055
|
+
return [
|
|
1056
|
+
2
|
|
1057
|
+
];
|
|
1058
|
+
}
|
|
1059
|
+
});
|
|
1060
|
+
});
|
|
1061
|
+
return _clearAllErrorLists.apply(this, arguments);
|
|
1062
|
+
}
|
|
1063
|
+
function parseTextErrors(output) {
|
|
1064
|
+
var errorList = [];
|
|
1065
|
+
var unmatchedLines = [];
|
|
1066
|
+
var lastFilePath = "";
|
|
1067
|
+
var eslintErrorDetailsRegex = /^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/;
|
|
1068
|
+
var tsRegex = /^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/;
|
|
1069
|
+
var commitlintRegex = /^✖\s+(.*?)\s+\[(.*?)\]$/;
|
|
1070
|
+
output.split("\n").forEach(function(line) {
|
|
1071
|
+
if (line.startsWith("/")) {
|
|
1072
|
+
lastFilePath = line.trim();
|
|
1073
|
+
} else {
|
|
1074
|
+
var eslintMatch = eslintErrorDetailsRegex.exec(line) || [];
|
|
1075
|
+
var tsMatch = tsRegex.exec(line) || [];
|
|
1076
|
+
var commitlintMatch = commitlintRegex.exec(line) || [];
|
|
1077
|
+
if (eslintMatch.length && lastFilePath) {
|
|
1078
|
+
errorList.push({
|
|
1079
|
+
file: lastFilePath,
|
|
1080
|
+
position: "".concat(eslintMatch[1], ":").concat(eslintMatch[2]),
|
|
1081
|
+
type: eslintMatch[3] === "error" /* Error */ ? "error" /* Error */ : "warning" /* Warning */ ,
|
|
1082
|
+
message: eslintMatch[4].trim(),
|
|
1083
|
+
rule: eslintMatch[5].trim()
|
|
1084
|
+
});
|
|
1085
|
+
} else if (tsMatch.length) {
|
|
1086
|
+
errorList.push({
|
|
1087
|
+
file: tsMatch[1],
|
|
1088
|
+
position: "".concat(tsMatch[2], ":").concat(tsMatch[3]),
|
|
1089
|
+
type: tsMatch[4] === "error" /* Error */ ? "error" /* Error */ : "warning" /* Warning */ ,
|
|
1090
|
+
message: tsMatch[5].trim()
|
|
1091
|
+
});
|
|
1092
|
+
} else if (commitlintMatch.length) {
|
|
1093
|
+
errorList.push({
|
|
1094
|
+
file: "commitlint",
|
|
1095
|
+
type: "error" /* Error */ ,
|
|
1096
|
+
message: commitlintMatch[1].trim(),
|
|
1097
|
+
rule: commitlintMatch[2].trim()
|
|
1098
|
+
});
|
|
1099
|
+
} else {
|
|
1100
|
+
unmatchedLines.push(line.trim());
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
});
|
|
1104
|
+
if (errorList.length) {
|
|
1105
|
+
saveErrorListToStorage(errorList);
|
|
1106
|
+
}
|
|
1107
|
+
if (unmatchedLines.length && DEBUG) {
|
|
1108
|
+
commandLog.warning("Unmatched lines:");
|
|
1109
|
+
unmatchedLines.forEach(function(line) {
|
|
1110
|
+
return console.log(" ".concat(line));
|
|
1111
|
+
});
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
function parseCommandOutput(output) {
|
|
1115
|
+
try {
|
|
1116
|
+
var results = JSON.parse(output);
|
|
1117
|
+
var errorList = [];
|
|
1118
|
+
results.forEach(function(param) {
|
|
1119
|
+
var filePath = param.filePath, messages = param.messages;
|
|
1120
|
+
messages.forEach(function(param) {
|
|
1121
|
+
var severity = param.severity, line = param.line, column = param.column, ruleId = param.ruleId, message = param.message;
|
|
1122
|
+
errorList.push({
|
|
1123
|
+
type: severity === 2 ? "error" /* Error */ : "warning" /* Warning */ ,
|
|
1124
|
+
file: filePath,
|
|
1125
|
+
position: "".concat(line, ":").concat(column),
|
|
1126
|
+
rule: ruleId,
|
|
1127
|
+
message: message
|
|
1128
|
+
});
|
|
1129
|
+
});
|
|
1130
|
+
});
|
|
1131
|
+
if (errorList.length) {
|
|
1132
|
+
saveErrorListToStorage(errorList);
|
|
1133
|
+
}
|
|
1134
|
+
} catch (e) {
|
|
1135
|
+
parseTextErrors(output);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
function executeCommand(command) {
|
|
1139
|
+
return _executeCommand.apply(this, arguments);
|
|
1140
|
+
}
|
|
1141
|
+
function _executeCommand() {
|
|
1142
|
+
_executeCommand = _async_to_generator(function(command) {
|
|
1143
|
+
var parser, controller, _ref, stdout, stderr, error, stdout1, stderr1, message;
|
|
1144
|
+
var _arguments = arguments;
|
|
1145
|
+
return _ts_generator(this, function(_state) {
|
|
1146
|
+
switch(_state.label){
|
|
1147
|
+
case 0:
|
|
1148
|
+
parser = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : parseCommandOutput;
|
|
1149
|
+
controller = new AbortController();
|
|
1150
|
+
process3.on("SIGINT", function() {
|
|
1151
|
+
commandLog.warning("Process interrupted. Terminating...");
|
|
1152
|
+
controller.abort();
|
|
1153
|
+
process3.exit();
|
|
1154
|
+
});
|
|
1155
|
+
_state.label = 1;
|
|
1156
|
+
case 1:
|
|
1157
|
+
_state.trys.push([
|
|
1158
|
+
1,
|
|
1159
|
+
3,
|
|
1160
|
+
,
|
|
1161
|
+
4
|
|
1162
|
+
]);
|
|
1163
|
+
return [
|
|
1164
|
+
4,
|
|
1165
|
+
execPromise(command, {
|
|
1166
|
+
maxBuffer: 1024 * 1024 * 100,
|
|
1167
|
+
signal: controller.signal
|
|
1168
|
+
})
|
|
1169
|
+
];
|
|
1170
|
+
case 2:
|
|
1171
|
+
_ref = _state.sent(), stdout = _ref.stdout, stderr = _ref.stderr;
|
|
1172
|
+
[
|
|
1173
|
+
stdout,
|
|
1174
|
+
stderr
|
|
1175
|
+
].forEach(function(output) {
|
|
1176
|
+
return output && parser(output);
|
|
1177
|
+
});
|
|
1178
|
+
return [
|
|
1179
|
+
3,
|
|
1180
|
+
4
|
|
1181
|
+
];
|
|
1182
|
+
case 3:
|
|
1183
|
+
error = _state.sent();
|
|
1184
|
+
stdout1 = error.stdout, stderr1 = error.stderr, message = error.message;
|
|
1185
|
+
[
|
|
1186
|
+
stdout1,
|
|
1187
|
+
stderr1
|
|
1188
|
+
].forEach(function(output) {
|
|
1189
|
+
return output && parser(output);
|
|
1190
|
+
});
|
|
1191
|
+
if (!stderr1 && !stdout1) {
|
|
1192
|
+
commandLog.error("Command failed: ".concat(message));
|
|
1193
|
+
}
|
|
1194
|
+
return [
|
|
1195
|
+
3,
|
|
1196
|
+
4
|
|
1197
|
+
];
|
|
1198
|
+
case 4:
|
|
1199
|
+
return [
|
|
1200
|
+
2
|
|
1201
|
+
];
|
|
1202
|
+
}
|
|
1203
|
+
});
|
|
1204
|
+
});
|
|
1205
|
+
return _executeCommand.apply(this, arguments);
|
|
1206
|
+
}
|
|
1207
|
+
var commandFormatter = {
|
|
1208
|
+
raw: function(cmd) {
|
|
1209
|
+
return {
|
|
1210
|
+
raw: true,
|
|
1211
|
+
cmd: cmd
|
|
1212
|
+
};
|
|
1213
|
+
},
|
|
1214
|
+
isRaw: function isRaw(cmd) {
|
|
1215
|
+
return (typeof cmd === "undefined" ? "undefined" : _type_of(cmd)) === "object" && cmd !== null && cmd.raw === true;
|
|
1216
|
+
},
|
|
1217
|
+
format: function format(command, context) {
|
|
1218
|
+
if (typeof command === "function") {
|
|
1219
|
+
return commandFormatter.formatCLI(command(context), context);
|
|
1220
|
+
}
|
|
1221
|
+
if (commandFormatter.isRaw(command)) {
|
|
1222
|
+
return command.cmd;
|
|
1223
|
+
}
|
|
1224
|
+
return commandFormatter.formatCLI(command, context);
|
|
1225
|
+
},
|
|
1226
|
+
formatCLI: function formatCLI(command, context) {
|
|
1227
|
+
if (context === null || context === void 0 ? void 0 : context.isRemote) {
|
|
1228
|
+
return "".concat(PNPM_DLX_CLI, " ").concat(CYBERSKILL_PACKAGE_NAME, " ").concat(command);
|
|
1229
|
+
}
|
|
1230
|
+
if (context === null || context === void 0 ? void 0 : context.isCurrentProject) {
|
|
1231
|
+
return "".concat(PNPM_EXEC_CLI, " ").concat(TSX_CLI, " src/cli.ts ").concat(command);
|
|
1232
|
+
}
|
|
1233
|
+
return "".concat(PNPM_EXEC_CLI, " ").concat(CYBERSKILL_CLI, " ").concat(command);
|
|
1234
|
+
}
|
|
1235
|
+
};
|
|
1236
|
+
function resolveCommands(input) {
|
|
1237
|
+
return _resolveCommands.apply(this, arguments);
|
|
1238
|
+
}
|
|
1239
|
+
function _resolveCommands() {
|
|
1240
|
+
_resolveCommands = _async_to_generator(function(input) {
|
|
1241
|
+
var context, _context_isRemote, isRemote, isCurrentProject, _tmp, ctx, commands;
|
|
1242
|
+
var _arguments = arguments;
|
|
1243
|
+
return _ts_generator(this, function(_state) {
|
|
1244
|
+
switch(_state.label){
|
|
1245
|
+
case 0:
|
|
1246
|
+
context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
|
|
1247
|
+
isRemote = (_context_isRemote = context === null || context === void 0 ? void 0 : context.isRemote) !== null && _context_isRemote !== void 0 ? _context_isRemote : false;
|
|
1248
|
+
if (!isRemote) return [
|
|
1249
|
+
3,
|
|
1250
|
+
1
|
|
1251
|
+
];
|
|
1252
|
+
_tmp = false;
|
|
1253
|
+
return [
|
|
1254
|
+
3,
|
|
1255
|
+
3
|
|
1256
|
+
];
|
|
1257
|
+
case 1:
|
|
1258
|
+
return [
|
|
1259
|
+
4,
|
|
1260
|
+
checkPackage(CYBERSKILL_PACKAGE_NAME)
|
|
1261
|
+
];
|
|
1262
|
+
case 2:
|
|
1263
|
+
_tmp = _state.sent().isCurrentProject;
|
|
1264
|
+
_state.label = 3;
|
|
1265
|
+
case 3:
|
|
1266
|
+
isCurrentProject = _tmp;
|
|
1267
|
+
ctx = {
|
|
1268
|
+
isRemote: isRemote,
|
|
1269
|
+
isCurrentProject: isCurrentProject
|
|
1270
|
+
};
|
|
1271
|
+
commands = typeof input === "function" ? input(ctx) : input;
|
|
1272
|
+
return [
|
|
1273
|
+
2,
|
|
1274
|
+
Object.fromEntries(Object.entries(commands).map(function(param) {
|
|
1275
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], cmd = _param[1];
|
|
1276
|
+
return [
|
|
1277
|
+
key,
|
|
1278
|
+
commandFormatter.format(cmd, ctx)
|
|
1279
|
+
];
|
|
1280
|
+
}))
|
|
1281
|
+
];
|
|
1282
|
+
}
|
|
1283
|
+
});
|
|
1284
|
+
});
|
|
1285
|
+
return _resolveCommands.apply(this, arguments);
|
|
1286
|
+
}
|
|
1287
|
+
export { clearAllErrorLists, commandFormatter, commandLog, executeCommand, getStoredErrorLists, resolveCommands, saveErrorListToStorage };
|