@rsdoctor/core 1.2.2 → 1.2.4-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.
- package/dist/build-utils/{common/trans-utils/transStats.js → build/chunks/assetsModules.cjs} +9 -12
- package/dist/build-utils/build/chunks/assetsModules.d.ts +0 -1
- package/dist/build-utils/build/chunks/assetsModules.js +7 -39
- package/dist/build-utils/build/chunks/chunkTransform.cjs +39 -0
- package/dist/build-utils/build/chunks/chunkTransform.d.ts +0 -1
- package/dist/build-utils/build/chunks/chunkTransform.js +5 -37
- package/dist/build-utils/{common/chunks/index.js → build/chunks/index.cjs} +8 -8
- package/dist/build-utils/build/chunks/index.d.ts +0 -1
- package/dist/build-utils/build/chunks/index.js +5 -78
- package/dist/build-utils/build/chunks/rspack/transform.cjs +80 -0
- package/dist/build-utils/build/chunks/rspack/transform.d.ts +0 -1
- package/dist/build-utils/build/chunks/rspack/transform.js +7 -42
- package/dist/build-utils/{common/index.js → build/index.cjs} +14 -14
- package/dist/build-utils/build/index.d.ts +0 -1
- package/dist/build-utils/build/index.js +8 -52
- package/dist/build-utils/build/loader/index.cjs +69 -0
- package/dist/build-utils/build/loader/index.d.ts +1 -1
- package/dist/build-utils/build/loader/index.js +4 -60
- package/dist/build-utils/build/loader/probeLoader.cjs +90 -0
- package/dist/build-utils/build/loader/probeLoader.d.ts +0 -1
- package/dist/build-utils/build/loader/probeLoader.js +12 -57
- package/dist/build-utils/build/loader/probeLoaderPlugin.cjs +65 -0
- package/dist/build-utils/build/loader/probeLoaderPlugin.d.ts +0 -1
- package/dist/build-utils/build/loader/probeLoaderPlugin.js +11 -43
- package/dist/build-utils/build/module-graph/index.cjs +87 -0
- package/dist/build-utils/build/module-graph/index.d.ts +0 -1
- package/dist/build-utils/build/module-graph/index.js +6 -87
- package/dist/build-utils/build/module-graph/parser.cjs +46 -0
- package/dist/build-utils/build/module-graph/parser.d.ts +0 -1
- package/dist/build-utils/build/module-graph/parser.js +7 -39
- package/dist/build-utils/build/module-graph/rspack/transform.cjs +110 -0
- package/dist/build-utils/build/module-graph/rspack/transform.d.ts +0 -1
- package/dist/build-utils/build/module-graph/rspack/transform.js +12 -50
- package/dist/build-utils/build/module-graph/transform.cjs +40 -0
- package/dist/build-utils/build/module-graph/transform.d.ts +0 -1
- package/dist/build-utils/build/module-graph/transform.js +6 -38
- package/dist/build-utils/build/module-graph/treeShaking.cjs +107 -0
- package/dist/build-utils/build/module-graph/treeShaking.d.ts +0 -1
- package/dist/build-utils/build/module-graph/treeShaking.js +15 -49
- package/dist/build-utils/build/module-graph/utils.cjs +97 -0
- package/dist/build-utils/build/module-graph/utils.d.ts +0 -1
- package/dist/build-utils/build/module-graph/utils.js +15 -50
- package/dist/build-utils/build/module-graph/webpack/transform.cjs +171 -0
- package/dist/build-utils/build/module-graph/webpack/transform.d.ts +0 -1
- package/dist/build-utils/build/module-graph/webpack/transform.js +31 -57
- package/dist/build-utils/{common/module-graph/index.js → build/utils/index.cjs} +15 -15
- package/dist/build-utils/build/utils/index.d.ts +0 -2
- package/dist/build-utils/build/utils/index.js +5 -87
- package/dist/build-utils/build/utils/loader.cjs +356 -0
- package/dist/build-utils/build/utils/loader.d.ts +1 -3
- package/dist/build-utils/build/utils/loader.js +44 -90
- package/dist/build-utils/build/utils/parseBundle.cjs +284 -0
- package/dist/build-utils/build/utils/parseBundle.d.ts +1 -2
- package/dist/build-utils/build/utils/parseBundle.js +19 -61
- package/dist/build-utils/build/utils/plugin.cjs +61 -0
- package/dist/build-utils/build/utils/plugin.d.ts +0 -1
- package/dist/build-utils/build/utils/plugin.js +5 -43
- package/dist/build-utils/index.cjs +36 -0
- package/dist/build-utils/index.d.ts +0 -2
- package/dist/build-utils/index.js +4 -40
- package/dist/index.cjs +85 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +6 -85
- package/dist/inner-plugins/constants.cjs +64 -0
- package/dist/inner-plugins/constants.d.ts +0 -1
- package/dist/inner-plugins/constants.js +3 -47
- package/dist/{build-utils/common/trans-utils/index.js → inner-plugins/index.cjs} +14 -5
- package/dist/inner-plugins/index.d.ts +0 -1
- package/dist/inner-plugins/index.js +4 -69
- package/dist/inner-plugins/loaders/proxy.cjs +90 -0
- package/dist/inner-plugins/loaders/proxy.d.ts +4 -2
- package/dist/inner-plugins/loaders/proxy.js +19 -22
- package/dist/inner-plugins/plugins/base.cjs +53 -0
- package/dist/inner-plugins/plugins/base.d.ts +3 -5
- package/dist/inner-plugins/plugins/base.js +6 -38
- package/dist/inner-plugins/plugins/bundle.cjs +121 -0
- package/dist/inner-plugins/plugins/bundle.d.ts +1 -1
- package/dist/inner-plugins/plugins/bundle.js +33 -49
- package/dist/inner-plugins/plugins/bundleTagPlugin.cjs +93 -0
- package/dist/inner-plugins/plugins/bundleTagPlugin.d.ts +0 -1
- package/dist/inner-plugins/plugins/bundleTagPlugin.js +12 -44
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.cjs +166 -0
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts +0 -1
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +42 -70
- package/dist/inner-plugins/plugins/errors.cjs +98 -0
- package/dist/inner-plugins/plugins/errors.d.ts +0 -1
- package/dist/inner-plugins/plugins/errors.js +20 -52
- package/dist/inner-plugins/plugins/index.cjs +141 -0
- package/dist/inner-plugins/plugins/index.d.ts +0 -1
- package/dist/inner-plugins/plugins/index.js +12 -141
- package/dist/inner-plugins/plugins/loader.cjs +155 -0
- package/dist/inner-plugins/plugins/loader.d.ts +0 -1
- package/dist/inner-plugins/plugins/loader.js +29 -57
- package/dist/inner-plugins/plugins/plugins.cjs +73 -0
- package/dist/inner-plugins/plugins/plugins.d.ts +0 -1
- package/dist/inner-plugins/plugins/plugins.js +18 -50
- package/dist/inner-plugins/plugins/progress.cjs +70 -0
- package/dist/inner-plugins/plugins/progress.d.ts +0 -1
- package/dist/inner-plugins/plugins/progress.js +9 -41
- package/dist/inner-plugins/plugins/rspack.cjs +117 -0
- package/dist/inner-plugins/plugins/rspack.d.ts +0 -1
- package/dist/inner-plugins/plugins/rspack.js +24 -56
- package/dist/inner-plugins/plugins/rules.cjs +97 -0
- package/dist/inner-plugins/plugins/rules.d.ts +0 -1
- package/dist/inner-plugins/plugins/rules.js +19 -51
- package/dist/inner-plugins/plugins/sourcemapTool.cjs +213 -0
- package/dist/inner-plugins/plugins/sourcemapTool.d.ts +0 -1
- package/dist/inner-plugins/plugins/sourcemapTool.js +25 -69
- package/dist/inner-plugins/plugins/summary.cjs +125 -0
- package/dist/inner-plugins/plugins/summary.d.ts +0 -1
- package/dist/inner-plugins/plugins/summary.js +28 -60
- package/dist/inner-plugins/utils/circleDetect.cjs +49 -0
- package/dist/inner-plugins/utils/circleDetect.d.ts +0 -1
- package/dist/inner-plugins/utils/circleDetect.js +3 -35
- package/dist/inner-plugins/utils/config.cjs +177 -0
- package/dist/inner-plugins/utils/config.d.ts +3 -8
- package/dist/inner-plugins/utils/config.js +43 -116
- package/dist/inner-plugins/utils/index.cjs +124 -0
- package/dist/inner-plugins/utils/index.d.ts +4 -1
- package/dist/inner-plugins/utils/index.js +9 -96
- package/dist/inner-plugins/utils/loader.cjs +231 -0
- package/dist/inner-plugins/utils/loader.d.ts +4 -4
- package/dist/inner-plugins/utils/loader.js +39 -97
- package/dist/inner-plugins/utils/normalize-config.cjs +122 -0
- package/dist/inner-plugins/utils/normalize-config.d.ts +40 -0
- package/dist/inner-plugins/utils/normalize-config.js +78 -0
- package/dist/inner-plugins/utils/plugin-common.cjs +73 -0
- package/dist/inner-plugins/utils/plugin-common.d.ts +6 -0
- package/dist/inner-plugins/utils/plugin-common.js +28 -0
- package/dist/inner-plugins/utils/plugin.cjs +107 -0
- package/dist/inner-plugins/utils/plugin.d.ts +2 -4
- package/dist/inner-plugins/utils/plugin.js +5 -40
- package/dist/inner-plugins/utils/sdk.cjs +55 -0
- package/dist/inner-plugins/utils/sdk.d.ts +8 -4
- package/dist/inner-plugins/utils/sdk.js +9 -42
- package/dist/rules/index.cjs +85 -0
- package/dist/rules/index.d.ts +0 -1
- package/dist/rules/index.js +6 -85
- package/dist/rules/linter.cjs +71 -0
- package/dist/rules/linter.d.ts +0 -1
- package/dist/rules/linter.js +11 -46
- package/dist/rules/rule.cjs +137 -0
- package/dist/rules/rule.d.ts +1 -2
- package/dist/rules/rule.js +20 -55
- package/dist/rules/rules/cross-chunks-package/index.cjs +73 -0
- package/dist/rules/rules/cross-chunks-package/index.d.ts +0 -1
- package/dist/rules/rules/cross-chunks-package/index.js +10 -42
- package/dist/rules/rules/cross-chunks-package/types.d.ts +0 -1
- package/dist/rules/rules/cross-chunks-package/types.js +2 -18
- package/dist/rules/rules/cross-chunks-package/utils.cjs +40 -0
- package/dist/rules/rules/cross-chunks-package/utils.d.ts +1 -2
- package/dist/rules/rules/cross-chunks-package/utils.js +4 -36
- package/dist/rules/rules/default-import-check/index.cjs +116 -0
- package/dist/rules/rules/default-import-check/index.d.ts +0 -1
- package/dist/rules/rules/default-import-check/index.js +17 -49
- package/dist/rules/rules/default-import-check/types.cjs +18 -0
- package/dist/rules/rules/default-import-check/types.d.ts +0 -1
- package/dist/rules/rules/default-import-check/types.js +2 -18
- package/dist/rules/rules/default-import-check/utils.cjs +98 -0
- package/dist/rules/rules/default-import-check/utils.d.ts +0 -1
- package/dist/rules/rules/default-import-check/utils.js +9 -53
- package/dist/rules/rules/duplicate-package/index.cjs +71 -0
- package/dist/rules/rules/duplicate-package/index.d.ts +0 -1
- package/dist/rules/rules/duplicate-package/index.js +15 -47
- package/dist/rules/rules/duplicate-package/types.cjs +60 -0
- package/dist/rules/rules/duplicate-package/types.d.ts +0 -1
- package/dist/rules/rules/duplicate-package/types.js +5 -40
- package/dist/rules/rules/duplicate-package/utils.cjs +84 -0
- package/dist/rules/rules/duplicate-package/utils.d.ts +0 -1
- package/dist/rules/rules/duplicate-package/utils.js +6 -51
- package/dist/rules/rules/ecma-version-check/index.cjs +97 -0
- package/dist/rules/rules/ecma-version-check/index.d.ts +0 -1
- package/dist/rules/rules/ecma-version-check/index.js +16 -58
- package/dist/rules/rules/ecma-version-check/types.cjs +18 -0
- package/dist/rules/rules/ecma-version-check/types.d.ts +0 -1
- package/dist/rules/rules/ecma-version-check/types.js +2 -18
- package/dist/rules/rules/ecma-version-check/utils.cjs +39 -0
- package/dist/rules/rules/ecma-version-check/utils.d.ts +0 -1
- package/dist/rules/rules/ecma-version-check/utils.js +3 -35
- package/dist/rules/rules/index.cjs +47 -0
- package/dist/rules/rules/index.d.ts +0 -1
- package/dist/rules/rules/index.js +13 -45
- package/dist/rules/rules/loader-performance-optimization/index.cjs +119 -0
- package/dist/rules/rules/loader-performance-optimization/index.d.ts +0 -1
- package/dist/rules/rules/loader-performance-optimization/index.js +14 -46
- package/dist/rules/rules/loader-performance-optimization/types.cjs +18 -0
- package/dist/rules/rules/loader-performance-optimization/types.d.ts +0 -1
- package/dist/rules/rules/loader-performance-optimization/types.js +2 -18
- package/dist/{build-utils/common/chunks/assetsContent.js → rules/rules/loader-performance-optimization/utils.cjs} +9 -10
- package/dist/rules/rules/loader-performance-optimization/utils.d.ts +0 -1
- package/dist/rules/rules/loader-performance-optimization/utils.js +3 -35
- package/dist/rules/utils.cjs +46 -0
- package/dist/rules/utils.d.ts +0 -1
- package/dist/rules/utils.js +6 -41
- package/dist/types/chunks.cjs +18 -0
- package/dist/types/chunks.d.ts +1 -7
- package/dist/types/chunks.js +2 -18
- package/dist/types/index.cjs +87 -0
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.js +6 -96
- package/dist/types/loader.cjs +18 -0
- package/dist/types/loader.d.ts +0 -1
- package/dist/types/loader.js +2 -18
- package/dist/types/plugin.cjs +18 -0
- package/dist/types/plugin.d.ts +7 -108
- package/dist/types/plugin.js +2 -18
- package/dist/types/rules.cjs +18 -0
- package/dist/types/rules.d.ts +0 -1
- package/dist/types/rules.js +2 -18
- package/package.json +29 -33
- package/dist/build-utils/build/chunks/assetsModules.d.ts.map +0 -1
- package/dist/build-utils/build/chunks/chunkTransform.d.ts.map +0 -1
- package/dist/build-utils/build/chunks/index.d.ts.map +0 -1
- package/dist/build-utils/build/chunks/rspack/transform.d.ts.map +0 -1
- package/dist/build-utils/build/index.d.ts.map +0 -1
- package/dist/build-utils/build/loader/index.d.ts.map +0 -1
- package/dist/build-utils/build/loader/probeLoader.d.ts.map +0 -1
- package/dist/build-utils/build/loader/probeLoaderPlugin.d.ts.map +0 -1
- package/dist/build-utils/build/module-graph/index.d.ts.map +0 -1
- package/dist/build-utils/build/module-graph/parser.d.ts.map +0 -1
- package/dist/build-utils/build/module-graph/rspack/transform.d.ts.map +0 -1
- package/dist/build-utils/build/module-graph/transform.d.ts.map +0 -1
- package/dist/build-utils/build/module-graph/treeShaking.d.ts.map +0 -1
- package/dist/build-utils/build/module-graph/utils.d.ts.map +0 -1
- package/dist/build-utils/build/module-graph/webpack/transform.d.ts.map +0 -1
- package/dist/build-utils/build/utils/index.d.ts.map +0 -1
- package/dist/build-utils/build/utils/loader.d.ts.map +0 -1
- package/dist/build-utils/build/utils/parseBundle.d.ts.map +0 -1
- package/dist/build-utils/build/utils/plugin.d.ts.map +0 -1
- package/dist/build-utils/common/chunks/assetsContent.d.ts +0 -6
- package/dist/build-utils/common/chunks/assetsContent.d.ts.map +0 -1
- package/dist/build-utils/common/chunks/assetsModules.d.ts +0 -23
- package/dist/build-utils/common/chunks/assetsModules.d.ts.map +0 -1
- package/dist/build-utils/common/chunks/assetsModules.js +0 -155
- package/dist/build-utils/common/chunks/chunkTransform.d.ts +0 -6
- package/dist/build-utils/common/chunks/chunkTransform.d.ts.map +0 -1
- package/dist/build-utils/common/chunks/chunkTransform.js +0 -74
- package/dist/build-utils/common/chunks/index.d.ts +0 -4
- package/dist/build-utils/common/chunks/index.d.ts.map +0 -1
- package/dist/build-utils/common/index.d.ts +0 -6
- package/dist/build-utils/common/index.d.ts.map +0 -1
- package/dist/build-utils/common/module-graph/compatible.d.ts +0 -9
- package/dist/build-utils/common/module-graph/compatible.d.ts.map +0 -1
- package/dist/build-utils/common/module-graph/compatible.js +0 -73
- package/dist/build-utils/common/module-graph/index.d.ts +0 -4
- package/dist/build-utils/common/module-graph/index.d.ts.map +0 -1
- package/dist/build-utils/common/module-graph/transform.d.ts +0 -8
- package/dist/build-utils/common/module-graph/transform.d.ts.map +0 -1
- package/dist/build-utils/common/module-graph/transform.js +0 -181
- package/dist/build-utils/common/module-graph/utils.d.ts +0 -14
- package/dist/build-utils/common/module-graph/utils.d.ts.map +0 -1
- package/dist/build-utils/common/module-graph/utils.js +0 -58
- package/dist/build-utils/common/trans-utils/index.d.ts +0 -2
- package/dist/build-utils/common/trans-utils/index.d.ts.map +0 -1
- package/dist/build-utils/common/trans-utils/transStats.d.ts +0 -11
- package/dist/build-utils/common/trans-utils/transStats.d.ts.map +0 -1
- package/dist/build-utils/common/webpack/compatible.d.ts +0 -18
- package/dist/build-utils/common/webpack/compatible.d.ts.map +0 -1
- package/dist/build-utils/common/webpack/compatible.js +0 -156
- package/dist/build-utils/index.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/inner-plugins/constants.d.ts.map +0 -1
- package/dist/inner-plugins/index.d.ts.map +0 -1
- package/dist/inner-plugins/loaders/proxy.d.ts.map +0 -1
- package/dist/inner-plugins/plugins/base.d.ts.map +0 -1
- package/dist/inner-plugins/plugins/bundle.d.ts.map +0 -1
- package/dist/inner-plugins/plugins/bundleTagPlugin.d.ts.map +0 -1
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts.map +0 -1
- package/dist/inner-plugins/plugins/errors.d.ts.map +0 -1
- package/dist/inner-plugins/plugins/index.d.ts.map +0 -1
- package/dist/inner-plugins/plugins/loader.d.ts.map +0 -1
- package/dist/inner-plugins/plugins/plugins.d.ts.map +0 -1
- package/dist/inner-plugins/plugins/progress.d.ts.map +0 -1
- package/dist/inner-plugins/plugins/rspack.d.ts.map +0 -1
- package/dist/inner-plugins/plugins/rules.d.ts.map +0 -1
- package/dist/inner-plugins/plugins/sourcemapTool.d.ts.map +0 -1
- package/dist/inner-plugins/plugins/summary.d.ts.map +0 -1
- package/dist/inner-plugins/utils/circleDetect.d.ts.map +0 -1
- package/dist/inner-plugins/utils/config.d.ts.map +0 -1
- package/dist/inner-plugins/utils/index.d.ts.map +0 -1
- package/dist/inner-plugins/utils/loader.d.ts.map +0 -1
- package/dist/inner-plugins/utils/plugin.d.ts.map +0 -1
- package/dist/inner-plugins/utils/sdk.d.ts.map +0 -1
- package/dist/rules/index.d.ts.map +0 -1
- package/dist/rules/linter.d.ts.map +0 -1
- package/dist/rules/rule.d.ts.map +0 -1
- package/dist/rules/rules/cross-chunks-package/index.d.ts.map +0 -1
- package/dist/rules/rules/cross-chunks-package/types.d.ts.map +0 -1
- package/dist/rules/rules/cross-chunks-package/utils.d.ts.map +0 -1
- package/dist/rules/rules/default-import-check/index.d.ts.map +0 -1
- package/dist/rules/rules/default-import-check/types.d.ts.map +0 -1
- package/dist/rules/rules/default-import-check/utils.d.ts.map +0 -1
- package/dist/rules/rules/duplicate-package/index.d.ts.map +0 -1
- package/dist/rules/rules/duplicate-package/types.d.ts.map +0 -1
- package/dist/rules/rules/duplicate-package/utils.d.ts.map +0 -1
- package/dist/rules/rules/ecma-version-check/index.d.ts.map +0 -1
- package/dist/rules/rules/ecma-version-check/types.d.ts.map +0 -1
- package/dist/rules/rules/ecma-version-check/utils.d.ts.map +0 -1
- package/dist/rules/rules/index.d.ts.map +0 -1
- package/dist/rules/rules/loader-performance-optimization/index.d.ts.map +0 -1
- package/dist/rules/rules/loader-performance-optimization/types.d.ts.map +0 -1
- package/dist/rules/rules/loader-performance-optimization/utils.d.ts.map +0 -1
- package/dist/rules/utils.d.ts.map +0 -1
- package/dist/types/chunks.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/loader.d.ts.map +0 -1
- package/dist/types/plugin.d.ts.map +0 -1
- package/dist/types/rules.d.ts.map +0 -1
- package/dist/types/webpack.d.ts +0 -15
- package/dist/types/webpack.d.ts.map +0 -1
- /package/dist/{types/webpack.js → rules/rules/cross-chunks-package/types.cjs} +0 -0
|
@@ -1,44 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
})();
|
|
11
|
-
(()=>{
|
|
12
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
-
})();
|
|
14
|
-
(()=>{
|
|
15
|
-
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
-
value: 'Module'
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
-
value: true
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
})();
|
|
24
|
-
var __webpack_exports__ = {};
|
|
25
|
-
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
InternalSummaryPlugin: ()=>InternalSummaryPlugin
|
|
28
|
-
});
|
|
29
|
-
const common_namespaceObject = require("@rsdoctor/utils/common");
|
|
30
|
-
const external_lodash_namespaceObject = require("lodash");
|
|
31
|
-
const external_base_js_namespaceObject = require("./base.js");
|
|
32
|
-
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
33
|
-
class InternalSummaryPlugin extends external_base_js_namespaceObject.InternalBasePlugin {
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
import { Summary } from "@rsdoctor/utils/common";
|
|
4
|
+
import { minBy, sumBy } from "lodash-es";
|
|
5
|
+
import { InternalBasePlugin } from "./base.js";
|
|
6
|
+
import { time, timeEnd } from "@rsdoctor/utils/logger";
|
|
7
|
+
class InternalSummaryPlugin extends InternalBasePlugin {
|
|
34
8
|
apply(compiler) {
|
|
35
|
-
|
|
9
|
+
time('InternalSummaryPlugin.apply');
|
|
36
10
|
try {
|
|
37
11
|
compiler.hooks.beforeCompile.tapPromise(this.tapPostOptions, this.beforeCompile);
|
|
38
12
|
compiler.hooks.afterCompile.tapPromise(this.tapPreOptions, this.afterCompile);
|
|
39
13
|
compiler.hooks.done.tapPromise(this.tapPostOptions, this.done.bind(this, compiler));
|
|
40
14
|
} finally{
|
|
41
|
-
|
|
15
|
+
timeEnd('InternalSummaryPlugin.apply');
|
|
42
16
|
}
|
|
43
17
|
}
|
|
44
18
|
mark(key, type) {
|
|
@@ -68,33 +42,33 @@ class InternalSummaryPlugin extends external_base_js_namespaceObject.InternalBas
|
|
|
68
42
|
}
|
|
69
43
|
constructor(...args){
|
|
70
44
|
super(...args), this.name = 'summary', this.times = new Map(), this.preTimes = new Map(), this.postTimes = new Map(), this.beforeCompile = async ()=>{
|
|
71
|
-
|
|
45
|
+
time('InternalSummaryPlugin.beforeCompile');
|
|
72
46
|
try {
|
|
73
|
-
if (!this.times.has(
|
|
47
|
+
if (!this.times.has(Summary.SummaryCostsDataName.Bootstrap)) {
|
|
74
48
|
const costs = Math.floor(1000 * process.uptime());
|
|
75
49
|
const startAt = Date.now() - costs;
|
|
76
|
-
this.report(
|
|
77
|
-
this.mark(
|
|
50
|
+
this.report(Summary.SummaryCostsDataName.Bootstrap, startAt);
|
|
51
|
+
this.mark(Summary.SummaryCostsDataName.Bootstrap, 'post');
|
|
78
52
|
}
|
|
79
53
|
} finally{
|
|
80
|
-
|
|
54
|
+
timeEnd('InternalSummaryPlugin.beforeCompile');
|
|
81
55
|
}
|
|
82
56
|
}, this.afterCompile = async (compilation)=>{
|
|
83
|
-
|
|
57
|
+
time('InternalSummaryPlugin.afterCompile');
|
|
84
58
|
try {
|
|
85
|
-
if (!this.times.has(
|
|
86
|
-
const start = this.postTimes.get(
|
|
87
|
-
this.report(
|
|
88
|
-
this.mark(
|
|
59
|
+
if (!this.times.has(Summary.SummaryCostsDataName.Compile) && !compilation.compiler.isChild()) {
|
|
60
|
+
const start = this.postTimes.get(Summary.SummaryCostsDataName.Bootstrap);
|
|
61
|
+
this.report(Summary.SummaryCostsDataName.Compile, start);
|
|
62
|
+
this.mark(Summary.SummaryCostsDataName.Compile, 'post');
|
|
89
63
|
}
|
|
90
64
|
} finally{
|
|
91
|
-
|
|
65
|
+
timeEnd('InternalSummaryPlugin.afterCompile');
|
|
92
66
|
}
|
|
93
67
|
}, this.done = async (compiler)=>{
|
|
94
|
-
|
|
68
|
+
time('InternalSummaryPlugin.done');
|
|
95
69
|
try {
|
|
96
|
-
const start = this.postTimes.get(
|
|
97
|
-
this.report(
|
|
70
|
+
const start = this.postTimes.get(Summary.SummaryCostsDataName.Compile);
|
|
71
|
+
this.report(Summary.SummaryCostsDataName.Done, start);
|
|
98
72
|
if (false !== compiler.options.optimization.minimize) {
|
|
99
73
|
const pluginData = this.sdk.getStoreData().plugin;
|
|
100
74
|
const minifyHookData = [
|
|
@@ -103,23 +77,17 @@ class InternalSummaryPlugin extends external_base_js_namespaceObject.InternalBas
|
|
|
103
77
|
minifyHookData.length && this.sdk.reportSummaryData({
|
|
104
78
|
costs: [
|
|
105
79
|
{
|
|
106
|
-
name:
|
|
107
|
-
startAt:
|
|
108
|
-
costs:
|
|
80
|
+
name: Summary.SummaryCostsDataName.Minify,
|
|
81
|
+
startAt: minBy(minifyHookData, (e)=>e.startAt).startAt,
|
|
82
|
+
costs: sumBy(minifyHookData, (e)=>e.costs)
|
|
109
83
|
}
|
|
110
84
|
]
|
|
111
85
|
});
|
|
112
86
|
}
|
|
113
87
|
} finally{
|
|
114
|
-
|
|
88
|
+
timeEnd('InternalSummaryPlugin.done');
|
|
115
89
|
}
|
|
116
90
|
};
|
|
117
91
|
}
|
|
118
92
|
}
|
|
119
|
-
|
|
120
|
-
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
121
|
-
"InternalSummaryPlugin"
|
|
122
|
-
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
123
|
-
Object.defineProperty(exports, '__esModule', {
|
|
124
|
-
value: true
|
|
125
|
-
});
|
|
93
|
+
export { InternalSummaryPlugin };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
checkCirclePath: ()=>checkCirclePath
|
|
28
|
+
});
|
|
29
|
+
const checkCirclePath = (obj, record, res, level, maxLevel = 3)=>{
|
|
30
|
+
const idx = record.slice(0, record.length - 1).findIndex((v)=>v.ref === obj);
|
|
31
|
+
if (-1 !== idx) {
|
|
32
|
+
const key = record.map((v)=>v.prop);
|
|
33
|
+
if (res.indexOf(key) < 0) return void res.push(key);
|
|
34
|
+
}
|
|
35
|
+
if ('object' == typeof obj && null !== obj && level < maxLevel) for (const [k, v] of Object.entries(obj))checkCirclePath(v, [
|
|
36
|
+
...record,
|
|
37
|
+
{
|
|
38
|
+
prop: k,
|
|
39
|
+
ref: v
|
|
40
|
+
}
|
|
41
|
+
], res, level + 1);
|
|
42
|
+
};
|
|
43
|
+
exports.checkCirclePath = __webpack_exports__.checkCirclePath;
|
|
44
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
45
|
+
"checkCirclePath"
|
|
46
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
47
|
+
Object.defineProperty(exports, '__esModule', {
|
|
48
|
+
value: true
|
|
49
|
+
});
|
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: definition[key]
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
})();
|
|
11
|
-
(()=>{
|
|
12
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
-
})();
|
|
14
|
-
(()=>{
|
|
15
|
-
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
-
value: 'Module'
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
-
value: true
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
})();
|
|
24
|
-
var __webpack_exports__ = {};
|
|
25
|
-
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
checkCirclePath: ()=>checkCirclePath
|
|
28
|
-
});
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
29
3
|
const checkCirclePath = (obj, record, res, level, maxLevel = 3)=>{
|
|
30
4
|
const idx = record.slice(0, record.length - 1).findIndex((v)=>v.ref === obj);
|
|
31
5
|
if (-1 !== idx) {
|
|
@@ -40,10 +14,4 @@ const checkCirclePath = (obj, record, res, level, maxLevel = 3)=>{
|
|
|
40
14
|
}
|
|
41
15
|
], res, level + 1);
|
|
42
16
|
};
|
|
43
|
-
|
|
44
|
-
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
45
|
-
"checkCirclePath"
|
|
46
|
-
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
47
|
-
Object.defineProperty(exports, '__esModule', {
|
|
48
|
-
value: true
|
|
49
|
-
});
|
|
17
|
+
export { checkCirclePath };
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
normalizeUserConfig: ()=>normalizeUserConfig,
|
|
37
|
+
normalizeReportType: ()=>normalizeReportType,
|
|
38
|
+
normalizeRspackUserOptions: ()=>normalizeRspackUserOptions
|
|
39
|
+
});
|
|
40
|
+
const types_namespaceObject = require("@rsdoctor/types");
|
|
41
|
+
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
42
|
+
const external_assert_namespaceObject = require("assert");
|
|
43
|
+
var external_assert_default = /*#__PURE__*/ __webpack_require__.n(external_assert_namespaceObject);
|
|
44
|
+
const external_normalize_config_cjs_namespaceObject = require("./normalize-config.cjs");
|
|
45
|
+
function defaultBoolean(v, dft) {
|
|
46
|
+
return 'boolean' == typeof v ? v : dft;
|
|
47
|
+
}
|
|
48
|
+
function getDefaultOutput() {
|
|
49
|
+
return {
|
|
50
|
+
mode: void 0,
|
|
51
|
+
reportCodeType: {
|
|
52
|
+
noModuleSource: false,
|
|
53
|
+
noAssetsAndModuleSource: false,
|
|
54
|
+
noCode: false
|
|
55
|
+
},
|
|
56
|
+
options: void 0,
|
|
57
|
+
reportDir: '',
|
|
58
|
+
compressData: void 0
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function getDefaultSupports() {
|
|
62
|
+
return {
|
|
63
|
+
parseBundle: true,
|
|
64
|
+
banner: void 0,
|
|
65
|
+
gzip: true
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function normalizeFeatures(features, mode) {
|
|
69
|
+
if (Array.isArray(features)) return {
|
|
70
|
+
loader: features.includes('loader'),
|
|
71
|
+
plugins: features.includes('plugins'),
|
|
72
|
+
resolver: features.includes('resolver'),
|
|
73
|
+
bundle: features.includes('bundle'),
|
|
74
|
+
treeShaking: features.includes('treeShaking'),
|
|
75
|
+
lite: features.includes('lite') || mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.lite]
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
loader: defaultBoolean(features.loader, true),
|
|
79
|
+
plugins: defaultBoolean(features.plugins, true),
|
|
80
|
+
resolver: defaultBoolean(features.resolver, false),
|
|
81
|
+
bundle: defaultBoolean(features.bundle, true),
|
|
82
|
+
treeShaking: defaultBoolean(features.treeShaking, false),
|
|
83
|
+
lite: defaultBoolean(features.lite, false) || mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.lite]
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function normalizeLinter(linter) {
|
|
87
|
+
return {
|
|
88
|
+
rules: {},
|
|
89
|
+
extends: [],
|
|
90
|
+
level: 'Error',
|
|
91
|
+
...linter
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function isValidMode(mode) {
|
|
95
|
+
return 'string' == typeof mode && [
|
|
96
|
+
'brief',
|
|
97
|
+
'normal',
|
|
98
|
+
'lite'
|
|
99
|
+
].includes(mode);
|
|
100
|
+
}
|
|
101
|
+
function normalizeUserConfig(config = {}) {
|
|
102
|
+
const { linter = {}, features = {}, loaderInterceptorOptions = {}, disableClientServer = false, sdkInstance, innerClientPath = '', output = getDefaultOutput(), supports = getDefaultSupports(), port, printLog = {
|
|
103
|
+
serverUrls: true
|
|
104
|
+
}, mode, brief } = config;
|
|
105
|
+
external_assert_default()('object' == typeof linter);
|
|
106
|
+
external_assert_default()('object' == typeof features || Array.isArray(features));
|
|
107
|
+
external_assert_default()('object' == typeof loaderInterceptorOptions);
|
|
108
|
+
external_assert_default()('boolean' == typeof disableClientServer);
|
|
109
|
+
let finalMode = ('mode' in output && isValidMode(output.mode) ? 'lite' === output.mode ? types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.normal] : output.mode : void 0) || mode || types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.normal];
|
|
110
|
+
if (mode) logger_namespaceObject.logger.info(logger_namespaceObject.chalk.yellow("The 'mode' configuration will be deprecated in a future version. Please use 'output.mode' instead."));
|
|
111
|
+
const _features = normalizeFeatures(features, finalMode);
|
|
112
|
+
const _linter = normalizeLinter(linter);
|
|
113
|
+
if (_features.lite || finalMode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.lite]) logger_namespaceObject.logger.info(logger_namespaceObject.chalk.yellow("Lite features will be deprecated in a future version. Please use 'output: { reportCodeType: { noAssetsAndModuleSource: true }}' instead."));
|
|
114
|
+
const { finalBrief, finalNormalOptions } = (0, external_normalize_config_cjs_namespaceObject.processModeConfigurations)(finalMode, output, brief);
|
|
115
|
+
if (_features.lite && finalMode !== types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief]) finalMode = types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.lite];
|
|
116
|
+
const reportCodeType = output.reportCodeType ? normalizeReportType(output.reportCodeType, finalMode) : normalizeReportType(getDefaultOutput().reportCodeType, finalMode);
|
|
117
|
+
const res = {
|
|
118
|
+
linter: _linter,
|
|
119
|
+
features: _features,
|
|
120
|
+
loaderInterceptorOptions: {
|
|
121
|
+
skipLoaders: Array.isArray(loaderInterceptorOptions.skipLoaders) ? loaderInterceptorOptions.skipLoaders : []
|
|
122
|
+
},
|
|
123
|
+
disableClientServer,
|
|
124
|
+
sdkInstance,
|
|
125
|
+
output: {
|
|
126
|
+
mode: finalMode,
|
|
127
|
+
options: 'brief' === finalMode ? finalBrief : finalNormalOptions,
|
|
128
|
+
reportCodeType,
|
|
129
|
+
reportDir: output.reportDir || ''
|
|
130
|
+
},
|
|
131
|
+
innerClientPath,
|
|
132
|
+
supports,
|
|
133
|
+
port,
|
|
134
|
+
printLog
|
|
135
|
+
};
|
|
136
|
+
if (void 0 !== output.compressData) logger_namespaceObject.logger.info(logger_namespaceObject.chalk.yellow("The 'compressData' configuration will be deprecated in a future version."));
|
|
137
|
+
return res;
|
|
138
|
+
}
|
|
139
|
+
const normalizeReportType = (reportCodeType, mode)=>{
|
|
140
|
+
const convertedReportCodeType = 'object' == typeof reportCodeType ? (0, external_normalize_config_cjs_namespaceObject.convertReportCodeTypeObject)(reportCodeType) : reportCodeType;
|
|
141
|
+
if ('noCode' === convertedReportCodeType) return types_namespaceObject.SDK.ToDataType.NoCode;
|
|
142
|
+
if (mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief]) return types_namespaceObject.SDK.ToDataType.NoCode;
|
|
143
|
+
if (mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.lite]) return types_namespaceObject.SDK.ToDataType.NoSourceAndAssets;
|
|
144
|
+
if ('noAssetsAndModuleSource' === convertedReportCodeType) return types_namespaceObject.SDK.ToDataType.NoSourceAndAssets;
|
|
145
|
+
if ('noModuleSource' === convertedReportCodeType) return types_namespaceObject.SDK.ToDataType.NoSource;
|
|
146
|
+
return types_namespaceObject.SDK.ToDataType.Normal;
|
|
147
|
+
};
|
|
148
|
+
function normalizeRspackUserOptions(options) {
|
|
149
|
+
var _options_experiments, _options_experiments1;
|
|
150
|
+
const config = normalizeUserConfig(options);
|
|
151
|
+
config.experiments ??= {
|
|
152
|
+
enableNativePlugin: {
|
|
153
|
+
moduleGraph: false,
|
|
154
|
+
chunkGraph: false
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
if ('boolean' == typeof (null == (_options_experiments = options.experiments) ? void 0 : _options_experiments.enableNativePlugin) && (null == (_options_experiments1 = options.experiments) ? void 0 : _options_experiments1.enableNativePlugin) === true) config.experiments.enableNativePlugin = {
|
|
158
|
+
moduleGraph: true,
|
|
159
|
+
chunkGraph: true
|
|
160
|
+
};
|
|
161
|
+
else config.experiments.enableNativePlugin = {
|
|
162
|
+
moduleGraph: false,
|
|
163
|
+
chunkGraph: false
|
|
164
|
+
};
|
|
165
|
+
return config;
|
|
166
|
+
}
|
|
167
|
+
exports.normalizeReportType = __webpack_exports__.normalizeReportType;
|
|
168
|
+
exports.normalizeRspackUserOptions = __webpack_exports__.normalizeRspackUserOptions;
|
|
169
|
+
exports.normalizeUserConfig = __webpack_exports__.normalizeUserConfig;
|
|
170
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
171
|
+
"normalizeReportType",
|
|
172
|
+
"normalizeRspackUserOptions",
|
|
173
|
+
"normalizeUserConfig"
|
|
174
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
175
|
+
Object.defineProperty(exports, '__esModule', {
|
|
176
|
+
value: true
|
|
177
|
+
});
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
+
import { RsdoctorRspackPluginOptions, RsdoctorRspackPluginOptionsNormalized } from '../../types';
|
|
1
2
|
import { Linter, Plugin, SDK } from '@rsdoctor/types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { RsdoctorWebpackPluginOptions, RsdoctorPluginOptionsNormalized, IReportCodeType, RsdoctorRspackPluginOptions, RsdoctorRspackPluginOptionsNormalized } from '../../types';
|
|
5
|
-
export declare function normalizeUserConfig<Rules extends Linter.ExtendRuleData[]>(config?: RsdoctorWebpackPluginOptions<Rules>): RsdoctorPluginOptionsNormalized<Rules>;
|
|
6
|
-
export declare function makeRuleSetSerializable(item: RspackRuleSetCondition | WebpackRuleSetConditionAbsolute | WebpackRuleSetCondition | void): void;
|
|
7
|
-
export declare function makeRulesSerializable(rules: Plugin.RuleSetRule[] | RspackRuleSetRule['oneOf'] | WebpackRuleSetRule['oneOf']): void;
|
|
8
|
-
export declare const normalizeReportType: (reportCodeType: IReportCodeType, mode: keyof typeof SDK.IMode) => SDK.ToDataType;
|
|
3
|
+
export declare function normalizeUserConfig<Rules extends Linter.ExtendRuleData[]>(config?: Plugin.RsdoctorWebpackPluginOptions<Rules>): Plugin.RsdoctorPluginOptionsNormalized<Rules>;
|
|
4
|
+
export declare const normalizeReportType: (reportCodeType: Plugin.IReportCodeType | Plugin.NewReportCodeType, mode: keyof typeof SDK.IMode) => SDK.ToDataType;
|
|
9
5
|
export declare function normalizeRspackUserOptions<Rules extends Linter.ExtendRuleData[]>(options: RsdoctorRspackPluginOptions<Rules>): RsdoctorRspackPluginOptionsNormalized<Rules>;
|
|
10
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1,60 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
a: getter
|
|
8
|
-
});
|
|
9
|
-
return getter;
|
|
10
|
-
};
|
|
11
|
-
})();
|
|
12
|
-
(()=>{
|
|
13
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: definition[key]
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
})();
|
|
20
|
-
(()=>{
|
|
21
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
-
})();
|
|
23
|
-
(()=>{
|
|
24
|
-
__webpack_require__.r = (exports1)=>{
|
|
25
|
-
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
-
value: 'Module'
|
|
27
|
-
});
|
|
28
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
-
value: true
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
})();
|
|
33
|
-
var __webpack_exports__ = {};
|
|
34
|
-
__webpack_require__.r(__webpack_exports__);
|
|
35
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
-
normalizeUserConfig: ()=>normalizeUserConfig,
|
|
37
|
-
makeRuleSetSerializable: ()=>makeRuleSetSerializable,
|
|
38
|
-
makeRulesSerializable: ()=>makeRulesSerializable,
|
|
39
|
-
normalizeReportType: ()=>normalizeReportType,
|
|
40
|
-
normalizeRspackUserOptions: ()=>normalizeRspackUserOptions
|
|
41
|
-
});
|
|
42
|
-
const types_namespaceObject = require("@rsdoctor/types");
|
|
43
|
-
const external_assert_namespaceObject = require("assert");
|
|
44
|
-
var external_assert_default = /*#__PURE__*/ __webpack_require__.n(external_assert_namespaceObject);
|
|
45
|
-
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
import { SDK } from "@rsdoctor/types";
|
|
4
|
+
import { chalk, logger } from "@rsdoctor/utils/logger";
|
|
5
|
+
import assert from "assert";
|
|
6
|
+
import { convertReportCodeTypeObject, processModeConfigurations } from "./normalize-config.js";
|
|
46
7
|
function defaultBoolean(v, dft) {
|
|
47
8
|
return 'boolean' == typeof v ? v : dft;
|
|
48
9
|
}
|
|
49
10
|
function getDefaultOutput() {
|
|
50
11
|
return {
|
|
12
|
+
mode: void 0,
|
|
51
13
|
reportCodeType: {
|
|
52
14
|
noModuleSource: false,
|
|
53
15
|
noAssetsAndModuleSource: false,
|
|
54
16
|
noCode: false
|
|
55
17
|
},
|
|
18
|
+
options: void 0,
|
|
56
19
|
reportDir: '',
|
|
57
|
-
compressData:
|
|
20
|
+
compressData: void 0
|
|
58
21
|
};
|
|
59
22
|
}
|
|
60
23
|
function getDefaultSupports() {
|
|
@@ -71,7 +34,7 @@ function normalizeFeatures(features, mode) {
|
|
|
71
34
|
resolver: features.includes('resolver'),
|
|
72
35
|
bundle: features.includes('bundle'),
|
|
73
36
|
treeShaking: features.includes('treeShaking'),
|
|
74
|
-
lite: features.includes('lite') || mode ===
|
|
37
|
+
lite: features.includes('lite') || mode === SDK.IMode[SDK.IMode.lite]
|
|
75
38
|
};
|
|
76
39
|
return {
|
|
77
40
|
loader: defaultBoolean(features.loader, true),
|
|
@@ -79,7 +42,7 @@ function normalizeFeatures(features, mode) {
|
|
|
79
42
|
resolver: defaultBoolean(features.resolver, false),
|
|
80
43
|
bundle: defaultBoolean(features.bundle, true),
|
|
81
44
|
treeShaking: defaultBoolean(features.treeShaking, false),
|
|
82
|
-
lite: defaultBoolean(features.lite, false) || mode ===
|
|
45
|
+
lite: defaultBoolean(features.lite, false) || mode === SDK.IMode[SDK.IMode.lite]
|
|
83
46
|
};
|
|
84
47
|
}
|
|
85
48
|
function normalizeLinter(linter) {
|
|
@@ -90,23 +53,29 @@ function normalizeLinter(linter) {
|
|
|
90
53
|
...linter
|
|
91
54
|
};
|
|
92
55
|
}
|
|
56
|
+
function isValidMode(mode) {
|
|
57
|
+
return 'string' == typeof mode && [
|
|
58
|
+
'brief',
|
|
59
|
+
'normal',
|
|
60
|
+
'lite'
|
|
61
|
+
].includes(mode);
|
|
62
|
+
}
|
|
93
63
|
function normalizeUserConfig(config = {}) {
|
|
94
64
|
const { linter = {}, features = {}, loaderInterceptorOptions = {}, disableClientServer = false, sdkInstance, innerClientPath = '', output = getDefaultOutput(), supports = getDefaultSupports(), port, printLog = {
|
|
95
65
|
serverUrls: true
|
|
96
|
-
}, mode
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
external_assert_default()('boolean' == typeof disableClientServer);
|
|
105
|
-
const _features = normalizeFeatures(features, mode);
|
|
66
|
+
}, mode, brief } = config;
|
|
67
|
+
assert('object' == typeof linter);
|
|
68
|
+
assert('object' == typeof features || Array.isArray(features));
|
|
69
|
+
assert('object' == typeof loaderInterceptorOptions);
|
|
70
|
+
assert('boolean' == typeof disableClientServer);
|
|
71
|
+
let finalMode = ('mode' in output && isValidMode(output.mode) ? 'lite' === output.mode ? SDK.IMode[SDK.IMode.normal] : output.mode : void 0) || mode || SDK.IMode[SDK.IMode.normal];
|
|
72
|
+
if (mode) logger.info(chalk.yellow("The 'mode' configuration will be deprecated in a future version. Please use 'output.mode' instead."));
|
|
73
|
+
const _features = normalizeFeatures(features, finalMode);
|
|
106
74
|
const _linter = normalizeLinter(linter);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
75
|
+
if (_features.lite || finalMode === SDK.IMode[SDK.IMode.lite]) logger.info(chalk.yellow("Lite features will be deprecated in a future version. Please use 'output: { reportCodeType: { noAssetsAndModuleSource: true }}' instead."));
|
|
76
|
+
const { finalBrief, finalNormalOptions } = processModeConfigurations(finalMode, output, brief);
|
|
77
|
+
if (_features.lite && finalMode !== SDK.IMode[SDK.IMode.brief]) finalMode = SDK.IMode[SDK.IMode.lite];
|
|
78
|
+
const reportCodeType = output.reportCodeType ? normalizeReportType(output.reportCodeType, finalMode) : normalizeReportType(getDefaultOutput().reportCodeType, finalMode);
|
|
110
79
|
const res = {
|
|
111
80
|
linter: _linter,
|
|
112
81
|
features: _features,
|
|
@@ -116,55 +85,27 @@ function normalizeUserConfig(config = {}) {
|
|
|
116
85
|
disableClientServer,
|
|
117
86
|
sdkInstance,
|
|
118
87
|
output: {
|
|
88
|
+
mode: finalMode,
|
|
89
|
+
options: 'brief' === finalMode ? finalBrief : finalNormalOptions,
|
|
119
90
|
reportCodeType,
|
|
120
|
-
reportDir: output.reportDir || ''
|
|
121
|
-
compressData: void 0 !== output.compressData ? output.compressData : true
|
|
91
|
+
reportDir: output.reportDir || ''
|
|
122
92
|
},
|
|
123
93
|
innerClientPath,
|
|
124
94
|
supports,
|
|
125
95
|
port,
|
|
126
|
-
printLog
|
|
127
|
-
mode,
|
|
128
|
-
brief
|
|
96
|
+
printLog
|
|
129
97
|
};
|
|
130
|
-
if (
|
|
98
|
+
if (void 0 !== output.compressData) logger.info(chalk.yellow("The 'compressData' configuration will be deprecated in a future version."));
|
|
131
99
|
return res;
|
|
132
100
|
}
|
|
133
|
-
function makeRuleSetSerializable(item) {
|
|
134
|
-
if (!item) return;
|
|
135
|
-
if (item instanceof RegExp) item.toJSON = item.toString;
|
|
136
|
-
else if (Array.isArray(item)) item.forEach((i)=>makeRuleSetSerializable(i));
|
|
137
|
-
else if ('object' == typeof item) {
|
|
138
|
-
makeRuleSetSerializable(item.and);
|
|
139
|
-
makeRuleSetSerializable(item.or);
|
|
140
|
-
makeRuleSetSerializable(item.not);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
function makeRulesSerializable(rules) {
|
|
144
|
-
if (!Array.isArray(rules)) return;
|
|
145
|
-
if (!rules.length) return;
|
|
146
|
-
rules.forEach((rule)=>{
|
|
147
|
-
if (!rule) return;
|
|
148
|
-
makeRuleSetSerializable(rule.test);
|
|
149
|
-
makeRuleSetSerializable(rule.resourceQuery);
|
|
150
|
-
makeRuleSetSerializable(rule.resource);
|
|
151
|
-
makeRuleSetSerializable(rule.resourceFragment);
|
|
152
|
-
makeRuleSetSerializable(rule.scheme);
|
|
153
|
-
makeRuleSetSerializable(rule.issuer);
|
|
154
|
-
if ('issuerLayer' in rule) makeRuleSetSerializable(rule.issuerLayer);
|
|
155
|
-
makeRuleSetSerializable(rule.include);
|
|
156
|
-
makeRuleSetSerializable(rule.exclude);
|
|
157
|
-
if (rule.oneOf) makeRulesSerializable(rule.oneOf);
|
|
158
|
-
if ('rules' in rule && rule.rules) makeRulesSerializable(rule.rules);
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
101
|
const normalizeReportType = (reportCodeType, mode)=>{
|
|
162
|
-
|
|
163
|
-
if (
|
|
164
|
-
if (mode ===
|
|
165
|
-
if (
|
|
166
|
-
if (
|
|
167
|
-
return
|
|
102
|
+
const convertedReportCodeType = 'object' == typeof reportCodeType ? convertReportCodeTypeObject(reportCodeType) : reportCodeType;
|
|
103
|
+
if ('noCode' === convertedReportCodeType) return SDK.ToDataType.NoCode;
|
|
104
|
+
if (mode === SDK.IMode[SDK.IMode.brief]) return SDK.ToDataType.NoCode;
|
|
105
|
+
if (mode === SDK.IMode[SDK.IMode.lite]) return SDK.ToDataType.NoSourceAndAssets;
|
|
106
|
+
if ('noAssetsAndModuleSource' === convertedReportCodeType) return SDK.ToDataType.NoSourceAndAssets;
|
|
107
|
+
if ('noModuleSource' === convertedReportCodeType) return SDK.ToDataType.NoSource;
|
|
108
|
+
return SDK.ToDataType.Normal;
|
|
168
109
|
};
|
|
169
110
|
function normalizeRspackUserOptions(options) {
|
|
170
111
|
var _options_experiments, _options_experiments1;
|
|
@@ -185,18 +126,4 @@ function normalizeRspackUserOptions(options) {
|
|
|
185
126
|
};
|
|
186
127
|
return config;
|
|
187
128
|
}
|
|
188
|
-
|
|
189
|
-
exports.makeRulesSerializable = __webpack_exports__.makeRulesSerializable;
|
|
190
|
-
exports.normalizeReportType = __webpack_exports__.normalizeReportType;
|
|
191
|
-
exports.normalizeRspackUserOptions = __webpack_exports__.normalizeRspackUserOptions;
|
|
192
|
-
exports.normalizeUserConfig = __webpack_exports__.normalizeUserConfig;
|
|
193
|
-
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
194
|
-
"makeRuleSetSerializable",
|
|
195
|
-
"makeRulesSerializable",
|
|
196
|
-
"normalizeReportType",
|
|
197
|
-
"normalizeRspackUserOptions",
|
|
198
|
-
"normalizeUserConfig"
|
|
199
|
-
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
200
|
-
Object.defineProperty(exports, '__esModule', {
|
|
201
|
-
value: true
|
|
202
|
-
});
|
|
129
|
+
export { normalizeReportType, normalizeRspackUserOptions, normalizeUserConfig };
|