@rsdoctor/cli 1.1.9 → 1.2.0-beta.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/commands/analyze.js +111 -108
- package/dist/commands/bundle-diff.js +146 -167
- package/dist/commands/index.js +66 -21
- package/dist/constants.js +61 -35
- package/dist/index.js +84 -82
- package/dist/types.js +17 -15
- package/dist/utils.js +89 -79
- package/package.json +10 -9
package/dist/commands/analyze.js
CHANGED
|
@@ -1,114 +1,117 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
+
analyze: ()=>analyze
|
|
32
37
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const analyze = (0,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
use ${name} to open "${
|
|
38
|
+
const common_namespaceObject = require("@rsdoctor/utils/common");
|
|
39
|
+
const types_namespaceObject = require("@rsdoctor/types");
|
|
40
|
+
const sdk_namespaceObject = require("@rsdoctor/sdk");
|
|
41
|
+
const external_ora_namespaceObject = require("ora");
|
|
42
|
+
var external_ora_default = /*#__PURE__*/ __webpack_require__.n(external_ora_namespaceObject);
|
|
43
|
+
const external_picocolors_namespaceObject = require("picocolors");
|
|
44
|
+
const external_utils_js_namespaceObject = require("../utils.js");
|
|
45
|
+
const external_constants_js_namespaceObject = require("../constants.js");
|
|
46
|
+
const analyze = (0, external_utils_js_namespaceObject.enhanceCommand)(({ cwd, name, bin })=>({
|
|
47
|
+
command: external_constants_js_namespaceObject.Commands.Analyze,
|
|
48
|
+
description: `
|
|
49
|
+
use ${name} to open "${types_namespaceObject.Constants.RsdoctorOutputManifestPath}" in browser for analysis.
|
|
45
50
|
|
|
46
|
-
example: ${bin} ${
|
|
51
|
+
example: ${bin} ${external_constants_js_namespaceObject.Commands.Analyze} --profile "${types_namespaceObject.Constants.RsdoctorOutputManifestPath}"
|
|
47
52
|
|
|
48
53
|
`.trim(),
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
0 && (module.exports = {
|
|
113
|
-
analyze
|
|
54
|
+
options (yargs) {
|
|
55
|
+
yargs.option('profile', {
|
|
56
|
+
type: 'string',
|
|
57
|
+
description: 'profile for Rsdoctor server',
|
|
58
|
+
demandOption: true
|
|
59
|
+
}).option('open', {
|
|
60
|
+
type: 'boolean',
|
|
61
|
+
description: 'turn off it if you need not open browser automatically',
|
|
62
|
+
default: true
|
|
63
|
+
}).option('port', {
|
|
64
|
+
type: 'number',
|
|
65
|
+
description: 'port for Rsdoctor Server'
|
|
66
|
+
}).option('type', {
|
|
67
|
+
type: 'boolean',
|
|
68
|
+
description: 'if need lite bundle mode'
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
async action ({ profile, open = true, port, type = types_namespaceObject.SDK.ToDataType.Normal }) {
|
|
72
|
+
const spinner = external_ora_default()({
|
|
73
|
+
prefixText: (0, external_picocolors_namespaceObject.cyan)(`[${name}]`)
|
|
74
|
+
}).start(`start to loading "${profile}"`);
|
|
75
|
+
const json = await (0, external_utils_js_namespaceObject.loadJSON)(profile, cwd);
|
|
76
|
+
spinner.text = "start to loading data...";
|
|
77
|
+
let dataValue;
|
|
78
|
+
try {
|
|
79
|
+
dataValue = await common_namespaceObject.Manifest.fetchShardingFiles(json.data, (url)=>(0, external_utils_js_namespaceObject.loadShardingFileWithSpinner)(url, cwd, spinner));
|
|
80
|
+
} catch (error) {
|
|
81
|
+
try {
|
|
82
|
+
dataValue = await common_namespaceObject.Manifest.fetchShardingFiles(json.cloudData || {}, (url)=>(0, external_utils_js_namespaceObject.loadShardingFileWithSpinner)(url, cwd, spinner));
|
|
83
|
+
} catch (e) {
|
|
84
|
+
spinner.fail((0, external_picocolors_namespaceObject.red)(error.message));
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
spinner.text = "start server";
|
|
89
|
+
const sdk = new sdk_namespaceObject.RsdoctorSDK({
|
|
90
|
+
name,
|
|
91
|
+
root: cwd,
|
|
92
|
+
port,
|
|
93
|
+
type
|
|
94
|
+
});
|
|
95
|
+
await sdk.bootstrap();
|
|
96
|
+
sdk.getStoreData = ()=>dataValue;
|
|
97
|
+
sdk.getManifestData = ()=>json;
|
|
98
|
+
const manifestBuffer = Buffer.from(JSON.stringify({
|
|
99
|
+
...json,
|
|
100
|
+
__LOCAL__SERVER__: true
|
|
101
|
+
}));
|
|
102
|
+
sdk.server.proxy(types_namespaceObject.SDK.ServerAPI.API.Manifest, 'GET', ()=>manifestBuffer);
|
|
103
|
+
if (open) {
|
|
104
|
+
spinner.text = "open browser automatically";
|
|
105
|
+
await sdk.server.openClientPage('homepage');
|
|
106
|
+
}
|
|
107
|
+
spinner.succeed(`the local url: ${(0, external_picocolors_namespaceObject.cyan)(sdk.server.getClientUrl('homepage'))}`);
|
|
108
|
+
return sdk;
|
|
109
|
+
}
|
|
110
|
+
}));
|
|
111
|
+
exports.analyze = __webpack_exports__.analyze;
|
|
112
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
113
|
+
"analyze"
|
|
114
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
115
|
+
Object.defineProperty(exports, '__esModule', {
|
|
116
|
+
value: true
|
|
114
117
|
});
|
|
@@ -1,173 +1,152 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
+
bundleDiff: ()=>bundleDiff
|
|
32
37
|
});
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const bundleDiff = (0,
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
const external_ora_namespaceObject = require("ora");
|
|
39
|
+
var external_ora_default = /*#__PURE__*/ __webpack_require__.n(external_ora_namespaceObject);
|
|
40
|
+
const external_picocolors_namespaceObject = require("picocolors");
|
|
41
|
+
const external_utils_js_namespaceObject = require("../utils.js");
|
|
42
|
+
const external_constants_js_namespaceObject = require("../constants.js");
|
|
43
|
+
const types_namespaceObject = require("@rsdoctor/types");
|
|
44
|
+
const common_namespaceObject = require("@rsdoctor/utils/common");
|
|
45
|
+
const sdk_namespaceObject = require("@rsdoctor/sdk");
|
|
46
|
+
const bundleDiff = (0, external_utils_js_namespaceObject.enhanceCommand)(({ cwd, bin, name })=>({
|
|
47
|
+
command: external_constants_js_namespaceObject.Commands.BundleDiff,
|
|
48
|
+
description: `
|
|
44
49
|
use ${name} to open the bundle diff result in browser for analysis.
|
|
45
50
|
|
|
46
|
-
example: ${bin} ${
|
|
51
|
+
example: ${bin} ${external_constants_js_namespaceObject.Commands.BundleDiff} --baseline="x.json" --current="x.json"
|
|
47
52
|
`.trim(),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
import_types2.SDK.ServerAPI.API.BundleDiffManifest,
|
|
148
|
-
"GET",
|
|
149
|
-
() => currentManifestsBuffer
|
|
150
|
-
);
|
|
151
|
-
spinner.text = `server bootstrap success`;
|
|
152
|
-
const localBaselineManifestUrl = baselineSdk.server.origin + import_types2.SDK.ServerAPI.API.BundleDiffManifest;
|
|
153
|
-
const localCurrentManifestUrl = currentSdk.server.origin + import_types2.SDK.ServerAPI.API.BundleDiffManifest;
|
|
154
|
-
baselineSdk.server.getClientUrl(
|
|
155
|
-
import_types2.Client.RsdoctorClientRoutes.BundleDiff,
|
|
156
|
-
localBaselineManifestUrl,
|
|
157
|
-
localCurrentManifestUrl
|
|
158
|
-
);
|
|
159
|
-
if (open) {
|
|
160
|
-
await baselineSdk.server.openClientPage(
|
|
161
|
-
import_types2.Client.RsdoctorClientRoutes.BundleDiff,
|
|
162
|
-
localBaselineManifestUrl,
|
|
163
|
-
localCurrentManifestUrl
|
|
164
|
-
);
|
|
165
|
-
}
|
|
166
|
-
spinner.succeed(`Bundle Diff page has been open.`);
|
|
167
|
-
return baselineSdk;
|
|
168
|
-
}
|
|
169
|
-
}));
|
|
170
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
171
|
-
0 && (module.exports = {
|
|
172
|
-
bundleDiff
|
|
53
|
+
options (yargs) {
|
|
54
|
+
yargs.option('current', {
|
|
55
|
+
type: 'string',
|
|
56
|
+
description: 'the url or file path of the profile json as the current',
|
|
57
|
+
demandOption: true
|
|
58
|
+
}).option('baseline', {
|
|
59
|
+
type: 'string',
|
|
60
|
+
description: 'the url or file path of the profile json as the baseline',
|
|
61
|
+
demandOption: true
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
async action ({ baseline, current, open = true }) {
|
|
65
|
+
const spinner = external_ora_default()({
|
|
66
|
+
prefixText: (0, external_picocolors_namespaceObject.cyan)(`[${name}]`)
|
|
67
|
+
}).start();
|
|
68
|
+
spinner.text = `loading "${baseline}"`;
|
|
69
|
+
const baselineData = {
|
|
70
|
+
...await (0, external_utils_js_namespaceObject.loadJSON)(baseline, cwd),
|
|
71
|
+
client: {
|
|
72
|
+
enableRoutes: []
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
let baselineDataValue;
|
|
76
|
+
try {
|
|
77
|
+
baselineDataValue = await common_namespaceObject.Manifest.fetchShardingFiles(baselineData.data, (url)=>(0, external_utils_js_namespaceObject.loadShardingFileWithSpinner)(url, cwd, spinner));
|
|
78
|
+
} catch (error) {
|
|
79
|
+
if (baselineData.cloudData) {
|
|
80
|
+
spinner.text = 'load the "baselineData.cloudData" instead of the "baselineData.data"';
|
|
81
|
+
baselineDataValue = await common_namespaceObject.Manifest.fetchShardingFiles(baselineData.cloudData, (url)=>(0, external_utils_js_namespaceObject.loadShardingFileWithSpinner)(url, cwd, spinner));
|
|
82
|
+
} else {
|
|
83
|
+
spinner.fail((0, external_picocolors_namespaceObject.red)(error.message));
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
spinner.text = `loading "${current}"`;
|
|
88
|
+
const currentData = {
|
|
89
|
+
...await (0, external_utils_js_namespaceObject.loadJSON)(current, cwd),
|
|
90
|
+
client: {
|
|
91
|
+
enableRoutes: []
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
let currentDataValue;
|
|
95
|
+
try {
|
|
96
|
+
currentDataValue = await common_namespaceObject.Manifest.fetchShardingFiles(currentData.data, (url)=>(0, external_utils_js_namespaceObject.loadShardingFileWithSpinner)(url, cwd, spinner));
|
|
97
|
+
} catch (error) {
|
|
98
|
+
if (currentData.cloudData) {
|
|
99
|
+
spinner.text = 'load the "currentData.cloudData" instead of the "currentData.data"';
|
|
100
|
+
currentDataValue = await common_namespaceObject.Manifest.fetchShardingFiles(currentData.cloudData, (url)=>(0, external_utils_js_namespaceObject.loadShardingFileWithSpinner)(url, cwd, spinner));
|
|
101
|
+
} else {
|
|
102
|
+
spinner.fail((0, external_picocolors_namespaceObject.red)(error.message));
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
spinner.text = "start server";
|
|
107
|
+
const baselineSdk = new sdk_namespaceObject.RsdoctorSDK({
|
|
108
|
+
name,
|
|
109
|
+
root: cwd
|
|
110
|
+
});
|
|
111
|
+
const currentSdk = new sdk_namespaceObject.RsdoctorSDK({
|
|
112
|
+
name,
|
|
113
|
+
root: cwd
|
|
114
|
+
});
|
|
115
|
+
await Promise.all([
|
|
116
|
+
baselineSdk.bootstrap(),
|
|
117
|
+
currentSdk.bootstrap()
|
|
118
|
+
]);
|
|
119
|
+
const baselineManifestsBuffer = Buffer.from(JSON.stringify({
|
|
120
|
+
__LOCAL__SERVER__: true,
|
|
121
|
+
__SOCKET__URL__: baselineSdk.server.socketUrl.socketUrl,
|
|
122
|
+
__SOCKET__PORT__: baselineSdk.server.socketUrl.port,
|
|
123
|
+
...baselineData
|
|
124
|
+
}));
|
|
125
|
+
const currentManifestsBuffer = Buffer.from(JSON.stringify({
|
|
126
|
+
__LOCAL__SERVER__: true,
|
|
127
|
+
__SOCKET__PORT__: currentSdk.server.socketUrl.port,
|
|
128
|
+
__SOCKET__URL__: currentSdk.server.socketUrl.socketUrl,
|
|
129
|
+
...currentData
|
|
130
|
+
}));
|
|
131
|
+
baselineSdk.getStoreData = ()=>baselineDataValue;
|
|
132
|
+
currentSdk.getStoreData = ()=>currentDataValue;
|
|
133
|
+
baselineSdk.getManifestData = ()=>baselineData;
|
|
134
|
+
currentSdk.getManifestData = ()=>currentData;
|
|
135
|
+
baselineSdk.server.proxy(types_namespaceObject.SDK.ServerAPI.API.BundleDiffManifest, 'GET', ()=>baselineManifestsBuffer);
|
|
136
|
+
currentSdk.server.proxy(types_namespaceObject.SDK.ServerAPI.API.BundleDiffManifest, 'GET', ()=>currentManifestsBuffer);
|
|
137
|
+
spinner.text = "server bootstrap success";
|
|
138
|
+
const localBaselineManifestUrl = baselineSdk.server.origin + types_namespaceObject.SDK.ServerAPI.API.BundleDiffManifest;
|
|
139
|
+
const localCurrentManifestUrl = currentSdk.server.origin + types_namespaceObject.SDK.ServerAPI.API.BundleDiffManifest;
|
|
140
|
+
baselineSdk.server.getClientUrl(types_namespaceObject.Client.RsdoctorClientRoutes.BundleDiff, localBaselineManifestUrl, localCurrentManifestUrl);
|
|
141
|
+
if (open) await baselineSdk.server.openClientPage(types_namespaceObject.Client.RsdoctorClientRoutes.BundleDiff, localBaselineManifestUrl, localCurrentManifestUrl);
|
|
142
|
+
spinner.succeed("Bundle Diff page has been open.");
|
|
143
|
+
return baselineSdk;
|
|
144
|
+
}
|
|
145
|
+
}));
|
|
146
|
+
exports.bundleDiff = __webpack_exports__.bundleDiff;
|
|
147
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
148
|
+
"bundleDiff"
|
|
149
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
150
|
+
Object.defineProperty(exports, '__esModule', {
|
|
151
|
+
value: true
|
|
173
152
|
});
|
package/dist/commands/index.js
CHANGED
|
@@ -1,24 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"./analyze": function(module) {
|
|
4
|
+
module.exports = require("./analyze.js");
|
|
5
|
+
},
|
|
6
|
+
"./bundle-diff": function(module) {
|
|
7
|
+
module.exports = require("./bundle-diff.js");
|
|
8
|
+
}
|
|
13
9
|
};
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
var __webpack_module_cache__ = {};
|
|
11
|
+
function __webpack_require__(moduleId) {
|
|
12
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
13
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
14
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
15
|
+
exports: {}
|
|
16
|
+
};
|
|
17
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
18
|
+
return module.exports;
|
|
19
|
+
}
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.n = (module)=>{
|
|
22
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
23
|
+
__webpack_require__.d(getter, {
|
|
24
|
+
a: getter
|
|
25
|
+
});
|
|
26
|
+
return getter;
|
|
27
|
+
};
|
|
28
|
+
})();
|
|
29
|
+
(()=>{
|
|
30
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
31
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: definition[key]
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
(()=>{
|
|
38
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
39
|
+
})();
|
|
40
|
+
(()=>{
|
|
41
|
+
__webpack_require__.r = (exports1)=>{
|
|
42
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
43
|
+
value: 'Module'
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
46
|
+
value: true
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
})();
|
|
50
|
+
var __webpack_exports__ = {};
|
|
51
|
+
(()=>{
|
|
52
|
+
__webpack_require__.r(__webpack_exports__);
|
|
53
|
+
var _analyze__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./analyze");
|
|
54
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
55
|
+
for(var __WEBPACK_IMPORT_KEY__ in _analyze__WEBPACK_IMPORTED_MODULE_0__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
56
|
+
return _analyze__WEBPACK_IMPORTED_MODULE_0__[key];
|
|
57
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
58
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
59
|
+
var _bundle_diff__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./bundle-diff");
|
|
60
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
61
|
+
for(var __WEBPACK_IMPORT_KEY__ in _bundle_diff__WEBPACK_IMPORTED_MODULE_1__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
62
|
+
return _bundle_diff__WEBPACK_IMPORTED_MODULE_1__[key];
|
|
63
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
64
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
65
|
+
})();
|
|
66
|
+
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
67
|
+
Object.defineProperty(exports, '__esModule', {
|
|
68
|
+
value: true
|
|
24
69
|
});
|
package/dist/constants.js
CHANGED
|
@@ -1,38 +1,64 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"../package.json": function(module) {
|
|
4
|
+
module.exports = require("../package.json");
|
|
5
|
+
}
|
|
9
6
|
};
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
7
|
+
var __webpack_module_cache__ = {};
|
|
8
|
+
function __webpack_require__(moduleId) {
|
|
9
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
10
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
11
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
12
|
+
exports: {}
|
|
13
|
+
};
|
|
14
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
15
|
+
return module.exports;
|
|
16
|
+
}
|
|
17
|
+
(()=>{
|
|
18
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
19
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: definition[key]
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
})();
|
|
25
|
+
(()=>{
|
|
26
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
27
|
+
})();
|
|
28
|
+
(()=>{
|
|
29
|
+
__webpack_require__.r = (exports1)=>{
|
|
30
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
31
|
+
value: 'Module'
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
34
|
+
value: true
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
var __webpack_exports__ = {};
|
|
39
|
+
(()=>{
|
|
40
|
+
__webpack_require__.r(__webpack_exports__);
|
|
41
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
42
|
+
Commands: ()=>Commands,
|
|
43
|
+
bin: ()=>bin,
|
|
44
|
+
pkg: ()=>pkg
|
|
45
|
+
});
|
|
46
|
+
var Commands = /*#__PURE__*/ function(Commands) {
|
|
47
|
+
Commands["Analyze"] = "analyze";
|
|
48
|
+
Commands["BundleDiff"] = "bundle-diff";
|
|
49
|
+
return Commands;
|
|
50
|
+
}({});
|
|
51
|
+
const pkg = __webpack_require__("../package.json");
|
|
52
|
+
const bin = Object.keys(pkg.bin)[0];
|
|
53
|
+
})();
|
|
54
|
+
exports.Commands = __webpack_exports__.Commands;
|
|
55
|
+
exports.bin = __webpack_exports__.bin;
|
|
56
|
+
exports.pkg = __webpack_exports__.pkg;
|
|
57
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
58
|
+
"Commands",
|
|
59
|
+
"bin",
|
|
60
|
+
"pkg"
|
|
61
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
62
|
+
Object.defineProperty(exports, '__esModule', {
|
|
63
|
+
value: true
|
|
38
64
|
});
|
package/dist/index.js
CHANGED
|
@@ -1,87 +1,89 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
+
execute: ()=>execute
|
|
32
37
|
});
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
const yargs_namespaceObject = require("yargs/yargs");
|
|
39
|
+
var yargs_default = /*#__PURE__*/ __webpack_require__.n(yargs_namespaceObject);
|
|
40
|
+
const helpers_namespaceObject = require("yargs/helpers");
|
|
41
|
+
const external_picocolors_namespaceObject = require("picocolors");
|
|
42
|
+
const index_js_namespaceObject = require("./commands/index.js");
|
|
43
|
+
const external_constants_js_namespaceObject = require("./constants.js");
|
|
44
|
+
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
40
45
|
async function execute(command, options) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
);
|
|
78
|
-
});
|
|
79
|
-
if (!argv.length) {
|
|
80
|
-
args.showHelp();
|
|
81
|
-
}
|
|
82
|
-
await args.parse();
|
|
46
|
+
const cwd = process.cwd();
|
|
47
|
+
const { name, version } = external_constants_js_namespaceObject.pkg;
|
|
48
|
+
const ctx = {
|
|
49
|
+
bin: external_constants_js_namespaceObject.bin,
|
|
50
|
+
cwd,
|
|
51
|
+
name
|
|
52
|
+
};
|
|
53
|
+
if (command === external_constants_js_namespaceObject.Commands.Analyze) {
|
|
54
|
+
const { action } = (0, index_js_namespaceObject.analyze)(ctx);
|
|
55
|
+
return action(options);
|
|
56
|
+
}
|
|
57
|
+
if (command === external_constants_js_namespaceObject.Commands.BundleDiff) {
|
|
58
|
+
const { action } = (0, index_js_namespaceObject.bundleDiff)(ctx);
|
|
59
|
+
return action(options);
|
|
60
|
+
}
|
|
61
|
+
const argv = (0, helpers_namespaceObject.hideBin)(process.argv);
|
|
62
|
+
const args = yargs_default()(argv).usage(`${external_constants_js_namespaceObject.bin} <command> [options]`);
|
|
63
|
+
args.version(version);
|
|
64
|
+
const commands = [
|
|
65
|
+
index_js_namespaceObject.analyze,
|
|
66
|
+
index_js_namespaceObject.bundleDiff
|
|
67
|
+
];
|
|
68
|
+
commands.forEach((cmd)=>{
|
|
69
|
+
const { command, description, options, action } = cmd(ctx);
|
|
70
|
+
args.command(command, description, (yargs)=>options(yargs.usage(`${external_constants_js_namespaceObject.bin} ${command} [options]`)), async (args)=>{
|
|
71
|
+
try {
|
|
72
|
+
await action(args);
|
|
73
|
+
} catch (error) {
|
|
74
|
+
const { message, stack } = error;
|
|
75
|
+
logger_namespaceObject.logger.error((0, external_picocolors_namespaceObject.red)(stack || message));
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
if (!argv.length) args.showHelp();
|
|
81
|
+
await args.parse();
|
|
83
82
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
exports.execute = __webpack_exports__.execute;
|
|
84
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
85
|
+
"execute"
|
|
86
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
87
|
+
Object.defineProperty(exports, '__esModule', {
|
|
88
|
+
value: true
|
|
87
89
|
});
|
package/dist/types.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.r = (exports1)=>{
|
|
5
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
+
value: 'Module'
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
})();
|
|
13
|
+
var __webpack_exports__ = {};
|
|
14
|
+
__webpack_require__.r(__webpack_exports__);
|
|
15
|
+
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
16
|
+
Object.defineProperty(exports, '__esModule', {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
package/dist/utils.js
CHANGED
|
@@ -1,94 +1,104 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
|
37
42
|
});
|
|
38
|
-
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
var
|
|
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 common_namespaceObject = require("@rsdoctor/utils/common");
|
|
48
|
+
const build_namespaceObject = require("@rsdoctor/utils/build");
|
|
43
49
|
function enhanceCommand(fn) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
return (ctx)=>{
|
|
51
|
+
const res = fn(ctx);
|
|
52
|
+
return res;
|
|
53
|
+
};
|
|
48
54
|
}
|
|
49
55
|
async function fetchText(url) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
const { data } = await external_axios_default().get(url, {
|
|
57
|
+
timeout: 60000,
|
|
58
|
+
headers: {
|
|
59
|
+
'Content-Type': 'text/plain; charset=utf-8',
|
|
60
|
+
'Accept-Encoding': 'gzip,deflate,compress'
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return data;
|
|
58
64
|
}
|
|
59
65
|
async function readFile(url, cwd) {
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
const file = external_path_default().resolve(cwd, url);
|
|
67
|
+
return build_namespaceObject.File.fse.readFile(file, 'utf-8');
|
|
62
68
|
}
|
|
63
69
|
async function loadJSON(uri, cwd) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
if (common_namespaceObject.Url.isUrl(uri)) {
|
|
71
|
+
const data = await fetchText(uri);
|
|
72
|
+
return data;
|
|
73
|
+
}
|
|
74
|
+
const file = await readFile(uri, cwd);
|
|
75
|
+
return JSON.parse(file);
|
|
70
76
|
}
|
|
71
77
|
async function loadShardingFile(uri, cwd) {
|
|
72
|
-
|
|
73
|
-
return
|
|
74
|
-
|
|
75
|
-
if (import_common.Url.isFilePath(uri)) {
|
|
76
|
-
return readFile(uri, cwd);
|
|
77
|
-
}
|
|
78
|
-
return Promise.resolve(uri);
|
|
78
|
+
if (common_namespaceObject.Url.isUrl(uri)) return fetchText(uri);
|
|
79
|
+
if (common_namespaceObject.Url.isFilePath(uri)) return readFile(uri, cwd);
|
|
80
|
+
return Promise.resolve(uri);
|
|
79
81
|
}
|
|
80
82
|
async function loadShardingFileWithSpinner(uri, cwd, spinner) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
return loadShardingFile(uri, cwd).then((res)=>{
|
|
84
|
+
spinner.text = `loaded "${uri}"`;
|
|
85
|
+
return res;
|
|
86
|
+
});
|
|
85
87
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
exports.enhanceCommand = __webpack_exports__.enhanceCommand;
|
|
89
|
+
exports.fetchText = __webpack_exports__.fetchText;
|
|
90
|
+
exports.loadJSON = __webpack_exports__.loadJSON;
|
|
91
|
+
exports.loadShardingFile = __webpack_exports__.loadShardingFile;
|
|
92
|
+
exports.loadShardingFileWithSpinner = __webpack_exports__.loadShardingFileWithSpinner;
|
|
93
|
+
exports.readFile = __webpack_exports__.readFile;
|
|
94
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
95
|
+
"enhanceCommand",
|
|
96
|
+
"fetchText",
|
|
97
|
+
"loadJSON",
|
|
98
|
+
"loadShardingFile",
|
|
99
|
+
"loadShardingFileWithSpinner",
|
|
100
|
+
"readFile"
|
|
101
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
102
|
+
Object.defineProperty(exports, '__esModule', {
|
|
103
|
+
value: true
|
|
94
104
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-beta.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -18,19 +18,20 @@
|
|
|
18
18
|
"module": "dist/index.js",
|
|
19
19
|
"types": "dist/index.d.ts",
|
|
20
20
|
"devDependencies": {
|
|
21
|
+
"@rslib/core": "^0.11.0",
|
|
21
22
|
"@types/yargs": "17.0.33",
|
|
22
23
|
"typescript": "^5.2.2"
|
|
23
24
|
},
|
|
24
25
|
"dependencies": {
|
|
25
|
-
"axios": "^1.
|
|
26
|
+
"axios": "^1.11.0",
|
|
26
27
|
"ora": "^5.4.1",
|
|
27
28
|
"picocolors": "^1.1.1",
|
|
28
29
|
"tslib": "2.8.1",
|
|
29
30
|
"yargs": "17.7.2",
|
|
30
|
-
"@rsdoctor/
|
|
31
|
-
"@rsdoctor/
|
|
32
|
-
"@rsdoctor/sdk": "1.
|
|
33
|
-
"@rsdoctor/
|
|
31
|
+
"@rsdoctor/types": "1.2.0-beta.0",
|
|
32
|
+
"@rsdoctor/utils": "1.2.0-beta.0",
|
|
33
|
+
"@rsdoctor/sdk": "1.2.0-beta.0",
|
|
34
|
+
"@rsdoctor/client": "1.2.0-beta.0"
|
|
34
35
|
},
|
|
35
36
|
"publishConfig": {
|
|
36
37
|
"access": "public",
|
|
@@ -39,8 +40,8 @@
|
|
|
39
40
|
},
|
|
40
41
|
"scripts": {
|
|
41
42
|
"dev": "npm run start",
|
|
42
|
-
"build": "
|
|
43
|
-
"start": "
|
|
44
|
-
"test": "
|
|
43
|
+
"build": "rslib build",
|
|
44
|
+
"start": "rslib build -w",
|
|
45
|
+
"test": "rstest run"
|
|
45
46
|
}
|
|
46
47
|
}
|