@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,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
getModuleGraphByStats: ()=>getModuleGraphByStats
|
|
32
|
-
});
|
|
33
|
-
const graph_namespaceObject = require("@rsdoctor/graph");
|
|
34
|
-
const external_index_cjs_namespaceObject = require("./index.cjs");
|
|
35
|
-
function getModuleGraphByStats(compilation, stats, root, chunkGraph, features, context) {
|
|
36
|
-
return (0, external_index_cjs_namespaceObject.appendModuleGraphByCompilation)(compilation, graph_namespaceObject.ModuleGraphTrans.getModuleGraphByStats(stats, root, chunkGraph), features, context);
|
|
37
|
-
}
|
|
38
|
-
exports.getModuleGraphByStats = __webpack_exports__.getModuleGraphByStats;
|
|
39
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
40
|
-
"getModuleGraphByStats"
|
|
41
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
42
|
-
Object.defineProperty(exports, '__esModule', {
|
|
43
|
-
value: true
|
|
44
|
-
});
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Plugin } from '@rsdoctor/types';
|
|
2
|
-
import { TransformContext } from '.';
|
|
3
|
-
import { SDK } from '@rsdoctor/types';
|
|
4
|
-
export declare function getModuleGraphByStats(compilation: Plugin.BaseCompilation, stats: Plugin.StatsCompilation, root: string, chunkGraph: SDK.ChunkGraphInstance, features?: Plugin.RsdoctorWebpackPluginFeatures, context?: TransformContext): Promise<SDK.ModuleGraphInstance>;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Plugin } from '@rsdoctor/types';
|
|
2
|
-
import { TransformContext } from './index.js';
|
|
3
|
-
import { SDK } from '@rsdoctor/types';
|
|
4
|
-
export declare function getModuleGraphByStats(compilation: Plugin.BaseCompilation, stats: Plugin.StatsCompilation, root: string, chunkGraph: SDK.ChunkGraphInstance, features?: Plugin.RsdoctorWebpackPluginFeatures, context?: TransformContext): Promise<SDK.ModuleGraphInstance>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { ModuleGraphTrans } from "@rsdoctor/graph";
|
|
3
|
-
import { appendModuleGraphByCompilation } from "./index.js";
|
|
4
|
-
function getModuleGraphByStats(compilation, stats, root, chunkGraph, features, context) {
|
|
5
|
-
return appendModuleGraphByCompilation(compilation, ModuleGraphTrans.getModuleGraphByStats(stats, root, chunkGraph), features, context);
|
|
6
|
-
}
|
|
7
|
-
export { getModuleGraphByStats };
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
appendTreeShaking: ()=>appendTreeShaking
|
|
32
|
-
});
|
|
33
|
-
const graph_namespaceObject = require("@rsdoctor/graph");
|
|
34
|
-
const external_utils_cjs_namespaceObject = require("./utils.cjs");
|
|
35
|
-
function transformMgm(origin, webpackGraph, graph, cache) {
|
|
36
|
-
const module = graph.getModuleByWebpackId(origin.identifier());
|
|
37
|
-
if (!module) return;
|
|
38
|
-
const mgm = new graph_namespaceObject.ModuleGraphModule(module, graph);
|
|
39
|
-
const originalMgm = webpackGraph.getExportsInfo(origin);
|
|
40
|
-
graph.addModuleGraphModule(mgm);
|
|
41
|
-
for (const info of originalMgm.exports){
|
|
42
|
-
const { name } = info;
|
|
43
|
-
const exportIdStatement = (0, external_utils_cjs_namespaceObject.getExportIdentifierStatement)(name, module) ?? graph_namespaceObject.Statement.getDefaultStatement(module);
|
|
44
|
-
const declareIdStatement = (0, external_utils_cjs_namespaceObject.getDeclarationIdentifier)(name, module);
|
|
45
|
-
const exportInfo = new graph_namespaceObject.ExportInfo(info.name, exportIdStatement);
|
|
46
|
-
if (declareIdStatement) {
|
|
47
|
-
const variable = new graph_namespaceObject.Variable(name, module, info.getUsedInfo(), declareIdStatement);
|
|
48
|
-
variable.setExportInfo(exportInfo);
|
|
49
|
-
mgm.addVariable(variable);
|
|
50
|
-
}
|
|
51
|
-
cache.set(info, exportInfo);
|
|
52
|
-
mgm.addExportInfo(exportInfo);
|
|
53
|
-
}
|
|
54
|
-
for (const dep of origin.dependencies){
|
|
55
|
-
if ('harmony import specifier' !== dep.type) continue;
|
|
56
|
-
const HISDep = dep;
|
|
57
|
-
const { name, userRequest } = HISDep;
|
|
58
|
-
const originName = HISDep.getIds(webpackGraph)[0] ?? graph_namespaceObject.SideEffect.NamespaceSymbol;
|
|
59
|
-
const importIdStatement = module.getStatement(dep.loc);
|
|
60
|
-
const importInfo = new graph_namespaceObject.SideEffect(name, module, importIdStatement, userRequest, originName);
|
|
61
|
-
mgm.addSideEffect(importInfo);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
function appendExportConnection(origin, webpackGraph, graph, cache) {
|
|
65
|
-
const module = graph.getModuleByWebpackId(origin.identifier());
|
|
66
|
-
const mgm = graph.getModuleGraphModule(module);
|
|
67
|
-
const originalMgm = webpackGraph.getExportsInfo(origin);
|
|
68
|
-
if (!mgm || !module) return;
|
|
69
|
-
for (const info of originalMgm.exports){
|
|
70
|
-
if (!info.isReexport()) continue;
|
|
71
|
-
const lastExport = graph_namespaceObject.Webpack.getLastExportInfo(info, webpackGraph);
|
|
72
|
-
const lastSdkExport = cache.get(lastExport);
|
|
73
|
-
const sdkExport = cache.get(info);
|
|
74
|
-
if (!lastSdkExport || !sdkExport) return;
|
|
75
|
-
sdkExport.setFromExport(lastSdkExport);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
function appendImportConnection(origin, graph) {
|
|
79
|
-
const module = graph.getModuleByWebpackId(origin.identifier());
|
|
80
|
-
const mgm = graph.getModuleGraphModule(module);
|
|
81
|
-
if (!mgm || !module) return;
|
|
82
|
-
for (const info of mgm.getSideEffects()){
|
|
83
|
-
const exportName = info.originName ?? info.name;
|
|
84
|
-
const resolveModule = info.fromDependency?.dependency;
|
|
85
|
-
if (!resolveModule) continue;
|
|
86
|
-
const resolveExport = graph.getModuleGraphModule(resolveModule).getExport(exportName);
|
|
87
|
-
if (resolveExport) info.setExportInfo(resolveExport);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
function appendTreeShaking(moduleGraph, compilation) {
|
|
91
|
-
if (!graph_namespaceObject.ModuleGraphTrans.isWebpack5orRspack(compilation)) return moduleGraph;
|
|
92
|
-
if ('moduleGraph' in compilation) {
|
|
93
|
-
const exportData = new Map();
|
|
94
|
-
const webpackCompilation = compilation;
|
|
95
|
-
const { moduleGraph: webpackGraph } = webpackCompilation;
|
|
96
|
-
const allModules = graph_namespaceObject.Webpack.getAllModules(webpackCompilation);
|
|
97
|
-
allModules.forEach((origin)=>transformMgm(origin, webpackGraph, moduleGraph, exportData));
|
|
98
|
-
allModules.forEach((origin)=>appendExportConnection(origin, webpackGraph, moduleGraph, exportData));
|
|
99
|
-
allModules.forEach((origin)=>appendImportConnection(origin, moduleGraph));
|
|
100
|
-
exportData.clear();
|
|
101
|
-
}
|
|
102
|
-
return moduleGraph;
|
|
103
|
-
}
|
|
104
|
-
exports.appendTreeShaking = __webpack_exports__.appendTreeShaking;
|
|
105
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
106
|
-
"appendTreeShaking"
|
|
107
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
108
|
-
Object.defineProperty(exports, '__esModule', {
|
|
109
|
-
value: true
|
|
110
|
-
});
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { ExportInfo, ModuleGraphModule, ModuleGraphTrans, SideEffect, Statement, Variable, Webpack } from "@rsdoctor/graph";
|
|
3
|
-
import { getDeclarationIdentifier, getExportIdentifierStatement } from "./utils.js";
|
|
4
|
-
function transformMgm(origin, webpackGraph, graph, cache) {
|
|
5
|
-
const module = graph.getModuleByWebpackId(origin.identifier());
|
|
6
|
-
if (!module) return;
|
|
7
|
-
const mgm = new ModuleGraphModule(module, graph);
|
|
8
|
-
const originalMgm = webpackGraph.getExportsInfo(origin);
|
|
9
|
-
graph.addModuleGraphModule(mgm);
|
|
10
|
-
for (const info of originalMgm.exports){
|
|
11
|
-
const { name } = info;
|
|
12
|
-
const exportIdStatement = getExportIdentifierStatement(name, module) ?? Statement.getDefaultStatement(module);
|
|
13
|
-
const declareIdStatement = getDeclarationIdentifier(name, module);
|
|
14
|
-
const exportInfo = new ExportInfo(info.name, exportIdStatement);
|
|
15
|
-
if (declareIdStatement) {
|
|
16
|
-
const variable = new Variable(name, module, info.getUsedInfo(), declareIdStatement);
|
|
17
|
-
variable.setExportInfo(exportInfo);
|
|
18
|
-
mgm.addVariable(variable);
|
|
19
|
-
}
|
|
20
|
-
cache.set(info, exportInfo);
|
|
21
|
-
mgm.addExportInfo(exportInfo);
|
|
22
|
-
}
|
|
23
|
-
for (const dep of origin.dependencies){
|
|
24
|
-
if ('harmony import specifier' !== dep.type) continue;
|
|
25
|
-
const HISDep = dep;
|
|
26
|
-
const { name, userRequest } = HISDep;
|
|
27
|
-
const originName = HISDep.getIds(webpackGraph)[0] ?? SideEffect.NamespaceSymbol;
|
|
28
|
-
const importIdStatement = module.getStatement(dep.loc);
|
|
29
|
-
const importInfo = new SideEffect(name, module, importIdStatement, userRequest, originName);
|
|
30
|
-
mgm.addSideEffect(importInfo);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function appendExportConnection(origin, webpackGraph, graph, cache) {
|
|
34
|
-
const module = graph.getModuleByWebpackId(origin.identifier());
|
|
35
|
-
const mgm = graph.getModuleGraphModule(module);
|
|
36
|
-
const originalMgm = webpackGraph.getExportsInfo(origin);
|
|
37
|
-
if (!mgm || !module) return;
|
|
38
|
-
for (const info of originalMgm.exports){
|
|
39
|
-
if (!info.isReexport()) continue;
|
|
40
|
-
const lastExport = Webpack.getLastExportInfo(info, webpackGraph);
|
|
41
|
-
const lastSdkExport = cache.get(lastExport);
|
|
42
|
-
const sdkExport = cache.get(info);
|
|
43
|
-
if (!lastSdkExport || !sdkExport) return;
|
|
44
|
-
sdkExport.setFromExport(lastSdkExport);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function appendImportConnection(origin, graph) {
|
|
48
|
-
const module = graph.getModuleByWebpackId(origin.identifier());
|
|
49
|
-
const mgm = graph.getModuleGraphModule(module);
|
|
50
|
-
if (!mgm || !module) return;
|
|
51
|
-
for (const info of mgm.getSideEffects()){
|
|
52
|
-
const exportName = info.originName ?? info.name;
|
|
53
|
-
const resolveModule = info.fromDependency?.dependency;
|
|
54
|
-
if (!resolveModule) continue;
|
|
55
|
-
const resolveExport = graph.getModuleGraphModule(resolveModule).getExport(exportName);
|
|
56
|
-
if (resolveExport) info.setExportInfo(resolveExport);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function appendTreeShaking(moduleGraph, compilation) {
|
|
60
|
-
if (!ModuleGraphTrans.isWebpack5orRspack(compilation)) return moduleGraph;
|
|
61
|
-
if ('moduleGraph' in compilation) {
|
|
62
|
-
const exportData = new Map();
|
|
63
|
-
const webpackCompilation = compilation;
|
|
64
|
-
const { moduleGraph: webpackGraph } = webpackCompilation;
|
|
65
|
-
const allModules = Webpack.getAllModules(webpackCompilation);
|
|
66
|
-
allModules.forEach((origin)=>transformMgm(origin, webpackGraph, moduleGraph, exportData));
|
|
67
|
-
allModules.forEach((origin)=>appendExportConnection(origin, webpackGraph, moduleGraph, exportData));
|
|
68
|
-
allModules.forEach((origin)=>appendImportConnection(origin, moduleGraph));
|
|
69
|
-
exportData.clear();
|
|
70
|
-
}
|
|
71
|
-
return moduleGraph;
|
|
72
|
-
}
|
|
73
|
-
export { appendTreeShaking };
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
getDeclarationIdentifier: ()=>getDeclarationIdentifier,
|
|
32
|
-
getExportIdentifierStatement: ()=>getExportIdentifierStatement
|
|
33
|
-
});
|
|
34
|
-
const compat_namespaceObject = require("es-toolkit/compat");
|
|
35
|
-
const ruleUtils_namespaceObject = require("@rsdoctor/utils/ruleUtils");
|
|
36
|
-
function getDefaultExportIdentifier(node, module, searchId) {
|
|
37
|
-
const { declaration } = node;
|
|
38
|
-
if (ruleUtils_namespaceObject.parser.asserts.isLiteral(declaration) && declaration.loc) return module.getStatement(declaration.loc);
|
|
39
|
-
if (ruleUtils_namespaceObject.parser.asserts.isIdentifier(declaration)) {
|
|
40
|
-
if (searchId) {
|
|
41
|
-
const result = getDeclarationIdentifier(declaration.name, module);
|
|
42
|
-
if (result) return result;
|
|
43
|
-
} else if (declaration.loc) return module.getStatement(declaration.loc);
|
|
44
|
-
}
|
|
45
|
-
if (ruleUtils_namespaceObject.parser.asserts.isClassDeclaration(declaration) || ruleUtils_namespaceObject.parser.asserts.isFunctionDeclaration(declaration)) {
|
|
46
|
-
if (declaration.id?.loc) return module.getStatement(declaration.id.loc);
|
|
47
|
-
}
|
|
48
|
-
const startLine = node.declaration.loc?.start.line;
|
|
49
|
-
if (!(0, compat_namespaceObject.isNumber)(startLine)) return;
|
|
50
|
-
const { transformed } = module.getSource();
|
|
51
|
-
const endColumn = transformed.split('\n')[startLine - 1].length - 1;
|
|
52
|
-
return module.getStatement({
|
|
53
|
-
start: {
|
|
54
|
-
line: startLine,
|
|
55
|
-
column: 0
|
|
56
|
-
},
|
|
57
|
-
end: {
|
|
58
|
-
line: startLine,
|
|
59
|
-
column: endColumn
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
function getExportIdentifierStatement(name, module) {
|
|
64
|
-
const ast = module.getProgram();
|
|
65
|
-
if (!ast) return;
|
|
66
|
-
for (const node of ast.body){
|
|
67
|
-
if (ruleUtils_namespaceObject.parser.asserts.isExportDefaultDeclaration(node)) {
|
|
68
|
-
const result = getDefaultExportIdentifier(node, module, false);
|
|
69
|
-
if (result) return result;
|
|
70
|
-
}
|
|
71
|
-
const id = ruleUtils_namespaceObject.parser.utils.getIdentifierInExport(name, node);
|
|
72
|
-
if (id?.loc) return module.getStatement(id.loc);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
function getDeclarationIdentifier(name, module) {
|
|
76
|
-
const ast = module.getProgram();
|
|
77
|
-
if (!ast) return;
|
|
78
|
-
for (const node of ast.body){
|
|
79
|
-
const id = ruleUtils_namespaceObject.parser.utils.getIdentifierInDeclaration(name, node);
|
|
80
|
-
if (id?.loc) return module.getStatement(id.loc);
|
|
81
|
-
if (ruleUtils_namespaceObject.parser.asserts.isExportNamedDeclaration(node) && node.declaration) {
|
|
82
|
-
const id = ruleUtils_namespaceObject.parser.utils.getIdentifierInDeclaration(name, node.declaration);
|
|
83
|
-
if (id?.loc) return module.getStatement(id.loc);
|
|
84
|
-
}
|
|
85
|
-
if ('default' === name && ruleUtils_namespaceObject.parser.asserts.isExportDefaultDeclaration(node)) {
|
|
86
|
-
const result = getDefaultExportIdentifier(node, module, true);
|
|
87
|
-
if (result) return result;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
exports.getDeclarationIdentifier = __webpack_exports__.getDeclarationIdentifier;
|
|
92
|
-
exports.getExportIdentifierStatement = __webpack_exports__.getExportIdentifierStatement;
|
|
93
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
94
|
-
"getDeclarationIdentifier",
|
|
95
|
-
"getExportIdentifierStatement"
|
|
96
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
97
|
-
Object.defineProperty(exports, '__esModule', {
|
|
98
|
-
value: true
|
|
99
|
-
});
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { SDK } from '@rsdoctor/types';
|
|
2
|
-
export declare function getExportIdentifierStatement(name: string, module: SDK.ModuleInstance): SDK.StatementInstance | undefined;
|
|
3
|
-
export declare function getDeclarationIdentifier(name: string, module: SDK.ModuleInstance): SDK.StatementInstance | undefined;
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.n = (module)=>{
|
|
5
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
-
__webpack_require__.d(getter, {
|
|
7
|
-
a: getter
|
|
8
|
-
});
|
|
9
|
-
return getter;
|
|
10
|
-
};
|
|
11
|
-
})();
|
|
12
|
-
(()=>{
|
|
13
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
-
var define = (defs, kind)=>{
|
|
15
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
[kind]: defs[key]
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
define(getters, "get");
|
|
21
|
-
define(values, "value");
|
|
22
|
-
};
|
|
23
|
-
})();
|
|
24
|
-
(()=>{
|
|
25
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
26
|
-
})();
|
|
27
|
-
(()=>{
|
|
28
|
-
__webpack_require__.r = (exports1)=>{
|
|
29
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
30
|
-
value: 'Module'
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
33
|
-
value: true
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
})();
|
|
37
|
-
var __webpack_exports__ = {};
|
|
38
|
-
__webpack_require__.r(__webpack_exports__);
|
|
39
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
40
|
-
appendModuleGraphByCompilation: ()=>appendModuleGraphByCompilation,
|
|
41
|
-
getModuleExportsType: ()=>getModuleExportsType
|
|
42
|
-
});
|
|
43
|
-
const external_node_fs_namespaceObject = require("node:fs");
|
|
44
|
-
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
45
|
-
const graph_namespaceObject = require("@rsdoctor/graph");
|
|
46
|
-
const external_parser_cjs_namespaceObject = require("../parser.cjs");
|
|
47
|
-
const compat_namespaceObject = require("es-toolkit/compat");
|
|
48
|
-
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
49
|
-
async function readFile(target, wbFs) {
|
|
50
|
-
if (wbFs?.fs?.readFile) {
|
|
51
|
-
const result = new Promise((resolve, reject)=>{
|
|
52
|
-
wbFs.fs.readFile(target, (err, content)=>{
|
|
53
|
-
if (err) return void reject(err);
|
|
54
|
-
content ? resolve(Buffer.from(content)) : resolve();
|
|
55
|
-
});
|
|
56
|
-
}).catch(()=>{});
|
|
57
|
-
if (result) return result;
|
|
58
|
-
}
|
|
59
|
-
try {
|
|
60
|
-
return await external_node_fs_default().promises.readFile(target);
|
|
61
|
-
} catch {
|
|
62
|
-
logger_namespaceObject.logger.debug(`readFile error: ${target}`);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function getModuleExportsType(module, moduleGraph, strict = false) {
|
|
67
|
-
if (moduleGraph && 'getExportsType' in module) return module.getExportsType(moduleGraph, strict);
|
|
68
|
-
return strict ? 'default-with-named' : 'dynamic';
|
|
69
|
-
}
|
|
70
|
-
function appendDependency(webpackDep, module, webpackGraph, graph) {
|
|
71
|
-
const resolvedWebpackModule = webpackGraph?.getResolvedModule ? webpackGraph.getResolvedModule(webpackDep) : void 0;
|
|
72
|
-
if (!resolvedWebpackModule) return;
|
|
73
|
-
const rawRequest = graph_namespaceObject.Webpack.getWebpackDependencyRequest(webpackDep, resolvedWebpackModule);
|
|
74
|
-
const resolveRequest = graph_namespaceObject.Webpack.getWebpackModulePath(resolvedWebpackModule);
|
|
75
|
-
const request = rawRequest ?? resolveRequest;
|
|
76
|
-
if (!module.getDependencyByRequest(request)) {
|
|
77
|
-
const depLayer = resolvedWebpackModule.layer || void 0;
|
|
78
|
-
const depModule = graph.getModuleByFile(resolveRequest, depLayer)[0];
|
|
79
|
-
if (depModule) {
|
|
80
|
-
const dep = module.addDependency(request, depModule, graph_namespaceObject.ModuleGraphTrans.getImportKind(webpackDep));
|
|
81
|
-
if (dep) graph.addDependency(dep);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
const dependency = module.getDependencyByRequest(request);
|
|
85
|
-
if (dependency) {
|
|
86
|
-
dependency.setBuildMeta({
|
|
87
|
-
exportsType: getModuleExportsType(resolvedWebpackModule, webpackGraph, module.meta.strictHarmonyModule)
|
|
88
|
-
});
|
|
89
|
-
const statement = graph_namespaceObject.Webpack.getDependencyPosition(webpackDep, module, false);
|
|
90
|
-
if (statement) dependency.addStatement(statement);
|
|
91
|
-
dependency.statements.forEach((state)=>{
|
|
92
|
-
state.position.source = state.module.getSourceRange(state.position.transformed);
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
function getModuleSource(modulePath, wbFs, sourceMap) {
|
|
97
|
-
if (sourceMap) try {
|
|
98
|
-
const contentFromSourceMap = sourceMap.sourceContentFor(modulePath);
|
|
99
|
-
if (contentFromSourceMap) return Buffer.from(contentFromSourceMap);
|
|
100
|
-
} catch (e) {
|
|
101
|
-
logger_namespaceObject.logger.debug(`getModuleSource error: ${e}`);
|
|
102
|
-
}
|
|
103
|
-
return readFile(modulePath, wbFs);
|
|
104
|
-
}
|
|
105
|
-
async function appendModuleData(origin, webpackGraph, graph, wbFs, features, context) {
|
|
106
|
-
const module = graph.getModuleByWebpackId(graph_namespaceObject.Webpack.getWebpackModuleId(origin));
|
|
107
|
-
if (!origin || !module) return;
|
|
108
|
-
const { getSourceMap, astCache, packagePathMap } = context ?? {};
|
|
109
|
-
try {
|
|
110
|
-
const sourceMap = await getSourceMap?.(module.path);
|
|
111
|
-
const source = await getModuleSource(module.path, wbFs, sourceMap) ?? Buffer.from('');
|
|
112
|
-
if (sourceMap) module.setSourceMap(sourceMap);
|
|
113
|
-
if (astCache?.has(origin)) {
|
|
114
|
-
const program = astCache.get(origin);
|
|
115
|
-
module.setProgram(program);
|
|
116
|
-
module.meta.hasSetEsModuleStatement = (0, external_parser_cjs_namespaceObject.hasSetEsModuleStatement)(program);
|
|
117
|
-
}
|
|
118
|
-
const transformed = graph_namespaceObject.Webpack.isExternalModule(origin) ? '' : module.getSource().transformed.length > 0 ? module.getSource().transformed : (0, compat_namespaceObject.isFunction)(origin?.originalSource) ? origin.originalSource()?.source()?.toString() ?? '' : '';
|
|
119
|
-
const transformedSize = graph_namespaceObject.Webpack.isExternalModule(origin) ? 0 : module.getSize().transformedSize > 0 ? module.getSize().transformedSize : Buffer.from(transformed).byteLength;
|
|
120
|
-
module.setSource({
|
|
121
|
-
transformed,
|
|
122
|
-
source: source.toString()
|
|
123
|
-
});
|
|
124
|
-
module.setSize({
|
|
125
|
-
transformedSize,
|
|
126
|
-
sourceSize: source.byteLength
|
|
127
|
-
});
|
|
128
|
-
let packageData;
|
|
129
|
-
if (packagePathMap && origin.resourceResolveData) {
|
|
130
|
-
let { descriptionFileRoot: root } = origin.resourceResolveData;
|
|
131
|
-
const { descriptionFileData: data } = origin.resourceResolveData;
|
|
132
|
-
if (root && data && data.name && data.version) {
|
|
133
|
-
if (packagePathMap.has(root)) root = packagePathMap.get(root);
|
|
134
|
-
else {
|
|
135
|
-
const realpath = await external_node_fs_default().promises.realpath(root, {
|
|
136
|
-
encoding: 'utf-8'
|
|
137
|
-
});
|
|
138
|
-
root = realpath;
|
|
139
|
-
packagePathMap.set(root, realpath);
|
|
140
|
-
}
|
|
141
|
-
packageData = {
|
|
142
|
-
...origin.resourceResolveData.descriptionFileData,
|
|
143
|
-
root
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
module.meta.strictHarmonyModule = origin.buildMeta?.strictHarmonyModule ?? false;
|
|
148
|
-
module.meta.packageData = packageData;
|
|
149
|
-
if (!features?.lite && origin?.dependencies) Array.from(origin.dependencies).filter((item)=>graph_namespaceObject.ModuleGraphTrans.isImportDependency(item)).concat(origin.blocks.reduce((ans, item)=>ans.concat(item.dependencies), [])).forEach((dep)=>appendDependency(dep, module, webpackGraph, graph));
|
|
150
|
-
} catch (e) {
|
|
151
|
-
console.error(`module ${module.path} transform has error:`, e);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
async function appendModuleGraphByCompilation(compilation, graph, features, context) {
|
|
155
|
-
try {
|
|
156
|
-
const webpackCompilation = compilation;
|
|
157
|
-
const { moduleGraph: webpackGraph, fileSystemInfo } = webpackCompilation;
|
|
158
|
-
const allModules = graph_namespaceObject.Webpack.getAllModules(webpackCompilation);
|
|
159
|
-
await Promise.all(allModules.map((module)=>appendModuleData(module, webpackGraph, graph, fileSystemInfo, features, context)));
|
|
160
|
-
graph_namespaceObject.ModuleGraphTrans.removeNoImportStyle(graph);
|
|
161
|
-
return graph;
|
|
162
|
-
} catch {
|
|
163
|
-
return graph;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
exports.appendModuleGraphByCompilation = __webpack_exports__.appendModuleGraphByCompilation;
|
|
167
|
-
exports.getModuleExportsType = __webpack_exports__.getModuleExportsType;
|
|
168
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
169
|
-
"appendModuleGraphByCompilation",
|
|
170
|
-
"getModuleExportsType"
|
|
171
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
172
|
-
Object.defineProperty(exports, '__esModule', {
|
|
173
|
-
value: true
|
|
174
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { SourceMapConsumer } from 'source-map';
|
|
2
|
-
import * as Webpack from 'webpack';
|
|
3
|
-
import * as Rspack from '@rspack/core';
|
|
4
|
-
import { Node } from '@rsdoctor/utils/ruleUtils';
|
|
5
|
-
import { Plugin, SDK } from '@rsdoctor/types';
|
|
6
|
-
export interface TransformContext {
|
|
7
|
-
astCache?: Map<Webpack.NormalModule, Node.Program>;
|
|
8
|
-
packagePathMap?: Map<string, string>;
|
|
9
|
-
getSourceMap?(module: string): Promise<SourceMapConsumer | undefined>;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Get the type of dependencies between modules.
|
|
13
|
-
* This property can determine what runtime webpack has added to the modules.
|
|
14
|
-
*/
|
|
15
|
-
export declare function getModuleExportsType(module: Webpack.NormalModule | Rspack.NormalModule, moduleGraph?: Webpack.ModuleGraph, strict?: boolean): SDK.DependencyBuildMeta['exportsType'];
|
|
16
|
-
export declare function appendModuleGraphByCompilation(compilation: Plugin.BaseCompilation, graph: SDK.ModuleGraphInstance, features?: Plugin.RsdoctorWebpackPluginFeatures, context?: TransformContext): Promise<SDK.ModuleGraphInstance>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { SourceMapConsumer } from 'source-map';
|
|
2
|
-
import * as Webpack from 'webpack';
|
|
3
|
-
import * as Rspack from '@rspack/core';
|
|
4
|
-
import { Node } from '@rsdoctor/utils/ruleUtils';
|
|
5
|
-
import { Plugin, SDK } from '@rsdoctor/types';
|
|
6
|
-
export interface TransformContext {
|
|
7
|
-
astCache?: Map<Webpack.NormalModule, Node.Program>;
|
|
8
|
-
packagePathMap?: Map<string, string>;
|
|
9
|
-
getSourceMap?(module: string): Promise<SourceMapConsumer | undefined>;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Get the type of dependencies between modules.
|
|
13
|
-
* This property can determine what runtime webpack has added to the modules.
|
|
14
|
-
*/
|
|
15
|
-
export declare function getModuleExportsType(module: Webpack.NormalModule | Rspack.NormalModule, moduleGraph?: Webpack.ModuleGraph, strict?: boolean): SDK.DependencyBuildMeta['exportsType'];
|
|
16
|
-
export declare function appendModuleGraphByCompilation(compilation: Plugin.BaseCompilation, graph: SDK.ModuleGraphInstance, features?: Plugin.RsdoctorWebpackPluginFeatures, context?: TransformContext): Promise<SDK.ModuleGraphInstance>;
|