@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,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare function normalizeUserConfig<Rules extends Linter.ExtendRuleData[]>(config?: Plugin.RsdoctorWebpackPluginOptions<Rules>): Plugin.RsdoctorPluginOptionsNormalized<Rules>;
|
|
1
|
+
import { Linter, Plugin, SDK } from '@rsdoctor/shared/types';
|
|
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) {
|
|
@@ -22,7 +22,6 @@ function getDefaultOutput() {
|
|
|
22
22
|
function getDefaultSupports() {
|
|
23
23
|
return {
|
|
24
24
|
parseBundle: true,
|
|
25
|
-
banner: void 0,
|
|
26
25
|
gzip: true
|
|
27
26
|
};
|
|
28
27
|
}
|
|
@@ -96,6 +95,7 @@ function normalizeUserConfig(config = {}) {
|
|
|
96
95
|
const server = {
|
|
97
96
|
...userServer
|
|
98
97
|
};
|
|
98
|
+
assert(void 0 === server.port || 'number' == typeof server.port);
|
|
99
99
|
if (void 0 === server.port && void 0 !== port) server.port = port;
|
|
100
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];
|
|
101
101
|
if (mode) logger.info(chalk.yellow("The 'mode' configuration will be deprecated in a future version. Please use 'output.mode' instead."));
|
|
@@ -137,18 +137,5 @@ const normalizeReportType = (reportCodeType, mode)=>{
|
|
|
137
137
|
if ('noModuleSource' === convertedReportCodeType) return SDK.ToDataType.NoSource;
|
|
138
138
|
return SDK.ToDataType.Normal;
|
|
139
139
|
};
|
|
140
|
-
|
|
141
|
-
const config = normalizeUserConfig(options);
|
|
142
|
-
config.experiments ??= {
|
|
143
|
-
enableNativePlugin: {
|
|
144
|
-
moduleGraph: true,
|
|
145
|
-
chunkGraph: true
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
if ('boolean' == typeof options.experiments?.enableNativePlugin && options.experiments?.enableNativePlugin === false) config.experiments.enableNativePlugin = {
|
|
149
|
-
moduleGraph: false,
|
|
150
|
-
chunkGraph: false
|
|
151
|
-
};
|
|
152
|
-
return config;
|
|
153
|
-
}
|
|
140
|
+
const normalizeRspackUserOptions = normalizeUserConfig;
|
|
154
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
|
};
|
|
@@ -149,10 +123,10 @@ async function reportLoader(ctx, start, startHRTime, isPitch, sync, code, err, r
|
|
|
149
123
|
}
|
|
150
124
|
await Promise.all([
|
|
151
125
|
Fetch.postJSON(`${host}${SDK.ServerAPI.API.ReportLoader}`, loaderData, 8888).catch((err)=>{
|
|
152
|
-
logger.debug(`${err.message}`, '[
|
|
126
|
+
logger.debug(`${err.message}`, '[RspackPlugin.ReportLoader][error]');
|
|
153
127
|
}),
|
|
154
128
|
Fetch.postJSON(`${host}${SDK.ServerAPI.API.ReportSourceMap}`, sourceMapData, 8888).catch((err)=>{
|
|
155
|
-
logger.debug(`${err.message}`, '[
|
|
129
|
+
logger.debug(`${err.message}`, '[RspackPlugin.ReportSourceMap][error]');
|
|
156
130
|
})
|
|
157
131
|
]);
|
|
158
132
|
return loaderData;
|
|
@@ -1,6 +1,5 @@
|
|
|
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
|
-
import { RuleSetCondition as WebpackRuleSetCondition, RuleSetConditionAbsolute as WebpackRuleSetConditionAbsolute, RuleSetRule as WebpackRuleSetRule } from 'webpack';
|
|
4
3
|
/**
|
|
5
4
|
* Process mode-specific configurations with priority logic
|
|
6
5
|
*/
|
|
@@ -22,9 +21,7 @@ export declare function convertReportCodeTypeObject(reportCodeType: any): Config
|
|
|
22
21
|
* properly serialized to JSON.
|
|
23
22
|
*
|
|
24
23
|
* @param item - The rule set condition to make serializable. Can be:
|
|
25
|
-
* - RspackRuleSetCondition: Rspack
|
|
26
|
-
* - WebpackRuleSetConditionAbsolute: Webpack absolute rule conditions
|
|
27
|
-
* - WebpackRuleSetCondition: Webpack rule conditions
|
|
24
|
+
* - RspackRuleSetCondition: Rspack rule conditions
|
|
28
25
|
* - void: Undefined or null values
|
|
29
26
|
*
|
|
30
27
|
* @example
|
|
@@ -36,5 +33,5 @@ export declare function convertReportCodeTypeObject(reportCodeType: any): Config
|
|
|
36
33
|
* JSON.stringify(condition); // '"/\\.js$/"'
|
|
37
34
|
* ```
|
|
38
35
|
*/
|
|
39
|
-
export declare function makeRuleSetSerializable(item: RspackRuleSetCondition |
|
|
40
|
-
export declare function makeRulesSerializable(rules: Plugin.RuleSetRule[] | RspackRuleSetRule['oneOf']
|
|
36
|
+
export declare function makeRuleSetSerializable(item: RspackRuleSetCondition | void): void;
|
|
37
|
+
export declare function makeRulesSerializable(rules: Plugin.RuleSetRule[] | RspackRuleSetRule['oneOf']): void;
|
|
@@ -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;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SDK } from '@rsdoctor/types';
|
|
1
|
+
import { SDK } from '@rsdoctor/shared/types';
|
|
3
2
|
declare global {
|
|
4
3
|
var __rsdoctor_sdks__: SDK.RsdoctorBuilderSDKInstance[] | undefined;
|
|
5
4
|
var __rsdoctor_sdk__: SDK.RsdoctorBuilderSDKInstance | undefined;
|
|
6
5
|
}
|
|
7
6
|
export declare function setSDK(t: SDK.RsdoctorBuilderSDKInstance): void;
|
|
8
|
-
export declare function getSDK(builderName?: string):
|
|
7
|
+
export declare function getSDK(builderName?: string): SDK.RsdoctorBuilderSDKInstance | undefined;
|
|
@@ -10,8 +10,8 @@ function getSDK(builderName) {
|
|
|
10
10
|
let sdk = globalThis['__rsdoctor_sdk__'];
|
|
11
11
|
if (sdk && sdk.name !== builderName) sdk = builderName ? sdks.find((s)=>s.name === builderName) || sdk : sdk;
|
|
12
12
|
if (sdk && builderName && 'parent' in sdk) {
|
|
13
|
-
const
|
|
14
|
-
const slaveSDK =
|
|
13
|
+
const parent = sdk.parent;
|
|
14
|
+
const slaveSDK = parent?.slaves.find((_sdk)=>_sdk.name === builderName);
|
|
15
15
|
return slaveSDK || sdk;
|
|
16
16
|
}
|
|
17
17
|
return sdk;
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import c from 'picocolors';
|
|
2
|
+
/**
|
|
3
|
+
* log debug message
|
|
4
|
+
*/
|
|
5
|
+
export declare function debug(getMsg: () => string, prefix?: string): void;
|
|
6
|
+
declare const rsdoctorLogger: import("rslog").Logger;
|
|
7
|
+
declare function time(label: string): void;
|
|
8
|
+
declare function timeEnd(label: string): void;
|
|
9
|
+
export { time, timeEnd, c as chalk, rsdoctorLogger as logger };
|
package/dist/logger.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import picocolors from "picocolors";
|
|
3
|
+
import { createLogger, logger } from "rslog";
|
|
4
|
+
import { Constants } from "@rsdoctor/shared/types";
|
|
5
|
+
function debug(getMsg, prefix = '') {
|
|
6
|
+
if (!process.env.DEBUG) return;
|
|
7
|
+
logger.level = 'verbose';
|
|
8
|
+
logger.debug(`${prefix} ${getMsg()}`);
|
|
9
|
+
}
|
|
10
|
+
const rsdoctorLogger = createLogger();
|
|
11
|
+
rsdoctorLogger.override({
|
|
12
|
+
log: (message)=>{
|
|
13
|
+
console.log(`${picocolors.green('[RSDOCTOR LOG]')} ${message}`);
|
|
14
|
+
},
|
|
15
|
+
info: (message)=>{
|
|
16
|
+
console.log(`${picocolors.yellow('[RSDOCTOR INFO]')} ${message}`);
|
|
17
|
+
},
|
|
18
|
+
warn: (message)=>{
|
|
19
|
+
console.warn(`${picocolors.yellow('[RSDOCTOR WARN]')} ${message}`);
|
|
20
|
+
},
|
|
21
|
+
start: (message)=>{
|
|
22
|
+
console.log(`${picocolors.green('[RSDOCTOR START]')} ${message}`);
|
|
23
|
+
},
|
|
24
|
+
ready: (message)=>{
|
|
25
|
+
console.log(`${picocolors.green('[RSDOCTOR READY]')} ${message}`);
|
|
26
|
+
},
|
|
27
|
+
error: (message)=>{
|
|
28
|
+
console.error(`${picocolors.red('[RSDOCTOR ERROR]')} ${message}`);
|
|
29
|
+
},
|
|
30
|
+
success: (message)=>{
|
|
31
|
+
console.error(`${picocolors.green('[RSDOCTOR SUCCESS]')} ${message}`);
|
|
32
|
+
},
|
|
33
|
+
debug: (message)=>{
|
|
34
|
+
if (process.env.DEBUG) console.log(`${picocolors.blue('[RSDOCTOR DEBUG]')} ${message}`);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const _timers = new Map();
|
|
38
|
+
function time(label) {
|
|
39
|
+
if (process.env.DEBUG !== Constants.RsdoctorProcessEnvDebugKey) return;
|
|
40
|
+
if (_timers.has(label)) return;
|
|
41
|
+
_timers.set(label, Date.now());
|
|
42
|
+
}
|
|
43
|
+
function timeEnd(label) {
|
|
44
|
+
if (process.env.DEBUG !== Constants.RsdoctorProcessEnvDebugKey) return;
|
|
45
|
+
const start = _timers.get(label);
|
|
46
|
+
if (null == start) return void logger.debug(`Timer '${label}' does not exist.`);
|
|
47
|
+
const duration = Date.now() - start;
|
|
48
|
+
logger.debug(`Timer '${label}' ended: ${duration}ms`);
|
|
49
|
+
_timers.delete(label);
|
|
50
|
+
}
|
|
51
|
+
export { debug, picocolors as chalk, rsdoctorLogger as logger, time, timeEnd };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Tap } from 'tapable';
|
|
2
|
-
export declare const pluginTapName = "
|
|
2
|
+
export declare const pluginTapName = "RsdoctorRspackPlugin";
|
|
3
3
|
export declare const pluginTapPostOptions: Tap;
|
|
4
4
|
export declare const pluginTapPreOptions: Tap;
|
|
5
5
|
export declare const internalPluginTapPreOptions: (namespace: string) => Tap;
|
|
6
6
|
export declare const internalPluginTapPostOptions: (namespace: string) => Tap;
|
|
7
|
+
export declare const pkg: {
|
|
8
|
+
version: string;
|
|
9
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
const constants_require = createRequire(import.meta.url);
|
|
4
|
+
const packageJson = constants_require('../../package.json');
|
|
5
|
+
const pluginTapName = 'RsdoctorRspackPlugin';
|
|
6
|
+
const pluginTapPostOptions = {
|
|
7
|
+
name: pluginTapName,
|
|
8
|
+
stage: 999
|
|
9
|
+
};
|
|
10
|
+
const pluginTapPreOptions = {
|
|
11
|
+
name: pluginTapName,
|
|
12
|
+
stage: -999
|
|
13
|
+
};
|
|
14
|
+
const internalPluginTapPreOptions = (namespace)=>({
|
|
15
|
+
name: `${pluginTapName}:${namespace}`,
|
|
16
|
+
stage: -998
|
|
17
|
+
});
|
|
18
|
+
const internalPluginTapPostOptions = (namespace)=>({
|
|
19
|
+
name: `${pluginTapName}:${namespace}`,
|
|
20
|
+
stage: 1000
|
|
21
|
+
});
|
|
22
|
+
const pkg = packageJson;
|
|
23
|
+
export { internalPluginTapPostOptions, internalPluginTapPreOptions, pkg, pluginTapName, pluginTapPostOptions, pluginTapPreOptions };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RsdoctorMultiplePluginOptions } from '../types/index.js';
|
|
2
|
+
import { type Linter, type Plugin } from '@rsdoctor/shared/types';
|
|
3
|
+
import { RsdoctorRspackPlugin } from './plugin.js';
|
|
4
|
+
export declare class RsdoctorRspackMultiplePlugin<Rules extends Linter.ExtendRuleData[]> extends RsdoctorRspackPlugin<Rules> {
|
|
5
|
+
private controller;
|
|
6
|
+
constructor(options?: RsdoctorMultiplePluginOptions<Rules>);
|
|
7
|
+
apply(compiler: Plugin.BaseCompilerType<'rspack'>): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { RsdoctorSDKController } from "../sdk.js";
|
|
3
|
+
import { SDK } from "@rsdoctor/shared/types";
|
|
4
|
+
import { normalizeUserConfig } from "../inner-plugins/index.js";
|
|
5
|
+
import { RsdoctorRspackPlugin } from "./plugin.js";
|
|
6
|
+
let globalController;
|
|
7
|
+
class RsdoctorRspackMultiplePlugin extends RsdoctorRspackPlugin {
|
|
8
|
+
apply(compiler) {
|
|
9
|
+
if ('dependencies' in compiler.options) this.sdk.dependencies = compiler.options.dependencies;
|
|
10
|
+
super.apply(compiler);
|
|
11
|
+
}
|
|
12
|
+
constructor(options = {}){
|
|
13
|
+
const controller = (()=>{
|
|
14
|
+
if (globalController) return globalController;
|
|
15
|
+
const controller = new RsdoctorSDKController();
|
|
16
|
+
globalController = controller;
|
|
17
|
+
return controller;
|
|
18
|
+
})();
|
|
19
|
+
const normallizedOptions = normalizeUserConfig(options);
|
|
20
|
+
const instance = controller.createSlave({
|
|
21
|
+
name: options.name || 'Builder',
|
|
22
|
+
stage: options.stage,
|
|
23
|
+
extraConfig: {
|
|
24
|
+
innerClientPath: normallizedOptions.innerClientPath,
|
|
25
|
+
printLog: normallizedOptions.printLog,
|
|
26
|
+
server: normallizedOptions.server,
|
|
27
|
+
mode: normallizedOptions.output.mode ? normallizedOptions.output.mode : void 0,
|
|
28
|
+
brief: normallizedOptions.output.mode === SDK.IMode[SDK.IMode.brief] ? normallizedOptions.output.options || void 0 : void 0
|
|
29
|
+
},
|
|
30
|
+
type: normallizedOptions.output.reportCodeType
|
|
31
|
+
});
|
|
32
|
+
super({
|
|
33
|
+
...options,
|
|
34
|
+
sdkInstance: instance
|
|
35
|
+
});
|
|
36
|
+
this.controller = controller;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export { RsdoctorRspackMultiplePlugin };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { RsdoctorRspackPluginInstance, RsdoctorRspackPluginOptions, RsdoctorRspackPluginOptionsNormalized } from '../types/index.js';
|
|
2
|
+
import { RsdoctorPrimarySDK } from '../sdk/index.js';
|
|
3
|
+
import { Linter, Plugin, SDK } from '@rsdoctor/shared/types';
|
|
4
|
+
export declare class RsdoctorRspackPlugin<Rules extends Linter.ExtendRuleData[]> implements RsdoctorRspackPluginInstance<Rules> {
|
|
5
|
+
readonly name = "RsdoctorRspackPlugin";
|
|
6
|
+
readonly sdk: SDK.RsdoctorBuilderSDKInstance | RsdoctorPrimarySDK;
|
|
7
|
+
readonly isRsdoctorPlugin: boolean;
|
|
8
|
+
_bootstrapTask: Promise<unknown>;
|
|
9
|
+
protected browserIsOpened: boolean;
|
|
10
|
+
modulesGraph: SDK.ModuleGraphInstance;
|
|
11
|
+
options: RsdoctorRspackPluginOptionsNormalized<Rules>;
|
|
12
|
+
outsideInstance: boolean;
|
|
13
|
+
constructor(options?: RsdoctorRspackPluginOptions<Rules>);
|
|
14
|
+
apply(compiler: unknown): unknown;
|
|
15
|
+
/**
|
|
16
|
+
* @description Generate ModuleGraph and ChunkGraph from the Rspack native plugin.
|
|
17
|
+
* @param {Compiler} compiler
|
|
18
|
+
* @return {*}
|
|
19
|
+
* @memberof RsdoctorRspackPlugin
|
|
20
|
+
*/
|
|
21
|
+
ensureModulesChunksGraphApplied(compiler: Plugin.BaseCompilerType<'rspack'>): void;
|
|
22
|
+
afterPlugins: (compiler: Plugin.BaseCompilerType<'rspack'>) => void;
|
|
23
|
+
done: (compiler: Plugin.BaseCompilerType<'rspack'>) => Promise<void>;
|
|
24
|
+
getRspackConfig(compiler: Plugin.BaseCompilerType<'rspack'>): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { Loader } from "../build-utils/index.js";
|
|
3
|
+
import { InternalBundlePlugin, InternalErrorReporterPlugin, InternalLoaderPlugin, InternalPluginsPlugin, InternalResolverPlugin, InternalRulesPlugin, InternalSummaryPlugin, ensureModulesChunksGraphFn, handleBriefModeReport, normalizeRspackUserOptions, processCompilerConfig, setSDK } from "../inner-plugins/index.js";
|
|
4
|
+
import { RsdoctorSDK, findRoot } from "../sdk.js";
|
|
5
|
+
import { Constants, Manifest, SDK } from "@rsdoctor/shared/types";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import { pkg, pluginTapName, pluginTapPostOptions } from "./constants.js";
|
|
8
|
+
import { ModuleGraph } from "../graph/index.js";
|
|
9
|
+
import { Loader as index_js_Loader } from "../common/index.js";
|
|
10
|
+
import { logger, time, timeEnd } from "../logger.js";
|
|
11
|
+
import { getRspackNativePlugin } from "../inner-plugins/plugins/rspack.js";
|
|
12
|
+
let hasGreeted = false;
|
|
13
|
+
class RsdoctorRspackPlugin {
|
|
14
|
+
apply(compiler) {
|
|
15
|
+
time('RsdoctorRspackPlugin.apply');
|
|
16
|
+
try {
|
|
17
|
+
if (!hasGreeted && !compiler.isChild()) {
|
|
18
|
+
hasGreeted = true;
|
|
19
|
+
logger.greet(`
|
|
20
|
+
\nRsdoctor v${pkg.version}\n`);
|
|
21
|
+
}
|
|
22
|
+
if (!this._bootstrapTask) this._bootstrapTask = this.sdk.bootstrap();
|
|
23
|
+
if (compiler.options.name) this.sdk.setName(compiler.options.name);
|
|
24
|
+
setSDK(this.sdk);
|
|
25
|
+
compiler.hooks.afterPlugins.tap(pluginTapPostOptions, this.afterPlugins.bind(this, compiler));
|
|
26
|
+
compiler.hooks.done.tapPromise({
|
|
27
|
+
...pluginTapPostOptions,
|
|
28
|
+
stage: pluginTapPostOptions.stage + 100
|
|
29
|
+
}, this.done.bind(this, compiler));
|
|
30
|
+
new InternalSummaryPlugin(this).apply(compiler);
|
|
31
|
+
if (this.options.features.loader) {
|
|
32
|
+
new Loader.ProbeLoaderPlugin().apply(compiler);
|
|
33
|
+
this.sdk.addClientRoutes([
|
|
34
|
+
Manifest.RsdoctorManifestClientRoutes.Loaders
|
|
35
|
+
]);
|
|
36
|
+
if (!index_js_Loader.isVue(compiler)) new InternalLoaderPlugin(this).apply(compiler);
|
|
37
|
+
}
|
|
38
|
+
if (this.options.features.plugins) new InternalPluginsPlugin(this).apply(compiler);
|
|
39
|
+
if (this.options.features.bundle) new InternalBundlePlugin(this).apply(compiler);
|
|
40
|
+
if (this.options.features.resolver) new InternalResolverPlugin(this).apply(compiler);
|
|
41
|
+
new InternalRulesPlugin(this).apply(compiler);
|
|
42
|
+
new InternalErrorReporterPlugin(this).apply(compiler);
|
|
43
|
+
const RsdoctorRspackNativePlugin = getRspackNativePlugin(compiler);
|
|
44
|
+
logger.debug('[RspackNativePlugin] Enabled');
|
|
45
|
+
new RsdoctorRspackNativePlugin({
|
|
46
|
+
moduleGraphFeatures: true,
|
|
47
|
+
chunkGraphFeatures: true,
|
|
48
|
+
sourceMapFeatures: {
|
|
49
|
+
cheap: false,
|
|
50
|
+
module: false
|
|
51
|
+
}
|
|
52
|
+
}).apply(compiler);
|
|
53
|
+
} finally{
|
|
54
|
+
timeEnd('RsdoctorRspackPlugin.apply');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
ensureModulesChunksGraphApplied(compiler) {
|
|
58
|
+
ensureModulesChunksGraphFn(compiler, this);
|
|
59
|
+
}
|
|
60
|
+
getRspackConfig(compiler) {
|
|
61
|
+
time('RsdoctorRspackPlugin.getRspackConfig');
|
|
62
|
+
try {
|
|
63
|
+
if (compiler.isChild()) return;
|
|
64
|
+
const configuration = processCompilerConfig(compiler.options);
|
|
65
|
+
const rspackVersion = compiler.webpack?.rspackVersion || compiler.webpack?.version;
|
|
66
|
+
this.sdk.reportConfiguration({
|
|
67
|
+
name: 'rspack',
|
|
68
|
+
version: rspackVersion || 'unknown',
|
|
69
|
+
config: configuration,
|
|
70
|
+
root: findRoot() || ''
|
|
71
|
+
});
|
|
72
|
+
} finally{
|
|
73
|
+
timeEnd('RsdoctorRspackPlugin.getRspackConfig');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
constructor(options){
|
|
77
|
+
this.name = pluginTapName;
|
|
78
|
+
this.browserIsOpened = false;
|
|
79
|
+
this.afterPlugins = (compiler)=>{
|
|
80
|
+
time('RsdoctorRspackPlugin.afterPlugins');
|
|
81
|
+
try {
|
|
82
|
+
this.getRspackConfig(compiler);
|
|
83
|
+
} finally{
|
|
84
|
+
timeEnd('RsdoctorRspackPlugin.afterPlugins');
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
this.done = async (compiler)=>{
|
|
88
|
+
time('RsdoctorRspackPlugin.done');
|
|
89
|
+
try {
|
|
90
|
+
logger.debug('[RsdoctorRspackPlugin] bootstrap(start) in done()');
|
|
91
|
+
await this.sdk.bootstrap();
|
|
92
|
+
logger.debug('[RsdoctorRspackPlugin] bootstrap(end) in done()');
|
|
93
|
+
this.sdk.addClientRoutes([
|
|
94
|
+
Manifest.RsdoctorManifestClientRoutes.Overall
|
|
95
|
+
]);
|
|
96
|
+
if (this.outsideInstance && 'parent' in this.sdk) this.sdk.parent.master.setOutputDir(path.resolve(this.options.output.reportDir || compiler.outputPath, this.options.output.mode === SDK.IMode[SDK.IMode.brief] ? '' : `./${Constants.RsdoctorOutputFolder}`));
|
|
97
|
+
this.sdk.setOutputDir(path.resolve(this.options.output.reportDir || compiler.outputPath, this.options.output.mode === SDK.IMode[SDK.IMode.brief] ? '' : `./${Constants.RsdoctorOutputFolder}`));
|
|
98
|
+
await this.sdk.writeStore();
|
|
99
|
+
if (!this.options.disableClientServer) if (this.options.output.mode === SDK.IMode[SDK.IMode.brief]) await handleBriefModeReport(this.sdk, this.options, this.options.disableClientServer);
|
|
100
|
+
else await this.sdk.server.openClientPage('homepage');
|
|
101
|
+
if (this.options.disableClientServer || this.options.output.mode === SDK.IMode[SDK.IMode.brief] && Array.isArray(this.options.output.options?.type) && 1 === this.options.output.options.type.length && 'json' === this.options.output.options.type[0]) await this.sdk.dispose();
|
|
102
|
+
} finally{
|
|
103
|
+
timeEnd('RsdoctorRspackPlugin.done');
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
this.options = normalizeRspackUserOptions(Object.assign(options || {}, {
|
|
107
|
+
supports: {
|
|
108
|
+
...options?.supports
|
|
109
|
+
}
|
|
110
|
+
}));
|
|
111
|
+
const { port, server, output, innerClientPath, printLog, sdkInstance } = this.options;
|
|
112
|
+
this.sdk = this.options.sdkInstance ?? new RsdoctorSDK({
|
|
113
|
+
port,
|
|
114
|
+
name: pluginTapName,
|
|
115
|
+
root: process.cwd(),
|
|
116
|
+
type: output.reportCodeType,
|
|
117
|
+
config: {
|
|
118
|
+
innerClientPath,
|
|
119
|
+
printLog,
|
|
120
|
+
server,
|
|
121
|
+
mode: output.mode ? output.mode : void 0,
|
|
122
|
+
brief: output.mode === SDK.IMode[SDK.IMode.brief] ? output.options || void 0 : void 0,
|
|
123
|
+
features: {
|
|
124
|
+
treeShaking: this.options.features.treeShaking
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
this.outsideInstance = Boolean(sdkInstance);
|
|
129
|
+
this.modulesGraph = new ModuleGraph();
|
|
130
|
+
this.isRsdoctorPlugin = true;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export { RsdoctorRspackPlugin };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Range, OffsetRange, Position, DocumentEditData } from './types.js';
|
|
2
|
+
/** Document Catalogue */
|
|
3
|
+
export declare class Document {
|
|
4
|
+
/** Actual document content. */
|
|
5
|
+
private _text;
|
|
6
|
+
/** Get the displacement of the file position in the text. */
|
|
7
|
+
positionAt: (offset: number) => Position | undefined;
|
|
8
|
+
/** Get the position of the displacement point in the file. */
|
|
9
|
+
offsetAt: (position: Position) => number | undefined;
|
|
10
|
+
constructor(content: string);
|
|
11
|
+
/** Generate location search */
|
|
12
|
+
private createFinder;
|
|
13
|
+
getText(range?: Range | OffsetRange): string;
|
|
14
|
+
/** Edit document data */
|
|
15
|
+
edit(data: DocumentEditData): string | undefined;
|
|
16
|
+
}
|