@rsdoctor/utils 0.0.2-beta.1 → 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/cjs/common/bundle.js +3 -3
- package/dist/cjs/common/graph/assets.js +1 -1
- package/dist/cjs/logger/debug.js +1 -1
- package/dist/esm/common/bundle.js +3 -3
- package/dist/esm/common/graph/assets.js +1 -1
- package/dist/esm/logger/debug.js +1 -1
- package/dist/type/common/graph/assets.d.ts +4 -4
- package/dist/type/common/manifest.d.ts +1 -1
- package/package.json +2 -2
|
@@ -28,7 +28,7 @@ const sep = ",";
|
|
|
28
28
|
function getBundleDiffPageQueryString(files) {
|
|
29
29
|
let qs = encodeURIComponent(files.join(sep));
|
|
30
30
|
if (qs) {
|
|
31
|
-
qs = `?${import_types.Client.
|
|
31
|
+
qs = `?${import_types.Client.RsdoctorClientUrlQuery.BundleDiffFiles}=${qs}`;
|
|
32
32
|
}
|
|
33
33
|
return qs;
|
|
34
34
|
}
|
|
@@ -40,10 +40,10 @@ function getBundleDiffPageUrl(files) {
|
|
|
40
40
|
if (search) {
|
|
41
41
|
qs += `&${search.slice(1)}`;
|
|
42
42
|
}
|
|
43
|
-
return `${origin}${qs}#${import_types.Client.
|
|
43
|
+
return `${origin}${qs}#${import_types.Client.RsdoctorClientRoutes.BundleDiff}`;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
return `${qs}#${import_types.Client.
|
|
46
|
+
return `${qs}#${import_types.Client.RsdoctorClientRoutes.BundleDiff}`;
|
|
47
47
|
}
|
|
48
48
|
function parseFilesFromBundlePageUrlQuery(queryValue) {
|
|
49
49
|
return decodeURIComponent(queryValue).split(sep);
|
|
@@ -189,7 +189,7 @@ function getAssetsDiffResult(baseline, current) {
|
|
|
189
189
|
function diffSize(bSize, cSize) {
|
|
190
190
|
const isEqual = bSize === cSize;
|
|
191
191
|
const percent = isEqual ? 0 : bSize === 0 ? 100 : Math.abs(cSize - bSize) / bSize * 100;
|
|
192
|
-
const state = isEqual ? import_types.Client.
|
|
192
|
+
const state = isEqual ? import_types.Client.RsdoctorClientDiffState.Equal : bSize > cSize ? import_types.Client.RsdoctorClientDiffState.Down : import_types.Client.RsdoctorClientDiffState.Up;
|
|
193
193
|
return { percent, state };
|
|
194
194
|
}
|
|
195
195
|
function diffAssetsByExtensions(baseline, current, filterOrExtensions, isInitial = false) {
|
package/dist/cjs/logger/debug.js
CHANGED
|
@@ -25,7 +25,7 @@ var import_types = require("@rsdoctor/types");
|
|
|
25
25
|
var import_logger = require("./logger");
|
|
26
26
|
let debugLogger;
|
|
27
27
|
function debug(getMsg, prefix = "") {
|
|
28
|
-
if (!process.env[import_types.Constants.
|
|
28
|
+
if (!process.env[import_types.Constants.RsdoctorProcessEnvDebugKey])
|
|
29
29
|
return;
|
|
30
30
|
if (!debugLogger) {
|
|
31
31
|
debugLogger = (0, import_logger.createLogger)({ level: "Debug" });
|
|
@@ -3,7 +3,7 @@ const sep = ",";
|
|
|
3
3
|
function getBundleDiffPageQueryString(files) {
|
|
4
4
|
let qs = encodeURIComponent(files.join(sep));
|
|
5
5
|
if (qs) {
|
|
6
|
-
qs = `?${Client.
|
|
6
|
+
qs = `?${Client.RsdoctorClientUrlQuery.BundleDiffFiles}=${qs}`;
|
|
7
7
|
}
|
|
8
8
|
return qs;
|
|
9
9
|
}
|
|
@@ -15,10 +15,10 @@ function getBundleDiffPageUrl(files) {
|
|
|
15
15
|
if (search) {
|
|
16
16
|
qs += `&${search.slice(1)}`;
|
|
17
17
|
}
|
|
18
|
-
return `${origin}${qs}#${Client.
|
|
18
|
+
return `${origin}${qs}#${Client.RsdoctorClientRoutes.BundleDiff}`;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
return `${qs}#${Client.
|
|
21
|
+
return `${qs}#${Client.RsdoctorClientRoutes.BundleDiff}`;
|
|
22
22
|
}
|
|
23
23
|
function parseFilesFromBundlePageUrlQuery(queryValue) {
|
|
24
24
|
return decodeURIComponent(queryValue).split(sep);
|
|
@@ -154,7 +154,7 @@ function getAssetsDiffResult(baseline, current) {
|
|
|
154
154
|
function diffSize(bSize, cSize) {
|
|
155
155
|
const isEqual = bSize === cSize;
|
|
156
156
|
const percent = isEqual ? 0 : bSize === 0 ? 100 : Math.abs(cSize - bSize) / bSize * 100;
|
|
157
|
-
const state = isEqual ? Client.
|
|
157
|
+
const state = isEqual ? Client.RsdoctorClientDiffState.Equal : bSize > cSize ? Client.RsdoctorClientDiffState.Down : Client.RsdoctorClientDiffState.Up;
|
|
158
158
|
return { percent, state };
|
|
159
159
|
}
|
|
160
160
|
function diffAssetsByExtensions(baseline, current, filterOrExtensions, isInitial = false) {
|
package/dist/esm/logger/debug.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Constants } from "@rsdoctor/types";
|
|
|
2
2
|
import { createLogger } from "./logger";
|
|
3
3
|
let debugLogger;
|
|
4
4
|
function debug(getMsg, prefix = "") {
|
|
5
|
-
if (!process.env[Constants.
|
|
5
|
+
if (!process.env[Constants.RsdoctorProcessEnvDebugKey])
|
|
6
6
|
return;
|
|
7
7
|
if (!debugLogger) {
|
|
8
8
|
debugLogger = createLogger({ level: "Debug" });
|
|
@@ -37,16 +37,16 @@ export declare function getInitialAssetsSizeInfo(assets: SDK.AssetData[], chunks
|
|
|
37
37
|
content: string | undefined;
|
|
38
38
|
}[];
|
|
39
39
|
};
|
|
40
|
-
export declare function getAssetsDiffResult(baseline: SDK.ChunkGraphData, current: SDK.ChunkGraphData): Client.
|
|
40
|
+
export declare function getAssetsDiffResult(baseline: SDK.ChunkGraphData, current: SDK.ChunkGraphData): Client.RsdoctorClientAssetsDiffResult;
|
|
41
41
|
/**
|
|
42
42
|
* @param bSize size of baseline
|
|
43
43
|
* @param cSize size of current
|
|
44
44
|
*/
|
|
45
45
|
export declare function diffSize(bSize: number, cSize: number): {
|
|
46
46
|
percent: number;
|
|
47
|
-
state: Client.
|
|
47
|
+
state: Client.RsdoctorClientDiffState;
|
|
48
48
|
};
|
|
49
|
-
export declare function diffAssetsByExtensions(baseline: SDK.ChunkGraphData, current: SDK.ChunkGraphData, filterOrExtensions?: FilterFunctionOrExtensions, isInitial?: boolean): Client.
|
|
50
|
-
export declare function getAssetsSummary(assets: SDK.AssetData[], chunks: SDK.ChunkData[], options?: Omit<GetAssetsOptions, 'filterOrExtensions'>): Client.
|
|
49
|
+
export declare function diffAssetsByExtensions(baseline: SDK.ChunkGraphData, current: SDK.ChunkGraphData, filterOrExtensions?: FilterFunctionOrExtensions, isInitial?: boolean): Client.RsdoctorClientAssetsDiffItem;
|
|
50
|
+
export declare function getAssetsSummary(assets: SDK.AssetData[], chunks: SDK.ChunkData[], options?: Omit<GetAssetsOptions, 'filterOrExtensions'>): Client.RsdoctorClientAssetsSummary;
|
|
51
51
|
export declare function getAssetDetails(assetPath: string, assets: SDK.AssetData[], chunks: SDK.ChunkData[], modules: SDK.ModuleData[]): SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetAssetDetails>;
|
|
52
52
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Manifest } from '@rsdoctor/types';
|
|
2
2
|
export declare function isShardingData(data: unknown): data is string[];
|
|
3
3
|
export declare function fetchShardingData(shardingFiles: string[], fetchImplement: (url: string) => Promise<string>): Promise<any>;
|
|
4
|
-
export declare function fetchShardingFiles(data: Manifest.
|
|
4
|
+
export declare function fetchShardingFiles(data: Manifest.RsdoctorManifestWithShardingFiles['data'], fetchImplement: (url: string) => Promise<string>, filterKeys?: Array<keyof Manifest.RsdoctorManifestData>): Promise<Manifest.RsdoctorManifestData>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/utils",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"lines-and-columns": "2.0.4",
|
|
62
62
|
"lodash": "^4.17.21",
|
|
63
63
|
"strip-ansi": "^6.0.1",
|
|
64
|
-
"@rsdoctor/types": "0.0.2-beta.
|
|
64
|
+
"@rsdoctor/types": "0.0.2-beta.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/deep-eql": "4.0.0",
|