@rsdoctor/sdk 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/cjs/sdk/multiple/controller.js +4 -4
- package/dist/cjs/sdk/multiple/server.js +3 -3
- package/dist/cjs/sdk/multiple/slave.js +4 -4
- package/dist/cjs/sdk/sdk/core.js +3 -3
- package/dist/cjs/sdk/sdk/index.js +2 -2
- package/dist/cjs/sdk/sdk/webpack.js +8 -8
- package/dist/cjs/sdk/server/fakeServer.js +3 -3
- package/dist/cjs/sdk/server/index.js +5 -5
- package/dist/esm/sdk/multiple/controller.js +4 -4
- package/dist/esm/sdk/multiple/server.js +3 -3
- package/dist/esm/sdk/multiple/slave.js +5 -5
- package/dist/esm/sdk/sdk/core.js +3 -3
- package/dist/esm/sdk/sdk/index.js +2 -2
- package/dist/esm/sdk/sdk/webpack.js +9 -9
- package/dist/esm/sdk/server/fakeServer.js +3 -3
- package/dist/esm/sdk/server/index.js +4 -4
- package/dist/type/sdk/multiple/controller.d.ts +7 -7
- package/dist/type/sdk/multiple/server.d.ts +5 -5
- package/dist/type/sdk/multiple/slave.d.ts +8 -8
- package/dist/type/sdk/sdk/core.d.ts +5 -5
- package/dist/type/sdk/sdk/index.d.ts +1 -1
- package/dist/type/sdk/sdk/types.d.ts +4 -4
- package/dist/type/sdk/sdk/webpack.d.ts +5 -5
- package/dist/type/sdk/server/apis/base.d.ts +3 -3
- package/dist/type/sdk/server/fakeServer.d.ts +4 -4
- package/dist/type/sdk/server/index.d.ts +8 -8
- package/dist/type/sdk/server/router.d.ts +2 -2
- package/dist/type/sdk/server/socket/api.d.ts +3 -3
- package/dist/type/sdk/server/socket/index.d.ts +1 -1
- package/package.json +6 -6
|
@@ -18,11 +18,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var controller_exports = {};
|
|
20
20
|
__export(controller_exports, {
|
|
21
|
-
|
|
21
|
+
RsdoctorSDKController: () => RsdoctorSDKController
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(controller_exports);
|
|
24
24
|
var import_slave = require("./slave");
|
|
25
|
-
class
|
|
25
|
+
class RsdoctorSDKController {
|
|
26
26
|
constructor(root = process.cwd()) {
|
|
27
27
|
this.slaves = [];
|
|
28
28
|
this.root = "";
|
|
@@ -55,7 +55,7 @@ class DoctorSDKController {
|
|
|
55
55
|
stage,
|
|
56
56
|
extraConfig
|
|
57
57
|
}) {
|
|
58
|
-
const slave = new import_slave.
|
|
58
|
+
const slave = new import_slave.RsdoctorSlaveSDK({
|
|
59
59
|
name,
|
|
60
60
|
stage,
|
|
61
61
|
controller: this,
|
|
@@ -68,5 +68,5 @@ class DoctorSDKController {
|
|
|
68
68
|
}
|
|
69
69
|
// Annotate the CommonJS export names for ESM import in node:
|
|
70
70
|
0 && (module.exports = {
|
|
71
|
-
|
|
71
|
+
RsdoctorSDKController
|
|
72
72
|
});
|
|
@@ -18,12 +18,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var server_exports = {};
|
|
20
20
|
__export(server_exports, {
|
|
21
|
-
|
|
21
|
+
RsdoctorSlaveServer: () => RsdoctorSlaveServer
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(server_exports);
|
|
24
24
|
var import_build = require("@rsdoctor/utils/build");
|
|
25
25
|
var import_server = require("../server");
|
|
26
|
-
class
|
|
26
|
+
class RsdoctorSlaveServer extends import_server.RsdoctorServer {
|
|
27
27
|
constructor(sdk, port = import_build.Server.defaultPort) {
|
|
28
28
|
super(sdk, port);
|
|
29
29
|
this.sdk = sdk;
|
|
@@ -37,5 +37,5 @@ class DoctorSlaveServer extends import_server.DoctorServer {
|
|
|
37
37
|
}
|
|
38
38
|
// Annotate the CommonJS export names for ESM import in node:
|
|
39
39
|
0 && (module.exports = {
|
|
40
|
-
|
|
40
|
+
RsdoctorSlaveServer
|
|
41
41
|
});
|
|
@@ -28,14 +28,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var slave_exports = {};
|
|
30
30
|
__export(slave_exports, {
|
|
31
|
-
|
|
31
|
+
RsdoctorSlaveSDK: () => RsdoctorSlaveSDK
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(slave_exports);
|
|
34
34
|
var import_path = __toESM(require("path"));
|
|
35
35
|
var import_sdk = require("../sdk");
|
|
36
36
|
var import_server = require("./server");
|
|
37
37
|
let id = 1;
|
|
38
|
-
class
|
|
38
|
+
class RsdoctorSlaveSDK extends import_sdk.RsdoctorWebpackSDK {
|
|
39
39
|
constructor({ name, stage, controller, extraConfig }) {
|
|
40
40
|
super({ name, root: controller.root });
|
|
41
41
|
const lastSdk = controller.getLastSdk();
|
|
@@ -44,7 +44,7 @@ class DoctorSlaveSDK extends import_sdk.DoctorWebpackSDK {
|
|
|
44
44
|
this.stage = typeof stage === "number" ? stage : 1;
|
|
45
45
|
this.extraConfig = extraConfig;
|
|
46
46
|
this.parent = controller;
|
|
47
|
-
this.server = new import_server.
|
|
47
|
+
this.server = new import_server.RsdoctorSlaveServer(this, port);
|
|
48
48
|
this.setName(name);
|
|
49
49
|
this.clearSwitch();
|
|
50
50
|
}
|
|
@@ -94,5 +94,5 @@ class DoctorSlaveSDK extends import_sdk.DoctorWebpackSDK {
|
|
|
94
94
|
}
|
|
95
95
|
// Annotate the CommonJS export names for ESM import in node:
|
|
96
96
|
0 && (module.exports = {
|
|
97
|
-
|
|
97
|
+
RsdoctorSlaveSDK
|
|
98
98
|
});
|
package/dist/cjs/sdk/sdk/core.js
CHANGED
|
@@ -47,13 +47,13 @@ class SDKCore {
|
|
|
47
47
|
};
|
|
48
48
|
this._envinfo = {};
|
|
49
49
|
this._clientRoutes = /* @__PURE__ */ new Set([
|
|
50
|
-
import_types.Manifest.
|
|
50
|
+
import_types.Manifest.RsdoctorManifestClientRoutes.Overall
|
|
51
51
|
]);
|
|
52
52
|
this.diskManifestPath = "";
|
|
53
53
|
this._name = name;
|
|
54
54
|
this.root = root;
|
|
55
55
|
this.pid = import_process.default.pid;
|
|
56
|
-
this._outputDir = import_path.default.join(this.root, import_types.Constants.
|
|
56
|
+
this._outputDir = import_path.default.join(this.root, import_types.Constants.RsdoctorOutputFolder);
|
|
57
57
|
}
|
|
58
58
|
get outputDir() {
|
|
59
59
|
return this._outputDir;
|
|
@@ -109,7 +109,7 @@ class SDKCore {
|
|
|
109
109
|
/** Upload analysis data pieces */
|
|
110
110
|
async writePieces(storeData, _options) {
|
|
111
111
|
const { outputDir } = this;
|
|
112
|
-
const manifest = import_path.default.resolve(outputDir, import_types.Constants.
|
|
112
|
+
const manifest = import_path.default.resolve(outputDir, import_types.Constants.RsdoctorOutputManifest);
|
|
113
113
|
this.diskManifestPath = manifest;
|
|
114
114
|
await import_build.File.fse.ensureDir(outputDir);
|
|
115
115
|
const dataUrls = await Promise.all(
|
|
@@ -19,13 +19,13 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
20
|
var sdk_exports = {};
|
|
21
21
|
__export(sdk_exports, {
|
|
22
|
-
|
|
22
|
+
RsdoctorSDK: () => import_webpack.RsdoctorWebpackSDK
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(sdk_exports);
|
|
25
25
|
__reExport(sdk_exports, require("./webpack"), module.exports);
|
|
26
26
|
var import_webpack = require("./webpack");
|
|
27
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
28
28
|
0 && (module.exports = {
|
|
29
|
-
|
|
29
|
+
RsdoctorSDK,
|
|
30
30
|
...require("./webpack")
|
|
31
31
|
});
|
|
@@ -18,7 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var webpack_exports = {};
|
|
20
20
|
__export(webpack_exports, {
|
|
21
|
-
|
|
21
|
+
RsdoctorWebpackSDK: () => RsdoctorWebpackSDK
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(webpack_exports);
|
|
24
24
|
var import_error = require("@rsdoctor/utils/error");
|
|
@@ -30,7 +30,7 @@ var import_logger = require("@rsdoctor/utils/logger");
|
|
|
30
30
|
var import_server = require("../server");
|
|
31
31
|
var import_fakeServer = require("../server/fakeServer");
|
|
32
32
|
var import_core = require("./core");
|
|
33
|
-
class
|
|
33
|
+
class RsdoctorWebpackSDK extends import_core.SDKCore {
|
|
34
34
|
constructor(options) {
|
|
35
35
|
super(options);
|
|
36
36
|
this._summary = { costs: [] };
|
|
@@ -43,24 +43,24 @@ class DoctorWebpackSDK extends import_core.SDKCore {
|
|
|
43
43
|
this._chunkGraph = new import_graph.ChunkGraph();
|
|
44
44
|
this._rawSourceMapCache = /* @__PURE__ */ new Map();
|
|
45
45
|
this._sourceMap = /* @__PURE__ */ new Map();
|
|
46
|
-
this.server = options.noServer ? new import_fakeServer.
|
|
46
|
+
this.server = options.noServer ? new import_fakeServer.RsdoctorFakeServer(this, void 0) : new import_server.RsdoctorServer(this, options.port);
|
|
47
47
|
this.type = options.type || import_types.SDK.ToDataType.Normal;
|
|
48
48
|
this.extraConfig = options.config;
|
|
49
49
|
}
|
|
50
50
|
async bootstrap() {
|
|
51
|
-
(0, import_logger.debug)(() => `${Date.now()}`, "[
|
|
51
|
+
(0, import_logger.debug)(() => `${Date.now()}`, "[RsdoctorWebpackSDK][bootstrap start]");
|
|
52
52
|
this.server && await this.server.bootstrap();
|
|
53
53
|
await super.bootstrap();
|
|
54
54
|
(0, import_logger.debug)(
|
|
55
55
|
() => `${Date.now()} ${this.server.origin}`,
|
|
56
|
-
"[
|
|
56
|
+
"[RsdoctorWebpackSDK][bootstrap end]"
|
|
57
57
|
);
|
|
58
58
|
}
|
|
59
59
|
async dispose() {
|
|
60
|
-
(0, import_logger.debug)(() => `${Date.now()}`, "[
|
|
60
|
+
(0, import_logger.debug)(() => `${Date.now()}`, "[RsdoctorWebpackSDK][dispose start]");
|
|
61
61
|
this.server && await this.server.dispose();
|
|
62
62
|
await super.dispose();
|
|
63
|
-
(0, import_logger.debug)(() => `${Date.now()}`, "[
|
|
63
|
+
(0, import_logger.debug)(() => `${Date.now()}`, "[RsdoctorWebpackSDK][dispose end]");
|
|
64
64
|
}
|
|
65
65
|
async applyErrorFix(id) {
|
|
66
66
|
const { _errors: errors } = this;
|
|
@@ -369,5 +369,5 @@ class DoctorWebpackSDK extends import_core.SDKCore {
|
|
|
369
369
|
}
|
|
370
370
|
// Annotate the CommonJS export names for ESM import in node:
|
|
371
371
|
0 && (module.exports = {
|
|
372
|
-
|
|
372
|
+
RsdoctorWebpackSDK
|
|
373
373
|
});
|
|
@@ -18,12 +18,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var fakeServer_exports = {};
|
|
20
20
|
__export(fakeServer_exports, {
|
|
21
|
-
|
|
21
|
+
RsdoctorFakeServer: () => RsdoctorFakeServer
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(fakeServer_exports);
|
|
24
24
|
var import_build = require("@rsdoctor/utils/build");
|
|
25
25
|
var import__ = require(".");
|
|
26
|
-
class
|
|
26
|
+
class RsdoctorFakeServer extends import__.RsdoctorServer {
|
|
27
27
|
constructor(sdk, port = import_build.Server.defaultPort) {
|
|
28
28
|
super(sdk, port);
|
|
29
29
|
this.sdk = sdk;
|
|
@@ -34,5 +34,5 @@ class DoctorFakeServer extends import__.DoctorServer {
|
|
|
34
34
|
}
|
|
35
35
|
// Annotate the CommonJS export names for ESM import in node:
|
|
36
36
|
0 && (module.exports = {
|
|
37
|
-
|
|
37
|
+
RsdoctorFakeServer
|
|
38
38
|
});
|
|
@@ -29,7 +29,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
30
|
var server_exports = {};
|
|
31
31
|
__export(server_exports, {
|
|
32
|
-
|
|
32
|
+
RsdoctorServer: () => RsdoctorServer
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(server_exports);
|
|
35
35
|
var import_types = require("@rsdoctor/types");
|
|
@@ -45,7 +45,7 @@ var import_socket = require("./socket");
|
|
|
45
45
|
var import_router = require("./router");
|
|
46
46
|
var APIs = __toESM(require("./apis"));
|
|
47
47
|
__reExport(server_exports, require("./utils"), module.exports);
|
|
48
|
-
class
|
|
48
|
+
class RsdoctorServer {
|
|
49
49
|
constructor(sdk, port = import_build.Server.defaultPort) {
|
|
50
50
|
this.sdk = sdk;
|
|
51
51
|
this.disposed = true;
|
|
@@ -154,10 +154,10 @@ class DoctorServer {
|
|
|
154
154
|
getClientUrl(route = "homepage", ...args) {
|
|
155
155
|
const url = `${this.origin}${import_types.SDK.ServerAPI.API.EntryHtml}`;
|
|
156
156
|
switch (route) {
|
|
157
|
-
case import_types.Client.
|
|
157
|
+
case import_types.Client.RsdoctorClientRoutes.BundleDiff: {
|
|
158
158
|
const [baseline, current] = args;
|
|
159
159
|
const qs = import_common.Bundle.getBundleDiffPageQueryString([baseline, current]);
|
|
160
|
-
return `${url}${qs}#${import_types.Client.
|
|
160
|
+
return `${url}${qs}#${import_types.Client.RsdoctorClientRoutes.BundleDiff}`;
|
|
161
161
|
}
|
|
162
162
|
default:
|
|
163
163
|
return url;
|
|
@@ -179,6 +179,6 @@ class DoctorServer {
|
|
|
179
179
|
}
|
|
180
180
|
// Annotate the CommonJS export names for ESM import in node:
|
|
181
181
|
0 && (module.exports = {
|
|
182
|
-
|
|
182
|
+
RsdoctorServer,
|
|
183
183
|
...require("./utils")
|
|
184
184
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
class
|
|
1
|
+
import { RsdoctorSlaveSDK } from "./slave";
|
|
2
|
+
class RsdoctorSDKController {
|
|
3
3
|
constructor(root = process.cwd()) {
|
|
4
4
|
this.slaves = [];
|
|
5
5
|
this.root = "";
|
|
@@ -32,7 +32,7 @@ class DoctorSDKController {
|
|
|
32
32
|
stage,
|
|
33
33
|
extraConfig
|
|
34
34
|
}) {
|
|
35
|
-
const slave = new
|
|
35
|
+
const slave = new RsdoctorSlaveSDK({
|
|
36
36
|
name,
|
|
37
37
|
stage,
|
|
38
38
|
controller: this,
|
|
@@ -44,5 +44,5 @@ class DoctorSDKController {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
export {
|
|
47
|
-
|
|
47
|
+
RsdoctorSDKController
|
|
48
48
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Server } from "@rsdoctor/utils/build";
|
|
2
|
-
import {
|
|
3
|
-
class
|
|
2
|
+
import { RsdoctorServer } from "../server";
|
|
3
|
+
class RsdoctorSlaveServer extends RsdoctorServer {
|
|
4
4
|
constructor(sdk, port = Server.defaultPort) {
|
|
5
5
|
super(sdk, port);
|
|
6
6
|
this.sdk = sdk;
|
|
@@ -13,5 +13,5 @@ class DoctorSlaveServer extends DoctorServer {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
export {
|
|
16
|
-
|
|
16
|
+
RsdoctorSlaveServer
|
|
17
17
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { RsdoctorWebpackSDK } from "../sdk";
|
|
3
|
+
import { RsdoctorSlaveServer } from "./server";
|
|
4
4
|
let id = 1;
|
|
5
|
-
class
|
|
5
|
+
class RsdoctorSlaveSDK extends RsdoctorWebpackSDK {
|
|
6
6
|
constructor({ name, stage, controller, extraConfig }) {
|
|
7
7
|
super({ name, root: controller.root });
|
|
8
8
|
const lastSdk = controller.getLastSdk();
|
|
@@ -11,7 +11,7 @@ class DoctorSlaveSDK extends DoctorWebpackSDK {
|
|
|
11
11
|
this.stage = typeof stage === "number" ? stage : 1;
|
|
12
12
|
this.extraConfig = extraConfig;
|
|
13
13
|
this.parent = controller;
|
|
14
|
-
this.server = new
|
|
14
|
+
this.server = new RsdoctorSlaveServer(this, port);
|
|
15
15
|
this.setName(name);
|
|
16
16
|
this.clearSwitch();
|
|
17
17
|
}
|
|
@@ -60,5 +60,5 @@ class DoctorSlaveSDK extends DoctorWebpackSDK {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
export {
|
|
63
|
-
|
|
63
|
+
RsdoctorSlaveSDK
|
|
64
64
|
};
|
package/dist/esm/sdk/sdk/core.js
CHANGED
|
@@ -14,13 +14,13 @@ class SDKCore {
|
|
|
14
14
|
};
|
|
15
15
|
this._envinfo = {};
|
|
16
16
|
this._clientRoutes = /* @__PURE__ */ new Set([
|
|
17
|
-
Manifest.
|
|
17
|
+
Manifest.RsdoctorManifestClientRoutes.Overall
|
|
18
18
|
]);
|
|
19
19
|
this.diskManifestPath = "";
|
|
20
20
|
this._name = name;
|
|
21
21
|
this.root = root;
|
|
22
22
|
this.pid = process.pid;
|
|
23
|
-
this._outputDir = path.join(this.root, Constants.
|
|
23
|
+
this._outputDir = path.join(this.root, Constants.RsdoctorOutputFolder);
|
|
24
24
|
}
|
|
25
25
|
get outputDir() {
|
|
26
26
|
return this._outputDir;
|
|
@@ -76,7 +76,7 @@ class SDKCore {
|
|
|
76
76
|
/** Upload analysis data pieces */
|
|
77
77
|
async writePieces(storeData, _options) {
|
|
78
78
|
const { outputDir } = this;
|
|
79
|
-
const manifest = path.resolve(outputDir, Constants.
|
|
79
|
+
const manifest = path.resolve(outputDir, Constants.RsdoctorOutputManifest);
|
|
80
80
|
this.diskManifestPath = manifest;
|
|
81
81
|
await File.fse.ensureDir(outputDir);
|
|
82
82
|
const dataUrls = await Promise.all(
|
|
@@ -4,10 +4,10 @@ import { File } from "@rsdoctor/utils/build";
|
|
|
4
4
|
import { SourceMapConsumer } from "source-map";
|
|
5
5
|
import { ModuleGraph, ChunkGraph, PackageGraph } from "@rsdoctor/graph";
|
|
6
6
|
import { debug } from "@rsdoctor/utils/logger";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { RsdoctorServer } from "../server";
|
|
8
|
+
import { RsdoctorFakeServer } from "../server/fakeServer";
|
|
9
9
|
import { SDKCore } from "./core";
|
|
10
|
-
class
|
|
10
|
+
class RsdoctorWebpackSDK extends SDKCore {
|
|
11
11
|
constructor(options) {
|
|
12
12
|
super(options);
|
|
13
13
|
this._summary = { costs: [] };
|
|
@@ -20,24 +20,24 @@ class DoctorWebpackSDK extends SDKCore {
|
|
|
20
20
|
this._chunkGraph = new ChunkGraph();
|
|
21
21
|
this._rawSourceMapCache = /* @__PURE__ */ new Map();
|
|
22
22
|
this._sourceMap = /* @__PURE__ */ new Map();
|
|
23
|
-
this.server = options.noServer ? new
|
|
23
|
+
this.server = options.noServer ? new RsdoctorFakeServer(this, void 0) : new RsdoctorServer(this, options.port);
|
|
24
24
|
this.type = options.type || SDK.ToDataType.Normal;
|
|
25
25
|
this.extraConfig = options.config;
|
|
26
26
|
}
|
|
27
27
|
async bootstrap() {
|
|
28
|
-
debug(() => `${Date.now()}`, "[
|
|
28
|
+
debug(() => `${Date.now()}`, "[RsdoctorWebpackSDK][bootstrap start]");
|
|
29
29
|
this.server && await this.server.bootstrap();
|
|
30
30
|
await super.bootstrap();
|
|
31
31
|
debug(
|
|
32
32
|
() => `${Date.now()} ${this.server.origin}`,
|
|
33
|
-
"[
|
|
33
|
+
"[RsdoctorWebpackSDK][bootstrap end]"
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
36
|
async dispose() {
|
|
37
|
-
debug(() => `${Date.now()}`, "[
|
|
37
|
+
debug(() => `${Date.now()}`, "[RsdoctorWebpackSDK][dispose start]");
|
|
38
38
|
this.server && await this.server.dispose();
|
|
39
39
|
await super.dispose();
|
|
40
|
-
debug(() => `${Date.now()}`, "[
|
|
40
|
+
debug(() => `${Date.now()}`, "[RsdoctorWebpackSDK][dispose end]");
|
|
41
41
|
}
|
|
42
42
|
async applyErrorFix(id) {
|
|
43
43
|
const { _errors: errors } = this;
|
|
@@ -345,5 +345,5 @@ class DoctorWebpackSDK extends SDKCore {
|
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
347
|
export {
|
|
348
|
-
|
|
348
|
+
RsdoctorWebpackSDK
|
|
349
349
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Server } from "@rsdoctor/utils/build";
|
|
2
|
-
import {
|
|
3
|
-
class
|
|
2
|
+
import { RsdoctorServer } from ".";
|
|
3
|
+
class RsdoctorFakeServer extends RsdoctorServer {
|
|
4
4
|
constructor(sdk, port = Server.defaultPort) {
|
|
5
5
|
super(sdk, port);
|
|
6
6
|
this.sdk = sdk;
|
|
@@ -10,5 +10,5 @@ class DoctorFakeServer extends DoctorServer {
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
export {
|
|
13
|
-
|
|
13
|
+
RsdoctorFakeServer
|
|
14
14
|
};
|
|
@@ -11,7 +11,7 @@ import { Socket } from "./socket";
|
|
|
11
11
|
import { Router } from "./router";
|
|
12
12
|
import * as APIs from "./apis";
|
|
13
13
|
export * from "./utils";
|
|
14
|
-
class
|
|
14
|
+
class RsdoctorServer {
|
|
15
15
|
constructor(sdk, port = Server.defaultPort) {
|
|
16
16
|
this.sdk = sdk;
|
|
17
17
|
this.disposed = true;
|
|
@@ -120,10 +120,10 @@ class DoctorServer {
|
|
|
120
120
|
getClientUrl(route = "homepage", ...args) {
|
|
121
121
|
const url = `${this.origin}${SDK.ServerAPI.API.EntryHtml}`;
|
|
122
122
|
switch (route) {
|
|
123
|
-
case Client.
|
|
123
|
+
case Client.RsdoctorClientRoutes.BundleDiff: {
|
|
124
124
|
const [baseline, current] = args;
|
|
125
125
|
const qs = Bundle.getBundleDiffPageQueryString([baseline, current]);
|
|
126
|
-
return `${url}${qs}#${Client.
|
|
126
|
+
return `${url}${qs}#${Client.RsdoctorClientRoutes.BundleDiff}`;
|
|
127
127
|
}
|
|
128
128
|
default:
|
|
129
129
|
return url;
|
|
@@ -144,5 +144,5 @@ class DoctorServer {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
export {
|
|
147
|
-
|
|
147
|
+
RsdoctorServer
|
|
148
148
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Manifest } from '@rsdoctor/types';
|
|
2
|
-
import {
|
|
3
|
-
export declare class
|
|
4
|
-
readonly slaves:
|
|
2
|
+
import { RsdoctorSlaveSDK } from './slave';
|
|
3
|
+
export declare class RsdoctorSDKController {
|
|
4
|
+
readonly slaves: RsdoctorSlaveSDK[];
|
|
5
5
|
root: string;
|
|
6
6
|
constructor(root?: string);
|
|
7
|
-
get master():
|
|
8
|
-
getLastSdk():
|
|
7
|
+
get master(): RsdoctorSlaveSDK;
|
|
8
|
+
getLastSdk(): RsdoctorSlaveSDK;
|
|
9
9
|
hasName(name: string): boolean;
|
|
10
|
-
getSeriesData(serverUrl?: boolean): Manifest.
|
|
10
|
+
getSeriesData(serverUrl?: boolean): Manifest.RsdoctorManifestSeriesData[];
|
|
11
11
|
createSlave({
|
|
12
12
|
name,
|
|
13
13
|
stage,
|
|
14
14
|
extraConfig
|
|
15
|
-
}: Omit<ConstructorParameters<typeof
|
|
15
|
+
}: Omit<ConstructorParameters<typeof RsdoctorSlaveSDK>[0], 'controller'>): RsdoctorSlaveSDK;
|
|
16
16
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
export declare class
|
|
4
|
-
protected sdk:
|
|
5
|
-
constructor(sdk:
|
|
1
|
+
import { RsdoctorServer } from '../server';
|
|
2
|
+
import type { RsdoctorSlaveSDK } from './slave';
|
|
3
|
+
export declare class RsdoctorSlaveServer extends RsdoctorServer {
|
|
4
|
+
protected sdk: RsdoctorSlaveSDK;
|
|
5
|
+
constructor(sdk: RsdoctorSlaveSDK, port?: number);
|
|
6
6
|
openClientPage(...args: unknown[]): Promise<void>;
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SDK } from '@rsdoctor/types';
|
|
2
|
-
import {
|
|
3
|
-
import type {
|
|
4
|
-
interface
|
|
2
|
+
import { RsdoctorWebpackSDK } from '../sdk';
|
|
3
|
+
import type { RsdoctorSDKController } from './controller';
|
|
4
|
+
interface RsdoctorSlaveSDKOptions {
|
|
5
5
|
name: string;
|
|
6
6
|
/**
|
|
7
7
|
* use to sort for display in the client page.
|
|
@@ -10,9 +10,9 @@ interface DoctorSlaveSDKOptions {
|
|
|
10
10
|
*/
|
|
11
11
|
stage?: number;
|
|
12
12
|
extraConfig?: SDK.SDKOptionsType;
|
|
13
|
-
controller:
|
|
13
|
+
controller: RsdoctorSDKController;
|
|
14
14
|
}
|
|
15
|
-
export declare class
|
|
15
|
+
export declare class RsdoctorSlaveSDK extends RsdoctorWebpackSDK {
|
|
16
16
|
id: number;
|
|
17
17
|
readonly stage: number;
|
|
18
18
|
private parent;
|
|
@@ -23,13 +23,13 @@ export declare class DoctorSlaveSDK extends DoctorWebpackSDK {
|
|
|
23
23
|
stage,
|
|
24
24
|
controller,
|
|
25
25
|
extraConfig
|
|
26
|
-
}:
|
|
26
|
+
}: RsdoctorSlaveSDKOptions);
|
|
27
27
|
private clearSwitch;
|
|
28
28
|
get isMaster(): boolean;
|
|
29
29
|
protected writePieces(): Promise<void>;
|
|
30
30
|
protected writeManifest(): Promise<string>;
|
|
31
|
-
getSeriesData(serverUrl?: boolean): import("@rsdoctor/types/dist/manifest").
|
|
31
|
+
getSeriesData(serverUrl?: boolean): import("@rsdoctor/types/dist/manifest").RsdoctorManifestSeriesData[];
|
|
32
32
|
setName(name: string): void;
|
|
33
|
-
getManifestData(): import("@rsdoctor/types/dist/manifest").
|
|
33
|
+
getManifestData(): import("@rsdoctor/types/dist/manifest").RsdoctorManifestWithShardingFiles;
|
|
34
34
|
}
|
|
35
35
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Common, Manifest, SDK } from '@rsdoctor/types';
|
|
2
|
-
import {
|
|
3
|
-
export declare abstract class SDKCore<T extends
|
|
2
|
+
import { RsdoctorSDKOptions, DataWithUrl } from './types';
|
|
3
|
+
export declare abstract class SDKCore<T extends RsdoctorSDKOptions> implements SDK.RsdoctorSDKInstance {
|
|
4
4
|
protected _name: string;
|
|
5
5
|
protected hash: string;
|
|
6
6
|
extraConfig: SDK.SDKOptionsType | undefined;
|
|
@@ -11,7 +11,7 @@ export declare abstract class SDKCore<T extends DoctorSDKOptions> implements SDK
|
|
|
11
11
|
private _clientRoutes;
|
|
12
12
|
private _outputDir;
|
|
13
13
|
diskManifestPath: string;
|
|
14
|
-
cloudData?: Manifest.
|
|
14
|
+
cloudData?: Manifest.RsdoctorManifestWithShardingFiles;
|
|
15
15
|
constructor({
|
|
16
16
|
name,
|
|
17
17
|
root
|
|
@@ -23,8 +23,8 @@ export declare abstract class SDKCore<T extends DoctorSDKOptions> implements SDK
|
|
|
23
23
|
setOutputDir(outputDir: string): void;
|
|
24
24
|
setName(name: string): void;
|
|
25
25
|
setHash(hash: string): void;
|
|
26
|
-
getClientRoutes(): Manifest.
|
|
27
|
-
addClientRoutes(routes: Manifest.
|
|
26
|
+
getClientRoutes(): Manifest.RsdoctorManifestClientRoutes[];
|
|
27
|
+
addClientRoutes(routes: Manifest.RsdoctorManifestClientRoutes[]): void;
|
|
28
28
|
/** Upload analysis data pieces */
|
|
29
29
|
protected writePieces(storeData: Common.PlainObject, _options?: SDK.WriteStoreOptionsType): Promise<void>;
|
|
30
30
|
/** Upload manifest file */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './webpack';
|
|
2
|
-
export {
|
|
2
|
+
export { RsdoctorWebpackSDK as RsdoctorSDK } from './webpack';
|
|
@@ -8,14 +8,14 @@ export interface DataWithUrl {
|
|
|
8
8
|
content: Buffer;
|
|
9
9
|
}[] | string;
|
|
10
10
|
}
|
|
11
|
-
export interface
|
|
11
|
+
export interface RsdoctorSDKOptions {
|
|
12
12
|
name: string;
|
|
13
13
|
root: string;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* sdk options for builder.
|
|
17
17
|
*/
|
|
18
|
-
export interface
|
|
18
|
+
export interface RsdoctorBuilderSDK extends RsdoctorSDKOptions {
|
|
19
19
|
type?: SDK.ToDataType;
|
|
20
20
|
/**
|
|
21
21
|
* port for client server
|
|
@@ -24,5 +24,5 @@ export interface DoctorBuilderSDK extends DoctorSDKOptions {
|
|
|
24
24
|
noServer?: boolean;
|
|
25
25
|
config?: SDK.SDKOptionsType;
|
|
26
26
|
}
|
|
27
|
-
export interface
|
|
28
|
-
export interface
|
|
27
|
+
export interface RsdoctorWebpackSDKOptions extends RsdoctorBuilderSDK {}
|
|
28
|
+
export interface RsdoctorEMOSDKOptions extends RsdoctorSDKOptions {}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Manifest, SDK } from '@rsdoctor/types';
|
|
2
2
|
import { RawSourceMap, SourceMapConsumer } from 'source-map';
|
|
3
3
|
import { ModuleGraph, ChunkGraph, PackageGraph } from '@rsdoctor/graph';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { RsdoctorServer } from '../server';
|
|
5
|
+
import { RsdoctorWebpackSDKOptions } from './types';
|
|
6
6
|
import { SDKCore } from './core';
|
|
7
|
-
export declare class
|
|
8
|
-
server:
|
|
7
|
+
export declare class RsdoctorWebpackSDK<T extends RsdoctorWebpackSDKOptions = RsdoctorWebpackSDKOptions> extends SDKCore<T> implements SDK.RsdoctorBuilderSDKInstance {
|
|
8
|
+
server: RsdoctorServer;
|
|
9
9
|
extraConfig: SDK.SDKOptionsType | undefined;
|
|
10
10
|
private type;
|
|
11
11
|
private _summary;
|
|
@@ -41,7 +41,7 @@ export declare class DoctorWebpackSDK<T extends DoctorWebpackSDKOptions = Doctor
|
|
|
41
41
|
createPackageGraph(): void;
|
|
42
42
|
writeStore(options?: SDK.WriteStoreOptionsType): Promise<string>;
|
|
43
43
|
getStoreData(): SDK.BuilderStoreData;
|
|
44
|
-
getManifestData(): Manifest.
|
|
44
|
+
getManifestData(): Manifest.RsdoctorManifestWithShardingFiles;
|
|
45
45
|
getRuleContext(_options: SDK.RuntimeContextOptions): SDK.RuntimeContext;
|
|
46
46
|
onDataReport(): void | Promise<void>;
|
|
47
47
|
}
|
|
@@ -4,8 +4,8 @@ export declare class BaseAPI implements Manifest.ManifestDataLoader {
|
|
|
4
4
|
[key: string | symbol]: any;
|
|
5
5
|
readonly ctx: SDK.ServerAPI.APIContext;
|
|
6
6
|
protected dataLoader: Data.APIDataLoader;
|
|
7
|
-
constructor(sdk: SDK.
|
|
8
|
-
loadManifest(): Promise<Manifest.
|
|
9
|
-
loadData<T extends Manifest.
|
|
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
10
|
loadData(key: string): Promise<void>;
|
|
11
11
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SDK } from '@rsdoctor/types';
|
|
2
|
-
import {
|
|
3
|
-
export declare class
|
|
4
|
-
protected sdk: SDK.
|
|
5
|
-
constructor(sdk: SDK.
|
|
2
|
+
import { RsdoctorServer } from '.';
|
|
3
|
+
export declare class RsdoctorFakeServer extends RsdoctorServer {
|
|
4
|
+
protected sdk: SDK.RsdoctorBuilderSDKInstance;
|
|
5
|
+
constructor(sdk: SDK.RsdoctorBuilderSDKInstance, port?: number);
|
|
6
6
|
openClientPage(): Promise<void>;
|
|
7
7
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
/// <reference types="connect" />
|
|
2
2
|
import { Common, SDK, Thirdparty, Client } from '@rsdoctor/types';
|
|
3
3
|
export * from './utils';
|
|
4
|
-
export declare class
|
|
5
|
-
protected sdk: SDK.
|
|
4
|
+
export declare class RsdoctorServer implements SDK.RsdoctorServerInstance {
|
|
5
|
+
protected sdk: SDK.RsdoctorBuilderSDKInstance;
|
|
6
6
|
private _server;
|
|
7
7
|
port: number;
|
|
8
8
|
private _socket?;
|
|
9
9
|
private disposed;
|
|
10
10
|
private _router;
|
|
11
|
-
constructor(sdk: SDK.
|
|
12
|
-
get app(): SDK.
|
|
11
|
+
constructor(sdk: SDK.RsdoctorBuilderSDKInstance, port?: number);
|
|
12
|
+
get app(): SDK.RsdoctorServerInstance['app'];
|
|
13
13
|
get origin(): string;
|
|
14
14
|
get socketUrl(): string;
|
|
15
15
|
bootstrap(): Promise<void>;
|
|
16
16
|
protected wrapNextHandleFunction(method: 'GET' | 'POST', cb: (...args: Parameters<Thirdparty.connect.NextHandleFunction>) => Common.PlainObject | string): Thirdparty.connect.NextHandleFunction;
|
|
17
17
|
proxy(api: SDK.ServerAPI.API, method: 'GET' | 'POST', cb: (...args: Parameters<Thirdparty.connect.NextHandleFunction>) => Common.PlainObject | string): void;
|
|
18
|
-
get: SDK.
|
|
19
|
-
post: SDK.
|
|
20
|
-
getClientUrl(route: Client.
|
|
18
|
+
get: SDK.RsdoctorServerInstance['get'];
|
|
19
|
+
post: SDK.RsdoctorServerInstance['post'];
|
|
20
|
+
getClientUrl(route: Client.RsdoctorClientRoutes, baselineUrl: string, currentUrl: string): string;
|
|
21
21
|
getClientUrl(route?: 'homepage'): string;
|
|
22
|
-
openClientPage(route: Client.
|
|
22
|
+
openClientPage(route: Client.RsdoctorClientRoutes, baselineUrl: string, currentUrl: string): Promise<void>;
|
|
23
23
|
openClientPage(route?: 'homepage'): Promise<void>;
|
|
24
24
|
sendAPIDataToClient<T extends SDK.ServerAPI.API | SDK.ServerAPI.APIExtends>(api: T, msg: SDK.ServerAPI.SocketResponseType<T>): void;
|
|
25
25
|
broadcast(): Promise<void>;
|
|
@@ -4,8 +4,8 @@ import { Common, SDK, Thirdparty } from '@rsdoctor/types';
|
|
|
4
4
|
import { BaseAPI } from './apis/base';
|
|
5
5
|
interface RouterOptions {
|
|
6
6
|
apis: Common.Constructor<typeof BaseAPI>[];
|
|
7
|
-
sdk: SDK.
|
|
8
|
-
server: SDK.
|
|
7
|
+
sdk: SDK.RsdoctorBuilderSDKInstance;
|
|
8
|
+
server: SDK.RsdoctorServerInstance;
|
|
9
9
|
}
|
|
10
10
|
export declare class Router {
|
|
11
11
|
protected options: RouterOptions;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Data } from '@rsdoctor/utils/common';
|
|
2
2
|
import { Manifest, SDK } from '@rsdoctor/types';
|
|
3
3
|
interface SocketAPILoaderOptions {
|
|
4
|
-
sdk: SDK.
|
|
4
|
+
sdk: SDK.RsdoctorBuilderSDKInstance;
|
|
5
5
|
}
|
|
6
6
|
export declare class SocketAPILoader implements Manifest.ManifestDataLoader {
|
|
7
7
|
protected options: SocketAPILoaderOptions;
|
|
8
8
|
protected dataLoader: Data.APIDataLoader;
|
|
9
9
|
constructor(options: SocketAPILoaderOptions);
|
|
10
|
-
loadManifest(): Promise<Manifest.
|
|
11
|
-
loadData<T extends Manifest.
|
|
10
|
+
loadManifest(): Promise<Manifest.RsdoctorManifestWithShardingFiles>;
|
|
11
|
+
loadData<T extends Manifest.RsdoctorManifestMappingKeys>(key: T): Promise<Manifest.InferManifestDataValue<T>>;
|
|
12
12
|
loadData(key: string): Promise<void>;
|
|
13
13
|
get loadAPIData(): <T extends SDK.ServerAPI.API, B extends import("@rsdoctor/types/dist/common").Get<SDK.ServerAPI.ResquestBodyTypes, T, void> = import("@rsdoctor/types/dist/common").Get<SDK.ServerAPI.ResquestBodyTypes, T, void>, R extends import("@rsdoctor/types/dist/common").Get<SDK.ServerAPI.ResponseTypes, T, void> = import("@rsdoctor/types/dist/common").Get<SDK.ServerAPI.ResponseTypes, T, void>>(...args: B extends void ? [api: T] : [api: T, body: B]) => Promise<import("@rsdoctor/types/dist/common").Get<SDK.ServerAPI.ResponseTypes, T, void>>;
|
|
14
14
|
}
|
|
@@ -5,7 +5,7 @@ import type { Server } from 'http';
|
|
|
5
5
|
import { Server as SocketServer, ServerOptions as SocketServerOptions, Socket as SocketType } from 'socket.io';
|
|
6
6
|
import { SocketAPILoader } from './api';
|
|
7
7
|
interface SocketOptions {
|
|
8
|
-
sdk: SDK.
|
|
8
|
+
sdk: SDK.RsdoctorBuilderSDKInstance;
|
|
9
9
|
server: Server;
|
|
10
10
|
port: number;
|
|
11
11
|
socketOptions?: SocketServerOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/sdk",
|
|
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",
|
|
@@ -23,9 +23,10 @@
|
|
|
23
23
|
"socket.io": "4.7.2",
|
|
24
24
|
"source-map": "^0.7.4",
|
|
25
25
|
"tapable": "2.2.1",
|
|
26
|
-
"@rsdoctor/utils": "0.0.2-beta.
|
|
27
|
-
"@rsdoctor/
|
|
28
|
-
"@rsdoctor/
|
|
26
|
+
"@rsdoctor/utils": "0.0.2-beta.2",
|
|
27
|
+
"@rsdoctor/graph": "0.0.2-beta.2",
|
|
28
|
+
"@rsdoctor/types": "0.0.2-beta.2",
|
|
29
|
+
"@rsdoctor/client": "0.0.2-beta.2"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@types/body-parser": "1.19.2",
|
|
@@ -34,8 +35,7 @@
|
|
|
34
35
|
"@types/node": "^16",
|
|
35
36
|
"@types/serve-static": "1.15.0",
|
|
36
37
|
"tslib": "2.4.1",
|
|
37
|
-
"typescript": "^5.2.2"
|
|
38
|
-
"@rsdoctor/types": "0.0.2-beta.0"
|
|
38
|
+
"typescript": "^5.2.2"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public",
|