@rsdoctor/core 2.0.0-alpha.1 → 2.0.0-alpha.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.
Files changed (167) hide show
  1. package/dist/26.js +26163 -0
  2. package/dist/630.js +1269 -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/utils/parseBundle.d.ts +1 -1
  7. package/dist/index.d.ts +5 -5
  8. package/dist/index.js +1725 -7
  9. package/dist/inner-plugins/constants.d.ts +1 -1
  10. package/dist/inner-plugins/plugins/base.d.ts +2 -2
  11. package/dist/logger.d.ts +2 -2
  12. package/dist/probe-loader.js +2 -0
  13. package/dist/proxy-loader.d.ts +1 -0
  14. package/dist/proxy-loader.js +48 -0
  15. package/dist/rslib-runtime.js +28 -0
  16. package/dist/rspack-plugin/constants.d.ts +1 -1
  17. package/dist/rules/rules/ecma-version-check/htmlParserStub.d.ts +3 -0
  18. package/dist/rules/rules/ecma-version-check/types.d.ts +13 -2
  19. package/dist/sdk/server/apis/base.d.ts +1 -1
  20. package/dist/sdk/server/socket/api.d.ts +1 -1
  21. package/dist/sdk/utils/date.d.ts +1 -0
  22. package/dist/types/loader.d.ts +1 -1
  23. package/package.json +20 -113
  24. package/dist/build-utils/build/chunks/assetsModules.js +0 -9
  25. package/dist/build-utils/build/chunks/index.js +0 -3
  26. package/dist/build-utils/build/chunks/rspack/transform.js +0 -44
  27. package/dist/build-utils/build/envinfo.js +0 -60
  28. package/dist/build-utils/build/file/cache.js +0 -24
  29. package/dist/build-utils/build/file/index.js +0 -5
  30. package/dist/build-utils/build/file/sharding.js +0 -38
  31. package/dist/build-utils/build/index.js +0 -12
  32. package/dist/build-utils/build/json.js +0 -67
  33. package/dist/build-utils/build/loader/index.js +0 -3
  34. package/dist/build-utils/build/loader/probeLoader.js +0 -44
  35. package/dist/build-utils/build/loader/probeLoaderPlugin.js +0 -32
  36. package/dist/build-utils/build/module-graph/index.js +0 -2
  37. package/dist/build-utils/build/module-graph/parser.js +0 -13
  38. package/dist/build-utils/build/module-graph/rspack/transform.js +0 -111
  39. package/dist/build-utils/build/module-graph/utils.js +0 -60
  40. package/dist/build-utils/build/process.js +0 -18
  41. package/dist/build-utils/build/server.js +0 -107
  42. package/dist/build-utils/build/utils/index.js +0 -4
  43. package/dist/build-utils/build/utils/loader.js +0 -267
  44. package/dist/build-utils/build/utils/parseBundle.js +0 -238
  45. package/dist/build-utils/build/utils/plugin.js +0 -21
  46. package/dist/build-utils/index.js +0 -13
  47. package/dist/collection.d.ts +0 -1
  48. package/dist/collection.js +0 -2
  49. package/dist/common/file.js +0 -8
  50. package/dist/common/global-config.js +0 -33
  51. package/dist/common/index.d.ts +0 -4
  52. package/dist/common/index.js +0 -6
  53. package/dist/common-browser.d.ts +0 -1
  54. package/dist/common-browser.js +0 -2
  55. package/dist/error/error.js +0 -143
  56. package/dist/error/index.js +0 -3
  57. package/dist/error/transform.js +0 -138
  58. package/dist/error/utils.js +0 -23
  59. package/dist/graph/index.d.ts +0 -1
  60. package/dist/graph/index.js +0 -2
  61. package/dist/inner-plugins/constants.js +0 -19
  62. package/dist/inner-plugins/index.js +0 -3
  63. package/dist/inner-plugins/loaders/proxy.js +0 -65
  64. package/dist/inner-plugins/plugins/base.js +0 -20
  65. package/dist/inner-plugins/plugins/bundle.js +0 -63
  66. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +0 -74
  67. package/dist/inner-plugins/plugins/errors.js +0 -65
  68. package/dist/inner-plugins/plugins/index.js +0 -11
  69. package/dist/inner-plugins/plugins/loader.js +0 -108
  70. package/dist/inner-plugins/plugins/plugins.js +0 -40
  71. package/dist/inner-plugins/plugins/progress.js +0 -35
  72. package/dist/inner-plugins/plugins/resolver.js +0 -57
  73. package/dist/inner-plugins/plugins/rspack.js +0 -99
  74. package/dist/inner-plugins/plugins/rules.js +0 -64
  75. package/dist/inner-plugins/plugins/sourcemapTool.js +0 -230
  76. package/dist/inner-plugins/plugins/summary.js +0 -92
  77. package/dist/inner-plugins/utils/circleDetect.js +0 -16
  78. package/dist/inner-plugins/utils/config.js +0 -141
  79. package/dist/inner-plugins/utils/index.js +0 -8
  80. package/dist/inner-plugins/utils/loader.js +0 -134
  81. package/dist/inner-plugins/utils/normalize-config.js +0 -77
  82. package/dist/inner-plugins/utils/openBrowser.js +0 -55
  83. package/dist/inner-plugins/utils/plugin-common.js +0 -94
  84. package/dist/inner-plugins/utils/plugin.js +0 -70
  85. package/dist/inner-plugins/utils/sdk.js +0 -19
  86. package/dist/logger.js +0 -51
  87. package/dist/rspack-plugin/constants.js +0 -23
  88. package/dist/rspack-plugin/index.js +0 -3
  89. package/dist/rspack-plugin/multiple.js +0 -39
  90. package/dist/rspack-plugin/plugin.js +0 -133
  91. package/dist/rule-utils/document/document.js +0 -46
  92. package/dist/rule-utils/document/index.js +0 -4
  93. package/dist/rule-utils/document/server.js +0 -13
  94. package/dist/rule-utils/document/types.js +0 -1
  95. package/dist/rule-utils/index.js +0 -3
  96. package/dist/rule-utils/parser/asserts.js +0 -105
  97. package/dist/rule-utils/parser/index.js +0 -5
  98. package/dist/rule-utils/parser/parser.js +0 -24
  99. package/dist/rule-utils/parser/types.js +0 -8
  100. package/dist/rule-utils/parser/utils.js +0 -106
  101. package/dist/rules/index.js +0 -4
  102. package/dist/rules/linter.js +0 -36
  103. package/dist/rules/rule.js +0 -101
  104. package/dist/rules/rules/cjs-require/index.js +0 -50
  105. package/dist/rules/rules/cjs-require/types.js +0 -1
  106. package/dist/rules/rules/cross-chunks-package/index.js +0 -41
  107. package/dist/rules/rules/cross-chunks-package/types.js +0 -1
  108. package/dist/rules/rules/cross-chunks-package/utils.js +0 -7
  109. package/dist/rules/rules/default-import-check/index.js +0 -83
  110. package/dist/rules/rules/default-import-check/types.js +0 -1
  111. package/dist/rules/rules/default-import-check/utils.js +0 -52
  112. package/dist/rules/rules/duplicate-package/index.js +0 -39
  113. package/dist/rules/rules/duplicate-package/types.js +0 -24
  114. package/dist/rules/rules/duplicate-package/utils.js +0 -38
  115. package/dist/rules/rules/ecma-version-check/index.js +0 -53
  116. package/dist/rules/rules/ecma-version-check/types.js +0 -1
  117. package/dist/rules/rules/ecma-version-check/utils.js +0 -6
  118. package/dist/rules/rules/esm-resolved-to-cjs/index.js +0 -193
  119. package/dist/rules/rules/esm-resolved-to-cjs/types.js +0 -1
  120. package/dist/rules/rules/index.js +0 -22
  121. package/dist/rules/rules/loader-performance-optimization/index.js +0 -86
  122. package/dist/rules/rules/loader-performance-optimization/types.js +0 -1
  123. package/dist/rules/rules/loader-performance-optimization/utils.js +0 -10
  124. package/dist/rules/rules/module-mixed-chunks/index.js +0 -52
  125. package/dist/rules/rules/module-mixed-chunks/types.js +0 -1
  126. package/dist/rules/rules/side-effects-only-imports/index.js +0 -81
  127. package/dist/rules/rules/side-effects-only-imports/types.js +0 -1
  128. package/dist/rules/utils.js +0 -10
  129. package/dist/sdk/index.js +0 -3
  130. package/dist/sdk/multiple/controller.js +0 -42
  131. package/dist/sdk/multiple/index.js +0 -3
  132. package/dist/sdk/multiple/primary.js +0 -64
  133. package/dist/sdk/multiple/server.js +0 -14
  134. package/dist/sdk/sdk/core.js +0 -163
  135. package/dist/sdk/sdk/index.js +0 -435
  136. package/dist/sdk/sdk/types.js +0 -1
  137. package/dist/sdk/server/apis/alerts.js +0 -30
  138. package/dist/sdk/server/apis/base.js +0 -22
  139. package/dist/sdk/server/apis/bundle-diff.js +0 -51
  140. package/dist/sdk/server/apis/data.js +0 -44
  141. package/dist/sdk/server/apis/fs.js +0 -28
  142. package/dist/sdk/server/apis/graph.js +0 -116
  143. package/dist/sdk/server/apis/index.js +0 -11
  144. package/dist/sdk/server/apis/loader.js +0 -120
  145. package/dist/sdk/server/apis/plugin.js +0 -39
  146. package/dist/sdk/server/apis/project.js +0 -59
  147. package/dist/sdk/server/apis/renderer.js +0 -33
  148. package/dist/sdk/server/apis/resolver.js +0 -38
  149. package/dist/sdk/server/client.js +0 -8
  150. package/dist/sdk/server/fakeServer.js +0 -12
  151. package/dist/sdk/server/index.js +0 -292
  152. package/dist/sdk/server/json-body.js +0 -150
  153. package/dist/sdk/server/router.js +0 -83
  154. package/dist/sdk/server/security.js +0 -47
  155. package/dist/sdk/server/socket/api.js +0 -22
  156. package/dist/sdk/server/socket/index.js +0 -166
  157. package/dist/sdk/server/utils.js +0 -19
  158. package/dist/sdk/utils/base.js +0 -22
  159. package/dist/sdk/utils/constant.js +0 -4
  160. package/dist/sdk/utils/index.js +0 -4
  161. package/dist/sdk/utils/openBrowser.js +0 -53
  162. package/dist/sdk/utils/upload.js +0 -6
  163. package/dist/sdk.js +0 -2
  164. package/dist/types/index.js +0 -4
  165. package/dist/types/loader.js +0 -1
  166. package/dist/types/plugin.js +0 -1
  167. package/dist/types/rules.js +0 -1
@@ -1,4 +1,4 @@
1
- import type { Tap } from 'tapable';
1
+ import type { Tap } from '@rspack/lite-tapable';
2
2
  export declare const pluginTapName = "RsdoctorRspackPlugin";
3
3
  export declare const pluginTapPostOptions: Tap;
4
4
  export declare const pluginTapPreOptions: Tap;
@@ -7,6 +7,6 @@ export declare abstract class InternalBasePlugin<T extends Plugin.BaseCompiler>
7
7
  abstract apply(compiler: T): void;
8
8
  get options(): Plugin.RsdoctorPluginOptionsNormalized<Linter.ExtendRuleData<any, string>[]>;
9
9
  get sdk(): SDK.RsdoctorBuilderSDKInstance;
10
- get tapPostOptions(): import("tapable").Tap;
11
- get tapPreOptions(): import("tapable").Tap;
10
+ get tapPostOptions(): import("@rspack/lite-tapable").Tap;
11
+ get tapPreOptions(): import("@rspack/lite-tapable").Tap;
12
12
  }
package/dist/logger.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import c from 'picocolors';
1
+ import { color } from 'rslog';
2
2
  /**
3
3
  * log debug message
4
4
  */
@@ -6,4 +6,4 @@ export declare function debug(getMsg: () => string, prefix?: string): void;
6
6
  declare const rsdoctorLogger: import("rslog").Logger;
7
7
  declare function time(label: string): void;
8
8
  declare function timeEnd(label: string): void;
9
- export { time, timeEnd, c as chalk, rsdoctorLogger as logger };
9
+ export { time, timeEnd, color as chalk, rsdoctorLogger as logger };
@@ -0,0 +1,2 @@
1
+ import "node:module";
2
+ export { default } from "./630.js";
@@ -0,0 +1 @@
1
+ export { default, pitch, raw } from './inner-plugins/loaders/proxy.js';
@@ -0,0 +1,48 @@
1
+ import "node:module";
2
+ import { shouldSkipLoader, reportLoader, getOriginLoaderModule } from "./26.js";
3
+ import { createLoaderContextTrap } from "./630.js";
4
+ let loaderModule = function(...args) {
5
+ if (shouldSkipLoader(this)) return void this.callback(null, ...args);
6
+ this.cacheable(!1);
7
+ let mod = getOriginLoaderModule(this);
8
+ if (mod.default) {
9
+ !1 === mod.raw && Buffer.isBuffer(args[0]) && (args[0] = args[0].toString());
10
+ let start = 0, startHRTime = [
11
+ 0,
12
+ 0
13
+ ], trap = createLoaderContextTrap.call(this, (err, res, sourceMap)=>{
14
+ reportLoader(this, start, startHRTime, !1, !1, args[0].toString(), err, res, sourceMap);
15
+ });
16
+ start = Date.now(), startHRTime = process.hrtime();
17
+ try {
18
+ let result = mod.default.apply(trap, args);
19
+ return !result || result instanceof Promise || reportLoader(this, start, startHRTime, !1, !0, args[0].toString(), null, result), result || '';
20
+ } catch (error) {
21
+ throw reportLoader(this, start, startHRTime, !1, !0, args[0].toString(), error, null), error;
22
+ }
23
+ }
24
+ this.callback(null, ...args);
25
+ }, pitch = function() {
26
+ if (shouldSkipLoader(this)) return;
27
+ this.cacheable(!1);
28
+ let mod = getOriginLoaderModule(this);
29
+ if (mod.pitch && 'function' == typeof mod.pitch) {
30
+ let start = 0, startHRTime = [
31
+ 0,
32
+ 0
33
+ ], trap = createLoaderContextTrap.call(this, (err, res)=>{
34
+ reportLoader(this, start, startHRTime, !0, !1, err ? 'Loader Pitch Async Error' : '', err, res);
35
+ });
36
+ start = Date.now(), startHRTime = process.hrtime();
37
+ try {
38
+ let res = mod.pitch.apply(trap, arguments);
39
+ return !res || res instanceof Promise || reportLoader(this, start, startHRTime, !0, !0, '', null, res), res;
40
+ } catch (error) {
41
+ throw reportLoader(this, start, startHRTime, !0, !0, 'Loader Pitch Sync Error', error, null), error;
42
+ }
43
+ }
44
+ };
45
+ loaderModule.raw = !0, loaderModule.pitch = pitch;
46
+ let raw = !0;
47
+ export default loaderModule;
48
+ export { pitch, raw };
@@ -0,0 +1,28 @@
1
+ import "node:module";
2
+ var __webpack_modules__ = {}, __webpack_module_cache__ = {};
3
+ function __webpack_require__(moduleId) {
4
+ var cachedModule = __webpack_module_cache__[moduleId];
5
+ if (void 0 !== cachedModule) return cachedModule.exports;
6
+ var module = __webpack_module_cache__[moduleId] = {
7
+ exports: {}
8
+ };
9
+ return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
10
+ }
11
+ __webpack_require__.m = __webpack_modules__, __webpack_require__.d = (exports, getters, values)=>{
12
+ var define = (defs, kind)=>{
13
+ for(var key in defs)__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key) && Object.defineProperty(exports, key, {
14
+ enumerable: !0,
15
+ [kind]: defs[key]
16
+ });
17
+ };
18
+ define(getters, "get"), define(values, "value");
19
+ }, __webpack_require__.add = function(modules) {
20
+ Object.assign(__webpack_require__.m, modules);
21
+ }, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports)=>{
22
+ "u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports, Symbol.toStringTag, {
23
+ value: 'Module'
24
+ }), Object.defineProperty(exports, '__esModule', {
25
+ value: !0
26
+ });
27
+ };
28
+ export { __webpack_require__ };
@@ -1,4 +1,4 @@
1
- import type { Tap } from 'tapable';
1
+ import type { Tap } from '@rspack/lite-tapable';
2
2
  export declare const pluginTapName = "RsdoctorRspackPlugin";
3
3
  export declare const pluginTapPostOptions: Tap;
4
4
  export declare const pluginTapPreOptions: Tap;
@@ -0,0 +1,3 @@
1
+ export declare class Parser {
2
+ constructor();
3
+ }
@@ -1,2 +1,13 @@
1
- import type { PluginCheckSyntaxOptions } from '@rsbuild/plugin-check-syntax';
2
- export type Config = PluginCheckSyntaxOptions;
1
+ import type { ecmaVersion as EcmaVersion } from 'acorn';
2
+ type Condition = string | RegExp | ((filepath: string) => boolean);
3
+ type CheckSyntaxExclude = Condition | Condition[];
4
+ type SyntaxErrorKey = 'source' | 'output' | 'reason' | 'code';
5
+ export type Config = {
6
+ targets?: string[];
7
+ exclude?: CheckSyntaxExclude;
8
+ excludeOutput?: CheckSyntaxExclude;
9
+ excludeErrorMessage?: RegExp | RegExp[];
10
+ excludeErrorLogs?: SyntaxErrorKey[];
11
+ ecmaVersion?: EcmaVersion;
12
+ };
13
+ export {};
@@ -1,4 +1,4 @@
1
- import { Data } from '../../../common/index.js';
1
+ import { Data } from '@rsdoctor/shared/common-browser';
2
2
  import { Manifest, SDK } from '@rsdoctor/shared/types';
3
3
  export declare class BaseAPI implements Manifest.ManifestDataLoader {
4
4
  [key: string | symbol]: any;
@@ -1,4 +1,4 @@
1
- import { Data } from '../../../common/index.js';
1
+ import { Data } from '@rsdoctor/shared/common-browser';
2
2
  import { Manifest, SDK } from '@rsdoctor/shared/types';
3
3
  interface SocketAPILoaderOptions {
4
4
  sdk: SDK.RsdoctorBuilderSDKInstance;
@@ -0,0 +1 @@
1
+ export declare const formatLocalDate: (date: Date) => string;
@@ -1,4 +1,4 @@
1
- import { Loader } from '../common/index.js';
1
+ import { Loader } from '@rsdoctor/shared/common-browser';
2
2
  export interface ProxyLoaderInternalOptions {
3
3
  cwd: string;
4
4
  /**
package/package.json CHANGED
@@ -1,17 +1,19 @@
1
1
  {
2
2
  "name": "@rsdoctor/core",
3
- "version": "2.0.0-alpha.1",
3
+ "version": "2.0.0-alpha.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
7
7
  "directory": "packages/core"
8
8
  },
9
9
  "license": "MIT",
10
+ "engines": {
11
+ "node": ">=22.18.0"
12
+ },
10
13
  "main": "dist/index.js",
11
14
  "types": "dist/index.d.ts",
12
15
  "files": [
13
16
  "dist",
14
- "compiled",
15
17
  "static"
16
18
  ],
17
19
  "type": "module",
@@ -20,57 +22,9 @@
20
22
  "types": "./dist/index.d.ts",
21
23
  "default": "./dist/index.js"
22
24
  },
23
- "./build-utils": {
24
- "types": "./dist/build-utils/index.d.ts",
25
- "default": "./dist/build-utils/index.js"
26
- },
27
- "./collection": {
28
- "types": "./dist/collection.d.ts",
29
- "default": "./dist/collection.js"
30
- },
31
- "./common": {
32
- "types": "./dist/common/index.d.ts",
33
- "default": "./dist/common/index.js"
34
- },
35
- "./common-browser": {
36
- "types": "./dist/common-browser.d.ts",
37
- "default": "./dist/common-browser.js"
38
- },
39
- "./graph": {
40
- "types": "./dist/graph/index.d.ts",
41
- "default": "./dist/graph/index.js"
42
- },
43
- "./error": {
44
- "types": "./dist/error/index.d.ts",
45
- "default": "./dist/error/index.js"
46
- },
47
- "./logger": {
48
- "types": "./dist/logger.d.ts",
49
- "default": "./dist/logger.js"
50
- },
51
- "./sdk": {
52
- "types": "./dist/sdk.d.ts",
53
- "default": "./dist/sdk.js"
54
- },
55
- "./plugins": {
56
- "types": "./dist/inner-plugins/index.d.ts",
57
- "default": "./dist/inner-plugins/index.js"
58
- },
59
- "./rspack-plugin": {
60
- "types": "./dist/rspack-plugin/index.d.ts",
61
- "default": "./dist/rspack-plugin/index.js"
62
- },
63
- "./rules": {
64
- "types": "./dist/rules/index.d.ts",
65
- "default": "./dist/rules/index.js"
66
- },
67
- "./rule-utils": {
68
- "types": "./dist/rule-utils/index.d.ts",
69
- "default": "./dist/rule-utils/index.js"
70
- },
71
- "./types": {
72
- "types": "./dist/types/index.d.ts",
73
- "default": "./dist/types/index.js"
25
+ "./proxy-loader": {
26
+ "types": "./dist/proxy-loader.d.ts",
27
+ "default": "./dist/proxy-loader.js"
74
28
  }
75
29
  },
76
30
  "typesVersions": {
@@ -78,95 +32,49 @@
78
32
  ".": [
79
33
  "./dist/index.d.ts"
80
34
  ],
81
- "build-utils": [
82
- "./dist/build-utils/index.d.ts"
83
- ],
84
- "collection": [
85
- "./dist/collection.d.ts"
86
- ],
87
- "common": [
88
- "./dist/common/index.d.ts"
89
- ],
90
- "common-browser": [
91
- "./dist/common-browser.d.ts"
92
- ],
93
- "graph": [
94
- "./dist/graph/index.d.ts"
95
- ],
96
- "error": [
97
- "./dist/error/index.d.ts"
98
- ],
99
- "logger": [
100
- "./dist/logger.d.ts"
101
- ],
102
- "sdk": [
103
- "./dist/sdk.d.ts"
104
- ],
105
- "plugins": [
106
- "./dist/inner-plugins/index.d.ts"
107
- ],
108
- "rspack-plugin": [
109
- "./dist/rspack-plugin/index.d.ts"
110
- ],
111
- "rules": [
112
- "./dist/rules/index.d.ts"
113
- ],
114
- "rule-utils": [
115
- "./dist/rule-utils/index.d.ts"
116
- ],
117
- "types": [
118
- "./dist/types/index.d.ts"
35
+ "proxy-loader": [
36
+ "./dist/proxy-loader.d.ts"
119
37
  ]
120
38
  }
121
39
  },
122
40
  "dependencies": {
123
41
  "@babel/code-frame": "7.26.2",
124
- "@rsbuild/plugin-check-syntax": "^1.6.1",
42
+ "@rspack/lite-tapable": "^1.1.5",
125
43
  "@types/estree": "1.0.5",
126
44
  "acorn": "^8.10.0",
127
45
  "acorn-import-attributes": "^1.9.5",
128
46
  "acorn-walk": "8.3.5",
129
47
  "browserslist-load-config": "^1.0.3",
48
+ "caniuse-lite": "^1.0.30001792",
130
49
  "connect": "3.7.0",
131
- "deep-eql": "4.1.4",
132
50
  "envinfo": "7.21.0",
133
- "filesize": "^11.0.22",
134
51
  "fs-extra": "^11.1.1",
135
52
  "get-port": "5.1.1",
136
- "json-stream-stringify": "3.0.1",
137
53
  "lines-and-columns": "2.0.4",
138
54
  "open": "^11.0.0",
139
- "path-browserify": "1.0.1",
140
- "picocolors": "^1.1.1",
141
55
  "raw-body": "3.0.2",
142
56
  "rslog": "^2.1.3",
143
57
  "semver": "^7.8.5",
144
58
  "source-map": "^0.7.6",
145
- "strip-ansi": "^7.2.0",
146
59
  "cors": "2.8.6",
147
- "dayjs": "1.11.21",
148
60
  "launch-editor": "^2.14.1",
149
- "safer-buffer": "2.1.2",
150
61
  "sirv": "3.0.2",
151
- "tapable": "2.3.3",
152
62
  "ws": "8.21.1",
153
- "@rsdoctor/client": "2.0.0-alpha.1",
154
- "@rsdoctor/shared": "2.0.0-alpha.0"
63
+ "@rsdoctor/shared": "2.0.0-alpha.2",
64
+ "@rsdoctor/client": "2.0.0-alpha.2"
155
65
  },
156
66
  "devDependencies": {
157
- "@rspack/core": "^2.1.5",
67
+ "@rsbuild/plugin-check-syntax": "^1.6.1",
68
+ "@rspack/core": "^2.1.7",
158
69
  "@types/babel__code-frame": "7.27.0",
159
70
  "@types/connect": "3.4.38",
160
- "@types/deep-eql": "4.0.2",
161
71
  "@types/envinfo": "7.8.4",
162
72
  "@types/fs-extra": "^11.0.4",
163
73
  "@types/node": "^24.12.3",
164
- "@types/node-fetch": "^2.6.13",
165
- "@types/path-browserify": "1.0.3",
166
74
  "@types/semver": "^7.7.1",
167
- "@types/tapable": "2.3.0",
168
75
  "babel-loader": "10.1.1",
169
- "prebundle": "1.6.5",
76
+ "filesize": "^11.0.22",
77
+ "json-stream-stringify": "3.0.1",
170
78
  "string-loader": "0.0.1",
171
79
  "ts-loader": "^9.6.2",
172
80
  "tslib": "2.8.1",
@@ -176,7 +84,7 @@
176
84
  "@scripts/test-helper": "0.1.1"
177
85
  },
178
86
  "peerDependencies": {
179
- "@rspack/core": ">=1.2.3"
87
+ "@rspack/core": "^2.0.0"
180
88
  },
181
89
  "peerDependenciesMeta": {
182
90
  "@rspack/core": {
@@ -189,9 +97,8 @@
189
97
  },
190
98
  "scripts": {
191
99
  "dev": "npm run start",
192
- "build": "npm run prebundle && rslib build",
100
+ "build": "rslib build",
193
101
  "start": "rslib build -w",
194
- "test": "rstest run",
195
- "prebundle": "prebundle"
102
+ "test": "rstest run"
196
103
  }
197
104
  }
@@ -1,9 +0,0 @@
1
- import "node:module";
2
- import { Chunks } from "../../../graph/index.js";
3
- import { parseBundle } from "../utils/index.js";
4
- async function getAssetsModulesData(moduleGraph, chunkGraph, bundleDir, sourceMapSets, hasParseBundle = true, assetsWithoutSourceMap) {
5
- return Chunks.getAssetsModulesData(moduleGraph, chunkGraph, bundleDir, hasParseBundle ? {
6
- parseBundle: parseBundle
7
- } : {}, sourceMapSets, assetsWithoutSourceMap);
8
- }
9
- export { getAssetsModulesData };
@@ -1,3 +0,0 @@
1
- import "node:module";
2
- export * from "./assetsModules.js";
3
- export * from "./rspack/transform.js";
@@ -1,44 +0,0 @@
1
- import "node:module";
2
- import { Asset, Chunk, EntryPoint } from "../../../../graph/index.js";
3
- function patchNativeChunkGraph(cg, rawChunkGraph) {
4
- const { chunks: rawChunks, entrypoints: rawEntrypoints } = rawChunkGraph;
5
- const chunks = rawChunks.map((chunk)=>new Chunk(chunk.ukey.toString(), chunk.name, 0, chunk.initial, chunk.entry));
6
- cg.setChunks(chunks);
7
- const entrypoints = rawEntrypoints.map((entrypoint)=>{
8
- const res = new EntryPoint(entrypoint.name);
9
- res.setId(entrypoint.ukey);
10
- return res;
11
- });
12
- cg.setEntrypoints(entrypoints);
13
- for (const rawChunk of rawChunks){
14
- const chunk = cg.getChunkById(rawChunk.ukey.toString());
15
- chunk.setDependencies(rawChunk.dependencies.map((ukey)=>cg.getChunkById(ukey.toString())));
16
- chunk.setImported(rawChunk.imported.map((ukey)=>cg.getChunkById(ukey.toString())));
17
- }
18
- for (const rawEntrypoint of rawEntrypoints){
19
- const entrypoint = cg.getEntryPointById(rawEntrypoint.ukey);
20
- entrypoint.setChunks(rawEntrypoint.chunks.map((ukey)=>cg.getChunkById(ukey.toString())));
21
- }
22
- }
23
- function patchNativeAssets(cg, rawAssetPatch) {
24
- const { assets: rawAssets, chunkAssets: rawChunkAssets, entrypointAssets: rawEntrypointAssets } = rawAssetPatch;
25
- const assets = rawAssets.map((asset)=>{
26
- const res = new Asset(asset.path, asset.size, [], '');
27
- res.setId(asset.ukey);
28
- return res;
29
- });
30
- cg.setAssets(assets);
31
- for (const rawAsset of rawAssets){
32
- const asset = cg.getAssetById(rawAsset.ukey);
33
- asset.setChunks(rawAsset.chunks.map((ukey)=>cg.getChunkById(ukey.toString())));
34
- }
35
- for (const rawChunkAsset of rawChunkAssets){
36
- const chunk = cg.getChunkById(rawChunkAsset.chunk.toString());
37
- chunk.setAssets(rawChunkAsset.assets.map((ukey)=>cg.getAssetById(ukey)));
38
- }
39
- for (const rawEntrypointAsset of rawEntrypointAssets){
40
- const entrypoint = cg.getEntryPointById(rawEntrypointAsset.entrypoint);
41
- entrypoint.setAssets(rawEntrypointAsset.assets.map((ukey)=>cg.getAssetById(ukey)));
42
- }
43
- }
44
- export { patchNativeAssets, patchNativeChunkGraph };
@@ -1,60 +0,0 @@
1
- import "node:module";
2
- import envinfo from "envinfo";
3
- import { exec } from "child_process";
4
- const helpers = envinfo.helpers;
5
- const run = envinfo.run;
6
- const getCPUInfo = ()=>helpers.getCPUInfo().then((res)=>res[1]);
7
- const getOSInfo = ()=>helpers.getOSInfo().then((res)=>res[1]);
8
- const getMemoryInfo = ()=>helpers.getMemoryInfo().then((res)=>res[1]);
9
- const getNodeVersion = ()=>helpers.getNodeInfo().then((res)=>res[1]);
10
- const getYarnVersion = ()=>helpers.getYarnInfo().then((res)=>res[1]);
11
- const getNpmVersion = ()=>helpers.getnpmInfo().then((res)=>res[1]);
12
- const getPnpmVersion = ()=>helpers.getpnpmInfo().then((res)=>res[1]);
13
- function getNpmPackageVersion(pkg) {
14
- const isArray = Array.isArray(pkg);
15
- return run({
16
- npmPackages: isArray ? pkg : [
17
- pkg
18
- ]
19
- }, {
20
- json: true,
21
- showNotFound: true
22
- }).then((res)=>{
23
- const { npmPackages = {} } = JSON.parse(res) || {};
24
- return isArray ? pkg.map((e)=>npmPackages[e] || 'Not Found') : npmPackages[pkg];
25
- });
26
- }
27
- function getGlobalNpmPackageVersion(pkg) {
28
- const isArray = Array.isArray(pkg);
29
- return run({
30
- npmGlobalPackages: isArray ? pkg : [
31
- pkg
32
- ]
33
- }, {
34
- json: true,
35
- showNotFound: true
36
- }).then((res)=>{
37
- const { npmGlobalPackages = {} } = JSON.parse(res) || {};
38
- return isArray ? pkg.map((e)=>npmGlobalPackages[e] || 'Not Found') : npmGlobalPackages[pkg];
39
- });
40
- }
41
- function getGitBranch() {
42
- return new Promise((resolve, reject)=>{
43
- exec('git branch --show-current', (err, stdout)=>{
44
- if (err) exec('git branch', (err, stdout)=>{
45
- if (err) reject(err);
46
- else resolve(stdout.split('\n').map((e)=>e.replace('* ', '')).join('').trim());
47
- });
48
- else resolve(stdout.trim());
49
- });
50
- });
51
- }
52
- function getGitRepo() {
53
- return new Promise((resolve, reject)=>{
54
- exec('git config --get remote.origin.url', (err, stdout)=>{
55
- if (err) reject(err);
56
- else resolve(stdout.trim());
57
- });
58
- });
59
- }
60
- export { getCPUInfo, getGitBranch, getGitRepo, getGlobalNpmPackageVersion, getMemoryInfo, getNodeVersion, getNpmPackageVersion, getNpmVersion, getOSInfo, getPnpmVersion, getYarnVersion };
@@ -1,24 +0,0 @@
1
- import "node:module";
2
- import node_fs from "node:fs";
3
- const cache = new Map();
4
- async function readFile(path) {
5
- if (cache.has(path)) return cache.get(path);
6
- const res = await node_fs.promises.readFile(path, 'utf-8');
7
- cache.set(path, res);
8
- return res;
9
- }
10
- function readFileSync(path) {
11
- if (cache.has(path)) return cache.get(path);
12
- const res = node_fs.readFileSync(path, 'utf-8');
13
- cache.set(path, res);
14
- return res;
15
- }
16
- async function readJSON(path) {
17
- const str = await readFile(path);
18
- return JSON.parse(str);
19
- }
20
- function readJSONSync(path) {
21
- const str = readFileSync(path);
22
- return JSON.parse(str);
23
- }
24
- export { readFile, readFileSync, readJSON, readJSONSync };
@@ -1,5 +0,0 @@
1
- import "node:module";
2
- import * as __rspack_external__cache_js_3b19274f from "./cache.js";
3
- export * from "./sharding.js";
4
- export { default as fse } from "fs-extra";
5
- export { __rspack_external__cache_js_3b19274f as cache };
@@ -1,38 +0,0 @@
1
- import "node:module";
2
- import fs_extra from "fs-extra";
3
- import fs from "fs";
4
- import path from "path";
5
- class FileSharding {
6
- createVirtualShardingFiles(ext = '', index = 0) {
7
- const bf = Buffer.from(this.content, this.encoding);
8
- const res = [];
9
- const threshold = this.limitBytes;
10
- let tmpBytes = 0;
11
- while(bf.byteLength > tmpBytes){
12
- res.push(bf.subarray(tmpBytes, tmpBytes + threshold));
13
- tmpBytes += threshold;
14
- }
15
- return res.map((e, i)=>({
16
- filename: `${i + index}${ext}`,
17
- content: e
18
- }));
19
- }
20
- async writeStringToFolder(folder, ext = '', index) {
21
- const dist = path.resolve(folder);
22
- await fs_extra.ensureDir(dist);
23
- const res = this.createVirtualShardingFiles(ext, index);
24
- await Promise.all(res.map((e)=>new Promise((resolve, reject)=>{
25
- const stream = fs.createWriteStream(path.join(dist, e.filename), this.encoding);
26
- stream.end(e.content);
27
- stream.once('close', ()=>resolve(void 0));
28
- stream.once('error', (err)=>reject(err));
29
- })));
30
- return res;
31
- }
32
- constructor(content, limitBytes = 10485760, encoding = 'utf-8'){
33
- this.content = content;
34
- this.limitBytes = limitBytes;
35
- this.encoding = encoding;
36
- }
37
- }
38
- export { FileSharding };
@@ -1,12 +0,0 @@
1
- import "node:module";
2
- import * as __rspack_external__file_index_js_5cbcde29 from "./file/index.js";
3
- import * as __rspack_external__json_js_faef839e from "./json.js";
4
- import * as __rspack_external__server_js_186b33b9 from "./server.js";
5
- import * as __rspack_external__envinfo_js_2b90a03d from "./envinfo.js";
6
- import * as __rspack_external__process_js_7eda60d3 from "./process.js";
7
- import * as __rspack_external__chunks_index_js_c4bbc2de from "./chunks/index.js";
8
- import * as __rspack_external__utils_index_js_d2e4ad7a from "./utils/index.js";
9
- import * as __rspack_external__loader_index_js_ef25077c from "./loader/index.js";
10
- import * as __rspack_external__types_index_js_d78e4824 from "../../types/index.js";
11
- import * as __rspack_external__module_graph_index_js_f91481f4 from "./module-graph/index.js";
12
- export { __rspack_external__chunks_index_js_c4bbc2de as Chunks, __rspack_external__envinfo_js_2b90a03d as EnvInfo, __rspack_external__file_index_js_5cbcde29 as File, __rspack_external__json_js_faef839e as Json, __rspack_external__loader_index_js_ef25077c as Loader, __rspack_external__module_graph_index_js_f91481f4 as ModuleGraph, __rspack_external__process_js_7eda60d3 as Process, __rspack_external__server_js_186b33b9 as Server, __rspack_external__types_index_js_d78e4824 as Types, __rspack_external__utils_index_js_d2e4ad7a as Utils };
@@ -1,67 +0,0 @@
1
- import "node:module";
2
- import { JsonStreamStringify } from "json-stream-stringify";
3
- import { dirname, join } from "path";
4
- import { Package } from "../../common/index.js";
5
- import { Transform } from "stream";
6
- const maxFileSize = 419430400;
7
- function stringify(json, replacer, space, cycle) {
8
- const jsonList = [];
9
- if (json && 'object' == typeof json) return new Promise((resolve, reject)=>{
10
- const stream = new JsonStreamStringify(json, replacer, space, cycle);
11
- let currentLength = 0;
12
- let currentContent = '';
13
- const batchProcessor = new Transform({
14
- readableObjectMode: true,
15
- transform (chunk, _encoding, callback) {
16
- const lines = chunk.toString().split('\\n');
17
- lines.forEach((line)=>{
18
- if (currentLength + line.length > maxFileSize) {
19
- jsonList.push(currentContent);
20
- currentContent = '';
21
- currentLength = 0;
22
- }
23
- if (line.length) {
24
- currentContent += line;
25
- currentLength += line.length;
26
- }
27
- });
28
- callback();
29
- }
30
- });
31
- stream.pipe(batchProcessor).on('data', (line)=>{
32
- if (currentLength + line.length > maxFileSize) {
33
- jsonList.push(currentContent);
34
- currentContent = '';
35
- currentLength = 0;
36
- }
37
- if (line.length) {
38
- currentContent += line;
39
- currentLength += line.length;
40
- }
41
- }).on('end', ()=>{
42
- if (jsonList.length < 1) jsonList.push(currentContent);
43
- resolve(jsonList);
44
- }).on('error', (err)=>reject(err));
45
- });
46
- return Promise.resolve(JSON.stringify(json, replacer, space));
47
- }
48
- const readPackageJson = (file, readFile)=>{
49
- let result;
50
- let current = file;
51
- while('/' !== current && !result){
52
- const parent = dirname(current);
53
- if (parent === current) break;
54
- current = parent;
55
- if (readFile) result = readFile(join(current, 'package.json'));
56
- if (readFile) {
57
- if (!result?.name) result = void 0;
58
- } else result = Package.getPackageMetaFromModulePath(file);
59
- }
60
- if (!result) return;
61
- if (readFile && (!result.name || !result.version)) return readPackageJson(dirname(current), readFile);
62
- return {
63
- ...result,
64
- root: current
65
- };
66
- };
67
- export { readPackageJson, stringify };
@@ -1,3 +0,0 @@
1
- import "node:module";
2
- export * from "./probeLoaderPlugin.js";
3
- export * from "./probeLoader.js";