@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
|
@@ -0,0 +1,166 @@
|
|
|
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
|
+
calculateNamespaceAndRegex: ()=>calculateNamespaceAndRegex,
|
|
28
|
+
ensureDevtools: ()=>ensureDevtools,
|
|
29
|
+
ensureModulesChunksGraphFn: ()=>ensureModulesChunksGraphFn
|
|
30
|
+
});
|
|
31
|
+
const types_namespaceObject = require("@rsdoctor/types");
|
|
32
|
+
const build_namespaceObject = require("@rsdoctor/utils/build");
|
|
33
|
+
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
34
|
+
const index_cjs_namespaceObject = require("../../build-utils/build/index.cjs");
|
|
35
|
+
const external_constants_cjs_namespaceObject = require("../constants.cjs");
|
|
36
|
+
const external_rspack_cjs_namespaceObject = require("./rspack.cjs");
|
|
37
|
+
const external_sourcemapTool_cjs_namespaceObject = require("./sourcemapTool.cjs");
|
|
38
|
+
let hasConsole = false;
|
|
39
|
+
const ensureModulesChunksGraphFn = (compiler, _this)=>{
|
|
40
|
+
var _compiler_webpack_experiments;
|
|
41
|
+
if (_this._modulesGraphApplied) return;
|
|
42
|
+
_this._modulesGraphApplied = true;
|
|
43
|
+
const context = {
|
|
44
|
+
astCache: new Map(),
|
|
45
|
+
packagePathMap: new Map(),
|
|
46
|
+
getSourceMap: (file)=>_this.sdk.getSourceMap(file)
|
|
47
|
+
};
|
|
48
|
+
const RsdoctorRspackPlugin = null == (_compiler_webpack_experiments = compiler.webpack.experiments) ? void 0 : _compiler_webpack_experiments.RsdoctorPlugin;
|
|
49
|
+
if (RsdoctorRspackPlugin) (0, external_rspack_cjs_namespaceObject.applyRspackNativePlugin)(compiler, _this, RsdoctorRspackPlugin);
|
|
50
|
+
if (!_this._realSourcePathCache) _this._realSourcePathCache = new Map();
|
|
51
|
+
compiler.hooks.done.tapPromise((0, external_constants_cjs_namespaceObject.internalPluginTapPreOptions)('moduleGraph'), async (_stats)=>{
|
|
52
|
+
await doneHandler(_stats, _this, context, compiler);
|
|
53
|
+
});
|
|
54
|
+
compiler.hooks.afterEmit.tapPromise({
|
|
55
|
+
...external_constants_cjs_namespaceObject.pluginTapPostOptions,
|
|
56
|
+
stage: external_constants_cjs_namespaceObject.pluginTapPostOptions.stage + 100
|
|
57
|
+
}, async (compilation)=>{
|
|
58
|
+
if (!ensureDevtools(compiler)) return;
|
|
59
|
+
const { namespace, sourceMapFilenameRegex } = calculateNamespaceAndRegex(compiler);
|
|
60
|
+
await (0, external_sourcemapTool_cjs_namespaceObject.handleAfterEmitAssets)(compilation, _this, sourceMapFilenameRegex, namespace);
|
|
61
|
+
});
|
|
62
|
+
compiler.hooks.emit.tapAsync({
|
|
63
|
+
...external_constants_cjs_namespaceObject.pluginTapPostOptions,
|
|
64
|
+
stage: external_constants_cjs_namespaceObject.pluginTapPostOptions.stage + 100
|
|
65
|
+
}, emitHandler.bind(null, _this, compiler));
|
|
66
|
+
};
|
|
67
|
+
async function doneHandler(_stats, _this, context, compiler) {
|
|
68
|
+
var _this_chunkGraph;
|
|
69
|
+
const stats = _stats;
|
|
70
|
+
const getStatsJson = (()=>{
|
|
71
|
+
let cached = null;
|
|
72
|
+
return ()=>{
|
|
73
|
+
if (cached) return cached;
|
|
74
|
+
cached = stats.toJson({
|
|
75
|
+
all: false,
|
|
76
|
+
chunks: true,
|
|
77
|
+
modules: true,
|
|
78
|
+
chunkModules: true,
|
|
79
|
+
assets: true,
|
|
80
|
+
ids: true,
|
|
81
|
+
hash: true,
|
|
82
|
+
errors: true,
|
|
83
|
+
warnings: true
|
|
84
|
+
});
|
|
85
|
+
return cached;
|
|
86
|
+
};
|
|
87
|
+
})();
|
|
88
|
+
logger_namespaceObject.logger.debug(`${(build_namespaceObject.Process.getMemoryUsageMessage(), '[Before Generate ModuleGraph]')}`);
|
|
89
|
+
if (!(null == (_this_chunkGraph = _this.chunkGraph) ? void 0 : _this_chunkGraph.getChunks().length)) _this.chunkGraph = index_cjs_namespaceObject.Chunks.chunkTransform(new Map(), getStatsJson());
|
|
90
|
+
if (!_this.modulesGraph.getModules().length) _this.modulesGraph = await index_cjs_namespaceObject.ModuleGraph.getModuleGraphByStats(stats.compilation, getStatsJson(), process.cwd(), _this.chunkGraph, _this.options.features, context);
|
|
91
|
+
logger_namespaceObject.logger.debug(`${(build_namespaceObject.Process.getMemoryUsageMessage(), '[After Generate ModuleGraph]')}`);
|
|
92
|
+
if (_this.options.features.treeShaking) {
|
|
93
|
+
if ('rspackVersion' in compiler.webpack) logger_namespaceObject.logger.info(logger_namespaceObject.chalk.yellow('Rspack currently does not support treeShaking capabilities.'));
|
|
94
|
+
else {
|
|
95
|
+
_this.modulesGraph = index_cjs_namespaceObject.ModuleGraph.appendTreeShaking(_this.modulesGraph, stats.compilation) || _this.modulesGraph;
|
|
96
|
+
_this.sdk.addClientRoutes([
|
|
97
|
+
types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.TreeShaking
|
|
98
|
+
]);
|
|
99
|
+
}
|
|
100
|
+
logger_namespaceObject.logger.debug(`${(build_namespaceObject.Process.getMemoryUsageMessage(), '[After AppendTreeShaking to ModuleGraph]')}`);
|
|
101
|
+
}
|
|
102
|
+
const shouldParseBundle = false !== _this.options.supports.parseBundle;
|
|
103
|
+
await getModulesInfos(compiler, _this.modulesGraph, _this.chunkGraph, shouldParseBundle, _this.sourceMapSets);
|
|
104
|
+
logger_namespaceObject.logger.debug(`${build_namespaceObject.Process.getMemoryUsageMessage()}, '[After Transform ModuleGraph]'`);
|
|
105
|
+
_this.modulesGraph && await _this.sdk.reportModuleGraph(_this.modulesGraph);
|
|
106
|
+
await _this.sdk.reportChunkGraph(_this.chunkGraph);
|
|
107
|
+
if (_this.options.supports.generateTileGraph) logger_namespaceObject.logger.warn(logger_namespaceObject.chalk.yellow('The option generateTileGraph is deprecated. Treemap (i.e. Tile Graph) is now supported by default.'));
|
|
108
|
+
}
|
|
109
|
+
const ensureDevtools = (compiler)=>{
|
|
110
|
+
const devtool = compiler.options.devtool;
|
|
111
|
+
if ('string' == typeof devtool && /eval/i.test(devtool)) {
|
|
112
|
+
hasConsole || logger_namespaceObject.logger.warn('SourceMap with eval is not supported. Please use other sourcemap options.');
|
|
113
|
+
hasConsole = true;
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
if ('rspack' in compiler) return true;
|
|
117
|
+
const sourceMapEnabled = 'string' == typeof devtool && /source-?map/i.test(devtool);
|
|
118
|
+
if (!sourceMapEnabled) {
|
|
119
|
+
logger_namespaceObject.logger.debug('SourceMap is not enabled. Skipping sourcemap processing.');
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
return true;
|
|
123
|
+
};
|
|
124
|
+
async function getModulesInfos(compiler, moduleGraph, chunkGraph, parseBundle, sourceMapSets) {
|
|
125
|
+
if (!moduleGraph) return;
|
|
126
|
+
try {
|
|
127
|
+
await index_cjs_namespaceObject.Chunks.getAssetsModulesData(moduleGraph, chunkGraph, compiler.outputPath, sourceMapSets, parseBundle);
|
|
128
|
+
} catch (e) {}
|
|
129
|
+
}
|
|
130
|
+
function escapeRegExp(str) {
|
|
131
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
132
|
+
}
|
|
133
|
+
function calculateNamespaceAndRegex(compiler) {
|
|
134
|
+
var _compiler_options_output_library;
|
|
135
|
+
let namespace = compiler.options.output.devtoolNamespace || (null == (_compiler_options_output_library = compiler.options.output.library) ? void 0 : _compiler_options_output_library.name) || '[^/]+/';
|
|
136
|
+
if (Array.isArray(namespace)) namespace = namespace[0];
|
|
137
|
+
else if ('object' == typeof namespace && 'name' in namespace) namespace = namespace.name;
|
|
138
|
+
const safeNamespace = escapeRegExp(namespace);
|
|
139
|
+
const sourceMapFilenameRegex = new RegExp(`(?:webpack://)?(?:${safeNamespace})?([^?]*)`);
|
|
140
|
+
return {
|
|
141
|
+
namespace: namespace,
|
|
142
|
+
sourceMapFilenameRegex
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
async function emitHandler(_this, compiler, compilation, callback) {
|
|
146
|
+
if (!ensureDevtools(compiler)) return void callback();
|
|
147
|
+
const { namespace, sourceMapFilenameRegex } = calculateNamespaceAndRegex(compiler);
|
|
148
|
+
await (0, external_sourcemapTool_cjs_namespaceObject.handleEmitAssets)({
|
|
149
|
+
compilation,
|
|
150
|
+
pluginInstance: _this,
|
|
151
|
+
sourceMapFilenameRegex,
|
|
152
|
+
namespace
|
|
153
|
+
});
|
|
154
|
+
callback();
|
|
155
|
+
}
|
|
156
|
+
exports.calculateNamespaceAndRegex = __webpack_exports__.calculateNamespaceAndRegex;
|
|
157
|
+
exports.ensureDevtools = __webpack_exports__.ensureDevtools;
|
|
158
|
+
exports.ensureModulesChunksGraphFn = __webpack_exports__.ensureModulesChunksGraphFn;
|
|
159
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
160
|
+
"calculateNamespaceAndRegex",
|
|
161
|
+
"ensureDevtools",
|
|
162
|
+
"ensureModulesChunksGraphFn"
|
|
163
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
164
|
+
Object.defineProperty(exports, '__esModule', {
|
|
165
|
+
value: true
|
|
166
|
+
});
|
|
@@ -1,40 +1,12 @@
|
|
|
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
|
-
calculateNamespaceAndRegex: ()=>calculateNamespaceAndRegex,
|
|
28
|
-
ensureDevtools: ()=>ensureDevtools,
|
|
29
|
-
ensureModulesChunksGraphFn: ()=>ensureModulesChunksGraphFn
|
|
30
|
-
});
|
|
31
|
-
const types_namespaceObject = require("@rsdoctor/types");
|
|
32
|
-
const build_namespaceObject = require("@rsdoctor/utils/build");
|
|
33
|
-
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
34
|
-
const index_js_namespaceObject = require("../../build-utils/build/index.js");
|
|
35
|
-
const external_constants_js_namespaceObject = require("../constants.js");
|
|
36
|
-
const external_rspack_js_namespaceObject = require("./rspack.js");
|
|
37
|
-
const external_sourcemapTool_js_namespaceObject = require("./sourcemapTool.js");
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
import { Manifest } from "@rsdoctor/types";
|
|
4
|
+
import { Process } from "@rsdoctor/utils/build";
|
|
5
|
+
import { chalk, logger } from "@rsdoctor/utils/logger";
|
|
6
|
+
import { Chunks, ModuleGraph } from "../../build-utils/build/index.js";
|
|
7
|
+
import { internalPluginTapPreOptions, pluginTapPostOptions } from "../constants.js";
|
|
8
|
+
import { applyRspackNativePlugin } from "./rspack.js";
|
|
9
|
+
import { handleAfterEmitAssets, handleEmitAssets } from "./sourcemapTool.js";
|
|
38
10
|
let hasConsole = false;
|
|
39
11
|
const ensureModulesChunksGraphFn = (compiler, _this)=>{
|
|
40
12
|
var _compiler_webpack_experiments;
|
|
@@ -46,22 +18,22 @@ const ensureModulesChunksGraphFn = (compiler, _this)=>{
|
|
|
46
18
|
getSourceMap: (file)=>_this.sdk.getSourceMap(file)
|
|
47
19
|
};
|
|
48
20
|
const RsdoctorRspackPlugin = null == (_compiler_webpack_experiments = compiler.webpack.experiments) ? void 0 : _compiler_webpack_experiments.RsdoctorPlugin;
|
|
49
|
-
if (RsdoctorRspackPlugin)
|
|
21
|
+
if (RsdoctorRspackPlugin) applyRspackNativePlugin(compiler, _this, RsdoctorRspackPlugin);
|
|
50
22
|
if (!_this._realSourcePathCache) _this._realSourcePathCache = new Map();
|
|
51
|
-
compiler.hooks.done.tapPromise(
|
|
23
|
+
compiler.hooks.done.tapPromise(internalPluginTapPreOptions('moduleGraph'), async (_stats)=>{
|
|
52
24
|
await doneHandler(_stats, _this, context, compiler);
|
|
53
25
|
});
|
|
54
26
|
compiler.hooks.afterEmit.tapPromise({
|
|
55
|
-
...
|
|
56
|
-
stage:
|
|
27
|
+
...pluginTapPostOptions,
|
|
28
|
+
stage: pluginTapPostOptions.stage + 100
|
|
57
29
|
}, async (compilation)=>{
|
|
58
30
|
if (!ensureDevtools(compiler)) return;
|
|
59
31
|
const { namespace, sourceMapFilenameRegex } = calculateNamespaceAndRegex(compiler);
|
|
60
|
-
await
|
|
32
|
+
await handleAfterEmitAssets(compilation, _this, sourceMapFilenameRegex, namespace);
|
|
61
33
|
});
|
|
62
34
|
compiler.hooks.emit.tapAsync({
|
|
63
|
-
...
|
|
64
|
-
stage:
|
|
35
|
+
...pluginTapPostOptions,
|
|
36
|
+
stage: pluginTapPostOptions.stage + 100
|
|
65
37
|
}, emitHandler.bind(null, _this, compiler));
|
|
66
38
|
};
|
|
67
39
|
async function doneHandler(_stats, _this, context, compiler) {
|
|
@@ -71,42 +43,52 @@ async function doneHandler(_stats, _this, context, compiler) {
|
|
|
71
43
|
let cached = null;
|
|
72
44
|
return ()=>{
|
|
73
45
|
if (cached) return cached;
|
|
74
|
-
cached = stats.toJson(
|
|
46
|
+
cached = stats.toJson({
|
|
47
|
+
all: false,
|
|
48
|
+
chunks: true,
|
|
49
|
+
modules: true,
|
|
50
|
+
chunkModules: true,
|
|
51
|
+
assets: true,
|
|
52
|
+
ids: true,
|
|
53
|
+
hash: true,
|
|
54
|
+
errors: true,
|
|
55
|
+
warnings: true
|
|
56
|
+
});
|
|
75
57
|
return cached;
|
|
76
58
|
};
|
|
77
59
|
})();
|
|
78
|
-
|
|
79
|
-
if (!(null == (_this_chunkGraph = _this.chunkGraph) ? void 0 : _this_chunkGraph.getChunks().length)) _this.chunkGraph =
|
|
80
|
-
if (!_this.modulesGraph.getModules().length) _this.modulesGraph = await
|
|
81
|
-
|
|
60
|
+
logger.debug(`${(Process.getMemoryUsageMessage(), '[Before Generate ModuleGraph]')}`);
|
|
61
|
+
if (!(null == (_this_chunkGraph = _this.chunkGraph) ? void 0 : _this_chunkGraph.getChunks().length)) _this.chunkGraph = Chunks.chunkTransform(new Map(), getStatsJson());
|
|
62
|
+
if (!_this.modulesGraph.getModules().length) _this.modulesGraph = await ModuleGraph.getModuleGraphByStats(stats.compilation, getStatsJson(), process.cwd(), _this.chunkGraph, _this.options.features, context);
|
|
63
|
+
logger.debug(`${(Process.getMemoryUsageMessage(), '[After Generate ModuleGraph]')}`);
|
|
82
64
|
if (_this.options.features.treeShaking) {
|
|
83
|
-
if ('rspackVersion' in compiler.webpack)
|
|
65
|
+
if ('rspackVersion' in compiler.webpack) logger.info(chalk.yellow('Rspack currently does not support treeShaking capabilities.'));
|
|
84
66
|
else {
|
|
85
|
-
_this.modulesGraph =
|
|
67
|
+
_this.modulesGraph = ModuleGraph.appendTreeShaking(_this.modulesGraph, stats.compilation) || _this.modulesGraph;
|
|
86
68
|
_this.sdk.addClientRoutes([
|
|
87
|
-
|
|
69
|
+
Manifest.RsdoctorManifestClientRoutes.TreeShaking
|
|
88
70
|
]);
|
|
89
71
|
}
|
|
90
|
-
|
|
72
|
+
logger.debug(`${(Process.getMemoryUsageMessage(), '[After AppendTreeShaking to ModuleGraph]')}`);
|
|
91
73
|
}
|
|
92
74
|
const shouldParseBundle = false !== _this.options.supports.parseBundle;
|
|
93
75
|
await getModulesInfos(compiler, _this.modulesGraph, _this.chunkGraph, shouldParseBundle, _this.sourceMapSets);
|
|
94
|
-
|
|
76
|
+
logger.debug(`${Process.getMemoryUsageMessage()}, '[After Transform ModuleGraph]'`);
|
|
95
77
|
_this.modulesGraph && await _this.sdk.reportModuleGraph(_this.modulesGraph);
|
|
96
78
|
await _this.sdk.reportChunkGraph(_this.chunkGraph);
|
|
97
|
-
if (_this.options.supports.generateTileGraph)
|
|
79
|
+
if (_this.options.supports.generateTileGraph) logger.warn(chalk.yellow('The option generateTileGraph is deprecated. Treemap (i.e. Tile Graph) is now supported by default.'));
|
|
98
80
|
}
|
|
99
81
|
const ensureDevtools = (compiler)=>{
|
|
100
82
|
const devtool = compiler.options.devtool;
|
|
101
83
|
if ('string' == typeof devtool && /eval/i.test(devtool)) {
|
|
102
|
-
hasConsole ||
|
|
84
|
+
hasConsole || logger.warn('SourceMap with eval is not supported. Please use other sourcemap options.');
|
|
103
85
|
hasConsole = true;
|
|
104
86
|
return false;
|
|
105
87
|
}
|
|
106
88
|
if ('rspack' in compiler) return true;
|
|
107
89
|
const sourceMapEnabled = 'string' == typeof devtool && /source-?map/i.test(devtool);
|
|
108
90
|
if (!sourceMapEnabled) {
|
|
109
|
-
|
|
91
|
+
logger.debug('SourceMap is not enabled. Skipping sourcemap processing.');
|
|
110
92
|
return false;
|
|
111
93
|
}
|
|
112
94
|
return true;
|
|
@@ -114,7 +96,7 @@ const ensureDevtools = (compiler)=>{
|
|
|
114
96
|
async function getModulesInfos(compiler, moduleGraph, chunkGraph, parseBundle, sourceMapSets) {
|
|
115
97
|
if (!moduleGraph) return;
|
|
116
98
|
try {
|
|
117
|
-
await
|
|
99
|
+
await Chunks.getAssetsModulesData(moduleGraph, chunkGraph, compiler.outputPath, sourceMapSets, parseBundle);
|
|
118
100
|
} catch (e) {}
|
|
119
101
|
}
|
|
120
102
|
function escapeRegExp(str) {
|
|
@@ -135,7 +117,7 @@ function calculateNamespaceAndRegex(compiler) {
|
|
|
135
117
|
async function emitHandler(_this, compiler, compilation, callback) {
|
|
136
118
|
if (!ensureDevtools(compiler)) return void callback();
|
|
137
119
|
const { namespace, sourceMapFilenameRegex } = calculateNamespaceAndRegex(compiler);
|
|
138
|
-
await
|
|
120
|
+
await handleEmitAssets({
|
|
139
121
|
compilation,
|
|
140
122
|
pluginInstance: _this,
|
|
141
123
|
sourceMapFilenameRegex,
|
|
@@ -143,14 +125,4 @@ async function emitHandler(_this, compiler, compilation, callback) {
|
|
|
143
125
|
});
|
|
144
126
|
callback();
|
|
145
127
|
}
|
|
146
|
-
|
|
147
|
-
exports.ensureDevtools = __webpack_exports__.ensureDevtools;
|
|
148
|
-
exports.ensureModulesChunksGraphFn = __webpack_exports__.ensureModulesChunksGraphFn;
|
|
149
|
-
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
150
|
-
"calculateNamespaceAndRegex",
|
|
151
|
-
"ensureDevtools",
|
|
152
|
-
"ensureModulesChunksGraphFn"
|
|
153
|
-
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
154
|
-
Object.defineProperty(exports, '__esModule', {
|
|
155
|
-
value: true
|
|
156
|
-
});
|
|
128
|
+
export { calculateNamespaceAndRegex, ensureDevtools, ensureModulesChunksGraphFn };
|
|
@@ -0,0 +1,98 @@
|
|
|
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
|
+
InternalErrorReporterPlugin: ()=>InternalErrorReporterPlugin
|
|
28
|
+
});
|
|
29
|
+
const types_namespaceObject = require("@rsdoctor/types");
|
|
30
|
+
const external_base_cjs_namespaceObject = require("./base.cjs");
|
|
31
|
+
const error_namespaceObject = require("@rsdoctor/utils/error");
|
|
32
|
+
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
33
|
+
class InternalErrorReporterPlugin extends external_base_cjs_namespaceObject.InternalBasePlugin {
|
|
34
|
+
apply(compiler) {
|
|
35
|
+
(0, logger_namespaceObject.time)('InternalErrorReporterPlugin.apply');
|
|
36
|
+
try {
|
|
37
|
+
compiler.hooks.done.tapPromise(this.tapPreOptions, this.done);
|
|
38
|
+
} finally{
|
|
39
|
+
(0, logger_namespaceObject.timeEnd)('InternalErrorReporterPlugin.apply');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
handleWebpackError(err, category, level) {
|
|
43
|
+
return error_namespaceObject.DevToolError.from(err, {
|
|
44
|
+
category,
|
|
45
|
+
code: types_namespaceObject.Rule.RuleMessageCodeEnumerated.Overlay,
|
|
46
|
+
controller: {
|
|
47
|
+
noStack: false
|
|
48
|
+
},
|
|
49
|
+
detail: {
|
|
50
|
+
stack: 'stack' in err ? err.stack : err.message
|
|
51
|
+
},
|
|
52
|
+
level
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
async reportWarnings(warnings) {
|
|
56
|
+
(0, logger_namespaceObject.time)('InternalErrorReporterPlugin.reportWarnings');
|
|
57
|
+
try {
|
|
58
|
+
const arr = warnings.map((warning)=>this.handleWebpackError(warning, types_namespaceObject.Rule.RuleMessageCategory.Compile, 'Warn'));
|
|
59
|
+
this.sdk.reportError(arr);
|
|
60
|
+
} finally{
|
|
61
|
+
(0, logger_namespaceObject.timeEnd)('InternalErrorReporterPlugin.reportWarnings');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async reportErrors(errors) {
|
|
65
|
+
(0, logger_namespaceObject.time)('InternalErrorReporterPlugin.reportErrors');
|
|
66
|
+
try {
|
|
67
|
+
const arr = errors.map((err)=>this.handleWebpackError(err, types_namespaceObject.Rule.RuleMessageCategory.Bundle, 'Error'));
|
|
68
|
+
this.sdk.reportError(arr);
|
|
69
|
+
} finally{
|
|
70
|
+
(0, logger_namespaceObject.timeEnd)('InternalErrorReporterPlugin.reportErrors');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
constructor(...args){
|
|
74
|
+
super(...args), this.name = 'error-reporter', this.done = async (stats)=>{
|
|
75
|
+
(0, logger_namespaceObject.time)('InternalErrorReporterPlugin.done');
|
|
76
|
+
try {
|
|
77
|
+
const tasks = [];
|
|
78
|
+
const statsData = stats.toJson({
|
|
79
|
+
all: false,
|
|
80
|
+
errors: true,
|
|
81
|
+
warnings: true
|
|
82
|
+
});
|
|
83
|
+
if (stats.hasErrors()) tasks.push(this.reportErrors(statsData.errors || []));
|
|
84
|
+
if (stats.hasWarnings()) tasks.push(this.reportWarnings(statsData.warnings || []));
|
|
85
|
+
await Promise.all(tasks);
|
|
86
|
+
} finally{
|
|
87
|
+
(0, logger_namespaceObject.timeEnd)('InternalErrorReporterPlugin.done');
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.InternalErrorReporterPlugin = __webpack_exports__.InternalErrorReporterPlugin;
|
|
93
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
94
|
+
"InternalErrorReporterPlugin"
|
|
95
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
96
|
+
Object.defineProperty(exports, '__esModule', {
|
|
97
|
+
value: true
|
|
98
|
+
});
|
|
@@ -1,48 +1,22 @@
|
|
|
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
|
-
InternalErrorReporterPlugin: ()=>InternalErrorReporterPlugin
|
|
28
|
-
});
|
|
29
|
-
const types_namespaceObject = require("@rsdoctor/types");
|
|
30
|
-
const external_base_js_namespaceObject = require("./base.js");
|
|
31
|
-
const error_namespaceObject = require("@rsdoctor/utils/error");
|
|
32
|
-
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
33
|
-
class InternalErrorReporterPlugin extends external_base_js_namespaceObject.InternalBasePlugin {
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
import { Rule } from "@rsdoctor/types";
|
|
4
|
+
import { InternalBasePlugin } from "./base.js";
|
|
5
|
+
import { DevToolError } from "@rsdoctor/utils/error";
|
|
6
|
+
import { time, timeEnd } from "@rsdoctor/utils/logger";
|
|
7
|
+
class InternalErrorReporterPlugin extends InternalBasePlugin {
|
|
34
8
|
apply(compiler) {
|
|
35
|
-
|
|
9
|
+
time('InternalErrorReporterPlugin.apply');
|
|
36
10
|
try {
|
|
37
11
|
compiler.hooks.done.tapPromise(this.tapPreOptions, this.done);
|
|
38
12
|
} finally{
|
|
39
|
-
|
|
13
|
+
timeEnd('InternalErrorReporterPlugin.apply');
|
|
40
14
|
}
|
|
41
15
|
}
|
|
42
16
|
handleWebpackError(err, category, level) {
|
|
43
|
-
return
|
|
17
|
+
return DevToolError.from(err, {
|
|
44
18
|
category,
|
|
45
|
-
code:
|
|
19
|
+
code: Rule.RuleMessageCodeEnumerated.Overlay,
|
|
46
20
|
controller: {
|
|
47
21
|
noStack: false
|
|
48
22
|
},
|
|
@@ -53,26 +27,26 @@ class InternalErrorReporterPlugin extends external_base_js_namespaceObject.Inter
|
|
|
53
27
|
});
|
|
54
28
|
}
|
|
55
29
|
async reportWarnings(warnings) {
|
|
56
|
-
|
|
30
|
+
time('InternalErrorReporterPlugin.reportWarnings');
|
|
57
31
|
try {
|
|
58
|
-
const arr = warnings.map((warning)=>this.handleWebpackError(warning,
|
|
32
|
+
const arr = warnings.map((warning)=>this.handleWebpackError(warning, Rule.RuleMessageCategory.Compile, 'Warn'));
|
|
59
33
|
this.sdk.reportError(arr);
|
|
60
34
|
} finally{
|
|
61
|
-
|
|
35
|
+
timeEnd('InternalErrorReporterPlugin.reportWarnings');
|
|
62
36
|
}
|
|
63
37
|
}
|
|
64
38
|
async reportErrors(errors) {
|
|
65
|
-
|
|
39
|
+
time('InternalErrorReporterPlugin.reportErrors');
|
|
66
40
|
try {
|
|
67
|
-
const arr = errors.map((err)=>this.handleWebpackError(err,
|
|
41
|
+
const arr = errors.map((err)=>this.handleWebpackError(err, Rule.RuleMessageCategory.Bundle, 'Error'));
|
|
68
42
|
this.sdk.reportError(arr);
|
|
69
43
|
} finally{
|
|
70
|
-
|
|
44
|
+
timeEnd('InternalErrorReporterPlugin.reportErrors');
|
|
71
45
|
}
|
|
72
46
|
}
|
|
73
47
|
constructor(...args){
|
|
74
48
|
super(...args), this.name = 'error-reporter', this.done = async (stats)=>{
|
|
75
|
-
|
|
49
|
+
time('InternalErrorReporterPlugin.done');
|
|
76
50
|
try {
|
|
77
51
|
const tasks = [];
|
|
78
52
|
const statsData = stats.toJson({
|
|
@@ -84,15 +58,9 @@ class InternalErrorReporterPlugin extends external_base_js_namespaceObject.Inter
|
|
|
84
58
|
if (stats.hasWarnings()) tasks.push(this.reportWarnings(statsData.warnings || []));
|
|
85
59
|
await Promise.all(tasks);
|
|
86
60
|
} finally{
|
|
87
|
-
|
|
61
|
+
timeEnd('InternalErrorReporterPlugin.done');
|
|
88
62
|
}
|
|
89
63
|
};
|
|
90
64
|
}
|
|
91
65
|
}
|
|
92
|
-
|
|
93
|
-
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
94
|
-
"InternalErrorReporterPlugin"
|
|
95
|
-
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
96
|
-
Object.defineProperty(exports, '__esModule', {
|
|
97
|
-
value: true
|
|
98
|
-
});
|
|
66
|
+
export { InternalErrorReporterPlugin };
|