@rsdoctor/core 2.0.0-alpha.0 → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build-utils/build/chunks/assetsModules.d.ts +1 -1
- package/dist/build-utils/build/chunks/assetsModules.js +1 -1
- package/dist/build-utils/build/chunks/index.d.ts +0 -1
- package/dist/build-utils/build/chunks/index.js +0 -1
- package/dist/build-utils/build/chunks/rspack/transform.d.ts +1 -1
- package/dist/build-utils/build/chunks/rspack/transform.js +1 -1
- package/dist/build-utils/build/envinfo.d.ts +13 -0
- package/dist/build-utils/build/envinfo.js +60 -0
- package/dist/build-utils/build/file/cache.d.ts +5 -0
- package/dist/build-utils/build/file/cache.js +24 -0
- package/dist/build-utils/build/file/index.d.ts +3 -0
- package/dist/build-utils/build/file/index.js +5 -0
- package/dist/build-utils/build/file/sharding.d.ts +21 -0
- package/dist/build-utils/build/file/sharding.js +38 -0
- package/dist/build-utils/build/index.d.ts +5 -0
- package/dist/build-utils/build/index.js +11 -6
- package/dist/build-utils/build/json.d.ts +3 -0
- package/dist/build-utils/build/json.js +67 -0
- package/dist/build-utils/build/loader/probeLoader.d.ts +2 -2
- package/dist/build-utils/build/loader/probeLoader.js +4 -4
- package/dist/build-utils/build/loader/probeLoaderPlugin.d.ts +1 -1
- package/dist/build-utils/build/loader/probeLoaderPlugin.js +1 -1
- package/dist/build-utils/build/module-graph/index.d.ts +0 -1
- package/dist/build-utils/build/module-graph/index.js +0 -1
- package/dist/build-utils/build/module-graph/parser.d.ts +1 -1
- package/dist/build-utils/build/module-graph/parser.js +1 -1
- package/dist/build-utils/build/module-graph/rspack/transform.d.ts +1 -1
- package/dist/build-utils/build/module-graph/rspack/transform.js +6 -4
- package/dist/build-utils/build/module-graph/utils.d.ts +1 -1
- package/dist/build-utils/build/module-graph/utils.js +5 -4
- package/dist/build-utils/build/process.d.ts +2 -0
- package/dist/build-utils/build/process.js +18 -0
- package/dist/build-utils/build/server.d.ts +15 -0
- package/dist/build-utils/build/server.js +107 -0
- package/dist/build-utils/build/utils/loader.d.ts +2 -2
- package/dist/build-utils/build/utils/loader.js +10 -19
- package/dist/build-utils/build/utils/parseBundle.d.ts +1 -1
- package/dist/build-utils/build/utils/parseBundle.js +6 -8
- package/dist/build-utils/build/utils/plugin.d.ts +1 -1
- package/dist/build-utils/index.d.ts +10 -0
- package/dist/build-utils/index.js +12 -2
- package/dist/collection.d.ts +1 -0
- package/dist/collection.js +2 -0
- package/dist/common/file.d.ts +2 -0
- package/dist/common/file.js +8 -0
- package/dist/common/global-config.d.ts +21 -0
- package/dist/common/global-config.js +33 -0
- package/dist/common/index.d.ts +4 -0
- package/dist/common/index.js +6 -0
- package/dist/common-browser.d.ts +1 -0
- package/dist/common-browser.js +2 -0
- package/dist/error/error.d.ts +35 -0
- package/dist/error/error.js +143 -0
- package/dist/error/index.d.ts +2 -0
- package/dist/error/index.js +3 -0
- package/dist/error/transform.d.ts +3 -0
- package/dist/error/transform.js +138 -0
- package/dist/error/utils.d.ts +4 -0
- package/dist/error/utils.js +23 -0
- package/dist/graph/index.d.ts +1 -0
- package/dist/graph/index.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -2
- package/dist/inner-plugins/loaders/proxy.d.ts +4 -4
- package/dist/inner-plugins/plugins/base.d.ts +1 -1
- package/dist/inner-plugins/plugins/bundle.d.ts +1 -1
- package/dist/inner-plugins/plugins/bundle.js +3 -3
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts +3 -3
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +11 -39
- package/dist/inner-plugins/plugins/errors.d.ts +2 -2
- package/dist/inner-plugins/plugins/errors.js +3 -3
- package/dist/inner-plugins/plugins/loader.d.ts +1 -1
- package/dist/inner-plugins/plugins/loader.js +7 -19
- package/dist/inner-plugins/plugins/plugins.d.ts +1 -1
- package/dist/inner-plugins/plugins/plugins.js +2 -2
- package/dist/inner-plugins/plugins/progress.d.ts +2 -2
- package/dist/inner-plugins/plugins/progress.js +2 -2
- package/dist/inner-plugins/plugins/resolver.d.ts +1 -1
- package/dist/inner-plugins/plugins/resolver.js +2 -2
- package/dist/inner-plugins/plugins/rspack.d.ts +8 -3
- package/dist/inner-plugins/plugins/rspack.js +18 -4
- package/dist/inner-plugins/plugins/rules.d.ts +1 -1
- package/dist/inner-plugins/plugins/rules.js +3 -3
- package/dist/inner-plugins/plugins/sourcemapTool.d.ts +2 -2
- package/dist/inner-plugins/plugins/sourcemapTool.js +2 -2
- package/dist/inner-plugins/plugins/summary.d.ts +1 -1
- package/dist/inner-plugins/plugins/summary.js +3 -3
- package/dist/inner-plugins/utils/config.d.ts +2 -3
- package/dist/inner-plugins/utils/config.js +16 -17
- package/dist/inner-plugins/utils/loader.d.ts +4 -7
- package/dist/inner-plugins/utils/loader.js +8 -34
- package/dist/inner-plugins/utils/normalize-config.d.ts +1 -1
- package/dist/inner-plugins/utils/openBrowser.d.ts +1 -0
- package/dist/inner-plugins/utils/openBrowser.js +55 -0
- package/dist/inner-plugins/utils/plugin-common.js +4 -4
- package/dist/inner-plugins/utils/plugin.d.ts +1 -1
- package/dist/inner-plugins/utils/plugin.js +1 -1
- package/dist/inner-plugins/utils/sdk.d.ts +2 -3
- package/dist/inner-plugins/utils/sdk.js +2 -2
- package/dist/logger.d.ts +9 -0
- package/dist/logger.js +51 -0
- package/dist/{inner-plugins/constants.d.cts → rspack-plugin/constants.d.ts} +3 -0
- package/dist/rspack-plugin/constants.js +23 -0
- package/dist/rspack-plugin/index.d.ts +2 -0
- package/dist/rspack-plugin/index.js +3 -0
- package/dist/rspack-plugin/multiple.d.ts +8 -0
- package/dist/rspack-plugin/multiple.js +39 -0
- package/dist/rspack-plugin/plugin.d.ts +25 -0
- package/dist/rspack-plugin/plugin.js +133 -0
- package/dist/rule-utils/document/document.d.ts +16 -0
- package/dist/rule-utils/document/document.js +46 -0
- package/dist/rule-utils/document/index.d.ts +3 -0
- package/dist/rule-utils/document/index.js +4 -0
- package/dist/rule-utils/document/server.d.ts +4 -0
- package/dist/rule-utils/document/server.js +13 -0
- package/dist/rule-utils/document/types.d.ts +31 -0
- package/dist/rule-utils/index.d.ts +2 -0
- package/dist/rule-utils/index.js +3 -0
- package/dist/rule-utils/parser/asserts.d.ts +81 -0
- package/dist/rule-utils/parser/asserts.js +105 -0
- package/dist/rule-utils/parser/index.d.ts +4 -0
- package/dist/rule-utils/parser/index.js +5 -0
- package/dist/rule-utils/parser/parser.d.ts +118 -0
- package/dist/rule-utils/parser/parser.js +24 -0
- package/dist/rule-utils/parser/types.d.ts +30 -0
- package/dist/rule-utils/parser/types.js +8 -0
- package/dist/rule-utils/parser/utils.d.ts +30 -0
- package/dist/rule-utils/parser/utils.js +106 -0
- package/dist/rules/linter.d.ts +1 -1
- package/dist/rules/linter.js +1 -1
- package/dist/rules/rule.d.ts +2 -2
- package/dist/rules/rule.js +2 -2
- package/dist/rules/rules/cjs-require/index.d.ts +1 -1
- package/dist/rules/rules/cjs-require/index.js +1 -1
- package/dist/rules/rules/cross-chunks-package/index.d.ts +1 -1
- package/dist/rules/rules/cross-chunks-package/index.js +2 -2
- package/dist/rules/rules/default-import-check/index.d.ts +1 -1
- package/dist/rules/rules/default-import-check/index.js +2 -2
- package/dist/rules/rules/default-import-check/utils.d.ts +2 -2
- package/dist/rules/rules/default-import-check/utils.js +2 -2
- package/dist/rules/rules/duplicate-package/index.d.ts +3 -3
- package/dist/rules/rules/duplicate-package/index.js +3 -3
- package/dist/rules/rules/duplicate-package/utils.d.ts +1 -1
- package/dist/rules/rules/ecma-version-check/index.d.ts +3 -2
- package/dist/rules/rules/ecma-version-check/index.js +1 -1
- package/dist/rules/rules/ecma-version-check/types.d.ts +1 -2
- package/dist/rules/rules/ecma-version-check/utils.d.ts +1 -1
- package/dist/rules/rules/esm-resolved-to-cjs/index.d.ts +1 -1
- package/dist/rules/rules/esm-resolved-to-cjs/index.js +1 -1
- package/dist/rules/rules/index.d.ts +1 -1
- package/dist/rules/rules/loader-performance-optimization/index.d.ts +1 -1
- package/dist/rules/rules/loader-performance-optimization/index.js +2 -2
- package/dist/rules/rules/loader-performance-optimization/types.d.ts +1 -1
- package/dist/rules/rules/module-mixed-chunks/index.d.ts +1 -1
- package/dist/rules/rules/module-mixed-chunks/index.js +1 -1
- package/dist/rules/rules/side-effects-only-imports/index.d.ts +1 -1
- package/dist/rules/rules/side-effects-only-imports/index.js +1 -1
- package/dist/rules/utils.d.ts +1 -1
- package/dist/rules/utils.js +1 -1
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/index.js +3 -0
- package/dist/sdk/multiple/controller.d.ts +12 -0
- package/dist/sdk/multiple/controller.js +42 -0
- package/dist/sdk/multiple/index.d.ts +2 -0
- package/dist/sdk/multiple/index.js +3 -0
- package/dist/sdk/multiple/primary.d.ts +32 -0
- package/dist/sdk/multiple/primary.js +64 -0
- package/dist/sdk/multiple/server.d.ts +7 -0
- package/dist/sdk/multiple/server.js +14 -0
- package/dist/sdk/sdk/core.d.ts +33 -0
- package/dist/sdk/sdk/core.js +163 -0
- package/dist/sdk/sdk/index.d.ts +52 -0
- package/dist/sdk/sdk/index.js +435 -0
- package/dist/sdk/sdk/types.d.ts +26 -0
- package/dist/sdk/sdk/types.js +1 -0
- package/dist/sdk/server/apis/alerts.d.ts +5 -0
- package/dist/sdk/server/apis/alerts.js +30 -0
- package/dist/sdk/server/apis/base.d.ts +11 -0
- package/dist/sdk/server/apis/base.js +22 -0
- package/dist/sdk/server/apis/bundle-diff.d.ts +6 -0
- package/dist/sdk/server/apis/bundle-diff.js +51 -0
- package/dist/sdk/server/apis/data.d.ts +6 -0
- package/dist/sdk/server/apis/data.js +44 -0
- package/dist/sdk/server/apis/fs.d.ts +5 -0
- package/dist/sdk/server/apis/fs.js +28 -0
- package/dist/sdk/server/apis/graph.d.ts +12 -0
- package/dist/sdk/server/apis/graph.js +116 -0
- package/dist/sdk/server/apis/index.d.ts +10 -0
- package/dist/sdk/server/apis/index.js +11 -0
- package/dist/sdk/server/apis/loader.d.ts +15 -0
- package/dist/sdk/server/apis/loader.js +120 -0
- package/dist/sdk/server/apis/plugin.d.ts +6 -0
- package/dist/sdk/server/apis/plugin.js +39 -0
- package/dist/sdk/server/apis/project.d.ts +8 -0
- package/dist/sdk/server/apis/project.js +59 -0
- package/dist/sdk/server/apis/renderer.d.ts +6 -0
- package/dist/sdk/server/apis/renderer.js +33 -0
- package/dist/sdk/server/apis/resolver.d.ts +6 -0
- package/dist/sdk/server/apis/resolver.js +38 -0
- package/dist/sdk/server/client.d.ts +3 -0
- package/dist/sdk/server/client.js +8 -0
- package/dist/sdk/server/fakeServer.d.ts +9 -0
- package/dist/sdk/server/fakeServer.js +12 -0
- package/dist/sdk/server/index.d.ts +44 -0
- package/dist/sdk/server/index.js +292 -0
- package/dist/sdk/server/json-body.d.ts +6 -0
- package/dist/sdk/server/json-body.js +150 -0
- package/dist/sdk/server/router.d.ts +24 -0
- package/dist/sdk/server/router.js +83 -0
- package/dist/sdk/server/security.d.ts +5 -0
- package/dist/sdk/server/security.js +47 -0
- package/dist/sdk/server/socket/api.d.ts +15 -0
- package/dist/sdk/server/socket/api.js +22 -0
- package/dist/sdk/server/socket/index.d.ts +48 -0
- package/dist/sdk/server/socket/index.js +166 -0
- package/dist/sdk/server/utils.d.ts +6 -0
- package/dist/sdk/server/utils.js +19 -0
- package/dist/sdk/utils/base.d.ts +1 -0
- package/dist/sdk/utils/base.js +22 -0
- package/dist/sdk/utils/constant.d.ts +1 -0
- package/dist/sdk/utils/constant.js +4 -0
- package/dist/sdk/utils/index.d.ts +3 -0
- package/dist/sdk/utils/index.js +4 -0
- package/dist/sdk/utils/openBrowser.d.ts +4 -0
- package/dist/sdk/utils/openBrowser.js +53 -0
- package/dist/sdk/utils/upload.d.ts +2 -0
- package/dist/sdk/utils/upload.js +6 -0
- package/dist/sdk.d.ts +1 -0
- package/dist/sdk.js +2 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js +0 -1
- package/dist/types/loader.d.ts +1 -1
- package/dist/types/plugin.d.ts +7 -28
- package/package.json +127 -58
- package/static/openChrome.applescript +95 -0
- package/dist/build-utils/build/chunks/assetsModules.cjs +0 -42
- package/dist/build-utils/build/chunks/assetsModules.d.cts +0 -17
- package/dist/build-utils/build/chunks/chunkTransform.cjs +0 -39
- package/dist/build-utils/build/chunks/chunkTransform.d.cts +0 -4
- package/dist/build-utils/build/chunks/chunkTransform.d.ts +0 -4
- package/dist/build-utils/build/chunks/chunkTransform.js +0 -6
- package/dist/build-utils/build/chunks/index.cjs +0 -72
- package/dist/build-utils/build/chunks/index.d.cts +0 -3
- package/dist/build-utils/build/chunks/rspack/transform.cjs +0 -80
- package/dist/build-utils/build/chunks/rspack/transform.d.cts +0 -13
- package/dist/build-utils/build/index.cjs +0 -52
- package/dist/build-utils/build/index.d.cts +0 -5
- package/dist/build-utils/build/loader/index.cjs +0 -65
- package/dist/build-utils/build/loader/index.d.cts +0 -2
- package/dist/build-utils/build/loader/probeLoader.cjs +0 -89
- package/dist/build-utils/build/loader/probeLoader.d.cts +0 -4
- package/dist/build-utils/build/loader/probeLoaderPlugin.cjs +0 -65
- package/dist/build-utils/build/loader/probeLoaderPlugin.d.cts +0 -5
- package/dist/build-utils/build/module-graph/index.cjs +0 -65
- package/dist/build-utils/build/module-graph/index.d.cts +0 -2
- package/dist/build-utils/build/module-graph/parser.cjs +0 -46
- package/dist/build-utils/build/module-graph/parser.d.cts +0 -2
- package/dist/build-utils/build/module-graph/rspack/transform.cjs +0 -151
- package/dist/build-utils/build/module-graph/rspack/transform.d.cts +0 -26
- package/dist/build-utils/build/module-graph/transform.cjs +0 -39
- package/dist/build-utils/build/module-graph/transform.d.cts +0 -3
- package/dist/build-utils/build/module-graph/transform.d.ts +0 -3
- package/dist/build-utils/build/module-graph/transform.js +0 -6
- package/dist/build-utils/build/module-graph/utils.cjs +0 -95
- package/dist/build-utils/build/module-graph/utils.d.cts +0 -3
- package/dist/build-utils/build/utils/index.cjs +0 -72
- package/dist/build-utils/build/utils/index.d.cts +0 -3
- package/dist/build-utils/build/utils/loader.cjs +0 -354
- package/dist/build-utils/build/utils/loader.d.cts +0 -20
- package/dist/build-utils/build/utils/parseBundle.cjs +0 -283
- package/dist/build-utils/build/utils/parseBundle.d.cts +0 -12
- package/dist/build-utils/build/utils/plugin.cjs +0 -60
- package/dist/build-utils/build/utils/plugin.d.cts +0 -5
- package/dist/build-utils/index.cjs +0 -36
- package/dist/build-utils/index.d.cts +0 -1
- package/dist/index.cjs +0 -81
- package/dist/index.d.cts +0 -3
- package/dist/inner-plugins/constants.cjs +0 -64
- package/dist/inner-plugins/index.cjs +0 -65
- package/dist/inner-plugins/index.d.cts +0 -2
- package/dist/inner-plugins/loaders/proxy.cjs +0 -104
- package/dist/inner-plugins/loaders/proxy.d.cts +0 -7
- package/dist/inner-plugins/plugins/base.cjs +0 -53
- package/dist/inner-plugins/plugins/base.d.cts +0 -12
- package/dist/inner-plugins/plugins/bundle.cjs +0 -96
- package/dist/inner-plugins/plugins/bundle.d.cts +0 -15
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.cjs +0 -141
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.cts +0 -34
- package/dist/inner-plugins/plugins/errors.cjs +0 -98
- package/dist/inner-plugins/plugins/errors.d.cts +0 -11
- package/dist/inner-plugins/plugins/index.cjs +0 -121
- package/dist/inner-plugins/plugins/index.d.cts +0 -10
- package/dist/inner-plugins/plugins/loader.cjs +0 -165
- package/dist/inner-plugins/plugins/loader.d.cts +0 -10
- package/dist/inner-plugins/plugins/plugins.cjs +0 -73
- package/dist/inner-plugins/plugins/plugins.d.cts +0 -8
- package/dist/inner-plugins/plugins/progress.cjs +0 -68
- package/dist/inner-plugins/plugins/progress.d.cts +0 -8
- package/dist/inner-plugins/plugins/resolver.cjs +0 -90
- package/dist/inner-plugins/plugins/resolver.d.cts +0 -12
- package/dist/inner-plugins/plugins/rspack.cjs +0 -118
- package/dist/inner-plugins/plugins/rspack.d.cts +0 -4
- package/dist/inner-plugins/plugins/rules.cjs +0 -97
- package/dist/inner-plugins/plugins/rules.d.cts +0 -8
- package/dist/inner-plugins/plugins/sourcemapTool.cjs +0 -275
- package/dist/inner-plugins/plugins/sourcemapTool.d.cts +0 -52
- package/dist/inner-plugins/plugins/summary.cjs +0 -125
- package/dist/inner-plugins/plugins/summary.d.cts +0 -14
- package/dist/inner-plugins/utils/circleDetect.cjs +0 -49
- package/dist/inner-plugins/utils/circleDetect.d.cts +0 -4
- package/dist/inner-plugins/utils/config.cjs +0 -191
- package/dist/inner-plugins/utils/config.d.cts +0 -5
- package/dist/inner-plugins/utils/index.cjs +0 -106
- package/dist/inner-plugins/utils/index.d.cts +0 -9
- package/dist/inner-plugins/utils/loader.cjs +0 -218
- package/dist/inner-plugins/utils/loader.d.cts +0 -13
- package/dist/inner-plugins/utils/normalize-config.cjs +0 -122
- package/dist/inner-plugins/utils/normalize-config.d.cts +0 -37
- package/dist/inner-plugins/utils/plugin-common.cjs +0 -143
- package/dist/inner-plugins/utils/plugin-common.d.cts +0 -11
- package/dist/inner-plugins/utils/plugin.cjs +0 -106
- package/dist/inner-plugins/utils/plugin.d.cts +0 -4
- package/dist/inner-plugins/utils/sdk.cjs +0 -55
- package/dist/inner-plugins/utils/sdk.d.cts +0 -8
- package/dist/rslib-runtime.js +0 -19
- package/dist/rules/index.cjs +0 -81
- package/dist/rules/index.d.cts +0 -3
- package/dist/rules/linter.cjs +0 -72
- package/dist/rules/linter.d.cts +0 -9
- package/dist/rules/rule.cjs +0 -137
- package/dist/rules/rule.d.cts +0 -27
- package/dist/rules/rules/cjs-require/index.cjs +0 -83
- package/dist/rules/rules/cjs-require/index.d.cts +0 -4
- package/dist/rules/rules/cjs-require/types.cjs +0 -18
- package/dist/rules/rules/cjs-require/types.d.cts +0 -7
- package/dist/rules/rules/cross-chunks-package/index.cjs +0 -74
- package/dist/rules/rules/cross-chunks-package/index.d.cts +0 -4
- package/dist/rules/rules/cross-chunks-package/types.cjs +0 -18
- package/dist/rules/rules/cross-chunks-package/types.d.cts +0 -3
- package/dist/rules/rules/cross-chunks-package/utils.cjs +0 -40
- package/dist/rules/rules/cross-chunks-package/utils.d.cts +0 -1
- package/dist/rules/rules/default-import-check/index.cjs +0 -116
- package/dist/rules/rules/default-import-check/index.d.cts +0 -4
- package/dist/rules/rules/default-import-check/types.cjs +0 -18
- package/dist/rules/rules/default-import-check/types.d.cts +0 -4
- package/dist/rules/rules/default-import-check/utils.cjs +0 -97
- package/dist/rules/rules/default-import-check/utils.d.cts +0 -10
- package/dist/rules/rules/duplicate-package/index.cjs +0 -72
- package/dist/rules/rules/duplicate-package/index.d.cts +0 -4
- package/dist/rules/rules/duplicate-package/types.cjs +0 -60
- package/dist/rules/rules/duplicate-package/types.d.cts +0 -24
- package/dist/rules/rules/duplicate-package/utils.cjs +0 -84
- package/dist/rules/rules/duplicate-package/utils.d.cts +0 -3
- package/dist/rules/rules/ecma-version-check/index.cjs +0 -96
- package/dist/rules/rules/ecma-version-check/index.d.cts +0 -4
- package/dist/rules/rules/ecma-version-check/types.cjs +0 -18
- package/dist/rules/rules/ecma-version-check/types.d.cts +0 -3
- package/dist/rules/rules/ecma-version-check/utils.cjs +0 -39
- package/dist/rules/rules/ecma-version-check/utils.d.cts +0 -2
- package/dist/rules/rules/esm-resolved-to-cjs/index.cjs +0 -237
- package/dist/rules/rules/esm-resolved-to-cjs/index.d.cts +0 -4
- package/dist/rules/rules/esm-resolved-to-cjs/types.cjs +0 -18
- package/dist/rules/rules/esm-resolved-to-cjs/types.d.cts +0 -8
- package/dist/rules/rules/index.cjs +0 -55
- package/dist/rules/rules/index.d.cts +0 -2
- package/dist/rules/rules/loader-performance-optimization/index.cjs +0 -119
- package/dist/rules/rules/loader-performance-optimization/index.d.cts +0 -4
- package/dist/rules/rules/loader-performance-optimization/types.cjs +0 -18
- package/dist/rules/rules/loader-performance-optimization/types.d.cts +0 -22
- package/dist/rules/rules/loader-performance-optimization/utils.cjs +0 -43
- package/dist/rules/rules/loader-performance-optimization/utils.d.cts +0 -1
- package/dist/rules/rules/module-mixed-chunks/index.cjs +0 -85
- package/dist/rules/rules/module-mixed-chunks/index.d.cts +0 -4
- package/dist/rules/rules/module-mixed-chunks/types.cjs +0 -18
- package/dist/rules/rules/module-mixed-chunks/types.d.cts +0 -3
- package/dist/rules/rules/side-effects-only-imports/index.cjs +0 -114
- package/dist/rules/rules/side-effects-only-imports/index.d.cts +0 -4
- package/dist/rules/rules/side-effects-only-imports/types.cjs +0 -18
- package/dist/rules/rules/side-effects-only-imports/types.d.cts +0 -9
- package/dist/rules/utils.cjs +0 -46
- package/dist/rules/utils.d.cts +0 -3
- package/dist/types/chunks.cjs +0 -18
- package/dist/types/chunks.d.cts +0 -6
- package/dist/types/chunks.d.ts +0 -6
- package/dist/types/index.cjs +0 -79
- package/dist/types/index.d.cts +0 -4
- package/dist/types/loader.cjs +0 -18
- package/dist/types/loader.d.cts +0 -19
- package/dist/types/plugin.cjs +0 -18
- package/dist/types/plugin.d.cts +0 -51
- package/dist/types/rules.cjs +0 -18
- package/dist/types/rules.d.cts +0 -7
- /package/dist/{types/chunks.js → rule-utils/document/types.js} +0 -0
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: definition[key]
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
})();
|
|
11
|
-
(()=>{
|
|
12
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
-
})();
|
|
14
|
-
(()=>{
|
|
15
|
-
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
-
value: 'Module'
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
-
value: true
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
})();
|
|
24
|
-
var __webpack_exports__ = {};
|
|
25
|
-
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
applyRspackNativePlugin: ()=>applyRspackNativePlugin
|
|
28
|
-
});
|
|
29
|
-
const graph_namespaceObject = require("@rsdoctor/graph");
|
|
30
|
-
const index_cjs_namespaceObject = require("../../build-utils/build/index.cjs");
|
|
31
|
-
const external_constants_cjs_namespaceObject = require("../constants.cjs");
|
|
32
|
-
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
33
|
-
function applyRspackNativePlugin(compiler, plugin, RsdoctorRspackPlugin) {
|
|
34
|
-
logger_namespaceObject.logger.debug('[RspackNativePlugin] Apply hooks');
|
|
35
|
-
compiler.hooks.compilation.tap('RsdoctorRspackPlugin', (compilation)=>{
|
|
36
|
-
const hooks = RsdoctorRspackPlugin.getCompilationHooks(compilation);
|
|
37
|
-
const cached = {};
|
|
38
|
-
const dependOn = {
|
|
39
|
-
chunkGraphData: [],
|
|
40
|
-
moduleGraphData: [
|
|
41
|
-
'chunkGraphData'
|
|
42
|
-
],
|
|
43
|
-
assetPatchData: [
|
|
44
|
-
'chunkGraphData'
|
|
45
|
-
],
|
|
46
|
-
moduleIdsPatchData: [
|
|
47
|
-
'moduleGraphData'
|
|
48
|
-
],
|
|
49
|
-
moduleSourcesPatchData: [
|
|
50
|
-
'moduleGraphData'
|
|
51
|
-
]
|
|
52
|
-
};
|
|
53
|
-
const consumer = {
|
|
54
|
-
chunkGraphData: (data)=>{
|
|
55
|
-
plugin.chunkGraph = new graph_namespaceObject.ChunkGraph();
|
|
56
|
-
index_cjs_namespaceObject.Chunks.patchNativeChunkGraph(plugin.chunkGraph, data);
|
|
57
|
-
},
|
|
58
|
-
moduleGraphData: (data)=>{
|
|
59
|
-
index_cjs_namespaceObject.ModuleGraph.patchNativeModuleGraph(plugin.modulesGraph, plugin.chunkGraph, data);
|
|
60
|
-
},
|
|
61
|
-
moduleIdsPatchData: (data)=>{
|
|
62
|
-
index_cjs_namespaceObject.ModuleGraph.patchNativeModuleIds(plugin.modulesGraph, data);
|
|
63
|
-
},
|
|
64
|
-
moduleSourcesPatchData: (data)=>{
|
|
65
|
-
index_cjs_namespaceObject.ModuleGraph.patchNativeModuleSources(plugin.modulesGraph, data);
|
|
66
|
-
index_cjs_namespaceObject.ModuleGraph.extractSideEffectCodes(plugin.modulesGraph);
|
|
67
|
-
},
|
|
68
|
-
assetPatchData: (data)=>{
|
|
69
|
-
index_cjs_namespaceObject.Chunks.patchNativeAssets(plugin.chunkGraph, data);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
const tryConsumeData = (key, data)=>{
|
|
73
|
-
if (true === cached[key]) return;
|
|
74
|
-
cached[key] = data;
|
|
75
|
-
while(true){
|
|
76
|
-
let hasConsumed = false;
|
|
77
|
-
for (const [_task, deps] of Object.entries(dependOn)){
|
|
78
|
-
const task = _task;
|
|
79
|
-
if (true === cached[task] || void 0 === cached[task]) continue;
|
|
80
|
-
const prepared = deps.every((dep)=>true === cached[dep]);
|
|
81
|
-
if (prepared) {
|
|
82
|
-
consumer[task](cached[task]);
|
|
83
|
-
cached[task] = true;
|
|
84
|
-
hasConsumed = true;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
if (!hasConsumed) break;
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
hooks.chunkGraph.tap((0, external_constants_cjs_namespaceObject.internalPluginTapPreOptions)('nativeChunkGraph'), (rawChunkGraph)=>{
|
|
91
|
-
logger_namespaceObject.logger.debug('[RspackNativePlugin] Called chunkGraph hook');
|
|
92
|
-
tryConsumeData('chunkGraphData', rawChunkGraph);
|
|
93
|
-
});
|
|
94
|
-
hooks.moduleGraph.tap((0, external_constants_cjs_namespaceObject.internalPluginTapPreOptions)('nativeModuleGraph'), (rawModuleGraph)=>{
|
|
95
|
-
logger_namespaceObject.logger.debug('[RspackNativePlugin] Called moduleGraph hook');
|
|
96
|
-
tryConsumeData('moduleGraphData', rawModuleGraph);
|
|
97
|
-
});
|
|
98
|
-
hooks.moduleIds.tap((0, external_constants_cjs_namespaceObject.internalPluginTapPreOptions)('nativeSourcePatch'), (rawModuleIdsPatch)=>{
|
|
99
|
-
logger_namespaceObject.logger.debug('[RspackNativePlugin] Called moduleIds hook');
|
|
100
|
-
tryConsumeData('moduleIdsPatchData', rawModuleIdsPatch);
|
|
101
|
-
});
|
|
102
|
-
hooks.moduleSources.tap((0, external_constants_cjs_namespaceObject.internalPluginTapPreOptions)('nativeModuleSourcesPatch'), (rawModuleSourcesPatch)=>{
|
|
103
|
-
logger_namespaceObject.logger.debug('[RspackNativePlugin] Called moduleSources hook');
|
|
104
|
-
tryConsumeData('moduleSourcesPatchData', rawModuleSourcesPatch);
|
|
105
|
-
});
|
|
106
|
-
hooks.assets.tap((0, external_constants_cjs_namespaceObject.internalPluginTapPreOptions)('nativeAssetPatch'), (rawAssetPatch)=>{
|
|
107
|
-
logger_namespaceObject.logger.debug('[RspackNativePlugin] Called assets hook');
|
|
108
|
-
tryConsumeData('assetPatchData', rawAssetPatch);
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
exports.applyRspackNativePlugin = __webpack_exports__.applyRspackNativePlugin;
|
|
113
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
114
|
-
"applyRspackNativePlugin"
|
|
115
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
116
|
-
Object.defineProperty(exports, '__esModule', {
|
|
117
|
-
value: true
|
|
118
|
-
});
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Linter, Plugin } from '@rsdoctor/types';
|
|
2
|
-
import type { experiments } from '@rspack/core';
|
|
3
|
-
import { RsdoctorPluginInstance } from '../../types';
|
|
4
|
-
export declare function applyRspackNativePlugin(compiler: Plugin.BaseCompiler, plugin: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData[]>, RsdoctorRspackPlugin: typeof experiments.RsdoctorPlugin): void;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: definition[key]
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
})();
|
|
11
|
-
(()=>{
|
|
12
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
-
})();
|
|
14
|
-
(()=>{
|
|
15
|
-
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
-
value: 'Module'
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
-
value: true
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
})();
|
|
24
|
-
var __webpack_exports__ = {};
|
|
25
|
-
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
InternalRulesPlugin: ()=>InternalRulesPlugin
|
|
28
|
-
});
|
|
29
|
-
const external_base_cjs_namespaceObject = require("./base.cjs");
|
|
30
|
-
const index_cjs_namespaceObject = require("../../rules/index.cjs");
|
|
31
|
-
const error_namespaceObject = require("@rsdoctor/utils/error");
|
|
32
|
-
const compat_namespaceObject = require("es-toolkit/compat");
|
|
33
|
-
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
34
|
-
class InternalRulesPlugin extends external_base_cjs_namespaceObject.InternalBasePlugin {
|
|
35
|
-
apply(compiler) {
|
|
36
|
-
(0, logger_namespaceObject.time)('InternalRulesPlugin.apply');
|
|
37
|
-
try {
|
|
38
|
-
compiler.hooks.done.tapPromise(this.tapPreOptions, this.done);
|
|
39
|
-
} finally{
|
|
40
|
-
(0, logger_namespaceObject.timeEnd)('InternalRulesPlugin.apply');
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
async lint(compilation) {
|
|
44
|
-
(0, logger_namespaceObject.time)('InternalRulesPlugin.lint');
|
|
45
|
-
try {
|
|
46
|
-
const options = this.options ?? {};
|
|
47
|
-
const linter = new index_cjs_namespaceObject.Linter(options.linter);
|
|
48
|
-
const result = await linter.validate(this.sdk.getRuleContext({}));
|
|
49
|
-
const validateErrors = result.errors.map((err)=>error_namespaceObject.DevToolError.from(err, {
|
|
50
|
-
detail: err.detail,
|
|
51
|
-
controller: {
|
|
52
|
-
noColor: true
|
|
53
|
-
}
|
|
54
|
-
}));
|
|
55
|
-
const errors = validateErrors.filter((item)=>'Error' === item.level);
|
|
56
|
-
const warnings = validateErrors.filter((item)=>'Warn' === item.level);
|
|
57
|
-
const toRspackError = (err)=>err.toError();
|
|
58
|
-
result.replace.forEach((item)=>{
|
|
59
|
-
if (Array.isArray(compilation.errors) && compilation.errors.includes(item)) (0, compat_namespaceObject.pull)(compilation.errors, item);
|
|
60
|
-
if (Array.isArray(compilation.warnings) && compilation.warnings.includes(item)) (0, compat_namespaceObject.pull)(compilation.warnings, item);
|
|
61
|
-
});
|
|
62
|
-
if (Array.isArray(compilation.errors)) errors.forEach((err)=>{
|
|
63
|
-
compilation.errors.push(toRspackError(err));
|
|
64
|
-
});
|
|
65
|
-
if (Array.isArray(compilation.warnings)) warnings.forEach((err)=>{
|
|
66
|
-
compilation.warnings.push(toRspackError(err));
|
|
67
|
-
});
|
|
68
|
-
this.sdk.reportError(validateErrors);
|
|
69
|
-
await linter.afterValidate({
|
|
70
|
-
data: this.sdk.getRuleContext({}),
|
|
71
|
-
validateResult: result,
|
|
72
|
-
hooks: {
|
|
73
|
-
afterSaveManifest: this.sdk.hooks.afterSaveManifest
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
} finally{
|
|
77
|
-
(0, logger_namespaceObject.timeEnd)('InternalRulesPlugin.lint');
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
constructor(...args){
|
|
81
|
-
super(...args), this.name = 'rules', this.done = async (stats)=>{
|
|
82
|
-
(0, logger_namespaceObject.time)('InternalRulesPlugin.done');
|
|
83
|
-
try {
|
|
84
|
-
await this.lint(stats.compilation);
|
|
85
|
-
} finally{
|
|
86
|
-
(0, logger_namespaceObject.timeEnd)('InternalRulesPlugin.done');
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
exports.InternalRulesPlugin = __webpack_exports__.InternalRulesPlugin;
|
|
92
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
93
|
-
"InternalRulesPlugin"
|
|
94
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
95
|
-
Object.defineProperty(exports, '__esModule', {
|
|
96
|
-
value: true
|
|
97
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { InternalBasePlugin } from './base';
|
|
2
|
-
import { Plugin } from '@rsdoctor/types';
|
|
3
|
-
export declare class InternalRulesPlugin extends InternalBasePlugin<Plugin.BaseCompiler> {
|
|
4
|
-
readonly name = "rules";
|
|
5
|
-
apply(compiler: Plugin.BaseCompiler): void;
|
|
6
|
-
done: (stats: Plugin.BaseStats) => Promise<void>;
|
|
7
|
-
protected lint(compilation: Plugin.BaseCompilation): Promise<void>;
|
|
8
|
-
}
|
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: definition[key]
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
})();
|
|
11
|
-
(()=>{
|
|
12
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
-
})();
|
|
14
|
-
(()=>{
|
|
15
|
-
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
-
value: 'Module'
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
-
value: true
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
})();
|
|
24
|
-
var __webpack_exports__ = {};
|
|
25
|
-
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
UNASSIGNED: ()=>UNASSIGNED,
|
|
28
|
-
bindContextCache: ()=>bindContextCache,
|
|
29
|
-
collectSourceMaps: ()=>collectSourceMaps,
|
|
30
|
-
handleAfterEmitAssets: ()=>handleAfterEmitAssets,
|
|
31
|
-
handleEmitAssets: ()=>handleEmitAssets
|
|
32
|
-
});
|
|
33
|
-
const common_namespaceObject = require("@rsdoctor/utils/common");
|
|
34
|
-
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
35
|
-
const external_path_namespaceObject = require("path");
|
|
36
|
-
const external_source_map_namespaceObject = require("source-map");
|
|
37
|
-
const UNASSIGNED = '[unassigned]';
|
|
38
|
-
function bindContextCache(context, namespace, cache, sourceMapDir, sourceRoot) {
|
|
39
|
-
cache = cache || new Map();
|
|
40
|
-
return (source, sourceMapFilenameRegex)=>{
|
|
41
|
-
if (cache.has(source)) return cache.get(source);
|
|
42
|
-
let resolved = UNASSIGNED;
|
|
43
|
-
if (source.startsWith('file://')) resolved = (0, external_path_namespaceObject.resolve)(context, source.replace(/^file:\/\//, ''));
|
|
44
|
-
else if (source.startsWith('webpack://')) if (sourceMapFilenameRegex) {
|
|
45
|
-
const match = source.match(sourceMapFilenameRegex);
|
|
46
|
-
const filePath = match?.[1];
|
|
47
|
-
const hasNamespace = namespace && source.startsWith(`webpack://${namespace}`) || namespace && source.startsWith(`file://${namespace}`);
|
|
48
|
-
const baseDir = hasNamespace ? process.cwd() : context;
|
|
49
|
-
resolved = filePath ? (0, external_path_namespaceObject.resolve)(baseDir, `./${filePath}`) : UNASSIGNED;
|
|
50
|
-
} else resolved = UNASSIGNED;
|
|
51
|
-
else if ((0, external_path_namespaceObject.isAbsolute)(source)) resolved = source;
|
|
52
|
-
else {
|
|
53
|
-
let baseDir = context;
|
|
54
|
-
if (sourceRoot) baseDir = (0, external_path_namespaceObject.isAbsolute)(sourceRoot) ? sourceRoot : sourceMapDir ? (0, external_path_namespaceObject.resolve)(sourceMapDir, sourceRoot) : (0, external_path_namespaceObject.resolve)(context, sourceRoot);
|
|
55
|
-
else if (sourceMapDir) baseDir = sourceMapDir;
|
|
56
|
-
resolved = (0, external_path_namespaceObject.resolve)(baseDir, source);
|
|
57
|
-
}
|
|
58
|
-
cache.set(source, resolved);
|
|
59
|
-
return resolved;
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
async function collectSourceMaps(map, assetLinesCodeList, _compilation, _this, sourceMapFilenameRegex, namespace, skipSources, sourceMapPath) {
|
|
63
|
-
if (map) {
|
|
64
|
-
const consumer = await new external_source_map_namespaceObject.SourceMapConsumer(map);
|
|
65
|
-
let sourceMapDir;
|
|
66
|
-
if (sourceMapPath) sourceMapDir = (0, external_path_namespaceObject.dirname)(sourceMapPath);
|
|
67
|
-
else if (_compilation.options.output?.path) sourceMapDir = 'string' == typeof _compilation.options.output.path ? _compilation.options.output.path : void 0;
|
|
68
|
-
const sourceRoot = map.sourceRoot;
|
|
69
|
-
const getRealSourcePath = bindContextCache(_this.sdk.root || process.cwd(), namespace, _this._realSourcePathCache, sourceMapDir, sourceRoot ?? void 0);
|
|
70
|
-
const lineMappings = new Map();
|
|
71
|
-
consumer._absoluteSources = consumer._sources;
|
|
72
|
-
consumer.eachMapping((m)=>{
|
|
73
|
-
if (!lineMappings.has(m.generatedLine)) lineMappings.set(m.generatedLine, []);
|
|
74
|
-
lineMappings.get(m.generatedLine).push(m);
|
|
75
|
-
});
|
|
76
|
-
for (const [lineNum, mappings] of lineMappings.entries()){
|
|
77
|
-
mappings.sort((a, b)=>a.generatedColumn - b.generatedColumn);
|
|
78
|
-
const lineIdx = lineNum - 1;
|
|
79
|
-
if (lineIdx < 0 || lineIdx >= assetLinesCodeList.length) continue;
|
|
80
|
-
const line = assetLinesCodeList[lineIdx];
|
|
81
|
-
for(let i = 0; i < mappings.length; i++){
|
|
82
|
-
const m = mappings[i];
|
|
83
|
-
if (!m.source) continue;
|
|
84
|
-
let realSource = m.source;
|
|
85
|
-
if (realSource.includes('!')) {
|
|
86
|
-
const parts = realSource.split('!');
|
|
87
|
-
for(let j = parts.length - 1; j >= 0; j--){
|
|
88
|
-
const part = parts[j];
|
|
89
|
-
if (!part) continue;
|
|
90
|
-
const cleanPart = part.split('??')[0];
|
|
91
|
-
if (!cleanPart.startsWith('builtin:')) {
|
|
92
|
-
if (cleanPart.startsWith('/') || cleanPart.includes('\\')) {
|
|
93
|
-
realSource = cleanPart;
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (realSource === m.source) {
|
|
99
|
-
const lastPart = parts[parts.length - 1];
|
|
100
|
-
realSource = lastPart ? lastPart.split('??')[0] : lastPart;
|
|
101
|
-
}
|
|
102
|
-
} else if (realSource.includes('??')) realSource = realSource.split('??')[0];
|
|
103
|
-
if (realSource) {
|
|
104
|
-
if ((realSource.startsWith('webpack://') || realSource.startsWith('file://')) && sourceMapFilenameRegex) realSource = getRealSourcePath(realSource, sourceMapFilenameRegex);
|
|
105
|
-
else if (!(0, external_path_namespaceObject.isAbsolute)(realSource)) realSource = getRealSourcePath(realSource, sourceMapFilenameRegex);
|
|
106
|
-
}
|
|
107
|
-
if (!realSource || realSource === UNASSIGNED) continue;
|
|
108
|
-
if (skipSources && skipSources.has(realSource)) continue;
|
|
109
|
-
const next = mappings[i + 1];
|
|
110
|
-
const start = m.generatedColumn;
|
|
111
|
-
const end = next ? next.generatedColumn : line.length;
|
|
112
|
-
const codeSegment = line.slice(start, end);
|
|
113
|
-
const prev = _this.sourceMapSets.get(realSource) || '';
|
|
114
|
-
_this.sourceMapSets.set(realSource, prev.concat(codeSegment));
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
async function handleAfterEmitAssets(compilation, _this, sourceMapFilenameRegex, namespace) {
|
|
120
|
-
if ('rspack' in compilation.compiler) {
|
|
121
|
-
_this.sourceMapSets = new Map();
|
|
122
|
-
if (_this.assetsWithoutSourceMap) _this.assetsWithoutSourceMap.clear();
|
|
123
|
-
else _this.assetsWithoutSourceMap = new Set();
|
|
124
|
-
(0, logger_namespaceObject.time)('ensureModulesChunkGraph.afterEmit.start');
|
|
125
|
-
const assets = [
|
|
126
|
-
...compilation.getAssets()
|
|
127
|
-
];
|
|
128
|
-
const skipSources = new Set();
|
|
129
|
-
for (const asset of assets){
|
|
130
|
-
const { assetLinesCodeList, map: mapFromAsset, assetName } = parseAsset(asset, assets, 'js/css');
|
|
131
|
-
let map = mapFromAsset;
|
|
132
|
-
let sourceMapPath;
|
|
133
|
-
if (map) {
|
|
134
|
-
const outputPath = compilation.options.output?.path;
|
|
135
|
-
if (outputPath && 'string' == typeof outputPath && assetName) {
|
|
136
|
-
const mapFileName = assetName.endsWith('.map') ? assetName : `${assetName}.map`;
|
|
137
|
-
sourceMapPath = (0, external_path_namespaceObject.resolve)(outputPath, mapFileName);
|
|
138
|
-
}
|
|
139
|
-
} else {
|
|
140
|
-
const sourceMapFile = asset.info.related?.sourceMap;
|
|
141
|
-
const sourceMapFileAssetName = sourceMapFile?.replace(/(\.[^.]+)(\.[^.]+)?$/, '$1');
|
|
142
|
-
if (sourceMapFile) {
|
|
143
|
-
let sourceMapAsset = assets.find((asset)=>asset.name === sourceMapFile);
|
|
144
|
-
if (!sourceMapAsset && sourceMapFileAssetName) {
|
|
145
|
-
const baseNameWithoutHash = common_namespaceObject.Graph.formatAssetName(sourceMapFileAssetName, 'string' == typeof compilation.options.output.filename ? compilation.options.output.filename : void 0);
|
|
146
|
-
sourceMapAsset = assets.find((asset)=>{
|
|
147
|
-
const assetBaseName = common_namespaceObject.Graph.formatAssetName(asset.name, 'string' == typeof compilation.options.output.filename ? compilation.options.output.filename : void 0);
|
|
148
|
-
return assetBaseName.includes(baseNameWithoutHash) && asset.name.endsWith('.map');
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
if (sourceMapAsset) {
|
|
152
|
-
map = JSON.parse(sourceMapAsset.source.source().toString());
|
|
153
|
-
const outputPath = compilation.options.output?.path;
|
|
154
|
-
if (outputPath && 'string' == typeof outputPath) sourceMapPath = (0, external_path_namespaceObject.resolve)(outputPath, sourceMapAsset.name);
|
|
155
|
-
}
|
|
156
|
-
} else {
|
|
157
|
-
if (assetName && 'string' == typeof assetName && (assetName.endsWith('.js') || assetName.endsWith('.bundle') || assetName.endsWith('.css'))) _this.assetsWithoutSourceMap.add(assetName);
|
|
158
|
-
continue;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
try {
|
|
162
|
-
await collectSourceMaps(map, assetLinesCodeList, compilation, _this, sourceMapFilenameRegex, namespace, skipSources, sourceMapPath);
|
|
163
|
-
} catch (e) {
|
|
164
|
-
logger_namespaceObject.logger.debug(e);
|
|
165
|
-
}
|
|
166
|
-
_this.sourceMapSets.forEach((_value, key)=>{
|
|
167
|
-
if (!skipSources.has(key)) skipSources.add(key);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
(0, logger_namespaceObject.timeEnd)('ensureModulesChunkGraph.afterEmit.start');
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
async function handleEmitAssets(options) {
|
|
174
|
-
const { compilation, pluginInstance, sourceMapFilenameRegex, namespace } = options;
|
|
175
|
-
if (!('rspack' in compilation.compiler)) {
|
|
176
|
-
pluginInstance.sourceMapSets = new Map();
|
|
177
|
-
(0, logger_namespaceObject.time)('ensureModulesChunkGraph.afterEmit.start');
|
|
178
|
-
const assets = Object.values(compilation.getAssets()).map((asset, index)=>({
|
|
179
|
-
name: index.toString(),
|
|
180
|
-
source: asset,
|
|
181
|
-
info: asset.info || {}
|
|
182
|
-
}));
|
|
183
|
-
for (const asset of assets){
|
|
184
|
-
const { assetLinesCodeList, map, assetName } = parseAsset(asset, assets, 'map');
|
|
185
|
-
if (!map) continue;
|
|
186
|
-
let sourceMapPath;
|
|
187
|
-
const outputPath = compilation.options.output?.path;
|
|
188
|
-
if (outputPath && 'string' == typeof outputPath && 'string' == typeof assetName) {
|
|
189
|
-
const mapFileName = assetName.endsWith('.map') ? assetName : `${assetName}.map`;
|
|
190
|
-
sourceMapPath = (0, external_path_namespaceObject.resolve)(outputPath, mapFileName);
|
|
191
|
-
}
|
|
192
|
-
try {
|
|
193
|
-
await collectSourceMaps(map, assetLinesCodeList, compilation, pluginInstance, sourceMapFilenameRegex, namespace, void 0, sourceMapPath);
|
|
194
|
-
} catch (e) {
|
|
195
|
-
logger_namespaceObject.logger.debug(e);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
(0, logger_namespaceObject.timeEnd)('ensureModulesChunkGraph.afterEmit.start');
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
function parseAsset(asset, assets, type) {
|
|
202
|
-
const assetName = asset.source?.name || asset.name;
|
|
203
|
-
let assetContent = '';
|
|
204
|
-
let assetLinesCodeList = [];
|
|
205
|
-
let map = null;
|
|
206
|
-
try {
|
|
207
|
-
if ('map' === type && 'string' == typeof assetName && assetName.endsWith('.map') && !asset.name.includes('d.ts')) {
|
|
208
|
-
assetContent = asset.source?.source?.source?.() || '';
|
|
209
|
-
if (!assetContent) {
|
|
210
|
-
logger_namespaceObject.logger.debug(`Failed to get source content for asset: ${assetName}`);
|
|
211
|
-
return {
|
|
212
|
-
assetName,
|
|
213
|
-
assetContent: '',
|
|
214
|
-
assetLinesCodeList: [],
|
|
215
|
-
map: null
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
map = JSON.parse(assetContent);
|
|
219
|
-
if (!map || !map.file) {
|
|
220
|
-
logger_namespaceObject.logger.debug(`Failed to get source map file for asset: ${assetName}`);
|
|
221
|
-
return {
|
|
222
|
-
assetName,
|
|
223
|
-
assetContent,
|
|
224
|
-
assetLinesCodeList: [],
|
|
225
|
-
map: null
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
const bundledAsset = assets.find((asset2)=>asset2.source?.name === map?.file);
|
|
229
|
-
const bundledCode = bundledAsset?.source?.source?.source?.() || '';
|
|
230
|
-
if (!bundledCode) {
|
|
231
|
-
logger_namespaceObject.logger.debug(`Failed to get bundled code for asset: ${map.file}`);
|
|
232
|
-
return {
|
|
233
|
-
assetName,
|
|
234
|
-
assetContent,
|
|
235
|
-
assetLinesCodeList: [],
|
|
236
|
-
map
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
assetLinesCodeList = bundledCode.split(/\r?\n/);
|
|
240
|
-
} else if ('js/css' === type && (assetName.endsWith('.js') || assetName.endsWith('.bundle') || assetName.endsWith('.css'))) {
|
|
241
|
-
assetContent = asset.source?.source?.() || '';
|
|
242
|
-
assetLinesCodeList = assetContent.split(/\r?\n/);
|
|
243
|
-
map = asset.source?.sourceAndMap?.()?.map || null;
|
|
244
|
-
}
|
|
245
|
-
} catch (error) {
|
|
246
|
-
logger_namespaceObject.logger.debug(`Error parsing asset ${assetName}:`, error);
|
|
247
|
-
return {
|
|
248
|
-
assetName,
|
|
249
|
-
assetContent: '',
|
|
250
|
-
assetLinesCodeList: [],
|
|
251
|
-
map: null
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
return {
|
|
255
|
-
assetName,
|
|
256
|
-
assetContent,
|
|
257
|
-
assetLinesCodeList,
|
|
258
|
-
map
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
exports.UNASSIGNED = __webpack_exports__.UNASSIGNED;
|
|
262
|
-
exports.bindContextCache = __webpack_exports__.bindContextCache;
|
|
263
|
-
exports.collectSourceMaps = __webpack_exports__.collectSourceMaps;
|
|
264
|
-
exports.handleAfterEmitAssets = __webpack_exports__.handleAfterEmitAssets;
|
|
265
|
-
exports.handleEmitAssets = __webpack_exports__.handleEmitAssets;
|
|
266
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
267
|
-
"UNASSIGNED",
|
|
268
|
-
"bindContextCache",
|
|
269
|
-
"collectSourceMaps",
|
|
270
|
-
"handleAfterEmitAssets",
|
|
271
|
-
"handleEmitAssets"
|
|
272
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
273
|
-
Object.defineProperty(exports, '__esModule', {
|
|
274
|
-
value: true
|
|
275
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { RsdoctorPluginInstance } from '../../types';
|
|
2
|
-
import { Linter, Plugin } from '@rsdoctor/types';
|
|
3
|
-
export declare const UNASSIGNED = "[unassigned]";
|
|
4
|
-
/**
|
|
5
|
-
* Options for handling source map assets.
|
|
6
|
-
* @param compilation - The current compilation object.
|
|
7
|
-
* @param pluginInstance - The Rsdoctor plugin instance.
|
|
8
|
-
* @param sourceMapFilenameRegex - Regex to extract file paths from source map sources.
|
|
9
|
-
* @param namespace - Optional namespace for resolving sources.
|
|
10
|
-
*/
|
|
11
|
-
interface SourceMapAssetOptions {
|
|
12
|
-
compilation: Plugin.BaseCompilation;
|
|
13
|
-
pluginInstance: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData<any, string>[]>;
|
|
14
|
-
sourceMapFilenameRegex: RegExp;
|
|
15
|
-
namespace?: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Binds a context cache to a source path resolver.
|
|
19
|
-
* @param context - The base context directory.
|
|
20
|
-
* @param namespace - Optional namespace for resolving sources.
|
|
21
|
-
* @param cache - The cache map to store resolved paths.
|
|
22
|
-
* @param sourceMapDir - The directory containing source maps.
|
|
23
|
-
* @param sourceRoot - The source root directory.
|
|
24
|
-
* @returns A function that resolves source paths based on the given context.
|
|
25
|
-
*/
|
|
26
|
-
export declare function bindContextCache(context: string, namespace?: string, cache?: Map<string, string>, sourceMapDir?: string, sourceRoot?: string): (source: string, sourceMapFilenameRegex?: RegExp) => string;
|
|
27
|
-
/**
|
|
28
|
-
* Collects and processes source map information for a given asset.
|
|
29
|
-
* Groups mappings by line, sorts them, and reconstructs the original source code segments.
|
|
30
|
-
* @param map - The raw source map object.
|
|
31
|
-
* @param assetLinesCodeList - The code lines of the asset.
|
|
32
|
-
* @param _compilation - The current compilation object.
|
|
33
|
-
* @param _this - The Rsdoctor plugin instance.
|
|
34
|
-
* @param sourceMapFilenameRegex - Regex to extract file paths from source map sources.
|
|
35
|
-
* @param namespace - Optional namespace for resolving sources.
|
|
36
|
-
*/
|
|
37
|
-
export declare function collectSourceMaps(map: any, assetLinesCodeList: string[], _compilation: Plugin.BaseCompilation, _this: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData[]>, sourceMapFilenameRegex?: RegExp, namespace?: string, skipSources?: Set<string>, sourceMapPath?: string): Promise<void>;
|
|
38
|
-
/**
|
|
39
|
-
* Handles the afterEmit event for assets to collect source map information.
|
|
40
|
-
* @param compilation - The current compilation object.
|
|
41
|
-
* @param _this - The Rsdoctor plugin instance.
|
|
42
|
-
* @param sourceMapFilenameRegex - Regex to extract file paths from source map sources.
|
|
43
|
-
* @param namespace - Optional namespace for resolving sources.
|
|
44
|
-
*/
|
|
45
|
-
export declare function handleAfterEmitAssets(compilation: Plugin.BaseCompilation, _this: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData<any, string>[]>, sourceMapFilenameRegex?: RegExp, namespace?: string): Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* Handles the emit event for assets to collect source map information.
|
|
48
|
-
* @param options - The options for handling source map assets.
|
|
49
|
-
* @returns A promise that resolves when the source map information is collected.
|
|
50
|
-
*/
|
|
51
|
-
export declare function handleEmitAssets(options: SourceMapAssetOptions): Promise<void>;
|
|
52
|
-
export {};
|