@cyberskill/shared 1.46.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.
Files changed (134) hide show
  1. package/README.md +12 -18
  2. package/dist/_tsup-dts-rollup.d.cts +413 -31
  3. package/dist/_tsup-dts-rollup.d.ts +413 -31
  4. package/dist/cli.cjs +2136 -1
  5. package/dist/cli.d.cts +2 -1
  6. package/dist/cli.d.ts +2 -1
  7. package/dist/cli.js +2056 -1
  8. package/dist/configs/commitlint/base.cjs +64 -1
  9. package/dist/configs/commitlint/base.js +7 -1
  10. package/dist/configs/eslint/base.cjs +121 -1
  11. package/dist/configs/eslint/base.js +52 -1
  12. package/dist/configs/eslint/nestjs.cjs +155 -1
  13. package/dist/configs/eslint/nestjs.js +85 -1
  14. package/dist/configs/eslint/nextjs.cjs +155 -1
  15. package/dist/configs/eslint/nextjs.js +85 -1
  16. package/dist/configs/eslint/nodejs.cjs +156 -1
  17. package/dist/configs/eslint/nodejs.js +86 -1
  18. package/dist/configs/eslint/vite-react.cjs +159 -1
  19. package/dist/configs/eslint/vite-react.js +89 -1
  20. package/dist/configs/graphql/graphql-codegen.cjs +125 -1
  21. package/dist/configs/graphql/graphql-codegen.js +64 -1
  22. package/dist/configs/graphql/index.cjs +126 -1
  23. package/dist/configs/graphql/index.js +64 -1
  24. package/dist/configs/i18n/react/i18next.cjs +80 -1
  25. package/dist/configs/i18n/react/i18next.js +7 -1
  26. package/dist/configs/i18n/react/index.cjs +81 -1
  27. package/dist/configs/i18n/react/index.js +7 -1
  28. package/dist/configs/index.cjs +232 -1
  29. package/dist/configs/index.js +166 -1
  30. package/dist/configs/lint-staged/base.cjs +64 -1
  31. package/dist/configs/lint-staged/base.js +7 -1
  32. package/dist/configs/vitest/react/e2e.cjs +128 -1
  33. package/dist/configs/vitest/react/e2e.js +59 -1
  34. package/dist/configs/vitest/react/unit.cjs +305 -1
  35. package/dist/configs/vitest/react/unit.js +228 -1
  36. package/dist/configs/vitest/react/unit.setup.cjs +60 -1
  37. package/dist/configs/vitest/react/unit.setup.js +8 -1
  38. package/dist/constants/index.cjs +678 -1
  39. package/dist/constants/index.d.cts +31 -1
  40. package/dist/constants/index.d.ts +31 -1
  41. package/dist/constants/index.js +469 -1
  42. package/dist/constants/path.cjs +423 -1
  43. package/dist/constants/path.d.cts +31 -1
  44. package/dist/constants/path.d.ts +31 -1
  45. package/dist/constants/path.js +218 -1
  46. package/dist/constants/response-status.cjs +313 -1
  47. package/dist/constants/response-status.js +252 -1
  48. package/dist/index.cjs +4546 -1
  49. package/dist/index.d.cts +51 -6
  50. package/dist/index.d.ts +51 -6
  51. package/dist/index.js +4133 -1
  52. package/dist/nodejs/index.cjs +2138 -1
  53. package/dist/nodejs/index.js +2054 -1
  54. package/dist/nodejs/mongo.cjs +2137 -1
  55. package/dist/nodejs/mongo.js +2054 -1
  56. package/dist/react/apollo-client.cjs +177 -1
  57. package/dist/react/apollo-client.js +116 -1
  58. package/dist/react/index.cjs +990 -1
  59. package/dist/react/index.js +876 -1
  60. package/dist/react/loading.cjs +301 -1
  61. package/dist/react/loading.js +216 -1
  62. package/dist/react/next-intl.cjs +744 -1
  63. package/dist/react/next-intl.js +655 -1
  64. package/dist/react/storage.cjs +631 -1
  65. package/dist/react/storage.js +558 -1
  66. package/dist/typescript/api-response.cjs +48 -1
  67. package/dist/typescript/apollo.cjs +48 -1
  68. package/dist/typescript/command.cjs +68 -1
  69. package/dist/typescript/command.d.cts +4 -0
  70. package/dist/typescript/command.d.ts +4 -0
  71. package/dist/typescript/command.js +7 -1
  72. package/dist/typescript/config.cjs +48 -1
  73. package/dist/typescript/fs.cjs +48 -0
  74. package/dist/typescript/fs.d.cts +1 -0
  75. package/dist/typescript/fs.d.ts +1 -0
  76. package/dist/typescript/fs.js +0 -0
  77. package/dist/typescript/graphql-codegen.cjs +48 -1
  78. package/dist/typescript/index.cjs +175 -1
  79. package/dist/typescript/index.d.cts +5 -0
  80. package/dist/typescript/index.d.ts +5 -0
  81. package/dist/typescript/index.js +151 -1
  82. package/dist/typescript/loading.cjs +48 -1
  83. package/dist/typescript/log.cjs +48 -1
  84. package/dist/typescript/mongo.cjs +164 -1
  85. package/dist/typescript/mongo.js +145 -1
  86. package/dist/typescript/next-intl.cjs +48 -1
  87. package/dist/typescript/react.cjs +48 -1
  88. package/dist/typescript/serializer.cjs +48 -1
  89. package/dist/typescript/string.cjs +48 -1
  90. package/dist/utils/command.cjs +1387 -1
  91. package/dist/utils/command.d.cts +2 -0
  92. package/dist/utils/command.d.ts +2 -0
  93. package/dist/utils/command.js +1287 -1
  94. package/dist/utils/common.cjs +300 -1
  95. package/dist/utils/common.js +219 -1
  96. package/dist/utils/config.cjs +146 -1
  97. package/dist/utils/config.js +89 -1
  98. package/dist/utils/fs.cjs +118 -1
  99. package/dist/utils/fs.d.cts +4 -1
  100. package/dist/utils/fs.d.ts +4 -1
  101. package/dist/utils/fs.js +37 -1
  102. package/dist/utils/index-nodejs.cjs +1738 -1
  103. package/dist/utils/index-nodejs.d.cts +15 -5
  104. package/dist/utils/index-nodejs.d.ts +15 -5
  105. package/dist/utils/index-nodejs.js +1571 -1
  106. package/dist/utils/index.cjs +727 -1
  107. package/dist/utils/index.js +625 -1
  108. package/dist/utils/log.cjs +330 -1
  109. package/dist/utils/log.js +269 -1
  110. package/dist/utils/package.cjs +941 -0
  111. package/dist/utils/package.d.cts +3 -0
  112. package/dist/utils/package.d.ts +3 -0
  113. package/dist/utils/package.js +857 -0
  114. package/dist/utils/path.cjs +291 -0
  115. package/dist/utils/path.d.cts +6 -0
  116. package/dist/utils/path.d.ts +6 -0
  117. package/dist/utils/path.js +191 -0
  118. package/dist/utils/serializer.cjs +91 -1
  119. package/dist/utils/serializer.js +30 -1
  120. package/dist/utils/storage-client.cjs +349 -1
  121. package/dist/utils/storage-client.js +276 -1
  122. package/dist/utils/storage-server.cjs +636 -1
  123. package/dist/utils/storage-server.d.cts +1 -1
  124. package/dist/utils/storage-server.d.ts +1 -1
  125. package/dist/utils/storage-server.js +550 -1
  126. package/dist/utils/string.cjs +152 -1
  127. package/dist/utils/string.js +75 -1
  128. package/dist/utils/validate.cjs +90 -1
  129. package/dist/utils/validate.js +33 -1
  130. package/package.json +19 -16
  131. package/dist/utils/npm-package.cjs +0 -1
  132. package/dist/utils/npm-package.d.cts +0 -4
  133. package/dist/utils/npm-package.d.ts +0 -4
  134. package/dist/utils/npm-package.js +0 -1
@@ -1 +1,636 @@
1
- "use strict";function e(e,r,t,n,o,u,a){try{var s=e[u](a);var i=s.value}catch(e){t(e);return}if(s.done){r(i)}else{Promise.resolve(i).then(n,o)}}function r(r){return function(){var t=this,n=arguments;return new Promise(function(o,u){var a=r.apply(t,n);function s(r){e(a,o,u,s,i,"next",r)}function i(r){e(a,o,u,s,i,"throw",r)}s(undefined)})}}function t(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function n(e,r){var t,n,o,u,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return u={next:s(0),"throw":s(1),"return":s(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(e){return function(r){return i([e,r])}}function i(u){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,n&&(o=u[0]&2?n["return"]:u[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;if(n=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:a.label++;return{value:u[1],done:false};case 5:a.label++;n=u[1];u=[0];continue;case 7:u=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){a=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(u[0]===6&&a.label<o[1]){a.label=o[1];o=u;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(u);break}if(o[2])a.ops.pop();a.trys.pop();continue}u=r.call(e,a)}catch(e){u=[6,e];n=0}finally{t=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}var o=Object.create;var u=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var i=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var l=function(e,r){for(var t in r)u(e,t,{get:r[t],enumerable:!0})},f=function(e,r,n,o){var i=true,l=false,f=undefined;if(r&&(typeof r==="undefined"?"undefined":t(r))=="object"||typeof r=="function")try{var y=function(){var t=v.value;!c.call(e,t)&&t!==n&&u(e,t,{get:function(){return r[t]},enumerable:!(o=a(r,t))||o.enumerable})};for(var p=s(r)[Symbol.iterator](),v;!(i=(v=p.next()).done);i=true)y()}catch(e){l=true;f=e}finally{try{if(!i&&p.return!=null){p.return()}}finally{if(l){throw f}}}return e};var y=function(e,r,t){return t=e!=null?o(i(e)):{},f(r||!e||!e.__esModule?u(t,"default",{value:e,enumerable:!0}):t,e)},p=function(e){return f(u({},"__esModule",{value:!0}),e)};var v={};l(v,{initNodePersist:function(){return w},storageDir:function(){return m},storageServer:function(){return S}});module.exports=p(v);var g=y(require("node-persist"),1),d=y(require("os"),1),h=y(require("path"),1),b=y(require("process"),1),m=b.default.env.CYBERSKILL_STORAGE_DIR||h.default.join(d.default.homedir(),".cyberskill-storage");function w(){return k.apply(this,arguments)}function k(){k=r(function(){var e;return n(this,function(r){switch(r.label){case 0:e=g.default.defaultInstance;if(e)return[3,2];return[4,g.default.init({dir:m,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=r.sent();r.label=2;case 2:e;return[2]}})});return k.apply(this,arguments)}var S={get:function e(e){return r(function(){var r,t;return n(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,w()];case 1:n.sent();return[4,g.default.getItem(e)];case 2:return[2,(r=n.sent())!==null&&r!==void 0?r:null];case 3:t=n.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 4:return[2]}})})()},set:function e(e,t){return r(function(){var r;return n(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,w()];case 1:n.sent();return[4,g.default.setItem(e,t)];case 2:n.sent();return[3,4];case 3:r=n.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},remove:function e(e){return r(function(){var r;return n(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,w()];case 1:t.sent();return[4,g.default.removeItem(e)];case 2:t.sent();return[3,4];case 3:r=t.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},keys:function e(){return r(function(){var e,r;return n(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,w()];case 1:t.sent();return[4,g.default.keys()];case 2:e=t.sent();return[2,Array.isArray(e)?e:(console.warn("⚠️ [Storage:keys] Invalid keys response:",e),[])];case 3:r=t.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",r),[])];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return n(this,function(r){try{return[2,"".concat(m," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};0&&(module.exports={initNodePersist:initNodePersist,storageDir:storageDir,storageServer:storageServer});
1
+ "use strict";
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_without_holes(arr) {
8
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
9
+ }
10
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
11
+ try {
12
+ var info = gen[key](arg);
13
+ var value = info.value;
14
+ } catch (error) {
15
+ reject(error);
16
+ return;
17
+ }
18
+ if (info.done) {
19
+ resolve(value);
20
+ } else {
21
+ Promise.resolve(value).then(_next, _throw);
22
+ }
23
+ }
24
+ function _async_to_generator(fn) {
25
+ return function() {
26
+ var self = this, args = arguments;
27
+ return new Promise(function(resolve, reject) {
28
+ var gen = fn.apply(self, args);
29
+ function _next(value) {
30
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
31
+ }
32
+ function _throw(err) {
33
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
34
+ }
35
+ _next(undefined);
36
+ });
37
+ };
38
+ }
39
+ function _iterable_to_array(iter) {
40
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
41
+ }
42
+ function _non_iterable_spread() {
43
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
44
+ }
45
+ function _to_consumable_array(arr) {
46
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
47
+ }
48
+ function _type_of(obj) {
49
+ "@swc/helpers - typeof";
50
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
51
+ }
52
+ function _unsupported_iterable_to_array(o, minLen) {
53
+ if (!o) return;
54
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
55
+ var n = Object.prototype.toString.call(o).slice(8, -1);
56
+ if (n === "Object" && o.constructor) n = o.constructor.name;
57
+ if (n === "Map" || n === "Set") return Array.from(n);
58
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
59
+ }
60
+ function _ts_generator(thisArg, body) {
61
+ var f, y, t, g, _ = {
62
+ label: 0,
63
+ sent: function() {
64
+ if (t[0] & 1) throw t[1];
65
+ return t[1];
66
+ },
67
+ trys: [],
68
+ ops: []
69
+ };
70
+ return g = {
71
+ next: verb(0),
72
+ "throw": verb(1),
73
+ "return": verb(2)
74
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
75
+ return this;
76
+ }), g;
77
+ function verb(n) {
78
+ return function(v) {
79
+ return step([
80
+ n,
81
+ v
82
+ ]);
83
+ };
84
+ }
85
+ function step(op) {
86
+ if (f) throw new TypeError("Generator is already executing.");
87
+ while(_)try {
88
+ 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;
89
+ if (y = 0, t) op = [
90
+ op[0] & 2,
91
+ t.value
92
+ ];
93
+ switch(op[0]){
94
+ case 0:
95
+ case 1:
96
+ t = op;
97
+ break;
98
+ case 4:
99
+ _.label++;
100
+ return {
101
+ value: op[1],
102
+ done: false
103
+ };
104
+ case 5:
105
+ _.label++;
106
+ y = op[1];
107
+ op = [
108
+ 0
109
+ ];
110
+ continue;
111
+ case 7:
112
+ op = _.ops.pop();
113
+ _.trys.pop();
114
+ continue;
115
+ default:
116
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
117
+ _ = 0;
118
+ continue;
119
+ }
120
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
121
+ _.label = op[1];
122
+ break;
123
+ }
124
+ if (op[0] === 6 && _.label < t[1]) {
125
+ _.label = t[1];
126
+ t = op;
127
+ break;
128
+ }
129
+ if (t && _.label < t[2]) {
130
+ _.label = t[2];
131
+ _.ops.push(op);
132
+ break;
133
+ }
134
+ if (t[2]) _.ops.pop();
135
+ _.trys.pop();
136
+ continue;
137
+ }
138
+ op = body.call(thisArg, _);
139
+ } catch (e) {
140
+ op = [
141
+ 6,
142
+ e
143
+ ];
144
+ y = 0;
145
+ } finally{
146
+ f = t = 0;
147
+ }
148
+ if (op[0] & 5) throw op[1];
149
+ return {
150
+ value: op[0] ? op[1] : void 0,
151
+ done: true
152
+ };
153
+ }
154
+ }
155
+ var __create = Object.create;
156
+ var __defProp = Object.defineProperty;
157
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
158
+ var __getOwnPropNames = Object.getOwnPropertyNames;
159
+ var __getProtoOf = Object.getPrototypeOf;
160
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
161
+ var __export = function(target, all) {
162
+ for(var name in all)__defProp(target, name, {
163
+ get: all[name],
164
+ enumerable: true
165
+ });
166
+ };
167
+ var __copyProps = function(to, from, except, desc) {
168
+ if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
169
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
170
+ try {
171
+ var _loop = function() {
172
+ var key = _step.value;
173
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
174
+ get: function() {
175
+ return from[key];
176
+ },
177
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
178
+ });
179
+ };
180
+ for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
181
+ } catch (err) {
182
+ _didIteratorError = true;
183
+ _iteratorError = err;
184
+ } finally{
185
+ try {
186
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
187
+ _iterator.return();
188
+ }
189
+ } finally{
190
+ if (_didIteratorError) {
191
+ throw _iteratorError;
192
+ }
193
+ }
194
+ }
195
+ }
196
+ return to;
197
+ };
198
+ var __toESM = function(mod, isNodeMode, target) {
199
+ return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
200
+ // file that has been converted to a CommonJS file using a Babel-
201
+ // compatible transform (i.e. "__esModule" has not been set), then set
202
+ // "default" to the CommonJS "module.exports" for node compatibility.
203
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
204
+ value: mod,
205
+ enumerable: true
206
+ }) : target, mod);
207
+ };
208
+ var __toCommonJS = function(mod) {
209
+ return __copyProps(__defProp({}, "__esModule", {
210
+ value: true
211
+ }), mod);
212
+ };
213
+ // src/utils/storage-server.ts
214
+ var storage_server_exports = {};
215
+ __export(storage_server_exports, {
216
+ getStorageDir: function() {
217
+ return getStorageDir;
218
+ },
219
+ initNodePersist: function() {
220
+ return initNodePersist;
221
+ },
222
+ storageServer: function() {
223
+ return storageServer;
224
+ }
225
+ });
226
+ module.exports = __toCommonJS(storage_server_exports);
227
+ // node_modules/.pnpm/tsup@8.4.0_@microsoft+api-extractor@7.52.2_@types+node@22.13.15__@swc+core@1.11.16_@swc_2cf618e3551c9a9c667a9bb2a289f06e/node_modules/tsup/assets/cjs_shims.js
228
+ var getImportMetaUrl = function() {
229
+ return typeof document === "undefined" ? new URL("file:".concat(__filename)).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
230
+ };
231
+ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
232
+ // src/utils/storage-server.ts
233
+ var import_node_persist = __toESM(require("node-persist"), 1);
234
+ var import_node_os = __toESM(require("os"), 1);
235
+ var import_node_path = __toESM(require("path"), 1);
236
+ var import_node_process3 = __toESM(require("process"), 1);
237
+ // src/constants/path.ts
238
+ var import_node_process2 = __toESM(require("process"), 1);
239
+ var import_node_url = require("url");
240
+ // src/utils/command.ts
241
+ var import_boxen = __toESM(require("boxen"), 1);
242
+ var import_chalk = __toESM(require("chalk"), 1);
243
+ var import_node_child_process = require("child_process");
244
+ var import_node_process = __toESM(require("process"), 1);
245
+ var util = __toESM(require("util"), 1);
246
+ // src/utils/package.ts
247
+ var import_node_fetch = __toESM(require("node-fetch"), 1);
248
+ // src/utils/fs.ts
249
+ var fs = __toESM(require("fs"), 1);
250
+ // src/utils/path.ts
251
+ var import_node_module = require("module");
252
+ var path = __toESM(require("path"), 1);
253
+ function resolveCyberSkillPath() {
254
+ for(var _len = arguments.length, urls = new Array(_len), _key = 0; _key < _len; _key++){
255
+ urls[_key] = arguments[_key];
256
+ }
257
+ var _path;
258
+ return (_path = path).resolve.apply(_path, [
259
+ CYBERSKILL_DIRECTORY
260
+ ].concat(_to_consumable_array(urls)));
261
+ }
262
+ function resolveWorkingPath() {
263
+ for(var _len = arguments.length, urls = new Array(_len), _key = 0; _key < _len; _key++){
264
+ urls[_key] = arguments[_key];
265
+ }
266
+ var _path;
267
+ return (_path = path).resolve.apply(_path, [
268
+ WORKING_DIRECTORY
269
+ ].concat(_to_consumable_array(urls)));
270
+ }
271
+ function resolve2() {
272
+ for(var _len = arguments.length, urls = new Array(_len), _key = 0; _key < _len; _key++){
273
+ urls[_key] = arguments[_key];
274
+ }
275
+ var _path;
276
+ return (_path = path).resolve.apply(_path, _to_consumable_array(urls));
277
+ }
278
+ function dirname2(url) {
279
+ return path.dirname(url);
280
+ }
281
+ // src/utils/package.ts
282
+ var CACHE_EXPIRATION_MS = 24 * 60 * 60 * 1e3;
283
+ // src/utils/command.ts
284
+ var DEBUG = import_node_process.default.env.DEBUG === "true";
285
+ var execPromise = util.promisify(import_node_child_process.exec);
286
+ var _import_chalk_default = import_chalk.default, gray = _import_chalk_default.gray, blue = _import_chalk_default.blue;
287
+ var commandFormatter = {
288
+ raw: function(cmd) {
289
+ return {
290
+ raw: true,
291
+ cmd: cmd
292
+ };
293
+ },
294
+ isRaw: function isRaw(cmd) {
295
+ return (typeof cmd === "undefined" ? "undefined" : _type_of(cmd)) === "object" && cmd !== null && cmd.raw === true;
296
+ },
297
+ format: function format(command, context) {
298
+ if (typeof command === "function") {
299
+ return commandFormatter.formatCLI(command(context), context);
300
+ }
301
+ if (commandFormatter.isRaw(command)) {
302
+ return command.cmd;
303
+ }
304
+ return commandFormatter.formatCLI(command, context);
305
+ },
306
+ formatCLI: function formatCLI(command, context) {
307
+ if (context === null || context === void 0 ? void 0 : context.isRemote) {
308
+ return "".concat(PNPM_DLX_CLI, " ").concat(CYBERSKILL_PACKAGE_NAME, " ").concat(command);
309
+ }
310
+ if (context === null || context === void 0 ? void 0 : context.isCurrentProject) {
311
+ return "".concat(PNPM_EXEC_CLI, " ").concat(TSX_CLI, " src/cli.ts ").concat(command);
312
+ }
313
+ return "".concat(PNPM_EXEC_CLI, " ").concat(CYBERSKILL_CLI, " ").concat(command);
314
+ }
315
+ };
316
+ // src/constants/path.ts
317
+ var __filename2 = (0, import_node_url.fileURLToPath)(importMetaUrl);
318
+ var __dirname = dirname2(__filename2);
319
+ var CYBERSKILL_DIRECTORY = resolve2(__dirname, "../../");
320
+ var WORKING_DIRECTORY = import_node_process2.default.env.INIT_CWD || import_node_process2.default.cwd();
321
+ var CYBERSKILL_PACKAGE_NAME = "@cyberskill/shared";
322
+ var CYBERSKILL_STORAGE = ".cyberskill-storage";
323
+ var NODE_MODULES = "node_modules";
324
+ var BUILD_DIRECTORY = "dist";
325
+ var PACKAGE_JSON = "package.json";
326
+ var PACKAGE_LOCK_JSON = "package-lock.json";
327
+ var TSCONFIG_JSON = "tsconfig.json";
328
+ var GIT_IGNORE = ".gitignore";
329
+ var SIMPLE_GIT_HOOK_JSON = ".simple-git-hooks.json";
330
+ var PNPM_LOCK_YAML = "pnpm-lock.yaml";
331
+ var GIT_HOOK = ".git/hooks";
332
+ var GIT_COMMIT_EDITMSG = ".git/COMMIT_EDITMSG";
333
+ var CYBERSKILL_CLI = "cyberskill";
334
+ var ESLINT_CLI = "eslint";
335
+ var VITEST_CLI = "vitest";
336
+ var COMMIT_LINT_CLI = "commitlint";
337
+ var LINT_STAGED_CLI = "lint-staged";
338
+ var RIMRAF_CLI = "rimraf";
339
+ var TSC_CLI = "tsc";
340
+ var TSX_CLI = "tsx";
341
+ var GIT_CLI = "git";
342
+ var PNPM_CLI = "pnpm";
343
+ var PNPM_DLX_CLI = "pnpm dlx";
344
+ var PNPM_EXEC_CLI = "pnpm exec";
345
+ var SIMPLE_GIT_HOOK_CLI = "simple-git-hooks";
346
+ var ESLINT_INSPECT_CLI = "@eslint/config-inspector";
347
+ var NODE_MODULES_INSPECT_CLI = "node_modules-inspect";
348
+ var PATH = {
349
+ CYBERSKILL_DIRECTORY: CYBERSKILL_DIRECTORY,
350
+ WORKING_DIRECTORY: WORKING_DIRECTORY,
351
+ TS_CONFIG: resolveWorkingPath(TSCONFIG_JSON),
352
+ GIT_IGNORE: resolveWorkingPath(GIT_IGNORE),
353
+ GIT_HOOK: resolveWorkingPath(GIT_HOOK),
354
+ GIT_COMMIT_MSG: resolveWorkingPath(GIT_COMMIT_EDITMSG),
355
+ SIMPLE_GIT_HOOKS: resolveWorkingPath(SIMPLE_GIT_HOOK_JSON),
356
+ PACKAGE_JSON: resolveWorkingPath(PACKAGE_JSON),
357
+ PACKAGE_LOCK_JSON: resolveWorkingPath(PACKAGE_LOCK_JSON),
358
+ PNPM_LOCK_YAML: resolveWorkingPath(PNPM_LOCK_YAML),
359
+ NODE_MODULES: resolveWorkingPath(NODE_MODULES),
360
+ CYBERSKILL: {
361
+ LINT_STAGED_CONFIG: resolveCyberSkillPath("./configs/lint-staged/base.js"),
362
+ COMMITLINT_CONFIG: resolveCyberSkillPath("./configs/commitlint/base.js"),
363
+ UNIT_TEST_CONFIG: resolveCyberSkillPath("./configs/vitest/react/unit.js"),
364
+ E2E_TEST_CONFIG: resolveCyberSkillPath("./configs/vitest/react/e2e.js")
365
+ }
366
+ };
367
+ var COMMAND = {
368
+ SIMPLE_GIT_HOOKS: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(SIMPLE_GIT_HOOK_CLI)),
369
+ ESLINT_INSPECT: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(ESLINT_INSPECT_CLI)),
370
+ NODE_MODULES_INSPECT: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(NODE_MODULES_INSPECT_CLI)),
371
+ RESET: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(RIMRAF_CLI, " ").concat(NODE_MODULES, " ").concat(PNPM_LOCK_YAML)),
372
+ ESLINT_CHECK: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(ESLINT_CLI, " ").concat(PATH.WORKING_DIRECTORY)),
373
+ ESLINT_FIX: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(ESLINT_CLI, " ").concat(PATH.WORKING_DIRECTORY, " --fix")),
374
+ TYPESCRIPT_CHECK: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(TSC_CLI, " -p ").concat(PATH.TS_CONFIG, " --noEmit")),
375
+ CYBERSKILL: {
376
+ TEST_UNIT: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(VITEST_CLI, " --config ").concat(PATH.CYBERSKILL.UNIT_TEST_CONFIG)),
377
+ TEST_E2E: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(VITEST_CLI, " --config ").concat(PATH.CYBERSKILL.E2E_TEST_CONFIG)),
378
+ COMMIT_LINT: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(COMMIT_LINT_CLI, " --edit ").concat(PATH.GIT_COMMIT_MSG, " --config ").concat(PATH.CYBERSKILL.COMMITLINT_CONFIG)),
379
+ LINT_STAGED: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(LINT_STAGED_CLI, " --config ").concat(PATH.CYBERSKILL.LINT_STAGED_CONFIG))
380
+ },
381
+ CONFIGURE_GIT_HOOK: commandFormatter.raw("".concat(GIT_CLI, " config core.hooksPath ").concat(PATH.GIT_HOOK)),
382
+ BUILD: commandFormatter.raw("".concat(PNPM_CLI, " run build")),
383
+ STAGE_BUILD_DIRECTORY: commandFormatter.raw("".concat(GIT_CLI, " add ").concat(BUILD_DIRECTORY)),
384
+ PNPM_INSTALL_STANDARD: commandFormatter.raw("".concat(PNPM_CLI, " install")),
385
+ PNPM_INSTALL_LEGACY: commandFormatter.raw("".concat(PNPM_CLI, " install --legacy-peer-deps")),
386
+ PNPM_INSTALL_FORCE: commandFormatter.raw("".concat(PNPM_CLI, " install --force"))
387
+ };
388
+ // src/utils/storage-server.ts
389
+ function getStorageDir() {
390
+ return import_node_process3.default.env.CYBERSKILL_STORAGE_DIR || import_node_path.default.join(import_node_os.default.homedir(), CYBERSKILL_STORAGE);
391
+ }
392
+ function initNodePersist() {
393
+ return _initNodePersist.apply(this, arguments);
394
+ }
395
+ function _initNodePersist() {
396
+ _initNodePersist = _async_to_generator(function() {
397
+ return _ts_generator(this, function(_state) {
398
+ switch(_state.label){
399
+ case 0:
400
+ if (!!import_node_persist.default.defaultInstance) return [
401
+ 3,
402
+ 2
403
+ ];
404
+ return [
405
+ 4,
406
+ import_node_persist.default.init({
407
+ dir: getStorageDir(),
408
+ stringify: JSON.stringify,
409
+ parse: JSON.parse,
410
+ encoding: "utf8",
411
+ logging: false,
412
+ forgiveParseErrors: true
413
+ })
414
+ ];
415
+ case 1:
416
+ _state.sent();
417
+ _state.label = 2;
418
+ case 2:
419
+ return [
420
+ 2
421
+ ];
422
+ }
423
+ });
424
+ });
425
+ return _initNodePersist.apply(this, arguments);
426
+ }
427
+ var storageServer = {
428
+ get: function get(key) {
429
+ return _async_to_generator(function() {
430
+ var result, error;
431
+ return _ts_generator(this, function(_state) {
432
+ switch(_state.label){
433
+ case 0:
434
+ _state.trys.push([
435
+ 0,
436
+ 3,
437
+ ,
438
+ 4
439
+ ]);
440
+ return [
441
+ 4,
442
+ initNodePersist()
443
+ ];
444
+ case 1:
445
+ _state.sent();
446
+ return [
447
+ 4,
448
+ import_node_persist.default.getItem(key)
449
+ ];
450
+ case 2:
451
+ result = _state.sent();
452
+ return [
453
+ 2,
454
+ result !== null && result !== void 0 ? result : null
455
+ ];
456
+ case 3:
457
+ error = _state.sent();
458
+ console.error('❌ [Storage:get] Error getting key "'.concat(key, '":'), error);
459
+ return [
460
+ 2,
461
+ null
462
+ ];
463
+ case 4:
464
+ return [
465
+ 2
466
+ ];
467
+ }
468
+ });
469
+ })();
470
+ },
471
+ set: function set(key, value) {
472
+ return _async_to_generator(function() {
473
+ var error;
474
+ return _ts_generator(this, function(_state) {
475
+ switch(_state.label){
476
+ case 0:
477
+ _state.trys.push([
478
+ 0,
479
+ 3,
480
+ ,
481
+ 4
482
+ ]);
483
+ return [
484
+ 4,
485
+ initNodePersist()
486
+ ];
487
+ case 1:
488
+ _state.sent();
489
+ return [
490
+ 4,
491
+ import_node_persist.default.setItem(key, value)
492
+ ];
493
+ case 2:
494
+ _state.sent();
495
+ return [
496
+ 3,
497
+ 4
498
+ ];
499
+ case 3:
500
+ error = _state.sent();
501
+ console.error('❌ [Storage:set] Error setting key "'.concat(key, '":'), error);
502
+ return [
503
+ 3,
504
+ 4
505
+ ];
506
+ case 4:
507
+ return [
508
+ 2
509
+ ];
510
+ }
511
+ });
512
+ })();
513
+ },
514
+ remove: function remove(key) {
515
+ return _async_to_generator(function() {
516
+ var error;
517
+ return _ts_generator(this, function(_state) {
518
+ switch(_state.label){
519
+ case 0:
520
+ _state.trys.push([
521
+ 0,
522
+ 3,
523
+ ,
524
+ 4
525
+ ]);
526
+ return [
527
+ 4,
528
+ initNodePersist()
529
+ ];
530
+ case 1:
531
+ _state.sent();
532
+ return [
533
+ 4,
534
+ import_node_persist.default.removeItem(key)
535
+ ];
536
+ case 2:
537
+ _state.sent();
538
+ return [
539
+ 3,
540
+ 4
541
+ ];
542
+ case 3:
543
+ error = _state.sent();
544
+ console.error('❌ [Storage:remove] Error removing key "'.concat(key, '":'), error);
545
+ return [
546
+ 3,
547
+ 4
548
+ ];
549
+ case 4:
550
+ return [
551
+ 2
552
+ ];
553
+ }
554
+ });
555
+ })();
556
+ },
557
+ keys: function keys() {
558
+ return _async_to_generator(function() {
559
+ var keys, error;
560
+ return _ts_generator(this, function(_state) {
561
+ switch(_state.label){
562
+ case 0:
563
+ _state.trys.push([
564
+ 0,
565
+ 3,
566
+ ,
567
+ 4
568
+ ]);
569
+ return [
570
+ 4,
571
+ initNodePersist()
572
+ ];
573
+ case 1:
574
+ _state.sent();
575
+ return [
576
+ 4,
577
+ import_node_persist.default.keys()
578
+ ];
579
+ case 2:
580
+ keys = _state.sent();
581
+ if (!Array.isArray(keys)) {
582
+ console.warn("⚠️ [Storage:keys] Invalid keys response:", keys);
583
+ return [
584
+ 2,
585
+ []
586
+ ];
587
+ }
588
+ return [
589
+ 2,
590
+ keys
591
+ ];
592
+ case 3:
593
+ error = _state.sent();
594
+ console.error("❌ [Storage:keys] Error getting keys:", error);
595
+ return [
596
+ 2,
597
+ []
598
+ ];
599
+ case 4:
600
+ return [
601
+ 2
602
+ ];
603
+ }
604
+ });
605
+ })();
606
+ },
607
+ getLogLink: function getLogLink(key) {
608
+ return _async_to_generator(function() {
609
+ var storagePath;
610
+ return _ts_generator(this, function(_state) {
611
+ try {
612
+ storagePath = getStorageDir();
613
+ return [
614
+ 2,
615
+ "".concat(storagePath, " (key: ").concat(key, ")")
616
+ ];
617
+ } catch (error) {
618
+ console.error("❌ [Storage:getLogLink] Error getting log link:", error);
619
+ return [
620
+ 2,
621
+ null
622
+ ];
623
+ }
624
+ return [
625
+ 2
626
+ ];
627
+ });
628
+ })();
629
+ }
630
+ };
631
+ // Annotate the CommonJS export names for ESM import in node:
632
+ 0 && (module.exports = {
633
+ getStorageDir: getStorageDir,
634
+ initNodePersist: initNodePersist,
635
+ storageServer: storageServer
636
+ });
@@ -1,3 +1,3 @@
1
+ export { getStorageDir_alias_2 as getStorageDir } from '../_tsup-dts-rollup.cjs';
1
2
  export { initNodePersist_alias_2 as initNodePersist } from '../_tsup-dts-rollup.cjs';
2
- export { storageDir_alias_2 as storageDir } from '../_tsup-dts-rollup.cjs';
3
3
  export { storageServer_alias_2 as storageServer } from '../_tsup-dts-rollup.cjs';
@@ -1,3 +1,3 @@
1
+ export { getStorageDir_alias_2 as getStorageDir } from '../_tsup-dts-rollup.js';
1
2
  export { initNodePersist_alias_2 as initNodePersist } from '../_tsup-dts-rollup.js';
2
- export { storageDir_alias_2 as storageDir } from '../_tsup-dts-rollup.js';
3
3
  export { storageServer_alias_2 as storageServer } from '../_tsup-dts-rollup.js';