@rsbuild/core 1.0.0 → 1.0.1-beta.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/README.md +1 -1
- package/bin/rsbuild.js +4 -2
- package/compiled/autoprefixer/index.d.ts +95 -0
- package/compiled/autoprefixer/index.js +7000 -0
- package/compiled/autoprefixer/license +20 -0
- package/compiled/autoprefixer/package.json +1 -0
- package/compiled/browserslist/index.d.ts +201 -0
- package/compiled/browserslist/index.js +1867 -0
- package/compiled/browserslist/license +20 -0
- package/compiled/browserslist/package.json +1 -0
- package/compiled/chokidar/index.d.ts +198 -0
- package/compiled/chokidar/index.js +5139 -0
- package/compiled/chokidar/license +21 -0
- package/compiled/chokidar/package.json +1 -0
- package/compiled/commander/{typings/index.d.ts → index.d.ts} +184 -102
- package/compiled/commander/index.js +2190 -1
- package/compiled/commander/package.json +1 -1
- package/compiled/connect/index.d.ts +90 -0
- package/compiled/connect/index.js +1240 -0
- package/compiled/connect/license +25 -0
- package/compiled/connect/package.json +1 -0
- package/compiled/connect-history-api-fallback/index.js +149 -1
- package/compiled/connect-history-api-fallback/package.json +1 -1
- package/compiled/css-loader/api.js +85 -0
- package/compiled/css-loader/getUrl.js +26 -0
- package/compiled/css-loader/index.d.ts +1 -0
- package/compiled/css-loader/index.js +7541 -0
- package/compiled/css-loader/license +20 -0
- package/compiled/css-loader/noSourceMaps.js +5 -0
- package/compiled/css-loader/package.json +1 -0
- package/compiled/css-loader/semver.js +1 -0
- package/compiled/css-loader/sourceMaps.js +16 -0
- package/compiled/dotenv/{lib/main.d.ts → index.d.ts} +25 -24
- package/compiled/dotenv/index.js +336 -1
- package/compiled/dotenv/package.json +1 -1
- package/compiled/dotenv-expand/index.d.ts +52 -0
- package/compiled/dotenv-expand/index.js +105 -1
- package/compiled/dotenv-expand/package.json +1 -1
- package/compiled/html-rspack-plugin/default_index.ejs +9 -0
- package/compiled/html-rspack-plugin/index.d.ts +284 -0
- package/compiled/html-rspack-plugin/index.js +1574 -0
- package/compiled/html-rspack-plugin/license +20 -0
- package/compiled/html-rspack-plugin/loader.js +162 -0
- package/compiled/html-rspack-plugin/package.json +1 -0
- package/compiled/http-compression/index.js +134 -1
- package/compiled/http-compression/package.json +1 -1
- package/compiled/http-proxy-middleware/index.d.ts +315 -0
- package/compiled/http-proxy-middleware/index.js +5251 -0
- package/compiled/http-proxy-middleware/license +22 -0
- package/compiled/http-proxy-middleware/package.json +1 -0
- package/compiled/jiti/index.d.ts +1 -0
- package/compiled/jiti/index.js +254 -1748
- package/compiled/jiti/package.json +1 -1
- package/compiled/launch-editor-middleware/index.d.ts +1 -0
- package/compiled/launch-editor-middleware/index.js +696 -0
- package/compiled/launch-editor-middleware/license +21 -0
- package/compiled/launch-editor-middleware/package.json +1 -0
- package/compiled/on-finished/index.d.ts +13 -0
- package/compiled/on-finished/index.js +197 -0
- package/compiled/on-finished/license +23 -0
- package/compiled/on-finished/package.json +1 -0
- package/compiled/open/index.d.ts +1 -153
- package/compiled/open/index.js +409 -1
- package/compiled/open/package.json +1 -1
- package/compiled/picocolors/index.d.ts +34 -0
- package/compiled/picocolors/index.js +97 -0
- package/compiled/picocolors/license +15 -0
- package/compiled/picocolors/package.json +1 -0
- package/compiled/postcss-load-config/index.d.ts +1 -0
- package/compiled/postcss-load-config/index.js +751 -0
- package/compiled/postcss-load-config/license +20 -0
- package/compiled/postcss-load-config/package.json +1 -0
- package/compiled/postcss-loader/index.d.ts +1 -0
- package/compiled/postcss-loader/index.js +8423 -0
- package/compiled/postcss-loader/license +20 -0
- package/compiled/postcss-loader/package.json +1 -0
- package/compiled/postcss-loader/semver.js +1 -0
- package/compiled/postcss-value-parser/index.d.ts +1 -0
- package/compiled/postcss-value-parser/index.js +495 -0
- package/compiled/postcss-value-parser/license +22 -0
- package/compiled/postcss-value-parser/package.json +1 -0
- package/compiled/rslog/index.d.ts +66 -0
- package/compiled/rslog/index.js +334 -0
- package/compiled/rslog/license +21 -0
- package/compiled/rslog/package.json +1 -0
- package/compiled/rspack-chain/index.d.ts +601 -0
- package/compiled/rspack-chain/index.js +1702 -0
- package/compiled/rspack-chain/license +373 -0
- package/compiled/rspack-chain/package.json +1 -0
- package/compiled/rspack-manifest-plugin/index.d.ts +1 -0
- package/compiled/rspack-manifest-plugin/index.js +5884 -0
- package/compiled/rspack-manifest-plugin/license +21 -0
- package/compiled/rspack-manifest-plugin/package.json +1 -0
- package/compiled/sirv/index.d.ts +1 -0
- package/compiled/sirv/index.js +701 -1
- package/compiled/sirv/package.json +1 -1
- package/compiled/style-loader/index.d.ts +1 -0
- package/compiled/style-loader/index.js +427 -0
- package/compiled/style-loader/license +20 -0
- package/compiled/style-loader/package.json +1 -0
- package/compiled/style-loader/runtime/injectStylesIntoLinkTag.js +29 -0
- package/compiled/style-loader/runtime/injectStylesIntoStyleTag.js +84 -0
- package/compiled/style-loader/runtime/insertBySelector.js +34 -0
- package/compiled/style-loader/runtime/insertStyleElement.js +10 -0
- package/compiled/style-loader/runtime/isEqualLocals.js +28 -0
- package/compiled/style-loader/runtime/isOldIE.js +17 -0
- package/compiled/style-loader/runtime/setAttributesWithAttributes.js +13 -0
- package/compiled/style-loader/runtime/setAttributesWithAttributesAndNonce.js +9 -0
- package/compiled/style-loader/runtime/setAttributesWithoutAttributes.js +10 -0
- package/compiled/style-loader/runtime/singletonStyleDomAPI.js +86 -0
- package/compiled/style-loader/runtime/styleDomAPI.js +61 -0
- package/compiled/style-loader/runtime/styleTagTransform.js +14 -0
- package/compiled/webpack-bundle-analyzer/index.d.ts +160 -0
- package/compiled/webpack-bundle-analyzer/index.js +13352 -0
- package/compiled/webpack-bundle-analyzer/license +20 -0
- package/compiled/webpack-bundle-analyzer/package.json +1 -0
- package/compiled/webpack-bundle-analyzer/public/viewer.js +16 -0
- package/compiled/webpack-bundle-analyzer/public/viewer.js.LICENSE.txt +10 -0
- package/compiled/webpack-dev-middleware/index.d.ts +1 -0
- package/compiled/webpack-dev-middleware/index.js +5672 -0
- package/compiled/webpack-dev-middleware/license +20 -0
- package/compiled/webpack-dev-middleware/package.json +1 -0
- package/compiled/webpack-dev-middleware/schema-utils.js +1 -0
- package/compiled/webpack-merge/index.d.ts +31 -0
- package/compiled/webpack-merge/index.js +1200 -0
- package/compiled/webpack-merge/license +20 -0
- package/compiled/webpack-merge/package.json +1 -0
- package/compiled/ws/index.d.ts +402 -0
- package/compiled/ws/index.js +3153 -0
- package/compiled/ws/license +20 -0
- package/compiled/ws/package.json +1 -0
- package/dist/client/hmr.js +249 -405
- package/dist/client/overlay.js +221 -0
- package/dist/{rspack-provider/plugins/basic.js → ignoreCssLoader.cjs} +12 -14
- package/dist/index.cjs +9011 -0
- package/dist/index.js +9082 -16
- package/dist/transformLoader.cjs +54 -0
- package/dist/transformRawLoader.cjs +65 -0
- package/dist-types/cli/commands.d.ts +20 -0
- package/dist-types/cli/init.d.ts +6 -0
- package/dist-types/cli/prepare.d.ts +1 -0
- package/dist-types/client/format.d.ts +5 -0
- package/dist-types/client/hmr.d.ts +1 -0
- package/dist-types/client/overlay.d.ts +1 -0
- package/dist-types/config.d.ts +63 -0
- package/dist-types/configChain.d.ts +162 -0
- package/dist-types/constants.d.ts +32 -0
- package/dist-types/createContext.d.ts +11 -0
- package/dist-types/createRsbuild.d.ts +2 -0
- package/dist-types/helpers/path.d.ts +10 -0
- package/dist-types/helpers.d.ts +57 -0
- package/dist-types/index.d.ts +24 -0
- package/dist-types/initHooks.d.ts +23 -0
- package/dist-types/initPlugins.d.ts +6 -0
- package/dist-types/internal.d.ts +20 -0
- package/dist-types/loadEnv.d.ts +27 -0
- package/dist-types/loader/ignoreCssLoader.d.ts +2 -0
- package/dist-types/loader/transformLoader.d.ts +5 -0
- package/dist-types/loader/transformRawLoader.d.ts +3 -0
- package/dist-types/logger.d.ts +4 -0
- package/dist-types/mergeConfig.d.ts +2 -0
- package/dist-types/package.json +1 -0
- package/dist-types/pluginHelper.d.ts +12 -0
- package/dist-types/pluginManager.d.ts +7 -0
- package/{dist → dist-types}/plugins/asset.d.ts +1 -1
- package/dist-types/plugins/basic.d.ts +5 -0
- package/dist-types/plugins/bundleAnalyzer.d.ts +2 -0
- package/dist-types/plugins/cache.d.ts +2 -0
- package/dist-types/plugins/cleanOutput.d.ts +2 -0
- package/dist-types/plugins/css.d.ts +10 -0
- package/dist-types/plugins/define.d.ts +2 -0
- package/dist-types/plugins/entry.d.ts +2 -0
- package/dist-types/plugins/externals.d.ts +2 -0
- package/{dist → dist-types}/plugins/fileSize.d.ts +1 -1
- package/dist-types/plugins/html.d.ts +9 -0
- package/dist-types/plugins/inlineChunk.d.ts +2 -0
- package/dist-types/plugins/lazyCompilation.d.ts +2 -0
- package/dist-types/plugins/manifest.d.ts +2 -0
- package/dist-types/plugins/minimize.d.ts +10 -0
- package/dist-types/plugins/moduleFederation.d.ts +2 -0
- package/dist-types/plugins/moment.d.ts +2 -0
- package/dist-types/plugins/nodeAddons.d.ts +2 -0
- package/dist-types/plugins/nonce.d.ts +2 -0
- package/{dist/plugins/startUrl.d.ts → dist-types/plugins/open.d.ts} +2 -1
- package/dist-types/plugins/output.d.ts +2 -0
- package/{dist → dist-types}/plugins/performance.d.ts +1 -1
- package/dist-types/plugins/progress.d.ts +2 -0
- package/dist-types/plugins/resolve.d.ts +2 -0
- package/dist-types/plugins/resourceHints.d.ts +2 -0
- package/dist-types/plugins/rsdoctor.d.ts +2 -0
- package/dist-types/plugins/rspackProfile.d.ts +2 -0
- package/dist-types/plugins/server.d.ts +2 -0
- package/dist-types/plugins/splitChunks.d.ts +4 -0
- package/dist-types/plugins/sri.d.ts +2 -0
- package/dist-types/plugins/swc.d.ts +7 -0
- package/dist-types/plugins/target.d.ts +2 -0
- package/dist-types/plugins/wasm.d.ts +2 -0
- package/dist-types/provider/build.d.ts +3 -0
- package/dist-types/provider/createCompiler.d.ts +33 -0
- package/dist-types/provider/initConfigs.d.ts +10 -0
- package/dist-types/provider/inspectConfig.d.ts +6 -0
- package/dist-types/provider/provider.d.ts +2 -0
- package/dist-types/provider/rspackConfig.d.ts +8 -0
- package/dist-types/rspack/HtmlAppIconPlugin.d.ts +13 -0
- package/dist-types/rspack/HtmlBasicPlugin.d.ts +37 -0
- package/dist-types/rspack/InlineChunkHtmlPlugin.d.ts +29 -0
- package/dist-types/rspack/preload/HtmlPreloadOrPrefetchPlugin.d.ts +29 -0
- package/dist-types/rspack/preload/helpers/determineAsValue.d.ts +22 -0
- package/dist-types/rspack/preload/helpers/doesChunkBelongToHtml.d.ts +29 -0
- package/dist-types/rspack/preload/helpers/extractChunks.d.ts +28 -0
- package/dist-types/rspack/preload/helpers/index.d.ts +4 -0
- package/dist-types/rspack/preload/helpers/type.d.ts +13 -0
- package/dist-types/server/compilerDevMiddleware.d.ts +30 -0
- package/dist-types/server/devMiddleware.d.ts +39 -0
- package/dist-types/server/devServer.d.ts +50 -0
- package/dist-types/server/environment.d.ts +7 -0
- package/dist-types/server/getDevMiddlewares.d.ts +25 -0
- package/dist-types/server/helper.d.ts +59 -0
- package/dist-types/server/httpServer.d.ts +8 -0
- package/dist-types/server/middlewares.d.ts +22 -0
- package/dist-types/server/prodServer.d.ts +25 -0
- package/dist-types/server/proxy.d.ts +6 -0
- package/dist-types/server/restart.d.ts +9 -0
- package/dist-types/server/runner/asModule.d.ts +2 -0
- package/dist-types/server/runner/basic.d.ts +25 -0
- package/dist-types/server/runner/cjs.d.ts +10 -0
- package/dist-types/server/runner/esm.d.ts +6 -0
- package/dist-types/server/runner/index.d.ts +8 -0
- package/dist-types/server/runner/type.d.ts +36 -0
- package/dist-types/server/socketServer.d.ts +22 -0
- package/dist-types/server/watchFiles.d.ts +11 -0
- package/dist-types/types/config/dev.d.ts +90 -0
- package/dist-types/types/config/html.d.ts +107 -0
- package/dist-types/types/config/index.d.ts +134 -0
- package/dist-types/types/config/output.d.ts +297 -0
- package/dist-types/types/config/performance.d.ts +123 -0
- package/dist-types/types/config/security.d.ts +18 -0
- package/dist-types/types/config/server.d.ts +106 -0
- package/dist-types/types/config/source.d.ts +79 -0
- package/dist-types/types/config/tools.d.ts +85 -0
- package/dist-types/types/context.d.ts +38 -0
- package/dist-types/types/hooks.d.ts +125 -0
- package/dist-types/types/index.d.ts +9 -0
- package/dist-types/types/plugin.d.ts +197 -0
- package/dist-types/types/rsbuild.d.ts +109 -0
- package/dist-types/types/rspack.d.ts +28 -0
- package/dist-types/types/stats.d.ts +17 -0
- package/dist-types/types/thirdParty.d.ts +168 -0
- package/dist-types/types/utils.d.ts +13 -0
- package/package.json +73 -43
- package/types.d.ts +36 -4
- package/compiled/dotenv-expand/lib/main.d.ts +0 -29
- package/compiled/jiti/types/jiti.d.ts +0 -19
- package/compiled/jiti/types/types.d.ts +0 -31
- package/compiled/open/license +0 -9
- package/compiled/sirv/sirv.d.ts +0 -27
- package/dist/cli/commands.d.ts +0 -20
- package/dist/cli/commands.js +0 -131
- package/dist/cli/config.d.ts +0 -9
- package/dist/cli/config.js +0 -110
- package/dist/cli/prepare.d.ts +0 -1
- package/dist/cli/prepare.js +0 -43
- package/dist/client/hmr/createSocketUrl.d.ts +0 -16
- package/dist/client/hmr/index.d.ts +0 -1
- package/dist/createRsbuild.d.ts +0 -10
- package/dist/createRsbuild.js +0 -100
- package/dist/index.d.ts +0 -10
- package/dist/loadEnv.d.ts +0 -5
- package/dist/loadEnv.js +0 -58
- package/dist/plugins/asset.js +0 -73
- package/dist/plugins/bundleAnalyzer.d.ts +0 -2
- package/dist/plugins/bundleAnalyzer.js +0 -59
- package/dist/plugins/cache.d.ts +0 -2
- package/dist/plugins/cache.js +0 -112
- package/dist/plugins/cleanOutput.d.ts +0 -2
- package/dist/plugins/cleanOutput.js +0 -47
- package/dist/plugins/define.d.ts +0 -2
- package/dist/plugins/define.js +0 -47
- package/dist/plugins/devtool.d.ts +0 -2
- package/dist/plugins/devtool.js +0 -46
- package/dist/plugins/entry.d.ts +0 -2
- package/dist/plugins/entry.js +0 -53
- package/dist/plugins/externals.d.ts +0 -2
- package/dist/plugins/externals.js +0 -48
- package/dist/plugins/fileSize.js +0 -158
- package/dist/plugins/html.d.ts +0 -15
- package/dist/plugins/html.js +0 -270
- package/dist/plugins/index.d.ts +0 -2
- package/dist/plugins/index.js +0 -61
- package/dist/plugins/inlineChunk.d.ts +0 -2
- package/dist/plugins/inlineChunk.js +0 -76
- package/dist/plugins/moment.d.ts +0 -2
- package/dist/plugins/moment.js +0 -68
- package/dist/plugins/networkPerformance.d.ts +0 -2
- package/dist/plugins/networkPerformance.js +0 -58
- package/dist/plugins/nodeAddons.d.ts +0 -2
- package/dist/plugins/nodeAddons.js +0 -70
- package/dist/plugins/performance.js +0 -63
- package/dist/plugins/preloadOrPrefetch.d.ts +0 -2
- package/dist/plugins/preloadOrPrefetch.js +0 -61
- package/dist/plugins/splitChunks.d.ts +0 -2
- package/dist/plugins/splitChunks.js +0 -228
- package/dist/plugins/startUrl.js +0 -148
- package/dist/plugins/target.d.ts +0 -2
- package/dist/plugins/target.js +0 -53
- package/dist/plugins/toml.d.ts +0 -2
- package/dist/plugins/toml.js +0 -36
- package/dist/plugins/wasm.d.ts +0 -2
- package/dist/plugins/wasm.js +0 -51
- package/dist/plugins/yaml.d.ts +0 -2
- package/dist/plugins/yaml.js +0 -36
- package/dist/rspack-plugins/HtmlBasicPlugin.d.ts +0 -19
- package/dist/rspack-plugins/HtmlBasicPlugin.js +0 -87
- package/dist/rspack-plugins/RemoveCssSourcemapPlugin.d.ts +0 -8
- package/dist/rspack-plugins/RemoveCssSourcemapPlugin.js +0 -51
- package/dist/rspack-provider/config.d.ts +0 -9
- package/dist/rspack-provider/config.js +0 -47
- package/dist/rspack-provider/core/build.d.ts +0 -19
- package/dist/rspack-provider/core/build.js +0 -79
- package/dist/rspack-provider/core/createCompiler.d.ts +0 -11
- package/dist/rspack-provider/core/createCompiler.js +0 -112
- package/dist/rspack-provider/core/createContext.d.ts +0 -13
- package/dist/rspack-provider/core/createContext.js +0 -133
- package/dist/rspack-provider/core/devMiddleware.d.ts +0 -3
- package/dist/rspack-provider/core/devMiddleware.js +0 -65
- package/dist/rspack-provider/core/initConfigs.d.ts +0 -14
- package/dist/rspack-provider/core/initConfigs.js +0 -78
- package/dist/rspack-provider/core/initHooks.d.ts +0 -19
- package/dist/rspack-provider/core/initHooks.js +0 -45
- package/dist/rspack-provider/core/initPlugins.d.ts +0 -9
- package/dist/rspack-provider/core/initPlugins.js +0 -87
- package/dist/rspack-provider/core/inspectConfig.d.ts +0 -19
- package/dist/rspack-provider/core/inspectConfig.js +0 -81
- package/dist/rspack-provider/core/rspackConfig.d.ts +0 -9
- package/dist/rspack-provider/core/rspackConfig.js +0 -132
- package/dist/rspack-provider/css-modules-typescript-pre-loader/index.d.ts +0 -6
- package/dist/rspack-provider/css-modules-typescript-pre-loader/index.js +0 -84
- package/dist/rspack-provider/css-modules-typescript-pre-loader/postcss-icss-extract-plugin.d.ts +0 -11
- package/dist/rspack-provider/css-modules-typescript-pre-loader/postcss-icss-extract-plugin.js +0 -67
- package/dist/rspack-provider/index.d.ts +0 -5
- package/dist/rspack-provider/index.js +0 -38
- package/dist/rspack-provider/plugins/basic.d.ts +0 -5
- package/dist/rspack-provider/plugins/css.d.ts +0 -29
- package/dist/rspack-provider/plugins/css.js +0 -199
- package/dist/rspack-provider/plugins/hmr.d.ts +0 -2
- package/dist/rspack-provider/plugins/hmr.js +0 -38
- package/dist/rspack-provider/plugins/less.d.ts +0 -2
- package/dist/rspack-provider/plugins/less.js +0 -78
- package/dist/rspack-provider/plugins/minimize.d.ts +0 -5
- package/dist/rspack-provider/plugins/minimize.js +0 -77
- package/dist/rspack-provider/plugins/output.d.ts +0 -2
- package/dist/rspack-provider/plugins/output.js +0 -65
- package/dist/rspack-provider/plugins/progress.d.ts +0 -2
- package/dist/rspack-provider/plugins/progress.js +0 -61
- package/dist/rspack-provider/plugins/resolve.d.ts +0 -2
- package/dist/rspack-provider/plugins/resolve.js +0 -54
- package/dist/rspack-provider/plugins/rspackProfile.d.ts +0 -5
- package/dist/rspack-provider/plugins/rspackProfile.js +0 -107
- package/dist/rspack-provider/plugins/sass.d.ts +0 -2
- package/dist/rspack-provider/plugins/sass.js +0 -83
- package/dist/rspack-provider/plugins/swc.d.ts +0 -7
- package/dist/rspack-provider/plugins/swc.js +0 -147
- package/dist/rspack-provider/plugins/transition.d.ts +0 -5
- package/dist/rspack-provider/plugins/transition.js +0 -42
- package/dist/rspack-provider/provider.d.ts +0 -8
- package/dist/rspack-provider/provider.js +0 -117
- package/dist/rspack-provider/shared.d.ts +0 -8
- package/dist/rspack-provider/shared.js +0 -116
- package/dist/server/dev-middleware/index.d.ts +0 -24
- package/dist/server/dev-middleware/index.js +0 -91
- package/dist/server/dev-middleware/socketServer.d.ts +0 -22
- package/dist/server/dev-middleware/socketServer.js +0 -164
- package/dist/server/devServer.d.ts +0 -34
- package/dist/server/devServer.js +0 -252
- package/dist/server/index.d.ts +0 -2
- package/dist/server/index.js +0 -31
- package/dist/server/middlewares.d.ts +0 -9
- package/dist/server/middlewares.js +0 -115
- package/dist/server/prodServer.d.ts +0 -33
- package/dist/server/prodServer.js +0 -197
- package/dist/server/proxy.d.ts +0 -9
- package/dist/server/proxy.js +0 -90
- package/dist/server/restart.d.ts +0 -11
- package/dist/server/restart.js +0 -65
- package/dist/types.d.ts +0 -19
- package/dist/types.js +0 -16
- package/static/template.html +0 -7
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import type { CopyRspackPluginOptions, Externals, LightningCssMinimizerRspackPluginOptions, SwcJsMinimizerRspackPluginOptions } from '@rspack/core';
|
|
2
|
+
import type { CSSLoaderModulesOptions } from '../../types';
|
|
3
|
+
import type { RsbuildTarget } from '../rsbuild';
|
|
4
|
+
import type { Rspack, RspackConfig } from '../rspack';
|
|
5
|
+
export type DistPathConfig = {
|
|
6
|
+
/**
|
|
7
|
+
* The root directory of all files.
|
|
8
|
+
* @default 'dist'
|
|
9
|
+
**/
|
|
10
|
+
root?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The output directory of JavaScript files.
|
|
13
|
+
* @default 'static/js'
|
|
14
|
+
*/
|
|
15
|
+
js?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The output directory of async JavaScript files.
|
|
18
|
+
* @default 'static/js/async'
|
|
19
|
+
*/
|
|
20
|
+
jsAsync?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The output directory of CSS files.
|
|
23
|
+
* @default 'static/css'
|
|
24
|
+
*/
|
|
25
|
+
css?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The output directory of async CSS files.
|
|
28
|
+
* @default 'static/css/async'
|
|
29
|
+
*/
|
|
30
|
+
cssAsync?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The output directory of SVG images.
|
|
33
|
+
* @default 'static/svg'
|
|
34
|
+
*/
|
|
35
|
+
svg?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The output directory of font files.
|
|
38
|
+
* @default 'static/font'
|
|
39
|
+
*/
|
|
40
|
+
font?: string;
|
|
41
|
+
/**
|
|
42
|
+
* The output directory of HTML files.
|
|
43
|
+
* @default '/'
|
|
44
|
+
*/
|
|
45
|
+
html?: string;
|
|
46
|
+
/**
|
|
47
|
+
* The output directory of Wasm files.
|
|
48
|
+
* @default 'static/wasm'
|
|
49
|
+
*/
|
|
50
|
+
wasm?: string;
|
|
51
|
+
/**
|
|
52
|
+
* The output directory of non-SVG images.
|
|
53
|
+
* @default 'static/image'
|
|
54
|
+
*/
|
|
55
|
+
image?: string;
|
|
56
|
+
/**
|
|
57
|
+
* The output directory of media resources, such as videos.
|
|
58
|
+
* @default 'static/media'
|
|
59
|
+
*/
|
|
60
|
+
media?: string;
|
|
61
|
+
};
|
|
62
|
+
export type FilenameConfig = {
|
|
63
|
+
/**
|
|
64
|
+
* The name of the JavaScript files.
|
|
65
|
+
* @default
|
|
66
|
+
* - dev: '[name].js'
|
|
67
|
+
* - prod: '[name].[contenthash:8].js'
|
|
68
|
+
*/
|
|
69
|
+
js?: NonNullable<Rspack.Configuration['output']>['filename'];
|
|
70
|
+
/**
|
|
71
|
+
* The name of the CSS files.
|
|
72
|
+
* @default
|
|
73
|
+
* - dev: '[name].css'
|
|
74
|
+
* - prod: '[name].[contenthash:8].css'
|
|
75
|
+
*/
|
|
76
|
+
css?: string;
|
|
77
|
+
/**
|
|
78
|
+
* The name of the SVG images.
|
|
79
|
+
* @default '[name].[contenthash:8].svg'
|
|
80
|
+
*/
|
|
81
|
+
svg?: string;
|
|
82
|
+
/**
|
|
83
|
+
* The name of the font files.
|
|
84
|
+
* @default '[name].[contenthash:8][ext]'
|
|
85
|
+
*/
|
|
86
|
+
font?: string;
|
|
87
|
+
/**
|
|
88
|
+
* The name of non-SVG images.
|
|
89
|
+
* @default '[name].[contenthash:8][ext]'
|
|
90
|
+
*/
|
|
91
|
+
image?: string;
|
|
92
|
+
/**
|
|
93
|
+
* The name of media assets, such as video.
|
|
94
|
+
* @default '[name].[contenthash:8][ext]'
|
|
95
|
+
*/
|
|
96
|
+
media?: string;
|
|
97
|
+
};
|
|
98
|
+
export type DataUriLimit = {
|
|
99
|
+
/** The data URI limit of the SVG image. */
|
|
100
|
+
svg?: number;
|
|
101
|
+
/** The data URI limit of the font file. */
|
|
102
|
+
font?: number;
|
|
103
|
+
/** The data URI limit of non-SVG images. */
|
|
104
|
+
image?: number;
|
|
105
|
+
/** The data URI limit of media resources such as videos. */
|
|
106
|
+
media?: number;
|
|
107
|
+
};
|
|
108
|
+
export type Charset = 'ascii' | 'utf8';
|
|
109
|
+
export type LegalComments = 'none' | 'inline' | 'linked';
|
|
110
|
+
export type NormalizedDataUriLimit = Required<DataUriLimit>;
|
|
111
|
+
export type Polyfill = 'usage' | 'entry' | 'off';
|
|
112
|
+
export type SourceMap = {
|
|
113
|
+
js?: RspackConfig['devtool'];
|
|
114
|
+
css?: boolean;
|
|
115
|
+
};
|
|
116
|
+
export type CSSModulesLocalsConvention = 'asIs' | 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly';
|
|
117
|
+
export type CSSModules = {
|
|
118
|
+
/**
|
|
119
|
+
* Allows CSS Modules to be automatically enabled based on their filenames.
|
|
120
|
+
*/
|
|
121
|
+
auto?: CSSLoaderModulesOptions['auto'];
|
|
122
|
+
/**
|
|
123
|
+
* Allows exporting names from global class names, so you can use them via import.
|
|
124
|
+
*/
|
|
125
|
+
exportGlobals?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Style of exported class names.
|
|
128
|
+
*/
|
|
129
|
+
exportLocalsConvention?: CSSModulesLocalsConvention;
|
|
130
|
+
/**
|
|
131
|
+
* Set the local ident name of CSS Modules.
|
|
132
|
+
*/
|
|
133
|
+
localIdentName?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Controls the level of compilation applied to the input styles.
|
|
136
|
+
*/
|
|
137
|
+
mode?: CSSLoaderModulesOptions['mode'];
|
|
138
|
+
/**
|
|
139
|
+
* Whether to enable ES modules named export for locals.
|
|
140
|
+
*/
|
|
141
|
+
namedExport?: boolean;
|
|
142
|
+
};
|
|
143
|
+
export type Minify = boolean | {
|
|
144
|
+
/**
|
|
145
|
+
* Whether to enable JavaScript minification.
|
|
146
|
+
*/
|
|
147
|
+
js?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Minimizer options of JavaScript, which will be passed to SWC.
|
|
150
|
+
*/
|
|
151
|
+
jsOptions?: SwcJsMinimizerRspackPluginOptions;
|
|
152
|
+
/**
|
|
153
|
+
* Whether to enable CSS minimization.
|
|
154
|
+
*/
|
|
155
|
+
css?: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Minimizer options of CSS, which will be passed to LightningCSS.
|
|
158
|
+
*/
|
|
159
|
+
cssOptions?: LightningCssMinimizerRspackPluginOptions;
|
|
160
|
+
};
|
|
161
|
+
export type InlineChunkTestFunction = (params: {
|
|
162
|
+
size: number;
|
|
163
|
+
name: string;
|
|
164
|
+
}) => boolean;
|
|
165
|
+
export type InlineChunkTest = RegExp | InlineChunkTestFunction;
|
|
166
|
+
export interface OutputConfig {
|
|
167
|
+
/**
|
|
168
|
+
* Specify build target to run in specified environment.
|
|
169
|
+
* @default 'web'
|
|
170
|
+
*/
|
|
171
|
+
target?: RsbuildTarget;
|
|
172
|
+
/**
|
|
173
|
+
* At build time, prevent some `import` dependencies from being packed into bundles in your code, and instead fetch them externally at runtime.
|
|
174
|
+
* For more information, please see: [Rspack Externals](https://rspack.dev/config/externals)
|
|
175
|
+
*/
|
|
176
|
+
externals?: Externals;
|
|
177
|
+
/**
|
|
178
|
+
* Set the directory of the dist files.
|
|
179
|
+
* Rsbuild will output files to the corresponding subdirectory according to the file type.
|
|
180
|
+
*/
|
|
181
|
+
distPath?: DistPathConfig;
|
|
182
|
+
/**
|
|
183
|
+
* Sets the filename of dist files.
|
|
184
|
+
*/
|
|
185
|
+
filename?: FilenameConfig;
|
|
186
|
+
/**
|
|
187
|
+
* By default, Rsbuild's output is ASCII-only and will escape all non-ASCII characters.
|
|
188
|
+
* If you want to output the original characters without using escape sequences,
|
|
189
|
+
* you can set `output.charset` to `utf8`.
|
|
190
|
+
*/
|
|
191
|
+
charset?: Charset;
|
|
192
|
+
/**
|
|
193
|
+
* Configure how the polyfill is injected.
|
|
194
|
+
*/
|
|
195
|
+
polyfill?: Polyfill;
|
|
196
|
+
/**
|
|
197
|
+
* When using CDN in the production,
|
|
198
|
+
* you can use this option to set the URL prefix of static assets,
|
|
199
|
+
* similar to the output.publicPath config of webpack.
|
|
200
|
+
*/
|
|
201
|
+
assetPrefix?: string;
|
|
202
|
+
/**
|
|
203
|
+
* Set the size threshold to inline static assets such as images and fonts.
|
|
204
|
+
* By default, static assets will be Base64 encoded and inline into the page if the size is less than 4KiB.
|
|
205
|
+
*/
|
|
206
|
+
dataUriLimit?: number | DataUriLimit;
|
|
207
|
+
/**
|
|
208
|
+
* Configure how to handle the legal comment.
|
|
209
|
+
* A "legal comment" is considered to be any statement-level comment in JS or rule-level
|
|
210
|
+
* comment in CSS that contains @license or @preserve or that starts with //! or /\*!.
|
|
211
|
+
* These comments are preserved in output files by default since that follows the intent
|
|
212
|
+
* of the original authors of the code.
|
|
213
|
+
*/
|
|
214
|
+
legalComments?: LegalComments;
|
|
215
|
+
/**
|
|
216
|
+
* Whether to clean all files in the dist path before starting compilation.
|
|
217
|
+
*/
|
|
218
|
+
cleanDistPath?: boolean;
|
|
219
|
+
/**
|
|
220
|
+
* Allow to custom CSS Modules options.
|
|
221
|
+
*/
|
|
222
|
+
cssModules?: CSSModules;
|
|
223
|
+
/**
|
|
224
|
+
* Whether to disable code minification in production build.
|
|
225
|
+
*/
|
|
226
|
+
minify?: Minify;
|
|
227
|
+
/**
|
|
228
|
+
* Whether to generate manifest file.
|
|
229
|
+
*/
|
|
230
|
+
manifest?: string | boolean;
|
|
231
|
+
/**
|
|
232
|
+
* Whether to generate source map files, and which format of source map to generate
|
|
233
|
+
*/
|
|
234
|
+
sourceMap?: SourceMap;
|
|
235
|
+
/**
|
|
236
|
+
* Whether to add filename hash after production build.
|
|
237
|
+
*/
|
|
238
|
+
filenameHash?: boolean | string;
|
|
239
|
+
/**
|
|
240
|
+
* Whether to inline output scripts files (.js files) into HTML with `<script>` tags.
|
|
241
|
+
*/
|
|
242
|
+
inlineScripts?: boolean | InlineChunkTest;
|
|
243
|
+
/**
|
|
244
|
+
* Whether to inline output style files (.css files) into html with `<style>` tags.
|
|
245
|
+
*/
|
|
246
|
+
inlineStyles?: boolean | InlineChunkTest;
|
|
247
|
+
/**
|
|
248
|
+
* Whether to inject styles into the DOM via `style-loader`.
|
|
249
|
+
*/
|
|
250
|
+
injectStyles?: boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Specifies the range of target browsers that the project is compatible with.
|
|
253
|
+
* This value will be used by [SWC](https://github.com/swc-project/swc) and
|
|
254
|
+
* [autoprefixer](https://github.com/postcss/autoprefixer) to identify the JavaScript syntax that
|
|
255
|
+
* need to be transformed and the CSS browser prefixes that need to be added.
|
|
256
|
+
*/
|
|
257
|
+
overrideBrowserslist?: string[];
|
|
258
|
+
/**
|
|
259
|
+
* Copies the specified file or directory to the dist directory.
|
|
260
|
+
*/
|
|
261
|
+
copy?: CopyRspackPluginOptions | CopyRspackPluginOptions['patterns'];
|
|
262
|
+
/**
|
|
263
|
+
* Whether to emit static assets such as image, font, etc.
|
|
264
|
+
* Return `false` to avoid outputting unnecessary assets for some scenarios such as SSR.
|
|
265
|
+
*/
|
|
266
|
+
emitAssets?: boolean;
|
|
267
|
+
}
|
|
268
|
+
export interface NormalizedOutputConfig extends OutputConfig {
|
|
269
|
+
target: RsbuildTarget;
|
|
270
|
+
filename: FilenameConfig;
|
|
271
|
+
distPath: Omit<Required<DistPathConfig>, 'jsAsync' | 'cssAsync' | 'js'> & {
|
|
272
|
+
js?: string;
|
|
273
|
+
jsAsync?: string;
|
|
274
|
+
cssAsync?: string;
|
|
275
|
+
};
|
|
276
|
+
polyfill: Polyfill;
|
|
277
|
+
sourceMap: {
|
|
278
|
+
js?: RspackConfig['devtool'];
|
|
279
|
+
css: boolean;
|
|
280
|
+
};
|
|
281
|
+
filenameHash: boolean | string;
|
|
282
|
+
assetPrefix: string;
|
|
283
|
+
dataUriLimit: number | NormalizedDataUriLimit;
|
|
284
|
+
minify: Minify;
|
|
285
|
+
inlineScripts: boolean | InlineChunkTest;
|
|
286
|
+
inlineStyles: boolean | InlineChunkTest;
|
|
287
|
+
injectStyles: boolean;
|
|
288
|
+
cssModules: {
|
|
289
|
+
auto: CSSModules['auto'];
|
|
290
|
+
namedExport: boolean;
|
|
291
|
+
exportGlobals: boolean;
|
|
292
|
+
exportLocalsConvention: CSSModulesLocalsConvention;
|
|
293
|
+
localIdentName?: string;
|
|
294
|
+
mode?: CSSModules['mode'];
|
|
295
|
+
};
|
|
296
|
+
emitAssets: boolean;
|
|
297
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { Configuration } from '@rspack/core';
|
|
2
|
+
import type { BundleAnalyzerPlugin } from '../../../compiled/webpack-bundle-analyzer';
|
|
3
|
+
export type ConsoleType = 'log' | 'info' | 'warn' | 'error' | 'table' | 'group';
|
|
4
|
+
export type BuildCacheOptions = {
|
|
5
|
+
/** Base directory for the filesystem cache. */
|
|
6
|
+
cacheDirectory?: string;
|
|
7
|
+
cacheDigest?: Array<string | undefined>;
|
|
8
|
+
};
|
|
9
|
+
export type PrintFileSizeOptions = {
|
|
10
|
+
total?: boolean;
|
|
11
|
+
detail?: boolean;
|
|
12
|
+
compressed?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export interface PreconnectOption {
|
|
15
|
+
href: string;
|
|
16
|
+
crossorigin?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export type Preconnect = Array<string | PreconnectOption>;
|
|
19
|
+
export interface DnsPrefetchOption {
|
|
20
|
+
href: string;
|
|
21
|
+
}
|
|
22
|
+
export type DnsPrefetch = string[];
|
|
23
|
+
export type PreloadIncludeType = 'async-chunks' | 'initial' | 'all-assets' | 'all-chunks';
|
|
24
|
+
export type Filter = Array<string | RegExp> | ((filename: string) => boolean);
|
|
25
|
+
export interface PreloadOrPreFetchOption {
|
|
26
|
+
type?: PreloadIncludeType;
|
|
27
|
+
include?: Filter;
|
|
28
|
+
exclude?: Filter;
|
|
29
|
+
}
|
|
30
|
+
export interface PerformanceConfig {
|
|
31
|
+
/**
|
|
32
|
+
* Whether to remove `console.[methodName]` in production build.
|
|
33
|
+
*/
|
|
34
|
+
removeConsole?: boolean | ConsoleType[];
|
|
35
|
+
/**
|
|
36
|
+
* Whether to remove the locales of [moment.js](https://momentjs.com/).
|
|
37
|
+
*/
|
|
38
|
+
removeMomentLocale?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Controls the Rsbuild's caching behavior during the build process.
|
|
41
|
+
*/
|
|
42
|
+
buildCache?: BuildCacheOptions | boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Whether to print the file sizes after production build.
|
|
45
|
+
*/
|
|
46
|
+
printFileSize?: PrintFileSizeOptions | boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Configure the chunk splitting strategy.
|
|
49
|
+
*/
|
|
50
|
+
chunkSplit?: RsbuildChunkSplit;
|
|
51
|
+
/**
|
|
52
|
+
* Analyze the size of output files.
|
|
53
|
+
*/
|
|
54
|
+
bundleAnalyze?: BundleAnalyzerPlugin.Options;
|
|
55
|
+
/**
|
|
56
|
+
* Used to control resource `Preconnect`.
|
|
57
|
+
*
|
|
58
|
+
* Specifies that the user agent should preemptively connect to the target resource's origin.
|
|
59
|
+
*/
|
|
60
|
+
preconnect?: Preconnect;
|
|
61
|
+
/**
|
|
62
|
+
* Used to control resource `DnsPrefetch`.
|
|
63
|
+
*
|
|
64
|
+
* Specifies that the user agent should preemptively perform DNS resolution for the target resource's origin.
|
|
65
|
+
*/
|
|
66
|
+
dnsPrefetch?: DnsPrefetch;
|
|
67
|
+
/**
|
|
68
|
+
* Used to control resource `Preload`.
|
|
69
|
+
*
|
|
70
|
+
* Specifies that the user agent must preemptively fetch and cache the target resource for current navigation.
|
|
71
|
+
*/
|
|
72
|
+
preload?: true | PreloadOrPreFetchOption;
|
|
73
|
+
/**
|
|
74
|
+
* Used to control resource `Prefetch`.
|
|
75
|
+
*
|
|
76
|
+
* Specifies that the user agent should preemptively fetch and cache the target resource as it is likely to be required for a followup navigation.
|
|
77
|
+
*/
|
|
78
|
+
prefetch?: true | PreloadOrPreFetchOption;
|
|
79
|
+
/**
|
|
80
|
+
* Whether capture timing information for each module,
|
|
81
|
+
* same as the [profile](https://webpack.js.org/configuration/other-options/#profile) config of webpack.
|
|
82
|
+
*/
|
|
83
|
+
profile?: boolean;
|
|
84
|
+
}
|
|
85
|
+
export interface NormalizedPerformanceConfig extends PerformanceConfig {
|
|
86
|
+
printFileSize: PrintFileSizeOptions | boolean;
|
|
87
|
+
buildCache: BuildCacheOptions | boolean;
|
|
88
|
+
chunkSplit: RsbuildChunkSplit;
|
|
89
|
+
}
|
|
90
|
+
export type SplitChunks = Configuration extends {
|
|
91
|
+
optimization?: {
|
|
92
|
+
splitChunks?: infer P;
|
|
93
|
+
};
|
|
94
|
+
} ? P : never;
|
|
95
|
+
export type CacheGroups = Configuration extends {
|
|
96
|
+
optimization?: {
|
|
97
|
+
splitChunks?: {
|
|
98
|
+
cacheGroups?: infer P;
|
|
99
|
+
} | false;
|
|
100
|
+
};
|
|
101
|
+
} ? P : never;
|
|
102
|
+
export type CacheGroup = CacheGroups extends {
|
|
103
|
+
[key: string]: infer P;
|
|
104
|
+
} ? P : null;
|
|
105
|
+
export type ForceSplitting = RegExp[] | Record<string, RegExp>;
|
|
106
|
+
export interface BaseSplitRules {
|
|
107
|
+
strategy?: string;
|
|
108
|
+
forceSplitting?: ForceSplitting;
|
|
109
|
+
override?: SplitChunks;
|
|
110
|
+
}
|
|
111
|
+
export interface BaseChunkSplit extends BaseSplitRules {
|
|
112
|
+
strategy?: 'split-by-module' | 'split-by-experience' | 'all-in-one' | 'single-vendor';
|
|
113
|
+
}
|
|
114
|
+
export interface SplitBySize extends BaseSplitRules {
|
|
115
|
+
strategy: 'split-by-size';
|
|
116
|
+
minSize?: number;
|
|
117
|
+
maxSize?: number;
|
|
118
|
+
}
|
|
119
|
+
export interface SplitCustom extends BaseSplitRules {
|
|
120
|
+
strategy: 'custom';
|
|
121
|
+
splitChunks?: SplitChunks;
|
|
122
|
+
}
|
|
123
|
+
export type RsbuildChunkSplit = BaseChunkSplit | SplitBySize | SplitCustom;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type SriAlgorithm = 'sha256' | 'sha384' | 'sha512';
|
|
2
|
+
export type SriOptions = {
|
|
3
|
+
algorithm?: SriAlgorithm;
|
|
4
|
+
enable?: boolean | 'auto';
|
|
5
|
+
};
|
|
6
|
+
export interface SecurityConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Adding an nonce attribute to sub-resources introduced by HTML allows the browser to
|
|
9
|
+
* verify the nonce of the introduced resource, thus preventing xss.
|
|
10
|
+
*/
|
|
11
|
+
nonce?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Adding an integrity attribute (`integrity`) to sub-resources introduced by HTML allows the browser to
|
|
14
|
+
* verify the integrity of the introduced resource, thus preventing tampering with the downloaded resource.
|
|
15
|
+
*/
|
|
16
|
+
sri?: SriOptions;
|
|
17
|
+
}
|
|
18
|
+
export type NormalizedSecurityConfig = Required<SecurityConfig>;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
import type { SecureServerSessionOptions } from 'node:http2';
|
|
3
|
+
import type { ServerOptions as HttpsServerOptions } from 'node:https';
|
|
4
|
+
import type { Options as BaseProxyOptions, Filter as ProxyFilter } from '../../../compiled/http-proxy-middleware';
|
|
5
|
+
import type { Routes } from '../hooks';
|
|
6
|
+
export type HtmlFallback = false | 'index';
|
|
7
|
+
export type ProxyDetail = BaseProxyOptions & {
|
|
8
|
+
bypass?: (req: IncomingMessage, res: ServerResponse, proxyOptions: ProxyOptions) => string | undefined | null | boolean;
|
|
9
|
+
context?: ProxyFilter;
|
|
10
|
+
};
|
|
11
|
+
export type ProxyOptions = Record<string, string> | Record<string, ProxyDetail> | ProxyDetail[] | ProxyDetail;
|
|
12
|
+
export type HistoryApiFallbackContext = {
|
|
13
|
+
match: RegExpMatchArray;
|
|
14
|
+
parsedUrl: import('node:url').Url;
|
|
15
|
+
request: Request;
|
|
16
|
+
};
|
|
17
|
+
export type HistoryApiFallbackOptions = {
|
|
18
|
+
index?: string;
|
|
19
|
+
verbose?: boolean;
|
|
20
|
+
logger?: typeof console.log;
|
|
21
|
+
htmlAcceptHeaders?: string[];
|
|
22
|
+
disableDotRule?: true;
|
|
23
|
+
rewrites?: Array<{
|
|
24
|
+
from: RegExp;
|
|
25
|
+
to: string | RegExp | ((context: HistoryApiFallbackContext) => string);
|
|
26
|
+
}>;
|
|
27
|
+
};
|
|
28
|
+
export type PrintUrls = boolean | ((params: {
|
|
29
|
+
urls: string[];
|
|
30
|
+
port: number;
|
|
31
|
+
routes: Routes;
|
|
32
|
+
protocol: string;
|
|
33
|
+
}) => string[] | void);
|
|
34
|
+
export type PublicDirOptions = {
|
|
35
|
+
/**
|
|
36
|
+
* The name of the public directory, can be set as a relative path or an absolute path.
|
|
37
|
+
* @default 'public'
|
|
38
|
+
*/
|
|
39
|
+
name?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Whether to copy files from the publicDir to the distDir on production build
|
|
42
|
+
* @default true
|
|
43
|
+
*/
|
|
44
|
+
copyOnBuild?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* whether to watch the public directory and reload the page when the files change
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
watch?: boolean;
|
|
50
|
+
};
|
|
51
|
+
export type PublicDir = false | PublicDirOptions | PublicDirOptions[];
|
|
52
|
+
export interface ServerConfig {
|
|
53
|
+
/**
|
|
54
|
+
* Whether to enable gzip compression
|
|
55
|
+
*/
|
|
56
|
+
compress?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Serving static files from the directory (by default 'public' directory)
|
|
59
|
+
*/
|
|
60
|
+
publicDir?: PublicDir;
|
|
61
|
+
/**
|
|
62
|
+
* Specify a port number for Rsbuild Server to listen.
|
|
63
|
+
*/
|
|
64
|
+
port?: number;
|
|
65
|
+
/**
|
|
66
|
+
* After configuring this option, you can enable HTTPS Server, and disabling the HTTP Server.
|
|
67
|
+
*/
|
|
68
|
+
https?: HttpsServerOptions | SecureServerSessionOptions;
|
|
69
|
+
/**
|
|
70
|
+
* Used to set the host of Rsbuild Server.
|
|
71
|
+
*/
|
|
72
|
+
host?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Adds headers to all responses.
|
|
75
|
+
*/
|
|
76
|
+
headers?: Record<string, string | string[]>;
|
|
77
|
+
/**
|
|
78
|
+
* Whether to support html fallback.
|
|
79
|
+
*/
|
|
80
|
+
htmlFallback?: HtmlFallback;
|
|
81
|
+
/**
|
|
82
|
+
* Provide alternative pages for some 404 responses or other requests.
|
|
83
|
+
* see https://github.com/bripkens/connect-history-api-fallback
|
|
84
|
+
*/
|
|
85
|
+
historyApiFallback?: boolean | HistoryApiFallbackOptions;
|
|
86
|
+
/**
|
|
87
|
+
* Set the page URL to open when the server starts.
|
|
88
|
+
*/
|
|
89
|
+
open?: boolean | string | string[] | {
|
|
90
|
+
target?: string | string[];
|
|
91
|
+
before?: () => Promise<void> | void;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Configure proxy rules for the dev server or preview server to proxy requests to the specified service.
|
|
95
|
+
*/
|
|
96
|
+
proxy?: ProxyOptions;
|
|
97
|
+
/**
|
|
98
|
+
* Whether to throw an error when the port is occupied.
|
|
99
|
+
*/
|
|
100
|
+
strictPort?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Whether to print the server urls when the server is started.
|
|
103
|
+
*/
|
|
104
|
+
printUrls?: PrintUrls;
|
|
105
|
+
}
|
|
106
|
+
export type NormalizedServerConfig = ServerConfig & Required<Pick<ServerConfig, 'htmlFallback' | 'port' | 'host' | 'compress' | 'strictPort' | 'printUrls' | 'open'>>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { RuleSetCondition } from '@rspack/core';
|
|
2
|
+
import type { RsbuildEntry } from '../rsbuild';
|
|
3
|
+
import type { ConfigChain } from '../utils';
|
|
4
|
+
export type Alias = Record<string, string | false | (string | false)[]>;
|
|
5
|
+
export type Define = Record<string, any>;
|
|
6
|
+
export type AliasStrategy = 'prefer-tsconfig' | 'prefer-alias';
|
|
7
|
+
export type Decorators = {
|
|
8
|
+
/**
|
|
9
|
+
* Specify the version of decorators to use.
|
|
10
|
+
* @default 'legacy''
|
|
11
|
+
*/
|
|
12
|
+
version?: 'legacy' | '2022-03';
|
|
13
|
+
};
|
|
14
|
+
export interface SourceConfig {
|
|
15
|
+
/**
|
|
16
|
+
* Create aliases to import or require certain modules,
|
|
17
|
+
* same as the [resolve.alias](https://rspack.dev/config/resolve) config of Rspack.
|
|
18
|
+
*/
|
|
19
|
+
alias?: ConfigChain<Alias>;
|
|
20
|
+
/**
|
|
21
|
+
* Used to control the priority between the `paths` option in `tsconfig.json`
|
|
22
|
+
* and the `alias` option in the bundler.
|
|
23
|
+
*/
|
|
24
|
+
aliasStrategy?: AliasStrategy;
|
|
25
|
+
/**
|
|
26
|
+
* Specify directories or modules that need additional compilation.
|
|
27
|
+
* In order to maintain faster compilation speed, Rsbuild will not compile files under node_modules through
|
|
28
|
+
* `babel-loader` or `ts-loader` by default, as will as the files outside the current project directory.
|
|
29
|
+
*/
|
|
30
|
+
include?: RuleSetCondition[];
|
|
31
|
+
/**
|
|
32
|
+
* Set the entry modules.
|
|
33
|
+
*/
|
|
34
|
+
entry?: RsbuildEntry;
|
|
35
|
+
/**
|
|
36
|
+
* Specifies that certain files that will be excluded from compilation.
|
|
37
|
+
*/
|
|
38
|
+
exclude?: RuleSetCondition[];
|
|
39
|
+
/**
|
|
40
|
+
* Add a script before the entry file of each page.
|
|
41
|
+
* This script will be executed before the page code.
|
|
42
|
+
* It can be used to execute global logics, such as polyfill injection.
|
|
43
|
+
*/
|
|
44
|
+
preEntry?: string | string[];
|
|
45
|
+
/**
|
|
46
|
+
* Used to replaces variables in your code with other values or expressions at compile time.
|
|
47
|
+
*/
|
|
48
|
+
define?: Define;
|
|
49
|
+
/**
|
|
50
|
+
* Configuring decorators syntax.
|
|
51
|
+
*/
|
|
52
|
+
decorators?: Decorators;
|
|
53
|
+
/**
|
|
54
|
+
* Used to import the code and style of the component library on demand.
|
|
55
|
+
*/
|
|
56
|
+
transformImport?: false | TransformImport[];
|
|
57
|
+
/**
|
|
58
|
+
* Configure a custom tsconfig.json file path to use, can be a relative or absolute path.
|
|
59
|
+
* @default 'tsconfig.json'
|
|
60
|
+
*/
|
|
61
|
+
tsconfigPath?: string;
|
|
62
|
+
}
|
|
63
|
+
export type TransformImport = {
|
|
64
|
+
libraryName: string;
|
|
65
|
+
libraryDirectory?: string;
|
|
66
|
+
style?: string | boolean;
|
|
67
|
+
styleLibraryDirectory?: string;
|
|
68
|
+
camelToDashComponentName?: boolean;
|
|
69
|
+
transformToDefaultImport?: boolean;
|
|
70
|
+
customName?: any;
|
|
71
|
+
customStyleName?: any;
|
|
72
|
+
};
|
|
73
|
+
export interface NormalizedSourceConfig extends SourceConfig {
|
|
74
|
+
define: Define;
|
|
75
|
+
alias: ConfigChain<Alias>;
|
|
76
|
+
aliasStrategy: AliasStrategy;
|
|
77
|
+
preEntry: string[];
|
|
78
|
+
decorators: Required<Decorators>;
|
|
79
|
+
}
|