@rsdoctor/sdk 1.5.9 → 1.5.10

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.
Files changed (36) hide show
  1. package/dist/{1~344.cjs → 1~765.cjs} +1 -1
  2. package/dist/index.cjs +6 -6
  3. package/dist/index.d.cts +1 -0
  4. package/dist/index.js +4 -4
  5. package/dist/sdk/index.d.cts +2 -0
  6. package/dist/sdk/multiple/controller.d.cts +12 -0
  7. package/dist/sdk/multiple/index.d.cts +2 -0
  8. package/dist/sdk/multiple/primary.d.cts +32 -0
  9. package/dist/sdk/multiple/server.d.cts +7 -0
  10. package/dist/sdk/sdk/core.d.cts +33 -0
  11. package/dist/sdk/sdk/index.d.cts +51 -0
  12. package/dist/sdk/sdk/types.d.cts +28 -0
  13. package/dist/sdk/server/apis/alerts.d.cts +5 -0
  14. package/dist/sdk/server/apis/base.d.cts +11 -0
  15. package/dist/sdk/server/apis/bundle-diff.d.cts +6 -0
  16. package/dist/sdk/server/apis/data.d.cts +6 -0
  17. package/dist/sdk/server/apis/fs.d.cts +5 -0
  18. package/dist/sdk/server/apis/graph.d.cts +12 -0
  19. package/dist/sdk/server/apis/index.d.cts +9 -0
  20. package/dist/sdk/server/apis/loader.d.cts +15 -0
  21. package/dist/sdk/server/apis/plugin.d.cts +6 -0
  22. package/dist/sdk/server/apis/project.d.cts +8 -0
  23. package/dist/sdk/server/apis/renderer.d.cts +6 -0
  24. package/dist/sdk/server/apis/resolver.d.cts +6 -0
  25. package/dist/sdk/server/fakeServer.d.cts +7 -0
  26. package/dist/sdk/server/index.d.cts +37 -0
  27. package/dist/sdk/server/router.d.cts +24 -0
  28. package/dist/sdk/server/socket/api.d.cts +15 -0
  29. package/dist/sdk/server/socket/index.d.cts +26 -0
  30. package/dist/sdk/server/utils.d.cts +6 -0
  31. package/dist/sdk/utils/base.d.cts +1 -0
  32. package/dist/sdk/utils/constant.d.cts +1 -0
  33. package/dist/sdk/utils/index.d.cts +3 -0
  34. package/dist/sdk/utils/openBrowser.d.cts +4 -0
  35. package/dist/sdk/utils/upload.d.cts +2 -0
  36. package/package.json +14 -9
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const __rslib_import_meta_url__ = "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
3
3
  exports.ids = [
4
- "344"
4
+ 765
5
5
  ], exports.modules = {
6
6
  "../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js" (__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
7
7
  let isDockerCached, cachedResult, mountPoint, defaultMountPoint;
package/dist/index.cjs CHANGED
@@ -4352,12 +4352,12 @@ var __webpack_modules__ = {
4352
4352
  };
4353
4353
  },
4354
4354
  "../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/binary-search.js" (__unused_rspack_module, exports1) {
4355
- exports1.GREATEST_LOWER_BOUND = 1, exports1.LEAST_UPPER_BOUND = 2, exports1.search = function(aNeedle, aHaystack, aCompare, aBias) {
4355
+ exports1.R = 1, exports1.U = 2, exports1.search = function(aNeedle, aHaystack, aCompare, aBias) {
4356
4356
  if (0 === aHaystack.length) return -1;
4357
4357
  let index = function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
4358
4358
  let mid = Math.floor((aHigh - aLow) / 2) + aLow, cmp = aCompare(aNeedle, aHaystack[mid], !0);
4359
- return 0 === cmp ? mid : cmp > 0 ? aHigh - mid > 1 ? recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias) : aBias === exports1.LEAST_UPPER_BOUND ? aHigh < aHaystack.length ? aHigh : -1 : mid : mid - aLow > 1 ? recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias) : aBias == exports1.LEAST_UPPER_BOUND ? mid : aLow < 0 ? -1 : aLow;
4360
- }(-1, aHaystack.length, aNeedle, aHaystack, aCompare, aBias || exports1.GREATEST_LOWER_BOUND);
4359
+ return 0 === cmp ? mid : cmp > 0 ? aHigh - mid > 1 ? recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias) : aBias === exports1.U ? aHigh < aHaystack.length ? aHigh : -1 : mid : mid - aLow > 1 ? recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias) : aBias == exports1.U ? mid : aLow < 0 ? -1 : aLow;
4360
+ }(-1, aHaystack.length, aNeedle, aHaystack, aCompare, aBias || exports1.R);
4361
4361
  if (index < 0) return -1;
4362
4362
  for(; index - 1 >= 0 && 0 === aCompare(aHaystack[index], aHaystack[index - 1], !0);)--index;
4363
4363
  return index;
@@ -4919,7 +4919,7 @@ var __webpack_modules__ = {
4919
4919
  let base = buildSafeBase(aPath + aRoot), newPath = withBase(aPath, withBase(aRoot, base));
4920
4920
  return computeRelativeURL(base, newPath);
4921
4921
  }
4922
- exports1.normalize = normalize, exports1.join = join, exports1.relative = function(rootURL, targetURL) {
4922
+ exports1.join = join, exports1.relative = function(rootURL, targetURL) {
4923
4923
  let result = function(rootURL, targetURL) {
4924
4924
  if (getURLType(rootURL) !== getURLType(targetURL)) return null;
4925
4925
  let base = buildSafeBase(rootURL + targetURL), root = new URL1(rootURL, base), target = new URL1(targetURL, base);
@@ -6249,13 +6249,13 @@ var __webpack_modules__ = {
6249
6249
  cwd: (0, external_node_path_.join)(__dirname, '../static')
6250
6250
  }), !0;
6251
6251
  logger_namespaceObject.logger.debug('Failed to find the target browser.');
6252
- let { default: open } = await __webpack_require__.e("344").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js"));
6252
+ let { default: open } = await __webpack_require__.e(765).then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js"));
6253
6253
  return await open(url), !0;
6254
6254
  } catch (err) {
6255
6255
  logger_namespaceObject.logger.debug("Failed to open Rsdoctor URL with apple script."), logger_namespaceObject.logger.debug(err);
6256
6256
  }
6257
6257
  else try {
6258
- let { default: open } = await __webpack_require__.e("344").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js"));
6258
+ let { default: open } = await __webpack_require__.e(765).then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js"));
6259
6259
  return await open(url), !0;
6260
6260
  } catch (err) {
6261
6261
  return logger_namespaceObject.logger.error('Failed to open Rsdoctor URL.'), logger_namespaceObject.logger.error(err), !1;
@@ -0,0 +1 @@
1
+ export * from './sdk';
package/dist/index.js CHANGED
@@ -4333,12 +4333,12 @@ __webpack_require__.m = __webpack_modules__, __webpack_require__.n = (module)=>{
4333
4333
  };
4334
4334
  },
4335
4335
  "../../node_modules/.pnpm/source-map@0.7.6/node_modules/source-map/lib/binary-search.js" (__unused_rspack_module, exports) {
4336
- exports.GREATEST_LOWER_BOUND = 1, exports.LEAST_UPPER_BOUND = 2, exports.search = function(aNeedle, aHaystack, aCompare, aBias) {
4336
+ exports.R = 1, exports.U = 2, exports.search = function(aNeedle, aHaystack, aCompare, aBias) {
4337
4337
  if (0 === aHaystack.length) return -1;
4338
4338
  let index = function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
4339
4339
  let mid = Math.floor((aHigh - aLow) / 2) + aLow, cmp = aCompare(aNeedle, aHaystack[mid], !0);
4340
- return 0 === cmp ? mid : cmp > 0 ? aHigh - mid > 1 ? recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias) : aBias === exports.LEAST_UPPER_BOUND ? aHigh < aHaystack.length ? aHigh : -1 : mid : mid - aLow > 1 ? recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias) : aBias == exports.LEAST_UPPER_BOUND ? mid : aLow < 0 ? -1 : aLow;
4341
- }(-1, aHaystack.length, aNeedle, aHaystack, aCompare, aBias || exports.GREATEST_LOWER_BOUND);
4340
+ return 0 === cmp ? mid : cmp > 0 ? aHigh - mid > 1 ? recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias) : aBias === exports.U ? aHigh < aHaystack.length ? aHigh : -1 : mid : mid - aLow > 1 ? recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias) : aBias == exports.U ? mid : aLow < 0 ? -1 : aLow;
4341
+ }(-1, aHaystack.length, aNeedle, aHaystack, aCompare, aBias || exports.R);
4342
4342
  if (index < 0) return -1;
4343
4343
  for(; index - 1 >= 0 && 0 === aCompare(aHaystack[index], aHaystack[index - 1], !0);)--index;
4344
4344
  return index;
@@ -4898,7 +4898,7 @@ __webpack_require__.m = __webpack_modules__, __webpack_require__.n = (module)=>{
4898
4898
  let base = buildSafeBase(aPath + aRoot), newPath = withBase(aPath, withBase(aRoot, base));
4899
4899
  return computeRelativeURL(base, newPath);
4900
4900
  }
4901
- exports.normalize = normalize, exports.join = join, exports.relative = function(rootURL, targetURL) {
4901
+ exports.join = join, exports.relative = function(rootURL, targetURL) {
4902
4902
  let result = function(rootURL, targetURL) {
4903
4903
  if (getURLType(rootURL) !== getURLType(targetURL)) return null;
4904
4904
  let base = buildSafeBase(rootURL + targetURL), root = new URL1(rootURL, base), target = new URL1(targetURL, base);
@@ -0,0 +1,2 @@
1
+ export * from './sdk';
2
+ export * from './multiple';
@@ -0,0 +1,12 @@
1
+ import { Manifest } from '@rsdoctor/types';
2
+ import { RsdoctorPrimarySDK } from './primary';
3
+ export declare class RsdoctorSDKController {
4
+ readonly slaves: RsdoctorPrimarySDK[];
5
+ root: string;
6
+ constructor(root?: string);
7
+ get master(): RsdoctorPrimarySDK;
8
+ getLastSdk(): RsdoctorPrimarySDK;
9
+ hasName(name: string): boolean;
10
+ getSeriesData(serverUrl?: boolean): Manifest.RsdoctorManifestSeriesData[];
11
+ createSlave({ name, stage, extraConfig, type, }: Omit<ConstructorParameters<typeof RsdoctorPrimarySDK>[0], 'controller'>): RsdoctorPrimarySDK;
12
+ }
@@ -0,0 +1,2 @@
1
+ export * from './controller';
2
+ export * from './primary';
@@ -0,0 +1,32 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ import { RsdoctorSDK } from '../sdk';
3
+ import type { RsdoctorSDKController } from './controller';
4
+ interface RsdoctorSlaveSDKOptions {
5
+ name: string;
6
+ /**
7
+ * use to sort for display in the client page.
8
+ * the smaller the front.
9
+ * @default 1
10
+ */
11
+ stage?: number;
12
+ extraConfig?: SDK.SDKOptionsType;
13
+ controller: RsdoctorSDKController;
14
+ type: SDK.ToDataType;
15
+ }
16
+ export declare class RsdoctorPrimarySDK extends RsdoctorSDK implements SDK.RsdoctorBuilderSDKInstance {
17
+ id: number;
18
+ parent: RsdoctorSDKController;
19
+ readonly stage: number;
20
+ dependencies: Array<string> | undefined;
21
+ private uploadPieces;
22
+ private finishUploadPieceSwitch;
23
+ constructor({ name, stage, controller, extraConfig, type, }: RsdoctorSlaveSDKOptions);
24
+ private clearSwitch;
25
+ get isMaster(): boolean;
26
+ protected writePieces(): Promise<void>;
27
+ protected writeManifest(): Promise<string>;
28
+ getSeriesData(serverUrl?: boolean): import("node_modules/@rsdoctor/types/dist/manifest").RsdoctorManifestSeriesData[];
29
+ setName(name: string): void;
30
+ getManifestData(): import("node_modules/@rsdoctor/types/dist/manifest").RsdoctorManifestWithShardingFiles;
31
+ }
32
+ export {};
@@ -0,0 +1,7 @@
1
+ import { RsdoctorServer } from '../server';
2
+ import type { RsdoctorPrimarySDK } from './primary';
3
+ export declare class RsdoctorSlaveServer extends RsdoctorServer {
4
+ protected sdk: RsdoctorPrimarySDK;
5
+ constructor(sdk: RsdoctorPrimarySDK, port?: number);
6
+ openClientPage(...args: unknown[]): Promise<void>;
7
+ }
@@ -0,0 +1,33 @@
1
+ import { Common, Manifest, SDK } from '@rsdoctor/types';
2
+ import { RsdoctorSDKOptions, DataWithUrl } from './types';
3
+ export declare abstract class SDKCore<T extends RsdoctorSDKOptions> implements SDK.RsdoctorSDKInstance {
4
+ protected _name: string;
5
+ protected hash: string;
6
+ extraConfig: SDK.SDKOptionsType | undefined;
7
+ readonly root: string;
8
+ readonly pid: number;
9
+ readonly hooks: SDK.Hooks;
10
+ protected _envinfo: SDK.EnvInfo;
11
+ private _clientRoutes;
12
+ private _outputDir;
13
+ diskManifestPath: string;
14
+ cloudData?: Manifest.RsdoctorManifestWithShardingFiles;
15
+ constructor({ name, root }: T);
16
+ get outputDir(): string;
17
+ get name(): string;
18
+ bootstrap(): Promise<void>;
19
+ dispose(): Promise<void>;
20
+ setOutputDir(outputDir: string): void;
21
+ setName(name: string): void;
22
+ setHash(hash: string): void;
23
+ getHash(): string;
24
+ getClientRoutes(): Manifest.RsdoctorManifestClientRoutes[];
25
+ addClientRoutes(routes: Manifest.RsdoctorManifestClientRoutes[]): void;
26
+ /** Upload analysis data pieces */
27
+ protected writePieces(storeData: Common.PlainObject, _options?: SDK.WriteStoreOptionsType): Promise<void>;
28
+ /** Upload manifest file */
29
+ protected writeManifest(): Promise<string>;
30
+ saveManifest(data: Common.PlainObject, options: SDK.WriteStoreOptionsType): Promise<string>;
31
+ protected writeToFolder(jsonStr: string, dir: string, key: string, index?: number): Promise<DataWithUrl>;
32
+ abstract onDataReport(): void | Promise<void>;
33
+ }
@@ -0,0 +1,51 @@
1
+ import { Manifest, SDK } from '@rsdoctor/types';
2
+ import { RawSourceMap, SourceMapConsumer } from 'source-map';
3
+ import { RsdoctorServer } from '../server';
4
+ import { RsdoctorWebpackSDKOptions } from './types';
5
+ import { SDKCore } from './core';
6
+ export * from '../utils/openBrowser';
7
+ export * from '../utils/base';
8
+ export declare class RsdoctorSDK<T extends RsdoctorWebpackSDKOptions = RsdoctorWebpackSDKOptions> extends SDKCore<T> implements SDK.RsdoctorBuilderSDKInstance {
9
+ server: RsdoctorServer;
10
+ extraConfig: SDK.SDKOptionsType | undefined;
11
+ type: SDK.ToDataType;
12
+ root: string;
13
+ private _summary;
14
+ private _configs;
15
+ private _errors;
16
+ private _loader;
17
+ private _loaderStart;
18
+ private _resolver;
19
+ private _plugin;
20
+ private _moduleGraph;
21
+ private _chunkGraph;
22
+ private _rawSourceMapCache;
23
+ private _sourceMap;
24
+ private _packageGraph;
25
+ constructor(options: T);
26
+ bootstrap(): Promise<void>;
27
+ dispose(): Promise<void>;
28
+ applyErrorFix(id: number): Promise<void>;
29
+ clear(): void;
30
+ clearSourceMapCache(): void;
31
+ getSourceMap(file: string): Promise<SourceMapConsumer | undefined>;
32
+ reportSourceMap(data: RawSourceMap): void;
33
+ reportConfiguration(config: SDK.ConfigData[0]): void;
34
+ reportError(errors: Error[]): void;
35
+ reportLoader(data: SDK.LoaderData): void;
36
+ reportLoaderStartOrEnd(data: SDK.ResourceLoaderData): void;
37
+ reportResolver(data: SDK.ResolverData): void;
38
+ reportPlugin(data: SDK.PluginData): void;
39
+ reportModuleGraph(data: SDK.ModuleGraphInstance): void;
40
+ reportPackageGraph(data: SDK.PackageGraphInstance): void;
41
+ reportChunkGraph(data: SDK.ChunkGraphInstance): void;
42
+ reportSummaryData(part: Partial<SDK.SummaryData>): void;
43
+ createPackageGraph(): void;
44
+ writeStore(options?: SDK.WriteStoreOptionsType): Promise<string>;
45
+ getStoreData(): SDK.BuilderStoreData;
46
+ getManifestData(): Manifest.RsdoctorManifestWithShardingFiles;
47
+ getRuleContext(_options: SDK.RuntimeContextOptions): SDK.RuntimeContext;
48
+ onDataReport(): void | Promise<void>;
49
+ addRsdoctorDataToHTML(storeData: SDK.BuilderStoreData, htmlContent: string): string;
50
+ inlineScriptsAndStyles(htmlFilePath: string): string;
51
+ }
@@ -0,0 +1,28 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ export interface DataWithUrl {
3
+ name: string;
4
+ files: {
5
+ path: string;
6
+ basename: string;
7
+ content: Buffer;
8
+ }[] | string;
9
+ }
10
+ export interface RsdoctorSDKOptions {
11
+ name: string;
12
+ root: string;
13
+ }
14
+ /**
15
+ * sdk options for builder.
16
+ */
17
+ export interface RsdoctorBuilderSDK extends RsdoctorSDKOptions {
18
+ type?: SDK.ToDataType;
19
+ /**
20
+ * port for client server
21
+ */
22
+ port?: number;
23
+ config?: SDK.SDKOptionsType;
24
+ }
25
+ export interface RsdoctorWebpackSDKOptions extends RsdoctorBuilderSDK {
26
+ }
27
+ export interface RsdoctorEMOSDKOptions extends RsdoctorSDKOptions {
28
+ }
@@ -0,0 +1,5 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ import { BaseAPI } from './base';
3
+ export declare class AlertsAPI extends BaseAPI {
4
+ getPackageRelationAlertDetails(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPackageRelationAlertDetails>>;
5
+ }
@@ -0,0 +1,11 @@
1
+ import { Data } from '@rsdoctor/utils/common';
2
+ import { Manifest, SDK } from '@rsdoctor/types';
3
+ export declare class BaseAPI implements Manifest.ManifestDataLoader {
4
+ [key: string | symbol]: any;
5
+ readonly ctx: SDK.ServerAPI.APIContext;
6
+ protected dataLoader: Data.APIDataLoader;
7
+ constructor(sdk: SDK.RsdoctorSDKInstance, server: SDK.RsdoctorServerInstance);
8
+ loadManifest(): Promise<Manifest.RsdoctorManifestWithShardingFiles>;
9
+ loadData<T extends Manifest.RsdoctorManifestMappingKeys>(key: T): Promise<Manifest.InferManifestDataValue<T>>;
10
+ loadData(key: string): Promise<void>;
11
+ }
@@ -0,0 +1,6 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ import { BaseAPI } from './base';
3
+ export declare class BundleDiffAPI extends BaseAPI {
4
+ getBundleDiffSummary(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetBundleDiffSummary>>;
5
+ bundleDiffManifest(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.BundleDiffManifest>>;
6
+ }
@@ -0,0 +1,6 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ import { BaseAPI } from './base';
3
+ export declare class DataAPI extends BaseAPI {
4
+ loadDataByKey(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.LoadDataByKey>>;
5
+ sendMessageToClient(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.SendAPIDataToClient>>;
6
+ }
@@ -0,0 +1,5 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ import { BaseAPI } from './base';
3
+ export declare class FileSystemAPI extends BaseAPI {
4
+ applyErrorFix(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.ApplyErrorFix>>;
5
+ }
@@ -0,0 +1,12 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ import { BaseAPI } from './base';
3
+ export declare class GraphAPI extends BaseAPI {
4
+ getAssetsSummary(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetAssetsSummary>>;
5
+ getModuleGraphForAsset(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetAssetDetails>>;
6
+ getChunksByModuleId(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetChunksByModuleId>>;
7
+ getModuleDetails(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetModuleDetails>>;
8
+ getDependencyByResolvedRequest(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetModulesByModuleIds>>;
9
+ getModuleCodeByModuleId(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetModuleCodeByModuleId>>;
10
+ getModuleCodeByModuleIds(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetModuleCodeByModuleIds>>;
11
+ getEntryModulesSummary(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetEntryPoints>>;
12
+ }
@@ -0,0 +1,9 @@
1
+ export * from './alerts';
2
+ export { DataAPI } from './data';
3
+ export * from './fs';
4
+ export * from './loader';
5
+ export * from './graph';
6
+ export * from './plugin';
7
+ export * from './project';
8
+ export * from './renderer';
9
+ export * from './resolver';
@@ -0,0 +1,15 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ import { BaseAPI } from './base';
3
+ export declare class LoaderAPI extends BaseAPI {
4
+ /** report loader data api */
5
+ reportLoader(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.ReportLoader>>;
6
+ /** report sourcemap data api */
7
+ reportSourceMap(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.ReportLoader>>;
8
+ getLoaderNames(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderNames>>;
9
+ getLoaderChartData(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderChartData>>;
10
+ getLoaderFileTree(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFileTree>>;
11
+ getLoaderFileDetails(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFileDetails>>;
12
+ getLoaderFolderStatistics(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFolderStatistics>>;
13
+ getLoaderFileFirstInput(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFileFirstInput>>;
14
+ getLoaderFileInputAndOutput(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFileInputAndOutput>>;
15
+ }
@@ -0,0 +1,6 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ import { BaseAPI } from './base';
3
+ export declare class PluginAPI extends BaseAPI {
4
+ getPluginSummary(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPluginSummary>>;
5
+ getPluginData(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPluginData>>;
6
+ }
@@ -0,0 +1,8 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ import { BaseAPI } from './base';
3
+ export declare class ProjectAPI extends BaseAPI {
4
+ env(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.Env>>;
5
+ manifest(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.Manifest>>;
6
+ getProjectInfo(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>>;
7
+ getClientRoutes(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetClientRoutes>>;
8
+ }
@@ -0,0 +1,6 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ import { BaseAPI } from './base';
3
+ export declare class RendererAPI extends BaseAPI {
4
+ /** sdk manifest api */
5
+ entryHtml(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.EntryHtml>>;
6
+ }
@@ -0,0 +1,6 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ import { BaseAPI } from './base';
3
+ export declare class ResolverAPI extends BaseAPI {
4
+ getResolverFileTree(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetResolverFileTree>>;
5
+ getResolverFileDetails(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetResolverFileDetails>>;
6
+ }
@@ -0,0 +1,7 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ import { RsdoctorServer } from '.';
3
+ export declare class RsdoctorFakeServer extends RsdoctorServer {
4
+ protected sdk: SDK.RsdoctorBuilderSDKInstance;
5
+ constructor(sdk: SDK.RsdoctorBuilderSDKInstance, port?: number);
6
+ openClientPage(): Promise<void>;
7
+ }
@@ -0,0 +1,37 @@
1
+ import { Common, SDK, Thirdparty, Client } from '@rsdoctor/types';
2
+ export * from './utils';
3
+ export type ISocketType = {
4
+ port: number;
5
+ socketUrl: string;
6
+ };
7
+ export declare class RsdoctorServer implements SDK.RsdoctorServerInstance {
8
+ protected sdk: SDK.RsdoctorBuilderSDKInstance;
9
+ private _server;
10
+ port: number;
11
+ private _socket?;
12
+ private disposed;
13
+ private _router;
14
+ private _innerClientPath;
15
+ private _printServerUrl;
16
+ constructor(sdk: SDK.RsdoctorBuilderSDKInstance, port?: number, config?: {
17
+ innerClientPath?: string;
18
+ printServerUrl?: boolean;
19
+ });
20
+ get app(): SDK.RsdoctorServerInstance['app'];
21
+ get host(): string;
22
+ get origin(): string;
23
+ get socketUrl(): ISocketType;
24
+ get innerClientPath(): string;
25
+ bootstrap(): Promise<void>;
26
+ protected wrapNextHandleFunction(method: 'GET' | 'POST', cb: (...args: Parameters<Thirdparty.connect.NextHandleFunction>) => Common.PlainObject | string): Thirdparty.connect.NextHandleFunction;
27
+ proxy(api: SDK.ServerAPI.API, method: 'GET' | 'POST', cb: (...args: Parameters<Thirdparty.connect.NextHandleFunction>) => Common.PlainObject | string): void;
28
+ get: SDK.RsdoctorServerInstance['get'];
29
+ post: SDK.RsdoctorServerInstance['post'];
30
+ getClientUrl(route: Client.RsdoctorClientRoutes, baselineUrl: string, currentUrl: string): string;
31
+ getClientUrl(route?: 'homepage'): string;
32
+ openClientPage(route: Client.RsdoctorClientRoutes, baselineUrl: string, currentUrl: string): Promise<void>;
33
+ openClientPage(route?: 'homepage'): Promise<void>;
34
+ sendAPIDataToClient<T extends SDK.ServerAPI.API | SDK.ServerAPI.APIExtends>(api: T, msg: SDK.ServerAPI.SocketResponseType<T>): void;
35
+ broadcast(): Promise<void>;
36
+ dispose: (exitCode?: number) => Promise<void>;
37
+ }
@@ -0,0 +1,24 @@
1
+ import type { ServerResponse } from 'http';
2
+ import { Common, SDK, Thirdparty } from '@rsdoctor/types';
3
+ import { BaseAPI } from './apis/base';
4
+ interface RouterOptions {
5
+ apis: Common.Constructor<typeof BaseAPI>[];
6
+ sdk: SDK.RsdoctorBuilderSDKInstance;
7
+ server: SDK.RsdoctorServerInstance;
8
+ }
9
+ export declare class Router {
10
+ protected options: RouterOptions;
11
+ static routes: {
12
+ /**
13
+ * - `key` is the constructor of object which used to match the API class
14
+ */
15
+ get: Map<Function, [apiKey: PropertyKey, pathname: string][]>;
16
+ post: Map<Function, [apiKey: PropertyKey, pathname: string][]>;
17
+ };
18
+ static get(pathname: string): MethodDecorator;
19
+ static post(pathname: string): MethodDecorator;
20
+ constructor(options: RouterOptions);
21
+ setup(): Promise<void>;
22
+ wrapAPIFunction<T extends BaseAPI>(api: T, key: PropertyKey): (req: Thirdparty.connect.IncomingMessage, res: ServerResponse) => Promise<any>;
23
+ }
24
+ export {};
@@ -0,0 +1,15 @@
1
+ import { Data } from '@rsdoctor/utils/common';
2
+ import { Manifest, SDK } from '@rsdoctor/types';
3
+ interface SocketAPILoaderOptions {
4
+ sdk: SDK.RsdoctorBuilderSDKInstance;
5
+ }
6
+ export declare class SocketAPILoader implements Manifest.ManifestDataLoader {
7
+ protected options: SocketAPILoaderOptions;
8
+ protected dataLoader: Data.APIDataLoader;
9
+ constructor(options: SocketAPILoaderOptions);
10
+ loadManifest(): Promise<Manifest.RsdoctorManifestWithShardingFiles>;
11
+ loadData<T extends Manifest.RsdoctorManifestMappingKeys>(key: T): Promise<Manifest.InferManifestDataValue<T>>;
12
+ loadData(key: string): Promise<void>;
13
+ get loadAPIData(): <T extends SDK.ServerAPI.API, B extends SDK.ServerAPI.InferRequestBodyType<T> = import("node_modules/@rsdoctor/types/dist/common").Get<SDK.ServerAPI.RequestBodyTypes, T, void>, R extends SDK.ServerAPI.InferResponseType<T> = import("node_modules/@rsdoctor/types/dist/common").Get<SDK.ServerAPI.ResponseTypes, T, void>>(...args: B extends void ? [api: T] : [api: T, body: B]) => Promise<SDK.ServerAPI.InferResponseType<T>>;
14
+ }
15
+ export {};
@@ -0,0 +1,26 @@
1
+ import { Common, SDK } from '@rsdoctor/types';
2
+ import type { Server } from 'http';
3
+ import { Server as SocketServer, ServerOptions as SocketServerOptions, Socket as SocketType } from 'socket.io';
4
+ import { SocketAPILoader } from './api';
5
+ interface SocketOptions {
6
+ sdk: SDK.RsdoctorBuilderSDKInstance;
7
+ server: Server;
8
+ port: number;
9
+ socketOptions?: SocketServerOptions;
10
+ }
11
+ export declare class Socket {
12
+ protected options: SocketOptions;
13
+ protected io: SocketServer;
14
+ protected loader: SocketAPILoader;
15
+ protected map: Map<SDK.ServerAPI.API, (Common.PlainObject | null)[]>;
16
+ constructor(options: SocketOptions);
17
+ bootstrap(): void;
18
+ protected setupSocket(socket: SocketType): void;
19
+ protected saveRequestToMap<T extends SDK.ServerAPI.API>(api: T, body?: SDK.ServerAPI.InferRequestBodyType<T, null> | null): void;
20
+ protected getAPIResponse<T extends SDK.ServerAPI.API>(api: T, body: SDK.ServerAPI.InferRequestBodyType<T>): Promise<SDK.ServerAPI.SocketResponseType<SDK.ServerAPI.API>>;
21
+ protected timer: NodeJS.Immediate | undefined;
22
+ broadcast(): Promise<void>;
23
+ sendAPIData<T extends SDK.ServerAPI.API | SDK.ServerAPI.APIExtends>(api: T, msg: SDK.ServerAPI.SocketResponseType<T>): void;
24
+ dispose(): void;
25
+ }
26
+ export {};
@@ -0,0 +1,6 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ export declare function getDataByPagination<T>(data: T[], pagination: SDK.ServerAPI.PaginationRequest): {
3
+ data: T[];
4
+ pagination: SDK.ServerAPI.PaginationResponse;
5
+ };
6
+ export declare function getLocalIpAddress(): string;
@@ -0,0 +1 @@
1
+ export declare function findRoot(startDir?: string): string | null;
@@ -0,0 +1 @@
1
+ export declare const CLOUD_DIR: string;
@@ -0,0 +1,3 @@
1
+ export * from './constant';
2
+ export * from './base';
3
+ export * from './upload';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Reads the BROWSER environment variable and decides what to do with it.
3
+ */
4
+ export declare function openBrowser(url: string, needEncodeURI?: boolean): Promise<boolean | undefined>;
@@ -0,0 +1,2 @@
1
+ import { DataWithUrl } from '../sdk/types';
2
+ export declare const transformDataUrls: (d: DataWithUrl[]) => Record<string, string[] | string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/sdk",
3
- "version": "1.5.9",
3
+ "version": "1.5.10",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -12,9 +12,14 @@
12
12
  "type": "module",
13
13
  "exports": {
14
14
  ".": {
15
- "types": "./dist/index.d.ts",
16
- "import": "./dist/index.js",
17
- "default": "./dist/index.cjs"
15
+ "import": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ },
19
+ "require": {
20
+ "types": "./dist/index.d.cts",
21
+ "default": "./dist/index.cjs"
22
+ }
18
23
  }
19
24
  },
20
25
  "files": [
@@ -26,11 +31,11 @@
26
31
  "launch-editor": "^2.13.2",
27
32
  "safer-buffer": "2.1.2",
28
33
  "socket.io": "4.8.1",
29
- "tapable": "2.3.2",
30
- "@rsdoctor/client": "1.5.9",
31
- "@rsdoctor/graph": "1.5.9",
32
- "@rsdoctor/types": "1.5.9",
33
- "@rsdoctor/utils": "1.5.9"
34
+ "tapable": "2.3.3",
35
+ "@rsdoctor/client": "1.5.10",
36
+ "@rsdoctor/types": "1.5.10",
37
+ "@rsdoctor/graph": "1.5.10",
38
+ "@rsdoctor/utils": "1.5.10"
34
39
  },
35
40
  "devDependencies": {
36
41
  "@types/body-parser": "1.19.6",