@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.
@@ -1,114 +1,117 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var analyze_exports = {};
30
- __export(analyze_exports, {
31
- analyze: () => analyze
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
- module.exports = __toCommonJS(analyze_exports);
34
- var import_common = require("@rsdoctor/utils/common");
35
- var import_types = require("@rsdoctor/types");
36
- var import_sdk = require("@rsdoctor/sdk");
37
- var import_ora = __toESM(require("ora"));
38
- var import_picocolors = require("picocolors");
39
- var import_utils = require("../utils");
40
- var import_constants = require("../constants");
41
- const analyze = (0, import_utils.enhanceCommand)(({ cwd, name, bin }) => ({
42
- command: import_constants.Commands.Analyze,
43
- description: `
44
- use ${name} to open "${import_types.Constants.RsdoctorOutputManifestPath}" in browser for analysis.
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} ${import_constants.Commands.Analyze} --profile "${import_types.Constants.RsdoctorOutputManifestPath}"
51
+ example: ${bin} ${external_constants_js_namespaceObject.Commands.Analyze} --profile "${types_namespaceObject.Constants.RsdoctorOutputManifestPath}"
47
52
 
48
53
  `.trim(),
49
- options(yargs) {
50
- yargs.option("profile", {
51
- type: "string",
52
- description: "profile for Rsdoctor server",
53
- demandOption: true
54
- }).option("open", {
55
- type: "boolean",
56
- description: "turn off it if you need not open browser automatically",
57
- default: true
58
- }).option("port", {
59
- type: "number",
60
- description: "port for Rsdoctor Server"
61
- }).option("type", {
62
- type: "boolean",
63
- description: "if need lite bundle mode"
64
- });
65
- },
66
- async action({ profile, open = true, port, type = import_types.SDK.ToDataType.Normal }) {
67
- const spinner = (0, import_ora.default)({ prefixText: (0, import_picocolors.cyan)(`[${name}]`) }).start(
68
- `start to loading "${profile}"`
69
- );
70
- const json = await (0, import_utils.loadJSON)(
71
- profile,
72
- cwd
73
- );
74
- spinner.text = `start to loading data...`;
75
- let dataValue;
76
- try {
77
- dataValue = await import_common.Manifest.fetchShardingFiles(
78
- json.data,
79
- (url) => (0, import_utils.loadShardingFileWithSpinner)(url, cwd, spinner)
80
- );
81
- } catch (error) {
82
- try {
83
- dataValue = await import_common.Manifest.fetchShardingFiles(
84
- json.cloudData || {},
85
- (url) => (0, import_utils.loadShardingFileWithSpinner)(url, cwd, spinner)
86
- );
87
- } catch (e) {
88
- spinner.fail((0, import_picocolors.red)(error.message));
89
- throw error;
90
- }
91
- }
92
- spinner.text = `start server`;
93
- const sdk = new import_sdk.RsdoctorSDK({ name, root: cwd, port, type });
94
- await sdk.bootstrap();
95
- sdk.getStoreData = () => dataValue;
96
- sdk.getManifestData = () => json;
97
- const manifestBuffer = Buffer.from(
98
- JSON.stringify({ ...json, __LOCAL__SERVER__: true })
99
- );
100
- sdk.server.proxy(import_types.SDK.ServerAPI.API.Manifest, "GET", () => manifestBuffer);
101
- if (open) {
102
- spinner.text = `open browser automatically`;
103
- await sdk.server.openClientPage("homepage");
104
- }
105
- spinner.succeed(
106
- `the local url: ${(0, import_picocolors.cyan)(sdk.server.getClientUrl("homepage"))}`
107
- );
108
- return sdk;
109
- }
110
- }));
111
- // Annotate the CommonJS export names for ESM import in node:
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 __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var bundle_diff_exports = {};
30
- __export(bundle_diff_exports, {
31
- bundleDiff: () => bundleDiff
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
- module.exports = __toCommonJS(bundle_diff_exports);
34
- var import_ora = __toESM(require("ora"));
35
- var import_picocolors = require("picocolors");
36
- var import_utils = require("../utils");
37
- var import_constants = require("../constants");
38
- var import_types2 = require("@rsdoctor/types");
39
- var import_common = require("@rsdoctor/utils/common");
40
- var import_sdk = require("@rsdoctor/sdk");
41
- const bundleDiff = (0, import_utils.enhanceCommand)(({ cwd, bin, name }) => ({
42
- command: import_constants.Commands.BundleDiff,
43
- description: `
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} ${import_constants.Commands.BundleDiff} --baseline="x.json" --current="x.json"
51
+ example: ${bin} ${external_constants_js_namespaceObject.Commands.BundleDiff} --baseline="x.json" --current="x.json"
47
52
  `.trim(),
48
- options(yargs) {
49
- yargs.option("current", {
50
- type: "string",
51
- description: "the url or file path of the profile json as the current",
52
- demandOption: true
53
- }).option("baseline", {
54
- type: "string",
55
- description: "the url or file path of the profile json as the baseline",
56
- demandOption: true
57
- });
58
- },
59
- async action({ baseline, current, open = true }) {
60
- const spinner = (0, import_ora.default)({ prefixText: (0, import_picocolors.cyan)(`[${name}]`) }).start();
61
- spinner.text = `loading "${baseline}"`;
62
- const baselineData = {
63
- ...await (0, import_utils.loadJSON)(
64
- baseline,
65
- cwd
66
- ),
67
- client: {
68
- enableRoutes: []
69
- }
70
- };
71
- let baselineDataValue;
72
- try {
73
- baselineDataValue = await import_common.Manifest.fetchShardingFiles(
74
- baselineData.data,
75
- (url) => (0, import_utils.loadShardingFileWithSpinner)(url, cwd, spinner)
76
- );
77
- } catch (error) {
78
- if (baselineData.cloudData) {
79
- spinner.text = 'load the "baselineData.cloudData" instead of the "baselineData.data"';
80
- baselineDataValue = await import_common.Manifest.fetchShardingFiles(
81
- baselineData.cloudData,
82
- (url) => (0, import_utils.loadShardingFileWithSpinner)(url, cwd, spinner)
83
- );
84
- } else {
85
- spinner.fail((0, import_picocolors.red)(error.message));
86
- throw error;
87
- }
88
- }
89
- spinner.text = `loading "${current}"`;
90
- const currentData = {
91
- ...await (0, import_utils.loadJSON)(
92
- current,
93
- cwd
94
- ),
95
- client: {
96
- enableRoutes: []
97
- }
98
- };
99
- let currentDataValue;
100
- try {
101
- currentDataValue = await import_common.Manifest.fetchShardingFiles(
102
- currentData.data,
103
- (url) => (0, import_utils.loadShardingFileWithSpinner)(url, cwd, spinner)
104
- );
105
- } catch (error) {
106
- if (currentData.cloudData) {
107
- spinner.text = 'load the "currentData.cloudData" instead of the "currentData.data"';
108
- currentDataValue = await import_common.Manifest.fetchShardingFiles(
109
- currentData.cloudData,
110
- (url) => (0, import_utils.loadShardingFileWithSpinner)(url, cwd, spinner)
111
- );
112
- } else {
113
- spinner.fail((0, import_picocolors.red)(error.message));
114
- throw error;
115
- }
116
- }
117
- spinner.text = `start server`;
118
- const baselineSdk = new import_sdk.RsdoctorSDK({ name, root: cwd });
119
- const currentSdk = new import_sdk.RsdoctorSDK({ name, root: cwd });
120
- await Promise.all([baselineSdk.bootstrap(), currentSdk.bootstrap()]);
121
- const baselineManifestsBuffer = Buffer.from(
122
- JSON.stringify({
123
- __LOCAL__SERVER__: true,
124
- __SOCKET__URL__: baselineSdk.server.socketUrl.socketUrl,
125
- __SOCKET__PORT__: baselineSdk.server.socketUrl.port,
126
- ...baselineData
127
- })
128
- );
129
- const currentManifestsBuffer = Buffer.from(
130
- JSON.stringify({
131
- __LOCAL__SERVER__: true,
132
- __SOCKET__PORT__: currentSdk.server.socketUrl.port,
133
- __SOCKET__URL__: currentSdk.server.socketUrl.socketUrl,
134
- ...currentData
135
- })
136
- );
137
- baselineSdk.getStoreData = () => baselineDataValue;
138
- currentSdk.getStoreData = () => currentDataValue;
139
- baselineSdk.getManifestData = () => baselineData;
140
- currentSdk.getManifestData = () => currentData;
141
- baselineSdk.server.proxy(
142
- import_types2.SDK.ServerAPI.API.BundleDiffManifest,
143
- "GET",
144
- () => baselineManifestsBuffer
145
- );
146
- currentSdk.server.proxy(
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
  });
@@ -1,24 +1,69 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
- var commands_exports = {};
17
- module.exports = __toCommonJS(commands_exports);
18
- __reExport(commands_exports, require("./analyze"), module.exports);
19
- __reExport(commands_exports, require("./bundle-diff"), module.exports);
20
- // Annotate the CommonJS export names for ESM import in node:
21
- 0 && (module.exports = {
22
- ...require("./analyze"),
23
- ...require("./bundle-diff")
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 __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var constants_exports = {};
20
- __export(constants_exports, {
21
- Commands: () => Commands,
22
- bin: () => bin,
23
- pkg: () => pkg
24
- });
25
- module.exports = __toCommonJS(constants_exports);
26
- var Commands = /* @__PURE__ */ ((Commands2) => {
27
- Commands2["Analyze"] = "analyze";
28
- Commands2["BundleDiff"] = "bundle-diff";
29
- return Commands2;
30
- })(Commands || {});
31
- const pkg = require("../package.json");
32
- const bin = Object.keys(pkg.bin)[0];
33
- // Annotate the CommonJS export names for ESM import in node:
34
- 0 && (module.exports = {
35
- Commands,
36
- bin,
37
- pkg
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 __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var src_exports = {};
30
- __export(src_exports, {
31
- execute: () => execute
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
- module.exports = __toCommonJS(src_exports);
34
- var import_yargs = __toESM(require("yargs/yargs"));
35
- var import_helpers = require("yargs/helpers");
36
- var import_picocolors = require("picocolors");
37
- var import_commands = require("./commands");
38
- var import_constants = require("./constants");
39
- var import_logger = require("@rsdoctor/utils/logger");
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
- const cwd = process.cwd();
42
- const { name, version } = import_constants.pkg;
43
- const ctx = { bin: import_constants.bin, cwd, name };
44
- if (command === import_constants.Commands.Analyze) {
45
- const { action } = (0, import_commands.analyze)(ctx);
46
- return action(
47
- options
48
- );
49
- }
50
- if (command === import_constants.Commands.BundleDiff) {
51
- const { action } = (0, import_commands.bundleDiff)(ctx);
52
- return action(
53
- options
54
- );
55
- }
56
- const argv = (0, import_helpers.hideBin)(process.argv);
57
- const args = (0, import_yargs.default)(argv).usage(`${import_constants.bin} <command> [options]`);
58
- args.version(version);
59
- const commands = [import_commands.analyze, import_commands.bundleDiff];
60
- commands.forEach((cmd) => {
61
- const { command: command2, description, options: options2, action } = cmd(ctx);
62
- args.command(
63
- command2,
64
- description,
65
- (yargs2) => {
66
- return options2(yargs2.usage(`${import_constants.bin} ${command2} [options]`));
67
- },
68
- async (args2) => {
69
- try {
70
- await action(args2);
71
- } catch (error) {
72
- const { message, stack } = error;
73
- import_logger.logger.error((0, import_picocolors.red)(stack || message));
74
- process.exit(1);
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
- // Annotate the CommonJS export names for ESM import in node:
85
- 0 && (module.exports = {
86
- execute
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 __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
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;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var types_exports = {};
16
- module.exports = __toCommonJS(types_exports);
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 __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var utils_exports = {};
30
- __export(utils_exports, {
31
- enhanceCommand: () => enhanceCommand,
32
- fetchText: () => fetchText,
33
- loadJSON: () => loadJSON,
34
- loadShardingFile: () => loadShardingFile,
35
- loadShardingFileWithSpinner: () => loadShardingFileWithSpinner,
36
- readFile: () => readFile
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
- module.exports = __toCommonJS(utils_exports);
39
- var import_axios = __toESM(require("axios"));
40
- var import_path = __toESM(require("path"));
41
- var import_common = require("@rsdoctor/utils/common");
42
- var import_build = require("@rsdoctor/utils/build");
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
- return (ctx) => {
45
- const res = fn(ctx);
46
- return res;
47
- };
50
+ return (ctx)=>{
51
+ const res = fn(ctx);
52
+ return res;
53
+ };
48
54
  }
49
55
  async function fetchText(url) {
50
- const { data } = await import_axios.default.get(url, {
51
- timeout: 6e4,
52
- headers: {
53
- "Content-Type": "text/plain; charset=utf-8",
54
- "Accept-Encoding": "gzip,deflate,compress"
55
- }
56
- });
57
- return data;
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
- const file = import_path.default.resolve(cwd, url);
61
- return import_build.File.fse.readFile(file, "utf-8");
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
- if (import_common.Url.isUrl(uri)) {
65
- const data = await fetchText(uri);
66
- return data;
67
- }
68
- const file = await readFile(uri, cwd);
69
- return JSON.parse(file);
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
- if (import_common.Url.isUrl(uri)) {
73
- return fetchText(uri);
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
- return loadShardingFile(uri, cwd).then((res) => {
82
- spinner.text = `loaded "${uri}"`;
83
- return res;
84
- });
83
+ return loadShardingFile(uri, cwd).then((res)=>{
84
+ spinner.text = `loaded "${uri}"`;
85
+ return res;
86
+ });
85
87
  }
86
- // Annotate the CommonJS export names for ESM import in node:
87
- 0 && (module.exports = {
88
- enhanceCommand,
89
- fetchText,
90
- loadJSON,
91
- loadShardingFile,
92
- loadShardingFileWithSpinner,
93
- readFile
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.1.9",
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.10.0",
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/client": "1.1.9",
31
- "@rsdoctor/types": "1.1.9",
32
- "@rsdoctor/sdk": "1.1.9",
33
- "@rsdoctor/utils": "1.1.9"
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": "modern build",
43
- "start": "modern build -w",
44
- "test": "vitest run"
43
+ "build": "rslib build",
44
+ "start": "rslib build -w",
45
+ "test": "rstest run"
45
46
  }
46
47
  }