@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
package/dist/rules/linter.js
CHANGED
package/dist/rules/rule.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Linter, SDK, Rule as RuleTypes } from '@rsdoctor/types';
|
|
1
|
+
import { Linter, SDK, Rule as RuleTypes } from '@rsdoctor/shared/types';
|
|
2
2
|
import { LinterType } from './linter.js';
|
|
3
3
|
type DefaultRuleConfig = Linter.DefaultRuleConfig;
|
|
4
4
|
export declare class Rule<Config = DefaultRuleConfig> implements Linter.RuleMeta<Config> {
|
|
@@ -16,7 +16,7 @@ export declare class Rule<Config = DefaultRuleConfig> implements Linter.RuleMeta
|
|
|
16
16
|
get title(): string;
|
|
17
17
|
get severity(): Linter.Severity;
|
|
18
18
|
get config(): Config | undefined;
|
|
19
|
-
get category(): "compile" | "
|
|
19
|
+
get category(): "bundle" | "compile" | "emo" | RuleTypes.RuleMessageCategory;
|
|
20
20
|
setOption(opt: Linter.RuleConfigItem): void;
|
|
21
21
|
match(level: Linter.Severity): boolean;
|
|
22
22
|
validate(context: SDK.RuntimeContext): Promise<Linter.ValidateResult>;
|
package/dist/rules/rule.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { Linter, Rule } from "@rsdoctor/types";
|
|
3
|
-
import { Lodash } from "
|
|
2
|
+
import { Linter, Rule } from "@rsdoctor/shared/types";
|
|
3
|
+
import { Lodash } from "../common/index.js";
|
|
4
4
|
import { noop, toSeverity } from "./utils.js";
|
|
5
5
|
class rule_Rule {
|
|
6
6
|
static from(data) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { Linter } from "@rsdoctor/types";
|
|
2
|
+
import { Linter } from "@rsdoctor/shared/types";
|
|
3
3
|
import { defineRule } from "../../rule.js";
|
|
4
4
|
const title = 'cjs-require';
|
|
5
5
|
const CJS_REQUIRE_TYPE = 'cjs require';
|
|
@@ -30,12 +30,12 @@ const rule = defineRule(()=>({
|
|
|
30
30
|
issuerModule: {
|
|
31
31
|
id: dep.module.id,
|
|
32
32
|
path: dep.module.path,
|
|
33
|
-
|
|
33
|
+
identifier: dep.module.identifier
|
|
34
34
|
},
|
|
35
35
|
requiredModule: {
|
|
36
36
|
id: requiredModule.id,
|
|
37
37
|
path: requiredModule.path,
|
|
38
|
-
|
|
38
|
+
identifier: requiredModule.identifier
|
|
39
39
|
},
|
|
40
40
|
request: dep.request
|
|
41
41
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { Linter } from "@rsdoctor/types";
|
|
2
|
+
import { Linter } from "@rsdoctor/shared/types";
|
|
3
3
|
import { defineRule } from "../../rule.js";
|
|
4
4
|
import { getErrorMsgForDupPckChunks } from "./utils.js";
|
|
5
|
-
import { uniq } from "
|
|
5
|
+
import { uniq } from "../../../collection.js";
|
|
6
6
|
const title = 'cross-chunks-package';
|
|
7
7
|
const rule = defineRule(()=>({
|
|
8
8
|
meta: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { builtinModules } from "module";
|
|
3
|
-
import { Linter } from "@rsdoctor/types";
|
|
4
|
-
import { getDocument, parser } from "
|
|
3
|
+
import { Linter } from "@rsdoctor/shared/types";
|
|
4
|
+
import { getDocument, parser } from "../../../rule-utils/index.js";
|
|
5
5
|
import { getDefaultImportByRequest, getFixData, getSourceRangeFromTransformedOffset, hasSameLeftInAssignStatement } from "./utils.js";
|
|
6
6
|
import { defineRule } from "../../rule.js";
|
|
7
7
|
const title = 'default-import-check';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Node, Range } from '
|
|
2
|
-
import type { SDK, Linter } from '@rsdoctor/types';
|
|
1
|
+
import { Node, Range } from '../../../rule-utils/index.js';
|
|
2
|
+
import type { SDK, Linter } from '@rsdoctor/shared/types';
|
|
3
3
|
export declare function getDefaultImportByRequest(node: Node.Program, request: string): Node.ImportDeclaration | undefined;
|
|
4
4
|
/**
|
|
5
5
|
* Determine that it contains the same left value assignment expression in the enumeration.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { getDocument, parser } from "
|
|
3
|
-
import { Lodash } from "
|
|
2
|
+
import { getDocument, parser } from "../../../rule-utils/index.js";
|
|
3
|
+
import { Lodash } from "../../../common/index.js";
|
|
4
4
|
function getDefaultImportByRequest(node, request) {
|
|
5
5
|
return parser.utils.getDefaultImports(node).find((decl)=>decl.source.value === request);
|
|
6
6
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Linter } from '@rsdoctor/types';
|
|
2
|
-
import
|
|
1
|
+
import { Linter } from '@rsdoctor/shared/types';
|
|
2
|
+
import type { Config } from './types.js';
|
|
3
3
|
export type { Config, CheckVersion } from './types.js';
|
|
4
|
-
export declare const rule: Linter.RuleData<
|
|
4
|
+
export declare const rule: Linter.RuleData<Config, "duplicate-package">;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { Linter } from "@rsdoctor/types";
|
|
2
|
+
import { Linter } from "@rsdoctor/shared/types";
|
|
3
3
|
import { diff, gt } from "semver";
|
|
4
4
|
import { getErrorDetail, getErrorMsg } from "./utils.js";
|
|
5
5
|
import { defineRule } from "../../rule.js";
|
|
6
|
-
import * as
|
|
6
|
+
import * as __rspack_external__types_js_b06c0ce5 from "./types.js";
|
|
7
7
|
const title = 'duplicate-package';
|
|
8
|
-
const { CheckVersionMap: CheckVersionMap } =
|
|
8
|
+
const { CheckVersionMap: CheckVersionMap } = __rspack_external__types_js_b06c0ce5;
|
|
9
9
|
const rule = defineRule(()=>({
|
|
10
10
|
meta: {
|
|
11
11
|
code: 'E1001',
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { SDK, Rule } from '@rsdoctor/types';
|
|
1
|
+
import type { SDK, Rule } from '@rsdoctor/shared/types';
|
|
2
2
|
export declare function getErrorMsg(packages: SDK.PackageInstance[], root: string): string;
|
|
3
3
|
export declare function getErrorDetail(pkg: SDK.PackageInstance, pkgGraph: SDK.PackageGraphInstance): Rule.PackageRelationData;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Config } from './types.js';
|
|
2
|
-
import { Linter } from '@rsdoctor/types';
|
|
2
|
+
import { Linter } from '@rsdoctor/shared/types';
|
|
3
3
|
export type { Config } from './types.js';
|
|
4
|
-
|
|
4
|
+
declare const title = "ecma-version-check";
|
|
5
|
+
export declare const rule: Linter.RuleData<Config, typeof title>;
|
|
@@ -3,7 +3,7 @@ import path from "path";
|
|
|
3
3
|
import { CheckSyntax } from "@rsbuild/plugin-check-syntax";
|
|
4
4
|
import { loadConfig } from "browserslist-load-config";
|
|
5
5
|
import { defineRule } from "../../rule.js";
|
|
6
|
-
import { Linter } from "@rsdoctor/types";
|
|
6
|
+
import { Linter } from "@rsdoctor/shared/types";
|
|
7
7
|
const title = 'ecma-version-check';
|
|
8
8
|
const rule = defineRule(()=>({
|
|
9
9
|
meta: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ECMAVersion } from '
|
|
1
|
+
import type { ECMAVersion } from '../../../rule-utils/index.js';
|
|
2
2
|
export declare function getVersionNumber(ECMAString: ECMAVersion): number | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import { Linter, SDK } from "@rsdoctor/types";
|
|
4
|
+
import { Linter, SDK } from "@rsdoctor/shared/types";
|
|
5
5
|
import { defineRule } from "../../rule.js";
|
|
6
6
|
const title = 'esm-resolved-to-cjs';
|
|
7
7
|
function normalizePathForCompare(filePath) {
|
|
@@ -64,27 +64,12 @@ function matchPatternExportKey(patternKey, exportKey) {
|
|
|
64
64
|
if (!exportKey.startsWith(prefix) || !exportKey.endsWith(suffix)) return null;
|
|
65
65
|
return exportKey.slice(prefix.length, exportKey.length - suffix.length);
|
|
66
66
|
}
|
|
67
|
-
function isPatternExportKey(key) {
|
|
68
|
-
return key.indexOf('*') === key.lastIndexOf('*') && key.includes('*');
|
|
69
|
-
}
|
|
70
|
-
function patternKeyCompare(keyA, keyB) {
|
|
71
|
-
const baseLengthA = keyA.includes('*') ? keyA.indexOf('*') + 1 : keyA.length;
|
|
72
|
-
const baseLengthB = keyB.includes('*') ? keyB.indexOf('*') + 1 : keyB.length;
|
|
73
|
-
if (baseLengthA > baseLengthB) return -1;
|
|
74
|
-
if (baseLengthB > baseLengthA) return 1;
|
|
75
|
-
if (!keyA.includes('*')) return 1;
|
|
76
|
-
if (!keyB.includes('*')) return -1;
|
|
77
|
-
if (keyA.length > keyB.length) return -1;
|
|
78
|
-
if (keyB.length > keyA.length) return 1;
|
|
79
|
-
return 0;
|
|
80
|
-
}
|
|
81
67
|
function resolveExportEntry(exports, exportKey) {
|
|
82
68
|
if (Object.prototype.hasOwnProperty.call(exports, exportKey)) return {
|
|
83
69
|
value: exports[exportKey],
|
|
84
70
|
wildcard: ''
|
|
85
71
|
};
|
|
86
|
-
const
|
|
87
|
-
for (const [key, value] of patternEntries){
|
|
72
|
+
for (const [key, value] of Object.entries(exports)){
|
|
88
73
|
const wildcard = matchPatternExportKey(key, exportKey);
|
|
89
74
|
if (null !== wildcard) return {
|
|
90
75
|
value,
|
|
@@ -181,7 +166,7 @@ const rule = defineRule(()=>({
|
|
|
181
166
|
resolvedModule: {
|
|
182
167
|
id: dep.dependency.id,
|
|
183
168
|
path: dep.dependency.path,
|
|
184
|
-
|
|
169
|
+
identifier: dep.dependency.identifier
|
|
185
170
|
},
|
|
186
171
|
issuers: [
|
|
187
172
|
issuer
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Linter } from '@rsdoctor/types';
|
|
1
|
+
import type { Linter } from '@rsdoctor/shared/types';
|
|
2
2
|
export declare const rules: Linter.RuleData[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { Linter } from "@rsdoctor/types";
|
|
3
|
-
import { Loader, Time } from "
|
|
2
|
+
import { Linter } from "@rsdoctor/shared/types";
|
|
3
|
+
import { Loader, Time } from "../../../common/index.js";
|
|
4
4
|
import { defineRule } from "../../rule.js";
|
|
5
5
|
import { match } from "./utils.js";
|
|
6
6
|
const title = 'loader-performance-optimization';
|
|
@@ -29,7 +29,7 @@ const rule = defineRule(()=>({
|
|
|
29
29
|
const { extensions, ignore = [], threshold = 5000 } = ruleConfig;
|
|
30
30
|
if (!extensions || extensions?.length === 0) return;
|
|
31
31
|
if (0 === loader.length) return;
|
|
32
|
-
const { config } = configs.find((e)=>'
|
|
32
|
+
const { config } = configs.find((e)=>'rspack' === e.name) || {
|
|
33
33
|
config: void 0
|
|
34
34
|
};
|
|
35
35
|
if (!config) return;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { Linter } from "@rsdoctor/types";
|
|
2
|
+
import { Linter } from "@rsdoctor/shared/types";
|
|
3
3
|
import { defineRule } from "../../rule.js";
|
|
4
4
|
const title = 'module-mixed-chunks';
|
|
5
5
|
const rule = defineRule(()=>({
|
|
@@ -28,7 +28,7 @@ const rule = defineRule(()=>({
|
|
|
28
28
|
module: {
|
|
29
29
|
id: module.id,
|
|
30
30
|
path: module.path,
|
|
31
|
-
|
|
31
|
+
identifier: module.identifier
|
|
32
32
|
},
|
|
33
33
|
initialChunks: initialChunks.map((chunk)=>({
|
|
34
34
|
id: chunk.id,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { Linter } from "@rsdoctor/types";
|
|
2
|
+
import { Linter } from "@rsdoctor/shared/types";
|
|
3
3
|
import { defineRule } from "../../rule.js";
|
|
4
4
|
const title = 'tree-shaking-side-effects-only';
|
|
5
5
|
function isSideEffectDependencyType(dependencyType) {
|
|
@@ -61,7 +61,7 @@ const rule = defineRule(()=>({
|
|
|
61
61
|
module: {
|
|
62
62
|
id: module.id,
|
|
63
63
|
path: module.path,
|
|
64
|
-
|
|
64
|
+
identifier: module.identifier
|
|
65
65
|
},
|
|
66
66
|
connections: sideEffectConnections.map((c)=>({
|
|
67
67
|
originModule: c.originModule ?? module.id,
|
package/dist/rules/utils.d.ts
CHANGED
package/dist/rules/utils.js
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Manifest } from '@rsdoctor/shared/types';
|
|
2
|
+
import { RsdoctorPrimarySDK } from './primary.js';
|
|
3
|
+
export declare class RsdoctorSDKController {
|
|
4
|
+
readonly slaves: RsdoctorPrimarySDK[];
|
|
5
|
+
root: string;
|
|
6
|
+
constructor(root?: string);
|
|
7
|
+
get master(): RsdoctorPrimarySDK;
|
|
8
|
+
getLastSdk(): RsdoctorPrimarySDK;
|
|
9
|
+
hasName(name: string): boolean;
|
|
10
|
+
getSeriesData(serverUrl?: boolean): Manifest.RsdoctorManifestSeriesData[];
|
|
11
|
+
createSlave({ name, stage, extraConfig, type, }: Omit<ConstructorParameters<typeof RsdoctorPrimarySDK>[0], 'controller'>): RsdoctorPrimarySDK;
|
|
12
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { RsdoctorPrimarySDK } from "./primary.js";
|
|
3
|
+
class RsdoctorSDKController {
|
|
4
|
+
get master() {
|
|
5
|
+
return this.slaves[0];
|
|
6
|
+
}
|
|
7
|
+
getLastSdk() {
|
|
8
|
+
return this.slaves[this.slaves.length - 1];
|
|
9
|
+
}
|
|
10
|
+
hasName(name) {
|
|
11
|
+
return Boolean(this.slaves.find((item)=>item.name === name));
|
|
12
|
+
}
|
|
13
|
+
getSeriesData(serverUrl = false) {
|
|
14
|
+
return this.slaves.map((item)=>{
|
|
15
|
+
const data = {
|
|
16
|
+
name: item.name,
|
|
17
|
+
path: item.diskManifestPath,
|
|
18
|
+
stage: item.stage
|
|
19
|
+
};
|
|
20
|
+
if (serverUrl) data.origin = item.server.origin;
|
|
21
|
+
return data;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
createSlave({ name, stage, extraConfig, type }) {
|
|
25
|
+
const slave = new RsdoctorPrimarySDK({
|
|
26
|
+
name,
|
|
27
|
+
stage,
|
|
28
|
+
controller: this,
|
|
29
|
+
extraConfig,
|
|
30
|
+
type
|
|
31
|
+
});
|
|
32
|
+
this.slaves.push(slave);
|
|
33
|
+
this.slaves.sort((a, b)=>a.stage - b.stage);
|
|
34
|
+
return slave;
|
|
35
|
+
}
|
|
36
|
+
constructor(root = process.cwd()){
|
|
37
|
+
this.slaves = [];
|
|
38
|
+
this.root = '';
|
|
39
|
+
this.root = root;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export { RsdoctorSDKController };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Manifest, SDK } from '@rsdoctor/shared/types';
|
|
2
|
+
import { RsdoctorSDK } from '../sdk/index.js';
|
|
3
|
+
import type { RsdoctorSDKController } from './controller.js';
|
|
4
|
+
interface RsdoctorSlaveSDKOptions {
|
|
5
|
+
name: string;
|
|
6
|
+
/**
|
|
7
|
+
* use to sort for display in the client page.
|
|
8
|
+
* the smaller the front.
|
|
9
|
+
* @default 1
|
|
10
|
+
*/
|
|
11
|
+
stage?: number;
|
|
12
|
+
extraConfig?: SDK.SDKOptionsType;
|
|
13
|
+
controller: RsdoctorSDKController;
|
|
14
|
+
type: SDK.ToDataType;
|
|
15
|
+
}
|
|
16
|
+
export declare class RsdoctorPrimarySDK extends RsdoctorSDK implements SDK.RsdoctorBuilderSDKInstance {
|
|
17
|
+
id: number;
|
|
18
|
+
parent: RsdoctorSDKController;
|
|
19
|
+
readonly stage: number;
|
|
20
|
+
dependencies: Array<string> | undefined;
|
|
21
|
+
private uploadPieces;
|
|
22
|
+
private finishUploadPieceSwitch;
|
|
23
|
+
constructor({ name, stage, controller, extraConfig, type, }: RsdoctorSlaveSDKOptions);
|
|
24
|
+
private clearSwitch;
|
|
25
|
+
get isMaster(): boolean;
|
|
26
|
+
protected writePieces(): Promise<void>;
|
|
27
|
+
protected writeManifest(): Promise<string>;
|
|
28
|
+
getSeriesData(serverUrl?: boolean): Manifest.RsdoctorManifestSeriesData[];
|
|
29
|
+
setName(name: string): void;
|
|
30
|
+
getManifestData(): Manifest.RsdoctorManifestWithShardingFiles;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { RsdoctorSDK } from "../sdk/index.js";
|
|
4
|
+
import { RsdoctorSlaveServer } from "./server.js";
|
|
5
|
+
let id = 1;
|
|
6
|
+
class RsdoctorPrimarySDK extends RsdoctorSDK {
|
|
7
|
+
clearSwitch() {
|
|
8
|
+
this.uploadPieces = new Promise((resolve)=>{
|
|
9
|
+
this.finishUploadPieceSwitch = resolve;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
get isMaster() {
|
|
13
|
+
return this.parent.master === this;
|
|
14
|
+
}
|
|
15
|
+
async writePieces() {
|
|
16
|
+
const { name, parent, isMaster, outputDir, finishUploadPieceSwitch } = this;
|
|
17
|
+
this.setOutputDir(isMaster ? outputDir : path.join(parent.master.outputDir, '.slaves', name.replace(/\s+/g, '-')));
|
|
18
|
+
await super.writePieces(this.getStoreData());
|
|
19
|
+
finishUploadPieceSwitch?.();
|
|
20
|
+
}
|
|
21
|
+
async writeManifest() {
|
|
22
|
+
const { parent, cloudData, dependencies } = this;
|
|
23
|
+
if (!dependencies?.length) await Promise.all(this.parent.slaves.filter((item)=>!item.dependencies?.length).map((item)=>item.uploadPieces));
|
|
24
|
+
if (cloudData) {
|
|
25
|
+
cloudData.name = this.name;
|
|
26
|
+
cloudData.series = parent.getSeriesData();
|
|
27
|
+
}
|
|
28
|
+
const result = await super.writeManifest();
|
|
29
|
+
this.clearSwitch();
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
getSeriesData(serverUrl = false) {
|
|
33
|
+
return this.parent.getSeriesData(serverUrl);
|
|
34
|
+
}
|
|
35
|
+
setName(name) {
|
|
36
|
+
this._name = this.parent.hasName(name) ? `${name}-${id}` : name;
|
|
37
|
+
}
|
|
38
|
+
getManifestData() {
|
|
39
|
+
const data = super.getManifestData();
|
|
40
|
+
data.name = this.name;
|
|
41
|
+
data.series = this.getSeriesData(true);
|
|
42
|
+
return data;
|
|
43
|
+
}
|
|
44
|
+
constructor({ name, stage, controller, extraConfig, type }){
|
|
45
|
+
super({
|
|
46
|
+
name,
|
|
47
|
+
root: controller.root,
|
|
48
|
+
config: extraConfig
|
|
49
|
+
});
|
|
50
|
+
const lastSdk = controller.getLastSdk();
|
|
51
|
+
const port = lastSdk ? lastSdk.server.port + 1 : extraConfig?.server?.port ?? this.server.port;
|
|
52
|
+
this.id = id++;
|
|
53
|
+
this.stage = 'number' == typeof stage ? stage : 1;
|
|
54
|
+
this.extraConfig = extraConfig;
|
|
55
|
+
this.parent = controller;
|
|
56
|
+
this.server = new RsdoctorSlaveServer(this, port, {
|
|
57
|
+
cors: extraConfig?.server?.cors
|
|
58
|
+
});
|
|
59
|
+
this.type = type;
|
|
60
|
+
this.setName(name);
|
|
61
|
+
this.clearSwitch();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export { RsdoctorPrimarySDK };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RsdoctorServer, type RsdoctorServerOptions } from '../server/index.js';
|
|
2
|
+
import type { RsdoctorPrimarySDK } from './primary.js';
|
|
3
|
+
export declare class RsdoctorSlaveServer extends RsdoctorServer {
|
|
4
|
+
protected sdk: RsdoctorPrimarySDK;
|
|
5
|
+
constructor(sdk: RsdoctorPrimarySDK, port?: number, config?: RsdoctorServerOptions);
|
|
6
|
+
openClientPage(...args: unknown[]): Promise<void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { Server } from "../../build-utils/index.js";
|
|
3
|
+
import { RsdoctorServer } from "../server/index.js";
|
|
4
|
+
class RsdoctorSlaveServer extends RsdoctorServer {
|
|
5
|
+
async openClientPage(...args) {
|
|
6
|
+
if (this.sdk.isMaster) return super.openClientPage(...args);
|
|
7
|
+
return Promise.resolve();
|
|
8
|
+
}
|
|
9
|
+
constructor(sdk, port = Server.defaultPort, config){
|
|
10
|
+
super(sdk, port, config);
|
|
11
|
+
this.sdk = sdk;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export { RsdoctorSlaveServer };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Common, Manifest, SDK } from '@rsdoctor/shared/types';
|
|
2
|
+
import { RsdoctorSDKOptions, DataWithUrl } from './types.js';
|
|
3
|
+
export declare abstract class SDKCore<T extends RsdoctorSDKOptions> implements SDK.RsdoctorSDKInstance {
|
|
4
|
+
protected _name: string;
|
|
5
|
+
protected hash: string;
|
|
6
|
+
extraConfig: SDK.SDKOptionsType | undefined;
|
|
7
|
+
readonly root: string;
|
|
8
|
+
readonly pid: number;
|
|
9
|
+
readonly hooks: SDK.Hooks;
|
|
10
|
+
protected _envinfo: SDK.EnvInfo;
|
|
11
|
+
private _clientRoutes;
|
|
12
|
+
private _outputDir;
|
|
13
|
+
diskManifestPath: string;
|
|
14
|
+
cloudData?: Manifest.RsdoctorManifestWithShardingFiles;
|
|
15
|
+
constructor({ name, root }: T);
|
|
16
|
+
get outputDir(): string;
|
|
17
|
+
get name(): string;
|
|
18
|
+
bootstrap(): Promise<void>;
|
|
19
|
+
dispose(): Promise<void>;
|
|
20
|
+
setOutputDir(outputDir: string): void;
|
|
21
|
+
setName(name: string): void;
|
|
22
|
+
setHash(hash: string): void;
|
|
23
|
+
getHash(): string;
|
|
24
|
+
getClientRoutes(): Manifest.RsdoctorManifestClientRoutes[];
|
|
25
|
+
addClientRoutes(routes: Manifest.RsdoctorManifestClientRoutes[]): void;
|
|
26
|
+
/** Upload analysis data pieces */
|
|
27
|
+
protected writePieces(storeData: Common.PlainObject, _options?: SDK.WriteStoreOptionsType): Promise<void>;
|
|
28
|
+
/** Upload manifest file */
|
|
29
|
+
protected writeManifest(): Promise<string>;
|
|
30
|
+
saveManifest(data: Common.PlainObject, options: SDK.WriteStoreOptionsType): Promise<string>;
|
|
31
|
+
protected writeToFolder(jsonStr: string, dir: string, key: string, index?: number): Promise<DataWithUrl>;
|
|
32
|
+
abstract onDataReport(): void | Promise<void>;
|
|
33
|
+
}
|