@rsdoctor/core 2.0.0-alpha.0 → 2.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/26.js +26163 -0
- package/dist/630.js +1269 -0
- package/dist/630.js.LICENSE.txt +7 -0
- package/dist/build-utils/build/chunks/assetsModules.d.ts +8 -2
- package/dist/build-utils/build/chunks/index.d.ts +0 -1
- package/dist/build-utils/build/chunks/rspack/transform.d.ts +1 -1
- package/dist/build-utils/build/envinfo.d.ts +13 -0
- package/dist/build-utils/build/file/cache.d.ts +5 -0
- package/dist/build-utils/build/file/index.d.ts +3 -0
- package/dist/build-utils/build/file/sharding.d.ts +21 -0
- package/dist/build-utils/build/index.d.ts +5 -0
- package/dist/build-utils/build/json.d.ts +3 -0
- package/dist/build-utils/build/loader/probeLoader.d.ts +8 -3
- package/dist/build-utils/build/loader/probeLoaderPlugin.d.ts +1 -1
- package/dist/build-utils/build/module-graph/index.d.ts +0 -1
- package/dist/build-utils/build/module-graph/parser.d.ts +1 -1
- package/dist/build-utils/build/module-graph/rspack/transform.d.ts +1 -1
- package/dist/build-utils/build/module-graph/utils.d.ts +1 -1
- package/dist/build-utils/build/process.d.ts +2 -0
- package/dist/build-utils/build/server.d.ts +15 -0
- package/dist/build-utils/build/utils/loader.d.ts +2 -2
- package/dist/build-utils/build/utils/parseBundle.d.ts +1 -1
- package/dist/build-utils/build/utils/plugin.d.ts +1 -1
- package/dist/build-utils/index.d.ts +10 -0
- package/dist/common/file.d.ts +2 -0
- package/dist/common/global-config.d.ts +21 -0
- package/dist/error/error.d.ts +35 -0
- package/dist/error/index.d.ts +2 -0
- package/dist/error/transform.d.ts +3 -0
- package/dist/error/utils.d.ts +4 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +1725 -5
- package/dist/inner-plugins/constants.d.ts +1 -1
- package/dist/inner-plugins/loaders/proxy.d.ts +4 -4
- package/dist/inner-plugins/plugins/base.d.ts +3 -3
- package/dist/inner-plugins/plugins/bundle.d.ts +1 -1
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts +3 -3
- package/dist/inner-plugins/plugins/errors.d.ts +2 -2
- package/dist/inner-plugins/plugins/loader.d.ts +1 -1
- package/dist/inner-plugins/plugins/plugins.d.ts +1 -1
- package/dist/inner-plugins/plugins/progress.d.ts +2 -2
- package/dist/inner-plugins/plugins/resolver.d.ts +1 -1
- package/dist/inner-plugins/plugins/rspack.d.ts +8 -3
- package/dist/inner-plugins/plugins/rules.d.ts +1 -1
- package/dist/inner-plugins/plugins/sourcemapTool.d.ts +2 -2
- package/dist/inner-plugins/plugins/summary.d.ts +1 -1
- package/dist/inner-plugins/utils/config.d.ts +2 -3
- package/dist/inner-plugins/utils/loader.d.ts +4 -7
- package/dist/inner-plugins/utils/normalize-config.d.ts +1 -1
- package/dist/inner-plugins/utils/openBrowser.d.ts +1 -0
- package/dist/inner-plugins/utils/plugin.d.ts +1 -1
- package/dist/inner-plugins/utils/sdk.d.ts +2 -3
- package/dist/logger.d.ts +9 -0
- package/dist/probe-loader.js +2 -0
- package/dist/proxy-loader.d.ts +1 -0
- package/dist/proxy-loader.js +48 -0
- package/dist/rslib-runtime.js +18 -9
- package/dist/{inner-plugins/constants.d.cts → rspack-plugin/constants.d.ts} +4 -1
- package/dist/rspack-plugin/index.d.ts +2 -0
- package/dist/rspack-plugin/multiple.d.ts +8 -0
- package/dist/rspack-plugin/plugin.d.ts +25 -0
- package/dist/rule-utils/document/document.d.ts +16 -0
- package/dist/rule-utils/document/index.d.ts +3 -0
- package/dist/rule-utils/document/server.d.ts +4 -0
- package/dist/rule-utils/document/types.d.ts +31 -0
- package/dist/rule-utils/index.d.ts +2 -0
- package/dist/rule-utils/parser/asserts.d.ts +81 -0
- package/dist/rule-utils/parser/index.d.ts +4 -0
- package/dist/rule-utils/parser/parser.d.ts +118 -0
- package/dist/rule-utils/parser/types.d.ts +30 -0
- package/dist/rule-utils/parser/utils.d.ts +30 -0
- package/dist/rules/linter.d.ts +1 -1
- package/dist/rules/rule.d.ts +2 -2
- package/dist/rules/rules/cjs-require/index.d.ts +1 -1
- package/dist/rules/rules/cross-chunks-package/index.d.ts +1 -1
- package/dist/rules/rules/default-import-check/index.d.ts +1 -1
- package/dist/rules/rules/default-import-check/utils.d.ts +2 -2
- package/dist/rules/rules/duplicate-package/index.d.ts +3 -3
- package/dist/rules/rules/duplicate-package/utils.d.ts +1 -1
- package/dist/rules/rules/ecma-version-check/htmlParserStub.d.ts +3 -0
- package/dist/rules/rules/ecma-version-check/index.d.ts +3 -2
- package/dist/rules/rules/ecma-version-check/types.d.ts +13 -3
- package/dist/rules/rules/ecma-version-check/utils.d.ts +1 -1
- package/dist/rules/rules/esm-resolved-to-cjs/index.d.ts +1 -1
- package/dist/rules/rules/index.d.ts +1 -1
- package/dist/rules/rules/loader-performance-optimization/index.d.ts +1 -1
- package/dist/rules/rules/loader-performance-optimization/types.d.ts +1 -1
- package/dist/rules/rules/module-mixed-chunks/index.d.ts +1 -1
- package/dist/rules/rules/side-effects-only-imports/index.d.ts +1 -1
- package/dist/rules/utils.d.ts +1 -1
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/multiple/controller.d.ts +12 -0
- package/dist/sdk/multiple/index.d.ts +2 -0
- package/dist/sdk/multiple/primary.d.ts +32 -0
- package/dist/sdk/multiple/server.d.ts +7 -0
- package/dist/sdk/sdk/core.d.ts +33 -0
- package/dist/sdk/sdk/index.d.ts +52 -0
- package/dist/sdk/sdk/types.d.ts +26 -0
- package/dist/sdk/server/apis/alerts.d.ts +5 -0
- package/dist/sdk/server/apis/base.d.ts +11 -0
- package/dist/sdk/server/apis/bundle-diff.d.ts +6 -0
- package/dist/sdk/server/apis/data.d.ts +6 -0
- package/dist/sdk/server/apis/fs.d.ts +5 -0
- package/dist/sdk/server/apis/graph.d.ts +12 -0
- package/dist/sdk/server/apis/index.d.ts +10 -0
- package/dist/sdk/server/apis/loader.d.ts +15 -0
- package/dist/sdk/server/apis/plugin.d.ts +6 -0
- package/dist/sdk/server/apis/project.d.ts +8 -0
- package/dist/sdk/server/apis/renderer.d.ts +6 -0
- package/dist/sdk/server/apis/resolver.d.ts +6 -0
- package/dist/sdk/server/client.d.ts +3 -0
- package/dist/sdk/server/fakeServer.d.ts +9 -0
- package/dist/sdk/server/index.d.ts +44 -0
- package/dist/sdk/server/json-body.d.ts +6 -0
- package/dist/sdk/server/router.d.ts +24 -0
- package/dist/sdk/server/security.d.ts +5 -0
- package/dist/sdk/server/socket/api.d.ts +15 -0
- package/dist/sdk/server/socket/index.d.ts +48 -0
- package/dist/sdk/server/utils.d.ts +6 -0
- package/dist/sdk/utils/base.d.ts +1 -0
- package/dist/sdk/utils/constant.d.ts +1 -0
- package/dist/sdk/utils/date.d.ts +1 -0
- package/dist/sdk/utils/index.d.ts +3 -0
- package/dist/sdk/utils/openBrowser.d.ts +4 -0
- package/dist/sdk/utils/upload.d.ts +2 -0
- package/dist/sdk.d.ts +1 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/loader.d.ts +1 -1
- package/dist/types/plugin.d.ts +7 -28
- package/package.json +56 -80
- package/static/openChrome.applescript +95 -0
- package/dist/build-utils/build/chunks/assetsModules.cjs +0 -42
- package/dist/build-utils/build/chunks/assetsModules.d.cts +0 -17
- package/dist/build-utils/build/chunks/assetsModules.js +0 -9
- package/dist/build-utils/build/chunks/chunkTransform.cjs +0 -39
- package/dist/build-utils/build/chunks/chunkTransform.d.cts +0 -4
- package/dist/build-utils/build/chunks/chunkTransform.d.ts +0 -4
- package/dist/build-utils/build/chunks/chunkTransform.js +0 -6
- package/dist/build-utils/build/chunks/index.cjs +0 -72
- package/dist/build-utils/build/chunks/index.d.cts +0 -3
- package/dist/build-utils/build/chunks/index.js +0 -4
- package/dist/build-utils/build/chunks/rspack/transform.cjs +0 -80
- package/dist/build-utils/build/chunks/rspack/transform.d.cts +0 -13
- package/dist/build-utils/build/chunks/rspack/transform.js +0 -44
- package/dist/build-utils/build/index.cjs +0 -52
- package/dist/build-utils/build/index.d.cts +0 -5
- package/dist/build-utils/build/index.js +0 -7
- package/dist/build-utils/build/loader/index.cjs +0 -65
- package/dist/build-utils/build/loader/index.d.cts +0 -2
- package/dist/build-utils/build/loader/index.js +0 -3
- package/dist/build-utils/build/loader/probeLoader.cjs +0 -89
- package/dist/build-utils/build/loader/probeLoader.d.cts +0 -4
- package/dist/build-utils/build/loader/probeLoader.js +0 -44
- package/dist/build-utils/build/loader/probeLoaderPlugin.cjs +0 -65
- package/dist/build-utils/build/loader/probeLoaderPlugin.d.cts +0 -5
- package/dist/build-utils/build/loader/probeLoaderPlugin.js +0 -32
- package/dist/build-utils/build/module-graph/index.cjs +0 -65
- package/dist/build-utils/build/module-graph/index.d.cts +0 -2
- package/dist/build-utils/build/module-graph/index.js +0 -3
- package/dist/build-utils/build/module-graph/parser.cjs +0 -46
- package/dist/build-utils/build/module-graph/parser.d.cts +0 -2
- package/dist/build-utils/build/module-graph/parser.js +0 -13
- package/dist/build-utils/build/module-graph/rspack/transform.cjs +0 -151
- package/dist/build-utils/build/module-graph/rspack/transform.d.cts +0 -26
- package/dist/build-utils/build/module-graph/rspack/transform.js +0 -109
- package/dist/build-utils/build/module-graph/transform.cjs +0 -39
- package/dist/build-utils/build/module-graph/transform.d.cts +0 -3
- package/dist/build-utils/build/module-graph/transform.d.ts +0 -3
- package/dist/build-utils/build/module-graph/transform.js +0 -6
- package/dist/build-utils/build/module-graph/utils.cjs +0 -95
- package/dist/build-utils/build/module-graph/utils.d.cts +0 -3
- package/dist/build-utils/build/module-graph/utils.js +0 -59
- package/dist/build-utils/build/utils/index.cjs +0 -72
- package/dist/build-utils/build/utils/index.d.cts +0 -3
- package/dist/build-utils/build/utils/index.js +0 -4
- package/dist/build-utils/build/utils/loader.cjs +0 -354
- package/dist/build-utils/build/utils/loader.d.cts +0 -20
- package/dist/build-utils/build/utils/loader.js +0 -276
- package/dist/build-utils/build/utils/parseBundle.cjs +0 -283
- package/dist/build-utils/build/utils/parseBundle.d.cts +0 -12
- package/dist/build-utils/build/utils/parseBundle.js +0 -240
- package/dist/build-utils/build/utils/plugin.cjs +0 -60
- package/dist/build-utils/build/utils/plugin.d.cts +0 -5
- package/dist/build-utils/build/utils/plugin.js +0 -21
- package/dist/build-utils/index.cjs +0 -36
- package/dist/build-utils/index.d.cts +0 -1
- package/dist/build-utils/index.js +0 -3
- package/dist/index.cjs +0 -81
- package/dist/index.d.cts +0 -3
- package/dist/inner-plugins/constants.cjs +0 -64
- package/dist/inner-plugins/constants.js +0 -19
- package/dist/inner-plugins/index.cjs +0 -65
- package/dist/inner-plugins/index.d.cts +0 -2
- package/dist/inner-plugins/index.js +0 -3
- package/dist/inner-plugins/loaders/proxy.cjs +0 -104
- package/dist/inner-plugins/loaders/proxy.d.cts +0 -7
- package/dist/inner-plugins/loaders/proxy.js +0 -65
- package/dist/inner-plugins/plugins/base.cjs +0 -53
- package/dist/inner-plugins/plugins/base.d.cts +0 -12
- package/dist/inner-plugins/plugins/base.js +0 -20
- package/dist/inner-plugins/plugins/bundle.cjs +0 -96
- package/dist/inner-plugins/plugins/bundle.d.cts +0 -15
- package/dist/inner-plugins/plugins/bundle.js +0 -63
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.cjs +0 -141
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.cts +0 -34
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +0 -102
- package/dist/inner-plugins/plugins/errors.cjs +0 -98
- package/dist/inner-plugins/plugins/errors.d.cts +0 -11
- package/dist/inner-plugins/plugins/errors.js +0 -65
- package/dist/inner-plugins/plugins/index.cjs +0 -121
- package/dist/inner-plugins/plugins/index.d.cts +0 -10
- package/dist/inner-plugins/plugins/index.js +0 -11
- package/dist/inner-plugins/plugins/loader.cjs +0 -165
- package/dist/inner-plugins/plugins/loader.d.cts +0 -10
- package/dist/inner-plugins/plugins/loader.js +0 -120
- package/dist/inner-plugins/plugins/plugins.cjs +0 -73
- package/dist/inner-plugins/plugins/plugins.d.cts +0 -8
- package/dist/inner-plugins/plugins/plugins.js +0 -40
- package/dist/inner-plugins/plugins/progress.cjs +0 -68
- package/dist/inner-plugins/plugins/progress.d.cts +0 -8
- package/dist/inner-plugins/plugins/progress.js +0 -35
- package/dist/inner-plugins/plugins/resolver.cjs +0 -90
- package/dist/inner-plugins/plugins/resolver.d.cts +0 -12
- package/dist/inner-plugins/plugins/resolver.js +0 -57
- package/dist/inner-plugins/plugins/rspack.cjs +0 -118
- package/dist/inner-plugins/plugins/rspack.d.cts +0 -4
- package/dist/inner-plugins/plugins/rspack.js +0 -85
- package/dist/inner-plugins/plugins/rules.cjs +0 -97
- package/dist/inner-plugins/plugins/rules.d.cts +0 -8
- package/dist/inner-plugins/plugins/rules.js +0 -64
- package/dist/inner-plugins/plugins/sourcemapTool.cjs +0 -275
- package/dist/inner-plugins/plugins/sourcemapTool.d.cts +0 -52
- package/dist/inner-plugins/plugins/sourcemapTool.js +0 -230
- package/dist/inner-plugins/plugins/summary.cjs +0 -125
- package/dist/inner-plugins/plugins/summary.d.cts +0 -14
- package/dist/inner-plugins/plugins/summary.js +0 -92
- package/dist/inner-plugins/utils/circleDetect.cjs +0 -49
- package/dist/inner-plugins/utils/circleDetect.d.cts +0 -4
- package/dist/inner-plugins/utils/circleDetect.js +0 -16
- package/dist/inner-plugins/utils/config.cjs +0 -191
- package/dist/inner-plugins/utils/config.d.cts +0 -5
- package/dist/inner-plugins/utils/config.js +0 -142
- package/dist/inner-plugins/utils/index.cjs +0 -106
- package/dist/inner-plugins/utils/index.d.cts +0 -9
- package/dist/inner-plugins/utils/index.js +0 -8
- package/dist/inner-plugins/utils/loader.cjs +0 -218
- package/dist/inner-plugins/utils/loader.d.cts +0 -13
- package/dist/inner-plugins/utils/loader.js +0 -160
- package/dist/inner-plugins/utils/normalize-config.cjs +0 -122
- package/dist/inner-plugins/utils/normalize-config.d.cts +0 -37
- package/dist/inner-plugins/utils/normalize-config.js +0 -77
- package/dist/inner-plugins/utils/plugin-common.cjs +0 -143
- package/dist/inner-plugins/utils/plugin-common.d.cts +0 -11
- package/dist/inner-plugins/utils/plugin-common.js +0 -94
- package/dist/inner-plugins/utils/plugin.cjs +0 -106
- package/dist/inner-plugins/utils/plugin.d.cts +0 -4
- package/dist/inner-plugins/utils/plugin.js +0 -70
- package/dist/inner-plugins/utils/sdk.cjs +0 -55
- package/dist/inner-plugins/utils/sdk.d.cts +0 -8
- package/dist/inner-plugins/utils/sdk.js +0 -19
- package/dist/rules/index.cjs +0 -81
- package/dist/rules/index.d.cts +0 -3
- package/dist/rules/index.js +0 -4
- package/dist/rules/linter.cjs +0 -72
- package/dist/rules/linter.d.cts +0 -9
- package/dist/rules/linter.js +0 -36
- package/dist/rules/rule.cjs +0 -137
- package/dist/rules/rule.d.cts +0 -27
- package/dist/rules/rule.js +0 -101
- package/dist/rules/rules/cjs-require/index.cjs +0 -83
- package/dist/rules/rules/cjs-require/index.d.cts +0 -4
- package/dist/rules/rules/cjs-require/index.js +0 -50
- package/dist/rules/rules/cjs-require/types.cjs +0 -18
- package/dist/rules/rules/cjs-require/types.d.cts +0 -7
- package/dist/rules/rules/cjs-require/types.js +0 -1
- package/dist/rules/rules/cross-chunks-package/index.cjs +0 -74
- package/dist/rules/rules/cross-chunks-package/index.d.cts +0 -4
- package/dist/rules/rules/cross-chunks-package/index.js +0 -41
- package/dist/rules/rules/cross-chunks-package/types.cjs +0 -18
- package/dist/rules/rules/cross-chunks-package/types.d.cts +0 -3
- package/dist/rules/rules/cross-chunks-package/types.js +0 -1
- package/dist/rules/rules/cross-chunks-package/utils.cjs +0 -40
- package/dist/rules/rules/cross-chunks-package/utils.d.cts +0 -1
- package/dist/rules/rules/cross-chunks-package/utils.js +0 -7
- package/dist/rules/rules/default-import-check/index.cjs +0 -116
- package/dist/rules/rules/default-import-check/index.d.cts +0 -4
- package/dist/rules/rules/default-import-check/index.js +0 -83
- package/dist/rules/rules/default-import-check/types.cjs +0 -18
- package/dist/rules/rules/default-import-check/types.d.cts +0 -4
- package/dist/rules/rules/default-import-check/types.js +0 -1
- package/dist/rules/rules/default-import-check/utils.cjs +0 -97
- package/dist/rules/rules/default-import-check/utils.d.cts +0 -10
- package/dist/rules/rules/default-import-check/utils.js +0 -52
- package/dist/rules/rules/duplicate-package/index.cjs +0 -72
- package/dist/rules/rules/duplicate-package/index.d.cts +0 -4
- package/dist/rules/rules/duplicate-package/index.js +0 -39
- package/dist/rules/rules/duplicate-package/types.cjs +0 -60
- package/dist/rules/rules/duplicate-package/types.d.cts +0 -24
- package/dist/rules/rules/duplicate-package/types.js +0 -24
- package/dist/rules/rules/duplicate-package/utils.cjs +0 -84
- package/dist/rules/rules/duplicate-package/utils.d.cts +0 -3
- package/dist/rules/rules/duplicate-package/utils.js +0 -38
- package/dist/rules/rules/ecma-version-check/index.cjs +0 -96
- package/dist/rules/rules/ecma-version-check/index.d.cts +0 -4
- package/dist/rules/rules/ecma-version-check/index.js +0 -53
- package/dist/rules/rules/ecma-version-check/types.cjs +0 -18
- package/dist/rules/rules/ecma-version-check/types.d.cts +0 -3
- package/dist/rules/rules/ecma-version-check/types.js +0 -1
- package/dist/rules/rules/ecma-version-check/utils.cjs +0 -39
- package/dist/rules/rules/ecma-version-check/utils.d.cts +0 -2
- package/dist/rules/rules/ecma-version-check/utils.js +0 -6
- package/dist/rules/rules/esm-resolved-to-cjs/index.cjs +0 -237
- package/dist/rules/rules/esm-resolved-to-cjs/index.d.cts +0 -4
- package/dist/rules/rules/esm-resolved-to-cjs/index.js +0 -193
- package/dist/rules/rules/esm-resolved-to-cjs/types.cjs +0 -18
- package/dist/rules/rules/esm-resolved-to-cjs/types.d.cts +0 -8
- package/dist/rules/rules/esm-resolved-to-cjs/types.js +0 -1
- package/dist/rules/rules/index.cjs +0 -55
- package/dist/rules/rules/index.d.cts +0 -2
- package/dist/rules/rules/index.js +0 -22
- package/dist/rules/rules/loader-performance-optimization/index.cjs +0 -119
- package/dist/rules/rules/loader-performance-optimization/index.d.cts +0 -4
- package/dist/rules/rules/loader-performance-optimization/index.js +0 -86
- package/dist/rules/rules/loader-performance-optimization/types.cjs +0 -18
- package/dist/rules/rules/loader-performance-optimization/types.d.cts +0 -22
- package/dist/rules/rules/loader-performance-optimization/types.js +0 -1
- package/dist/rules/rules/loader-performance-optimization/utils.cjs +0 -43
- package/dist/rules/rules/loader-performance-optimization/utils.d.cts +0 -1
- package/dist/rules/rules/loader-performance-optimization/utils.js +0 -10
- package/dist/rules/rules/module-mixed-chunks/index.cjs +0 -85
- package/dist/rules/rules/module-mixed-chunks/index.d.cts +0 -4
- package/dist/rules/rules/module-mixed-chunks/index.js +0 -52
- package/dist/rules/rules/module-mixed-chunks/types.cjs +0 -18
- package/dist/rules/rules/module-mixed-chunks/types.d.cts +0 -3
- package/dist/rules/rules/module-mixed-chunks/types.js +0 -1
- package/dist/rules/rules/side-effects-only-imports/index.cjs +0 -114
- package/dist/rules/rules/side-effects-only-imports/index.d.cts +0 -4
- package/dist/rules/rules/side-effects-only-imports/index.js +0 -81
- package/dist/rules/rules/side-effects-only-imports/types.cjs +0 -18
- package/dist/rules/rules/side-effects-only-imports/types.d.cts +0 -9
- package/dist/rules/rules/side-effects-only-imports/types.js +0 -1
- package/dist/rules/utils.cjs +0 -46
- package/dist/rules/utils.d.cts +0 -3
- package/dist/rules/utils.js +0 -10
- package/dist/types/chunks.cjs +0 -18
- package/dist/types/chunks.d.cts +0 -6
- package/dist/types/chunks.d.ts +0 -6
- package/dist/types/chunks.js +0 -1
- package/dist/types/index.cjs +0 -79
- package/dist/types/index.d.cts +0 -4
- package/dist/types/index.js +0 -5
- package/dist/types/loader.cjs +0 -18
- package/dist/types/loader.d.cts +0 -19
- package/dist/types/loader.js +0 -1
- package/dist/types/plugin.cjs +0 -18
- package/dist/types/plugin.d.cts +0 -51
- package/dist/types/plugin.js +0 -1
- package/dist/types/rules.cjs +0 -18
- package/dist/types/rules.d.cts +0 -7
- package/dist/types/rules.js +0 -1
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { Graph } from "@rsdoctor/utils/common";
|
|
3
|
-
import { logger, time, timeEnd } from "@rsdoctor/utils/logger";
|
|
4
|
-
import { dirname, isAbsolute, resolve } from "path";
|
|
5
|
-
import { SourceMapConsumer } from "source-map";
|
|
6
|
-
const UNASSIGNED = '[unassigned]';
|
|
7
|
-
function bindContextCache(context, namespace, cache, sourceMapDir, sourceRoot) {
|
|
8
|
-
cache = cache || new Map();
|
|
9
|
-
return (source, sourceMapFilenameRegex)=>{
|
|
10
|
-
if (cache.has(source)) return cache.get(source);
|
|
11
|
-
let resolved = UNASSIGNED;
|
|
12
|
-
if (source.startsWith('file://')) resolved = resolve(context, source.replace(/^file:\/\//, ''));
|
|
13
|
-
else if (source.startsWith('webpack://')) if (sourceMapFilenameRegex) {
|
|
14
|
-
const match = source.match(sourceMapFilenameRegex);
|
|
15
|
-
const filePath = match?.[1];
|
|
16
|
-
const hasNamespace = namespace && source.startsWith(`webpack://${namespace}`) || namespace && source.startsWith(`file://${namespace}`);
|
|
17
|
-
const baseDir = hasNamespace ? process.cwd() : context;
|
|
18
|
-
resolved = filePath ? resolve(baseDir, `./${filePath}`) : UNASSIGNED;
|
|
19
|
-
} else resolved = UNASSIGNED;
|
|
20
|
-
else if (isAbsolute(source)) resolved = source;
|
|
21
|
-
else {
|
|
22
|
-
let baseDir = context;
|
|
23
|
-
if (sourceRoot) baseDir = isAbsolute(sourceRoot) ? sourceRoot : sourceMapDir ? resolve(sourceMapDir, sourceRoot) : resolve(context, sourceRoot);
|
|
24
|
-
else if (sourceMapDir) baseDir = sourceMapDir;
|
|
25
|
-
resolved = resolve(baseDir, source);
|
|
26
|
-
}
|
|
27
|
-
cache.set(source, resolved);
|
|
28
|
-
return resolved;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
async function collectSourceMaps(map, assetLinesCodeList, _compilation, _this, sourceMapFilenameRegex, namespace, skipSources, sourceMapPath) {
|
|
32
|
-
if (map) {
|
|
33
|
-
const consumer = await new SourceMapConsumer(map);
|
|
34
|
-
let sourceMapDir;
|
|
35
|
-
if (sourceMapPath) sourceMapDir = dirname(sourceMapPath);
|
|
36
|
-
else if (_compilation.options.output?.path) sourceMapDir = 'string' == typeof _compilation.options.output.path ? _compilation.options.output.path : void 0;
|
|
37
|
-
const sourceRoot = map.sourceRoot;
|
|
38
|
-
const getRealSourcePath = bindContextCache(_this.sdk.root || process.cwd(), namespace, _this._realSourcePathCache, sourceMapDir, sourceRoot ?? void 0);
|
|
39
|
-
const lineMappings = new Map();
|
|
40
|
-
consumer._absoluteSources = consumer._sources;
|
|
41
|
-
consumer.eachMapping((m)=>{
|
|
42
|
-
if (!lineMappings.has(m.generatedLine)) lineMappings.set(m.generatedLine, []);
|
|
43
|
-
lineMappings.get(m.generatedLine).push(m);
|
|
44
|
-
});
|
|
45
|
-
for (const [lineNum, mappings] of lineMappings.entries()){
|
|
46
|
-
mappings.sort((a, b)=>a.generatedColumn - b.generatedColumn);
|
|
47
|
-
const lineIdx = lineNum - 1;
|
|
48
|
-
if (lineIdx < 0 || lineIdx >= assetLinesCodeList.length) continue;
|
|
49
|
-
const line = assetLinesCodeList[lineIdx];
|
|
50
|
-
for(let i = 0; i < mappings.length; i++){
|
|
51
|
-
const m = mappings[i];
|
|
52
|
-
if (!m.source) continue;
|
|
53
|
-
let realSource = m.source;
|
|
54
|
-
if (realSource.includes('!')) {
|
|
55
|
-
const parts = realSource.split('!');
|
|
56
|
-
for(let j = parts.length - 1; j >= 0; j--){
|
|
57
|
-
const part = parts[j];
|
|
58
|
-
if (!part) continue;
|
|
59
|
-
const cleanPart = part.split('??')[0];
|
|
60
|
-
if (!cleanPart.startsWith('builtin:')) {
|
|
61
|
-
if (cleanPart.startsWith('/') || cleanPart.includes('\\')) {
|
|
62
|
-
realSource = cleanPart;
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (realSource === m.source) {
|
|
68
|
-
const lastPart = parts[parts.length - 1];
|
|
69
|
-
realSource = lastPart ? lastPart.split('??')[0] : lastPart;
|
|
70
|
-
}
|
|
71
|
-
} else if (realSource.includes('??')) realSource = realSource.split('??')[0];
|
|
72
|
-
if (realSource) {
|
|
73
|
-
if ((realSource.startsWith('webpack://') || realSource.startsWith('file://')) && sourceMapFilenameRegex) realSource = getRealSourcePath(realSource, sourceMapFilenameRegex);
|
|
74
|
-
else if (!isAbsolute(realSource)) realSource = getRealSourcePath(realSource, sourceMapFilenameRegex);
|
|
75
|
-
}
|
|
76
|
-
if (!realSource || realSource === UNASSIGNED) continue;
|
|
77
|
-
if (skipSources && skipSources.has(realSource)) continue;
|
|
78
|
-
const next = mappings[i + 1];
|
|
79
|
-
const start = m.generatedColumn;
|
|
80
|
-
const end = next ? next.generatedColumn : line.length;
|
|
81
|
-
const codeSegment = line.slice(start, end);
|
|
82
|
-
const prev = _this.sourceMapSets.get(realSource) || '';
|
|
83
|
-
_this.sourceMapSets.set(realSource, prev.concat(codeSegment));
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
async function handleAfterEmitAssets(compilation, _this, sourceMapFilenameRegex, namespace) {
|
|
89
|
-
if ('rspack' in compilation.compiler) {
|
|
90
|
-
_this.sourceMapSets = new Map();
|
|
91
|
-
if (_this.assetsWithoutSourceMap) _this.assetsWithoutSourceMap.clear();
|
|
92
|
-
else _this.assetsWithoutSourceMap = new Set();
|
|
93
|
-
time('ensureModulesChunkGraph.afterEmit.start');
|
|
94
|
-
const assets = [
|
|
95
|
-
...compilation.getAssets()
|
|
96
|
-
];
|
|
97
|
-
const skipSources = new Set();
|
|
98
|
-
for (const asset of assets){
|
|
99
|
-
const { assetLinesCodeList, map: mapFromAsset, assetName } = parseAsset(asset, assets, 'js/css');
|
|
100
|
-
let map = mapFromAsset;
|
|
101
|
-
let sourceMapPath;
|
|
102
|
-
if (map) {
|
|
103
|
-
const outputPath = compilation.options.output?.path;
|
|
104
|
-
if (outputPath && 'string' == typeof outputPath && assetName) {
|
|
105
|
-
const mapFileName = assetName.endsWith('.map') ? assetName : `${assetName}.map`;
|
|
106
|
-
sourceMapPath = resolve(outputPath, mapFileName);
|
|
107
|
-
}
|
|
108
|
-
} else {
|
|
109
|
-
const sourceMapFile = asset.info.related?.sourceMap;
|
|
110
|
-
const sourceMapFileAssetName = sourceMapFile?.replace(/(\.[^.]+)(\.[^.]+)?$/, '$1');
|
|
111
|
-
if (sourceMapFile) {
|
|
112
|
-
let sourceMapAsset = assets.find((asset)=>asset.name === sourceMapFile);
|
|
113
|
-
if (!sourceMapAsset && sourceMapFileAssetName) {
|
|
114
|
-
const baseNameWithoutHash = Graph.formatAssetName(sourceMapFileAssetName, 'string' == typeof compilation.options.output.filename ? compilation.options.output.filename : void 0);
|
|
115
|
-
sourceMapAsset = assets.find((asset)=>{
|
|
116
|
-
const assetBaseName = Graph.formatAssetName(asset.name, 'string' == typeof compilation.options.output.filename ? compilation.options.output.filename : void 0);
|
|
117
|
-
return assetBaseName.includes(baseNameWithoutHash) && asset.name.endsWith('.map');
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
if (sourceMapAsset) {
|
|
121
|
-
map = JSON.parse(sourceMapAsset.source.source().toString());
|
|
122
|
-
const outputPath = compilation.options.output?.path;
|
|
123
|
-
if (outputPath && 'string' == typeof outputPath) sourceMapPath = resolve(outputPath, sourceMapAsset.name);
|
|
124
|
-
}
|
|
125
|
-
} else {
|
|
126
|
-
if (assetName && 'string' == typeof assetName && (assetName.endsWith('.js') || assetName.endsWith('.bundle') || assetName.endsWith('.css'))) _this.assetsWithoutSourceMap.add(assetName);
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
try {
|
|
131
|
-
await collectSourceMaps(map, assetLinesCodeList, compilation, _this, sourceMapFilenameRegex, namespace, skipSources, sourceMapPath);
|
|
132
|
-
} catch (e) {
|
|
133
|
-
logger.debug(e);
|
|
134
|
-
}
|
|
135
|
-
_this.sourceMapSets.forEach((_value, key)=>{
|
|
136
|
-
if (!skipSources.has(key)) skipSources.add(key);
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
timeEnd('ensureModulesChunkGraph.afterEmit.start');
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
async function handleEmitAssets(options) {
|
|
143
|
-
const { compilation, pluginInstance, sourceMapFilenameRegex, namespace } = options;
|
|
144
|
-
if (!('rspack' in compilation.compiler)) {
|
|
145
|
-
pluginInstance.sourceMapSets = new Map();
|
|
146
|
-
time('ensureModulesChunkGraph.afterEmit.start');
|
|
147
|
-
const assets = Object.values(compilation.getAssets()).map((asset, index)=>({
|
|
148
|
-
name: index.toString(),
|
|
149
|
-
source: asset,
|
|
150
|
-
info: asset.info || {}
|
|
151
|
-
}));
|
|
152
|
-
for (const asset of assets){
|
|
153
|
-
const { assetLinesCodeList, map, assetName } = parseAsset(asset, assets, 'map');
|
|
154
|
-
if (!map) continue;
|
|
155
|
-
let sourceMapPath;
|
|
156
|
-
const outputPath = compilation.options.output?.path;
|
|
157
|
-
if (outputPath && 'string' == typeof outputPath && 'string' == typeof assetName) {
|
|
158
|
-
const mapFileName = assetName.endsWith('.map') ? assetName : `${assetName}.map`;
|
|
159
|
-
sourceMapPath = resolve(outputPath, mapFileName);
|
|
160
|
-
}
|
|
161
|
-
try {
|
|
162
|
-
await collectSourceMaps(map, assetLinesCodeList, compilation, pluginInstance, sourceMapFilenameRegex, namespace, void 0, sourceMapPath);
|
|
163
|
-
} catch (e) {
|
|
164
|
-
logger.debug(e);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
timeEnd('ensureModulesChunkGraph.afterEmit.start');
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
function parseAsset(asset, assets, type) {
|
|
171
|
-
const assetName = asset.source?.name || asset.name;
|
|
172
|
-
let assetContent = '';
|
|
173
|
-
let assetLinesCodeList = [];
|
|
174
|
-
let map = null;
|
|
175
|
-
try {
|
|
176
|
-
if ('map' === type && 'string' == typeof assetName && assetName.endsWith('.map') && !asset.name.includes('d.ts')) {
|
|
177
|
-
assetContent = asset.source?.source?.source?.() || '';
|
|
178
|
-
if (!assetContent) {
|
|
179
|
-
logger.debug(`Failed to get source content for asset: ${assetName}`);
|
|
180
|
-
return {
|
|
181
|
-
assetName,
|
|
182
|
-
assetContent: '',
|
|
183
|
-
assetLinesCodeList: [],
|
|
184
|
-
map: null
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
map = JSON.parse(assetContent);
|
|
188
|
-
if (!map || !map.file) {
|
|
189
|
-
logger.debug(`Failed to get source map file for asset: ${assetName}`);
|
|
190
|
-
return {
|
|
191
|
-
assetName,
|
|
192
|
-
assetContent,
|
|
193
|
-
assetLinesCodeList: [],
|
|
194
|
-
map: null
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
const bundledAsset = assets.find((asset2)=>asset2.source?.name === map?.file);
|
|
198
|
-
const bundledCode = bundledAsset?.source?.source?.source?.() || '';
|
|
199
|
-
if (!bundledCode) {
|
|
200
|
-
logger.debug(`Failed to get bundled code for asset: ${map.file}`);
|
|
201
|
-
return {
|
|
202
|
-
assetName,
|
|
203
|
-
assetContent,
|
|
204
|
-
assetLinesCodeList: [],
|
|
205
|
-
map
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
assetLinesCodeList = bundledCode.split(/\r?\n/);
|
|
209
|
-
} else if ('js/css' === type && (assetName.endsWith('.js') || assetName.endsWith('.bundle') || assetName.endsWith('.css'))) {
|
|
210
|
-
assetContent = asset.source?.source?.() || '';
|
|
211
|
-
assetLinesCodeList = assetContent.split(/\r?\n/);
|
|
212
|
-
map = asset.source?.sourceAndMap?.()?.map || null;
|
|
213
|
-
}
|
|
214
|
-
} catch (error) {
|
|
215
|
-
logger.debug(`Error parsing asset ${assetName}:`, error);
|
|
216
|
-
return {
|
|
217
|
-
assetName,
|
|
218
|
-
assetContent: '',
|
|
219
|
-
assetLinesCodeList: [],
|
|
220
|
-
map: null
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
return {
|
|
224
|
-
assetName,
|
|
225
|
-
assetContent,
|
|
226
|
-
assetLinesCodeList,
|
|
227
|
-
map
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
export { UNASSIGNED, bindContextCache, collectSourceMaps, handleAfterEmitAssets, handleEmitAssets };
|
|
@@ -1,125 +0,0 @@
|
|
|
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 ("u" > 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 compat_namespaceObject = require("es-toolkit/compat");
|
|
31
|
-
const external_base_cjs_namespaceObject = require("./base.cjs");
|
|
32
|
-
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
33
|
-
class InternalSummaryPlugin extends external_base_cjs_namespaceObject.InternalBasePlugin {
|
|
34
|
-
apply(compiler) {
|
|
35
|
-
(0, logger_namespaceObject.time)('InternalSummaryPlugin.apply');
|
|
36
|
-
try {
|
|
37
|
-
compiler.hooks.beforeCompile.tapPromise(this.tapPostOptions, this.beforeCompile);
|
|
38
|
-
compiler.hooks.afterCompile.tapPromise(this.tapPreOptions, this.afterCompile);
|
|
39
|
-
compiler.hooks.done.tapPromise(this.tapPostOptions, this.done.bind(this, compiler));
|
|
40
|
-
} finally{
|
|
41
|
-
(0, logger_namespaceObject.timeEnd)('InternalSummaryPlugin.apply');
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
mark(key, type) {
|
|
45
|
-
const now = Date.now();
|
|
46
|
-
switch(type){
|
|
47
|
-
case 'pre':
|
|
48
|
-
this.preTimes.set(key, now);
|
|
49
|
-
break;
|
|
50
|
-
case 'post':
|
|
51
|
-
this.postTimes.set(key, now);
|
|
52
|
-
break;
|
|
53
|
-
default:
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
report(name, start) {
|
|
58
|
-
this.times.set(name, start);
|
|
59
|
-
this.sdk.reportSummaryData({
|
|
60
|
-
costs: [
|
|
61
|
-
{
|
|
62
|
-
name,
|
|
63
|
-
startAt: start,
|
|
64
|
-
costs: Date.now() - start
|
|
65
|
-
}
|
|
66
|
-
]
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
constructor(...args){
|
|
70
|
-
super(...args), this.name = 'summary', this.times = new Map(), this.preTimes = new Map(), this.postTimes = new Map(), this.beforeCompile = async ()=>{
|
|
71
|
-
(0, logger_namespaceObject.time)('InternalSummaryPlugin.beforeCompile');
|
|
72
|
-
try {
|
|
73
|
-
if (!this.times.has(common_namespaceObject.Summary.SummaryCostsDataName.Bootstrap)) {
|
|
74
|
-
const costs = Math.floor(1000 * process.uptime());
|
|
75
|
-
const startAt = Date.now() - costs;
|
|
76
|
-
this.report(common_namespaceObject.Summary.SummaryCostsDataName.Bootstrap, startAt);
|
|
77
|
-
this.mark(common_namespaceObject.Summary.SummaryCostsDataName.Bootstrap, 'post');
|
|
78
|
-
}
|
|
79
|
-
} finally{
|
|
80
|
-
(0, logger_namespaceObject.timeEnd)('InternalSummaryPlugin.beforeCompile');
|
|
81
|
-
}
|
|
82
|
-
}, this.afterCompile = async (compilation)=>{
|
|
83
|
-
(0, logger_namespaceObject.time)('InternalSummaryPlugin.afterCompile');
|
|
84
|
-
try {
|
|
85
|
-
if (!this.times.has(common_namespaceObject.Summary.SummaryCostsDataName.Compile) && !compilation.compiler.isChild()) {
|
|
86
|
-
const start = this.postTimes.get(common_namespaceObject.Summary.SummaryCostsDataName.Bootstrap);
|
|
87
|
-
this.report(common_namespaceObject.Summary.SummaryCostsDataName.Compile, start);
|
|
88
|
-
this.mark(common_namespaceObject.Summary.SummaryCostsDataName.Compile, 'post');
|
|
89
|
-
}
|
|
90
|
-
} finally{
|
|
91
|
-
(0, logger_namespaceObject.timeEnd)('InternalSummaryPlugin.afterCompile');
|
|
92
|
-
}
|
|
93
|
-
}, this.done = async (compiler)=>{
|
|
94
|
-
(0, logger_namespaceObject.time)('InternalSummaryPlugin.done');
|
|
95
|
-
try {
|
|
96
|
-
const start = this.postTimes.get(common_namespaceObject.Summary.SummaryCostsDataName.Compile);
|
|
97
|
-
this.report(common_namespaceObject.Summary.SummaryCostsDataName.Done, start);
|
|
98
|
-
if (false !== compiler.options.optimization.minimize) {
|
|
99
|
-
const pluginData = this.sdk.getStoreData().plugin;
|
|
100
|
-
const minifyHookData = [
|
|
101
|
-
...pluginData.processAssets || []
|
|
102
|
-
];
|
|
103
|
-
if (minifyHookData.length) this.sdk.reportSummaryData({
|
|
104
|
-
costs: [
|
|
105
|
-
{
|
|
106
|
-
name: common_namespaceObject.Summary.SummaryCostsDataName.Minify,
|
|
107
|
-
startAt: (0, compat_namespaceObject.minBy)(minifyHookData, (e)=>e.startAt).startAt,
|
|
108
|
-
costs: (0, compat_namespaceObject.sumBy)(minifyHookData, (e)=>e.costs)
|
|
109
|
-
}
|
|
110
|
-
]
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
} finally{
|
|
114
|
-
(0, logger_namespaceObject.timeEnd)('InternalSummaryPlugin.done');
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
exports.InternalSummaryPlugin = __webpack_exports__.InternalSummaryPlugin;
|
|
120
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
121
|
-
"InternalSummaryPlugin"
|
|
122
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
123
|
-
Object.defineProperty(exports, '__esModule', {
|
|
124
|
-
value: true
|
|
125
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from '@rsdoctor/types';
|
|
2
|
-
import { InternalBasePlugin } from './base';
|
|
3
|
-
export declare class InternalSummaryPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
4
|
-
readonly name = "summary";
|
|
5
|
-
private times;
|
|
6
|
-
private preTimes;
|
|
7
|
-
private postTimes;
|
|
8
|
-
apply(compiler: T): void;
|
|
9
|
-
private mark;
|
|
10
|
-
beforeCompile: () => Promise<void>;
|
|
11
|
-
afterCompile: (compilation: Plugin.BaseCompilation) => Promise<void>;
|
|
12
|
-
done: (compiler: T) => Promise<void>;
|
|
13
|
-
private report;
|
|
14
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { Summary } from "@rsdoctor/utils/common";
|
|
3
|
-
import { minBy, sumBy } from "es-toolkit/compat";
|
|
4
|
-
import { InternalBasePlugin } from "./base.js";
|
|
5
|
-
import { time, timeEnd } from "@rsdoctor/utils/logger";
|
|
6
|
-
class InternalSummaryPlugin extends InternalBasePlugin {
|
|
7
|
-
apply(compiler) {
|
|
8
|
-
time('InternalSummaryPlugin.apply');
|
|
9
|
-
try {
|
|
10
|
-
compiler.hooks.beforeCompile.tapPromise(this.tapPostOptions, this.beforeCompile);
|
|
11
|
-
compiler.hooks.afterCompile.tapPromise(this.tapPreOptions, this.afterCompile);
|
|
12
|
-
compiler.hooks.done.tapPromise(this.tapPostOptions, this.done.bind(this, compiler));
|
|
13
|
-
} finally{
|
|
14
|
-
timeEnd('InternalSummaryPlugin.apply');
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
mark(key, type) {
|
|
18
|
-
const now = Date.now();
|
|
19
|
-
switch(type){
|
|
20
|
-
case 'pre':
|
|
21
|
-
this.preTimes.set(key, now);
|
|
22
|
-
break;
|
|
23
|
-
case 'post':
|
|
24
|
-
this.postTimes.set(key, now);
|
|
25
|
-
break;
|
|
26
|
-
default:
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
report(name, start) {
|
|
31
|
-
this.times.set(name, start);
|
|
32
|
-
this.sdk.reportSummaryData({
|
|
33
|
-
costs: [
|
|
34
|
-
{
|
|
35
|
-
name,
|
|
36
|
-
startAt: start,
|
|
37
|
-
costs: Date.now() - start
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
constructor(...args){
|
|
43
|
-
super(...args), this.name = 'summary', this.times = new Map(), this.preTimes = new Map(), this.postTimes = new Map(), this.beforeCompile = async ()=>{
|
|
44
|
-
time('InternalSummaryPlugin.beforeCompile');
|
|
45
|
-
try {
|
|
46
|
-
if (!this.times.has(Summary.SummaryCostsDataName.Bootstrap)) {
|
|
47
|
-
const costs = Math.floor(1000 * process.uptime());
|
|
48
|
-
const startAt = Date.now() - costs;
|
|
49
|
-
this.report(Summary.SummaryCostsDataName.Bootstrap, startAt);
|
|
50
|
-
this.mark(Summary.SummaryCostsDataName.Bootstrap, 'post');
|
|
51
|
-
}
|
|
52
|
-
} finally{
|
|
53
|
-
timeEnd('InternalSummaryPlugin.beforeCompile');
|
|
54
|
-
}
|
|
55
|
-
}, this.afterCompile = async (compilation)=>{
|
|
56
|
-
time('InternalSummaryPlugin.afterCompile');
|
|
57
|
-
try {
|
|
58
|
-
if (!this.times.has(Summary.SummaryCostsDataName.Compile) && !compilation.compiler.isChild()) {
|
|
59
|
-
const start = this.postTimes.get(Summary.SummaryCostsDataName.Bootstrap);
|
|
60
|
-
this.report(Summary.SummaryCostsDataName.Compile, start);
|
|
61
|
-
this.mark(Summary.SummaryCostsDataName.Compile, 'post');
|
|
62
|
-
}
|
|
63
|
-
} finally{
|
|
64
|
-
timeEnd('InternalSummaryPlugin.afterCompile');
|
|
65
|
-
}
|
|
66
|
-
}, this.done = async (compiler)=>{
|
|
67
|
-
time('InternalSummaryPlugin.done');
|
|
68
|
-
try {
|
|
69
|
-
const start = this.postTimes.get(Summary.SummaryCostsDataName.Compile);
|
|
70
|
-
this.report(Summary.SummaryCostsDataName.Done, start);
|
|
71
|
-
if (false !== compiler.options.optimization.minimize) {
|
|
72
|
-
const pluginData = this.sdk.getStoreData().plugin;
|
|
73
|
-
const minifyHookData = [
|
|
74
|
-
...pluginData.processAssets || []
|
|
75
|
-
];
|
|
76
|
-
if (minifyHookData.length) this.sdk.reportSummaryData({
|
|
77
|
-
costs: [
|
|
78
|
-
{
|
|
79
|
-
name: Summary.SummaryCostsDataName.Minify,
|
|
80
|
-
startAt: minBy(minifyHookData, (e)=>e.startAt).startAt,
|
|
81
|
-
costs: sumBy(minifyHookData, (e)=>e.costs)
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
} finally{
|
|
87
|
-
timeEnd('InternalSummaryPlugin.done');
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
export { InternalSummaryPlugin };
|
|
@@ -1,49 +0,0 @@
|
|
|
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 ("u" > 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 __rspack_i in __webpack_exports__)if (-1 === [
|
|
45
|
-
"checkCirclePath"
|
|
46
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
47
|
-
Object.defineProperty(exports, '__esModule', {
|
|
48
|
-
value: true
|
|
49
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
const checkCirclePath = (obj, record, res, level, maxLevel = 3)=>{
|
|
3
|
-
const idx = record.slice(0, record.length - 1).findIndex((v)=>v.ref === obj);
|
|
4
|
-
if (-1 !== idx) {
|
|
5
|
-
const key = record.map((v)=>v.prop);
|
|
6
|
-
if (res.indexOf(key) < 0) return void res.push(key);
|
|
7
|
-
}
|
|
8
|
-
if ('object' == typeof obj && null !== obj && level < maxLevel) for (const [k, v] of Object.entries(obj))checkCirclePath(v, [
|
|
9
|
-
...record,
|
|
10
|
-
{
|
|
11
|
-
prop: k,
|
|
12
|
-
ref: v
|
|
13
|
-
}
|
|
14
|
-
], res, level + 1);
|
|
15
|
-
};
|
|
16
|
-
export { checkCirclePath };
|