@rsdoctor/components 0.0.2-beta.0 → 0.0.2-beta.2
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/components/Alert/change.js +2 -3
- package/dist/components/Alert/file-relation.js +1 -1
- package/dist/components/Alert/index.css +3 -0
- package/dist/components/Alert/link.js +1 -1
- package/dist/components/Alert/package-relation.js +8 -27
- package/dist/components/Alert/view.js +3 -4
- package/dist/components/Alerts/bundle.js +23 -9
- package/dist/components/Alerts/common.js +3 -20
- package/dist/components/Badge/index.js +11 -29
- package/dist/components/Card/diff.d.ts +2 -2
- package/dist/components/Card/diff.js +4 -33
- package/dist/components/Card/index.d.ts +1 -0
- package/dist/components/Card/index.js +6 -37
- package/dist/components/Card/size.d.ts +5 -0
- package/dist/components/Card/size.js +17 -9
- package/dist/components/Card/statistic.css +2 -1
- package/dist/components/Card/statistic.d.ts +3 -0
- package/dist/components/Card/statistic.js +6 -21
- package/dist/components/Charts/TimelineCharts/index.js +120 -127
- package/dist/components/Charts/common.js +1 -1
- package/dist/components/Charts/loader.js +9 -18
- package/dist/components/CodeViewer/diff.js +8 -26
- package/dist/components/CodeViewer/hightlight.js +3 -3
- package/dist/components/CodeViewer/viewer.js +4 -20
- package/dist/components/Configuration/{webpack.d.ts → builder.d.ts} +1 -1
- package/dist/components/Configuration/{webpack.js → builder.js} +6 -6
- package/dist/components/Configuration/index.d.ts +1 -1
- package/dist/components/Configuration/index.js +1 -1
- package/dist/components/FileTree/index.js +13 -24
- package/dist/components/Form/keyword.js +1 -17
- package/dist/components/Keyword/index.js +4 -36
- package/dist/components/Layout/builder-select.js +1 -1
- package/dist/components/Layout/header.js +2 -3
- package/dist/components/Layout/index.js +2 -2
- package/dist/components/Layout/menus.d.ts +1 -1
- package/dist/components/Layout/menus.js +11 -35
- package/dist/components/Loader/Analysis/files.js +8 -2
- package/dist/components/Loader/Analysis/index.d.ts +1 -1
- package/dist/components/Loader/executions.d.ts +1 -1
- package/dist/components/Loader/executions.js +62 -84
- package/dist/components/Manifest/api.d.ts +1 -1
- package/dist/components/Manifest/api.js +5 -35
- package/dist/components/Manifest/data.d.ts +1 -1
- package/dist/components/Manifest/data.js +1 -17
- package/dist/components/Opener/vscode.js +4 -19
- package/dist/components/Overall/bundle.js +2 -2
- package/dist/components/Overall/compile.js +1 -2
- package/dist/components/Resolver/analysis.js +1 -17
- package/dist/components/TextDrawer/duplicate.js +18 -56
- package/dist/components/TextDrawer/index.js +9 -28
- package/dist/components/worker/ecmaversion/client.js +1 -2
- package/dist/components/worker/ecmaversion/worker.js +3 -3
- package/dist/components/worker/jsequal/client.js +1 -2
- package/dist/components/worker/jsequal/worker.js +21 -50
- package/dist/config.d.ts +2 -2
- package/dist/config.js +3 -17
- package/dist/constants.d.ts +4 -2
- package/dist/constants.js +5 -1
- package/dist/pages/BundleSize/components/asset.js +74 -101
- package/dist/pages/BundleSize/components/cards.js +16 -27
- package/dist/pages/BundleSize/components/index.d.ts +1 -1
- package/dist/pages/BundleSize/components/index.js +57 -5
- package/dist/pages/BundleSize/constants.d.ts +1 -1
- package/dist/pages/BundleSize/constants.js +1 -1
- package/dist/pages/ModuleAnalyze/chunks.js +1 -1
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.css +16 -7
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.js +6 -24
- package/dist/pages/ModuleAnalyze/constants.d.ts +1 -1
- package/dist/pages/ModuleAnalyze/constants.js +1 -1
- package/dist/pages/ModuleAnalyze/utils/hooks.js +5 -8
- package/dist/pages/ModuleAnalyze/utils/index.js +2 -4
- package/dist/pages/ModuleResolve/constants.d.ts +1 -1
- package/dist/pages/ModuleResolve/constants.js +1 -1
- package/dist/pages/Overall/constants.d.ts +1 -1
- package/dist/pages/Overall/constants.js +1 -1
- package/dist/pages/Resources/RuleIndex/constants.d.ts +3 -0
- package/dist/pages/Resources/RuleIndex/constants.js +7 -0
- package/dist/pages/Resources/RuleIndex/index.d.ts +3 -0
- package/dist/pages/Resources/RuleIndex/index.js +53 -0
- package/dist/pages/WebpackLoaders/Analysis/constants.d.ts +1 -1
- package/dist/pages/WebpackLoaders/Analysis/constants.js +1 -1
- package/dist/pages/WebpackLoaders/Overall/constants.d.ts +2 -2
- package/dist/pages/WebpackLoaders/Overall/constants.js +2 -2
- package/dist/pages/WebpackLoaders/Overall/index.js +1 -1
- package/dist/pages/WebpackPlugins/constants.d.ts +2 -2
- package/dist/pages/WebpackPlugins/constants.js +2 -2
- package/dist/pages/index.d.ts +2 -1
- package/dist/pages/index.js +3 -1
- package/dist/utils/data/base.d.ts +7 -7
- package/dist/utils/data/base.js +2 -24
- package/dist/utils/data/index.d.ts +1 -1
- package/dist/utils/data/index.js +14 -36
- package/dist/utils/data/local.d.ts +1 -1
- package/dist/utils/data/local.js +32 -56
- package/dist/utils/data/remote.d.ts +1 -1
- package/dist/utils/data/remote.js +22 -46
- package/dist/utils/file.js +4 -4
- package/dist/utils/hooks.d.ts +16 -15
- package/dist/utils/hooks.js +33 -73
- package/dist/utils/i18n/cn.js +1 -1
- package/dist/utils/i18n/en.d.ts +1 -1
- package/dist/utils/i18n/en.js +1 -1
- package/dist/utils/manifest.d.ts +2 -2
- package/dist/utils/monaco.d.ts +4 -1
- package/dist/utils/monaco.js +26 -3
- package/dist/utils/request.d.ts +10 -10
- package/dist/utils/request.js +52 -101
- package/dist/utils/routes.d.ts +2 -2
- package/dist/utils/routes.js +2 -2
- package/dist/utils/storage.js +3 -3
- package/dist/utils/url.js +10 -28
- package/package.json +7 -4
- package/dist/assets/icon.7509d763.svg +0 -21
|
@@ -3,7 +3,7 @@ import { BaseDataLoader } from './base';
|
|
|
3
3
|
export declare class LocalServerDataLoader extends BaseDataLoader {
|
|
4
4
|
protected events: Map<SDK.ServerAPI.API | SDK.ServerAPI.APIExtends, Set<Common.Function>>;
|
|
5
5
|
isLocal(): boolean;
|
|
6
|
-
loadData<T extends keyof Manifest.
|
|
6
|
+
loadData<T extends keyof Manifest.RsdoctorManifestData>(key: T): Promise<void | Manifest.RsdoctorManifestData[T]>;
|
|
7
7
|
loadAPI<T extends SDK.ServerAPI.API, B extends SDK.ServerAPI.InferRequestBodyType<T> = SDK.ServerAPI.InferRequestBodyType<T>, R extends SDK.ServerAPI.InferResponseType<T> = SDK.ServerAPI.InferResponseType<T>>(...args: B extends void ? [api: T] : [api: T, body: B]): Promise<R>;
|
|
8
8
|
dispose(): void;
|
|
9
9
|
/**
|
package/dist/utils/data/local.js
CHANGED
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
1
|
import { Manifest as ManifestShared } from "@rsdoctor/utils/common";
|
|
22
2
|
import { SDK } from "@rsdoctor/types";
|
|
23
3
|
import { get } from "lodash-es";
|
|
@@ -31,46 +11,42 @@ class LocalServerDataLoader extends BaseDataLoader {
|
|
|
31
11
|
isLocal() {
|
|
32
12
|
return true;
|
|
33
13
|
}
|
|
34
|
-
loadData(key) {
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
(res2)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this.shardingDataMap.set(key, task);
|
|
54
|
-
}
|
|
55
|
-
res = yield this.shardingDataMap.get(key);
|
|
56
|
-
this.shardingDataMap.delete(key);
|
|
57
|
-
return res;
|
|
14
|
+
async loadData(key) {
|
|
15
|
+
return this.limit(key, async () => {
|
|
16
|
+
const [scope, ...rest] = this.getKeys(key);
|
|
17
|
+
const data = this.getData(scope);
|
|
18
|
+
if (!data)
|
|
19
|
+
return;
|
|
20
|
+
let res = data;
|
|
21
|
+
if (ManifestShared.isShardingData(res)) {
|
|
22
|
+
if (!this.shardingDataMap.has(key)) {
|
|
23
|
+
const task = new Promise((resolve) => {
|
|
24
|
+
getSocket(this.manifest.__SOCKET__URL__).emit(
|
|
25
|
+
SDK.ServerAPI.API.LoadDataByKey,
|
|
26
|
+
{ key },
|
|
27
|
+
(res2) => {
|
|
28
|
+
resolve(res2.res);
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
});
|
|
32
|
+
this.shardingDataMap.set(key, task);
|
|
58
33
|
}
|
|
59
|
-
|
|
60
|
-
|
|
34
|
+
res = await this.shardingDataMap.get(key);
|
|
35
|
+
this.shardingDataMap.delete(key);
|
|
36
|
+
return res;
|
|
37
|
+
}
|
|
38
|
+
return rest.length > 0 ? get(res, this.joinKeys(rest)) : res;
|
|
61
39
|
});
|
|
62
40
|
}
|
|
63
|
-
loadAPI(...args) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
resolve(res.res);
|
|
71
|
-
});
|
|
41
|
+
async loadAPI(...args) {
|
|
42
|
+
const [api, body] = args;
|
|
43
|
+
const key = body ? `${api}_${JSON.stringify(body)}` : `${api}`;
|
|
44
|
+
return this.limit(key, async () => {
|
|
45
|
+
return new Promise((resolve) => {
|
|
46
|
+
getSocket(this.manifest.__SOCKET__URL__).emit(api, body, (res) => {
|
|
47
|
+
resolve(res.res);
|
|
72
48
|
});
|
|
73
|
-
})
|
|
49
|
+
});
|
|
74
50
|
});
|
|
75
51
|
}
|
|
76
52
|
dispose() {
|
|
@@ -2,7 +2,7 @@ import { Manifest, SDK } from '@rsdoctor/types';
|
|
|
2
2
|
import { BaseDataLoader } from './base';
|
|
3
3
|
export declare class RemoteDataLoader extends BaseDataLoader {
|
|
4
4
|
isLocal(): boolean;
|
|
5
|
-
loadData<T extends Manifest.
|
|
5
|
+
loadData<T extends Manifest.RsdoctorManifestMappingKeys>(key: T): Promise<Manifest.InferManifestDataValue<T>>;
|
|
6
6
|
loadAPI<T extends SDK.ServerAPI.API, B extends SDK.ServerAPI.InferRequestBodyType<T> = SDK.ServerAPI.InferRequestBodyType<T>, R extends SDK.ServerAPI.InferResponseType<T> = SDK.ServerAPI.InferResponseType<T>>(...args: B extends void ? [api: T] : [api: T, body: B]): Promise<R>;
|
|
7
7
|
dispose(): void;
|
|
8
8
|
onDataUpdate(): void;
|
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
1
|
import { Manifest as ManifestShared } from "@rsdoctor/utils/common";
|
|
22
2
|
import { get } from "lodash-es";
|
|
23
3
|
import { BaseDataLoader } from "./base";
|
|
@@ -26,35 +6,31 @@ class RemoteDataLoader extends BaseDataLoader {
|
|
|
26
6
|
isLocal() {
|
|
27
7
|
return false;
|
|
28
8
|
}
|
|
29
|
-
loadData(key) {
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
this.shardingDataMap.set(scope, task);
|
|
44
|
-
}
|
|
45
|
-
res = yield this.shardingDataMap.get(scope);
|
|
9
|
+
async loadData(key) {
|
|
10
|
+
return this.limit(key, async () => {
|
|
11
|
+
const [scope, ...rest] = this.getKeys(key);
|
|
12
|
+
const data = this.getData(scope);
|
|
13
|
+
if (!data)
|
|
14
|
+
return;
|
|
15
|
+
let res = data;
|
|
16
|
+
if (ManifestShared.isShardingData(res)) {
|
|
17
|
+
if (!this.shardingDataMap.has(scope)) {
|
|
18
|
+
const task = ManifestShared.fetchShardingData(res, fetchShardingFile).catch((err) => {
|
|
19
|
+
this.log(`loadData error: `, res, key);
|
|
20
|
+
throw err;
|
|
21
|
+
});
|
|
22
|
+
this.shardingDataMap.set(scope, task);
|
|
46
23
|
}
|
|
47
|
-
|
|
48
|
-
}
|
|
24
|
+
res = await this.shardingDataMap.get(scope);
|
|
25
|
+
}
|
|
26
|
+
return rest.length > 0 ? get(res, this.joinKeys(rest)) : res;
|
|
49
27
|
});
|
|
50
28
|
}
|
|
51
|
-
loadAPI(...args) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return this.
|
|
56
|
-
return this.loader.loadAPI(...args);
|
|
57
|
-
}));
|
|
29
|
+
async loadAPI(...args) {
|
|
30
|
+
const [api, body] = args;
|
|
31
|
+
const key = body ? `${api}_${JSON.stringify(body)}` : `${api}`;
|
|
32
|
+
return this.limit(key, async () => {
|
|
33
|
+
return this.loader.loadAPI(...args);
|
|
58
34
|
});
|
|
59
35
|
}
|
|
60
36
|
dispose() {
|
package/dist/utils/file.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { get, startsWith } from "lodash-es";
|
|
2
2
|
import { message } from "antd";
|
|
3
3
|
const rootDirname = (file, sep = "/") => {
|
|
4
|
-
const idx = file
|
|
4
|
+
const idx = file?.indexOf(sep);
|
|
5
5
|
if (idx === -1) {
|
|
6
6
|
return null;
|
|
7
7
|
}
|
|
8
8
|
if (idx === 0) {
|
|
9
|
-
return sep + (rootDirname(file
|
|
9
|
+
return sep + (rootDirname(file?.slice(1)) || "");
|
|
10
10
|
}
|
|
11
|
-
return file
|
|
11
|
+
return file?.slice(0, idx);
|
|
12
12
|
};
|
|
13
13
|
function mapFileKey(arr, depth = 2, filter = () => true) {
|
|
14
14
|
let d = 0;
|
|
@@ -59,7 +59,7 @@ function createFileStructures({
|
|
|
59
59
|
const res = files.reduce(
|
|
60
60
|
(t, file) => {
|
|
61
61
|
let dir = rootDirname(file, sep);
|
|
62
|
-
let basename = dir ? file
|
|
62
|
+
let basename = dir ? file?.slice(dir.length + 1) : file;
|
|
63
63
|
let parent = t;
|
|
64
64
|
while (dir) {
|
|
65
65
|
let exist = parent.children.find((e) => e.title === dir);
|
package/dist/utils/hooks.d.ts
CHANGED
|
@@ -10,21 +10,22 @@ export declare function useLoading(defaultLoading?: boolean): {
|
|
|
10
10
|
setLoading: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
11
11
|
withLoading(func: (...args: unknown[]) => Promise<unknown> | unknown): Promise<void>;
|
|
12
12
|
};
|
|
13
|
-
export declare function useProjectRootByManifest(manifest: Manifest.
|
|
14
|
-
export declare function useHashByManifest(manifest: Manifest.
|
|
15
|
-
export declare function useCloudManifestUrlByManifest(manifest: Manifest.
|
|
16
|
-
export declare function useChunkGraphByManifest(manifest: Manifest.
|
|
17
|
-
export declare function useConfigOutputFileNameByManifest(manifest: Manifest.
|
|
18
|
-
export declare function useModuleGraphByManifest(manifest: Manifest.
|
|
13
|
+
export declare function useProjectRootByManifest(manifest: Manifest.RsdoctorManifest): string;
|
|
14
|
+
export declare function useHashByManifest(manifest: Manifest.RsdoctorManifest): string;
|
|
15
|
+
export declare function useCloudManifestUrlByManifest(manifest: Manifest.RsdoctorManifest | Manifest.RsdoctorManifestWithShardingFiles | void): void;
|
|
16
|
+
export declare function useChunkGraphByManifest(manifest: Manifest.RsdoctorManifest): SDK.ChunkGraphData;
|
|
17
|
+
export declare function useConfigOutputFileNameByManifest(manifest: Manifest.RsdoctorManifest): string;
|
|
18
|
+
export declare function useModuleGraphByManifest(manifest: Manifest.RsdoctorManifest): SDK.ModuleGraphData;
|
|
19
19
|
export declare function useModuleGraph(moduleGraph: SDK.ModuleGraphData): SDK.ModuleGraphData;
|
|
20
|
-
export declare function usePackageGraphByManifest(manifest: Manifest.
|
|
21
|
-
export declare function useUniqModulesByManifest(manifest: Manifest.
|
|
20
|
+
export declare function usePackageGraphByManifest(manifest: Manifest.RsdoctorManifest): SDK.PackageGraphData;
|
|
21
|
+
export declare function useUniqModulesByManifest(manifest: Manifest.RsdoctorManifest): SDK.ModuleData[];
|
|
22
22
|
export declare function useUniqModules(modules: SDK.ModuleData[]): SDK.ModuleData[];
|
|
23
|
-
export declare function useErrorsByManifest(manifest: Manifest.
|
|
24
|
-
export declare function useBundleAlertsByManifest(manifest: Manifest.
|
|
25
|
-
export declare function useDuplicatePackagesByManifest(manifest: Manifest.
|
|
26
|
-
export declare function useCompileAlertsByErrors(errors: Manifest.
|
|
27
|
-
export declare function useBundleAlertsByErrors(errors: Manifest.
|
|
28
|
-
export declare function useDuplicatePackagesByErrors(errors: Manifest.
|
|
23
|
+
export declare function useErrorsByManifest(manifest: Manifest.RsdoctorManifest): Rule.RuleStoreData;
|
|
24
|
+
export declare function useBundleAlertsByManifest(manifest: Manifest.RsdoctorManifest): Rule.RuleStoreDataItem[];
|
|
25
|
+
export declare function useDuplicatePackagesByManifest(manifest: Manifest.RsdoctorManifest): Rule.PackageRelationDiffRuleStoreData[];
|
|
26
|
+
export declare function useCompileAlertsByErrors(errors: Manifest.RsdoctorManifestData['errors']): Rule.RuleStoreDataItem[];
|
|
27
|
+
export declare function useBundleAlertsByErrors(errors: Manifest.RsdoctorManifestData['errors']): Rule.RuleStoreDataItem[];
|
|
28
|
+
export declare function useDuplicatePackagesByErrors(errors: Manifest.RsdoctorManifestData['errors']): Rule.PackageRelationDiffRuleStoreData[];
|
|
29
29
|
export declare function useWebpackConfigurationByConfigs(configs?: SDK.ConfigData): SDK.WebpackConfigData | null | undefined;
|
|
30
|
-
export declare function useDetectIfCloudIdeEnv(): boolean;
|
|
30
|
+
export declare function useDetectIfCloudIdeEnv(): boolean;
|
|
31
|
+
export declare function useWindowWidth(): number;
|
package/dist/utils/hooks.js
CHANGED
|
@@ -1,68 +1,19 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
var __async = (__this, __arguments, generator) => {
|
|
33
|
-
return new Promise((resolve, reject) => {
|
|
34
|
-
var fulfilled = (value) => {
|
|
35
|
-
try {
|
|
36
|
-
step(generator.next(value));
|
|
37
|
-
} catch (e) {
|
|
38
|
-
reject(e);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
var rejected = (value) => {
|
|
42
|
-
try {
|
|
43
|
-
step(generator.throw(value));
|
|
44
|
-
} catch (e) {
|
|
45
|
-
reject(e);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
49
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
1
|
import { Algorithm } from "@rsdoctor/utils/common";
|
|
53
2
|
import { Client, Rule } from "@rsdoctor/types";
|
|
54
3
|
import { uniqBy, isArray, defaults } from "lodash-es";
|
|
55
|
-
import { useState } from "react";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
56
5
|
import { useTranslation } from "react-i18next";
|
|
57
6
|
import { useNavigate, useLocation } from "react-router-dom";
|
|
58
7
|
import parse from "url-parse";
|
|
59
8
|
import "./i18n";
|
|
60
9
|
import { setLocaleToStorage } from "./storage";
|
|
61
|
-
const route = Client.
|
|
10
|
+
const route = Client.RsdoctorClientRoutes.RuleIndex;
|
|
62
11
|
const useI18n = () => {
|
|
63
|
-
const
|
|
64
|
-
return
|
|
65
|
-
|
|
12
|
+
const { i18n, ...rest } = useTranslation();
|
|
13
|
+
return {
|
|
14
|
+
...rest,
|
|
15
|
+
i18n: {
|
|
16
|
+
...i18n,
|
|
66
17
|
changeLanguage(lng, callback) {
|
|
67
18
|
return i18n.changeLanguage(lng, (error, t) => {
|
|
68
19
|
if (!error) {
|
|
@@ -71,8 +22,8 @@ const useI18n = () => {
|
|
|
71
22
|
callback && callback(error, t);
|
|
72
23
|
});
|
|
73
24
|
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
76
27
|
};
|
|
77
28
|
function useRuleIndexNavigate(code, link) {
|
|
78
29
|
const navigate = useNavigate();
|
|
@@ -80,7 +31,7 @@ function useRuleIndexNavigate(code, link) {
|
|
|
80
31
|
return () => window.open(link, "__blank");
|
|
81
32
|
}
|
|
82
33
|
return () => {
|
|
83
|
-
navigate(`${route}?${Rule.
|
|
34
|
+
navigate(`${route}?${Rule.RsdoctorRuleClientConstant.UrlQueryForErrorCode}=${code}`);
|
|
84
35
|
};
|
|
85
36
|
}
|
|
86
37
|
function useUrlQuery() {
|
|
@@ -93,15 +44,13 @@ function useLoading(defaultLoading = false) {
|
|
|
93
44
|
return {
|
|
94
45
|
loading,
|
|
95
46
|
setLoading,
|
|
96
|
-
withLoading(func) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
});
|
|
47
|
+
async withLoading(func) {
|
|
48
|
+
try {
|
|
49
|
+
setLoading(true);
|
|
50
|
+
await func();
|
|
51
|
+
} finally {
|
|
52
|
+
setLoading(false);
|
|
53
|
+
}
|
|
105
54
|
}
|
|
106
55
|
};
|
|
107
56
|
}
|
|
@@ -132,9 +81,8 @@ function useChunkGraphByManifest(manifest) {
|
|
|
132
81
|
return ensurePlainObject(manifest.data.chunkGraph, { assets: [], chunks: [], entrypoints: [] });
|
|
133
82
|
}
|
|
134
83
|
function useConfigOutputFileNameByManifest(manifest) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return (_h = (_g = (_f = (_e = manifest.data.configs) == null ? void 0 : _e[0]) == null ? void 0 : _f.config) == null ? void 0 : _g.output) == null ? void 0 : _h.filename;
|
|
84
|
+
if (typeof manifest.data.configs?.[0]?.config?.output?.filename === "string") {
|
|
85
|
+
return manifest.data.configs?.[0]?.config?.output?.filename;
|
|
138
86
|
}
|
|
139
87
|
return "";
|
|
140
88
|
}
|
|
@@ -220,7 +168,7 @@ function useDuplicatePackagesByErrors(errors) {
|
|
|
220
168
|
}
|
|
221
169
|
function useWebpackConfigurationByConfigs(configs = []) {
|
|
222
170
|
if (isArray(configs)) {
|
|
223
|
-
return configs.find((e) => e.name === "webpack");
|
|
171
|
+
return configs.find((e) => e.name === "webpack" || e.name === "rspack");
|
|
224
172
|
}
|
|
225
173
|
return null;
|
|
226
174
|
}
|
|
@@ -230,6 +178,17 @@ function useDetectIfCloudIdeEnv() {
|
|
|
230
178
|
}
|
|
231
179
|
return false;
|
|
232
180
|
}
|
|
181
|
+
function useWindowWidth() {
|
|
182
|
+
const [windowWidth, setWindowWidth] = useState(window.innerWidth);
|
|
183
|
+
useEffect(() => {
|
|
184
|
+
const handleResize = () => setWindowWidth(window.innerWidth);
|
|
185
|
+
window.addEventListener("resize", handleResize);
|
|
186
|
+
return () => {
|
|
187
|
+
window.removeEventListener("resize", handleResize);
|
|
188
|
+
};
|
|
189
|
+
}, []);
|
|
190
|
+
return windowWidth;
|
|
191
|
+
}
|
|
233
192
|
export {
|
|
234
193
|
useBundleAlertsByErrors,
|
|
235
194
|
useBundleAlertsByManifest,
|
|
@@ -252,5 +211,6 @@ export {
|
|
|
252
211
|
useUniqModules,
|
|
253
212
|
useUniqModulesByManifest,
|
|
254
213
|
useUrlQuery,
|
|
255
|
-
useWebpackConfigurationByConfigs
|
|
214
|
+
useWebpackConfigurationByConfigs,
|
|
215
|
+
useWindowWidth
|
|
256
216
|
};
|
package/dist/utils/i18n/cn.js
CHANGED
|
@@ -2,7 +2,7 @@ const cn = {
|
|
|
2
2
|
Overall: "概览",
|
|
3
3
|
"Compile Analysis": "编译分析",
|
|
4
4
|
LoadersAnalysis: "Loaders 分析",
|
|
5
|
-
"Loaders
|
|
5
|
+
"Loaders Timeline": "Loaders 概览",
|
|
6
6
|
"Loaders Analysis": "Loaders 分析",
|
|
7
7
|
PluginsAnalysis: "Plugins 分析",
|
|
8
8
|
ModuleResolve: "Module Resolve 分析",
|
package/dist/utils/i18n/en.d.ts
CHANGED
package/dist/utils/i18n/en.js
CHANGED
|
@@ -2,7 +2,7 @@ const en = {
|
|
|
2
2
|
Overall: "Overall",
|
|
3
3
|
"Compile Analysis": "Compile Analysis",
|
|
4
4
|
LoadersAnalysis: "Loaders Analysis",
|
|
5
|
-
"Loaders
|
|
5
|
+
"Loaders Timeline": "Loaders Timeline",
|
|
6
6
|
"Loaders Analysis": "Loaders Analysis",
|
|
7
7
|
PluginsAnalysis: "Plugins Analysis",
|
|
8
8
|
ModuleResolve: "Module Resolve",
|
package/dist/utils/manifest.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ModuleGraph } from '@rsdoctor/graph';
|
|
2
2
|
import { Manifest, SDK } from '@rsdoctor/types';
|
|
3
3
|
import { Theme, ViewMode } from '../constants';
|
|
4
|
-
export declare function useManifestJson(): Manifest.
|
|
4
|
+
export declare function useManifestJson(): Manifest.RsdoctorManifest;
|
|
5
5
|
export declare function useLocale(): import("../constants").Language;
|
|
6
6
|
export declare function useTheme(): {
|
|
7
7
|
theme: Theme;
|
|
@@ -23,5 +23,5 @@ export declare function useViewMode(): {
|
|
|
23
23
|
isCompileList: boolean;
|
|
24
24
|
isBundleList: boolean;
|
|
25
25
|
};
|
|
26
|
-
export declare function useManifest(url: string): Manifest.
|
|
26
|
+
export declare function useManifest(url: string): Manifest.RsdoctorManifestWithShardingFiles | undefined;
|
|
27
27
|
export declare function useModuleGraphInstanceByModuleGraph(moduleGraph: SDK.ModuleGraphData): ModuleGraph;
|
package/dist/utils/monaco.d.ts
CHANGED
|
@@ -6,4 +6,7 @@ export declare function getRevealPositionForViewer(startLineNumber: number, star
|
|
|
6
6
|
lineNumber: number;
|
|
7
7
|
column: number;
|
|
8
8
|
};
|
|
9
|
-
export declare function getSelectionRange(source: SDK.SourceRange, Range: typeof RangeClass): RangeClass;
|
|
9
|
+
export declare function getSelectionRange(source: SDK.SourceRange, Range: typeof RangeClass): RangeClass;
|
|
10
|
+
export declare function useMonacoEditor(): {
|
|
11
|
+
initMonaco: (monacoRef: any) => Promise<void>;
|
|
12
|
+
};
|
package/dist/utils/monaco.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { extname } from "path";
|
|
2
|
+
import { loader } from "@monaco-editor/react";
|
|
2
3
|
import { isJsDataUrl } from "./url";
|
|
4
|
+
const monacoLoader = loader.init();
|
|
3
5
|
function getOriginalLanguage(filepath) {
|
|
4
6
|
if (isJsDataUrl(filepath)) {
|
|
5
7
|
return "javascript";
|
|
@@ -35,14 +37,35 @@ function getRevealPositionForViewer(startLineNumber, startColumn) {
|
|
|
35
37
|
};
|
|
36
38
|
}
|
|
37
39
|
function getSelectionRange(source, Range) {
|
|
38
|
-
var _a, _b;
|
|
39
40
|
const { start, end } = source;
|
|
40
41
|
const { line = 1, column = 0 } = start;
|
|
41
|
-
return new Range(line, column + 1,
|
|
42
|
+
return new Range(line, column + 1, end?.line ?? line, (end?.column ?? 9999) + 1);
|
|
43
|
+
}
|
|
44
|
+
const initMonaco = (monacoRef) => {
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
if (monacoRef.value) {
|
|
47
|
+
resolve();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
monacoLoader.then((monacoInstance) => {
|
|
51
|
+
monacoRef.value = monacoInstance;
|
|
52
|
+
}).catch((error) => {
|
|
53
|
+
if (error?.type !== "cancelation") {
|
|
54
|
+
console.error("Monaco initialization error:", error);
|
|
55
|
+
reject();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
function useMonacoEditor() {
|
|
61
|
+
return {
|
|
62
|
+
initMonaco
|
|
63
|
+
};
|
|
42
64
|
}
|
|
43
65
|
export {
|
|
44
66
|
getModifiedLanguage,
|
|
45
67
|
getOriginalLanguage,
|
|
46
68
|
getRevealPositionForViewer,
|
|
47
|
-
getSelectionRange
|
|
69
|
+
getSelectionRange,
|
|
70
|
+
useMonacoEditor
|
|
48
71
|
};
|
package/dist/utils/request.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { Manifest, SDK } from '@rsdoctor/types';
|
|
2
2
|
export declare function fetchShardingFile(url: string): Promise<string>;
|
|
3
3
|
export declare function loadManifestByUrl(url: string): Promise<{
|
|
4
|
-
data: Manifest.
|
|
4
|
+
data: Manifest.RsdoctorManifestData;
|
|
5
5
|
__LOCAL__SERVER__?: boolean | undefined;
|
|
6
6
|
__SOCKET__URL__?: string | undefined;
|
|
7
|
-
client: Manifest.
|
|
7
|
+
client: Manifest.RsdoctorManifestClient;
|
|
8
8
|
name?: string | undefined;
|
|
9
|
-
series?: Manifest.
|
|
9
|
+
series?: Manifest.RsdoctorManifestSeriesData[] | undefined;
|
|
10
10
|
}>;
|
|
11
|
-
export declare function fetchJSONByUrl(url: string): Promise<Manifest.
|
|
12
|
-
export declare function fetchJSONByUrls(urls: string[]): Promise<Manifest.
|
|
13
|
-
export declare function parseManifest(json: Manifest.
|
|
14
|
-
data: Manifest.
|
|
11
|
+
export declare function fetchJSONByUrl(url: string): Promise<Manifest.RsdoctorManifestWithShardingFiles>;
|
|
12
|
+
export declare function fetchJSONByUrls(urls: string[]): Promise<Manifest.RsdoctorManifestWithShardingFiles[]>;
|
|
13
|
+
export declare function parseManifest(json: Manifest.RsdoctorManifestWithShardingFiles): Promise<{
|
|
14
|
+
data: Manifest.RsdoctorManifestData;
|
|
15
15
|
__LOCAL__SERVER__?: boolean | undefined;
|
|
16
16
|
__SOCKET__URL__?: string | undefined;
|
|
17
|
-
client: Manifest.
|
|
17
|
+
client: Manifest.RsdoctorManifestClient;
|
|
18
18
|
name?: string | undefined;
|
|
19
|
-
series?: Manifest.
|
|
19
|
+
series?: Manifest.RsdoctorManifestSeriesData[] | undefined;
|
|
20
20
|
}>;
|
|
21
21
|
export declare function getManifestUrl(): string;
|
|
22
|
-
export declare function fetchManifest(url?: string): Promise<Manifest.
|
|
22
|
+
export declare function fetchManifest(url?: string): Promise<Manifest.RsdoctorManifestWithShardingFiles>;
|
|
23
23
|
export declare function postServerAPI<T extends SDK.ServerAPI.API, B extends SDK.ServerAPI.InferRequestBodyType<T> = SDK.ServerAPI.InferRequestBodyType<T>, R extends SDK.ServerAPI.InferResponseType<T> = SDK.ServerAPI.InferResponseType<T>>(...args: B extends void ? [api: T] : [api: T, body: B]): Promise<R>;
|