@rsdoctor/core 1.6.1 → 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 -3
- package/dist/build-utils/build/module-graph/index.js +0 -3
- 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 +7 -5
- 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/build/utils/plugin.js +1 -2
- 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/constants.d.ts +1 -1
- package/dist/inner-plugins/constants.js +1 -1
- 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 +4 -20
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts +6 -8
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +12 -77
- package/dist/inner-plugins/plugins/errors.d.ts +3 -3
- package/dist/inner-plugins/plugins/errors.js +6 -6
- package/dist/inner-plugins/plugins/index.d.ts +0 -1
- package/dist/inner-plugins/plugins/index.js +0 -1
- package/dist/inner-plugins/plugins/loader.d.ts +1 -1
- package/dist/inner-plugins/plugins/loader.js +8 -20
- package/dist/inner-plugins/plugins/plugins.d.ts +1 -1
- package/dist/inner-plugins/plugins/plugins.js +3 -3
- package/dist/inner-plugins/plugins/progress.d.ts +3 -3
- package/dist/inner-plugins/plugins/progress.js +16 -18
- package/dist/inner-plugins/plugins/resolver.d.ts +2 -3
- 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 +6 -6
- 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 +3 -4
- package/dist/inner-plugins/utils/config.js +4 -17
- package/dist/inner-plugins/utils/loader.d.ts +4 -7
- package/dist/inner-plugins/utils/loader.js +10 -36
- package/dist/inner-plugins/utils/normalize-config.d.ts +4 -7
- 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} +4 -1
- 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 +3 -3
- 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 +3 -18
- 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 +3 -3
- 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 +2 -2
- package/dist/rules/rules/side-effects-only-imports/index.d.ts +1 -1
- package/dist/rules/rules/side-effects-only-imports/index.js +2 -2
- 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/dist/types/rules.d.ts +4 -4
- package/package.json +123 -55
- package/static/openChrome.applescript +95 -0
- package/dist/build-utils/build/chunks/assetsModules.cjs +0 -46
- package/dist/build-utils/build/chunks/assetsModules.d.cts +0 -17
- package/dist/build-utils/build/chunks/chunkTransform.cjs +0 -43
- 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 -76
- package/dist/build-utils/build/chunks/index.d.cts +0 -3
- package/dist/build-utils/build/chunks/rspack/transform.cjs +0 -84
- package/dist/build-utils/build/chunks/rspack/transform.d.cts +0 -13
- package/dist/build-utils/build/index.cjs +0 -56
- package/dist/build-utils/build/index.d.cts +0 -5
- package/dist/build-utils/build/loader/index.cjs +0 -69
- package/dist/build-utils/build/loader/index.d.cts +0 -2
- package/dist/build-utils/build/loader/probeLoader.cjs +0 -93
- package/dist/build-utils/build/loader/probeLoader.d.cts +0 -4
- package/dist/build-utils/build/loader/probeLoaderPlugin.cjs +0 -69
- package/dist/build-utils/build/loader/probeLoaderPlugin.d.cts +0 -5
- package/dist/build-utils/build/module-graph/index.cjs +0 -83
- package/dist/build-utils/build/module-graph/index.d.cts +0 -4
- package/dist/build-utils/build/module-graph/parser.cjs +0 -50
- package/dist/build-utils/build/module-graph/parser.d.cts +0 -2
- package/dist/build-utils/build/module-graph/rspack/transform.cjs +0 -155
- package/dist/build-utils/build/module-graph/rspack/transform.d.cts +0 -26
- package/dist/build-utils/build/module-graph/transform.cjs +0 -44
- package/dist/build-utils/build/module-graph/transform.d.cts +0 -4
- package/dist/build-utils/build/module-graph/transform.d.ts +0 -4
- package/dist/build-utils/build/module-graph/transform.js +0 -7
- package/dist/build-utils/build/module-graph/treeShaking.cjs +0 -110
- package/dist/build-utils/build/module-graph/treeShaking.d.cts +0 -2
- package/dist/build-utils/build/module-graph/treeShaking.d.ts +0 -2
- package/dist/build-utils/build/module-graph/treeShaking.js +0 -73
- package/dist/build-utils/build/module-graph/utils.cjs +0 -99
- package/dist/build-utils/build/module-graph/utils.d.cts +0 -3
- package/dist/build-utils/build/module-graph/webpack/transform.cjs +0 -174
- package/dist/build-utils/build/module-graph/webpack/transform.d.cts +0 -16
- package/dist/build-utils/build/module-graph/webpack/transform.d.ts +0 -16
- package/dist/build-utils/build/module-graph/webpack/transform.js +0 -124
- package/dist/build-utils/build/utils/index.cjs +0 -76
- package/dist/build-utils/build/utils/index.d.cts +0 -3
- package/dist/build-utils/build/utils/loader.cjs +0 -358
- package/dist/build-utils/build/utils/loader.d.cts +0 -20
- package/dist/build-utils/build/utils/parseBundle.cjs +0 -287
- package/dist/build-utils/build/utils/parseBundle.d.cts +0 -12
- package/dist/build-utils/build/utils/plugin.cjs +0 -65
- package/dist/build-utils/build/utils/plugin.d.cts +0 -5
- package/dist/build-utils/index.cjs +0 -40
- package/dist/build-utils/index.d.cts +0 -1
- package/dist/index.cjs +0 -85
- package/dist/index.d.cts +0 -3
- package/dist/inner-plugins/constants.cjs +0 -68
- package/dist/inner-plugins/index.cjs +0 -69
- package/dist/inner-plugins/index.d.cts +0 -2
- package/dist/inner-plugins/loaders/proxy.cjs +0 -108
- package/dist/inner-plugins/loaders/proxy.d.cts +0 -7
- package/dist/inner-plugins/plugins/base.cjs +0 -57
- package/dist/inner-plugins/plugins/base.d.cts +0 -12
- package/dist/inner-plugins/plugins/bundle.cjs +0 -116
- package/dist/inner-plugins/plugins/bundle.d.cts +0 -15
- package/dist/inner-plugins/plugins/bundleTagPlugin.cjs +0 -88
- package/dist/inner-plugins/plugins/bundleTagPlugin.d.cts +0 -6
- package/dist/inner-plugins/plugins/bundleTagPlugin.d.ts +0 -6
- package/dist/inner-plugins/plugins/bundleTagPlugin.js +0 -51
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.cjs +0 -182
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.cts +0 -36
- package/dist/inner-plugins/plugins/errors.cjs +0 -102
- package/dist/inner-plugins/plugins/errors.d.cts +0 -11
- package/dist/inner-plugins/plugins/index.cjs +0 -132
- package/dist/inner-plugins/plugins/index.d.cts +0 -11
- package/dist/inner-plugins/plugins/loader.cjs +0 -169
- package/dist/inner-plugins/plugins/loader.d.cts +0 -10
- package/dist/inner-plugins/plugins/plugins.cjs +0 -77
- package/dist/inner-plugins/plugins/plugins.d.cts +0 -8
- package/dist/inner-plugins/plugins/progress.cjs +0 -74
- package/dist/inner-plugins/plugins/progress.d.cts +0 -8
- package/dist/inner-plugins/plugins/resolver.cjs +0 -94
- package/dist/inner-plugins/plugins/resolver.d.cts +0 -13
- package/dist/inner-plugins/plugins/rspack.cjs +0 -122
- package/dist/inner-plugins/plugins/rspack.d.cts +0 -4
- package/dist/inner-plugins/plugins/rules.cjs +0 -101
- package/dist/inner-plugins/plugins/rules.d.cts +0 -8
- package/dist/inner-plugins/plugins/sourcemapTool.cjs +0 -279
- package/dist/inner-plugins/plugins/sourcemapTool.d.cts +0 -52
- package/dist/inner-plugins/plugins/summary.cjs +0 -129
- package/dist/inner-plugins/plugins/summary.d.cts +0 -14
- package/dist/inner-plugins/utils/circleDetect.cjs +0 -53
- package/dist/inner-plugins/utils/circleDetect.d.cts +0 -4
- package/dist/inner-plugins/utils/config.cjs +0 -207
- package/dist/inner-plugins/utils/config.d.cts +0 -5
- package/dist/inner-plugins/utils/index.cjs +0 -110
- package/dist/inner-plugins/utils/index.d.cts +0 -9
- package/dist/inner-plugins/utils/loader.cjs +0 -222
- package/dist/inner-plugins/utils/loader.d.cts +0 -13
- package/dist/inner-plugins/utils/normalize-config.cjs +0 -126
- package/dist/inner-plugins/utils/normalize-config.d.cts +0 -40
- package/dist/inner-plugins/utils/plugin-common.cjs +0 -147
- package/dist/inner-plugins/utils/plugin-common.d.cts +0 -11
- package/dist/inner-plugins/utils/plugin.cjs +0 -110
- package/dist/inner-plugins/utils/plugin.d.cts +0 -4
- package/dist/inner-plugins/utils/sdk.cjs +0 -59
- package/dist/inner-plugins/utils/sdk.d.cts +0 -8
- package/dist/rslib-runtime.js +0 -19
- package/dist/rules/index.cjs +0 -85
- package/dist/rules/index.d.cts +0 -3
- package/dist/rules/linter.cjs +0 -76
- package/dist/rules/linter.d.cts +0 -9
- package/dist/rules/rule.cjs +0 -141
- package/dist/rules/rule.d.cts +0 -27
- package/dist/rules/rules/cjs-require/index.cjs +0 -87
- 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 -78
- 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 -44
- package/dist/rules/rules/cross-chunks-package/utils.d.cts +0 -1
- package/dist/rules/rules/default-import-check/index.cjs +0 -120
- 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 -101
- package/dist/rules/rules/default-import-check/utils.d.cts +0 -10
- package/dist/rules/rules/duplicate-package/index.cjs +0 -76
- package/dist/rules/rules/duplicate-package/index.d.cts +0 -4
- package/dist/rules/rules/duplicate-package/types.cjs +0 -64
- package/dist/rules/rules/duplicate-package/types.d.cts +0 -24
- package/dist/rules/rules/duplicate-package/utils.cjs +0 -88
- package/dist/rules/rules/duplicate-package/utils.d.cts +0 -3
- package/dist/rules/rules/ecma-version-check/index.cjs +0 -100
- 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 -43
- package/dist/rules/rules/ecma-version-check/utils.d.cts +0 -2
- package/dist/rules/rules/esm-resolved-to-cjs/index.cjs +0 -256
- 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 -59
- package/dist/rules/rules/index.d.cts +0 -2
- package/dist/rules/rules/loader-performance-optimization/index.cjs +0 -123
- 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 -47
- package/dist/rules/rules/loader-performance-optimization/utils.d.cts +0 -1
- package/dist/rules/rules/module-mixed-chunks/index.cjs +0 -89
- 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 -118
- 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 -50
- 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 -83
- 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,7 +1,7 @@
|
|
|
1
|
-
import type { Plugin as PluginType } from '@rsdoctor/types';
|
|
2
|
-
import { Plugin } from '@rsdoctor/types';
|
|
1
|
+
import type { Plugin as PluginType } from '@rsdoctor/shared/types';
|
|
2
|
+
import { Plugin } from '@rsdoctor/shared/types';
|
|
3
3
|
import type { ProxyLoaderOptions } from '../../types/index.js';
|
|
4
|
-
declare const loaderModule: Plugin.LoaderDefinition<ProxyLoaderOptions,
|
|
5
|
-
export declare const pitch: (this: PluginType.LoaderContext<ProxyLoaderOptions>) =>
|
|
4
|
+
declare const loaderModule: Plugin.LoaderDefinition<ProxyLoaderOptions, object>;
|
|
5
|
+
export declare const pitch: (this: PluginType.LoaderContext<ProxyLoaderOptions>) => void | string | Buffer<ArrayBufferLike> | Promise<string | Buffer<ArrayBufferLike>>;
|
|
6
6
|
export declare const raw = true;
|
|
7
7
|
export default loaderModule;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Linter, Plugin, SDK } from '@rsdoctor/types';
|
|
1
|
+
import type { Linter, Plugin, SDK } from '@rsdoctor/shared/types';
|
|
2
2
|
import type { InternalPlugin, RsdoctorPluginInstance } from '../../types/index.js';
|
|
3
3
|
export declare abstract class InternalBasePlugin<T extends Plugin.BaseCompiler> implements InternalPlugin<T, Linter.ExtendRuleData[]> {
|
|
4
4
|
readonly scheduler: RsdoctorPluginInstance<T, Linter.ExtendRuleData[]>;
|
|
@@ -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');
|
|
@@ -37,28 +37,12 @@ class InternalBundlePlugin extends InternalBasePlugin {
|
|
|
37
37
|
super(...args), this.name = 'bundle', this.map = new Map(), this.thisCompilation = (compilation)=>{
|
|
38
38
|
time('InternalBundlePlugin.thisCompilation');
|
|
39
39
|
try {
|
|
40
|
-
if (compilation.hooks.processAssets
|
|
40
|
+
if (compilation.hooks.processAssets) compilation.hooks.afterProcessAssets.tap(this.tapPostOptions, (assets)=>{
|
|
41
41
|
Object.keys(assets).forEach((file)=>{
|
|
42
42
|
const v = this.ensureAssetContent(file);
|
|
43
43
|
v.content = assets[file].source().toString();
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
|
-
else if (compilation.hooks.processAssets && 'afterProcessAssets' in compilation.hooks) compilation.hooks.afterProcessAssets.tap(this.tapPostOptions, ()=>{
|
|
47
|
-
Object.keys(compilation.assets).forEach((file)=>{
|
|
48
|
-
const v = this.ensureAssetContent(file);
|
|
49
|
-
v.content = compilation.assets[file].source().toString();
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
else if ('afterOptimizeChunkAssets' in compilation.hooks) compilation.hooks.afterOptimizeChunkAssets.tap(this.tapPostOptions, (chunks)=>{
|
|
53
|
-
[
|
|
54
|
-
...chunks
|
|
55
|
-
].reduce((t, chunk)=>t.concat([
|
|
56
|
-
...chunk.files
|
|
57
|
-
]), []).forEach((file)=>{
|
|
58
|
-
const v = this.ensureAssetContent(file);
|
|
59
|
-
v.content = compilation.assets[file].source().toString();
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
46
|
} finally{
|
|
63
47
|
timeEnd('InternalBundlePlugin.thisCompilation');
|
|
64
48
|
}
|
|
@@ -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
|
*/
|
|
@@ -12,22 +12,20 @@ export interface MappingItem {
|
|
|
12
12
|
name: string | null;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* Main function to generate ModuleGraph and ChunkGraph from
|
|
16
|
-
*
|
|
17
|
-
* @param compiler - The Webpack or Rspack compiler instance.
|
|
18
|
-
* @param _this - The Rsdoctor plugin instance.
|
|
15
|
+
* Main function to generate ModuleGraph and ChunkGraph from Rspack native data
|
|
16
|
+
* and collect source maps.
|
|
19
17
|
*/
|
|
20
18
|
export declare const ensureModulesChunksGraphFn: (compiler: Plugin.BaseCompiler, _this: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData[]>) => void;
|
|
21
19
|
/**
|
|
22
20
|
* Checks if source map processing is enabled and supported by the current compiler configuration.
|
|
23
21
|
* Warns if eval-based source maps are used (unsupported).
|
|
24
|
-
* @param compiler - The
|
|
22
|
+
* @param compiler - The Rspack compiler instance.
|
|
25
23
|
* @returns true if source maps are enabled and supported, false otherwise.
|
|
26
24
|
*/
|
|
27
25
|
export declare const ensureDevtools: (compiler: Plugin.BaseCompiler) => boolean;
|
|
28
26
|
/**
|
|
29
27
|
* Calculates namespace and source map filename regex for source map resolution.
|
|
30
|
-
* @param compiler - The
|
|
28
|
+
* @param compiler - The Rspack compiler instance.
|
|
31
29
|
* @returns An object containing namespace and sourceMapFilenameRegex.
|
|
32
30
|
*/
|
|
33
31
|
export declare function calculateNamespaceAndRegex(compiler: Plugin.BaseCompiler): {
|
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { chalk, logger } from "@rsdoctor/utils/logger";
|
|
5
|
-
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";
|
|
6
4
|
import { internalPluginTapPreOptions, pluginTapPostOptions } from "../constants.js";
|
|
7
|
-
import { applyRspackNativePlugin } from "./rspack.js";
|
|
8
|
-
import { handleAfterEmitAssets
|
|
5
|
+
import { applyRspackNativePlugin, getRspackNativePlugin } from "./rspack.js";
|
|
6
|
+
import { handleAfterEmitAssets } from "./sourcemapTool.js";
|
|
9
7
|
let hasConsole = false;
|
|
10
8
|
const ensureModulesChunksGraphFn = (compiler, _this)=>{
|
|
11
9
|
if (_this._modulesGraphApplied) return;
|
|
10
|
+
const RsdoctorRspackPlugin = getRspackNativePlugin(compiler);
|
|
12
11
|
_this._modulesGraphApplied = true;
|
|
13
|
-
const
|
|
14
|
-
astCache: new Map(),
|
|
15
|
-
packagePathMap: new Map(),
|
|
16
|
-
getSourceMap: (file)=>_this.sdk.getSourceMap(file)
|
|
17
|
-
};
|
|
18
|
-
const RsdoctorRspackPlugin = compiler.webpack.experiments?.RsdoctorPlugin;
|
|
19
|
-
if (RsdoctorRspackPlugin) applyRspackNativePlugin(compiler, _this, RsdoctorRspackPlugin);
|
|
12
|
+
const nativeGraphState = applyRspackNativePlugin(compiler, _this, RsdoctorRspackPlugin);
|
|
20
13
|
if (!_this._realSourcePathCache) _this._realSourcePathCache = new Map();
|
|
21
|
-
compiler.hooks.done.tapPromise(internalPluginTapPreOptions('moduleGraph'), async (
|
|
22
|
-
await doneHandler(
|
|
14
|
+
compiler.hooks.done.tapPromise(internalPluginTapPreOptions('moduleGraph'), async ()=>{
|
|
15
|
+
await doneHandler(_this, compiler, nativeGraphState);
|
|
23
16
|
});
|
|
24
17
|
compiler.hooks.compilation.tap({
|
|
25
18
|
...pluginTapPostOptions,
|
|
@@ -34,55 +27,14 @@ const ensureModulesChunksGraphFn = (compiler, _this)=>{
|
|
|
34
27
|
await handleAfterEmitAssets(compilation, _this, sourceMapFilenameRegex, namespace);
|
|
35
28
|
});
|
|
36
29
|
});
|
|
37
|
-
compiler.hooks.emit.tapAsync({
|
|
38
|
-
...pluginTapPostOptions,
|
|
39
|
-
stage: pluginTapPostOptions.stage + 100
|
|
40
|
-
}, emitHandler.bind(null, _this, compiler));
|
|
41
30
|
};
|
|
42
|
-
async function doneHandler(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
let cached = null;
|
|
46
|
-
return ()=>{
|
|
47
|
-
if (cached) return cached;
|
|
48
|
-
cached = stats.toJson({
|
|
49
|
-
all: false,
|
|
50
|
-
chunks: true,
|
|
51
|
-
modules: true,
|
|
52
|
-
chunkModules: true,
|
|
53
|
-
assets: true,
|
|
54
|
-
ids: true,
|
|
55
|
-
hash: true,
|
|
56
|
-
errors: true,
|
|
57
|
-
warnings: true,
|
|
58
|
-
nestedModules: true,
|
|
59
|
-
cachedModules: true,
|
|
60
|
-
orphanModules: true,
|
|
61
|
-
runtimeModules: true,
|
|
62
|
-
optimizationBailout: true
|
|
63
|
-
});
|
|
64
|
-
return cached;
|
|
65
|
-
};
|
|
66
|
-
})();
|
|
67
|
-
logger.debug(`${(Process.getMemoryUsageMessage(), '[Before Generate ModuleGraph]')}`);
|
|
68
|
-
if (!_this.chunkGraph?.getChunks().length) _this.chunkGraph = Chunks.chunkTransform(new Map(), getStatsJson());
|
|
69
|
-
if (!_this.modulesGraph.getModules().length) _this.modulesGraph = await ModuleGraph.getModuleGraphByStats(stats.compilation, getStatsJson(), process.cwd(), _this.chunkGraph, _this.options.features, context);
|
|
70
|
-
logger.debug(`${(Process.getMemoryUsageMessage(), '[After Generate ModuleGraph]')}`);
|
|
71
|
-
if (_this.options.features.treeShaking) {
|
|
72
|
-
if ('rspackVersion' in compiler.webpack) logger.info(chalk.yellow('Rspack currently does not support treeShaking capabilities.'));
|
|
73
|
-
else {
|
|
74
|
-
_this.modulesGraph = ModuleGraph.appendTreeShaking(_this.modulesGraph, stats.compilation) || _this.modulesGraph;
|
|
75
|
-
_this.sdk.addClientRoutes([
|
|
76
|
-
Manifest.RsdoctorManifestClientRoutes.TreeShaking
|
|
77
|
-
]);
|
|
78
|
-
}
|
|
79
|
-
logger.debug(`${(Process.getMemoryUsageMessage(), '[After AppendTreeShaking to ModuleGraph]')}`);
|
|
80
|
-
}
|
|
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.');
|
|
81
34
|
const shouldParseBundle = false !== _this.options.supports.parseBundle;
|
|
82
35
|
await getModulesInfos(compiler, _this.modulesGraph, _this.chunkGraph, shouldParseBundle, _this.sourceMapSets, _this.assetsWithoutSourceMap);
|
|
83
|
-
logger.debug(`${Process.getMemoryUsageMessage()}, '[After Transform ModuleGraph]'`);
|
|
84
36
|
logger.debug('reportModuleGraph start');
|
|
85
|
-
|
|
37
|
+
await _this.sdk.reportModuleGraph(_this.modulesGraph);
|
|
86
38
|
logger.debug('reportModuleGraph done');
|
|
87
39
|
logger.debug('reportChunkGraph start');
|
|
88
40
|
await _this.sdk.reportChunkGraph(_this.chunkGraph);
|
|
@@ -97,12 +49,6 @@ const ensureDevtools = (compiler)=>{
|
|
|
97
49
|
hasConsole = true;
|
|
98
50
|
return false;
|
|
99
51
|
}
|
|
100
|
-
if ('rspack' in compiler) return true;
|
|
101
|
-
const sourceMapEnabled = 'string' == typeof devtool && /source-?map/i.test(devtool);
|
|
102
|
-
if (!sourceMapEnabled) {
|
|
103
|
-
logger.debug('SourceMap is not enabled. Skipping sourcemap processing.');
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
52
|
return true;
|
|
107
53
|
};
|
|
108
54
|
async function getModulesInfos(compiler, moduleGraph, chunkGraph, parseBundle, sourceMapSets, assetsWithoutSourceMap) {
|
|
@@ -125,15 +71,4 @@ function calculateNamespaceAndRegex(compiler) {
|
|
|
125
71
|
sourceMapFilenameRegex
|
|
126
72
|
};
|
|
127
73
|
}
|
|
128
|
-
async function emitHandler(_this, compiler, compilation, callback) {
|
|
129
|
-
if (!ensureDevtools(compiler)) return void callback();
|
|
130
|
-
const { namespace, sourceMapFilenameRegex } = calculateNamespaceAndRegex(compiler);
|
|
131
|
-
await handleEmitAssets({
|
|
132
|
-
compilation,
|
|
133
|
-
pluginInstance: _this,
|
|
134
|
-
sourceMapFilenameRegex,
|
|
135
|
-
namespace
|
|
136
|
-
});
|
|
137
|
-
callback();
|
|
138
|
-
}
|
|
139
74
|
export { calculateNamespaceAndRegex, ensureDevtools, ensureModulesChunksGraphFn };
|
|
@@ -1,11 +1,11 @@
|
|
|
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;
|
|
7
7
|
done: (stats: Plugin.BaseStats) => Promise<void>;
|
|
8
|
-
|
|
8
|
+
handleBundlerError(err: Plugin.BuildError, category: Rule.RuleMessageCategory, level: keyof typeof Err.ErrorLevel): DevToolError;
|
|
9
9
|
reportWarnings(warnings: Plugin.BuildError[]): Promise<void>;
|
|
10
10
|
reportErrors(errors: Plugin.BuildWarning[]): Promise<void>;
|
|
11
11
|
}
|
|
@@ -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');
|
|
@@ -12,7 +12,7 @@ class InternalErrorReporterPlugin extends InternalBasePlugin {
|
|
|
12
12
|
timeEnd('InternalErrorReporterPlugin.apply');
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
handleBundlerError(err, category, level) {
|
|
16
16
|
return DevToolError.from(err, {
|
|
17
17
|
category,
|
|
18
18
|
code: Rule.RuleMessageCodeEnumerated.Overlay,
|
|
@@ -28,7 +28,7 @@ class InternalErrorReporterPlugin extends InternalBasePlugin {
|
|
|
28
28
|
async reportWarnings(warnings) {
|
|
29
29
|
time('InternalErrorReporterPlugin.reportWarnings');
|
|
30
30
|
try {
|
|
31
|
-
const arr = warnings.map((warning)=>this.
|
|
31
|
+
const arr = warnings.map((warning)=>this.handleBundlerError(warning, Rule.RuleMessageCategory.Compile, 'Warn'));
|
|
32
32
|
this.sdk.reportError(arr);
|
|
33
33
|
} finally{
|
|
34
34
|
timeEnd('InternalErrorReporterPlugin.reportWarnings');
|
|
@@ -37,7 +37,7 @@ class InternalErrorReporterPlugin extends InternalBasePlugin {
|
|
|
37
37
|
async reportErrors(errors) {
|
|
38
38
|
time('InternalErrorReporterPlugin.reportErrors');
|
|
39
39
|
try {
|
|
40
|
-
const arr = errors.map((err)=>this.
|
|
40
|
+
const arr = errors.map((err)=>this.handleBundlerError(err, Rule.RuleMessageCategory.Bundle, 'Error'));
|
|
41
41
|
this.sdk.reportError(arr);
|
|
42
42
|
} finally{
|
|
43
43
|
timeEnd('InternalErrorReporterPlugin.reportErrors');
|
|
@@ -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,24 +88,16 @@ 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;
|
|
110
98
|
compiler.options.module.rules = this.getInterceptRules(compiler, compiler.options.module.rules);
|
|
111
99
|
this.sdk.addClientRoutes([
|
|
112
|
-
Manifest.RsdoctorManifestClientRoutes.
|
|
100
|
+
Manifest.RsdoctorManifestClientRoutes.Loaders
|
|
113
101
|
]);
|
|
114
102
|
} finally{
|
|
115
103
|
timeEnd('InternalLoaderPlugin.afterPlugins');
|
|
@@ -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');
|
|
@@ -21,7 +21,7 @@ class InternalPluginsPlugin extends InternalBasePlugin {
|
|
|
21
21
|
if (compiler.isChild()) return;
|
|
22
22
|
Utils.interceptCompilerHooks(compiler, (name, hook)=>interceptPluginHook(this.sdk, name, hook));
|
|
23
23
|
this.sdk.addClientRoutes([
|
|
24
|
-
Manifest.RsdoctorManifestClientRoutes.
|
|
24
|
+
Manifest.RsdoctorManifestClientRoutes.Plugins
|
|
25
25
|
]);
|
|
26
26
|
} finally{
|
|
27
27
|
timeEnd('InternalPluginsPlugin.afterPlugins');
|
|
@@ -1,7 +1,7 @@
|
|
|
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
|
-
export declare class InternalProgressPlugin<T extends Plugin.BaseCompilerType<'
|
|
4
|
+
export declare class InternalProgressPlugin<T extends Plugin.BaseCompilerType<'rspack'>> extends InternalBasePlugin<T> {
|
|
5
5
|
readonly name = "progress";
|
|
6
6
|
protected currentProgress: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.APIExtends.GetCompileProgress>;
|
|
7
7
|
apply(compiler: T): void;
|
|
@@ -1,27 +1,25 @@
|
|
|
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;
|
|
8
8
|
if (compiler.webpack && compiler.webpack.ProgressPlugin) {
|
|
9
|
-
const progress = new compiler.webpack.ProgressPlugin({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
logger.debug(e);
|
|
24
|
-
}
|
|
9
|
+
const progress = new compiler.webpack.ProgressPlugin((percentage, msg)=>{
|
|
10
|
+
currentProgress.percentage = percentage;
|
|
11
|
+
currentProgress.message = msg || '';
|
|
12
|
+
const api = SDK.ServerAPI.APIExtends.GetCompileProgress;
|
|
13
|
+
try {
|
|
14
|
+
sdk.server.sendAPIDataToClient(api, {
|
|
15
|
+
req: {
|
|
16
|
+
api,
|
|
17
|
+
body: void 0
|
|
18
|
+
},
|
|
19
|
+
res: currentProgress
|
|
20
|
+
});
|
|
21
|
+
} catch (e) {
|
|
22
|
+
logger.debug(e);
|
|
25
23
|
}
|
|
26
24
|
});
|
|
27
25
|
progress.apply(compiler);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Plugin } from '@rsdoctor/types';
|
|
1
|
+
import { Plugin } from '@rsdoctor/shared/types';
|
|
2
2
|
import { InternalBasePlugin } from './base.js';
|
|
3
|
-
import type { Compiler as WebpackCompiler } from 'webpack';
|
|
4
3
|
export declare class InternalResolverPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
5
4
|
readonly name = "resolver";
|
|
6
5
|
protected resolveDataMap: Map<string, {
|
|
@@ -9,5 +8,5 @@ export declare class InternalResolverPlugin<T extends Plugin.BaseCompiler> exten
|
|
|
9
8
|
request: string;
|
|
10
9
|
}>;
|
|
11
10
|
apply(compiler: T): void;
|
|
12
|
-
protected handleNormalModuleFactory: (normalModuleFactory: Plugin.RspackNormalModuleFactory
|
|
11
|
+
protected handleNormalModuleFactory: (normalModuleFactory: Plugin.RspackNormalModuleFactory) => void;
|
|
13
12
|
}
|
|
@@ -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');
|
|
@@ -27,16 +27,16 @@ class InternalRulesPlugin extends InternalBasePlugin {
|
|
|
27
27
|
}));
|
|
28
28
|
const errors = validateErrors.filter((item)=>'Error' === item.level);
|
|
29
29
|
const warnings = validateErrors.filter((item)=>'Warn' === item.level);
|
|
30
|
-
const
|
|
30
|
+
const toRspackError = (err)=>err.toError();
|
|
31
31
|
result.replace.forEach((item)=>{
|
|
32
32
|
if (Array.isArray(compilation.errors) && compilation.errors.includes(item)) pull(compilation.errors, item);
|
|
33
33
|
if (Array.isArray(compilation.warnings) && compilation.warnings.includes(item)) pull(compilation.warnings, item);
|
|
34
34
|
});
|
|
35
35
|
if (Array.isArray(compilation.errors)) errors.forEach((err)=>{
|
|
36
|
-
compilation.
|
|
36
|
+
compilation.errors.push(toRspackError(err));
|
|
37
37
|
});
|
|
38
38
|
if (Array.isArray(compilation.warnings)) warnings.forEach((err)=>{
|
|
39
|
-
compilation.warnings.push(
|
|
39
|
+
compilation.warnings.push(toRspackError(err));
|
|
40
40
|
});
|
|
41
41
|
this.sdk.reportError(validateErrors);
|
|
42
42
|
await linter.afterValidate({
|
|
@@ -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');
|