@cyberskill/shared 1.50.0 → 1.52.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 (147) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +100 -129
  2. package/dist/_tsup-dts-rollup.d.ts +100 -129
  3. package/dist/cli.cjs +1 -2146
  4. package/dist/cli.d.cts +1 -2
  5. package/dist/cli.d.ts +1 -2
  6. package/dist/cli.js +1 -2066
  7. package/dist/configs/commitlint/base.cjs +1 -64
  8. package/dist/configs/commitlint/base.js +1 -7
  9. package/dist/configs/eslint/base.cjs +1 -121
  10. package/dist/configs/eslint/base.js +1 -52
  11. package/dist/configs/eslint/nestjs.cjs +1 -155
  12. package/dist/configs/eslint/nestjs.js +1 -85
  13. package/dist/configs/eslint/nextjs.cjs +1 -155
  14. package/dist/configs/eslint/nextjs.js +1 -85
  15. package/dist/configs/eslint/nodejs.cjs +1 -156
  16. package/dist/configs/eslint/nodejs.js +1 -86
  17. package/dist/configs/eslint/vite-react.cjs +1 -159
  18. package/dist/configs/eslint/vite-react.js +1 -89
  19. package/dist/configs/graphql/graphql-codegen.cjs +1 -125
  20. package/dist/configs/graphql/graphql-codegen.js +1 -64
  21. package/dist/configs/graphql/index.cjs +1 -126
  22. package/dist/configs/graphql/index.js +1 -64
  23. package/dist/configs/i18n/react/i18next.cjs +1 -80
  24. package/dist/configs/i18n/react/i18next.js +1 -7
  25. package/dist/configs/i18n/react/index.cjs +1 -81
  26. package/dist/configs/i18n/react/index.js +1 -7
  27. package/dist/configs/index.cjs +1 -232
  28. package/dist/configs/index.js +1 -166
  29. package/dist/configs/lint-staged/base.cjs +1 -64
  30. package/dist/configs/lint-staged/base.js +1 -7
  31. package/dist/configs/vitest/react/e2e.cjs +1 -128
  32. package/dist/configs/vitest/react/e2e.js +1 -59
  33. package/dist/configs/vitest/react/unit.cjs +1 -305
  34. package/dist/configs/vitest/react/unit.js +1 -228
  35. package/dist/configs/vitest/react/unit.setup.cjs +1 -60
  36. package/dist/configs/vitest/react/unit.setup.js +1 -8
  37. package/dist/constants/index.cjs +1 -677
  38. package/dist/constants/index.d.cts +8 -3
  39. package/dist/constants/index.d.ts +8 -3
  40. package/dist/constants/index.js +1 -468
  41. package/dist/constants/path.cjs +1 -422
  42. package/dist/constants/path.d.cts +8 -3
  43. package/dist/constants/path.d.ts +8 -3
  44. package/dist/constants/path.js +1 -217
  45. package/dist/constants/response-status.cjs +1 -313
  46. package/dist/constants/response-status.js +1 -252
  47. package/dist/index.cjs +1 -4559
  48. package/dist/index.d.cts +13 -8
  49. package/dist/index.d.ts +13 -8
  50. package/dist/index.js +1 -4142
  51. package/dist/nodejs/index.cjs +1 -2138
  52. package/dist/nodejs/index.js +1 -2054
  53. package/dist/nodejs/mongo.cjs +1 -2137
  54. package/dist/nodejs/mongo.js +1 -2054
  55. package/dist/react/apollo-client.cjs +1 -177
  56. package/dist/react/apollo-client.js +1 -116
  57. package/dist/react/index.cjs +1 -990
  58. package/dist/react/index.js +1 -876
  59. package/dist/react/loading.cjs +1 -301
  60. package/dist/react/loading.js +1 -216
  61. package/dist/react/next-intl.cjs +1 -744
  62. package/dist/react/next-intl.js +1 -655
  63. package/dist/react/storage.cjs +1 -631
  64. package/dist/react/storage.js +1 -558
  65. package/dist/typescript/api-response.cjs +1 -48
  66. package/dist/typescript/apollo.cjs +1 -48
  67. package/dist/typescript/command.cjs +1 -68
  68. package/dist/typescript/command.d.cts +3 -0
  69. package/dist/typescript/command.d.ts +3 -0
  70. package/dist/typescript/command.js +1 -7
  71. package/dist/typescript/config.cjs +1 -48
  72. package/dist/typescript/fs.cjs +1 -48
  73. package/dist/typescript/graphql-codegen.cjs +1 -48
  74. package/dist/typescript/index.cjs +1 -175
  75. package/dist/typescript/index.d.cts +3 -0
  76. package/dist/typescript/index.d.ts +3 -0
  77. package/dist/typescript/index.js +1 -151
  78. package/dist/typescript/loading.cjs +1 -48
  79. package/dist/typescript/log.cjs +1 -48
  80. package/dist/typescript/mongo.cjs +1 -164
  81. package/dist/typescript/mongo.js +1 -145
  82. package/dist/typescript/next-intl.cjs +1 -48
  83. package/dist/typescript/react.cjs +1 -48
  84. package/dist/typescript/serializer.cjs +1 -48
  85. package/dist/typescript/string.cjs +1 -48
  86. package/dist/utils/command.cjs +1 -1387
  87. package/dist/utils/command.d.cts +2 -2
  88. package/dist/utils/command.d.ts +2 -2
  89. package/dist/utils/command.js +1 -1287
  90. package/dist/utils/common.cjs +1 -300
  91. package/dist/utils/common.js +1 -219
  92. package/dist/utils/config.cjs +1 -146
  93. package/dist/utils/config.js +1 -89
  94. package/dist/utils/fs.cjs +1 -132
  95. package/dist/utils/fs.js +1 -47
  96. package/dist/utils/index-nodejs.cjs +1 -1752
  97. package/dist/utils/index-nodejs.d.cts +2 -5
  98. package/dist/utils/index-nodejs.d.ts +2 -5
  99. package/dist/utils/index-nodejs.js +1 -1581
  100. package/dist/utils/index.cjs +1 -727
  101. package/dist/utils/index.js +1 -625
  102. package/dist/utils/log.cjs +1 -330
  103. package/dist/utils/log.js +1 -269
  104. package/dist/utils/package.cjs +1 -941
  105. package/dist/utils/package.js +1 -857
  106. package/dist/utils/path.cjs +1 -291
  107. package/dist/utils/path.d.cts +0 -3
  108. package/dist/utils/path.d.ts +0 -3
  109. package/dist/utils/path.js +1 -191
  110. package/dist/utils/serializer.cjs +1 -91
  111. package/dist/utils/serializer.js +1 -30
  112. package/dist/utils/storage-client.cjs +1 -349
  113. package/dist/utils/storage-client.js +1 -276
  114. package/dist/utils/storage-server.cjs +1 -636
  115. package/dist/utils/storage-server.js +1 -550
  116. package/dist/utils/string.cjs +1 -152
  117. package/dist/utils/string.js +1 -75
  118. package/dist/utils/validate.cjs +1 -90
  119. package/dist/utils/validate.js +1 -33
  120. package/package.json +15 -13
  121. /package/{src/public → public}/favicon/android-icon-144x144.png +0 -0
  122. /package/{src/public → public}/favicon/android-icon-192x192.png +0 -0
  123. /package/{src/public → public}/favicon/android-icon-36x36.png +0 -0
  124. /package/{src/public → public}/favicon/android-icon-48x48.png +0 -0
  125. /package/{src/public → public}/favicon/android-icon-72x72.png +0 -0
  126. /package/{src/public → public}/favicon/android-icon-96x96.png +0 -0
  127. /package/{src/public → public}/favicon/apple-icon-114x114.png +0 -0
  128. /package/{src/public → public}/favicon/apple-icon-120x120.png +0 -0
  129. /package/{src/public → public}/favicon/apple-icon-144x144.png +0 -0
  130. /package/{src/public → public}/favicon/apple-icon-152x152.png +0 -0
  131. /package/{src/public → public}/favicon/apple-icon-180x180.png +0 -0
  132. /package/{src/public → public}/favicon/apple-icon-57x57.png +0 -0
  133. /package/{src/public → public}/favicon/apple-icon-60x60.png +0 -0
  134. /package/{src/public → public}/favicon/apple-icon-72x72.png +0 -0
  135. /package/{src/public → public}/favicon/apple-icon-76x76.png +0 -0
  136. /package/{src/public → public}/favicon/apple-icon-precomposed.png +0 -0
  137. /package/{src/public → public}/favicon/apple-icon.png +0 -0
  138. /package/{src/public → public}/favicon/browserconfig.xml +0 -0
  139. /package/{src/public → public}/favicon/favicon-16x16.png +0 -0
  140. /package/{src/public → public}/favicon/favicon-32x32.png +0 -0
  141. /package/{src/public → public}/favicon/favicon-96x96.png +0 -0
  142. /package/{src/public → public}/favicon/favicon.ico +0 -0
  143. /package/{src/public → public}/favicon/manifest.json +0 -0
  144. /package/{src/public → public}/favicon/ms-icon-144x144.png +0 -0
  145. /package/{src/public → public}/favicon/ms-icon-150x150.png +0 -0
  146. /package/{src/public → public}/favicon/ms-icon-310x310.png +0 -0
  147. /package/{src/public → public}/favicon/ms-icon-70x70.png +0 -0
@@ -1,89 +1 @@
1
- // src/utils/config.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_without_holes(arr) {
8
- if (Array.isArray(arr)) return _array_like_to_array(arr);
9
- }
10
- function _define_property(obj, key, value) {
11
- if (key in obj) {
12
- Object.defineProperty(obj, key, {
13
- value: value,
14
- enumerable: true,
15
- configurable: true,
16
- writable: true
17
- });
18
- } else {
19
- obj[key] = value;
20
- }
21
- return obj;
22
- }
23
- function _iterable_to_array(iter) {
24
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
25
- }
26
- function _non_iterable_spread() {
27
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
28
- }
29
- function _object_spread(target) {
30
- for(var i = 1; i < arguments.length; i++){
31
- var source = arguments[i] != null ? arguments[i] : {};
32
- var ownKeys = Object.keys(source);
33
- if (typeof Object.getOwnPropertySymbols === "function") {
34
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
35
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
36
- }));
37
- }
38
- ownKeys.forEach(function(key) {
39
- _define_property(target, key, source[key]);
40
- });
41
- }
42
- return target;
43
- }
44
- function _to_consumable_array(arr) {
45
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
46
- }
47
- function _type_of(obj) {
48
- "@swc/helpers - typeof";
49
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
50
- }
51
- function _unsupported_iterable_to_array(o, minLen) {
52
- if (!o) return;
53
- if (typeof o === "string") return _array_like_to_array(o, minLen);
54
- var n = Object.prototype.toString.call(o).slice(8, -1);
55
- if (n === "Object" && o.constructor) n = o.constructor.name;
56
- if (n === "Map" || n === "Set") return Array.from(n);
57
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
58
- }
59
- function deepMerge() {
60
- for(var _len = arguments.length, configs = new Array(_len), _key = 0; _key < _len; _key++){
61
- configs[_key] = arguments[_key];
62
- }
63
- var merge = function(target, source) {
64
- var result = _object_spread({}, target);
65
- Object.keys(source).forEach(function(key) {
66
- if (!Object.hasOwnProperty.call(source, key)) {
67
- return;
68
- }
69
- var sourceValue = source[key];
70
- var targetValue = result[key];
71
- if (Array.isArray(sourceValue)) {
72
- result[key] = _to_consumable_array(/* @__PURE__ */ new Set(_to_consumable_array(Array.isArray(targetValue) ? targetValue : []).concat(_to_consumable_array(sourceValue))));
73
- } else if ((typeof sourceValue === "undefined" ? "undefined" : _type_of(sourceValue)) === "object" && sourceValue !== null && !Array.isArray(sourceValue)) {
74
- result[key] = merge((typeof targetValue === "undefined" ? "undefined" : _type_of(targetValue)) === "object" && targetValue !== null && !Array.isArray(targetValue) ? targetValue : {}, sourceValue);
75
- } else {
76
- result[key] = sourceValue;
77
- }
78
- });
79
- return result;
80
- };
81
- return configs.flatMap(function(config) {
82
- return Array.isArray(config) ? config : [
83
- config
84
- ];
85
- }).reduce(function(acc, config) {
86
- return merge(acc, config);
87
- }, {});
88
- }
89
- export { deepMerge };
1
+ function r(r,e){if(e==null||e>r.length)e=r.length;for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function e(e){if(Array.isArray(e))return r(e)}function t(r,e,t){if(e in r){Object.defineProperty(r,e,{value:t,enumerable:true,configurable:true,writable:true})}else{r[e]=t}return r}function n(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function o(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};var o=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){o=o.concat(Object.getOwnPropertySymbols(n).filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))}o.forEach(function(e){t(r,e,n[e])})}return r}function a(r){return e(r)||n(r)||f(r)||o()}function i(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function f(e,t){if(!e)return;if(typeof e==="string")return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}function c(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++){e[t]=arguments[t]}var n=function(r,e){var t=u({},r);return Object.keys(e).forEach(function(r){if(!Object.hasOwnProperty.call(e,r))return;var o=e[r],u=t[r];Array.isArray(o)?t[r]=a(new Set(a(Array.isArray(u)?u:[]).concat(a(o)))):(typeof o==="undefined"?"undefined":i(o))=="object"&&o!==null&&!Array.isArray(o)?t[r]=n((typeof u==="undefined"?"undefined":i(u))=="object"&&u!==null&&!Array.isArray(u)?u:{},o):t[r]=o}),t};return e.flatMap(function(r){return Array.isArray(r)?r:[r]}).reduce(function(r,e){return n(r,e)},{})}export{c as deepMerge};
package/dist/utils/fs.cjs CHANGED
@@ -1,132 +1 @@
1
- "use strict";
2
- function _type_of(obj) {
3
- "@swc/helpers - typeof";
4
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
5
- }
6
- var __create = Object.create;
7
- var __defProp = Object.defineProperty;
8
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
- var __getOwnPropNames = Object.getOwnPropertyNames;
10
- var __getProtoOf = Object.getPrototypeOf;
11
- var __hasOwnProp = Object.prototype.hasOwnProperty;
12
- var __export = function(target, all) {
13
- for(var name in all)__defProp(target, name, {
14
- get: all[name],
15
- enumerable: true
16
- });
17
- };
18
- var __copyProps = function(to, from, except, desc) {
19
- if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
20
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
21
- try {
22
- var _loop = function() {
23
- var key = _step.value;
24
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
25
- get: function() {
26
- return from[key];
27
- },
28
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
29
- });
30
- };
31
- for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
32
- } catch (err) {
33
- _didIteratorError = true;
34
- _iteratorError = err;
35
- } finally{
36
- try {
37
- if (!_iteratorNormalCompletion && _iterator.return != null) {
38
- _iterator.return();
39
- }
40
- } finally{
41
- if (_didIteratorError) {
42
- throw _iteratorError;
43
- }
44
- }
45
- }
46
- }
47
- return to;
48
- };
49
- var __toESM = function(mod, isNodeMode, target) {
50
- return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
51
- // file that has been converted to a CommonJS file using a Babel-
52
- // compatible transform (i.e. "__esModule" has not been set), then set
53
- // "default" to the CommonJS "module.exports" for node compatibility.
54
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
55
- value: mod,
56
- enumerable: true
57
- }) : target, mod);
58
- };
59
- var __toCommonJS = function(mod) {
60
- return __copyProps(__defProp({}, "__esModule", {
61
- value: true
62
- }), mod);
63
- };
64
- // src/utils/fs.ts
65
- var fs_exports = {};
66
- __export(fs_exports, {
67
- appendFileSync: function() {
68
- return appendFileSync2;
69
- },
70
- existsSync: function() {
71
- return existsSync2;
72
- },
73
- readFileSync: function() {
74
- return readFileSync2;
75
- },
76
- rmSync: function() {
77
- return rmSync2;
78
- },
79
- writeFileSync: function() {
80
- return writeFileSync2;
81
- }
82
- });
83
- module.exports = __toCommonJS(fs_exports);
84
- var fs = __toESM(require("fs"), 1);
85
- var existsSync2 = function(filePath) {
86
- return fs.existsSync(filePath);
87
- };
88
- function readFileSync2(filePath, options) {
89
- var content = fs.readFileSync(filePath, "utf-8");
90
- if (options === null || options === void 0 ? void 0 : options.asJson) {
91
- try {
92
- var parsed = JSON.parse(content);
93
- if ((typeof parsed === "undefined" ? "undefined" : _type_of(parsed)) === "object" && parsed !== null) {
94
- return parsed;
95
- }
96
- throw new Error("Parsed JSON is not an object or array");
97
- } catch (e) {
98
- throw new Error("Failed to parse JSON from file: ".concat(filePath));
99
- }
100
- }
101
- return content;
102
- }
103
- function writeFileSync2(filePath, data) {
104
- var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
105
- var _options_isJson = options.isJson, isJson = _options_isJson === void 0 ? false : _options_isJson;
106
- var content = isJson && (typeof data === "undefined" ? "undefined" : _type_of(data)) === "object" ? JSON.stringify(data, null, 4) : String(data);
107
- fs.writeFileSync(filePath, content, "utf-8");
108
- }
109
- function appendFileSync2(filePath, data) {
110
- var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
111
- var _options_isJson = options.isJson, isJson = _options_isJson === void 0 ? false : _options_isJson;
112
- var content = isJson && (typeof data === "undefined" ? "undefined" : _type_of(data)) === "object" ? JSON.stringify(data, null, 4) : String(data);
113
- fs.appendFileSync(filePath, content, "utf-8");
114
- }
115
- function rmSync2(filePaths) {
116
- filePaths.forEach(function(filePath) {
117
- if (existsSync2(filePath)) {
118
- fs.rmSync(filePath, {
119
- recursive: true,
120
- force: true
121
- });
122
- }
123
- });
124
- }
125
- // Annotate the CommonJS export names for ESM import in node:
126
- 0 && (module.exports = {
127
- appendFileSync: appendFileSync,
128
- existsSync: existsSync,
129
- readFileSync: readFileSync,
130
- rmSync: rmSync,
131
- writeFileSync: writeFileSync
132
- });
1
+ "use strict";function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var n=Object.create;var r=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var o=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var c=function(e,n){for(var t in n)r(e,t,{get:n[t],enumerable:!0})},f=function(n,o,c,f){var a=true,l=false,y=undefined;if(o&&(typeof o==="undefined"?"undefined":e(o))=="object"||typeof o=="function")try{var d=function(){var e=v.value;!u.call(n,e)&&e!==c&&r(n,e,{get:function(){return o[e]},enumerable:!(f=t(o,e))||f.enumerable})};for(var s=i(o)[Symbol.iterator](),v;!(a=(v=s.next()).done);a=true)d()}catch(e){l=true;y=e}finally{try{if(!a&&s.return!=null){s.return()}}finally{if(l){throw y}}}return n};var a=function(e,t,i){return i=e!=null?n(o(e)):{},f(t||!e||!e.__esModule?r(i,"default",{value:e,enumerable:!0}):i,e)},l=function(e){return f(r({},"__esModule",{value:!0}),e)};var y={};c(y,{appendFileSync:function(){return p},existsSync:function(){return s},readFileSync:function(){return v},rmSync:function(){return b},writeFileSync:function(){return S}});module.exports=l(y);var d=a(require("fs"),1),s=function(e){return d.existsSync(e)};function v(n,r){var t=d.readFileSync(n,"utf-8");if(r===null||r===void 0?void 0:r.asJson)try{var i=JSON.parse(t);if((typeof i==="undefined"?"undefined":e(i))=="object"&&i!==null)return i;throw new Error("Parsed JSON is not an object or array")}catch(e){throw new Error("Failed to parse JSON from file: ".concat(n))}return t}function S(n,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var i=t.isJson,o=i===void 0?!1:i,u=o&&(typeof r==="undefined"?"undefined":e(r))=="object"?JSON.stringify(r,null,4):String(r);d.writeFileSync(n,u,"utf-8")}function p(n,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var i=t.isJson,o=i===void 0?!1:i,u=o&&(typeof r==="undefined"?"undefined":e(r))=="object"?JSON.stringify(r,null,4):String(r);d.appendFileSync(n,u,"utf-8")}function b(e){e.forEach(function(e){s(e)&&d.rmSync(e,{recursive:!0,force:!0})})}0&&(module.exports={appendFileSync:appendFileSync,existsSync:existsSync,readFileSync:readFileSync,rmSync:rmSync,writeFileSync:writeFileSync});
package/dist/utils/fs.js CHANGED
@@ -1,47 +1 @@
1
- // src/utils/fs.ts
2
- function _type_of(obj) {
3
- "@swc/helpers - typeof";
4
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
5
- }
6
- import * as fs from "node:fs";
7
- var existsSync2 = function(filePath) {
8
- return fs.existsSync(filePath);
9
- };
10
- function readFileSync2(filePath, options) {
11
- var content = fs.readFileSync(filePath, "utf-8");
12
- if (options === null || options === void 0 ? void 0 : options.asJson) {
13
- try {
14
- var parsed = JSON.parse(content);
15
- if ((typeof parsed === "undefined" ? "undefined" : _type_of(parsed)) === "object" && parsed !== null) {
16
- return parsed;
17
- }
18
- throw new Error("Parsed JSON is not an object or array");
19
- } catch (e) {
20
- throw new Error("Failed to parse JSON from file: ".concat(filePath));
21
- }
22
- }
23
- return content;
24
- }
25
- function writeFileSync2(filePath, data) {
26
- var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
27
- var _options_isJson = options.isJson, isJson = _options_isJson === void 0 ? false : _options_isJson;
28
- var content = isJson && (typeof data === "undefined" ? "undefined" : _type_of(data)) === "object" ? JSON.stringify(data, null, 4) : String(data);
29
- fs.writeFileSync(filePath, content, "utf-8");
30
- }
31
- function appendFileSync2(filePath, data) {
32
- var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
33
- var _options_isJson = options.isJson, isJson = _options_isJson === void 0 ? false : _options_isJson;
34
- var content = isJson && (typeof data === "undefined" ? "undefined" : _type_of(data)) === "object" ? JSON.stringify(data, null, 4) : String(data);
35
- fs.appendFileSync(filePath, content, "utf-8");
36
- }
37
- function rmSync2(filePaths) {
38
- filePaths.forEach(function(filePath) {
39
- if (existsSync2(filePath)) {
40
- fs.rmSync(filePath, {
41
- recursive: true,
42
- force: true
43
- });
44
- }
45
- });
46
- }
47
- export { appendFileSync2 as appendFileSync, existsSync2 as existsSync, readFileSync2 as readFileSync, rmSync2 as rmSync, writeFileSync2 as writeFileSync };
1
+ function n(n){"@swc/helpers - typeof";return n&&typeof Symbol!=="undefined"&&n.constructor===Symbol?"symbol":typeof n}import*as e from"node:fs";var r=function(n){return e.existsSync(n)};function i(r,i){var o=e.readFileSync(r,"utf-8");if(i===null||i===void 0?void 0:i.asJson)try{var t=JSON.parse(o);if((typeof t==="undefined"?"undefined":n(t))=="object"&&t!==null)return t;throw new Error("Parsed JSON is not an object or array")}catch(n){throw new Error("Failed to parse JSON from file: ".concat(r))}return o}function o(r,i){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var t=o.isJson,f=t===void 0?!1:t,c=f&&(typeof i==="undefined"?"undefined":n(i))=="object"?JSON.stringify(i,null,4):String(i);e.writeFileSync(r,c,"utf-8")}function t(r,i){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var t=o.isJson,f=t===void 0?!1:t,c=f&&(typeof i==="undefined"?"undefined":n(i))=="object"?JSON.stringify(i,null,4):String(i);e.appendFileSync(r,c,"utf-8")}function f(n){n.forEach(function(n){r(n)&&e.rmSync(n,{recursive:!0,force:!0})})}export{t as appendFileSync,r as existsSync,i as readFileSync,f as rmSync,o as writeFileSync};