@rsdoctor/core 0.0.0-next-20240620044732
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/LICENSE +21 -0
- package/README.md +22 -0
- package/dist/build-utils/build/chunks/assetsModules.d.ts +4 -0
- package/dist/build-utils/build/chunks/assetsModules.d.ts.map +1 -0
- package/dist/build-utils/build/chunks/assetsModules.js +36 -0
- package/dist/build-utils/build/chunks/chunkTransform.d.ts +5 -0
- package/dist/build-utils/build/chunks/chunkTransform.d.ts.map +1 -0
- package/dist/build-utils/build/chunks/chunkTransform.js +31 -0
- package/dist/build-utils/build/chunks/generateTileGraph.d.ts +11 -0
- package/dist/build-utils/build/chunks/generateTileGraph.d.ts.map +1 -0
- package/dist/build-utils/build/chunks/generateTileGraph.js +71 -0
- package/dist/build-utils/build/chunks/index.d.ts +4 -0
- package/dist/build-utils/build/chunks/index.d.ts.map +1 -0
- package/dist/build-utils/build/chunks/index.js +26 -0
- package/dist/build-utils/build/index.d.ts +5 -0
- package/dist/build-utils/build/index.d.ts.map +1 -0
- package/dist/build-utils/build/index.js +47 -0
- package/dist/build-utils/build/module-graph/index.d.ts +4 -0
- package/dist/build-utils/build/module-graph/index.d.ts.map +1 -0
- package/dist/build-utils/build/module-graph/index.js +26 -0
- package/dist/build-utils/build/module-graph/parser.d.ts +3 -0
- package/dist/build-utils/build/module-graph/parser.d.ts.map +1 -0
- package/dist/build-utils/build/module-graph/parser.js +44 -0
- package/dist/build-utils/build/module-graph/transform.d.ts +5 -0
- package/dist/build-utils/build/module-graph/transform.d.ts.map +1 -0
- package/dist/build-utils/build/module-graph/transform.js +37 -0
- package/dist/build-utils/build/module-graph/treeShaking.d.ts +4 -0
- package/dist/build-utils/build/module-graph/treeShaking.d.ts.map +1 -0
- package/dist/build-utils/build/module-graph/treeShaking.js +132 -0
- package/dist/build-utils/build/module-graph/utils.d.ts +4 -0
- package/dist/build-utils/build/module-graph/utils.d.ts.map +1 -0
- package/dist/build-utils/build/module-graph/utils.js +113 -0
- package/dist/build-utils/build/module-graph/webpack/transform.d.ts +12 -0
- package/dist/build-utils/build/module-graph/webpack/transform.d.ts.map +1 -0
- package/dist/build-utils/build/module-graph/webpack/transform.js +195 -0
- package/dist/build-utils/build/utils/index.d.ts +4 -0
- package/dist/build-utils/build/utils/index.d.ts.map +1 -0
- package/dist/build-utils/build/utils/index.js +26 -0
- package/dist/build-utils/build/utils/loader.d.ts +19 -0
- package/dist/build-utils/build/utils/loader.d.ts.map +1 -0
- package/dist/build-utils/build/utils/loader.js +299 -0
- package/dist/build-utils/build/utils/parseBundle.d.ts +13 -0
- package/dist/build-utils/build/utils/parseBundle.d.ts.map +1 -0
- package/dist/build-utils/build/utils/parseBundle.js +367 -0
- package/dist/build-utils/build/utils/plugin.d.ts +6 -0
- package/dist/build-utils/build/utils/plugin.d.ts.map +1 -0
- package/dist/build-utils/build/utils/plugin.js +63 -0
- package/dist/build-utils/common/chunks/assetsContent.d.ts +5 -0
- package/dist/build-utils/common/chunks/assetsContent.d.ts.map +1 -0
- package/dist/build-utils/common/chunks/assetsContent.js +34 -0
- package/dist/build-utils/common/chunks/assetsModules.d.ts +24 -0
- package/dist/build-utils/common/chunks/assetsModules.d.ts.map +1 -0
- package/dist/build-utils/common/chunks/assetsModules.js +107 -0
- package/dist/build-utils/common/chunks/chunkTransform.d.ts +6 -0
- package/dist/build-utils/common/chunks/chunkTransform.d.ts.map +1 -0
- package/dist/build-utils/common/chunks/chunkTransform.js +73 -0
- package/dist/build-utils/common/chunks/index.d.ts +4 -0
- package/dist/build-utils/common/chunks/index.d.ts.map +1 -0
- package/dist/build-utils/common/chunks/index.js +26 -0
- package/dist/build-utils/common/index.d.ts +6 -0
- package/dist/build-utils/common/index.d.ts.map +1 -0
- package/dist/build-utils/common/index.js +50 -0
- package/dist/build-utils/common/module-graph/compatible.d.ts +10 -0
- package/dist/build-utils/common/module-graph/compatible.d.ts.map +1 -0
- package/dist/build-utils/common/module-graph/compatible.js +63 -0
- package/dist/build-utils/common/module-graph/index.d.ts +4 -0
- package/dist/build-utils/common/module-graph/index.d.ts.map +1 -0
- package/dist/build-utils/common/module-graph/index.js +26 -0
- package/dist/build-utils/common/module-graph/transform.d.ts +8 -0
- package/dist/build-utils/common/module-graph/transform.d.ts.map +1 -0
- package/dist/build-utils/common/module-graph/transform.js +200 -0
- package/dist/build-utils/common/module-graph/utils.d.ts +16 -0
- package/dist/build-utils/common/module-graph/utils.d.ts.map +1 -0
- package/dist/build-utils/common/module-graph/utils.js +62 -0
- package/dist/build-utils/common/trans-utils/index.d.ts +2 -0
- package/dist/build-utils/common/trans-utils/index.d.ts.map +1 -0
- package/dist/build-utils/common/trans-utils/index.js +22 -0
- package/dist/build-utils/common/trans-utils/transStats.d.ts +7 -0
- package/dist/build-utils/common/trans-utils/transStats.d.ts.map +1 -0
- package/dist/build-utils/common/trans-utils/transStats.js +35 -0
- package/dist/build-utils/common/webpack/compatible.d.ts +27 -0
- package/dist/build-utils/common/webpack/compatible.d.ts.map +1 -0
- package/dist/build-utils/common/webpack/compatible.js +181 -0
- package/dist/build-utils/index.d.ts +3 -0
- package/dist/build-utils/index.d.ts.map +1 -0
- package/dist/build-utils/index.js +41 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/inner-plugins/constants.d.ts +7 -0
- package/dist/inner-plugins/constants.d.ts.map +1 -0
- package/dist/inner-plugins/constants.js +52 -0
- package/dist/inner-plugins/index.d.ts +3 -0
- package/dist/inner-plugins/index.d.ts.map +1 -0
- package/dist/inner-plugins/index.js +24 -0
- package/dist/inner-plugins/loaders/proxy.d.ts +5 -0
- package/dist/inner-plugins/loaders/proxy.d.ts.map +1 -0
- package/dist/inner-plugins/loaders/proxy.js +115 -0
- package/dist/inner-plugins/plugins/base.d.ts +14 -0
- package/dist/inner-plugins/plugins/base.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/base.js +45 -0
- package/dist/inner-plugins/plugins/bundle.d.ts +15 -0
- package/dist/inner-plugins/plugins/bundle.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/bundle.js +92 -0
- package/dist/inner-plugins/plugins/bundleTagPlugin.d.ts +7 -0
- package/dist/inner-plugins/plugins/bundleTagPlugin.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/bundleTagPlugin.js +81 -0
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts +10 -0
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +126 -0
- package/dist/inner-plugins/plugins/errors.d.ts +12 -0
- package/dist/inner-plugins/plugins/errors.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/errors.js +85 -0
- package/dist/inner-plugins/plugins/index.d.ts +11 -0
- package/dist/inner-plugins/plugins/index.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/index.js +40 -0
- package/dist/inner-plugins/plugins/loader.d.ts +12 -0
- package/dist/inner-plugins/plugins/loader.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/loader.js +161 -0
- package/dist/inner-plugins/plugins/plugins.d.ts +9 -0
- package/dist/inner-plugins/plugins/plugins.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/plugins.js +60 -0
- package/dist/inner-plugins/plugins/progress.d.ts +9 -0
- package/dist/inner-plugins/plugins/progress.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/progress.js +59 -0
- package/dist/inner-plugins/plugins/rules.d.ts +9 -0
- package/dist/inner-plugins/plugins/rules.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/rules.js +85 -0
- package/dist/inner-plugins/plugins/summary.d.ts +15 -0
- package/dist/inner-plugins/plugins/summary.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/summary.js +115 -0
- package/dist/inner-plugins/utils/circleDetect.d.ts +5 -0
- package/dist/inner-plugins/utils/circleDetect.d.ts.map +1 -0
- package/dist/inner-plugins/utils/circleDetect.js +42 -0
- package/dist/inner-plugins/utils/config.d.ts +8 -0
- package/dist/inner-plugins/utils/config.d.ts.map +1 -0
- package/dist/inner-plugins/utils/config.js +151 -0
- package/dist/inner-plugins/utils/index.d.ts +6 -0
- package/dist/inner-plugins/utils/index.d.ts.map +1 -0
- package/dist/inner-plugins/utils/index.js +30 -0
- package/dist/inner-plugins/utils/loader.d.ts +12 -0
- package/dist/inner-plugins/utils/loader.d.ts.map +1 -0
- package/dist/inner-plugins/utils/loader.js +201 -0
- package/dist/inner-plugins/utils/plugin.d.ts +6 -0
- package/dist/inner-plugins/utils/plugin.d.ts.map +1 -0
- package/dist/inner-plugins/utils/plugin.js +126 -0
- package/dist/inner-plugins/utils/sdk.d.ts +4 -0
- package/dist/inner-plugins/utils/sdk.d.ts.map +1 -0
- package/dist/inner-plugins/utils/sdk.js +43 -0
- package/dist/rules/index.d.ts +4 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +33 -0
- package/dist/rules/linter.d.ts +10 -0
- package/dist/rules/linter.d.ts.map +1 -0
- package/dist/rules/linter.js +74 -0
- package/dist/rules/rule.d.ts +28 -0
- package/dist/rules/rule.d.ts.map +1 -0
- package/dist/rules/rule.js +143 -0
- package/dist/rules/rules/default-import-check/index.d.ts +5 -0
- package/dist/rules/rules/default-import-check/index.d.ts.map +1 -0
- package/dist/rules/rules/default-import-check/index.js +124 -0
- package/dist/rules/rules/default-import-check/types.d.ts +5 -0
- package/dist/rules/rules/default-import-check/types.d.ts.map +1 -0
- package/dist/rules/rules/default-import-check/types.js +16 -0
- package/dist/rules/rules/default-import-check/utils.d.ts +11 -0
- package/dist/rules/rules/default-import-check/utils.d.ts.map +1 -0
- package/dist/rules/rules/default-import-check/utils.js +93 -0
- package/dist/rules/rules/duplicate-package/index.d.ts +5 -0
- package/dist/rules/rules/duplicate-package/index.d.ts.map +1 -0
- package/dist/rules/rules/duplicate-package/index.js +71 -0
- package/dist/rules/rules/duplicate-package/types.d.ts +25 -0
- package/dist/rules/rules/duplicate-package/types.d.ts.map +1 -0
- package/dist/rules/rules/duplicate-package/types.js +51 -0
- package/dist/rules/rules/duplicate-package/utils.d.ts +4 -0
- package/dist/rules/rules/duplicate-package/utils.d.ts.map +1 -0
- package/dist/rules/rules/duplicate-package/utils.js +89 -0
- package/dist/rules/rules/ecma-version-check/index.d.ts +5 -0
- package/dist/rules/rules/ecma-version-check/index.d.ts.map +1 -0
- package/dist/rules/rules/ecma-version-check/index.js +82 -0
- package/dist/rules/rules/ecma-version-check/types.d.ts +8 -0
- package/dist/rules/rules/ecma-version-check/types.d.ts.map +1 -0
- package/dist/rules/rules/ecma-version-check/types.js +16 -0
- package/dist/rules/rules/ecma-version-check/utils.d.ts +3 -0
- package/dist/rules/rules/ecma-version-check/utils.d.ts.map +1 -0
- package/dist/rules/rules/ecma-version-check/utils.js +31 -0
- package/dist/rules/rules/index.d.ts +2 -0
- package/dist/rules/rules/index.d.ts.map +1 -0
- package/dist/rules/rules/index.js +37 -0
- package/dist/rules/rules/loader-performance-optimization/index.d.ts +5 -0
- package/dist/rules/rules/loader-performance-optimization/index.d.ts.map +1 -0
- package/dist/rules/rules/loader-performance-optimization/index.js +124 -0
- package/dist/rules/rules/loader-performance-optimization/types.d.ts +23 -0
- package/dist/rules/rules/loader-performance-optimization/types.d.ts.map +1 -0
- package/dist/rules/rules/loader-performance-optimization/types.js +16 -0
- package/dist/rules/rules/loader-performance-optimization/utils.d.ts +2 -0
- package/dist/rules/rules/loader-performance-optimization/utils.d.ts.map +1 -0
- package/dist/rules/rules/loader-performance-optimization/utils.js +38 -0
- package/dist/rules/utils.d.ts +4 -0
- package/dist/rules/utils.d.ts.map +1 -0
- package/dist/rules/utils.js +44 -0
- package/dist/types/chunks.d.ts +12 -0
- package/dist/types/chunks.d.ts.map +1 -0
- package/dist/types/chunks.js +16 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +30 -0
- package/dist/types/loader.d.ts +20 -0
- package/dist/types/loader.d.ts.map +1 -0
- package/dist/types/loader.js +16 -0
- package/dist/types/plugin.d.ts +96 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/plugin.js +16 -0
- package/dist/types/rules.d.ts +8 -0
- package/dist/types/rules.d.ts.map +1 -0
- package/dist/types/rules.js +16 -0
- package/dist/types/webpack.d.ts +15 -0
- package/dist/types/webpack.d.ts.map +1 -0
- package/dist/types/webpack.js +16 -0
- package/package.json +112 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-present Bytedance, Inc. and its affiliates.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Rsdoctor Core
|
|
2
|
+
|
|
3
|
+
This is the core package of Rsdoctor, providing core tools and analysis capabilities for Rsdoctor plugins.
|
|
4
|
+
|
|
5
|
+
## features
|
|
6
|
+
|
|
7
|
+
- Rsdoctor is a one-stop tool for diagnosing and analyzing the build process and build artifacts.
|
|
8
|
+
- Rsdoctor is a tool that supports Webpack and Rspack build analysis.
|
|
9
|
+
- Rsdoctor is an analysis tool that can display the time-consuming and behavioral details of the compilation.
|
|
10
|
+
- Rsdoctor is a tool that provides bundle Diff and other anti-degradation capabilities simultaneously.
|
|
11
|
+
|
|
12
|
+
## Documentation
|
|
13
|
+
|
|
14
|
+
https://rsdoctor.dev/
|
|
15
|
+
|
|
16
|
+
## Contributing
|
|
17
|
+
|
|
18
|
+
Please read the [Contributing Guide](https://github.com/web-infra-dev/rsdoctor/blob/main/CONTRIBUTING.md).
|
|
19
|
+
|
|
20
|
+
## License
|
|
21
|
+
|
|
22
|
+
Rsdoctor is [MIT licensed](https://github.com/web-infra-dev/rsdoctor/blob/main/LICENSE).
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Plugin } from '@rsdoctor/types';
|
|
2
|
+
import { ParsedModuleSizeData } from '../../common/chunks';
|
|
3
|
+
export declare function getAssetsModulesData(bundleStats: Plugin.StatsCompilation, bundleDir: string, hasParseBundle?: boolean): Promise<ParsedModuleSizeData | null>;
|
|
4
|
+
//# sourceMappingURL=assetsModules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assetsModules.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/chunks/assetsModules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAEL,oBAAoB,EACrB,MAAM,6BAA6B,CAAC;AAGrC,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,CAAC,gBAAgB,EACpC,SAAS,EAAE,MAAM,EACjB,cAAc,UAAO,GACpB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAMtC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var assetsModules_exports = {};
|
|
20
|
+
__export(assetsModules_exports, {
|
|
21
|
+
getAssetsModulesData: () => getAssetsModulesData
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(assetsModules_exports);
|
|
24
|
+
var import_chunks = require("../../common/chunks");
|
|
25
|
+
var import_utils = require("../utils");
|
|
26
|
+
async function getAssetsModulesData(bundleStats, bundleDir, hasParseBundle = true) {
|
|
27
|
+
return (0, import_chunks.getAssetsModulesData)(
|
|
28
|
+
bundleStats,
|
|
29
|
+
bundleDir,
|
|
30
|
+
hasParseBundle ? { parseBundle: import_utils.parseBundle } : {}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
getAssetsModulesData
|
|
36
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunkTransform.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/chunks/chunkTransform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,EAC1C,WAAW,EAAE,MAAM,CAAC,gBAAgB,wCAGrC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var chunkTransform_exports = {};
|
|
20
|
+
__export(chunkTransform_exports, {
|
|
21
|
+
chunkTransform: () => chunkTransform
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(chunkTransform_exports);
|
|
24
|
+
var import_chunks = require("../../common/chunks");
|
|
25
|
+
function chunkTransform(assetMap, bundleStats) {
|
|
26
|
+
return (0, import_chunks.chunkTransform)(assetMap, bundleStats);
|
|
27
|
+
}
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
chunkTransform
|
|
31
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Plugin } from '@rsdoctor/types';
|
|
2
|
+
export declare const TileGraphReportName = "rsdoctor-tile-graph.html";
|
|
3
|
+
type IGenerateReportOpts = {
|
|
4
|
+
reportFilename: string;
|
|
5
|
+
reportTitle?: string;
|
|
6
|
+
bundleDir?: string;
|
|
7
|
+
openBrowser?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function generateTileGraph(bundleStats: Plugin.BaseStats, opts: IGenerateReportOpts, buildOutputPath: string): Promise<string | null>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=generateTileGraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateTileGraph.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/chunks/generateTileGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAKzC,eAAO,MAAM,mBAAmB,6BAA6B,CAAC;AAE9D,KAAK,mBAAmB,GAAG;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAiBF,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,MAAM,CAAC,SAAS,EAC7B,IAAI,EAAE,mBAAmB,EACzB,eAAe,EAAE,MAAM,0BAexB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var generateTileGraph_exports = {};
|
|
30
|
+
__export(generateTileGraph_exports, {
|
|
31
|
+
TileGraphReportName: () => TileGraphReportName,
|
|
32
|
+
generateTileGraph: () => generateTileGraph
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(generateTileGraph_exports);
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
36
|
+
var import_logger = require("@rsdoctor/utils/logger");
|
|
37
|
+
var import_viewer = require("webpack-bundle-analyzer/lib/viewer");
|
|
38
|
+
const TileGraphReportName = "rsdoctor-tile-graph.html";
|
|
39
|
+
async function generateJSONReportUtil(bundleStats, opts) {
|
|
40
|
+
await (0, import_viewer.generateReport)(bundleStats, {
|
|
41
|
+
...opts,
|
|
42
|
+
logger: {
|
|
43
|
+
warn: () => {
|
|
44
|
+
},
|
|
45
|
+
info: () => {
|
|
46
|
+
},
|
|
47
|
+
error: (e) => {
|
|
48
|
+
import_logger.logger.info(`webpack-bundle-analyzer generateReport has error ${e}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
async function generateTileGraph(bundleStats, opts, buildOutputPath) {
|
|
54
|
+
try {
|
|
55
|
+
const { reportFilename } = opts;
|
|
56
|
+
await generateJSONReportUtil(bundleStats, {
|
|
57
|
+
...opts,
|
|
58
|
+
openBrowser: false,
|
|
59
|
+
bundleDir: buildOutputPath
|
|
60
|
+
});
|
|
61
|
+
return import_path.default.join(buildOutputPath, `${reportFilename}`);
|
|
62
|
+
} catch (e) {
|
|
63
|
+
(0, import_logger.debug)(() => `Generate webpack-bundle-analyzer tile graph has error:${e}`);
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
+
0 && (module.exports = {
|
|
69
|
+
TileGraphReportName,
|
|
70
|
+
generateTileGraph
|
|
71
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/chunks/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var chunks_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(chunks_exports);
|
|
18
|
+
__reExport(chunks_exports, require("./assetsModules"), module.exports);
|
|
19
|
+
__reExport(chunks_exports, require("./chunkTransform"), module.exports);
|
|
20
|
+
__reExport(chunks_exports, require("./generateTileGraph"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("./assetsModules"),
|
|
24
|
+
...require("./chunkTransform"),
|
|
25
|
+
...require("./generateTileGraph")
|
|
26
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/build-utils/build/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var build_exports = {};
|
|
30
|
+
__export(build_exports, {
|
|
31
|
+
Chunks: () => Chunks,
|
|
32
|
+
ModuleGraph: () => ModuleGraph,
|
|
33
|
+
Types: () => Types,
|
|
34
|
+
Utils: () => Utils
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(build_exports);
|
|
37
|
+
var Chunks = __toESM(require("./chunks"));
|
|
38
|
+
var Utils = __toESM(require("./utils"));
|
|
39
|
+
var Types = __toESM(require("../../types"));
|
|
40
|
+
var ModuleGraph = __toESM(require("./module-graph"));
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
Chunks,
|
|
44
|
+
ModuleGraph,
|
|
45
|
+
Types,
|
|
46
|
+
Utils
|
|
47
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/module-graph/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var module_graph_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(module_graph_exports);
|
|
18
|
+
__reExport(module_graph_exports, require("./webpack/transform"), module.exports);
|
|
19
|
+
__reExport(module_graph_exports, require("./transform"), module.exports);
|
|
20
|
+
__reExport(module_graph_exports, require("./treeShaking"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("./webpack/transform"),
|
|
24
|
+
...require("./transform"),
|
|
25
|
+
...require("./treeShaking")
|
|
26
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/module-graph/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAazD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,WAS5D"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var parser_exports = {};
|
|
20
|
+
__export(parser_exports, {
|
|
21
|
+
hasSetEsModuleStatement: () => hasSetEsModuleStatement
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(parser_exports);
|
|
24
|
+
var import_ruleUtils = require("@rsdoctor/utils/ruleUtils");
|
|
25
|
+
const esmLabelStatement = import_ruleUtils.parser.internal.parseExpressionAt(
|
|
26
|
+
'Object.defineProperty(exports, "__esModule", { value: true })',
|
|
27
|
+
0,
|
|
28
|
+
{
|
|
29
|
+
ecmaVersion: 6,
|
|
30
|
+
ranges: false,
|
|
31
|
+
locations: false,
|
|
32
|
+
sourceType: "script"
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
function hasSetEsModuleStatement(program) {
|
|
36
|
+
const expressions = program.body.filter(import_ruleUtils.parser.asserts.isExpressionStatement).map((item) => item.expression).filter(import_ruleUtils.parser.asserts.isSimpleCallExpression);
|
|
37
|
+
return expressions.some(
|
|
38
|
+
(exp) => import_ruleUtils.parser.utils.isSameSemantics(exp, esmLabelStatement)
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
hasSetEsModuleStatement
|
|
44
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Plugin } from '@rsdoctor/types';
|
|
2
|
+
import { TransformContext } from '.';
|
|
3
|
+
import { ChunkGraph } from '@rsdoctor/graph';
|
|
4
|
+
export declare function getModuleGraphByStats(compilation: Plugin.BaseCompilation, stats: Plugin.StatsCompilation, root: string, chunkGraph: ChunkGraph, features?: Plugin.RsdoctorWebpackPluginFeatures, context?: TransformContext): Promise<import("@rsdoctor/graph").ModuleGraph>;
|
|
5
|
+
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/module-graph/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAkC,MAAM,GAAG,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,MAAM,CAAC,eAAe,EACnC,KAAK,EAAE,MAAM,CAAC,gBAAgB,EAC9B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,UAAU,EACtB,QAAQ,CAAC,EAAE,MAAM,CAAC,6BAA6B,EAC/C,OAAO,CAAC,EAAE,gBAAgB,kDAQ3B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var transform_exports = {};
|
|
20
|
+
__export(transform_exports, {
|
|
21
|
+
getModuleGraphByStats: () => getModuleGraphByStats
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(transform_exports);
|
|
24
|
+
var import_module_graph = require("../../common/module-graph");
|
|
25
|
+
var import__ = require(".");
|
|
26
|
+
function getModuleGraphByStats(compilation, stats, root, chunkGraph, features, context) {
|
|
27
|
+
return (0, import__.appendModuleGraphByCompilation)(
|
|
28
|
+
compilation,
|
|
29
|
+
(0, import_module_graph.getModuleGraphByStats)(stats, root, chunkGraph),
|
|
30
|
+
features,
|
|
31
|
+
context
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
getModuleGraphByStats
|
|
37
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"treeShaking.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/module-graph/treeShaking.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAMZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAsJnD,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,MAAM,CAAC,eAAe,2BAsBpC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var treeShaking_exports = {};
|
|
20
|
+
__export(treeShaking_exports, {
|
|
21
|
+
appendTreeShaking: () => appendTreeShaking
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(treeShaking_exports);
|
|
24
|
+
var import_graph = require("@rsdoctor/graph");
|
|
25
|
+
var import_compatible = require("../../common/webpack/compatible");
|
|
26
|
+
var import_utils = require("./utils");
|
|
27
|
+
var import_module_graph = require("../../common/module-graph");
|
|
28
|
+
function transformMgm(origin, webpackGraph, graph, cache) {
|
|
29
|
+
const module2 = graph.getModuleByWebpackId(origin.identifier());
|
|
30
|
+
if (!module2) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const mgm = new import_graph.ModuleGraphModule(module2, graph);
|
|
34
|
+
const originalMgm = webpackGraph.getExportsInfo(origin);
|
|
35
|
+
graph.addModuleGraphModule(mgm);
|
|
36
|
+
for (const info of originalMgm.exports) {
|
|
37
|
+
const { name } = info;
|
|
38
|
+
const exportIdStatement = (0, import_utils.getExportIdentifierStatement)(name, module2) ?? import_graph.Statement.getDefaultStatement(module2);
|
|
39
|
+
const declareIdStatement = (0, import_utils.getDeclarationIdentifier)(name, module2);
|
|
40
|
+
const exportInfo = new import_graph.ExportInfo(info.name, exportIdStatement);
|
|
41
|
+
if (declareIdStatement) {
|
|
42
|
+
const variable = new import_graph.Variable(
|
|
43
|
+
name,
|
|
44
|
+
module2,
|
|
45
|
+
info.getUsedInfo(),
|
|
46
|
+
declareIdStatement
|
|
47
|
+
);
|
|
48
|
+
variable.setExportInfo(exportInfo);
|
|
49
|
+
mgm.addVariable(variable);
|
|
50
|
+
}
|
|
51
|
+
cache.set(info, exportInfo);
|
|
52
|
+
mgm.addExportInfo(exportInfo);
|
|
53
|
+
}
|
|
54
|
+
for (const dep of origin.dependencies) {
|
|
55
|
+
if (dep.type !== "harmony import specifier") {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const HISDep = dep;
|
|
59
|
+
const { name, userRequest } = HISDep;
|
|
60
|
+
const originName = HISDep.getIds(webpackGraph)[0] ?? import_graph.SideEffect.NamespaceSymbol;
|
|
61
|
+
const importIdStatement = module2.getStatement(dep.loc);
|
|
62
|
+
const importInfo = new import_graph.SideEffect(
|
|
63
|
+
name,
|
|
64
|
+
module2,
|
|
65
|
+
importIdStatement,
|
|
66
|
+
userRequest,
|
|
67
|
+
originName
|
|
68
|
+
);
|
|
69
|
+
mgm.addSideEffect(importInfo);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function appendExportConnection(origin, webpackGraph, graph, cache) {
|
|
73
|
+
const module2 = graph.getModuleByWebpackId(origin.identifier());
|
|
74
|
+
const mgm = graph.getModuleGraphModule(module2);
|
|
75
|
+
const originalMgm = webpackGraph.getExportsInfo(origin);
|
|
76
|
+
if (!mgm || !module2) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
for (const info of originalMgm.exports) {
|
|
80
|
+
if (!info.isReexport()) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
const lastExport = (0, import_compatible.getLastExportInfo)(info, webpackGraph);
|
|
84
|
+
const lastSdkExport = cache.get(lastExport);
|
|
85
|
+
const sdkExport = cache.get(info);
|
|
86
|
+
if (!lastSdkExport || !sdkExport) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
sdkExport.setFromExport(lastSdkExport);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function appendImportConnection(origin, graph) {
|
|
93
|
+
const module2 = graph.getModuleByWebpackId(origin.identifier());
|
|
94
|
+
const mgm = graph.getModuleGraphModule(module2);
|
|
95
|
+
if (!mgm || !module2) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
for (const info of mgm.getSideEffects()) {
|
|
99
|
+
const exportName = info.originName ?? info.name;
|
|
100
|
+
const resolveModule = info.fromDependency?.dependency;
|
|
101
|
+
if (!resolveModule) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const resolveExport = graph.getModuleGraphModule(resolveModule).getExport(exportName);
|
|
105
|
+
if (resolveExport) {
|
|
106
|
+
info.setExportInfo(resolveExport);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function appendTreeShaking(moduleGraph, compilation) {
|
|
111
|
+
if (!(0, import_module_graph.isWebpack5orRspack)(compilation)) {
|
|
112
|
+
return moduleGraph;
|
|
113
|
+
}
|
|
114
|
+
if ("moduleGraph" in compilation) {
|
|
115
|
+
const exportData = /* @__PURE__ */ new Map();
|
|
116
|
+
const { moduleGraph: webpackGraph } = compilation;
|
|
117
|
+
const allModules = (0, import_compatible.getAllModules)(compilation);
|
|
118
|
+
allModules.forEach(
|
|
119
|
+
(origin) => transformMgm(origin, webpackGraph, moduleGraph, exportData)
|
|
120
|
+
);
|
|
121
|
+
allModules.forEach(
|
|
122
|
+
(origin) => appendExportConnection(origin, webpackGraph, moduleGraph, exportData)
|
|
123
|
+
);
|
|
124
|
+
allModules.forEach((origin) => appendImportConnection(origin, moduleGraph));
|
|
125
|
+
exportData.clear();
|
|
126
|
+
return moduleGraph;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
130
|
+
0 && (module.exports = {
|
|
131
|
+
appendTreeShaking
|
|
132
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as SDK from '@rsdoctor/graph';
|
|
2
|
+
export declare function getExportIdentifierStatement(name: string, module: SDK.Module): SDK.Statement | undefined;
|
|
3
|
+
export declare function getDeclarationIdentifier(name: string, module: SDK.Module): SDK.Statement | undefined;
|
|
4
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/module-graph/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AA0DvC,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,6BAuB5E;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,6BAiCxE"}
|