@rsdoctor/core 2.0.0-alpha.0 → 2.0.0-alpha.2
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/26.js +26163 -0
- package/dist/630.js +1269 -0
- package/dist/630.js.LICENSE.txt +7 -0
- package/dist/build-utils/build/chunks/assetsModules.d.ts +8 -2
- package/dist/build-utils/build/chunks/index.d.ts +0 -1
- package/dist/build-utils/build/chunks/rspack/transform.d.ts +1 -1
- package/dist/build-utils/build/envinfo.d.ts +13 -0
- package/dist/build-utils/build/file/cache.d.ts +5 -0
- package/dist/build-utils/build/file/index.d.ts +3 -0
- package/dist/build-utils/build/file/sharding.d.ts +21 -0
- package/dist/build-utils/build/index.d.ts +5 -0
- package/dist/build-utils/build/json.d.ts +3 -0
- package/dist/build-utils/build/loader/probeLoader.d.ts +8 -3
- package/dist/build-utils/build/loader/probeLoaderPlugin.d.ts +1 -1
- package/dist/build-utils/build/module-graph/index.d.ts +0 -1
- package/dist/build-utils/build/module-graph/parser.d.ts +1 -1
- package/dist/build-utils/build/module-graph/rspack/transform.d.ts +1 -1
- package/dist/build-utils/build/module-graph/utils.d.ts +1 -1
- package/dist/build-utils/build/process.d.ts +2 -0
- package/dist/build-utils/build/server.d.ts +15 -0
- package/dist/build-utils/build/utils/loader.d.ts +2 -2
- package/dist/build-utils/build/utils/parseBundle.d.ts +1 -1
- package/dist/build-utils/build/utils/plugin.d.ts +1 -1
- package/dist/build-utils/index.d.ts +10 -0
- package/dist/common/file.d.ts +2 -0
- package/dist/common/global-config.d.ts +21 -0
- package/dist/error/error.d.ts +35 -0
- package/dist/error/index.d.ts +2 -0
- package/dist/error/transform.d.ts +3 -0
- package/dist/error/utils.d.ts +4 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +1725 -5
- package/dist/inner-plugins/constants.d.ts +1 -1
- package/dist/inner-plugins/loaders/proxy.d.ts +4 -4
- package/dist/inner-plugins/plugins/base.d.ts +3 -3
- package/dist/inner-plugins/plugins/bundle.d.ts +1 -1
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts +3 -3
- package/dist/inner-plugins/plugins/errors.d.ts +2 -2
- package/dist/inner-plugins/plugins/loader.d.ts +1 -1
- package/dist/inner-plugins/plugins/plugins.d.ts +1 -1
- package/dist/inner-plugins/plugins/progress.d.ts +2 -2
- package/dist/inner-plugins/plugins/resolver.d.ts +1 -1
- package/dist/inner-plugins/plugins/rspack.d.ts +8 -3
- package/dist/inner-plugins/plugins/rules.d.ts +1 -1
- package/dist/inner-plugins/plugins/sourcemapTool.d.ts +2 -2
- package/dist/inner-plugins/plugins/summary.d.ts +1 -1
- package/dist/inner-plugins/utils/config.d.ts +2 -3
- package/dist/inner-plugins/utils/loader.d.ts +4 -7
- 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/plugin.d.ts +1 -1
- package/dist/inner-plugins/utils/sdk.d.ts +2 -3
- package/dist/logger.d.ts +9 -0
- package/dist/probe-loader.js +2 -0
- package/dist/proxy-loader.d.ts +1 -0
- package/dist/proxy-loader.js +48 -0
- package/dist/rslib-runtime.js +18 -9
- package/dist/{inner-plugins/constants.d.cts → rspack-plugin/constants.d.ts} +4 -1
- package/dist/rspack-plugin/index.d.ts +2 -0
- package/dist/rspack-plugin/multiple.d.ts +8 -0
- package/dist/rspack-plugin/plugin.d.ts +25 -0
- package/dist/rule-utils/document/document.d.ts +16 -0
- package/dist/rule-utils/document/index.d.ts +3 -0
- package/dist/rule-utils/document/server.d.ts +4 -0
- package/dist/rule-utils/document/types.d.ts +31 -0
- package/dist/rule-utils/index.d.ts +2 -0
- package/dist/rule-utils/parser/asserts.d.ts +81 -0
- package/dist/rule-utils/parser/index.d.ts +4 -0
- package/dist/rule-utils/parser/parser.d.ts +118 -0
- package/dist/rule-utils/parser/types.d.ts +30 -0
- package/dist/rule-utils/parser/utils.d.ts +30 -0
- package/dist/rules/linter.d.ts +1 -1
- package/dist/rules/rule.d.ts +2 -2
- package/dist/rules/rules/cjs-require/index.d.ts +1 -1
- package/dist/rules/rules/cross-chunks-package/index.d.ts +1 -1
- package/dist/rules/rules/default-import-check/index.d.ts +1 -1
- package/dist/rules/rules/default-import-check/utils.d.ts +2 -2
- package/dist/rules/rules/duplicate-package/index.d.ts +3 -3
- package/dist/rules/rules/duplicate-package/utils.d.ts +1 -1
- package/dist/rules/rules/ecma-version-check/htmlParserStub.d.ts +3 -0
- package/dist/rules/rules/ecma-version-check/index.d.ts +3 -2
- package/dist/rules/rules/ecma-version-check/types.d.ts +13 -3
- 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/index.d.ts +1 -1
- package/dist/rules/rules/loader-performance-optimization/index.d.ts +1 -1
- 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/side-effects-only-imports/index.d.ts +1 -1
- package/dist/rules/utils.d.ts +1 -1
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/multiple/controller.d.ts +12 -0
- package/dist/sdk/multiple/index.d.ts +2 -0
- package/dist/sdk/multiple/primary.d.ts +32 -0
- package/dist/sdk/multiple/server.d.ts +7 -0
- package/dist/sdk/sdk/core.d.ts +33 -0
- package/dist/sdk/sdk/index.d.ts +52 -0
- package/dist/sdk/sdk/types.d.ts +26 -0
- package/dist/sdk/server/apis/alerts.d.ts +5 -0
- package/dist/sdk/server/apis/base.d.ts +11 -0
- package/dist/sdk/server/apis/bundle-diff.d.ts +6 -0
- package/dist/sdk/server/apis/data.d.ts +6 -0
- package/dist/sdk/server/apis/fs.d.ts +5 -0
- package/dist/sdk/server/apis/graph.d.ts +12 -0
- package/dist/sdk/server/apis/index.d.ts +10 -0
- package/dist/sdk/server/apis/loader.d.ts +15 -0
- package/dist/sdk/server/apis/plugin.d.ts +6 -0
- package/dist/sdk/server/apis/project.d.ts +8 -0
- package/dist/sdk/server/apis/renderer.d.ts +6 -0
- package/dist/sdk/server/apis/resolver.d.ts +6 -0
- package/dist/sdk/server/client.d.ts +3 -0
- package/dist/sdk/server/fakeServer.d.ts +9 -0
- package/dist/sdk/server/index.d.ts +44 -0
- package/dist/sdk/server/json-body.d.ts +6 -0
- package/dist/sdk/server/router.d.ts +24 -0
- package/dist/sdk/server/security.d.ts +5 -0
- package/dist/sdk/server/socket/api.d.ts +15 -0
- package/dist/sdk/server/socket/index.d.ts +48 -0
- package/dist/sdk/server/utils.d.ts +6 -0
- package/dist/sdk/utils/base.d.ts +1 -0
- package/dist/sdk/utils/constant.d.ts +1 -0
- package/dist/sdk/utils/date.d.ts +1 -0
- package/dist/sdk/utils/index.d.ts +3 -0
- package/dist/sdk/utils/openBrowser.d.ts +4 -0
- package/dist/sdk/utils/upload.d.ts +2 -0
- package/dist/sdk.d.ts +1 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/loader.d.ts +1 -1
- package/dist/types/plugin.d.ts +7 -28
- package/package.json +56 -80
- 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/assetsModules.js +0 -9
- 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/index.js +0 -4
- 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/chunks/rspack/transform.js +0 -44
- package/dist/build-utils/build/index.cjs +0 -52
- package/dist/build-utils/build/index.d.cts +0 -5
- package/dist/build-utils/build/index.js +0 -7
- 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/index.js +0 -3
- 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/probeLoader.js +0 -44
- 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/loader/probeLoaderPlugin.js +0 -32
- 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/index.js +0 -3
- 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/parser.js +0 -13
- 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/rspack/transform.js +0 -109
- 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/module-graph/utils.js +0 -59
- 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/index.js +0 -4
- 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/loader.js +0 -276
- 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/parseBundle.js +0 -240
- 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/build/utils/plugin.js +0 -21
- package/dist/build-utils/index.cjs +0 -36
- package/dist/build-utils/index.d.cts +0 -1
- package/dist/build-utils/index.js +0 -3
- 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/constants.js +0 -19
- package/dist/inner-plugins/index.cjs +0 -65
- package/dist/inner-plugins/index.d.cts +0 -2
- package/dist/inner-plugins/index.js +0 -3
- package/dist/inner-plugins/loaders/proxy.cjs +0 -104
- package/dist/inner-plugins/loaders/proxy.d.cts +0 -7
- package/dist/inner-plugins/loaders/proxy.js +0 -65
- package/dist/inner-plugins/plugins/base.cjs +0 -53
- package/dist/inner-plugins/plugins/base.d.cts +0 -12
- package/dist/inner-plugins/plugins/base.js +0 -20
- package/dist/inner-plugins/plugins/bundle.cjs +0 -96
- package/dist/inner-plugins/plugins/bundle.d.cts +0 -15
- package/dist/inner-plugins/plugins/bundle.js +0 -63
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.cjs +0 -141
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.cts +0 -34
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +0 -102
- package/dist/inner-plugins/plugins/errors.cjs +0 -98
- package/dist/inner-plugins/plugins/errors.d.cts +0 -11
- package/dist/inner-plugins/plugins/errors.js +0 -65
- package/dist/inner-plugins/plugins/index.cjs +0 -121
- package/dist/inner-plugins/plugins/index.d.cts +0 -10
- package/dist/inner-plugins/plugins/index.js +0 -11
- package/dist/inner-plugins/plugins/loader.cjs +0 -165
- package/dist/inner-plugins/plugins/loader.d.cts +0 -10
- package/dist/inner-plugins/plugins/loader.js +0 -120
- package/dist/inner-plugins/plugins/plugins.cjs +0 -73
- package/dist/inner-plugins/plugins/plugins.d.cts +0 -8
- package/dist/inner-plugins/plugins/plugins.js +0 -40
- package/dist/inner-plugins/plugins/progress.cjs +0 -68
- package/dist/inner-plugins/plugins/progress.d.cts +0 -8
- package/dist/inner-plugins/plugins/progress.js +0 -35
- package/dist/inner-plugins/plugins/resolver.cjs +0 -90
- package/dist/inner-plugins/plugins/resolver.d.cts +0 -12
- package/dist/inner-plugins/plugins/resolver.js +0 -57
- package/dist/inner-plugins/plugins/rspack.cjs +0 -118
- package/dist/inner-plugins/plugins/rspack.d.cts +0 -4
- package/dist/inner-plugins/plugins/rspack.js +0 -85
- package/dist/inner-plugins/plugins/rules.cjs +0 -97
- package/dist/inner-plugins/plugins/rules.d.cts +0 -8
- package/dist/inner-plugins/plugins/rules.js +0 -64
- package/dist/inner-plugins/plugins/sourcemapTool.cjs +0 -275
- package/dist/inner-plugins/plugins/sourcemapTool.d.cts +0 -52
- package/dist/inner-plugins/plugins/sourcemapTool.js +0 -230
- package/dist/inner-plugins/plugins/summary.cjs +0 -125
- package/dist/inner-plugins/plugins/summary.d.cts +0 -14
- package/dist/inner-plugins/plugins/summary.js +0 -92
- package/dist/inner-plugins/utils/circleDetect.cjs +0 -49
- package/dist/inner-plugins/utils/circleDetect.d.cts +0 -4
- package/dist/inner-plugins/utils/circleDetect.js +0 -16
- package/dist/inner-plugins/utils/config.cjs +0 -191
- package/dist/inner-plugins/utils/config.d.cts +0 -5
- package/dist/inner-plugins/utils/config.js +0 -142
- package/dist/inner-plugins/utils/index.cjs +0 -106
- package/dist/inner-plugins/utils/index.d.cts +0 -9
- package/dist/inner-plugins/utils/index.js +0 -8
- package/dist/inner-plugins/utils/loader.cjs +0 -218
- package/dist/inner-plugins/utils/loader.d.cts +0 -13
- package/dist/inner-plugins/utils/loader.js +0 -160
- 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/normalize-config.js +0 -77
- 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-common.js +0 -94
- package/dist/inner-plugins/utils/plugin.cjs +0 -106
- package/dist/inner-plugins/utils/plugin.d.cts +0 -4
- package/dist/inner-plugins/utils/plugin.js +0 -70
- package/dist/inner-plugins/utils/sdk.cjs +0 -55
- package/dist/inner-plugins/utils/sdk.d.cts +0 -8
- package/dist/inner-plugins/utils/sdk.js +0 -19
- package/dist/rules/index.cjs +0 -81
- package/dist/rules/index.d.cts +0 -3
- package/dist/rules/index.js +0 -4
- package/dist/rules/linter.cjs +0 -72
- package/dist/rules/linter.d.cts +0 -9
- package/dist/rules/linter.js +0 -36
- package/dist/rules/rule.cjs +0 -137
- package/dist/rules/rule.d.cts +0 -27
- package/dist/rules/rule.js +0 -101
- 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/index.js +0 -50
- 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/cjs-require/types.js +0 -1
- 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/index.js +0 -41
- 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/types.js +0 -1
- 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/cross-chunks-package/utils.js +0 -7
- 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/index.js +0 -83
- 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/types.js +0 -1
- 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/default-import-check/utils.js +0 -52
- 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/index.js +0 -39
- 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/types.js +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/duplicate-package/utils.js +0 -38
- 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/index.js +0 -53
- 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/types.js +0 -1
- 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/ecma-version-check/utils.js +0 -6
- 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/index.js +0 -193
- 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/esm-resolved-to-cjs/types.js +0 -1
- package/dist/rules/rules/index.cjs +0 -55
- package/dist/rules/rules/index.d.cts +0 -2
- package/dist/rules/rules/index.js +0 -22
- 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/index.js +0 -86
- 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/types.js +0 -1
- 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/loader-performance-optimization/utils.js +0 -10
- 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/index.js +0 -52
- 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/module-mixed-chunks/types.js +0 -1
- 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/index.js +0 -81
- 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/rules/side-effects-only-imports/types.js +0 -1
- package/dist/rules/utils.cjs +0 -46
- package/dist/rules/utils.d.cts +0 -3
- package/dist/rules/utils.js +0 -10
- 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/chunks.js +0 -1
- package/dist/types/index.cjs +0 -79
- package/dist/types/index.d.cts +0 -4
- package/dist/types/index.js +0 -5
- package/dist/types/loader.cjs +0 -18
- package/dist/types/loader.d.cts +0 -19
- package/dist/types/loader.js +0 -1
- package/dist/types/plugin.cjs +0 -18
- package/dist/types/plugin.d.cts +0 -51
- package/dist/types/plugin.js +0 -1
- package/dist/types/rules.cjs +0 -18
- package/dist/types/rules.d.cts +0 -7
- package/dist/types/rules.js +0 -1
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import __rslib_shim_module__ from "node:module";
|
|
2
|
-
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(/*#__PURE__*/ (()=>import.meta.url)());
|
|
3
|
-
import { Manifest } from "@rsdoctor/types";
|
|
4
|
-
import { Loader } from "@rsdoctor/utils/common";
|
|
5
|
-
import { isEqual, omit } from "es-toolkit/compat";
|
|
6
|
-
import { interceptLoader } from "../utils/index.js";
|
|
7
|
-
import { InternalBasePlugin } from "./base.js";
|
|
8
|
-
import { time, timeEnd } from "@rsdoctor/utils/logger";
|
|
9
|
-
import path from "path";
|
|
10
|
-
import { fileURLToPath } from "url";
|
|
11
|
-
import { safeCloneDeep } from "../utils/plugin-common.js";
|
|
12
|
-
const loader_filename = fileURLToPath(import.meta.url);
|
|
13
|
-
const loader_dirname = path.dirname(loader_filename);
|
|
14
|
-
class InternalLoaderPlugin extends InternalBasePlugin {
|
|
15
|
-
apply(compiler) {
|
|
16
|
-
time('InternalLoaderPlugin.apply');
|
|
17
|
-
try {
|
|
18
|
-
compiler.hooks.afterPlugins.tap(this.tapPostOptions, this.afterPlugins.bind(this, compiler));
|
|
19
|
-
compiler.hooks.compilation.tap(this.tapPreOptions, (compilation)=>this.compilation(compiler, compilation));
|
|
20
|
-
} finally{
|
|
21
|
-
timeEnd('InternalLoaderPlugin.apply');
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
compilation(compiler, compilation) {
|
|
25
|
-
time('InternalLoaderPlugin.compilation');
|
|
26
|
-
try {
|
|
27
|
-
if (compiler.isChild()) return;
|
|
28
|
-
const wrapper = (callback)=>(loaderContext, module)=>{
|
|
29
|
-
const proxyLoaders = module?.loaders || loaderContext?.loaders || [];
|
|
30
|
-
const originLoaders = proxyLoaders.map((loader)=>{
|
|
31
|
-
const rawOptions = loader.options;
|
|
32
|
-
const opts = 'object' == typeof rawOptions && null !== rawOptions ? rawOptions : {};
|
|
33
|
-
if (opts[Loader.LoaderInternalPropertyName]) return {
|
|
34
|
-
...loader,
|
|
35
|
-
loader: opts[Loader.LoaderInternalPropertyName].loader,
|
|
36
|
-
options: omit(opts, Loader.LoaderInternalPropertyName)
|
|
37
|
-
};
|
|
38
|
-
return loader;
|
|
39
|
-
});
|
|
40
|
-
const newLoaders = safeCloneDeep(originLoaders);
|
|
41
|
-
if ('object' == typeof compiler.options.cache && 'version' in compiler.options.cache && 'string' == typeof compiler.options.cache.version && compiler.options.cache.version.indexOf('next/dist/build') > -1) callback(loaderContext, module || {});
|
|
42
|
-
else {
|
|
43
|
-
const proxyModule = new Proxy(module || {}, {
|
|
44
|
-
get (target, p, receiver) {
|
|
45
|
-
if ('loaders' === p) return newLoaders;
|
|
46
|
-
return Reflect.get(target, p, receiver);
|
|
47
|
-
},
|
|
48
|
-
set (target, p, newValue, receiver) {
|
|
49
|
-
const _newValue = safeCloneDeep(newValue);
|
|
50
|
-
if ('loaders' === p) {
|
|
51
|
-
if (Array.isArray(_newValue)) {
|
|
52
|
-
newLoaders.length = 0;
|
|
53
|
-
_newValue.forEach((e)=>{
|
|
54
|
-
newLoaders.push(e);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return Reflect.set(target, p, _newValue, receiver);
|
|
59
|
-
},
|
|
60
|
-
deleteProperty (target, p) {
|
|
61
|
-
return Reflect.deleteProperty(target, p);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
callback(loaderContext, proxyModule);
|
|
65
|
-
}
|
|
66
|
-
if (!isEqual(originLoaders, newLoaders)) {
|
|
67
|
-
const rules = this.getInterceptRules(compiler, newLoaders.map((e)=>({
|
|
68
|
-
loader: e.loader,
|
|
69
|
-
options: e.options ?? void 0
|
|
70
|
-
})));
|
|
71
|
-
module.loaders = rules.map((e, i)=>({
|
|
72
|
-
...newLoaders[i],
|
|
73
|
-
loader: e.loader,
|
|
74
|
-
options: e.options
|
|
75
|
-
}));
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
const interceptor = {
|
|
79
|
-
register (tap) {
|
|
80
|
-
const originFn = tap.fn;
|
|
81
|
-
if ('function' == typeof originFn) tap.fn = wrapper(originFn);
|
|
82
|
-
return tap;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
compiler.webpack.NormalModule.getCompilationHooks(compilation).loader.intercept(interceptor);
|
|
86
|
-
} finally{
|
|
87
|
-
timeEnd('InternalLoaderPlugin.compilation');
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
getInterceptRules(compiler, rules) {
|
|
91
|
-
return interceptLoader(rules, this.internalLoaderPath, {
|
|
92
|
-
cwd: compiler.context || process.cwd(),
|
|
93
|
-
host: this.sdk.server.origin,
|
|
94
|
-
skipLoaders: this.options.loaderInterceptorOptions.skipLoaders
|
|
95
|
-
}, this.sdk.root, 'resolveLoader' in compiler.options ? compiler.options.resolveLoader : {});
|
|
96
|
-
}
|
|
97
|
-
constructor(...args){
|
|
98
|
-
super(...args), this.name = 'loader', this.internalLoaderPath = (()=>{
|
|
99
|
-
const isCJS = loader_filename.endsWith('.cjs');
|
|
100
|
-
if (isCJS) return require.resolve(path.join(loader_dirname, "../loaders/proxy.cjs"));
|
|
101
|
-
try {
|
|
102
|
-
return require.resolve(path.join(loader_dirname, "../loaders/proxy.js"));
|
|
103
|
-
} catch {
|
|
104
|
-
return require.resolve(path.join(loader_dirname, "../loaders/proxy.cjs"));
|
|
105
|
-
}
|
|
106
|
-
})(), this.afterPlugins = (compiler)=>{
|
|
107
|
-
time('InternalLoaderPlugin.afterPlugins');
|
|
108
|
-
try {
|
|
109
|
-
if (compiler.isChild()) return;
|
|
110
|
-
compiler.options.module.rules = this.getInterceptRules(compiler, compiler.options.module.rules);
|
|
111
|
-
this.sdk.addClientRoutes([
|
|
112
|
-
Manifest.RsdoctorManifestClientRoutes.Loaders
|
|
113
|
-
]);
|
|
114
|
-
} finally{
|
|
115
|
-
timeEnd('InternalLoaderPlugin.afterPlugins');
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
export { InternalLoaderPlugin };
|
|
@@ -1,73 +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
|
-
InternalPluginsPlugin: ()=>InternalPluginsPlugin
|
|
28
|
-
});
|
|
29
|
-
const types_namespaceObject = require("@rsdoctor/types");
|
|
30
|
-
const index_cjs_namespaceObject = require("../../build-utils/build/index.cjs");
|
|
31
|
-
const external_utils_index_cjs_namespaceObject = require("../utils/index.cjs");
|
|
32
|
-
const external_base_cjs_namespaceObject = require("./base.cjs");
|
|
33
|
-
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
34
|
-
class InternalPluginsPlugin extends external_base_cjs_namespaceObject.InternalBasePlugin {
|
|
35
|
-
apply(compiler) {
|
|
36
|
-
(0, logger_namespaceObject.time)('InternalPluginsPlugin.apply');
|
|
37
|
-
try {
|
|
38
|
-
compiler.hooks.afterPlugins.tap(this.tapPostOptions, this.afterPlugins.bind(this, compiler));
|
|
39
|
-
compiler.hooks.compilation.tap(this.tapPostOptions, this.compilation);
|
|
40
|
-
} finally{
|
|
41
|
-
(0, logger_namespaceObject.timeEnd)('InternalPluginsPlugin.apply');
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
constructor(...args){
|
|
45
|
-
super(...args), this.name = 'plugins', this.afterPlugins = (compiler)=>{
|
|
46
|
-
(0, logger_namespaceObject.time)('InternalPluginsPlugin.afterPlugins');
|
|
47
|
-
try {
|
|
48
|
-
if (compiler.isChild()) return;
|
|
49
|
-
index_cjs_namespaceObject.Utils.interceptCompilerHooks(compiler, (name, hook)=>(0, external_utils_index_cjs_namespaceObject.interceptPluginHook)(this.sdk, name, hook));
|
|
50
|
-
this.sdk.addClientRoutes([
|
|
51
|
-
types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.Plugins
|
|
52
|
-
]);
|
|
53
|
-
} finally{
|
|
54
|
-
(0, logger_namespaceObject.timeEnd)('InternalPluginsPlugin.afterPlugins');
|
|
55
|
-
}
|
|
56
|
-
}, this.compilation = (compilation)=>{
|
|
57
|
-
(0, logger_namespaceObject.time)('InternalPluginsPlugin.compilation');
|
|
58
|
-
try {
|
|
59
|
-
if (compilation.compiler.isChild()) return;
|
|
60
|
-
index_cjs_namespaceObject.Utils.interceptCompilationHooks(compilation, (name, hook)=>(0, external_utils_index_cjs_namespaceObject.interceptPluginHook)(this.sdk, name, hook));
|
|
61
|
-
} finally{
|
|
62
|
-
(0, logger_namespaceObject.timeEnd)('InternalPluginsPlugin.compilation');
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
exports.InternalPluginsPlugin = __webpack_exports__.InternalPluginsPlugin;
|
|
68
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
69
|
-
"InternalPluginsPlugin"
|
|
70
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
71
|
-
Object.defineProperty(exports, '__esModule', {
|
|
72
|
-
value: true
|
|
73
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Plugin } from '@rsdoctor/types';
|
|
2
|
-
import { InternalBasePlugin } from './base';
|
|
3
|
-
export declare class InternalPluginsPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
4
|
-
readonly name = "plugins";
|
|
5
|
-
apply(compiler: Plugin.BaseCompiler): void;
|
|
6
|
-
afterPlugins: (compiler: Plugin.BaseCompiler) => void;
|
|
7
|
-
compilation: (compilation: Plugin.BaseCompilation) => void;
|
|
8
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { Manifest } from "@rsdoctor/types";
|
|
3
|
-
import { Utils } from "../../build-utils/build/index.js";
|
|
4
|
-
import { interceptPluginHook } from "../utils/index.js";
|
|
5
|
-
import { InternalBasePlugin } from "./base.js";
|
|
6
|
-
import { time, timeEnd } from "@rsdoctor/utils/logger";
|
|
7
|
-
class InternalPluginsPlugin extends InternalBasePlugin {
|
|
8
|
-
apply(compiler) {
|
|
9
|
-
time('InternalPluginsPlugin.apply');
|
|
10
|
-
try {
|
|
11
|
-
compiler.hooks.afterPlugins.tap(this.tapPostOptions, this.afterPlugins.bind(this, compiler));
|
|
12
|
-
compiler.hooks.compilation.tap(this.tapPostOptions, this.compilation);
|
|
13
|
-
} finally{
|
|
14
|
-
timeEnd('InternalPluginsPlugin.apply');
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
constructor(...args){
|
|
18
|
-
super(...args), this.name = 'plugins', this.afterPlugins = (compiler)=>{
|
|
19
|
-
time('InternalPluginsPlugin.afterPlugins');
|
|
20
|
-
try {
|
|
21
|
-
if (compiler.isChild()) return;
|
|
22
|
-
Utils.interceptCompilerHooks(compiler, (name, hook)=>interceptPluginHook(this.sdk, name, hook));
|
|
23
|
-
this.sdk.addClientRoutes([
|
|
24
|
-
Manifest.RsdoctorManifestClientRoutes.Plugins
|
|
25
|
-
]);
|
|
26
|
-
} finally{
|
|
27
|
-
timeEnd('InternalPluginsPlugin.afterPlugins');
|
|
28
|
-
}
|
|
29
|
-
}, this.compilation = (compilation)=>{
|
|
30
|
-
time('InternalPluginsPlugin.compilation');
|
|
31
|
-
try {
|
|
32
|
-
if (compilation.compiler.isChild()) return;
|
|
33
|
-
Utils.interceptCompilationHooks(compilation, (name, hook)=>interceptPluginHook(this.sdk, name, hook));
|
|
34
|
-
} finally{
|
|
35
|
-
timeEnd('InternalPluginsPlugin.compilation');
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
export { InternalPluginsPlugin };
|
|
@@ -1,68 +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
|
-
InternalProgressPlugin: ()=>InternalProgressPlugin
|
|
28
|
-
});
|
|
29
|
-
const types_namespaceObject = require("@rsdoctor/types");
|
|
30
|
-
const external_base_cjs_namespaceObject = require("./base.cjs");
|
|
31
|
-
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
32
|
-
class InternalProgressPlugin extends external_base_cjs_namespaceObject.InternalBasePlugin {
|
|
33
|
-
apply(compiler) {
|
|
34
|
-
const { sdk, currentProgress } = this;
|
|
35
|
-
if (compiler.webpack && compiler.webpack.ProgressPlugin) {
|
|
36
|
-
const progress = new compiler.webpack.ProgressPlugin((percentage, msg)=>{
|
|
37
|
-
currentProgress.percentage = percentage;
|
|
38
|
-
currentProgress.message = msg || '';
|
|
39
|
-
const api = types_namespaceObject.SDK.ServerAPI.APIExtends.GetCompileProgress;
|
|
40
|
-
try {
|
|
41
|
-
sdk.server.sendAPIDataToClient(api, {
|
|
42
|
-
req: {
|
|
43
|
-
api,
|
|
44
|
-
body: void 0
|
|
45
|
-
},
|
|
46
|
-
res: currentProgress
|
|
47
|
-
});
|
|
48
|
-
} catch (e) {
|
|
49
|
-
logger_namespaceObject.logger.debug(e);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
progress.apply(compiler);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
constructor(...args){
|
|
56
|
-
super(...args), this.name = 'progress', this.currentProgress = {
|
|
57
|
-
percentage: 100,
|
|
58
|
-
message: ''
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.InternalProgressPlugin = __webpack_exports__.InternalProgressPlugin;
|
|
63
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
64
|
-
"InternalProgressPlugin"
|
|
65
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
66
|
-
Object.defineProperty(exports, '__esModule', {
|
|
67
|
-
value: true
|
|
68
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { SDK } from '@rsdoctor/types';
|
|
2
|
-
import type { Plugin } from '@rsdoctor/types';
|
|
3
|
-
import { InternalBasePlugin } from './base';
|
|
4
|
-
export declare class InternalProgressPlugin<T extends Plugin.BaseCompilerType<'rspack'>> extends InternalBasePlugin<T> {
|
|
5
|
-
readonly name = "progress";
|
|
6
|
-
protected currentProgress: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.APIExtends.GetCompileProgress>;
|
|
7
|
-
apply(compiler: T): void;
|
|
8
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { SDK } from "@rsdoctor/types";
|
|
3
|
-
import { InternalBasePlugin } from "./base.js";
|
|
4
|
-
import { logger } from "@rsdoctor/utils/logger";
|
|
5
|
-
class InternalProgressPlugin extends InternalBasePlugin {
|
|
6
|
-
apply(compiler) {
|
|
7
|
-
const { sdk, currentProgress } = this;
|
|
8
|
-
if (compiler.webpack && compiler.webpack.ProgressPlugin) {
|
|
9
|
-
const progress = new compiler.webpack.ProgressPlugin((percentage, msg)=>{
|
|
10
|
-
currentProgress.percentage = percentage;
|
|
11
|
-
currentProgress.message = msg || '';
|
|
12
|
-
const api = SDK.ServerAPI.APIExtends.GetCompileProgress;
|
|
13
|
-
try {
|
|
14
|
-
sdk.server.sendAPIDataToClient(api, {
|
|
15
|
-
req: {
|
|
16
|
-
api,
|
|
17
|
-
body: void 0
|
|
18
|
-
},
|
|
19
|
-
res: currentProgress
|
|
20
|
-
});
|
|
21
|
-
} catch (e) {
|
|
22
|
-
logger.debug(e);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
progress.apply(compiler);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
constructor(...args){
|
|
29
|
-
super(...args), this.name = 'progress', this.currentProgress = {
|
|
30
|
-
percentage: 100,
|
|
31
|
-
message: ''
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export { InternalProgressPlugin };
|
|
@@ -1,90 +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
|
-
InternalResolverPlugin: ()=>InternalResolverPlugin
|
|
28
|
-
});
|
|
29
|
-
const types_namespaceObject = require("@rsdoctor/types");
|
|
30
|
-
const common_namespaceObject = require("@rsdoctor/utils/common");
|
|
31
|
-
const external_base_cjs_namespaceObject = require("./base.cjs");
|
|
32
|
-
class InternalResolverPlugin extends external_base_cjs_namespaceObject.InternalBasePlugin {
|
|
33
|
-
apply(compiler) {
|
|
34
|
-
this.scheduler.ensureModulesChunksGraphApplied(compiler);
|
|
35
|
-
compiler.hooks.normalModuleFactory.tap(this.tapPostOptions, this.handleNormalModuleFactory);
|
|
36
|
-
this.sdk.addClientRoutes([
|
|
37
|
-
types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.ModuleResolve
|
|
38
|
-
]);
|
|
39
|
-
}
|
|
40
|
-
constructor(...args){
|
|
41
|
-
super(...args), this.name = 'resolver', this.resolveDataMap = new Map(), this.handleNormalModuleFactory = (normalModuleFactory)=>{
|
|
42
|
-
normalModuleFactory.hooks.beforeResolve.tap(this.tapPostOptions, (resolveData)=>{
|
|
43
|
-
if (!resolveData) return;
|
|
44
|
-
const issuer = resolveData.contextInfo?.issuer || resolveData.context || '';
|
|
45
|
-
const request = resolveData.request;
|
|
46
|
-
if (issuer && request) {
|
|
47
|
-
const key = `${issuer}::${request}`;
|
|
48
|
-
this.resolveDataMap.set(key, {
|
|
49
|
-
startAt: Date.now(),
|
|
50
|
-
startHRTime: process.hrtime(),
|
|
51
|
-
request
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
normalModuleFactory.hooks.afterResolve.tap(this.tapPostOptions, (resolveData)=>{
|
|
56
|
-
if (!resolveData) return;
|
|
57
|
-
const issuer = resolveData.contextInfo?.issuer || resolveData.context || '';
|
|
58
|
-
const request = resolveData.request;
|
|
59
|
-
const result = resolveData.createData?.resource || resolveData.resourceResolveData?.path;
|
|
60
|
-
if (issuer && request) {
|
|
61
|
-
const key = `${issuer}::${request}`;
|
|
62
|
-
const startData = this.resolveDataMap.get(key);
|
|
63
|
-
if (startData) {
|
|
64
|
-
const data = {
|
|
65
|
-
isEntry: Boolean(issuer),
|
|
66
|
-
issuerPath: issuer,
|
|
67
|
-
request: startData.request,
|
|
68
|
-
startAt: startData.startAt,
|
|
69
|
-
endAt: common_namespaceObject.Time.getCurrentTimestamp(startData.startAt, startData.startHRTime),
|
|
70
|
-
result: result || '',
|
|
71
|
-
pid: process.pid,
|
|
72
|
-
ppid: process.ppid
|
|
73
|
-
};
|
|
74
|
-
this.sdk.reportResolver([
|
|
75
|
-
data
|
|
76
|
-
]);
|
|
77
|
-
this.resolveDataMap.delete(key);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
exports.InternalResolverPlugin = __webpack_exports__.InternalResolverPlugin;
|
|
85
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
86
|
-
"InternalResolverPlugin"
|
|
87
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
88
|
-
Object.defineProperty(exports, '__esModule', {
|
|
89
|
-
value: true
|
|
90
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Plugin } from '@rsdoctor/types';
|
|
2
|
-
import { InternalBasePlugin } from './base';
|
|
3
|
-
export declare class InternalResolverPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
4
|
-
readonly name = "resolver";
|
|
5
|
-
protected resolveDataMap: Map<string, {
|
|
6
|
-
startAt: number;
|
|
7
|
-
startHRTime: [number, number];
|
|
8
|
-
request: string;
|
|
9
|
-
}>;
|
|
10
|
-
apply(compiler: T): void;
|
|
11
|
-
protected handleNormalModuleFactory: (normalModuleFactory: Plugin.RspackNormalModuleFactory) => void;
|
|
12
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { Manifest } from "@rsdoctor/types";
|
|
3
|
-
import { Time } from "@rsdoctor/utils/common";
|
|
4
|
-
import { InternalBasePlugin } from "./base.js";
|
|
5
|
-
class InternalResolverPlugin extends InternalBasePlugin {
|
|
6
|
-
apply(compiler) {
|
|
7
|
-
this.scheduler.ensureModulesChunksGraphApplied(compiler);
|
|
8
|
-
compiler.hooks.normalModuleFactory.tap(this.tapPostOptions, this.handleNormalModuleFactory);
|
|
9
|
-
this.sdk.addClientRoutes([
|
|
10
|
-
Manifest.RsdoctorManifestClientRoutes.ModuleResolve
|
|
11
|
-
]);
|
|
12
|
-
}
|
|
13
|
-
constructor(...args){
|
|
14
|
-
super(...args), this.name = 'resolver', this.resolveDataMap = new Map(), this.handleNormalModuleFactory = (normalModuleFactory)=>{
|
|
15
|
-
normalModuleFactory.hooks.beforeResolve.tap(this.tapPostOptions, (resolveData)=>{
|
|
16
|
-
if (!resolveData) return;
|
|
17
|
-
const issuer = resolveData.contextInfo?.issuer || resolveData.context || '';
|
|
18
|
-
const request = resolveData.request;
|
|
19
|
-
if (issuer && request) {
|
|
20
|
-
const key = `${issuer}::${request}`;
|
|
21
|
-
this.resolveDataMap.set(key, {
|
|
22
|
-
startAt: Date.now(),
|
|
23
|
-
startHRTime: process.hrtime(),
|
|
24
|
-
request
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
normalModuleFactory.hooks.afterResolve.tap(this.tapPostOptions, (resolveData)=>{
|
|
29
|
-
if (!resolveData) return;
|
|
30
|
-
const issuer = resolveData.contextInfo?.issuer || resolveData.context || '';
|
|
31
|
-
const request = resolveData.request;
|
|
32
|
-
const result = resolveData.createData?.resource || resolveData.resourceResolveData?.path;
|
|
33
|
-
if (issuer && request) {
|
|
34
|
-
const key = `${issuer}::${request}`;
|
|
35
|
-
const startData = this.resolveDataMap.get(key);
|
|
36
|
-
if (startData) {
|
|
37
|
-
const data = {
|
|
38
|
-
isEntry: Boolean(issuer),
|
|
39
|
-
issuerPath: issuer,
|
|
40
|
-
request: startData.request,
|
|
41
|
-
startAt: startData.startAt,
|
|
42
|
-
endAt: Time.getCurrentTimestamp(startData.startAt, startData.startHRTime),
|
|
43
|
-
result: result || '',
|
|
44
|
-
pid: process.pid,
|
|
45
|
-
ppid: process.ppid
|
|
46
|
-
};
|
|
47
|
-
this.sdk.reportResolver([
|
|
48
|
-
data
|
|
49
|
-
]);
|
|
50
|
-
this.resolveDataMap.delete(key);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
export { InternalResolverPlugin };
|
|
@@ -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;
|