@rsdoctor/cli 1.2.4-beta.0 → 1.2.4-beta.1

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/utils.js DELETED
@@ -1,105 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.n = (module)=>{
5
- var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
- __webpack_require__.d(getter, {
7
- a: getter
8
- });
9
- return getter;
10
- };
11
- })();
12
- (()=>{
13
- __webpack_require__.d = (exports1, definition)=>{
14
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
- enumerable: true,
16
- get: definition[key]
17
- });
18
- };
19
- })();
20
- (()=>{
21
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
- })();
23
- (()=>{
24
- __webpack_require__.r = (exports1)=>{
25
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
- value: 'Module'
27
- });
28
- Object.defineProperty(exports1, '__esModule', {
29
- value: true
30
- });
31
- };
32
- })();
33
- var __webpack_exports__ = {};
34
- __webpack_require__.r(__webpack_exports__);
35
- __webpack_require__.d(__webpack_exports__, {
36
- enhanceCommand: ()=>enhanceCommand,
37
- readFile: ()=>readFile,
38
- fetchText: ()=>fetchText,
39
- loadJSON: ()=>loadJSON,
40
- loadShardingFileWithSpinner: ()=>loadShardingFileWithSpinner,
41
- loadShardingFile: ()=>loadShardingFile
42
- });
43
- const external_axios_namespaceObject = require("axios");
44
- var external_axios_default = /*#__PURE__*/ __webpack_require__.n(external_axios_namespaceObject);
45
- const external_path_namespaceObject = require("path");
46
- var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
47
- const external_node_fs_namespaceObject = require("node:fs");
48
- var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
49
- const common_namespaceObject = require("@rsdoctor/utils/common");
50
- function enhanceCommand(fn) {
51
- return (ctx)=>{
52
- const res = fn(ctx);
53
- return res;
54
- };
55
- }
56
- async function fetchText(url) {
57
- const { data } = await external_axios_default().get(url, {
58
- timeout: 60000,
59
- headers: {
60
- 'Content-Type': 'text/plain; charset=utf-8',
61
- 'Accept-Encoding': 'gzip,deflate,compress'
62
- }
63
- });
64
- return data;
65
- }
66
- async function readFile(url, cwd) {
67
- const file = external_path_default().resolve(cwd, url);
68
- return external_node_fs_default().readFileSync(file, 'utf-8');
69
- }
70
- async function loadJSON(uri, cwd) {
71
- if (common_namespaceObject.Url.isUrl(uri)) {
72
- const data = await fetchText(uri);
73
- return data;
74
- }
75
- const file = await readFile(uri, cwd);
76
- return JSON.parse(file);
77
- }
78
- async function loadShardingFile(uri, cwd) {
79
- if (common_namespaceObject.Url.isUrl(uri)) return fetchText(uri);
80
- if (common_namespaceObject.Url.isFilePath(uri)) return readFile(uri, cwd);
81
- return Promise.resolve(uri);
82
- }
83
- async function loadShardingFileWithSpinner(uri, cwd, spinner) {
84
- return loadShardingFile(uri, cwd).then((res)=>{
85
- spinner.text = `loaded "${uri}"`;
86
- return res;
87
- });
88
- }
89
- exports.enhanceCommand = __webpack_exports__.enhanceCommand;
90
- exports.fetchText = __webpack_exports__.fetchText;
91
- exports.loadJSON = __webpack_exports__.loadJSON;
92
- exports.loadShardingFile = __webpack_exports__.loadShardingFile;
93
- exports.loadShardingFileWithSpinner = __webpack_exports__.loadShardingFileWithSpinner;
94
- exports.readFile = __webpack_exports__.readFile;
95
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
96
- "enhanceCommand",
97
- "fetchText",
98
- "loadJSON",
99
- "loadShardingFile",
100
- "loadShardingFileWithSpinner",
101
- "readFile"
102
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
103
- Object.defineProperty(exports, '__esModule', {
104
- value: true
105
- });