@rsdoctor/utils 0.1.0 → 0.1.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/README.md +10 -3
- package/dist/cjs/{logger/debug.js → logger.js} +24 -11
- package/dist/esm/logger.js +15 -0
- package/dist/type/build/envinfo.d.ts +1 -1
- package/dist/type/build/file/cache.d.ts +1 -1
- package/dist/type/build/file/index.d.ts +1 -1
- package/dist/type/build/file/sharding.d.ts +20 -20
- package/dist/type/build/index.d.ts +1 -1
- package/dist/type/build/json.d.ts +1 -1
- package/dist/type/build/process.d.ts +1 -1
- package/dist/type/build/server.d.ts +5 -5
- package/dist/type/common/alerts.d.ts +1 -1
- package/dist/type/common/algorithm.d.ts +1 -1
- package/dist/type/common/bundle.d.ts +1 -1
- package/dist/type/common/crypto.d.ts +1 -1
- package/dist/type/common/data/index.d.ts +5 -5
- package/dist/type/common/graph/assets.d.ts +26 -26
- package/dist/type/common/graph/chunk.d.ts +1 -1
- package/dist/type/common/graph/dependency.d.ts +1 -1
- package/dist/type/common/graph/entrypoints.d.ts +1 -1
- package/dist/type/common/graph/index.d.ts +1 -1
- package/dist/type/common/graph/modules.d.ts +1 -1
- package/dist/type/common/index.d.ts +1 -1
- package/dist/type/common/loader.d.ts +3 -3
- package/dist/type/common/manifest.d.ts +1 -1
- package/dist/type/common/package.d.ts +1 -1
- package/dist/type/common/plugin.d.ts +1 -1
- package/dist/type/common/resolver.d.ts +1 -1
- package/dist/type/common/rspack.d.ts +5 -5
- package/dist/type/common/summary.d.ts +5 -5
- package/dist/type/common/time.d.ts +1 -1
- package/dist/type/common/url.d.ts +1 -1
- package/dist/type/error/error.d.ts +33 -33
- package/dist/type/error/index.d.ts +1 -1
- package/dist/type/error/transform.d.ts +1 -1
- package/dist/type/error/utils.d.ts +1 -4
- package/dist/type/index.d.ts +1 -1
- package/dist/type/logger.d.ts +7 -0
- package/dist/type/rule-utils/document/document.d.ts +13 -13
- package/dist/type/rule-utils/document/index.d.ts +1 -1
- package/dist/type/rule-utils/document/server.d.ts +1 -1
- package/dist/type/rule-utils/document/types.d.ts +16 -16
- package/dist/type/rule-utils/index.d.ts +1 -1
- package/dist/type/rule-utils/parser/asserts.d.ts +79 -79
- package/dist/type/rule-utils/parser/index.d.ts +1 -1
- package/dist/type/rule-utils/parser/parser.d.ts +108 -108
- package/dist/type/rule-utils/parser/types.d.ts +20 -20
- package/dist/type/rule-utils/parser/utils.d.ts +1 -1
- package/package.json +6 -5
- package/dist/cjs/logger/index.js +0 -24
- package/dist/cjs/logger/logger.js +0 -118
- package/dist/esm/logger/debug.js +0 -14
- package/dist/esm/logger/index.js +0 -2
- package/dist/esm/logger/logger.js +0 -82
- package/dist/type/logger/debug.d.ts +0 -4
- package/dist/type/logger/index.d.ts +0 -2
- package/dist/type/logger/logger.d.ts +0 -16
package/README.md
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
# Rsdoctor
|
|
1
|
+
# Rsdoctor Utils
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package is the Rsdoctor‘s tools package.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## features
|
|
6
|
+
|
|
7
|
+
- Rsdoctor is a one-stop tool for diagnosing and analyzing the build process and build artifacts.
|
|
8
|
+
- Rsdoctor is a tool that supports Webpack and Rspack build analysis.
|
|
9
|
+
- Rsdoctor is an analysis tool that can display the time-consuming and behavioral details of the compilation.
|
|
10
|
+
- Rsdoctor is a tool that provides bundle Diff and other anti-degradation capabilities simultaneously.
|
|
6
11
|
|
|
7
12
|
## Documentation
|
|
8
13
|
|
|
14
|
+
https://rsdoctor.dev/
|
|
15
|
+
|
|
9
16
|
## Contributing
|
|
10
17
|
|
|
11
18
|
Please read the [Contributing Guide](https://github.com/web-infra-dev/rsdoctor/blob/main/CONTRIBUTING.md).
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,24 +17,35 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
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
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
29
|
+
var logger_exports = {};
|
|
30
|
+
__export(logger_exports, {
|
|
31
|
+
chalk: () => import_chalk.default,
|
|
32
|
+
debug: () => debug,
|
|
33
|
+
logger: () => import_rslog.logger
|
|
22
34
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
35
|
+
module.exports = __toCommonJS(logger_exports);
|
|
36
|
+
var import_chalk = __toESM(require("chalk"));
|
|
37
|
+
var import_rslog = require("rslog");
|
|
24
38
|
var import_types = require("@rsdoctor/types");
|
|
25
|
-
var import_logger = require("./logger");
|
|
26
|
-
let debugLogger;
|
|
27
39
|
function debug(getMsg, prefix = "") {
|
|
28
|
-
if (!process.env[import_types.Constants.RsdoctorProcessEnvDebugKey])
|
|
40
|
+
if (!process.env[import_types.Constants.RsdoctorProcessEnvDebugKey]) {
|
|
29
41
|
return;
|
|
30
|
-
if (!debugLogger) {
|
|
31
|
-
debugLogger = (0, import_logger.createLogger)({ level: "Debug" });
|
|
32
42
|
}
|
|
33
|
-
|
|
43
|
+
import_rslog.logger.level = "verbose";
|
|
44
|
+
import_rslog.logger.debug(`${prefix} ${getMsg()}`);
|
|
34
45
|
}
|
|
35
46
|
// Annotate the CommonJS export names for ESM import in node:
|
|
36
47
|
0 && (module.exports = {
|
|
37
|
-
|
|
48
|
+
chalk,
|
|
49
|
+
debug,
|
|
50
|
+
logger
|
|
38
51
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { logger } from "rslog";
|
|
3
|
+
import { Constants } from "@rsdoctor/types";
|
|
4
|
+
function debug(getMsg, prefix = "") {
|
|
5
|
+
if (!process.env[Constants.RsdoctorProcessEnvDebugKey]) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
logger.level = "verbose";
|
|
9
|
+
logger.debug(`${prefix} ${getMsg()}`);
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
chalk,
|
|
13
|
+
debug,
|
|
14
|
+
logger
|
|
15
|
+
};
|
|
@@ -9,4 +9,4 @@ export declare function getNpmPackageVersion(pkgs: string[]): Promise<string[]>;
|
|
|
9
9
|
export declare function getGlobalNpmPackageVersion(pkg: string): Promise<string>;
|
|
10
10
|
export declare function getGlobalNpmPackageVersion(pkgs: string[]): Promise<string[]>;
|
|
11
11
|
export declare function getGitBranch(): Promise<string>;
|
|
12
|
-
export declare function getGitRepo(): Promise<string>;
|
|
12
|
+
export declare function getGitRepo(): Promise<string>;
|
|
@@ -2,4 +2,4 @@ import { Common } from '@rsdoctor/types';
|
|
|
2
2
|
export declare function readFile(path: string): Promise<string>;
|
|
3
3
|
export declare function readFileSync(path: string): string;
|
|
4
4
|
export declare function readJSON<T extends Common.PlainObject>(path: string): Promise<T>;
|
|
5
|
-
export declare function readJSONSync<T extends Common.PlainObject>(path: string): T;
|
|
5
|
+
export declare function readJSONSync<T extends Common.PlainObject>(path: string): T;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
export declare class FileSharding {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
3
|
+
protected content: string;
|
|
4
|
+
protected limitBytes: number;
|
|
5
|
+
protected encoding: BufferEncoding;
|
|
6
|
+
constructor(content: string, limitBytes?: number, encoding?: BufferEncoding);
|
|
7
|
+
/**
|
|
8
|
+
* @param ext the extension name of the output file (must starts with ".")
|
|
9
|
+
*/
|
|
10
|
+
createVirtualShardingFiles(ext?: string): {
|
|
11
|
+
filename: string;
|
|
12
|
+
content: Buffer;
|
|
13
|
+
}[];
|
|
14
|
+
/**
|
|
15
|
+
* @param folder absolute path of folder which used to save string sharding files.
|
|
16
|
+
* @param ext the extension name of the output file (must starts with ".")
|
|
17
|
+
*/
|
|
18
|
+
writeStringToFolder(folder: string, ext?: string): Promise<{
|
|
19
|
+
filename: string;
|
|
20
|
+
content: Buffer;
|
|
21
|
+
}[]>;
|
|
22
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function stringify<T, P = T extends undefined ? undefined : string>(json: T, replacer?: (this: any, key: string, value: any) => any, space?: string | number, cycle?: boolean): Promise<P>;
|
|
1
|
+
export declare function stringify<T, P = T extends undefined ? undefined : string>(json: T, replacer?: (this: any, key: string, value: any) => any, space?: string | number, cycle?: boolean): Promise<P>;
|
|
@@ -8,8 +8,8 @@ export declare const createGetPortSyncFunctionString: (expectPort: number) => st
|
|
|
8
8
|
export declare function getPortSync(expectPort: number): number | never;
|
|
9
9
|
export declare function createApp(): connect.Server;
|
|
10
10
|
export declare function createServer(port: number): Promise<{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}>;
|
|
11
|
+
app: Thirdparty.connect.Server;
|
|
12
|
+
server: http.Server;
|
|
13
|
+
port: number;
|
|
14
|
+
close(): Promise<void> | never;
|
|
15
|
+
}>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Rule, SDK } from '@rsdoctor/types';
|
|
2
|
-
export declare function getPackageRelationAlertDetails(modules: SDK.ModuleGraphData['modules'], dependencies: SDK.ModuleGraphData['dependencies'], root: string, packageDependencies: Rule.DependencyWithPackageData[], moduleCodeMap: SDK.ModuleCodeData): SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPackageRelationAlertDetails>;
|
|
2
|
+
export declare function getPackageRelationAlertDetails(modules: SDK.ModuleGraphData['modules'], dependencies: SDK.ModuleGraphData['dependencies'], root: string, packageDependencies: Rule.DependencyWithPackageData[], moduleCodeMap: SDK.ModuleCodeData): SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPackageRelationAlertDetails>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function mergeIntervals(intervals: [number, number][]): [number, number][];
|
|
2
2
|
export declare function compressText(input: string): string;
|
|
3
3
|
export declare function decompressText(input: string): string;
|
|
4
|
-
export declare function random(min: number, max: number): number;
|
|
4
|
+
export declare function random(min: number, max: number): number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare function getBundleDiffPageQueryString(files: string[]): string;
|
|
2
2
|
export declare function getBundleDiffPageUrl(files: string[]): string;
|
|
3
|
-
export declare function parseFilesFromBundlePageUrlQuery(queryValue: string): string[];
|
|
3
|
+
export declare function parseFilesFromBundlePageUrlQuery(queryValue: string): string[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare function encode(str: string): string;
|
|
2
|
-
export declare function decode(str: string): string;
|
|
2
|
+
export declare function decode(str: string): string;
|
|
@@ -3,8 +3,8 @@ import { SDK, Manifest } from '@rsdoctor/types';
|
|
|
3
3
|
* this class will run at both brower and node environment.
|
|
4
4
|
*/
|
|
5
5
|
export declare class APIDataLoader {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
6
|
+
protected loader: Manifest.ManifestDataLoader;
|
|
7
|
+
constructor(loader: Manifest.ManifestDataLoader);
|
|
8
|
+
log(...args: unknown[]): void;
|
|
9
|
+
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<SDK.ServerAPI.InferResponseType<T>>;
|
|
10
|
+
}
|
|
@@ -5,37 +5,37 @@ export declare function isAssetMatchExtensions(asset: SDK.AssetData, exts: strin
|
|
|
5
5
|
export declare function filterAssetsByExtensions(assets: SDK.AssetData[], exts: string | string[]): SDK.AssetData[];
|
|
6
6
|
type FilterFunctionOrExtensions = string | string[] | ((asset: SDK.AssetData) => boolean);
|
|
7
7
|
interface GetAssetsOptions {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
/**
|
|
9
|
+
* turn off it when you need not file content.
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
withFileContent?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* filter with assets
|
|
15
|
+
*/
|
|
16
|
+
filterOrExtensions?: FilterFunctionOrExtensions;
|
|
17
17
|
}
|
|
18
18
|
export declare function filterAssets(assets: SDK.AssetData[], filterOrExtensions?: FilterFunctionOrExtensions): SDK.AssetData[];
|
|
19
19
|
export declare function getAssetsSizeInfo(assets: SDK.AssetData[], chunks: SDK.ChunkData[], options?: GetAssetsOptions): {
|
|
20
|
-
|
|
21
|
-
size: number;
|
|
22
|
-
files: {
|
|
23
|
-
path: string;
|
|
20
|
+
count: number;
|
|
24
21
|
size: number;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
files: {
|
|
23
|
+
path: string;
|
|
24
|
+
size: number;
|
|
25
|
+
initial: boolean;
|
|
26
|
+
content: string | undefined;
|
|
27
|
+
}[];
|
|
28
28
|
};
|
|
29
29
|
export declare function isInitialAsset(asset: SDK.AssetData, chunks: SDK.ChunkData[]): boolean;
|
|
30
30
|
export declare function getInitialAssetsSizeInfo(assets: SDK.AssetData[], chunks: SDK.ChunkData[], options?: GetAssetsOptions): {
|
|
31
|
-
|
|
32
|
-
size: number;
|
|
33
|
-
files: {
|
|
34
|
-
path: string;
|
|
31
|
+
count: number;
|
|
35
32
|
size: number;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
files: {
|
|
34
|
+
path: string;
|
|
35
|
+
size: number;
|
|
36
|
+
initial: boolean;
|
|
37
|
+
content: string | undefined;
|
|
38
|
+
}[];
|
|
39
39
|
};
|
|
40
40
|
export declare function getAssetsDiffResult(baseline: SDK.ChunkGraphData, current: SDK.ChunkGraphData): Client.RsdoctorClientAssetsDiffResult;
|
|
41
41
|
/**
|
|
@@ -43,10 +43,10 @@ export declare function getAssetsDiffResult(baseline: SDK.ChunkGraphData, curren
|
|
|
43
43
|
* @param cSize size of current
|
|
44
44
|
*/
|
|
45
45
|
export declare function diffSize(bSize: number, cSize: number): {
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
percent: number;
|
|
47
|
+
state: Client.RsdoctorClientDiffState;
|
|
48
48
|
};
|
|
49
49
|
export declare function diffAssetsByExtensions(baseline: SDK.ChunkGraphData, current: SDK.ChunkGraphData, filterOrExtensions?: FilterFunctionOrExtensions, isInitial?: boolean): Client.RsdoctorClientAssetsDiffItem;
|
|
50
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
|
-
export {};
|
|
52
|
+
export {};
|
|
@@ -4,4 +4,4 @@ export declare function getChunksByModule(module: SDK.ModuleData, chunks: SDK.Ch
|
|
|
4
4
|
export declare function getChunkByChunkId(chunkId: string, chunks: SDK.ChunkData[]): SDK.ChunkData;
|
|
5
5
|
export declare function getChunksByChunkIds(chunkIds: string[], chunks: SDK.ChunkData[]): SDK.ChunkData[];
|
|
6
6
|
export declare function getChunksByAsset(asset: SDK.AssetData, chunks: SDK.ChunkData[]): SDK.ChunkData[];
|
|
7
|
-
export declare function getChunksByModuleId(id: number, modules: SDK.ModuleData[], chunks: SDK.ChunkData[]): SDK.ChunkData[];
|
|
7
|
+
export declare function getChunksByModuleId(id: number, modules: SDK.ModuleData[], chunks: SDK.ChunkData[]): SDK.ChunkData[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Rule, SDK } from '@rsdoctor/types';
|
|
2
2
|
export declare function getDependencyByPackageData(dep: Rule.DependencyWithPackageData, dependencies: SDK.DependencyData[]): SDK.DependencyData | undefined;
|
|
3
3
|
export declare function getDependenciesByModule(module: SDK.ModuleData, dependencies: SDK.DependencyData[]): SDK.DependencyData[];
|
|
4
|
-
export declare function getDependencyByResolvedRequest(resolvedRequest: string, dependencies: SDK.DependencyData[]): SDK.DependencyData | undefined;
|
|
4
|
+
export declare function getDependencyByResolvedRequest(resolvedRequest: string, dependencies: SDK.DependencyData[]): SDK.DependencyData | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SDK } from '@rsdoctor/types';
|
|
2
|
-
export declare function getEntryPoints(entrypoints: SDK.EntryPointData[]): SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetEntryPoints>;
|
|
2
|
+
export declare function getEntryPoints(entrypoints: SDK.EntryPointData[]): SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetEntryPoints>;
|
|
@@ -6,4 +6,4 @@ export declare function getModulesByChunk(chunk: SDK.ChunkData, modules: SDK.Mod
|
|
|
6
6
|
export declare function getModulesByChunks(chunks: SDK.ChunkData[], modules: SDK.ModuleData[]): SDK.ModuleData[];
|
|
7
7
|
export declare function getModuleByDependency(dep: SDK.DependencyData, modules: SDK.ModuleData[]): SDK.ModuleData | undefined;
|
|
8
8
|
export declare function filterModulesAndDependenciesByPackageDeps(deps: Rule.DependencyWithPackageData[], dependencies: SDK.DependencyData[], modules: SDK.ModuleData[]): Pick<SDK.ModuleGraphData, 'dependencies' | 'modules'>;
|
|
9
|
-
export declare function getModuleDetails(moduleId: number, modules: SDK.ModuleData[], dependencies: SDK.DependencyData[]): SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetModuleDetails>;
|
|
9
|
+
export declare function getModuleDetails(moduleId: number, modules: SDK.ModuleData[], dependencies: SDK.DependencyData[]): SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetModuleDetails>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SDK } from '@rsdoctor/types';
|
|
2
2
|
export declare function findLoaderTotalTiming(loaders: Pick<SDK.LoaderTransformData, 'startAt' | 'endAt'>[]): {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
start: number;
|
|
4
|
+
end: number;
|
|
5
5
|
};
|
|
6
6
|
export declare function getLoadersCosts(filter: (loader: Pick<SDK.LoaderTransformData, 'loader' | 'startAt' | 'endAt' | 'pid'>) => boolean, loaders: Pick<SDK.LoaderTransformData, 'loader' | 'startAt' | 'endAt' | 'pid'>[]): number;
|
|
7
7
|
export declare function getLoaderCosts(loader: SDK.LoaderTransformData, loaders: SDK.LoaderTransformData[]): number;
|
|
@@ -13,4 +13,4 @@ export declare function getLoaderFileDetails(path: string, loaders: SDK.LoaderDa
|
|
|
13
13
|
export declare function getLoaderFolderStatistics(folder: string, loaders: SDK.LoaderData): SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFolderStatistics>;
|
|
14
14
|
export declare function getLoaderFileFirstInput(file: string, loaders: SDK.LoaderData): SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFileFirstInput>;
|
|
15
15
|
export declare function getLoaderFileInputAndOutput(file: string, loader: string, loaderIndex: number, loaders: SDK.LoaderData): SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFileInputAndOutput>;
|
|
16
|
-
export declare const LoaderInternalPropertyName = "__l__";
|
|
16
|
+
export declare const LoaderInternalPropertyName = "__l__";
|
|
@@ -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.RsdoctorManifestWithShardingFiles['data'], fetchImplement: (url: string) => Promise<string>, filterKeys?: Array<keyof Manifest.RsdoctorManifestData>): Promise<Manifest.RsdoctorManifestData>;
|
|
4
|
+
export declare function fetchShardingFiles(data: Manifest.RsdoctorManifestWithShardingFiles['data'], fetchImplement: (url: string) => Promise<string>, filterKeys?: Array<keyof Manifest.RsdoctorManifestData>): Promise<Manifest.RsdoctorManifestData>;
|
|
@@ -4,4 +4,4 @@ export declare const PACKAGE_PATH_NAME: RegExp;
|
|
|
4
4
|
/**
|
|
5
5
|
* Heuristics to extract package id, name, and path from a module path
|
|
6
6
|
*/
|
|
7
|
-
export declare const getPackageMetaFromModulePath: (modulePath: string) => SDK.PackageJSONData;
|
|
7
|
+
export declare const getPackageMetaFromModulePath: (modulePath: string) => SDK.PackageJSONData;
|
|
@@ -2,4 +2,4 @@ import { SDK } from '@rsdoctor/types';
|
|
|
2
2
|
export declare function getPluginHooks(plugin: SDK.PluginData): string[];
|
|
3
3
|
export declare function getPluginTapNames(plugin: SDK.PluginData): string[];
|
|
4
4
|
export declare function getPluginSummary(plugin: SDK.PluginData): SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPluginSummary>;
|
|
5
|
-
export declare function getPluginData(plugin: SDK.PluginData, selectedHooks?: string[], selectedTapNames?: string[]): SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPluginData>;
|
|
5
|
+
export declare function getPluginData(plugin: SDK.PluginData, selectedHooks?: string[], selectedTapNames?: string[]): SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPluginData>;
|
|
@@ -3,4 +3,4 @@ export declare function isResolveSuccessData(data: SDK.PathResolverData): data i
|
|
|
3
3
|
export declare function isResolveFailData(data: SDK.PathResolverData): data is SDK.PathResolverSuccessData;
|
|
4
4
|
export declare function getResolverCosts(resolver: SDK.PathResolverData, resolvers: SDK.ResolverData): number;
|
|
5
5
|
export declare function getResolverFileTree(resolver: SDK.ResolverData): SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetResolverFileTree>;
|
|
6
|
-
export declare function getResolverFileDetails(filepath: string, resolvers: SDK.ResolverData, modules: SDK.ModuleData[], moduleCodeMap: SDK.ModuleCodeData): SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetResolverFileDetails>;
|
|
6
|
+
export declare function getResolverFileDetails(filepath: string, resolvers: SDK.ResolverData, modules: SDK.ModuleData[], moduleCodeMap: SDK.ModuleCodeData): SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetResolverFileDetails>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const RspackLoaderInternalPropertyName = "__l__";
|
|
2
2
|
export declare enum RspackSummaryCostsDataName {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
3
|
+
Bootstrap = "bootstrap->rspack:beforeCompile",
|
|
4
|
+
Compile = "rspack:beforeCompile->afterCompile",
|
|
5
|
+
Done = "rspack:afterCompile->done",
|
|
6
|
+
Minify = "rspack:minify(rspack:optimizeChunkAssets)"
|
|
7
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare enum SummaryCostsDataName {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
2
|
+
Bootstrap = "bootstrap->beforeCompile",
|
|
3
|
+
Compile = "beforeCompile->afterCompile",
|
|
4
|
+
Done = "afterCompile->done",
|
|
5
|
+
Minify = "minify(webpack4:optimizeChunkAssets|webpack5:processAssets|rspack:processAssets)"
|
|
6
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function toFixedDigits(num: number, digits?: number): number;
|
|
2
2
|
export declare function getUnit(num: number, type: 'm' | 'h'): string;
|
|
3
3
|
export declare function formatCosts(costs: number | string): string;
|
|
4
|
-
export declare function getCurrentTimestamp(start: number, startHRTime: [number, number]): number;
|
|
4
|
+
export declare function getCurrentTimestamp(start: number, startHRTime: [number, number]): number;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import { Err, Rule } from '@rsdoctor/types';
|
|
2
2
|
export declare class DevToolError extends Error implements Err.DevToolErrorInstance {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
}
|
|
3
|
+
static from(err: unknown, opt?: Err.DevToolErrorParams): DevToolError;
|
|
4
|
+
readonly id: number;
|
|
5
|
+
readonly code?: string;
|
|
6
|
+
readonly category?: string;
|
|
7
|
+
readonly title: string;
|
|
8
|
+
readonly detail?: any;
|
|
9
|
+
readonly fixData?: Err.FixData;
|
|
10
|
+
readonly hint?: string;
|
|
11
|
+
readonly referenceUrl?: string;
|
|
12
|
+
private _codeFrame?;
|
|
13
|
+
private _controller;
|
|
14
|
+
private readonly _level;
|
|
15
|
+
constructor(title: string, message: string, opts?: Err.DevToolErrorParams);
|
|
16
|
+
get level(): "Ignore" | "Warn" | "Error";
|
|
17
|
+
get path(): string | undefined;
|
|
18
|
+
set path(file: string | undefined);
|
|
19
|
+
get codeFrame(): Err.CodeFrameOption | undefined;
|
|
20
|
+
private printCodeFrame;
|
|
21
|
+
toString(): string;
|
|
22
|
+
toData(): Rule.RuleStoreDataItem;
|
|
23
|
+
toError(): Error;
|
|
24
|
+
/**
|
|
25
|
+
* for json stringify
|
|
26
|
+
*/
|
|
27
|
+
toJSON(): {
|
|
28
|
+
message: string;
|
|
29
|
+
name: string;
|
|
30
|
+
stack: string | undefined;
|
|
31
|
+
};
|
|
32
|
+
setControllerOption(opt: Err.ControllerOption): void;
|
|
33
|
+
setCodeFrame(opt: Err.CodeFrameOption): void;
|
|
34
|
+
isSame(error: Err.DevToolErrorInstance): boolean;
|
|
35
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './error';
|
|
2
|
-
export { printErrors } from './utils';
|
|
2
|
+
export { printErrors } from './utils';
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { Err, Logger } from '@rsdoctor/types';
|
|
2
2
|
export declare function toLevel(level: keyof typeof Err.ErrorLevel): Err.ErrorLevel;
|
|
3
3
|
export declare function insertSpace(rawLines: string, line: number, width: number): string;
|
|
4
|
-
export declare function printErrors({
|
|
5
|
-
errors,
|
|
6
|
-
warnings
|
|
7
|
-
}: Err.DevToolErrorsData, logLevel?: Logger.LogLevelName): string;
|
|
4
|
+
export declare function printErrors({ errors, warnings }: Err.DevToolErrorsData, logLevel?: Logger.LogLevelName): string;
|
package/dist/type/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * as RuleUtils from './rule-utils';
|
|
2
|
-
export * as Logger from './logger';
|
|
2
|
+
export * as Logger from './logger';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Range, OffsetRange, Position, DocumentEditData } from './types';
|
|
2
2
|
/** Document Catalogue */
|
|
3
3
|
export declare class Document {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
4
|
+
/** Actual document content. */
|
|
5
|
+
private _text;
|
|
6
|
+
/** Get the displacement of the file position in the text. */
|
|
7
|
+
positionAt: (offset: number) => Position | undefined;
|
|
8
|
+
/** Get the position of the displacement point in the file. */
|
|
9
|
+
offsetAt: (position: Position) => number | undefined;
|
|
10
|
+
constructor(content: string);
|
|
11
|
+
/** Generate location search */
|
|
12
|
+
private createFinder;
|
|
13
|
+
getText(range?: Range | OffsetRange): string;
|
|
14
|
+
/** Edit document data */
|
|
15
|
+
edit(data: DocumentEditData): string | undefined;
|
|
16
|
+
}
|