@rsdoctor/types 1.5.2 → 1.5.3
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/index.cjs +549 -0
- package/dist/index.js +492 -48
- package/dist/sdk/instance.d.ts +3 -0
- package/dist/sdk/module.d.ts +34 -0
- package/dist/sdk/package.d.ts +2 -2
- package/dist/sdk/result.d.ts +2 -1
- package/dist/sdk/server/apis/graph.d.ts +3 -2
- package/dist/sdk/server/apis/loader.d.ts +1 -1
- package/package.json +13 -6
- package/dist/babel.js +0 -2
- package/dist/client.js +0 -31
- package/dist/common.js +0 -2
- package/dist/config.js +0 -2
- package/dist/constants.js +0 -46
- package/dist/emo.js +0 -9
- package/dist/error.js +0 -10
- package/dist/esbuild.js +0 -2
- package/dist/linter/diagnostic.js +0 -5
- package/dist/linter/index.js +0 -18
- package/dist/linter/rule.js +0 -2
- package/dist/logger.js +0 -12
- package/dist/manifest.js +0 -17
- package/dist/modules.js +0 -2
- package/dist/plugin/baseCompiler.js +0 -2
- package/dist/plugin/baseLoader.js +0 -2
- package/dist/plugin/baseStats.js +0 -2
- package/dist/plugin/index.js +0 -23
- package/dist/plugin/internal-rules.js +0 -2
- package/dist/plugin/plugin.js +0 -2
- package/dist/plugin/rspack.js +0 -2
- package/dist/plugin/webpack.js +0 -2
- package/dist/rule/code/E1001.js +0 -31
- package/dist/rule/code/E1002.js +0 -39
- package/dist/rule/code/E1003.js +0 -39
- package/dist/rule/code/E1004.js +0 -15
- package/dist/rule/code/E1005.js +0 -31
- package/dist/rule/code/E1006.js +0 -33
- package/dist/rule/code/index.js +0 -65
- package/dist/rule/code/type.js +0 -23
- package/dist/rule/data.js +0 -2
- package/dist/rule/index.js +0 -18
- package/dist/sdk/chunk.js +0 -2
- package/dist/sdk/config.js +0 -2
- package/dist/sdk/context.js +0 -2
- package/dist/sdk/envinfo.js +0 -2
- package/dist/sdk/hooks.js +0 -2
- package/dist/sdk/index.js +0 -32
- package/dist/sdk/instance.js +0 -9
- package/dist/sdk/loader.js +0 -2
- package/dist/sdk/module.js +0 -31
- package/dist/sdk/package.js +0 -2
- package/dist/sdk/plugin.js +0 -2
- package/dist/sdk/process.js +0 -2
- package/dist/sdk/resolver.js +0 -2
- package/dist/sdk/result.js +0 -2
- package/dist/sdk/server/apis/alerts.js +0 -3
- package/dist/sdk/server/apis/graph.js +0 -3
- package/dist/sdk/server/apis/index.js +0 -87
- package/dist/sdk/server/apis/loader.js +0 -3
- package/dist/sdk/server/apis/pagination.js +0 -2
- package/dist/sdk/server/apis/plugin.js +0 -3
- package/dist/sdk/server/apis/project.js +0 -3
- package/dist/sdk/server/apis/resolver.js +0 -3
- package/dist/sdk/server/index.js +0 -37
- package/dist/sdk/statement.js +0 -147
- package/dist/sdk/summary.js +0 -2
- package/dist/sdk/treeShaking.js +0 -2
- package/dist/thirdparty.js +0 -2
package/package.json
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/types",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
7
7
|
"directory": "packages/types"
|
|
8
8
|
},
|
|
9
9
|
"license": "MIT",
|
|
10
|
+
"type": "module",
|
|
10
11
|
"main": "dist/index.js",
|
|
11
12
|
"types": "dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"default": "./dist/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
12
20
|
"files": [
|
|
13
21
|
"dist"
|
|
14
22
|
],
|
|
@@ -19,9 +27,9 @@
|
|
|
19
27
|
"source-map": "^0.7.6"
|
|
20
28
|
},
|
|
21
29
|
"devDependencies": {
|
|
22
|
-
"@rspack/core": "
|
|
30
|
+
"@rspack/core": "2.0.0-beta.5",
|
|
23
31
|
"@types/node": "^22.8.1",
|
|
24
|
-
"@types/react": "^18.3.
|
|
32
|
+
"@types/react": "^18.3.28",
|
|
25
33
|
"tslib": "2.8.1",
|
|
26
34
|
"typescript": "^5.9.2"
|
|
27
35
|
},
|
|
@@ -42,8 +50,7 @@
|
|
|
42
50
|
"registry": "https://registry.npmjs.org/"
|
|
43
51
|
},
|
|
44
52
|
"scripts": {
|
|
45
|
-
"build": "
|
|
46
|
-
"dev": "
|
|
47
|
-
"start": "npm run build -- -w"
|
|
53
|
+
"build": "rslib build",
|
|
54
|
+
"dev": "rslib build --watch"
|
|
48
55
|
}
|
|
49
56
|
}
|
package/dist/babel.js
DELETED
package/dist/client.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RsdoctorClientDiffState = exports.RsdoctorClientRoutes = exports.RsdoctorClientUrlQuery = void 0;
|
|
4
|
-
var RsdoctorClientUrlQuery;
|
|
5
|
-
(function (RsdoctorClientUrlQuery) {
|
|
6
|
-
RsdoctorClientUrlQuery["BundleDiffFiles"] = "__bundle_files__";
|
|
7
|
-
RsdoctorClientUrlQuery["ManifestFile"] = "manifest";
|
|
8
|
-
RsdoctorClientUrlQuery["EnableRoutes"] = "enableRoutes";
|
|
9
|
-
})(RsdoctorClientUrlQuery || (exports.RsdoctorClientUrlQuery = RsdoctorClientUrlQuery = {}));
|
|
10
|
-
var RsdoctorClientRoutes;
|
|
11
|
-
(function (RsdoctorClientRoutes) {
|
|
12
|
-
RsdoctorClientRoutes["Home"] = "/";
|
|
13
|
-
RsdoctorClientRoutes["Overall"] = "/overall";
|
|
14
|
-
RsdoctorClientRoutes["WebpackLoaderOverall"] = "/webpack/loaders/overall";
|
|
15
|
-
RsdoctorClientRoutes["WebpackLoaderAnalysis"] = "/webpack/loaders/analysis";
|
|
16
|
-
RsdoctorClientRoutes["ModuleResolve"] = "/module/resolve";
|
|
17
|
-
RsdoctorClientRoutes["WebpackPlugins"] = "/webpack/plugins";
|
|
18
|
-
RsdoctorClientRoutes["BundleSize"] = "/bundle/size";
|
|
19
|
-
RsdoctorClientRoutes["ModuleAnalyze"] = "/module/analyze";
|
|
20
|
-
RsdoctorClientRoutes["TreeShaking"] = "/treeshaking";
|
|
21
|
-
RsdoctorClientRoutes["BundleDiff"] = "/resources/bundle/diff";
|
|
22
|
-
RsdoctorClientRoutes["RuleIndex"] = "/resources/rules";
|
|
23
|
-
RsdoctorClientRoutes["Uploader"] = "/resources/uploader";
|
|
24
|
-
RsdoctorClientRoutes["EmoCheck"] = "/emo/check";
|
|
25
|
-
})(RsdoctorClientRoutes || (exports.RsdoctorClientRoutes = RsdoctorClientRoutes = {}));
|
|
26
|
-
var RsdoctorClientDiffState;
|
|
27
|
-
(function (RsdoctorClientDiffState) {
|
|
28
|
-
RsdoctorClientDiffState["Equal"] = "-";
|
|
29
|
-
RsdoctorClientDiffState["Up"] = "UP";
|
|
30
|
-
RsdoctorClientDiffState["Down"] = "DOWN";
|
|
31
|
-
})(RsdoctorClientDiffState || (exports.RsdoctorClientDiffState = RsdoctorClientDiffState = {}));
|
package/dist/common.js
DELETED
package/dist/config.js
DELETED
package/dist/constants.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WINDOW_RSDOCTOR_TAG = exports.RsdoctorClientUrl = exports.RsdoctorProcessEnvDebugKey = exports.RsdoctorMonitorDocBId = exports.RsdoctorMonitorWebBId = exports.RsdoctorMonitorNodeBId = exports.StatsFilePath = exports.RsdoctorOutputManifestPath = exports.RsdoctorOutputManifest = exports.RsdoctorOutputFolder = exports.MapExtensions = exports.FontExtensions = exports.MediaExtensions = exports.ImgExtensions = exports.HtmlExtension = exports.CSSExtension = exports.JSExtensions = exports.BundleExtension = exports.JSExtension = void 0;
|
|
4
|
-
exports.JSExtension = '.js';
|
|
5
|
-
exports.BundleExtension = '.bundle';
|
|
6
|
-
exports.JSExtensions = [exports.JSExtension, exports.BundleExtension];
|
|
7
|
-
exports.CSSExtension = '.css';
|
|
8
|
-
exports.HtmlExtension = '.html';
|
|
9
|
-
exports.ImgExtensions = [
|
|
10
|
-
'.png',
|
|
11
|
-
'.jpg',
|
|
12
|
-
'.svg',
|
|
13
|
-
'.webp',
|
|
14
|
-
'.jpeg',
|
|
15
|
-
'.gif',
|
|
16
|
-
'.bmp',
|
|
17
|
-
];
|
|
18
|
-
exports.MediaExtensions = [
|
|
19
|
-
'.mp3',
|
|
20
|
-
'.mp4',
|
|
21
|
-
'.avi',
|
|
22
|
-
'.wav',
|
|
23
|
-
'.flv',
|
|
24
|
-
'.mov',
|
|
25
|
-
'.mpg',
|
|
26
|
-
'.mpeg',
|
|
27
|
-
];
|
|
28
|
-
exports.FontExtensions = [
|
|
29
|
-
'.ttf',
|
|
30
|
-
'.fnt',
|
|
31
|
-
'.fon',
|
|
32
|
-
'.otf',
|
|
33
|
-
'.woff',
|
|
34
|
-
'.woff2',
|
|
35
|
-
];
|
|
36
|
-
exports.MapExtensions = ['.js.map', '.css.map', '.ts.map', '.LICENSE.txt'];
|
|
37
|
-
exports.RsdoctorOutputFolder = '.rsdoctor';
|
|
38
|
-
exports.RsdoctorOutputManifest = 'manifest.json';
|
|
39
|
-
exports.RsdoctorOutputManifestPath = `${exports.RsdoctorOutputFolder}/${exports.RsdoctorOutputManifest}`;
|
|
40
|
-
exports.StatsFilePath = 'dist/stats.json';
|
|
41
|
-
exports.RsdoctorMonitorNodeBId = 'Rsdoctor';
|
|
42
|
-
exports.RsdoctorMonitorWebBId = 'Rsdoctor-Client';
|
|
43
|
-
exports.RsdoctorMonitorDocBId = 'Rsdoctor-Doc';
|
|
44
|
-
exports.RsdoctorProcessEnvDebugKey = 'rsdoctor';
|
|
45
|
-
exports.RsdoctorClientUrl = ''; // TODO: rsdoctor client url
|
|
46
|
-
exports.WINDOW_RSDOCTOR_TAG = '__RSDOCTOR__';
|
package/dist/emo.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EmoCheckSeverity = void 0;
|
|
4
|
-
var EmoCheckSeverity;
|
|
5
|
-
(function (EmoCheckSeverity) {
|
|
6
|
-
EmoCheckSeverity[EmoCheckSeverity["Error"] = 0] = "Error";
|
|
7
|
-
EmoCheckSeverity[EmoCheckSeverity["Warn"] = 1] = "Warn";
|
|
8
|
-
EmoCheckSeverity[EmoCheckSeverity["Info"] = 2] = "Info";
|
|
9
|
-
})(EmoCheckSeverity || (exports.EmoCheckSeverity = EmoCheckSeverity = {}));
|
package/dist/error.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ErrorLevel = void 0;
|
|
4
|
-
/** Error Level */
|
|
5
|
-
var ErrorLevel;
|
|
6
|
-
(function (ErrorLevel) {
|
|
7
|
-
ErrorLevel[ErrorLevel["Ignore"] = 0] = "Ignore";
|
|
8
|
-
ErrorLevel[ErrorLevel["Warn"] = 1] = "Warn";
|
|
9
|
-
ErrorLevel[ErrorLevel["Error"] = 2] = "Error";
|
|
10
|
-
})(ErrorLevel || (exports.ErrorLevel = ErrorLevel = {}));
|
package/dist/esbuild.js
DELETED
package/dist/linter/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./diagnostic"), exports);
|
|
18
|
-
__exportStar(require("./rule"), exports);
|
package/dist/linter/rule.js
DELETED
package/dist/logger.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LogLevel = void 0;
|
|
4
|
-
var LogLevel;
|
|
5
|
-
(function (LogLevel) {
|
|
6
|
-
LogLevel[LogLevel["Silent"] = 0] = "Silent";
|
|
7
|
-
LogLevel[LogLevel["Error"] = 1] = "Error";
|
|
8
|
-
LogLevel[LogLevel["Warning"] = 2] = "Warning";
|
|
9
|
-
LogLevel[LogLevel["Info"] = 3] = "Info";
|
|
10
|
-
LogLevel[LogLevel["Debug"] = 4] = "Debug";
|
|
11
|
-
LogLevel[LogLevel["Verbose"] = 5] = "Verbose";
|
|
12
|
-
})(LogLevel || (exports.LogLevel = LogLevel = {}));
|
package/dist/manifest.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RsdoctorManifestClientConstant = exports.RsdoctorManifestClientRoutes = void 0;
|
|
4
|
-
var RsdoctorManifestClientRoutes;
|
|
5
|
-
(function (RsdoctorManifestClientRoutes) {
|
|
6
|
-
RsdoctorManifestClientRoutes["Overall"] = "Overall";
|
|
7
|
-
RsdoctorManifestClientRoutes["WebpackLoaders"] = "Compile.WebpackLoaders";
|
|
8
|
-
RsdoctorManifestClientRoutes["ModuleResolve"] = "Compile.ModuleResolve";
|
|
9
|
-
RsdoctorManifestClientRoutes["WebpackPlugins"] = "Compile.WebpackPlugins";
|
|
10
|
-
RsdoctorManifestClientRoutes["BundleSize"] = "Bundle.BundleSize";
|
|
11
|
-
RsdoctorManifestClientRoutes["ModuleGraph"] = "Bundle.ModuleGraph";
|
|
12
|
-
RsdoctorManifestClientRoutes["TreeShaking"] = "Bundle.TreeShaking";
|
|
13
|
-
})(RsdoctorManifestClientRoutes || (exports.RsdoctorManifestClientRoutes = RsdoctorManifestClientRoutes = {}));
|
|
14
|
-
var RsdoctorManifestClientConstant;
|
|
15
|
-
(function (RsdoctorManifestClientConstant) {
|
|
16
|
-
RsdoctorManifestClientConstant["WindowPropertyForManifestUrl"] = "__DEVTOOLS_MANIFEST_URL__";
|
|
17
|
-
})(RsdoctorManifestClientConstant || (exports.RsdoctorManifestClientConstant = RsdoctorManifestClientConstant = {}));
|
package/dist/modules.js
DELETED
package/dist/plugin/baseStats.js
DELETED
package/dist/plugin/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./baseCompiler"), exports);
|
|
18
|
-
__exportStar(require("./baseStats"), exports);
|
|
19
|
-
__exportStar(require("./plugin"), exports);
|
|
20
|
-
__exportStar(require("./baseLoader"), exports);
|
|
21
|
-
__exportStar(require("./rspack"), exports);
|
|
22
|
-
__exportStar(require("./internal-rules"), exports);
|
|
23
|
-
__exportStar(require("./webpack"), exports);
|
package/dist/plugin/plugin.js
DELETED
package/dist/plugin/rspack.js
DELETED
package/dist/plugin/webpack.js
DELETED
package/dist/rule/code/E1001.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.message = exports.code = void 0;
|
|
4
|
-
exports.code = 'E1001';
|
|
5
|
-
exports.message = {
|
|
6
|
-
code: exports.code,
|
|
7
|
-
title: 'Duplicate Packages',
|
|
8
|
-
type: 'markdown',
|
|
9
|
-
category: 'bundle',
|
|
10
|
-
description: `
|
|
11
|
-
#### Description
|
|
12
|
-
|
|
13
|
-
There is a same name package which is bundled in multiple versions in your application.
|
|
14
|
-
|
|
15
|
-
This negatively impacts the bundle size of your application.
|
|
16
|
-
|
|
17
|
-
#### General Solution
|
|
18
|
-
|
|
19
|
-
Add an entry in \`resolve.alias\` to configure Webpack to route any package references to a single specified path.
|
|
20
|
-
|
|
21
|
-
For example, if \`lodash\` is duplicated in your bundle, the following configuration would make all Lodash imports refer to the \`lodash\` instance found at \`./node_modules/lodash\`:
|
|
22
|
-
|
|
23
|
-
\`\`\`js
|
|
24
|
-
{
|
|
25
|
-
alias: {
|
|
26
|
-
lodash: path.resolve(__dirname, 'node_modules/lodash')
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
\`\`\`
|
|
30
|
-
`,
|
|
31
|
-
};
|
package/dist/rule/code/E1002.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.message = exports.code = void 0;
|
|
4
|
-
exports.code = 'E1002';
|
|
5
|
-
exports.message = {
|
|
6
|
-
code: exports.code,
|
|
7
|
-
title: 'Cross Chunks Packages',
|
|
8
|
-
type: 'markdown',
|
|
9
|
-
category: 'bundle',
|
|
10
|
-
description: `
|
|
11
|
-
#### Description
|
|
12
|
-
|
|
13
|
-
There is a package with the same version that is duplicated across different chunks in your application. This redundancy increases the overall bundle size, which is not optimal for performance.
|
|
14
|
-
|
|
15
|
-
#### General Solution
|
|
16
|
-
|
|
17
|
-
To address this issue, you can use Rspack's **SplitChunksPlugin** to extract common dependencies into a separate chunk. This ensures that the same package is not duplicated across multiple chunks, thereby reducing the bundle size.
|
|
18
|
-
|
|
19
|
-
For example, if **lodash** is being duplicated across different chunks, you can configure the **optimization.splitChunks** option in your Webpack configuration to extract **lodash** into a separate chunk:
|
|
20
|
-
|
|
21
|
-
\`\`\`
|
|
22
|
-
module.exports = {
|
|
23
|
-
optimization: {
|
|
24
|
-
splitChunks: {
|
|
25
|
-
cacheGroups: {
|
|
26
|
-
commons: {
|
|
27
|
-
test: /[\\/]node_modules[\\/]lodash[\\/]/,
|
|
28
|
-
name: 'lodash',
|
|
29
|
-
chunks: 'all',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
\`\`\`
|
|
36
|
-
|
|
37
|
-
This configuration will automatically split out common dependencies (including those from \`node_modules\`) into separate chunks, ensuring that no package is duplicated across different chunks.
|
|
38
|
-
`,
|
|
39
|
-
};
|
package/dist/rule/code/E1003.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.message = exports.code = void 0;
|
|
4
|
-
exports.code = 'E1003';
|
|
5
|
-
exports.message = {
|
|
6
|
-
code: exports.code,
|
|
7
|
-
title: 'Loader Performance Optimization',
|
|
8
|
-
type: 'markdown',
|
|
9
|
-
category: 'compile',
|
|
10
|
-
description: `
|
|
11
|
-
#### Description
|
|
12
|
-
|
|
13
|
-
Usually the slow compile of most projects is due to the slow execution of the loaders.
|
|
14
|
-
|
|
15
|
-
And the loaders always pre-process many unnecessary files, such as \`node_modules files\` and \`already compiled files\`.
|
|
16
|
-
|
|
17
|
-
#### General Solution
|
|
18
|
-
|
|
19
|
-
Set \`exclude\` to the \`module.rules\` of webpack configuration for target loader.
|
|
20
|
-
|
|
21
|
-
For example, if \`node_modules/lodash\` is processed by the \`babel-loader\` that make the compile slowly:
|
|
22
|
-
|
|
23
|
-
\`\`\`
|
|
24
|
-
{
|
|
25
|
-
module: {
|
|
26
|
-
rules: [
|
|
27
|
-
{
|
|
28
|
-
test: /\\.js$/,
|
|
29
|
-
use: 'babel-loader',
|
|
30
|
-
exclude: [
|
|
31
|
-
/node_modules\\/lodash/
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
\`\`\`
|
|
38
|
-
`,
|
|
39
|
-
};
|
package/dist/rule/code/E1004.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.message = exports.code = void 0;
|
|
4
|
-
exports.code = 'E1004';
|
|
5
|
-
exports.message = {
|
|
6
|
-
code: exports.code,
|
|
7
|
-
title: 'ECMA Version Check',
|
|
8
|
-
type: 'markdown',
|
|
9
|
-
category: 'bundle',
|
|
10
|
-
description: `
|
|
11
|
-
#### Description
|
|
12
|
-
|
|
13
|
-
Detect if there is a newer version of ECMA syntax in the js bundle file
|
|
14
|
-
`,
|
|
15
|
-
};
|
package/dist/rule/code/E1005.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.message = exports.code = void 0;
|
|
4
|
-
exports.code = 'E1005';
|
|
5
|
-
exports.message = {
|
|
6
|
-
code: exports.code,
|
|
7
|
-
title: 'Default Import Check',
|
|
8
|
-
type: 'markdown',
|
|
9
|
-
category: 'compile',
|
|
10
|
-
description: `
|
|
11
|
-
#### Description
|
|
12
|
-
|
|
13
|
-
Usually webpack will automatically compatible different modules that has different types, but in a special case, the operation of compatibility will fail.
|
|
14
|
-
That is, when you use \`Default Import\` to import a cjs module, and this cjs module do not have the compatible statement, such as \`exports.default = \`.
|
|
15
|
-
|
|
16
|
-
#### General Solution
|
|
17
|
-
|
|
18
|
-
1. for cjs module, write a \`exports.default = \` statement for default export.
|
|
19
|
-
2. use \`Namespace Import\` for import the cjs module.
|
|
20
|
-
|
|
21
|
-
For example, for the package \`htmlparser2@7.2.0\`:
|
|
22
|
-
|
|
23
|
-
\`\`\`ts
|
|
24
|
-
// you should use this
|
|
25
|
-
import * as Parser from 'htmlparser2';
|
|
26
|
-
|
|
27
|
-
// can not use this
|
|
28
|
-
import Parser from 'htmlparser2';
|
|
29
|
-
\`\`\`
|
|
30
|
-
`,
|
|
31
|
-
};
|
package/dist/rule/code/E1006.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.message = exports.code = void 0;
|
|
4
|
-
exports.code = 'E1006';
|
|
5
|
-
exports.message = {
|
|
6
|
-
code: exports.code,
|
|
7
|
-
title: 'Module Mixed Chunks',
|
|
8
|
-
type: 'markdown',
|
|
9
|
-
category: 'bundle',
|
|
10
|
-
description: `
|
|
11
|
-
#### Description
|
|
12
|
-
|
|
13
|
-
When a module is included in both **initial chunks** and **async chunks**, the same module code is bundled into multiple chunks, increasing output size and potentially affecting first-screen load and cache efficiency.
|
|
14
|
-
|
|
15
|
-
- **Initial chunks**: Chunks loaded with the main entry (e.g. entry points, synchronous \`import\` in the main bundle).
|
|
16
|
-
- **Async chunks**: Chunks loaded on demand via dynamic \`import()\` or similar.
|
|
17
|
-
|
|
18
|
-
In the **Module Mixed Chunks** tab of Bundle Alerts, each entry shows the module path, **Initial Chunks** list, and **Async Chunks** list so you can locate duplicated modules.
|
|
19
|
-
|
|
20
|
-
#### Common Causes
|
|
21
|
-
|
|
22
|
-
- **Same module referenced in two ways**: The module is both synchronously imported in the main bundle or entry and dynamically \`import()\`ed elsewhere, so the bundler emits it in both initial and async chunks.
|
|
23
|
-
- **A file is both an entry and an async chunk**: e.g. a utility module is configured as an entry and also \`import()\`ed in app code, so it appears in the entry's initial chunk and in a dynamically loaded async chunk.
|
|
24
|
-
- **splitChunks overlapping with entry**: A path is split into an async chunk via \`splitChunks\` / \`chunkSplit\`, but that path is also an entry or a main-bundle dependency, leading to mixed chunk types.
|
|
25
|
-
|
|
26
|
-
#### General Solution
|
|
27
|
-
|
|
28
|
-
1. **Use a single import style**: Prefer one way to reference a module—either all synchronous imports (initial) or all dynamic \`import()\` (async). Avoid the same file being both synchronously imported in the main bundle and dynamically imported elsewhere.
|
|
29
|
-
2. **Review entry vs dynamic loading**: If a file is both an entry and part of an async chunk, remove one of those usages or extract it into a single shared chunk via build config so both initial and async chunks reference it instead of duplicating it.
|
|
30
|
-
3. **Adjust splitChunks**: Check rules for that module path in \`optimization.splitChunks\` (Rspack/Webpack) or \`performance.chunkSplit\` (Rsbuild), and avoid the same module being split into both initial and async chunks. Use \`chunks: 'async'\` or \`chunks: 'initial'\` where appropriate, or control which chunk type it goes into via \`cacheGroups\` and \`test\` / \`chunks\`.
|
|
31
|
-
4. **Trace dependencies**: From the reported module path and chunk list, search the codebase for references to that module, distinguish sync vs dynamic imports, then converge to a single chunk type or extract a common chunk.
|
|
32
|
-
`,
|
|
33
|
-
};
|
package/dist/rule/code/index.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.RsdoctorRuleClientConstant = exports.RuleErrorMap = void 0;
|
|
40
|
-
const E1001 = __importStar(require("./E1001"));
|
|
41
|
-
const E1002 = __importStar(require("./E1002"));
|
|
42
|
-
const E1003 = __importStar(require("./E1003"));
|
|
43
|
-
const E1004 = __importStar(require("./E1004"));
|
|
44
|
-
const E1005 = __importStar(require("./E1005"));
|
|
45
|
-
const E1006 = __importStar(require("./E1006"));
|
|
46
|
-
/**
|
|
47
|
-
* The format is E + "4 digits".
|
|
48
|
-
* - The first number represents the category:
|
|
49
|
-
* - 1 for Webpack build related indexes
|
|
50
|
-
* - ...
|
|
51
|
-
* - The rest of the numbers can be increased by adding zeros
|
|
52
|
-
*/
|
|
53
|
-
exports.RuleErrorMap = {
|
|
54
|
-
[E1001.code]: E1001.message,
|
|
55
|
-
[E1002.code]: E1002.message,
|
|
56
|
-
[E1003.code]: E1003.message,
|
|
57
|
-
[E1004.code]: E1004.message,
|
|
58
|
-
[E1005.code]: E1005.message,
|
|
59
|
-
[E1006.code]: E1006.message,
|
|
60
|
-
};
|
|
61
|
-
var RsdoctorRuleClientConstant;
|
|
62
|
-
(function (RsdoctorRuleClientConstant) {
|
|
63
|
-
RsdoctorRuleClientConstant["UrlQueryForErrorCode"] = "code";
|
|
64
|
-
})(RsdoctorRuleClientConstant || (exports.RsdoctorRuleClientConstant = RsdoctorRuleClientConstant = {}));
|
|
65
|
-
__exportStar(require("./type"), exports);
|
package/dist/rule/code/type.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RuleMessageCategory = exports.RuleMessageCodeEnumerated = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* only defined the code which can be enumerated
|
|
6
|
-
*/
|
|
7
|
-
var RuleMessageCodeEnumerated;
|
|
8
|
-
(function (RuleMessageCodeEnumerated) {
|
|
9
|
-
/**
|
|
10
|
-
* others tools / frameworks errors, such as PIA
|
|
11
|
-
*/
|
|
12
|
-
RuleMessageCodeEnumerated["Extend"] = "EXTEND";
|
|
13
|
-
/**
|
|
14
|
-
* errors show in the overlay at the client, such as Webpack compile errors in development
|
|
15
|
-
*/
|
|
16
|
-
RuleMessageCodeEnumerated["Overlay"] = "OVERLAY";
|
|
17
|
-
})(RuleMessageCodeEnumerated || (exports.RuleMessageCodeEnumerated = RuleMessageCodeEnumerated = {}));
|
|
18
|
-
var RuleMessageCategory;
|
|
19
|
-
(function (RuleMessageCategory) {
|
|
20
|
-
RuleMessageCategory["Compile"] = "compile";
|
|
21
|
-
RuleMessageCategory["Bundle"] = "bundle";
|
|
22
|
-
RuleMessageCategory["EMO"] = "emo";
|
|
23
|
-
})(RuleMessageCategory || (exports.RuleMessageCategory = RuleMessageCategory = {}));
|
package/dist/rule/data.js
DELETED
package/dist/rule/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./code"), exports);
|
|
18
|
-
__exportStar(require("./data"), exports);
|
package/dist/sdk/chunk.js
DELETED
package/dist/sdk/config.js
DELETED
package/dist/sdk/context.js
DELETED
package/dist/sdk/envinfo.js
DELETED
package/dist/sdk/hooks.js
DELETED