@rsdoctor/core 2.0.0-alpha.1 → 2.0.0-beta.0

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 (177) hide show
  1. package/dist/26.js +26174 -0
  2. package/dist/630.js +1280 -0
  3. package/dist/630.js.LICENSE.txt +7 -0
  4. package/dist/build-utils/build/chunks/assetsModules.d.ts +7 -1
  5. package/dist/build-utils/build/loader/probeLoader.d.ts +7 -2
  6. package/dist/build-utils/build/server.d.ts +1 -2
  7. package/dist/build-utils/build/utils/parseBundle.d.ts +1 -1
  8. package/dist/index.d.ts +5 -5
  9. package/dist/index.js +1908 -7
  10. package/dist/inner-plugins/constants.d.ts +1 -1
  11. package/dist/inner-plugins/plugins/base.d.ts +2 -2
  12. package/dist/inner-plugins/plugins/errors.d.ts +1 -0
  13. package/dist/inner-plugins/plugins/plugins.d.ts +1 -1
  14. package/dist/inner-plugins/plugins/summary.d.ts +3 -2
  15. package/dist/inner-plugins/utils/sdk.d.ts +2 -1
  16. package/dist/logger.d.ts +2 -2
  17. package/dist/probe-loader.js +2 -0
  18. package/dist/proxy-loader.d.ts +1 -0
  19. package/dist/proxy-loader.js +48 -0
  20. package/dist/rslib-runtime.js +28 -0
  21. package/dist/rspack-plugin/constants.d.ts +1 -1
  22. package/dist/rspack-plugin/multiple.d.ts +5 -3
  23. package/dist/rspack-plugin/plugin.d.ts +43 -17
  24. package/dist/rspack-plugin/session.d.ts +20 -0
  25. package/dist/rules/rules/ecma-version-check/htmlParserStub.d.ts +3 -0
  26. package/dist/rules/rules/ecma-version-check/types.d.ts +13 -2
  27. package/dist/sdk/multiple/controller.d.ts +13 -2
  28. package/dist/sdk/multiple/primary.d.ts +12 -4
  29. package/dist/sdk/server/apis/base.d.ts +1 -1
  30. package/dist/sdk/server/socket/api.d.ts +1 -1
  31. package/dist/sdk/utils/date.d.ts +1 -0
  32. package/dist/types/loader.d.ts +1 -1
  33. package/package.json +23 -117
  34. package/dist/build-utils/build/chunks/assetsModules.js +0 -9
  35. package/dist/build-utils/build/chunks/index.js +0 -3
  36. package/dist/build-utils/build/chunks/rspack/transform.js +0 -44
  37. package/dist/build-utils/build/envinfo.js +0 -60
  38. package/dist/build-utils/build/file/cache.js +0 -24
  39. package/dist/build-utils/build/file/index.js +0 -5
  40. package/dist/build-utils/build/file/sharding.js +0 -38
  41. package/dist/build-utils/build/index.js +0 -12
  42. package/dist/build-utils/build/json.js +0 -67
  43. package/dist/build-utils/build/loader/index.js +0 -3
  44. package/dist/build-utils/build/loader/probeLoader.js +0 -44
  45. package/dist/build-utils/build/loader/probeLoaderPlugin.js +0 -32
  46. package/dist/build-utils/build/module-graph/index.js +0 -2
  47. package/dist/build-utils/build/module-graph/parser.js +0 -13
  48. package/dist/build-utils/build/module-graph/rspack/transform.js +0 -111
  49. package/dist/build-utils/build/module-graph/utils.js +0 -60
  50. package/dist/build-utils/build/process.js +0 -18
  51. package/dist/build-utils/build/server.js +0 -107
  52. package/dist/build-utils/build/utils/index.js +0 -4
  53. package/dist/build-utils/build/utils/loader.js +0 -267
  54. package/dist/build-utils/build/utils/parseBundle.js +0 -238
  55. package/dist/build-utils/build/utils/plugin.js +0 -21
  56. package/dist/build-utils/index.js +0 -13
  57. package/dist/collection.d.ts +0 -1
  58. package/dist/collection.js +0 -2
  59. package/dist/common/file.js +0 -8
  60. package/dist/common/global-config.js +0 -33
  61. package/dist/common/index.d.ts +0 -4
  62. package/dist/common/index.js +0 -6
  63. package/dist/common-browser.d.ts +0 -1
  64. package/dist/common-browser.js +0 -2
  65. package/dist/error/error.js +0 -143
  66. package/dist/error/index.js +0 -3
  67. package/dist/error/transform.js +0 -138
  68. package/dist/error/utils.js +0 -23
  69. package/dist/graph/index.d.ts +0 -1
  70. package/dist/graph/index.js +0 -2
  71. package/dist/inner-plugins/constants.js +0 -19
  72. package/dist/inner-plugins/index.js +0 -3
  73. package/dist/inner-plugins/loaders/proxy.js +0 -65
  74. package/dist/inner-plugins/plugins/base.js +0 -20
  75. package/dist/inner-plugins/plugins/bundle.js +0 -63
  76. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +0 -74
  77. package/dist/inner-plugins/plugins/errors.js +0 -65
  78. package/dist/inner-plugins/plugins/index.js +0 -11
  79. package/dist/inner-plugins/plugins/loader.js +0 -108
  80. package/dist/inner-plugins/plugins/plugins.js +0 -40
  81. package/dist/inner-plugins/plugins/progress.js +0 -35
  82. package/dist/inner-plugins/plugins/resolver.js +0 -57
  83. package/dist/inner-plugins/plugins/rspack.js +0 -99
  84. package/dist/inner-plugins/plugins/rules.js +0 -64
  85. package/dist/inner-plugins/plugins/sourcemapTool.js +0 -230
  86. package/dist/inner-plugins/plugins/summary.js +0 -92
  87. package/dist/inner-plugins/utils/circleDetect.js +0 -16
  88. package/dist/inner-plugins/utils/config.js +0 -141
  89. package/dist/inner-plugins/utils/index.js +0 -8
  90. package/dist/inner-plugins/utils/loader.js +0 -134
  91. package/dist/inner-plugins/utils/normalize-config.js +0 -77
  92. package/dist/inner-plugins/utils/openBrowser.js +0 -55
  93. package/dist/inner-plugins/utils/plugin-common.js +0 -94
  94. package/dist/inner-plugins/utils/plugin.js +0 -70
  95. package/dist/inner-plugins/utils/sdk.js +0 -19
  96. package/dist/logger.js +0 -51
  97. package/dist/rspack-plugin/constants.js +0 -23
  98. package/dist/rspack-plugin/index.js +0 -3
  99. package/dist/rspack-plugin/multiple.js +0 -39
  100. package/dist/rspack-plugin/plugin.js +0 -133
  101. package/dist/rule-utils/document/document.js +0 -46
  102. package/dist/rule-utils/document/index.js +0 -4
  103. package/dist/rule-utils/document/server.js +0 -13
  104. package/dist/rule-utils/document/types.js +0 -1
  105. package/dist/rule-utils/index.js +0 -3
  106. package/dist/rule-utils/parser/asserts.js +0 -105
  107. package/dist/rule-utils/parser/index.js +0 -5
  108. package/dist/rule-utils/parser/parser.js +0 -24
  109. package/dist/rule-utils/parser/types.js +0 -8
  110. package/dist/rule-utils/parser/utils.js +0 -106
  111. package/dist/rules/index.js +0 -4
  112. package/dist/rules/linter.js +0 -36
  113. package/dist/rules/rule.js +0 -101
  114. package/dist/rules/rules/cjs-require/index.js +0 -50
  115. package/dist/rules/rules/cjs-require/types.js +0 -1
  116. package/dist/rules/rules/cross-chunks-package/index.js +0 -41
  117. package/dist/rules/rules/cross-chunks-package/types.js +0 -1
  118. package/dist/rules/rules/cross-chunks-package/utils.js +0 -7
  119. package/dist/rules/rules/default-import-check/index.js +0 -83
  120. package/dist/rules/rules/default-import-check/types.js +0 -1
  121. package/dist/rules/rules/default-import-check/utils.js +0 -52
  122. package/dist/rules/rules/duplicate-package/index.js +0 -39
  123. package/dist/rules/rules/duplicate-package/types.js +0 -24
  124. package/dist/rules/rules/duplicate-package/utils.js +0 -38
  125. package/dist/rules/rules/ecma-version-check/index.js +0 -53
  126. package/dist/rules/rules/ecma-version-check/types.js +0 -1
  127. package/dist/rules/rules/ecma-version-check/utils.js +0 -6
  128. package/dist/rules/rules/esm-resolved-to-cjs/index.js +0 -193
  129. package/dist/rules/rules/esm-resolved-to-cjs/types.js +0 -1
  130. package/dist/rules/rules/index.js +0 -22
  131. package/dist/rules/rules/loader-performance-optimization/index.js +0 -86
  132. package/dist/rules/rules/loader-performance-optimization/types.js +0 -1
  133. package/dist/rules/rules/loader-performance-optimization/utils.js +0 -10
  134. package/dist/rules/rules/module-mixed-chunks/index.js +0 -52
  135. package/dist/rules/rules/module-mixed-chunks/types.js +0 -1
  136. package/dist/rules/rules/side-effects-only-imports/index.js +0 -81
  137. package/dist/rules/rules/side-effects-only-imports/types.js +0 -1
  138. package/dist/rules/utils.js +0 -10
  139. package/dist/sdk/index.js +0 -3
  140. package/dist/sdk/multiple/controller.js +0 -42
  141. package/dist/sdk/multiple/index.js +0 -3
  142. package/dist/sdk/multiple/primary.js +0 -64
  143. package/dist/sdk/multiple/server.js +0 -14
  144. package/dist/sdk/sdk/core.js +0 -163
  145. package/dist/sdk/sdk/index.js +0 -435
  146. package/dist/sdk/sdk/types.js +0 -1
  147. package/dist/sdk/server/apis/alerts.js +0 -30
  148. package/dist/sdk/server/apis/base.js +0 -22
  149. package/dist/sdk/server/apis/bundle-diff.js +0 -51
  150. package/dist/sdk/server/apis/data.js +0 -44
  151. package/dist/sdk/server/apis/fs.js +0 -28
  152. package/dist/sdk/server/apis/graph.js +0 -116
  153. package/dist/sdk/server/apis/index.js +0 -11
  154. package/dist/sdk/server/apis/loader.js +0 -120
  155. package/dist/sdk/server/apis/plugin.js +0 -39
  156. package/dist/sdk/server/apis/project.js +0 -59
  157. package/dist/sdk/server/apis/renderer.js +0 -33
  158. package/dist/sdk/server/apis/resolver.js +0 -38
  159. package/dist/sdk/server/client.js +0 -8
  160. package/dist/sdk/server/fakeServer.js +0 -12
  161. package/dist/sdk/server/index.js +0 -292
  162. package/dist/sdk/server/json-body.js +0 -150
  163. package/dist/sdk/server/router.js +0 -83
  164. package/dist/sdk/server/security.js +0 -47
  165. package/dist/sdk/server/socket/api.js +0 -22
  166. package/dist/sdk/server/socket/index.js +0 -166
  167. package/dist/sdk/server/utils.js +0 -19
  168. package/dist/sdk/utils/base.js +0 -22
  169. package/dist/sdk/utils/constant.js +0 -4
  170. package/dist/sdk/utils/index.js +0 -4
  171. package/dist/sdk/utils/openBrowser.js +0 -53
  172. package/dist/sdk/utils/upload.js +0 -6
  173. package/dist/sdk.js +0 -2
  174. package/dist/types/index.js +0 -4
  175. package/dist/types/loader.js +0 -1
  176. package/dist/types/plugin.js +0 -1
  177. package/dist/types/rules.js +0 -1
@@ -1,51 +0,0 @@
1
- import "node:module";
2
- import { SDK } from "@rsdoctor/shared/types";
3
- import { BaseAPI } from "./base.js";
4
- import { Router } from "../router.js";
5
- function _ts_decorate(decorators, target, key, desc) {
6
- var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
8
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10
- }
11
- function _ts_metadata(k, v) {
12
- if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
13
- }
14
- class BundleDiffAPI extends BaseAPI {
15
- async getBundleDiffSummary() {
16
- const { sdk } = this.ctx;
17
- const { root, hash, errors, chunkGraph, moduleGraph, packageGraph, configs, moduleCodeMap, cloudManifestUrl } = sdk.getStoreData();
18
- let outputFilename = '';
19
- if ('string' == typeof configs?.[0]?.config?.output?.filename) outputFilename = configs?.[0]?.config?.output?.filename;
20
- return {
21
- root,
22
- hash,
23
- errors,
24
- chunkGraph,
25
- moduleGraph,
26
- packageGraph,
27
- outputFilename,
28
- moduleCodeMap,
29
- cloudManifestUrl
30
- };
31
- }
32
- async bundleDiffManifest() {
33
- const { sdk } = this.ctx;
34
- const data = sdk.getStoreData();
35
- return data;
36
- }
37
- }
38
- _ts_decorate([
39
- Router.get(SDK.ServerAPI.API.GetBundleDiffSummary),
40
- Router.post(SDK.ServerAPI.API.GetBundleDiffSummary),
41
- _ts_metadata("design:type", Function),
42
- _ts_metadata("design:paramtypes", []),
43
- _ts_metadata("design:returntype", Promise)
44
- ], BundleDiffAPI.prototype, "getBundleDiffSummary", null);
45
- _ts_decorate([
46
- Router.get(SDK.ServerAPI.API.BundleDiffManifest),
47
- _ts_metadata("design:type", Function),
48
- _ts_metadata("design:paramtypes", []),
49
- _ts_metadata("design:returntype", Promise)
50
- ], BundleDiffAPI.prototype, "bundleDiffManifest", null);
51
- export { BundleDiffAPI };
@@ -1,44 +0,0 @@
1
- import "node:module";
2
- import { SDK } from "@rsdoctor/shared/types";
3
- import { BaseAPI } from "./base.js";
4
- import { Router } from "../router.js";
5
- function _ts_decorate(decorators, target, key, desc) {
6
- var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
8
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10
- }
11
- function _ts_metadata(k, v) {
12
- if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
13
- }
14
- class DataAPI extends BaseAPI {
15
- async loadDataByKey() {
16
- const { req } = this.ctx;
17
- const { url } = req;
18
- let { key } = req.body;
19
- if (!key && url) {
20
- const uri = new URL(url, 'http://127.0.0.1');
21
- key = uri.pathname.replace(/^\//, '');
22
- }
23
- const data = await this.loadData(key);
24
- return data;
25
- }
26
- async sendMessageToClient() {
27
- const { req, server } = this.ctx;
28
- const { api, data } = req.body;
29
- await server.sendAPIDataToClient(api, data);
30
- }
31
- }
32
- _ts_decorate([
33
- Router.post(SDK.ServerAPI.API.LoadDataByKey),
34
- _ts_metadata("design:type", Function),
35
- _ts_metadata("design:paramtypes", []),
36
- _ts_metadata("design:returntype", Promise)
37
- ], DataAPI.prototype, "loadDataByKey", null);
38
- _ts_decorate([
39
- Router.post(SDK.ServerAPI.API.SendAPIDataToClient),
40
- _ts_metadata("design:type", Function),
41
- _ts_metadata("design:paramtypes", []),
42
- _ts_metadata("design:returntype", Promise)
43
- ], DataAPI.prototype, "sendMessageToClient", null);
44
- export { DataAPI };
@@ -1,28 +0,0 @@
1
- import "node:module";
2
- import { SDK } from "@rsdoctor/shared/types";
3
- import { BaseAPI } from "./base.js";
4
- import { Router } from "../router.js";
5
- function _ts_decorate(decorators, target, key, desc) {
6
- var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
8
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10
- }
11
- function _ts_metadata(k, v) {
12
- if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
13
- }
14
- class FileSystemAPI extends BaseAPI {
15
- async applyErrorFix() {
16
- const { body } = this.ctx.req;
17
- const data = body;
18
- await this.ctx.sdk.applyErrorFix(data.id);
19
- return 'success';
20
- }
21
- }
22
- _ts_decorate([
23
- Router.post(SDK.ServerAPI.API.ApplyErrorFix),
24
- _ts_metadata("design:type", Function),
25
- _ts_metadata("design:paramtypes", []),
26
- _ts_metadata("design:returntype", Promise)
27
- ], FileSystemAPI.prototype, "applyErrorFix", null);
28
- export { FileSystemAPI };
@@ -1,116 +0,0 @@
1
- import "node:module";
2
- import { SDK } from "@rsdoctor/shared/types";
3
- import { BaseAPI } from "./base.js";
4
- import { Router } from "../router.js";
5
- function _ts_decorate(decorators, target, key, desc) {
6
- var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
8
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10
- }
11
- function _ts_metadata(k, v) {
12
- if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
13
- }
14
- class GraphAPI extends BaseAPI {
15
- async getAssetsSummary() {
16
- const { req } = this.ctx;
17
- const { withFileContent } = req.body;
18
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetAssetsSummary, {
19
- withFileContent
20
- });
21
- }
22
- async getModuleGraphForAsset() {
23
- const { req } = this.ctx;
24
- const { assetPath } = req.body;
25
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetAssetDetails, {
26
- assetPath
27
- });
28
- }
29
- async getChunksByModuleId() {
30
- const { req } = this.ctx;
31
- const { moduleId } = req.body;
32
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetChunksByModuleId, {
33
- moduleId
34
- });
35
- }
36
- async getModuleDetails() {
37
- const { req } = this.ctx;
38
- const { moduleId } = req.body;
39
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetModuleDetails, {
40
- moduleId
41
- });
42
- }
43
- async getDependencyByResolvedRequest() {
44
- const { req } = this.ctx;
45
- const { moduleIds = [] } = req.body;
46
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetModulesByModuleIds, {
47
- moduleIds
48
- });
49
- }
50
- async getModuleCodeByModuleId() {
51
- const { req } = this.ctx;
52
- const { moduleId } = req.body;
53
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetModuleCodeByModuleId, {
54
- moduleId
55
- });
56
- }
57
- async getModuleCodeByModuleIds() {
58
- const { req } = this.ctx;
59
- const { moduleIds } = req.body;
60
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetModuleCodeByModuleIds, {
61
- moduleIds
62
- });
63
- }
64
- async getEntryModulesSummary() {
65
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetEntryPoints);
66
- }
67
- }
68
- _ts_decorate([
69
- Router.post(SDK.ServerAPI.API.GetAssetsSummary),
70
- _ts_metadata("design:type", Function),
71
- _ts_metadata("design:paramtypes", []),
72
- _ts_metadata("design:returntype", Promise)
73
- ], GraphAPI.prototype, "getAssetsSummary", null);
74
- _ts_decorate([
75
- Router.post(SDK.ServerAPI.API.GetAssetDetails),
76
- _ts_metadata("design:type", Function),
77
- _ts_metadata("design:paramtypes", []),
78
- _ts_metadata("design:returntype", Promise)
79
- ], GraphAPI.prototype, "getModuleGraphForAsset", null);
80
- _ts_decorate([
81
- Router.post(SDK.ServerAPI.API.GetChunksByModuleId),
82
- _ts_metadata("design:type", Function),
83
- _ts_metadata("design:paramtypes", []),
84
- _ts_metadata("design:returntype", Promise)
85
- ], GraphAPI.prototype, "getChunksByModuleId", null);
86
- _ts_decorate([
87
- Router.post(SDK.ServerAPI.API.GetModuleDetails),
88
- _ts_metadata("design:type", Function),
89
- _ts_metadata("design:paramtypes", []),
90
- _ts_metadata("design:returntype", Promise)
91
- ], GraphAPI.prototype, "getModuleDetails", null);
92
- _ts_decorate([
93
- Router.post(SDK.ServerAPI.API.GetModulesByModuleIds),
94
- _ts_metadata("design:type", Function),
95
- _ts_metadata("design:paramtypes", []),
96
- _ts_metadata("design:returntype", Promise)
97
- ], GraphAPI.prototype, "getDependencyByResolvedRequest", null);
98
- _ts_decorate([
99
- Router.post(SDK.ServerAPI.API.GetModuleCodeByModuleId),
100
- _ts_metadata("design:type", Function),
101
- _ts_metadata("design:paramtypes", []),
102
- _ts_metadata("design:returntype", Promise)
103
- ], GraphAPI.prototype, "getModuleCodeByModuleId", null);
104
- _ts_decorate([
105
- Router.post(SDK.ServerAPI.API.GetModuleCodeByModuleIds),
106
- _ts_metadata("design:type", Function),
107
- _ts_metadata("design:paramtypes", []),
108
- _ts_metadata("design:returntype", Promise)
109
- ], GraphAPI.prototype, "getModuleCodeByModuleIds", null);
110
- _ts_decorate([
111
- Router.post(SDK.ServerAPI.API.GetEntryPoints),
112
- _ts_metadata("design:type", Function),
113
- _ts_metadata("design:paramtypes", []),
114
- _ts_metadata("design:returntype", Promise)
115
- ], GraphAPI.prototype, "getEntryModulesSummary", null);
116
- export { GraphAPI };
@@ -1,11 +0,0 @@
1
- import "node:module";
2
- export * from "./alerts.js";
3
- export * from "./bundle-diff.js";
4
- export * from "./fs.js";
5
- export * from "./loader.js";
6
- export * from "./graph.js";
7
- export * from "./plugin.js";
8
- export * from "./project.js";
9
- export * from "./renderer.js";
10
- export * from "./resolver.js";
11
- export { DataAPI } from "./data.js";
@@ -1,120 +0,0 @@
1
- import "node:module";
2
- import { SDK } from "@rsdoctor/shared/types";
3
- import { BaseAPI } from "./base.js";
4
- import { Router } from "../router.js";
5
- function _ts_decorate(decorators, target, key, desc) {
6
- var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
8
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10
- }
11
- function _ts_metadata(k, v) {
12
- if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
13
- }
14
- class LoaderAPI extends BaseAPI {
15
- async reportLoader() {
16
- const { req, sdk } = this.ctx;
17
- const { body } = req;
18
- sdk.reportLoader(body);
19
- return 'ok';
20
- }
21
- async reportSourceMap() {
22
- const { req: { body }, sdk } = this.ctx;
23
- sdk.reportSourceMap(body);
24
- return 'ok';
25
- }
26
- async getLoaderNames() {
27
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetLoaderNames);
28
- }
29
- async getLoaderChartData() {
30
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetLoaderChartData);
31
- }
32
- async getLoaderFileTree() {
33
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetLoaderFileTree);
34
- }
35
- async getLoaderFileDetails() {
36
- const { req } = this.ctx;
37
- const { path } = req.body;
38
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetLoaderFileDetails, {
39
- path
40
- });
41
- }
42
- async getLoaderFolderStatistics() {
43
- const { req } = this.ctx;
44
- const { folder } = req.body;
45
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetLoaderFolderStatistics, {
46
- folder
47
- });
48
- }
49
- async getLoaderFileFirstInput() {
50
- const { req } = this.ctx;
51
- const { file } = req.body;
52
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetLoaderFileFirstInput, {
53
- file
54
- });
55
- }
56
- async getLoaderFileInputAndOutput() {
57
- const { req } = this.ctx;
58
- const { file, loader, loaderIndex } = req.body;
59
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetLoaderFileInputAndOutput, {
60
- file,
61
- loader,
62
- loaderIndex
63
- });
64
- }
65
- }
66
- _ts_decorate([
67
- Router.post(SDK.ServerAPI.API.ReportLoader),
68
- _ts_metadata("design:type", Function),
69
- _ts_metadata("design:paramtypes", []),
70
- _ts_metadata("design:returntype", Promise)
71
- ], LoaderAPI.prototype, "reportLoader", null);
72
- _ts_decorate([
73
- Router.post(SDK.ServerAPI.API.ReportSourceMap),
74
- _ts_metadata("design:type", Function),
75
- _ts_metadata("design:paramtypes", []),
76
- _ts_metadata("design:returntype", Promise)
77
- ], LoaderAPI.prototype, "reportSourceMap", null);
78
- _ts_decorate([
79
- Router.post(SDK.ServerAPI.API.GetLoaderNames),
80
- _ts_metadata("design:type", Function),
81
- _ts_metadata("design:paramtypes", []),
82
- _ts_metadata("design:returntype", Promise)
83
- ], LoaderAPI.prototype, "getLoaderNames", null);
84
- _ts_decorate([
85
- Router.post(SDK.ServerAPI.API.GetLoaderChartData),
86
- _ts_metadata("design:type", Function),
87
- _ts_metadata("design:paramtypes", []),
88
- _ts_metadata("design:returntype", Promise)
89
- ], LoaderAPI.prototype, "getLoaderChartData", null);
90
- _ts_decorate([
91
- Router.post(SDK.ServerAPI.API.GetLoaderFileTree),
92
- _ts_metadata("design:type", Function),
93
- _ts_metadata("design:paramtypes", []),
94
- _ts_metadata("design:returntype", Promise)
95
- ], LoaderAPI.prototype, "getLoaderFileTree", null);
96
- _ts_decorate([
97
- Router.post(SDK.ServerAPI.API.GetLoaderFileDetails),
98
- _ts_metadata("design:type", Function),
99
- _ts_metadata("design:paramtypes", []),
100
- _ts_metadata("design:returntype", Promise)
101
- ], LoaderAPI.prototype, "getLoaderFileDetails", null);
102
- _ts_decorate([
103
- Router.post(SDK.ServerAPI.API.GetLoaderFolderStatistics),
104
- _ts_metadata("design:type", Function),
105
- _ts_metadata("design:paramtypes", []),
106
- _ts_metadata("design:returntype", Promise)
107
- ], LoaderAPI.prototype, "getLoaderFolderStatistics", null);
108
- _ts_decorate([
109
- Router.post(SDK.ServerAPI.API.GetLoaderFileFirstInput),
110
- _ts_metadata("design:type", Function),
111
- _ts_metadata("design:paramtypes", []),
112
- _ts_metadata("design:returntype", Promise)
113
- ], LoaderAPI.prototype, "getLoaderFileFirstInput", null);
114
- _ts_decorate([
115
- Router.post(SDK.ServerAPI.API.GetLoaderFileInputAndOutput),
116
- _ts_metadata("design:type", Function),
117
- _ts_metadata("design:paramtypes", []),
118
- _ts_metadata("design:returntype", Promise)
119
- ], LoaderAPI.prototype, "getLoaderFileInputAndOutput", null);
120
- export { LoaderAPI };
@@ -1,39 +0,0 @@
1
- import "node:module";
2
- import { SDK } from "@rsdoctor/shared/types";
3
- import { BaseAPI } from "./base.js";
4
- import { Router } from "../router.js";
5
- function _ts_decorate(decorators, target, key, desc) {
6
- var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
8
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10
- }
11
- function _ts_metadata(k, v) {
12
- if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
13
- }
14
- class PluginAPI extends BaseAPI {
15
- async getPluginSummary() {
16
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetPluginSummary);
17
- }
18
- async getPluginData() {
19
- const { req } = this.ctx;
20
- const { hooks = [], tapNames = [] } = req.body;
21
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetPluginData, {
22
- hooks,
23
- tapNames
24
- });
25
- }
26
- }
27
- _ts_decorate([
28
- Router.post(SDK.ServerAPI.API.GetPluginSummary),
29
- _ts_metadata("design:type", Function),
30
- _ts_metadata("design:paramtypes", []),
31
- _ts_metadata("design:returntype", Promise)
32
- ], PluginAPI.prototype, "getPluginSummary", null);
33
- _ts_decorate([
34
- Router.post(SDK.ServerAPI.API.GetPluginData),
35
- _ts_metadata("design:type", Function),
36
- _ts_metadata("design:paramtypes", []),
37
- _ts_metadata("design:returntype", Promise)
38
- ], PluginAPI.prototype, "getPluginData", null);
39
- export { PluginAPI };
@@ -1,59 +0,0 @@
1
- import "node:module";
2
- import { SDK } from "@rsdoctor/shared/types";
3
- import { BaseAPI } from "./base.js";
4
- import { Router } from "../router.js";
5
- import { getLocalIpAddress } from "../utils.js";
6
- function _ts_decorate(decorators, target, key, desc) {
7
- var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
9
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10
- return c > 3 && r && Object.defineProperty(target, key, r), r;
11
- }
12
- function _ts_metadata(k, v) {
13
- if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
14
- }
15
- class ProjectAPI extends BaseAPI {
16
- async env() {
17
- const { server } = this.ctx;
18
- return {
19
- ip: getLocalIpAddress(),
20
- port: server.port
21
- };
22
- }
23
- async manifest() {
24
- const { sdk } = this.ctx;
25
- const data = sdk.getManifestData();
26
- return JSON.stringify(data);
27
- }
28
- async getProjectInfo() {
29
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetProjectInfo);
30
- }
31
- async getClientRoutes() {
32
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetClientRoutes);
33
- }
34
- }
35
- _ts_decorate([
36
- Router.get(SDK.ServerAPI.API.Env),
37
- _ts_metadata("design:type", Function),
38
- _ts_metadata("design:paramtypes", []),
39
- _ts_metadata("design:returntype", Promise)
40
- ], ProjectAPI.prototype, "env", null);
41
- _ts_decorate([
42
- Router.get(SDK.ServerAPI.API.Manifest),
43
- _ts_metadata("design:type", Function),
44
- _ts_metadata("design:paramtypes", []),
45
- _ts_metadata("design:returntype", Promise)
46
- ], ProjectAPI.prototype, "manifest", null);
47
- _ts_decorate([
48
- Router.post(SDK.ServerAPI.API.GetProjectInfo),
49
- _ts_metadata("design:type", Function),
50
- _ts_metadata("design:paramtypes", []),
51
- _ts_metadata("design:returntype", Promise)
52
- ], ProjectAPI.prototype, "getProjectInfo", null);
53
- _ts_decorate([
54
- Router.post(SDK.ServerAPI.API.GetClientRoutes),
55
- _ts_metadata("design:type", Function),
56
- _ts_metadata("design:paramtypes", []),
57
- _ts_metadata("design:returntype", Promise)
58
- ], ProjectAPI.prototype, "getClientRoutes", null);
59
- export { ProjectAPI };
@@ -1,33 +0,0 @@
1
- import "node:module";
2
- import { SDK } from "@rsdoctor/shared/types";
3
- import node_fs from "node:fs";
4
- import { createRequire } from "module";
5
- import { BaseAPI } from "./base.js";
6
- import { Router } from "../router.js";
7
- function _ts_decorate(decorators, target, key, desc) {
8
- var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
10
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
11
- return c > 3 && r && Object.defineProperty(target, key, r), r;
12
- }
13
- function _ts_metadata(k, v) {
14
- if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
15
- }
16
- const renderer_require = createRequire(import.meta.url);
17
- class RendererAPI extends BaseAPI {
18
- async entryHtml() {
19
- const { server, res } = this.ctx;
20
- const clientHtmlPath = server.innerClientPath ? server.innerClientPath : renderer_require.resolve('@rsdoctor/client');
21
- const clientHtml = node_fs.readFileSync(clientHtmlPath, 'utf-8');
22
- res.setHeader('Content-Type', 'text/html');
23
- res.setHeader('Cache-Control', 'no-store');
24
- return clientHtml;
25
- }
26
- }
27
- _ts_decorate([
28
- Router.get(SDK.ServerAPI.API.EntryHtml),
29
- _ts_metadata("design:type", Function),
30
- _ts_metadata("design:paramtypes", []),
31
- _ts_metadata("design:returntype", Promise)
32
- ], RendererAPI.prototype, "entryHtml", null);
33
- export { RendererAPI };
@@ -1,38 +0,0 @@
1
- import "node:module";
2
- import { SDK } from "@rsdoctor/shared/types";
3
- import { BaseAPI } from "./base.js";
4
- import { Router } from "../router.js";
5
- function _ts_decorate(decorators, target, key, desc) {
6
- var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
8
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10
- }
11
- function _ts_metadata(k, v) {
12
- if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
13
- }
14
- class ResolverAPI extends BaseAPI {
15
- async getResolverFileTree() {
16
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetResolverFileTree);
17
- }
18
- async getResolverFileDetails() {
19
- const { req } = this.ctx;
20
- const { filepath } = req.body;
21
- return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetResolverFileDetails, {
22
- filepath
23
- });
24
- }
25
- }
26
- _ts_decorate([
27
- Router.post(SDK.ServerAPI.API.GetResolverFileTree),
28
- _ts_metadata("design:type", Function),
29
- _ts_metadata("design:paramtypes", []),
30
- _ts_metadata("design:returntype", Promise)
31
- ], ResolverAPI.prototype, "getResolverFileTree", null);
32
- _ts_decorate([
33
- Router.post(SDK.ServerAPI.API.GetResolverFileDetails),
34
- _ts_metadata("design:type", Function),
35
- _ts_metadata("design:paramtypes", []),
36
- _ts_metadata("design:returntype", Promise)
37
- ], ResolverAPI.prototype, "getResolverFileDetails", null);
38
- export { ResolverAPI };
@@ -1,8 +0,0 @@
1
- import "node:module";
2
- import path from "path";
3
- import { createRequire } from "module";
4
- const client_require = createRequire(import.meta.url);
5
- const resolveClientHtmlPath = (innerClientPath)=>innerClientPath || client_require.resolve('@rsdoctor/client');
6
- const resolveClientDistPath = (innerClientPath)=>path.dirname(resolveClientHtmlPath(innerClientPath));
7
- const resolveClientDiffHtmlPath = (innerClientPath)=>path.resolve(resolveClientDistPath(innerClientPath), 'diff.html');
8
- export { resolveClientDiffHtmlPath, resolveClientDistPath, resolveClientHtmlPath };
@@ -1,12 +0,0 @@
1
- import "node:module";
2
- import { Server } from "../../build-utils/index.js";
3
- import { RsdoctorServer } from "./index.js";
4
- class RsdoctorFakeServer extends RsdoctorServer {
5
- async bootstrap() {}
6
- async openClientPage() {}
7
- constructor(sdk, port = Server.defaultPort){
8
- super(sdk, port), this.sdk = sdk, this.dispose = async ()=>{};
9
- this.sdk = sdk;
10
- }
11
- }
12
- export { RsdoctorFakeServer };