@rsdoctor/core 2.0.0-alpha.0 → 2.0.0-alpha.1
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/build/chunks/assetsModules.d.ts +1 -1
- package/dist/build-utils/build/chunks/assetsModules.js +1 -1
- package/dist/build-utils/build/chunks/index.d.ts +0 -1
- package/dist/build-utils/build/chunks/index.js +0 -1
- package/dist/build-utils/build/chunks/rspack/transform.d.ts +1 -1
- package/dist/build-utils/build/chunks/rspack/transform.js +1 -1
- package/dist/build-utils/build/envinfo.d.ts +13 -0
- package/dist/build-utils/build/envinfo.js +60 -0
- package/dist/build-utils/build/file/cache.d.ts +5 -0
- package/dist/build-utils/build/file/cache.js +24 -0
- package/dist/build-utils/build/file/index.d.ts +3 -0
- package/dist/build-utils/build/file/index.js +5 -0
- package/dist/build-utils/build/file/sharding.d.ts +21 -0
- package/dist/build-utils/build/file/sharding.js +38 -0
- package/dist/build-utils/build/index.d.ts +5 -0
- package/dist/build-utils/build/index.js +11 -6
- package/dist/build-utils/build/json.d.ts +3 -0
- package/dist/build-utils/build/json.js +67 -0
- package/dist/build-utils/build/loader/probeLoader.d.ts +2 -2
- package/dist/build-utils/build/loader/probeLoader.js +4 -4
- package/dist/build-utils/build/loader/probeLoaderPlugin.d.ts +1 -1
- package/dist/build-utils/build/loader/probeLoaderPlugin.js +1 -1
- package/dist/build-utils/build/module-graph/index.d.ts +0 -1
- package/dist/build-utils/build/module-graph/index.js +0 -1
- package/dist/build-utils/build/module-graph/parser.d.ts +1 -1
- package/dist/build-utils/build/module-graph/parser.js +1 -1
- package/dist/build-utils/build/module-graph/rspack/transform.d.ts +1 -1
- package/dist/build-utils/build/module-graph/rspack/transform.js +6 -4
- package/dist/build-utils/build/module-graph/utils.d.ts +1 -1
- package/dist/build-utils/build/module-graph/utils.js +5 -4
- package/dist/build-utils/build/process.d.ts +2 -0
- package/dist/build-utils/build/process.js +18 -0
- package/dist/build-utils/build/server.d.ts +15 -0
- package/dist/build-utils/build/server.js +107 -0
- package/dist/build-utils/build/utils/loader.d.ts +2 -2
- package/dist/build-utils/build/utils/loader.js +10 -19
- package/dist/build-utils/build/utils/parseBundle.d.ts +1 -1
- package/dist/build-utils/build/utils/parseBundle.js +6 -8
- package/dist/build-utils/build/utils/plugin.d.ts +1 -1
- package/dist/build-utils/index.d.ts +10 -0
- package/dist/build-utils/index.js +12 -2
- package/dist/collection.d.ts +1 -0
- package/dist/collection.js +2 -0
- package/dist/common/file.d.ts +2 -0
- package/dist/common/file.js +8 -0
- package/dist/common/global-config.d.ts +21 -0
- package/dist/common/global-config.js +33 -0
- package/dist/common/index.d.ts +4 -0
- package/dist/common/index.js +6 -0
- package/dist/common-browser.d.ts +1 -0
- package/dist/common-browser.js +2 -0
- package/dist/error/error.d.ts +35 -0
- package/dist/error/error.js +143 -0
- package/dist/error/index.d.ts +2 -0
- package/dist/error/index.js +3 -0
- package/dist/error/transform.d.ts +3 -0
- package/dist/error/transform.js +138 -0
- package/dist/error/utils.d.ts +4 -0
- package/dist/error/utils.js +23 -0
- package/dist/graph/index.d.ts +1 -0
- package/dist/graph/index.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -2
- package/dist/inner-plugins/loaders/proxy.d.ts +4 -4
- package/dist/inner-plugins/plugins/base.d.ts +1 -1
- package/dist/inner-plugins/plugins/bundle.d.ts +1 -1
- package/dist/inner-plugins/plugins/bundle.js +3 -3
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts +3 -3
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +11 -39
- package/dist/inner-plugins/plugins/errors.d.ts +2 -2
- package/dist/inner-plugins/plugins/errors.js +3 -3
- package/dist/inner-plugins/plugins/loader.d.ts +1 -1
- package/dist/inner-plugins/plugins/loader.js +7 -19
- package/dist/inner-plugins/plugins/plugins.d.ts +1 -1
- package/dist/inner-plugins/plugins/plugins.js +2 -2
- package/dist/inner-plugins/plugins/progress.d.ts +2 -2
- package/dist/inner-plugins/plugins/progress.js +2 -2
- package/dist/inner-plugins/plugins/resolver.d.ts +1 -1
- package/dist/inner-plugins/plugins/resolver.js +2 -2
- package/dist/inner-plugins/plugins/rspack.d.ts +8 -3
- package/dist/inner-plugins/plugins/rspack.js +18 -4
- package/dist/inner-plugins/plugins/rules.d.ts +1 -1
- package/dist/inner-plugins/plugins/rules.js +3 -3
- package/dist/inner-plugins/plugins/sourcemapTool.d.ts +2 -2
- package/dist/inner-plugins/plugins/sourcemapTool.js +2 -2
- package/dist/inner-plugins/plugins/summary.d.ts +1 -1
- package/dist/inner-plugins/plugins/summary.js +3 -3
- package/dist/inner-plugins/utils/config.d.ts +2 -3
- package/dist/inner-plugins/utils/config.js +16 -17
- package/dist/inner-plugins/utils/loader.d.ts +4 -7
- package/dist/inner-plugins/utils/loader.js +8 -34
- 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/openBrowser.js +55 -0
- package/dist/inner-plugins/utils/plugin-common.js +4 -4
- package/dist/inner-plugins/utils/plugin.d.ts +1 -1
- package/dist/inner-plugins/utils/plugin.js +1 -1
- package/dist/inner-plugins/utils/sdk.d.ts +2 -3
- package/dist/inner-plugins/utils/sdk.js +2 -2
- package/dist/logger.d.ts +9 -0
- package/dist/logger.js +51 -0
- package/dist/{inner-plugins/constants.d.cts → rspack-plugin/constants.d.ts} +3 -0
- package/dist/rspack-plugin/constants.js +23 -0
- package/dist/rspack-plugin/index.d.ts +2 -0
- package/dist/rspack-plugin/index.js +3 -0
- package/dist/rspack-plugin/multiple.d.ts +8 -0
- package/dist/rspack-plugin/multiple.js +39 -0
- package/dist/rspack-plugin/plugin.d.ts +25 -0
- package/dist/rspack-plugin/plugin.js +133 -0
- package/dist/rule-utils/document/document.d.ts +16 -0
- package/dist/rule-utils/document/document.js +46 -0
- package/dist/rule-utils/document/index.d.ts +3 -0
- package/dist/rule-utils/document/index.js +4 -0
- package/dist/rule-utils/document/server.d.ts +4 -0
- package/dist/rule-utils/document/server.js +13 -0
- package/dist/rule-utils/document/types.d.ts +31 -0
- package/dist/rule-utils/index.d.ts +2 -0
- package/dist/rule-utils/index.js +3 -0
- package/dist/rule-utils/parser/asserts.d.ts +81 -0
- package/dist/rule-utils/parser/asserts.js +105 -0
- package/dist/rule-utils/parser/index.d.ts +4 -0
- package/dist/rule-utils/parser/index.js +5 -0
- package/dist/rule-utils/parser/parser.d.ts +118 -0
- package/dist/rule-utils/parser/parser.js +24 -0
- package/dist/rule-utils/parser/types.d.ts +30 -0
- package/dist/rule-utils/parser/types.js +8 -0
- package/dist/rule-utils/parser/utils.d.ts +30 -0
- package/dist/rule-utils/parser/utils.js +106 -0
- package/dist/rules/linter.d.ts +1 -1
- package/dist/rules/linter.js +1 -1
- package/dist/rules/rule.d.ts +2 -2
- package/dist/rules/rule.js +2 -2
- package/dist/rules/rules/cjs-require/index.d.ts +1 -1
- package/dist/rules/rules/cjs-require/index.js +1 -1
- package/dist/rules/rules/cross-chunks-package/index.d.ts +1 -1
- package/dist/rules/rules/cross-chunks-package/index.js +2 -2
- package/dist/rules/rules/default-import-check/index.d.ts +1 -1
- package/dist/rules/rules/default-import-check/index.js +2 -2
- package/dist/rules/rules/default-import-check/utils.d.ts +2 -2
- package/dist/rules/rules/default-import-check/utils.js +2 -2
- package/dist/rules/rules/duplicate-package/index.d.ts +3 -3
- package/dist/rules/rules/duplicate-package/index.js +3 -3
- package/dist/rules/rules/duplicate-package/utils.d.ts +1 -1
- package/dist/rules/rules/ecma-version-check/index.d.ts +3 -2
- package/dist/rules/rules/ecma-version-check/index.js +1 -1
- package/dist/rules/rules/ecma-version-check/types.d.ts +1 -2
- 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/esm-resolved-to-cjs/index.js +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/index.js +2 -2
- 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/module-mixed-chunks/index.js +1 -1
- package/dist/rules/rules/side-effects-only-imports/index.d.ts +1 -1
- package/dist/rules/rules/side-effects-only-imports/index.js +1 -1
- package/dist/rules/utils.d.ts +1 -1
- package/dist/rules/utils.js +1 -1
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/index.js +3 -0
- package/dist/sdk/multiple/controller.d.ts +12 -0
- package/dist/sdk/multiple/controller.js +42 -0
- package/dist/sdk/multiple/index.d.ts +2 -0
- package/dist/sdk/multiple/index.js +3 -0
- package/dist/sdk/multiple/primary.d.ts +32 -0
- package/dist/sdk/multiple/primary.js +64 -0
- package/dist/sdk/multiple/server.d.ts +7 -0
- package/dist/sdk/multiple/server.js +14 -0
- package/dist/sdk/sdk/core.d.ts +33 -0
- package/dist/sdk/sdk/core.js +163 -0
- package/dist/sdk/sdk/index.d.ts +52 -0
- package/dist/sdk/sdk/index.js +435 -0
- package/dist/sdk/sdk/types.d.ts +26 -0
- package/dist/sdk/sdk/types.js +1 -0
- package/dist/sdk/server/apis/alerts.d.ts +5 -0
- package/dist/sdk/server/apis/alerts.js +30 -0
- package/dist/sdk/server/apis/base.d.ts +11 -0
- package/dist/sdk/server/apis/base.js +22 -0
- package/dist/sdk/server/apis/bundle-diff.d.ts +6 -0
- package/dist/sdk/server/apis/bundle-diff.js +51 -0
- package/dist/sdk/server/apis/data.d.ts +6 -0
- package/dist/sdk/server/apis/data.js +44 -0
- package/dist/sdk/server/apis/fs.d.ts +5 -0
- package/dist/sdk/server/apis/fs.js +28 -0
- package/dist/sdk/server/apis/graph.d.ts +12 -0
- package/dist/sdk/server/apis/graph.js +116 -0
- package/dist/sdk/server/apis/index.d.ts +10 -0
- package/dist/sdk/server/apis/index.js +11 -0
- package/dist/sdk/server/apis/loader.d.ts +15 -0
- package/dist/sdk/server/apis/loader.js +120 -0
- package/dist/sdk/server/apis/plugin.d.ts +6 -0
- package/dist/sdk/server/apis/plugin.js +39 -0
- package/dist/sdk/server/apis/project.d.ts +8 -0
- package/dist/sdk/server/apis/project.js +59 -0
- package/dist/sdk/server/apis/renderer.d.ts +6 -0
- package/dist/sdk/server/apis/renderer.js +33 -0
- package/dist/sdk/server/apis/resolver.d.ts +6 -0
- package/dist/sdk/server/apis/resolver.js +38 -0
- package/dist/sdk/server/client.d.ts +3 -0
- package/dist/sdk/server/client.js +8 -0
- package/dist/sdk/server/fakeServer.d.ts +9 -0
- package/dist/sdk/server/fakeServer.js +12 -0
- package/dist/sdk/server/index.d.ts +44 -0
- package/dist/sdk/server/index.js +292 -0
- package/dist/sdk/server/json-body.d.ts +6 -0
- package/dist/sdk/server/json-body.js +150 -0
- package/dist/sdk/server/router.d.ts +24 -0
- package/dist/sdk/server/router.js +83 -0
- package/dist/sdk/server/security.d.ts +5 -0
- package/dist/sdk/server/security.js +47 -0
- package/dist/sdk/server/socket/api.d.ts +15 -0
- package/dist/sdk/server/socket/api.js +22 -0
- package/dist/sdk/server/socket/index.d.ts +48 -0
- package/dist/sdk/server/socket/index.js +166 -0
- package/dist/sdk/server/utils.d.ts +6 -0
- package/dist/sdk/server/utils.js +19 -0
- package/dist/sdk/utils/base.d.ts +1 -0
- package/dist/sdk/utils/base.js +22 -0
- package/dist/sdk/utils/constant.d.ts +1 -0
- package/dist/sdk/utils/constant.js +4 -0
- package/dist/sdk/utils/index.d.ts +3 -0
- package/dist/sdk/utils/index.js +4 -0
- package/dist/sdk/utils/openBrowser.d.ts +4 -0
- package/dist/sdk/utils/openBrowser.js +53 -0
- package/dist/sdk/utils/upload.d.ts +2 -0
- package/dist/sdk/utils/upload.js +6 -0
- package/dist/sdk.d.ts +1 -0
- package/dist/sdk.js +2 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js +0 -1
- package/dist/types/loader.d.ts +1 -1
- package/dist/types/plugin.d.ts +7 -28
- package/package.json +127 -58
- 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/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/rspack/transform.cjs +0 -80
- package/dist/build-utils/build/chunks/rspack/transform.d.cts +0 -13
- package/dist/build-utils/build/index.cjs +0 -52
- package/dist/build-utils/build/index.d.cts +0 -5
- 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/probeLoader.cjs +0 -89
- package/dist/build-utils/build/loader/probeLoader.d.cts +0 -4
- 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/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/parser.cjs +0 -46
- package/dist/build-utils/build/module-graph/parser.d.cts +0 -2
- 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/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/utils/index.cjs +0 -72
- package/dist/build-utils/build/utils/index.d.cts +0 -3
- 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/parseBundle.cjs +0 -283
- package/dist/build-utils/build/utils/parseBundle.d.cts +0 -12
- 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/index.cjs +0 -36
- package/dist/build-utils/index.d.cts +0 -1
- 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/index.cjs +0 -65
- package/dist/inner-plugins/index.d.cts +0 -2
- package/dist/inner-plugins/loaders/proxy.cjs +0 -104
- package/dist/inner-plugins/loaders/proxy.d.cts +0 -7
- package/dist/inner-plugins/plugins/base.cjs +0 -53
- package/dist/inner-plugins/plugins/base.d.cts +0 -12
- package/dist/inner-plugins/plugins/bundle.cjs +0 -96
- package/dist/inner-plugins/plugins/bundle.d.cts +0 -15
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.cjs +0 -141
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.cts +0 -34
- package/dist/inner-plugins/plugins/errors.cjs +0 -98
- package/dist/inner-plugins/plugins/errors.d.cts +0 -11
- package/dist/inner-plugins/plugins/index.cjs +0 -121
- package/dist/inner-plugins/plugins/index.d.cts +0 -10
- package/dist/inner-plugins/plugins/loader.cjs +0 -165
- package/dist/inner-plugins/plugins/loader.d.cts +0 -10
- package/dist/inner-plugins/plugins/plugins.cjs +0 -73
- package/dist/inner-plugins/plugins/plugins.d.cts +0 -8
- package/dist/inner-plugins/plugins/progress.cjs +0 -68
- package/dist/inner-plugins/plugins/progress.d.cts +0 -8
- package/dist/inner-plugins/plugins/resolver.cjs +0 -90
- package/dist/inner-plugins/plugins/resolver.d.cts +0 -12
- package/dist/inner-plugins/plugins/rspack.cjs +0 -118
- package/dist/inner-plugins/plugins/rspack.d.cts +0 -4
- package/dist/inner-plugins/plugins/rules.cjs +0 -97
- package/dist/inner-plugins/plugins/rules.d.cts +0 -8
- package/dist/inner-plugins/plugins/sourcemapTool.cjs +0 -275
- package/dist/inner-plugins/plugins/sourcemapTool.d.cts +0 -52
- package/dist/inner-plugins/plugins/summary.cjs +0 -125
- package/dist/inner-plugins/plugins/summary.d.cts +0 -14
- package/dist/inner-plugins/utils/circleDetect.cjs +0 -49
- package/dist/inner-plugins/utils/circleDetect.d.cts +0 -4
- package/dist/inner-plugins/utils/config.cjs +0 -191
- package/dist/inner-plugins/utils/config.d.cts +0 -5
- package/dist/inner-plugins/utils/index.cjs +0 -106
- package/dist/inner-plugins/utils/index.d.cts +0 -9
- package/dist/inner-plugins/utils/loader.cjs +0 -218
- package/dist/inner-plugins/utils/loader.d.cts +0 -13
- 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/plugin-common.cjs +0 -143
- package/dist/inner-plugins/utils/plugin-common.d.cts +0 -11
- package/dist/inner-plugins/utils/plugin.cjs +0 -106
- package/dist/inner-plugins/utils/plugin.d.cts +0 -4
- package/dist/inner-plugins/utils/sdk.cjs +0 -55
- package/dist/inner-plugins/utils/sdk.d.cts +0 -8
- package/dist/rslib-runtime.js +0 -19
- package/dist/rules/index.cjs +0 -81
- package/dist/rules/index.d.cts +0 -3
- package/dist/rules/linter.cjs +0 -72
- package/dist/rules/linter.d.cts +0 -9
- package/dist/rules/rule.cjs +0 -137
- package/dist/rules/rule.d.cts +0 -27
- 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/types.cjs +0 -18
- package/dist/rules/rules/cjs-require/types.d.cts +0 -7
- 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/types.cjs +0 -18
- package/dist/rules/rules/cross-chunks-package/types.d.cts +0 -3
- 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/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/types.cjs +0 -18
- package/dist/rules/rules/default-import-check/types.d.cts +0 -4
- 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/duplicate-package/index.cjs +0 -72
- package/dist/rules/rules/duplicate-package/index.d.cts +0 -4
- 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/utils.cjs +0 -84
- package/dist/rules/rules/duplicate-package/utils.d.cts +0 -3
- 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/types.cjs +0 -18
- package/dist/rules/rules/ecma-version-check/types.d.cts +0 -3
- 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/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/types.cjs +0 -18
- package/dist/rules/rules/esm-resolved-to-cjs/types.d.cts +0 -8
- package/dist/rules/rules/index.cjs +0 -55
- package/dist/rules/rules/index.d.cts +0 -2
- 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/types.cjs +0 -18
- package/dist/rules/rules/loader-performance-optimization/types.d.cts +0 -22
- 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/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/types.cjs +0 -18
- package/dist/rules/rules/module-mixed-chunks/types.d.cts +0 -3
- 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/types.cjs +0 -18
- package/dist/rules/rules/side-effects-only-imports/types.d.cts +0 -9
- package/dist/rules/utils.cjs +0 -46
- package/dist/rules/utils.d.cts +0 -3
- 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/index.cjs +0 -79
- package/dist/types/index.d.cts +0 -4
- package/dist/types/loader.cjs +0 -18
- package/dist/types/loader.d.cts +0 -19
- package/dist/types/plugin.cjs +0 -18
- package/dist/types/plugin.d.cts +0 -51
- package/dist/types/rules.cjs +0 -18
- package/dist/types/rules.d.cts +0 -7
- /package/dist/{types/chunks.js → rule-utils/document/types.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Plugin } from '@rsdoctor/types';
|
|
1
|
+
import { Plugin } from '@rsdoctor/shared/types';
|
|
2
2
|
import { InternalBasePlugin } from './base.js';
|
|
3
3
|
export declare class InternalBundlePlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
4
4
|
readonly name = "bundle";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { Manifest } from "@rsdoctor/types";
|
|
2
|
+
import { Manifest } from "@rsdoctor/shared/types";
|
|
3
3
|
import { InternalBasePlugin } from "./base.js";
|
|
4
|
-
import { Chunks } from "
|
|
5
|
-
import { logger, time, timeEnd } from "
|
|
4
|
+
import { Chunks } from "../../graph/index.js";
|
|
5
|
+
import { logger, time, timeEnd } from "../../logger.js";
|
|
6
6
|
class InternalBundlePlugin extends InternalBasePlugin {
|
|
7
7
|
apply(compiler) {
|
|
8
8
|
time('InternalBundlePlugin.apply');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RsdoctorPluginInstance } from '../../types/index.js';
|
|
2
|
-
import { Linter, Plugin } from '@rsdoctor/types';
|
|
1
|
+
import type { RsdoctorPluginInstance } from '../../types/index.js';
|
|
2
|
+
import { Linter, Plugin } from '@rsdoctor/shared/types';
|
|
3
3
|
/**
|
|
4
4
|
* Represents a mapping item from a source map.
|
|
5
5
|
*/
|
|
@@ -13,7 +13,7 @@ export interface MappingItem {
|
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Main function to generate ModuleGraph and ChunkGraph from Rspack native data
|
|
16
|
-
*
|
|
16
|
+
* and collect source maps.
|
|
17
17
|
*/
|
|
18
18
|
export declare const ensureModulesChunksGraphFn: (compiler: Plugin.BaseCompiler, _this: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData[]>) => void;
|
|
19
19
|
/**
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Chunks, ModuleGraph } from "../../build-utils/build/index.js";
|
|
2
|
+
import { chalk, logger } from "../../logger.js";
|
|
3
|
+
import { Chunks } from "../../build-utils/build/index.js";
|
|
5
4
|
import { internalPluginTapPreOptions, pluginTapPostOptions } from "../constants.js";
|
|
6
|
-
import { applyRspackNativePlugin } from "./rspack.js";
|
|
5
|
+
import { applyRspackNativePlugin, getRspackNativePlugin } from "./rspack.js";
|
|
7
6
|
import { handleAfterEmitAssets } from "./sourcemapTool.js";
|
|
8
7
|
let hasConsole = false;
|
|
9
8
|
const ensureModulesChunksGraphFn = (compiler, _this)=>{
|
|
10
9
|
if (_this._modulesGraphApplied) return;
|
|
10
|
+
const RsdoctorRspackPlugin = getRspackNativePlugin(compiler);
|
|
11
11
|
_this._modulesGraphApplied = true;
|
|
12
|
-
const
|
|
13
|
-
if (RsdoctorRspackPlugin) applyRspackNativePlugin(compiler, _this, RsdoctorRspackPlugin);
|
|
12
|
+
const nativeGraphState = applyRspackNativePlugin(compiler, _this, RsdoctorRspackPlugin);
|
|
14
13
|
if (!_this._realSourcePathCache) _this._realSourcePathCache = new Map();
|
|
15
|
-
compiler.hooks.done.tapPromise(internalPluginTapPreOptions('moduleGraph'), async (
|
|
16
|
-
await doneHandler(
|
|
14
|
+
compiler.hooks.done.tapPromise(internalPluginTapPreOptions('moduleGraph'), async ()=>{
|
|
15
|
+
await doneHandler(_this, compiler, nativeGraphState);
|
|
17
16
|
});
|
|
18
17
|
compiler.hooks.compilation.tap({
|
|
19
18
|
...pluginTapPostOptions,
|
|
@@ -29,40 +28,13 @@ const ensureModulesChunksGraphFn = (compiler, _this)=>{
|
|
|
29
28
|
});
|
|
30
29
|
});
|
|
31
30
|
};
|
|
32
|
-
async function doneHandler(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
let cached = null;
|
|
36
|
-
return ()=>{
|
|
37
|
-
if (cached) return cached;
|
|
38
|
-
cached = stats.toJson({
|
|
39
|
-
all: false,
|
|
40
|
-
chunks: true,
|
|
41
|
-
modules: true,
|
|
42
|
-
chunkModules: true,
|
|
43
|
-
assets: true,
|
|
44
|
-
ids: true,
|
|
45
|
-
hash: true,
|
|
46
|
-
errors: true,
|
|
47
|
-
warnings: true,
|
|
48
|
-
nestedModules: true,
|
|
49
|
-
cachedModules: true,
|
|
50
|
-
orphanModules: true,
|
|
51
|
-
runtimeModules: true,
|
|
52
|
-
optimizationBailout: true
|
|
53
|
-
});
|
|
54
|
-
return cached;
|
|
55
|
-
};
|
|
56
|
-
})();
|
|
57
|
-
logger.debug(`${(Process.getMemoryUsageMessage(), '[Before Generate ModuleGraph]')}`);
|
|
58
|
-
if (!_this.chunkGraph?.getChunks().length) _this.chunkGraph = Chunks.chunkTransform(new Map(), getStatsJson());
|
|
59
|
-
if (!_this.modulesGraph.getModules().length) _this.modulesGraph = await ModuleGraph.getModuleGraphByStats(stats.compilation, getStatsJson(), process.cwd(), _this.chunkGraph, _this.options.features);
|
|
60
|
-
logger.debug(`${(Process.getMemoryUsageMessage(), '[After Generate ModuleGraph]')}`);
|
|
31
|
+
async function doneHandler(_this, compiler, nativeGraphState) {
|
|
32
|
+
if (!nativeGraphState.chunkGraph || !_this.chunkGraph) throw new Error('[RsdoctorRspackPlugin] The Rspack native plugin did not provide chunk graph data.');
|
|
33
|
+
if (!nativeGraphState.moduleGraph) throw new Error('[RsdoctorRspackPlugin] The Rspack native plugin did not provide module graph data.');
|
|
61
34
|
const shouldParseBundle = false !== _this.options.supports.parseBundle;
|
|
62
35
|
await getModulesInfos(compiler, _this.modulesGraph, _this.chunkGraph, shouldParseBundle, _this.sourceMapSets, _this.assetsWithoutSourceMap);
|
|
63
|
-
logger.debug(`${Process.getMemoryUsageMessage()}, '[After Transform ModuleGraph]'`);
|
|
64
36
|
logger.debug('reportModuleGraph start');
|
|
65
|
-
|
|
37
|
+
await _this.sdk.reportModuleGraph(_this.modulesGraph);
|
|
66
38
|
logger.debug('reportModuleGraph done');
|
|
67
39
|
logger.debug('reportChunkGraph start');
|
|
68
40
|
await _this.sdk.reportChunkGraph(_this.chunkGraph);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Rule, Err, Plugin } from '@rsdoctor/types';
|
|
1
|
+
import { Rule, Err, Plugin } from '@rsdoctor/shared/types';
|
|
2
2
|
import { InternalBasePlugin } from './base.js';
|
|
3
|
-
import { DevToolError } from '
|
|
3
|
+
import { DevToolError } from '../../error/index.js';
|
|
4
4
|
export declare class InternalErrorReporterPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
5
5
|
readonly name = "error-reporter";
|
|
6
6
|
apply(compiler: T): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { Rule } from "@rsdoctor/types";
|
|
2
|
+
import { Rule } from "@rsdoctor/shared/types";
|
|
3
3
|
import { InternalBasePlugin } from "./base.js";
|
|
4
|
-
import { DevToolError } from "
|
|
5
|
-
import { time, timeEnd } from "
|
|
4
|
+
import { DevToolError } from "../../error/index.js";
|
|
5
|
+
import { time, timeEnd } from "../../logger.js";
|
|
6
6
|
class InternalErrorReporterPlugin extends InternalBasePlugin {
|
|
7
7
|
apply(compiler) {
|
|
8
8
|
time('InternalErrorReporterPlugin.apply');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Plugin } from '@rsdoctor/types';
|
|
1
|
+
import { Plugin } from '@rsdoctor/shared/types';
|
|
2
2
|
import { InternalBasePlugin } from './base.js';
|
|
3
3
|
export declare class InternalLoaderPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
4
4
|
readonly name = "loader";
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { isEqual, omit } from "es-toolkit/compat";
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { Manifest } from "@rsdoctor/shared/types";
|
|
3
|
+
import { Loader } from "../../common/index.js";
|
|
4
|
+
import { isEqual, omit } from "../../collection.js";
|
|
6
5
|
import { interceptLoader } from "../utils/index.js";
|
|
7
6
|
import { InternalBasePlugin } from "./base.js";
|
|
8
|
-
import { time, timeEnd } from "
|
|
9
|
-
import path from "path";
|
|
7
|
+
import { time, timeEnd } from "../../logger.js";
|
|
10
8
|
import { fileURLToPath } from "url";
|
|
11
9
|
import { safeCloneDeep } from "../utils/plugin-common.js";
|
|
12
|
-
const loader_filename = fileURLToPath(import.meta.url);
|
|
13
|
-
const loader_dirname = path.dirname(loader_filename);
|
|
14
10
|
class InternalLoaderPlugin extends InternalBasePlugin {
|
|
15
11
|
apply(compiler) {
|
|
16
12
|
time('InternalLoaderPlugin.apply');
|
|
@@ -92,18 +88,10 @@ class InternalLoaderPlugin extends InternalBasePlugin {
|
|
|
92
88
|
cwd: compiler.context || process.cwd(),
|
|
93
89
|
host: this.sdk.server.origin,
|
|
94
90
|
skipLoaders: this.options.loaderInterceptorOptions.skipLoaders
|
|
95
|
-
},
|
|
91
|
+
}, compiler.resolverFactory.get('loader', compiler.options.resolveLoader), this.sdk.root);
|
|
96
92
|
}
|
|
97
93
|
constructor(...args){
|
|
98
|
-
super(...args), this.name = 'loader', this.internalLoaderPath = (()=>{
|
|
99
|
-
const isCJS = loader_filename.endsWith('.cjs');
|
|
100
|
-
if (isCJS) return require.resolve(path.join(loader_dirname, "../loaders/proxy.cjs"));
|
|
101
|
-
try {
|
|
102
|
-
return require.resolve(path.join(loader_dirname, "../loaders/proxy.js"));
|
|
103
|
-
} catch {
|
|
104
|
-
return require.resolve(path.join(loader_dirname, "../loaders/proxy.cjs"));
|
|
105
|
-
}
|
|
106
|
-
})(), this.afterPlugins = (compiler)=>{
|
|
94
|
+
super(...args), this.name = 'loader', this.internalLoaderPath = fileURLToPath(new URL('../loaders/proxy.js', import.meta.url)), this.afterPlugins = (compiler)=>{
|
|
107
95
|
time('InternalLoaderPlugin.afterPlugins');
|
|
108
96
|
try {
|
|
109
97
|
if (compiler.isChild()) return;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Plugin } from '@rsdoctor/types';
|
|
1
|
+
import { Plugin } from '@rsdoctor/shared/types';
|
|
2
2
|
import { InternalBasePlugin } from './base.js';
|
|
3
3
|
export declare class InternalPluginsPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
4
4
|
readonly name = "plugins";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { Manifest } from "@rsdoctor/types";
|
|
2
|
+
import { Manifest } from "@rsdoctor/shared/types";
|
|
3
3
|
import { Utils } from "../../build-utils/build/index.js";
|
|
4
4
|
import { interceptPluginHook } from "../utils/index.js";
|
|
5
5
|
import { InternalBasePlugin } from "./base.js";
|
|
6
|
-
import { time, timeEnd } from "
|
|
6
|
+
import { time, timeEnd } from "../../logger.js";
|
|
7
7
|
class InternalPluginsPlugin extends InternalBasePlugin {
|
|
8
8
|
apply(compiler) {
|
|
9
9
|
time('InternalPluginsPlugin.apply');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SDK } from '@rsdoctor/types';
|
|
2
|
-
import type { Plugin } from '@rsdoctor/types';
|
|
1
|
+
import { SDK } from '@rsdoctor/shared/types';
|
|
2
|
+
import type { Plugin } from '@rsdoctor/shared/types';
|
|
3
3
|
import { InternalBasePlugin } from './base.js';
|
|
4
4
|
export declare class InternalProgressPlugin<T extends Plugin.BaseCompilerType<'rspack'>> extends InternalBasePlugin<T> {
|
|
5
5
|
readonly name = "progress";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { SDK } from "@rsdoctor/types";
|
|
2
|
+
import { SDK } from "@rsdoctor/shared/types";
|
|
3
3
|
import { InternalBasePlugin } from "./base.js";
|
|
4
|
-
import { logger } from "
|
|
4
|
+
import { logger } from "../../logger.js";
|
|
5
5
|
class InternalProgressPlugin extends InternalBasePlugin {
|
|
6
6
|
apply(compiler) {
|
|
7
7
|
const { sdk, currentProgress } = this;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Plugin } from '@rsdoctor/types';
|
|
1
|
+
import { Plugin } from '@rsdoctor/shared/types';
|
|
2
2
|
import { InternalBasePlugin } from './base.js';
|
|
3
3
|
export declare class InternalResolverPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
4
4
|
readonly name = "resolver";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { Manifest } from "@rsdoctor/types";
|
|
3
|
-
import { Time } from "
|
|
2
|
+
import { Manifest } from "@rsdoctor/shared/types";
|
|
3
|
+
import { Time } from "../../common/index.js";
|
|
4
4
|
import { InternalBasePlugin } from "./base.js";
|
|
5
5
|
class InternalResolverPlugin extends InternalBasePlugin {
|
|
6
6
|
apply(compiler) {
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { Linter, Plugin } from '@rsdoctor/types';
|
|
1
|
+
import { Linter, Plugin } from '@rsdoctor/shared/types';
|
|
2
2
|
import type { experiments } from '@rspack/core';
|
|
3
|
-
import { RsdoctorPluginInstance } from '../../types/index.js';
|
|
4
|
-
export
|
|
3
|
+
import type { RsdoctorPluginInstance } from '../../types/index.js';
|
|
4
|
+
export interface RspackNativeGraphState {
|
|
5
|
+
chunkGraph: boolean;
|
|
6
|
+
moduleGraph: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function getRspackNativePlugin(compiler: Plugin.BaseCompiler): typeof experiments.RsdoctorPlugin;
|
|
9
|
+
export declare function applyRspackNativePlugin(compiler: Plugin.BaseCompiler, plugin: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData[]>, RsdoctorRspackPlugin: typeof experiments.RsdoctorPlugin): RspackNativeGraphState;
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { ChunkGraph } from "
|
|
2
|
+
import { ChunkGraph } from "../../graph/index.js";
|
|
3
3
|
import { Chunks, ModuleGraph } from "../../build-utils/build/index.js";
|
|
4
4
|
import { internalPluginTapPreOptions } from "../constants.js";
|
|
5
|
-
import { logger } from "
|
|
5
|
+
import { logger } from "../../logger.js";
|
|
6
|
+
function getRspackNativePlugin(compiler) {
|
|
7
|
+
const RsdoctorRspackPlugin = compiler.webpack.experiments?.RsdoctorPlugin;
|
|
8
|
+
if (!RsdoctorRspackPlugin) throw new Error('[RsdoctorRspackPlugin] The current Rspack version does not provide experiments.RsdoctorPlugin. Please upgrade Rspack.');
|
|
9
|
+
return RsdoctorRspackPlugin;
|
|
10
|
+
}
|
|
6
11
|
function applyRspackNativePlugin(compiler, plugin, RsdoctorRspackPlugin) {
|
|
12
|
+
const state = {
|
|
13
|
+
chunkGraph: false,
|
|
14
|
+
moduleGraph: false
|
|
15
|
+
};
|
|
7
16
|
logger.debug('[RspackNativePlugin] Apply hooks');
|
|
8
17
|
compiler.hooks.compilation.tap('RsdoctorRspackPlugin', (compilation)=>{
|
|
18
|
+
state.chunkGraph = false;
|
|
19
|
+
state.moduleGraph = false;
|
|
9
20
|
const hooks = RsdoctorRspackPlugin.getCompilationHooks(compilation);
|
|
10
21
|
const cached = {};
|
|
11
22
|
const dependOn = {
|
|
@@ -27,16 +38,18 @@ function applyRspackNativePlugin(compiler, plugin, RsdoctorRspackPlugin) {
|
|
|
27
38
|
chunkGraphData: (data)=>{
|
|
28
39
|
plugin.chunkGraph = new ChunkGraph();
|
|
29
40
|
Chunks.patchNativeChunkGraph(plugin.chunkGraph, data);
|
|
41
|
+
state.chunkGraph = true;
|
|
30
42
|
},
|
|
31
43
|
moduleGraphData: (data)=>{
|
|
32
44
|
ModuleGraph.patchNativeModuleGraph(plugin.modulesGraph, plugin.chunkGraph, data);
|
|
45
|
+
state.moduleGraph = true;
|
|
33
46
|
},
|
|
34
47
|
moduleIdsPatchData: (data)=>{
|
|
35
48
|
ModuleGraph.patchNativeModuleIds(plugin.modulesGraph, data);
|
|
36
49
|
},
|
|
37
50
|
moduleSourcesPatchData: (data)=>{
|
|
38
51
|
ModuleGraph.patchNativeModuleSources(plugin.modulesGraph, data);
|
|
39
|
-
ModuleGraph.extractSideEffectCodes(plugin.modulesGraph);
|
|
52
|
+
if (plugin.options.features.treeShaking) ModuleGraph.extractSideEffectCodes(plugin.modulesGraph);
|
|
40
53
|
},
|
|
41
54
|
assetPatchData: (data)=>{
|
|
42
55
|
Chunks.patchNativeAssets(plugin.chunkGraph, data);
|
|
@@ -81,5 +94,6 @@ function applyRspackNativePlugin(compiler, plugin, RsdoctorRspackPlugin) {
|
|
|
81
94
|
tryConsumeData('assetPatchData', rawAssetPatch);
|
|
82
95
|
});
|
|
83
96
|
});
|
|
97
|
+
return state;
|
|
84
98
|
}
|
|
85
|
-
export { applyRspackNativePlugin };
|
|
99
|
+
export { applyRspackNativePlugin, getRspackNativePlugin };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InternalBasePlugin } from './base.js';
|
|
2
|
-
import { Plugin } from '@rsdoctor/types';
|
|
2
|
+
import { Plugin } from '@rsdoctor/shared/types';
|
|
3
3
|
export declare class InternalRulesPlugin extends InternalBasePlugin<Plugin.BaseCompiler> {
|
|
4
4
|
readonly name = "rules";
|
|
5
5
|
apply(compiler: Plugin.BaseCompiler): void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { InternalBasePlugin } from "./base.js";
|
|
3
3
|
import { Linter } from "../../rules/index.js";
|
|
4
|
-
import { DevToolError } from "
|
|
5
|
-
import { pull } from "
|
|
6
|
-
import { time, timeEnd } from "
|
|
4
|
+
import { DevToolError } from "../../error/index.js";
|
|
5
|
+
import { pull } from "../../collection.js";
|
|
6
|
+
import { time, timeEnd } from "../../logger.js";
|
|
7
7
|
class InternalRulesPlugin extends InternalBasePlugin {
|
|
8
8
|
apply(compiler) {
|
|
9
9
|
time('InternalRulesPlugin.apply');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RsdoctorPluginInstance } from '../../types/index.js';
|
|
2
|
-
import { Linter, Plugin } from '@rsdoctor/types';
|
|
1
|
+
import type { RsdoctorPluginInstance } from '../../types/index.js';
|
|
2
|
+
import { Linter, Plugin } from '@rsdoctor/shared/types';
|
|
3
3
|
export declare const UNASSIGNED = "[unassigned]";
|
|
4
4
|
/**
|
|
5
5
|
* Options for handling source map assets.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { Graph } from "
|
|
3
|
-
import { logger, time, timeEnd } from "
|
|
2
|
+
import { Graph } from "../../common/index.js";
|
|
3
|
+
import { logger, time, timeEnd } from "../../logger.js";
|
|
4
4
|
import { dirname, isAbsolute, resolve } from "path";
|
|
5
5
|
import { SourceMapConsumer } from "source-map";
|
|
6
6
|
const UNASSIGNED = '[unassigned]';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Plugin } from '@rsdoctor/types';
|
|
1
|
+
import type { Plugin } from '@rsdoctor/shared/types';
|
|
2
2
|
import { InternalBasePlugin } from './base.js';
|
|
3
3
|
export declare class InternalSummaryPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
4
4
|
readonly name = "summary";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { Summary } from "
|
|
3
|
-
import { minBy, sumBy } from "
|
|
2
|
+
import { Summary } from "../../common/index.js";
|
|
3
|
+
import { minBy, sumBy } from "../../collection.js";
|
|
4
4
|
import { InternalBasePlugin } from "./base.js";
|
|
5
|
-
import { time, timeEnd } from "
|
|
5
|
+
import { time, timeEnd } from "../../logger.js";
|
|
6
6
|
class InternalSummaryPlugin extends InternalBasePlugin {
|
|
7
7
|
apply(compiler) {
|
|
8
8
|
time('InternalSummaryPlugin.apply');
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Linter, Plugin, SDK } from '@rsdoctor/types';
|
|
1
|
+
import { Linter, Plugin, SDK } from '@rsdoctor/shared/types';
|
|
3
2
|
export declare function normalizeUserConfig<Rules extends Linter.ExtendRuleData[]>(config?: Plugin.RsdoctorRspackPluginOptions<Rules>): Plugin.RsdoctorPluginOptionsNormalized<Rules>;
|
|
4
3
|
export declare const normalizeReportType: (reportCodeType: Plugin.IReportCodeType | Plugin.NewReportCodeType, mode: keyof typeof SDK.IMode) => SDK.ToDataType;
|
|
5
|
-
export declare
|
|
4
|
+
export declare const normalizeRspackUserOptions: typeof normalizeUserConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { SDK } from "@rsdoctor/types";
|
|
3
|
-
import { chalk, logger } from "
|
|
2
|
+
import { SDK } from "@rsdoctor/shared/types";
|
|
3
|
+
import { chalk, logger } from "../../logger.js";
|
|
4
4
|
import assert from "assert";
|
|
5
5
|
import { convertReportCodeTypeObject, processModeConfigurations } from "./normalize-config.js";
|
|
6
6
|
function defaultBoolean(v, dft) {
|
|
@@ -78,14 +78,25 @@ function normalizeUserConfig(config = {}) {
|
|
|
78
78
|
...config,
|
|
79
79
|
output: outputConfig
|
|
80
80
|
};
|
|
81
|
-
const { linter = {}, features = {}, loaderInterceptorOptions = {}, disableClientServer: userDisableClientServer = false, sdkInstance, innerClientPath = '', output = outputConfig, supports =
|
|
81
|
+
const { linter = {}, features = {}, loaderInterceptorOptions = {}, disableClientServer: userDisableClientServer = false, sdkInstance, innerClientPath = '', output = outputConfig, supports: userSupports = {}, port, server: userServer = {}, printLog = {
|
|
82
82
|
serverUrls: true
|
|
83
83
|
}, mode, brief } = normalizedConfig;
|
|
84
|
+
const supports = {
|
|
85
|
+
...getDefaultSupports(),
|
|
86
|
+
...userSupports
|
|
87
|
+
};
|
|
84
88
|
const disableClientServer = 'true' === process.env.RSTEST ? false : process.env.CI ? true : userDisableClientServer;
|
|
85
89
|
assert('object' == typeof linter);
|
|
86
90
|
assert('object' == typeof features || Array.isArray(features));
|
|
87
91
|
assert('object' == typeof loaderInterceptorOptions);
|
|
88
92
|
assert('boolean' == typeof disableClientServer);
|
|
93
|
+
assert(void 0 === port || 'number' == typeof port);
|
|
94
|
+
assert('object' == typeof userServer && null !== userServer);
|
|
95
|
+
const server = {
|
|
96
|
+
...userServer
|
|
97
|
+
};
|
|
98
|
+
assert(void 0 === server.port || 'number' == typeof server.port);
|
|
99
|
+
if (void 0 === server.port && void 0 !== port) server.port = port;
|
|
89
100
|
let finalMode = ('mode' in output && isValidMode(output.mode) ? 'lite' === output.mode ? SDK.IMode[SDK.IMode.normal] : output.mode : void 0) || mode || SDK.IMode[SDK.IMode.normal];
|
|
90
101
|
if (mode) logger.info(chalk.yellow("The 'mode' configuration will be deprecated in a future version. Please use 'output.mode' instead."));
|
|
91
102
|
const _features = normalizeFeatures(features, finalMode);
|
|
@@ -111,6 +122,7 @@ function normalizeUserConfig(config = {}) {
|
|
|
111
122
|
innerClientPath,
|
|
112
123
|
supports,
|
|
113
124
|
port,
|
|
125
|
+
server,
|
|
114
126
|
printLog
|
|
115
127
|
};
|
|
116
128
|
if (void 0 !== output.compressData) logger.info(chalk.yellow("The 'compressData' configuration will be deprecated in a future version."));
|
|
@@ -125,18 +137,5 @@ const normalizeReportType = (reportCodeType, mode)=>{
|
|
|
125
137
|
if ('noModuleSource' === convertedReportCodeType) return SDK.ToDataType.NoSource;
|
|
126
138
|
return SDK.ToDataType.Normal;
|
|
127
139
|
};
|
|
128
|
-
|
|
129
|
-
const config = normalizeUserConfig(options);
|
|
130
|
-
config.experiments ??= {
|
|
131
|
-
enableNativePlugin: {
|
|
132
|
-
moduleGraph: true,
|
|
133
|
-
chunkGraph: true
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
if ('boolean' == typeof options.experiments?.enableNativePlugin && options.experiments?.enableNativePlugin === false) config.experiments.enableNativePlugin = {
|
|
137
|
-
moduleGraph: false,
|
|
138
|
-
chunkGraph: false
|
|
139
|
-
};
|
|
140
|
-
return config;
|
|
141
|
-
}
|
|
140
|
+
const normalizeRspackUserOptions = normalizeUserConfig;
|
|
142
141
|
export { normalizeReportType, normalizeRspackUserOptions, normalizeUserConfig };
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SDK, Plugin } from '@rsdoctor/types';
|
|
1
|
+
import { SDK, Plugin } from '@rsdoctor/shared/types';
|
|
3
2
|
import { ProxyLoaderInternalOptions, ProxyLoaderOptions } from '../../types/index.js';
|
|
4
3
|
import { Utils as BuildUtils } from '../../build-utils/build/index.js';
|
|
5
4
|
export declare function getInternalLoaderOptions(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): ProxyLoaderInternalOptions;
|
|
6
|
-
export declare function getLoaderOptionsWithoutInternalKeys(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>):
|
|
5
|
+
export declare function getLoaderOptionsWithoutInternalKeys(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): Record<string, any>;
|
|
7
6
|
export declare function getOriginLoaderModule(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): ReturnType<typeof BuildUtils.loadLoaderModule>;
|
|
8
7
|
export declare function shouldSkipLoader(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): boolean;
|
|
9
|
-
export type
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
export declare function interceptLoader<T extends Plugin.BuildRuleSetRule>(rules: T[], loaderPath: string, options: Omit<ProxyLoaderInternalOptions, 'loader' | 'hasOptions'>, cwd?: string, resolveLoader?: CompatibleResolve): T[];
|
|
8
|
+
export type LoaderResolver = ReturnType<Plugin.BaseCompiler['resolverFactory']['get']>;
|
|
9
|
+
export declare function interceptLoader<T extends Plugin.BuildRuleSetRule>(rules: T[], loaderPath: string, options: Omit<ProxyLoaderInternalOptions, 'loader' | 'hasOptions'>, loaderResolver: LoaderResolver, cwd?: string): T[];
|
|
13
10
|
export declare function reportLoader(ctx: Plugin.LoaderContext<ProxyLoaderOptions>, start: number, startHRTime: [number, number], isPitch: boolean, sync: boolean, code: string, err: Error | null | undefined, res: string | Buffer | null, sourceMap?: Plugin.SourceMapInput): Promise<SDK.LoaderData>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import {
|
|
3
|
-
import { omit } from "es-toolkit/compat";
|
|
2
|
+
import { omit } from "../../collection.js";
|
|
4
3
|
import path from "path";
|
|
5
|
-
import { logger } from "
|
|
6
|
-
import { Fetch, Loader, Lodash, Time } from "
|
|
7
|
-
import { SDK } from "@rsdoctor/types";
|
|
8
|
-
import { DevToolError } from "
|
|
4
|
+
import { logger } from "../../logger.js";
|
|
5
|
+
import { Fetch, Loader, Lodash, Time } from "../../common/index.js";
|
|
6
|
+
import { SDK } from "@rsdoctor/shared/types";
|
|
7
|
+
import { DevToolError } from "../../error/index.js";
|
|
9
8
|
import { getSDK } from "./sdk.js";
|
|
10
9
|
import { checkCirclePath } from "./circleDetect.js";
|
|
11
10
|
import { Utils } from "../../build-utils/build/index.js";
|
|
@@ -40,36 +39,11 @@ function shouldSkipLoader(loaderContext) {
|
|
|
40
39
|
}
|
|
41
40
|
return false;
|
|
42
41
|
}
|
|
43
|
-
function interceptLoader(rules, loaderPath, options, cwd = process.cwd()
|
|
44
|
-
const loaderResolver = new ResolverFactory({
|
|
45
|
-
conditionNames: [
|
|
46
|
-
'loader',
|
|
47
|
-
'require',
|
|
48
|
-
'node'
|
|
49
|
-
],
|
|
50
|
-
exportsFields: [
|
|
51
|
-
'exports'
|
|
52
|
-
],
|
|
53
|
-
mainFiles: [
|
|
54
|
-
'index'
|
|
55
|
-
],
|
|
56
|
-
mainFields: [
|
|
57
|
-
'loader',
|
|
58
|
-
'main'
|
|
59
|
-
],
|
|
60
|
-
extensions: [
|
|
61
|
-
'js',
|
|
62
|
-
'.json'
|
|
63
|
-
],
|
|
64
|
-
modules: [
|
|
65
|
-
'node_modules'
|
|
66
|
-
],
|
|
67
|
-
...resolveLoader
|
|
68
|
-
});
|
|
42
|
+
function interceptLoader(rules, loaderPath, options, loaderResolver, cwd = process.cwd()) {
|
|
69
43
|
const resolve = (target)=>{
|
|
70
44
|
try {
|
|
71
|
-
const result = loaderResolver.
|
|
72
|
-
if (result
|
|
45
|
+
const result = loaderResolver.resolveSync({}, cwd, target);
|
|
46
|
+
if (result) return result;
|
|
73
47
|
} catch {}
|
|
74
48
|
return target;
|
|
75
49
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Config, Plugin, SDK } from '@rsdoctor/types';
|
|
1
|
+
import { Config, Plugin, SDK } from '@rsdoctor/shared/types';
|
|
2
2
|
import type { RuleSetCondition as RspackRuleSetCondition, RuleSetRule as RspackRuleSetRule } from '@rspack/core';
|
|
3
3
|
/**
|
|
4
4
|
* Process mode-specific configurations with priority logic
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function openBrowser(url: string, needEncodeURI?: boolean): Promise<boolean | undefined>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { exec } from "node:child_process";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { promisify } from "node:util";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { logger } from "../../logger.js";
|
|
7
|
+
const execAsync = promisify(exec);
|
|
8
|
+
const openBrowser_dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const supportedChromiumBrowsers = [
|
|
10
|
+
'Google Chrome Canary',
|
|
11
|
+
'Google Chrome Dev',
|
|
12
|
+
'Google Chrome Beta',
|
|
13
|
+
'Google Chrome',
|
|
14
|
+
'Microsoft Edge',
|
|
15
|
+
'Brave Browser',
|
|
16
|
+
'Vivaldi',
|
|
17
|
+
'Chromium'
|
|
18
|
+
];
|
|
19
|
+
const getTargetBrowser = async ()=>{
|
|
20
|
+
let targetBrowser = process.env.BROWSER;
|
|
21
|
+
if (!targetBrowser || !supportedChromiumBrowsers.includes(targetBrowser)) {
|
|
22
|
+
const { stdout: ps } = await execAsync('ps cax');
|
|
23
|
+
targetBrowser = supportedChromiumBrowsers.find((b)=>ps.includes(b));
|
|
24
|
+
}
|
|
25
|
+
return targetBrowser;
|
|
26
|
+
};
|
|
27
|
+
const openWithDefaultBrowser = async (url)=>{
|
|
28
|
+
try {
|
|
29
|
+
const { default: open } = await import("open");
|
|
30
|
+
await open(url);
|
|
31
|
+
return true;
|
|
32
|
+
} catch (err) {
|
|
33
|
+
logger.error('Failed to open Rsdoctor URL.');
|
|
34
|
+
logger.error(err);
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
async function openBrowser(url, needEncodeURI = true) {
|
|
39
|
+
const shouldTryOpenChromeWithAppleScript = 'darwin' === process.platform;
|
|
40
|
+
if (shouldTryOpenChromeWithAppleScript) try {
|
|
41
|
+
const targetBrowser = await getTargetBrowser();
|
|
42
|
+
if (targetBrowser) {
|
|
43
|
+
await execAsync(`osascript openChrome.applescript "${needEncodeURI ? encodeURI(url) : url}" "${targetBrowser}"`, {
|
|
44
|
+
cwd: join(openBrowser_dirname, '../../../static')
|
|
45
|
+
});
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
logger.debug('Failed to find the target browser.');
|
|
49
|
+
} catch (err) {
|
|
50
|
+
logger.debug("Failed to open Rsdoctor URL with apple script.");
|
|
51
|
+
logger.debug(err);
|
|
52
|
+
}
|
|
53
|
+
return openWithDefaultBrowser(url);
|
|
54
|
+
}
|
|
55
|
+
export { openBrowser };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { chalk } from "@rsdoctor/utils/logger";
|
|
2
|
+
import { makeRulesSerializable } from "../index.js";
|
|
3
|
+
import { SDK } from "@rsdoctor/shared/types";
|
|
4
|
+
import { chalk } from "../../logger.js";
|
|
6
5
|
import path from "path";
|
|
6
|
+
import { openBrowser } from "./openBrowser.js";
|
|
7
7
|
function safeCloneDeep(value, visited = new WeakMap()) {
|
|
8
8
|
if (null == value) return value;
|
|
9
9
|
if ('object' != typeof value) return value;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SDK } from '@rsdoctor/types';
|
|
1
|
+
import type { SDK } from '@rsdoctor/shared/types';
|
|
2
2
|
import { IHook } from '../../build-utils/build/utils/index.js';
|
|
3
3
|
export declare function reportPluginData(sdk: SDK.RsdoctorBuilderSDKInstance, hook: string, tapName: string, start: number, type: SDK.PluginHookData['type'], _res: unknown, err?: Error): void;
|
|
4
4
|
export declare function interceptPluginHook(sdk: SDK.RsdoctorBuilderSDKInstance, name: string, hook: IHook): void;
|