From 36f5cd39af0b7514cd43e6d9ae1f76ea188b11c9 Mon Sep 17 00:00:00 2001 From: fi3ework Date: Mon, 22 Apr 2024 13:22:55 +0800 Subject: [PATCH] chore(workflow): enable biome imports sorting (#2162) --- biome.json | 13 ++++- e2e/cases/asset-prefix/index.test.ts | 2 +- e2e/cases/assets-retry/index.test.ts | 4 +- e2e/cases/assets-retry/src/App.tsx | 2 +- e2e/cases/async-plugin/index.test.ts | 2 +- e2e/cases/babel/basic/index.test.ts | 2 +- e2e/cases/babel/decorator/index.test.ts | 2 +- e2e/cases/babel/preset/index.test.ts | 2 +- e2e/cases/bundler-chain/index.test.ts | 2 +- e2e/cases/cache/index.test.ts | 2 +- e2e/cases/check-syntax/index.test.ts | 2 +- e2e/cases/cli/basic/index.test.ts | 4 +- e2e/cases/cli/build-watch/index.test.ts | 6 +-- e2e/cases/cli/custom-config/index.test.ts | 4 +- e2e/cases/cli/custom-env-prefix/index.test.ts | 2 +- e2e/cases/cli/falsy-plugins/index.test.ts | 4 +- e2e/cases/cli/function-config/index.test.ts | 6 +-- e2e/cases/cli/inspect/index.test.ts | 4 +- e2e/cases/cli/load-env/index.test.ts | 2 +- e2e/cases/cli/node-env/index.test.ts | 4 +- e2e/cases/cli/public-env-vars/index.test.ts | 2 +- e2e/cases/cli/reload-config/index.test.ts | 4 +- e2e/cases/cli/reload-env/index.test.ts | 6 +-- e2e/cases/cli/vue/index.test.ts | 4 +- e2e/cases/configure-rspack/index.test.ts | 2 +- e2e/cases/configure-webpack/index.test.ts | 2 +- e2e/cases/css/css-minimize/index.test.ts | 2 +- .../css/css-modules-composes/index.test.ts | 2 +- e2e/cases/css/css-modules-dom/index.test.ts | 2 +- e2e/cases/css/css-modules-dom/src/App.tsx | 2 +- .../css/css-modules-global/index.test.ts | 2 +- .../css-modules-ts-declaration/index.test.ts | 4 +- e2e/cases/css/css-modules/index.test.ts | 2 +- e2e/cases/css/import-common-css/index.test.ts | 2 +- e2e/cases/css/import-loaders/index.test.ts | 2 +- e2e/cases/css/less-exclude/index.test.ts | 2 +- e2e/cases/css/less-import/index.test.ts | 2 +- e2e/cases/css/less-inline-js/index.test.ts | 2 +- e2e/cases/css/less-npm-import/index.test.ts | 2 +- e2e/cases/css/lightningcss/index.test.ts | 2 +- e2e/cases/css/lightningcss/src/_styl.js | 4 +- e2e/cases/css/lightningcss/src/index.js | 4 +- e2e/cases/css/multi-css/index.test.ts | 2 +- e2e/cases/css/nested-npm-import/index.test.ts | 2 +- e2e/cases/css/relative-import/index.test.ts | 2 +- e2e/cases/css/resolve-alias/index.test.ts | 2 +- .../css/resolve-url-loader/index.test.ts | 2 +- e2e/cases/css/sass-exclude/index.test.ts | 2 +- e2e/cases/css/style-loader/index.test.ts | 2 +- e2e/cases/css/style-loader/src/App.tsx | 2 +- .../css/tailwindcss-mjs/postcss.config.mjs | 2 +- e2e/cases/custom-dist-path/index.test.ts | 2 +- e2e/cases/custom-dist-path/src/index.js | 2 +- e2e/cases/decorator/2022-03/index.test.ts | 2 +- e2e/cases/decorator/basic/index.test.ts | 2 +- e2e/cases/emit-assets/index.test.ts | 2 +- e2e/cases/eslint/basic/index.test.ts | 2 +- e2e/cases/eslint/flat-config/index.test.ts | 2 +- e2e/cases/exports-presence/index.test.ts | 2 +- e2e/cases/exports-presence/src/index.js | 2 +- e2e/cases/filename-hash/index.test.ts | 2 +- e2e/cases/html-tags/basic/index.test.ts | 2 +- .../html-tags/function-usage/index.test.ts | 2 +- .../html-tags/modify-by-entry/index.test.ts | 2 +- e2e/cases/html/app-icon/index.test.ts | 2 +- e2e/cases/html/combined/html.test.ts | 2 +- e2e/cases/html/cross-origin/index.test.ts | 2 +- e2e/cases/html/favicon/index.test.ts | 2 +- e2e/cases/html/filename-hash/index.test.ts | 2 +- e2e/cases/html/html-plugin/index.test.ts | 4 +- e2e/cases/html/inject/index.test.ts | 2 +- e2e/cases/html/legal-comments/index.test.ts | 2 +- e2e/cases/html/meta/index.test.ts | 2 +- e2e/cases/html/minify/index.test.ts | 2 +- e2e/cases/html/mount-id/index.test.ts | 2 +- e2e/cases/html/output-structure/index.test.ts | 2 +- e2e/cases/html/script-loading/index.test.ts | 2 +- e2e/cases/html/template/index.test.ts | 2 +- e2e/cases/html/title/index.test.ts | 2 +- e2e/cases/ignore-css/removeCss.test.ts | 2 +- e2e/cases/image-compress/index.test.ts | 4 +- e2e/cases/image-compress/src/index.js | 2 +- e2e/cases/import-json/index.test.ts | 2 +- e2e/cases/import-toml/index.test.ts | 2 +- e2e/cases/import-yaml/index.test.ts | 2 +- e2e/cases/inline-chunk/index.test.ts | 2 +- e2e/cases/inspect-config/debug.test.ts | 4 +- e2e/cases/inspect-config/index.test.ts | 4 +- .../custom-logger/index.test.ts | 2 +- .../custom-logger/rsbuild.config.ts | 2 +- .../javascript-api/load-env/index.test.ts | 2 +- .../register-plugin/index.test.ts | 2 +- e2e/cases/legal-comments/index.test.ts | 2 +- e2e/cases/live-reload/index.test.ts | 4 +- e2e/cases/mdx/preact/index.test.ts | 2 +- e2e/cases/mdx/preact/rsbuild.config.ts | 2 +- e2e/cases/mdx/react/index.test.ts | 2 +- e2e/cases/mdx/react/rsbuild.config.ts | 2 +- e2e/cases/mdx/vue/index.test.ts | 2 +- e2e/cases/mdx/vue/rsbuild.config.ts | 2 +- e2e/cases/mjs-artifact/index.test.ts | 2 +- e2e/cases/mjs-artifact/test.mjs | 20 +++---- e2e/cases/module-federation/index.test.ts | 2 +- e2e/cases/moment/index.test.ts | 2 +- e2e/cases/multi-compiler/index.test.ts | 2 +- e2e/cases/node-addons/index.test.ts | 4 +- e2e/cases/node-polyfill-tip/index.test.ts | 2 +- e2e/cases/node-polyfill/index.test.ts | 2 +- e2e/cases/node-polyfill/rsbuild.config.ts | 2 +- e2e/cases/nonce/basic/index.test.ts | 2 +- e2e/cases/nonce/dynamic-chunk/index.test.ts | 2 +- e2e/cases/nonce/with-rem/index.test.ts | 2 +- e2e/cases/output/ascii/index.test.ts | 2 +- e2e/cases/output/assets-retry/index.test.ts | 2 +- e2e/cases/output/assets.test.ts | 2 +- .../output/clean-dist-path/index.test.ts | 2 +- e2e/cases/output/copy/index.test.ts | 2 +- .../output/externals/tests/index.test.ts | 2 +- .../performance/bundle-analyzer/index.test.ts | 2 +- .../performance/load-resource/index.test.ts | 2 +- .../performance/load-resource/src/test.ts | 2 +- e2e/cases/performance/performance.test.ts | 2 +- .../performance/print-file-size/index.test.ts | 2 +- .../performance/remove-console/index.test.ts | 2 +- .../performance/single-vendor/index.test.ts | 4 +- .../performance/split-by-module/index.test.ts | 4 +- .../plugin-after-build-hook/index.test.ts | 2 +- .../plugin-api/plugin-expose/index.test.ts | 2 +- .../plugin-api/plugin-hooks/index.test.ts | 2 +- .../plugin-modify-tags/index.test.ts | 2 +- .../plugin-api/plugin-transform/index.test.ts | 2 +- e2e/cases/polyfill/basic/index.test.ts | 2 +- e2e/cases/polyfill/browserslist/index.test.ts | 2 +- e2e/cases/preact/basic/index.test.ts | 2 +- e2e/cases/preview/index.test.ts | 2 +- e2e/cases/prod-server/index.test.ts | 2 +- e2e/cases/progress/index.test.ts | 2 +- e2e/cases/pug/basic/index.test.ts | 2 +- e2e/cases/pug/vue2-template/index.test.ts | 2 +- e2e/cases/pug/vue3-template/index.test.ts | 2 +- e2e/cases/react/basic/index.test.ts | 2 +- e2e/cases/react/enable-profiler/index.test.ts | 2 +- e2e/cases/react/legacy-jsx/index.test.ts | 2 +- e2e/cases/react/split-chunk/index.test.ts | 2 +- e2e/cases/react/split-chunk/src/index.js | 2 +- e2e/cases/rem/basic/index.test.ts | 2 +- e2e/cases/rem/basic/src/App.tsx | 2 +- e2e/cases/rem/with-viewport/index.test.ts | 2 +- e2e/cases/resolve-pkg-imports/index.test.ts | 2 +- e2e/cases/resolve-pkg-imports/src/index.js | 2 +- e2e/cases/rsdoctor/index.test.ts | 2 +- e2e/cases/server/custom-server/index.test.ts | 4 +- .../server/custom-server/scripts/index.mjs | 2 +- e2e/cases/server/dev.test.ts | 4 +- .../historyApiFallback.test.ts | 2 +- .../server/history-api-fallback/src/App.jsx | 2 +- e2e/cases/server/htmlFallback.test.ts | 4 +- e2e/cases/server/ipv6-host/index.test.ts | 2 +- e2e/cases/server/overlay/index.test.ts | 4 +- e2e/cases/server/port/index.test.ts | 2 +- e2e/cases/server/print-urls/index.test.ts | 2 +- e2e/cases/server/proxy/index.test.ts | 2 +- .../public-dir-with-template/index.test.ts | 2 +- e2e/cases/server/public-dir/publicDir.test.ts | 2 +- e2e/cases/server/writeToDisk.test.ts | 2 +- e2e/cases/solid/hmr/index.test.ts | 2 +- e2e/cases/solid/index.test.ts | 2 +- e2e/cases/solid/ref/index.test.ts | 2 +- e2e/cases/source-build/app/rsbuild.config.ts | 2 +- e2e/cases/source-build/index.test.ts | 2 +- e2e/cases/source-map/source.test.ts | 2 +- .../source/alias-by-target/index.test.ts | 2 +- .../source/custom-tsconfig/index.test.ts | 2 +- .../entry-description-object/index.test.ts | 2 +- e2e/cases/source/jsconfig-paths/index.test.ts | 2 +- e2e/cases/source/multiple-entry/index.test.ts | 2 +- e2e/cases/source/plugin-import/helper.ts | 2 +- e2e/cases/source/plugin-import/index.test.ts | 2 +- e2e/cases/source/source-exclude/index.test.ts | 2 +- e2e/cases/source/source-include/index.test.ts | 2 +- e2e/cases/source/source.test.ts | 2 +- e2e/cases/source/tsconfig-paths/index.test.ts | 2 +- e2e/cases/stats/stats-options/index.test.ts | 2 +- e2e/cases/stylus-rem/index.test.ts | 4 +- e2e/cases/stylus/index.test.ts | 2 +- e2e/cases/svelte/index.test.ts | 4 +- e2e/cases/svg/svg-assets/index.test.ts | 2 +- .../svg/svgo-minify-id-prefix/index.test.ts | 2 +- .../svg/svgo-minify-view-box/index.test.ts | 2 +- .../index.test.ts | 2 +- .../svg/svgr-default-export-url/index.test.ts | 2 +- .../svg/svgr-default-export-url/src/App.jsx | 2 +- .../svg/svgr-disable-emit-asset/index.test.ts | 2 +- .../svg/svgr-exclude-importer/index.test.ts | 2 +- .../svg/svgr-exclude-importer/src/index.jsx | 2 +- e2e/cases/svg/svgr-exclude/index.test.ts | 2 +- e2e/cases/svg/svgr-exclude/src/index.jsx | 2 +- .../svg/svgr-external-react/index.test.ts | 2 +- e2e/cases/svg/svgr-mdx/index.test.ts | 2 +- e2e/cases/svg/svgr-mdx/rsbuild.config.ts | 2 +- .../svgr-named-export-component/index.test.ts | 2 +- e2e/cases/svg/svgr-query-custom/index.test.ts | 2 +- e2e/cases/svg/svgr-query-custom/src/App.jsx | 2 +- .../index.test.ts | 2 +- e2e/cases/svg/svgr-query-react/index.test.ts | 2 +- e2e/cases/svg/svgr-query-react/src/App.jsx | 2 +- e2e/cases/svg/svgr-query-url/index.test.ts | 2 +- e2e/cases/swc-plugin/index.test.ts | 2 +- e2e/cases/top-level-await/index.test.ts | 2 +- e2e/cases/transform-lodash/index.test.ts | 2 +- e2e/cases/type-check/basic/index.test.ts | 4 +- .../exclude-node-modules/index.test.ts | 4 +- e2e/cases/typescript/index.test.ts | 2 +- e2e/cases/umd/basic/index.test.ts | 2 +- e2e/cases/umd/export-array/index.test.ts | 2 +- e2e/cases/umd/export/index.test.ts | 2 +- e2e/cases/vue/jsx-basic/index.test.ts | 2 +- e2e/cases/vue/jsx-basic/rsbuild.config.ts | 2 +- e2e/cases/vue/jsx-basic/src/A.jsx | 2 +- e2e/cases/vue/jsx-hmr/index.test.ts | 6 +-- e2e/cases/vue/jsx-hmr/rsbuild.config.ts | 2 +- e2e/cases/vue/jsx-hmr/src/index.jsx | 4 +- e2e/cases/vue/sfc-basic/index.test.ts | 2 +- e2e/cases/vue/sfc-lang-jsx/index.test.ts | 2 +- e2e/cases/vue/sfc-lang-jsx/rsbuild.config.ts | 2 +- e2e/cases/vue/sfc-lang-ts/index.test.ts | 2 +- e2e/cases/vue/sfc-lang-tsx/index.test.ts | 2 +- e2e/cases/vue/sfc-lang-tsx/rsbuild.config.ts | 2 +- e2e/cases/vue/sfc-style/index.test.ts | 2 +- e2e/cases/vue/sfc-style/src/index.js | 2 +- e2e/cases/vue/split-chunk/index.test.ts | 2 +- e2e/cases/vue2/jsx-basic/index.test.ts | 2 +- e2e/cases/vue2/jsx-basic/rsbuild.config.ts | 2 +- e2e/cases/vue2/sfc-basic/index.test.ts | 2 +- e2e/cases/vue2/sfc-lang-jsx/index.test.ts | 2 +- e2e/cases/vue2/sfc-lang-jsx/rsbuild.config.ts | 2 +- e2e/cases/vue2/sfc-lang-ts/index.test.ts | 2 +- e2e/cases/vue2/sfc-lang-tsx/index.test.ts | 2 +- e2e/cases/vue2/sfc-lang-tsx/rsbuild.config.ts | 2 +- e2e/cases/vue2/sfc-style/index.test.ts | 2 +- e2e/cases/vue2/split-chunk/index.test.ts | 2 +- e2e/cases/wasm/index.test.ts | 2 +- e2e/cases/web-worker/new-worker/index.test.ts | 2 +- .../web-worker-target/index.test.ts | 2 +- e2e/scripts/helper.ts | 2 +- e2e/scripts/shared.ts | 12 ++--- examples/lit/src/my-element.js | 2 +- examples/mdx/rsbuild.config.ts | 2 +- .../host/moduleFederation.config.ts | 2 +- .../remote/moduleFederation.config.ts | 2 +- examples/svelte/src/index.js | 2 +- examples/vue2/src/index.js | 2 +- examples/vue3/src/index.js | 2 +- package.json | 3 +- .../src/pluginLockCorejsVersion.ts | 2 +- packages/compat/babel-preset/src/web.ts | 4 +- packages/compat/plugin-swc/src/binding.ts | 2 +- packages/compat/plugin-swc/src/loader.ts | 2 +- packages/compat/plugin-swc/src/minimizer.ts | 10 ++-- packages/compat/plugin-swc/src/plugin.ts | 10 ++-- packages/compat/plugin-swc/src/utils.ts | 14 ++--- .../plugin-swc/tests/concurrent.test.ts | 2 +- .../compat/plugin-swc/tests/plugin.test.ts | 10 ++-- packages/compat/webpack/src/build.ts | 18 +++---- packages/compat/webpack/src/createCompiler.ts | 22 ++++---- packages/compat/webpack/src/initConfigs.ts | 16 +++--- packages/compat/webpack/src/inspectConfig.ts | 14 ++--- packages/compat/webpack/src/plugins/copy.ts | 2 +- packages/compat/webpack/src/plugins/css.ts | 22 ++++---- packages/compat/webpack/src/plugins/less.ts | 4 +- packages/compat/webpack/src/plugins/output.ts | 4 +- .../compat/webpack/src/plugins/progress.ts | 2 +- .../compat/webpack/src/plugins/resolve.ts | 8 +-- packages/compat/webpack/src/plugins/sass.ts | 2 +- .../webpack/src/progress/ProgressPlugin.ts | 2 +- .../webpack/src/progress/helpers/bar.ts | 2 +- .../webpack/src/progress/helpers/bus.ts | 6 +-- packages/compat/webpack/src/provider.ts | 18 +++---- packages/compat/webpack/src/shared.ts | 2 +- packages/compat/webpack/src/types.ts | 2 +- packages/compat/webpack/src/webpackConfig.ts | 24 ++++----- packages/compat/webpack/tests/css.test.ts | 2 +- packages/compat/webpack/tests/default.test.ts | 2 +- packages/compat/webpack/tests/helper.ts | 4 +- .../compat/webpack/tests/initConfigs.test.ts | 2 +- .../compat/webpack/tests/progress.test.ts | 2 +- packages/core/src/cli/commands.ts | 6 +-- packages/core/src/cli/init.ts | 2 +- packages/core/src/client/hmr/index.ts | 2 +- packages/core/src/config.ts | 50 +++++++++--------- packages/core/src/createContext.ts | 16 +++--- packages/core/src/createRsbuild.ts | 6 +-- packages/core/src/initHooks.ts | 20 +++---- packages/core/src/initPlugins.ts | 10 ++-- packages/core/src/mergeConfig.ts | 2 +- packages/core/src/pluginManager.ts | 4 +- packages/core/src/plugins/asset.ts | 10 ++-- packages/core/src/plugins/bundleAnalyzer.ts | 2 +- packages/core/src/plugins/cache.ts | 4 +- packages/core/src/plugins/cleanOutput.ts | 2 +- packages/core/src/plugins/define.ts | 2 +- packages/core/src/plugins/entry.ts | 8 +-- packages/core/src/plugins/fileSize.ts | 6 +-- packages/core/src/plugins/html.ts | 26 +++++----- packages/core/src/plugins/inlineChunk.ts | 6 +-- packages/core/src/plugins/moduleFederation.ts | 4 +- packages/core/src/plugins/resourceHints.ts | 2 +- packages/core/src/plugins/rsdoctor.ts | 2 +- packages/core/src/plugins/server.ts | 2 +- packages/core/src/plugins/splitChunks.ts | 8 +-- packages/core/src/plugins/startUrl.ts | 4 +- packages/core/src/provider/build.ts | 12 ++--- packages/core/src/provider/createCompiler.ts | 26 +++++----- .../index.ts | 6 +-- .../postcssIcssExtractPlugin.ts | 2 +- packages/core/src/provider/initConfigs.ts | 16 +++--- packages/core/src/provider/inspectConfig.ts | 16 +++--- packages/core/src/provider/plugins/css.ts | 28 +++++----- packages/core/src/provider/plugins/less.ts | 2 +- packages/core/src/provider/plugins/output.ts | 2 +- packages/core/src/provider/plugins/resolve.ts | 2 +- .../src/provider/plugins/rspackProfile.ts | 4 +- packages/core/src/provider/plugins/sass.ts | 4 +- packages/core/src/provider/plugins/swc.ts | 24 ++++----- packages/core/src/provider/provider.ts | 6 +-- packages/core/src/provider/rspackConfig.ts | 18 +++---- packages/core/src/provider/shared.ts | 10 ++-- packages/core/src/rspack/HtmlAppIconPlugin.ts | 6 +-- packages/core/src/rspack/HtmlBasicPlugin.ts | 16 +++--- .../core/src/rspack/InlineChunkHtmlPlugin.ts | 6 +-- .../src/rspack/RemoveCssSourcemapPlugin.ts | 2 +- .../preload/HtmlPreloadOrPrefetchPlugin.ts | 18 +++---- .../preload/helpers/determineAsValue.ts | 4 +- .../preload/helpers/doesChunkBelongToHtml.ts | 4 +- .../rspack/preload/helpers/extractChunks.ts | 2 +- packages/core/src/rspack/transformLoader.ts | 2 +- .../core/src/server/compilerDevMiddleware.ts | 4 +- packages/core/src/server/devMiddleware.ts | 6 +-- packages/core/src/server/devServer.ts | 26 +++++----- packages/core/src/server/getDevMiddlewares.ts | 10 ++-- packages/core/src/server/helper.ts | 14 ++--- packages/core/src/server/middlewares.ts | 12 ++--- packages/core/src/server/prodServer.ts | 22 ++++---- packages/core/src/server/proxy.ts | 12 ++--- packages/core/src/server/socketServer.ts | 2 +- packages/core/src/types.ts | 6 +-- packages/core/tests/asset.test.ts | 2 +- packages/core/tests/createCompiler.test.ts | 2 +- packages/core/tests/default.test.ts | 2 +- packages/core/tests/hooks.test.ts | 2 +- packages/core/tests/html.test.ts | 6 +-- packages/core/tests/htmlHelper.test.ts | 4 +- packages/core/tests/inlineChunk.test.ts | 2 +- packages/core/tests/mergeConfig.test.ts | 2 +- packages/core/tests/minimize.test.ts | 4 +- packages/core/tests/pluginStore.test.ts | 2 +- packages/core/tests/resolve.test.ts | 2 +- packages/core/tests/rspackVersion.test.ts | 2 +- packages/core/tests/server.test.ts | 4 +- packages/core/tests/splitChunks.test.ts | 2 +- packages/core/tests/swc.test.ts | 2 +- packages/core/tests/target.test.ts | 4 +- packages/create-rsbuild/src/index.ts | 2 +- .../template-svelte-js/src/index.js | 2 +- .../template-svelte-ts/src/index.ts | 2 +- .../template-vue2-js/src/index.js | 2 +- .../template-vue2-ts/src/index.ts | 2 +- .../template-vue3-js/src/index.js | 2 +- .../template-vue3-ts/src/index.ts | 2 +- .../monorepo-utils/src/common/getBaseData.ts | 2 +- packages/monorepo-utils/src/common/pnpm.ts | 4 +- .../src/project-utils/getDependentProjects.ts | 2 +- .../monorepo-utils/src/project/project.ts | 4 +- packages/monorepo-utils/src/types/index.ts | 2 +- .../src/AssetsRetryPlugin.ts | 4 +- packages/plugin-assets-retry/src/index.ts | 2 +- .../plugin-assets-retry/src/runtime/index.ts | 2 +- .../tests/assetsRetry.test.ts | 2 +- packages/plugin-babel/src/helper.ts | 14 ++--- packages/plugin-babel/src/plugin.ts | 12 ++--- packages/plugin-babel/src/types.ts | 2 +- packages/plugin-babel/tests/index.test.ts | 6 +-- .../src/CheckSyntaxPlugin.ts | 24 ++++----- .../src/helpers/generateError.ts | 6 +-- packages/plugin-check-syntax/src/index.ts | 6 +-- .../tests/CheckSyntaxPlugin.test.ts | 2 +- packages/plugin-css-minimizer/src/index.ts | 4 +- packages/plugin-image-compress/src/index.ts | 2 +- .../src/shared/codecs.ts | 2 +- packages/plugin-lightningcss/src/loader.ts | 2 +- packages/plugin-lightningcss/src/minimizer.ts | 6 +-- packages/plugin-lightningcss/src/plugin.ts | 10 ++-- .../plugin-lightningcss/tests/index.test.ts | 8 +-- packages/plugin-mdx/src/index.ts | 2 +- packages/plugin-mdx/tests/index.test.ts | 2 +- packages/plugin-preact/src/index.ts | 2 +- packages/plugin-preact/tests/index.test.ts | 4 +- packages/plugin-pug/src/index.ts | 2 +- packages/plugin-react/src/index.ts | 4 +- packages/plugin-react/src/react.ts | 6 +-- packages/plugin-react/src/splitChunks.ts | 6 +-- packages/plugin-react/tests/features.test.ts | 6 +-- packages/plugin-react/tests/index.test.ts | 4 +- .../src/AutoSetRootFontSizePlugin.ts | 8 +-- packages/plugin-rem/src/index.ts | 2 +- .../tests/AutoSetRootFontSizePlugin.test.ts | 4 +- packages/plugin-rem/tests/index.test.ts | 2 +- packages/plugin-solid/src/index.ts | 2 +- packages/plugin-solid/tests/index.test.ts | 4 +- packages/plugin-source-build/src/index.ts | 6 +-- .../plugin-source-build/tests/index.test.ts | 2 +- .../plugin-styled-components/src/index.ts | 4 +- .../tests/index.test.ts | 4 +- packages/plugin-svelte/src/index.ts | 4 +- packages/plugin-svgr/src/index.ts | 6 +-- packages/plugin-svgr/src/loader.ts | 8 +-- packages/plugin-svgr/tests/index.test.ts | 6 +-- packages/plugin-type-check/src/index.ts | 8 +-- packages/plugin-umd/src/index.ts | 2 +- packages/plugin-vue-jsx/src/index.ts | 2 +- packages/plugin-vue-jsx/tests/index.test.ts | 4 +- packages/plugin-vue/src/index.ts | 2 +- packages/plugin-vue/src/splitChunks.ts | 4 +- packages/plugin-vue2-jsx/tests/index.test.ts | 4 +- packages/plugin-vue2/src/index.ts | 4 +- packages/plugin-vue2/src/splitChunks.ts | 4 +- packages/shared/src/chain.ts | 36 ++++++------- packages/shared/src/config.ts | 12 ++--- packages/shared/src/css.ts | 8 +-- packages/shared/src/fs.ts | 4 +- packages/shared/src/getBrowserslist.ts | 4 +- packages/shared/src/getLoaderOptions.ts | 8 +-- .../src/loaders/cssModulesTypescriptLoader.ts | 4 +- packages/shared/src/logger.ts | 2 +- packages/shared/src/mergeChainedOptions.ts | 4 +- packages/shared/src/minimize.ts | 8 +-- packages/shared/src/types/config/dev.ts | 2 +- packages/shared/src/types/config/html.ts | 2 +- packages/shared/src/types/config/index.ts | 18 +++---- packages/shared/src/types/config/output.ts | 4 +- packages/shared/src/types/config/source.ts | 4 +- packages/shared/src/types/config/tools.ts | 48 ++++++++--------- packages/shared/src/types/hooks.ts | 8 +-- packages/shared/src/types/plugin.ts | 52 +++++++++---------- packages/shared/src/types/provider.ts | 10 ++-- packages/shared/src/types/rsbuild.ts | 6 +-- packages/shared/src/types/server.ts | 4 +- packages/shared/src/types/stats.ts | 2 +- packages/shared/src/types/thirdParty.ts | 20 +++---- packages/shared/src/url.ts | 4 +- packages/shared/src/utils.ts | 24 ++++----- packages/shared/tests/config.test.ts | 2 +- packages/shared/tests/css.test.ts | 6 +-- .../shared/tests/mergeChainedOptions.test.ts | 2 +- packages/shared/tests/url.test.ts | 2 +- scripts/check-changeset/src/index.ts | 2 +- scripts/modern.base.config.ts | 2 +- scripts/prebundle/src/constant.ts | 2 +- scripts/prebundle/src/helper.ts | 2 +- scripts/prebundle/src/prebundle.ts | 2 +- scripts/test-helper/src/index.ts | 2 +- scripts/test-helper/src/path.ts | 4 +- scripts/test-helper/src/pathSerializer.ts | 2 +- scripts/test-helper/src/rsbuild.ts | 10 ++-- scripts/test-helper/vitest.setup.ts | 2 +- vitest.workspace.ts | 2 +- website/components/Overview.tsx | 2 +- website/components/Step.tsx | 2 +- website/components/utils.ts | 2 +- website/rspress.config.ts | 8 +-- website/theme/index.tsx | 2 +- website/theme/rsbuildPluginOverview.ts | 2 +- 472 files changed, 1055 insertions(+), 1043 deletions(-) diff --git a/biome.json b/biome.json index 771d8c7955..8b65e20ba9 100644 --- a/biome.json +++ b/biome.json @@ -1,7 +1,15 @@ { "$schema": "https://biomejs.dev/schemas/1.6.0/schema.json", "organizeImports": { - "enabled": true + "enabled": true, + "include": [ + "./**/*.js", + "./**/*.jsx", + "./**/*.ts", + "./**/*.tsx", + "./**/*.mjs", + "./**/*.cjs" + ] }, "vcs": { "enabled": true, @@ -18,6 +26,9 @@ ], "ignoreUnknown": true }, + "formatter": { + "enabled": false + }, "linter": { "enabled": true, "rules": { diff --git a/e2e/cases/asset-prefix/index.test.ts b/e2e/cases/asset-prefix/index.test.ts index ba20cd36e0..1f7a7b38d2 100644 --- a/e2e/cases/asset-prefix/index.test.ts +++ b/e2e/cases/asset-prefix/index.test.ts @@ -1,5 +1,5 @@ +import { build, dev, gotoPage } from '@e2e/helper'; import { expect, test } from '@playwright/test'; -import { dev, build, gotoPage } from '@e2e/helper'; test('should allow dev.assetPrefix to be `auto`', async ({ page }) => { const rsbuild = await dev({ diff --git a/e2e/cases/assets-retry/index.test.ts b/e2e/cases/assets-retry/index.test.ts index 20682a9147..5431c275d8 100644 --- a/e2e/cases/assets-retry/index.test.ts +++ b/e2e/cases/assets-retry/index.test.ts @@ -1,8 +1,8 @@ -import { expect, test } from '@playwright/test'; import { dev, gotoPage, proxyConsole } from '@e2e/helper'; -import { pluginReact } from '@rsbuild/plugin-react'; +import { expect, test } from '@playwright/test'; import { pluginAssetsRetry } from '@rsbuild/plugin-assets-retry'; import type { PluginAssetsRetryOptions } from '@rsbuild/plugin-assets-retry'; +import { pluginReact } from '@rsbuild/plugin-react'; import type { RequestHandler } from '@rsbuild/shared'; function count404Response(logs: string[], urlPrefix: string): number { diff --git a/e2e/cases/assets-retry/src/App.tsx b/e2e/cases/assets-retry/src/App.tsx index 17ed296791..1ef5a2c0fd 100644 --- a/e2e/cases/assets-retry/src/App.tsx +++ b/e2e/cases/assets-retry/src/App.tsx @@ -1,7 +1,7 @@ import React from 'react'; import './App.css'; -import { ErrorBoundary } from './ErrorBoundary'; import CompTest from './CompTest'; +import { ErrorBoundary } from './ErrorBoundary'; const AsyncCompTest = React.lazy(() => import('./AsyncCompTest')); diff --git a/e2e/cases/async-plugin/index.test.ts b/e2e/cases/async-plugin/index.test.ts index 5797d9abb5..176ff89a0f 100644 --- a/e2e/cases/async-plugin/index.test.ts +++ b/e2e/cases/async-plugin/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; import type { RsbuildPlugin } from '@rsbuild/core'; const asyncPlugin = async (): Promise => { diff --git a/e2e/cases/babel/basic/index.test.ts b/e2e/cases/babel/basic/index.test.ts index 5048acc3f2..4d7e7408b0 100644 --- a/e2e/cases/babel/basic/index.test.ts +++ b/e2e/cases/babel/basic/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; import { pluginBabel } from '@rsbuild/plugin-babel'; rspackOnlyTest( diff --git a/e2e/cases/babel/decorator/index.test.ts b/e2e/cases/babel/decorator/index.test.ts index dd85d131ae..559c071704 100644 --- a/e2e/cases/babel/decorator/index.test.ts +++ b/e2e/cases/babel/decorator/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; import { pluginBabel } from '@rsbuild/plugin-babel'; rspackOnlyTest( diff --git a/e2e/cases/babel/preset/index.test.ts b/e2e/cases/babel/preset/index.test.ts index 18e056f7fb..8d1edb7ad1 100644 --- a/e2e/cases/babel/preset/index.test.ts +++ b/e2e/cases/babel/preset/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest( 'should run babel with @rsbuild/babel-preset correctly', diff --git a/e2e/cases/bundler-chain/index.test.ts b/e2e/cases/bundler-chain/index.test.ts index de0c6ae77b..7b8a7a835f 100644 --- a/e2e/cases/bundler-chain/index.test.ts +++ b/e2e/cases/bundler-chain/index.test.ts @@ -1,6 +1,6 @@ import { join } from 'node:path'; -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should allow to use tools.bundlerChain to set alias config', async ({ page, diff --git a/e2e/cases/cache/index.test.ts b/e2e/cases/cache/index.test.ts index 09e408e632..604cf36c90 100644 --- a/e2e/cases/cache/index.test.ts +++ b/e2e/cases/cache/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { expect } from '@playwright/test'; import { build, webpackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; import { fse } from '@rsbuild/shared'; webpackOnlyTest( diff --git a/e2e/cases/check-syntax/index.test.ts b/e2e/cases/check-syntax/index.test.ts index 5909c4bbdc..8323c9ed00 100644 --- a/e2e/cases/check-syntax/index.test.ts +++ b/e2e/cases/check-syntax/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { expect, test } from '@playwright/test'; import { build, proxyConsole } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginCheckSyntax } from '@rsbuild/plugin-check-syntax'; import type { RsbuildConfig } from '@rsbuild/shared'; import { normalizeToPosixPath } from '@scripts/test-helper'; diff --git a/e2e/cases/cli/basic/index.test.ts b/e2e/cases/cli/basic/index.test.ts index 59f3bb4d89..0f68ec20c0 100644 --- a/e2e/cases/cli/basic/index.test.ts +++ b/e2e/cases/cli/basic/index.test.ts @@ -1,7 +1,7 @@ -import path from 'node:path'; import { execSync } from 'node:child_process'; -import { expect, test } from '@playwright/test'; +import path from 'node:path'; import { globContentJSON } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should run build command correctly', async () => { execSync('npx rsbuild build', { diff --git a/e2e/cases/cli/build-watch/index.test.ts b/e2e/cases/cli/build-watch/index.test.ts index 2c5bbdc61d..90ba89f518 100644 --- a/e2e/cases/cli/build-watch/index.test.ts +++ b/e2e/cases/cli/build-watch/index.test.ts @@ -1,8 +1,8 @@ -import path from 'node:path'; import { exec } from 'node:child_process'; -import { test, expect } from '@playwright/test'; -import { fse } from '@rsbuild/shared'; +import path from 'node:path'; import { awaitFileExists } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; +import { fse } from '@rsbuild/shared'; test('should support watch mode for build command', async () => { const indexFile = path.join(__dirname, 'src/index.js'); diff --git a/e2e/cases/cli/custom-config/index.test.ts b/e2e/cases/cli/custom-config/index.test.ts index 76462d794f..a24f7bc49d 100644 --- a/e2e/cases/cli/custom-config/index.test.ts +++ b/e2e/cases/cli/custom-config/index.test.ts @@ -1,7 +1,7 @@ -import path from 'node:path'; import { execSync } from 'node:child_process'; -import { expect, test } from '@playwright/test'; +import path from 'node:path'; import { globContentJSON } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should use custom config when using --config option', async () => { execSync('npx rsbuild build --config ./custom.config.mjs', { diff --git a/e2e/cases/cli/custom-env-prefix/index.test.ts b/e2e/cases/cli/custom-env-prefix/index.test.ts index f8ed27727e..aafd856393 100644 --- a/e2e/cases/cli/custom-env-prefix/index.test.ts +++ b/e2e/cases/cli/custom-env-prefix/index.test.ts @@ -1,7 +1,7 @@ +import { execSync } from 'node:child_process'; import path from 'node:path'; import { expect, test } from '@playwright/test'; import { fse } from '@rsbuild/shared'; -import { execSync } from 'node:child_process'; test('should allow to custom env prefix via loadEnv method', async () => { execSync('npx rsbuild build', { diff --git a/e2e/cases/cli/falsy-plugins/index.test.ts b/e2e/cases/cli/falsy-plugins/index.test.ts index 59f3bb4d89..0f68ec20c0 100644 --- a/e2e/cases/cli/falsy-plugins/index.test.ts +++ b/e2e/cases/cli/falsy-plugins/index.test.ts @@ -1,7 +1,7 @@ -import path from 'node:path'; import { execSync } from 'node:child_process'; -import { expect, test } from '@playwright/test'; +import path from 'node:path'; import { globContentJSON } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should run build command correctly', async () => { execSync('npx rsbuild build', { diff --git a/e2e/cases/cli/function-config/index.test.ts b/e2e/cases/cli/function-config/index.test.ts index 6f995fbc0e..cf2d0d4ea5 100644 --- a/e2e/cases/cli/function-config/index.test.ts +++ b/e2e/cases/cli/function-config/index.test.ts @@ -1,8 +1,8 @@ -import { fse } from '@rsbuild/shared'; -import path from 'node:path'; import { execSync } from 'node:child_process'; -import { expect, test } from '@playwright/test'; +import path from 'node:path'; import { globContentJSON } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; +import { fse } from '@rsbuild/shared'; test('should allow to export function in config file', async () => { const targetDir = path.join(__dirname, 'dist-production-build'); diff --git a/e2e/cases/cli/inspect/index.test.ts b/e2e/cases/cli/inspect/index.test.ts index 3b376f475b..ec963e946f 100644 --- a/e2e/cases/cli/inspect/index.test.ts +++ b/e2e/cases/cli/inspect/index.test.ts @@ -1,7 +1,7 @@ -import path from 'node:path'; import { execSync } from 'node:child_process'; -import { expect, test } from '@playwright/test'; +import path from 'node:path'; import { globContentJSON } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should run inspect command correctly', async () => { delete process.env.NODE_ENV; diff --git a/e2e/cases/cli/load-env/index.test.ts b/e2e/cases/cli/load-env/index.test.ts index 685d9e3198..b67912f066 100644 --- a/e2e/cases/cli/load-env/index.test.ts +++ b/e2e/cases/cli/load-env/index.test.ts @@ -1,7 +1,7 @@ +import { execSync } from 'node:child_process'; import path from 'node:path'; import { expect, test } from '@playwright/test'; import { fse } from '@rsbuild/shared'; -import { execSync } from 'node:child_process'; const localFile = path.join(__dirname, '.env.local'); const prodLocalFile = path.join(__dirname, '.env.production.local'); diff --git a/e2e/cases/cli/node-env/index.test.ts b/e2e/cases/cli/node-env/index.test.ts index c5cf6a459c..889f83d153 100644 --- a/e2e/cases/cli/node-env/index.test.ts +++ b/e2e/cases/cli/node-env/index.test.ts @@ -1,7 +1,7 @@ -import path from 'node:path'; import { execSync } from 'node:child_process'; -import { expect, test } from '@playwright/test'; +import path from 'node:path'; import { globContentJSON } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should set NODE_ENV correctly when running build command', async () => { delete process.env.NODE_ENV; diff --git a/e2e/cases/cli/public-env-vars/index.test.ts b/e2e/cases/cli/public-env-vars/index.test.ts index e4b8d4c4bc..3e08cc4e73 100644 --- a/e2e/cases/cli/public-env-vars/index.test.ts +++ b/e2e/cases/cli/public-env-vars/index.test.ts @@ -1,7 +1,7 @@ +import { execSync } from 'node:child_process'; import path from 'node:path'; import { expect, test } from '@playwright/test'; import { fse } from '@rsbuild/shared'; -import { execSync } from 'node:child_process'; test('should inject public env vars to client', async () => { execSync('npx rsbuild build', { diff --git a/e2e/cases/cli/reload-config/index.test.ts b/e2e/cases/cli/reload-config/index.test.ts index cff2f696dd..af4ce6375c 100644 --- a/e2e/cases/cli/reload-config/index.test.ts +++ b/e2e/cases/cli/reload-config/index.test.ts @@ -1,8 +1,8 @@ -import path from 'node:path'; import { exec } from 'node:child_process'; +import path from 'node:path'; +import { awaitFileExists, getRandomPort } from '@e2e/helper'; import { test } from '@playwright/test'; import { fse } from '@rsbuild/shared'; -import { getRandomPort, awaitFileExists } from '@e2e/helper'; test('should restart dev server and reload config when config file changed', async () => { const dist1 = path.join(__dirname, 'dist'); diff --git a/e2e/cases/cli/reload-env/index.test.ts b/e2e/cases/cli/reload-env/index.test.ts index 4c6cce0160..14326c33cc 100644 --- a/e2e/cases/cli/reload-env/index.test.ts +++ b/e2e/cases/cli/reload-env/index.test.ts @@ -1,8 +1,8 @@ -import path from 'node:path'; import { exec } from 'node:child_process'; -import { test, expect } from '@playwright/test'; +import path from 'node:path'; +import { awaitFileExists, getRandomPort } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { fse } from '@rsbuild/shared'; -import { getRandomPort, awaitFileExists } from '@e2e/helper'; // Skipped as it occasionally failed in CI test.skip('should restart dev server when .env file is changed', async () => { diff --git a/e2e/cases/cli/vue/index.test.ts b/e2e/cases/cli/vue/index.test.ts index 29096a6528..1cd09a7ca0 100644 --- a/e2e/cases/cli/vue/index.test.ts +++ b/e2e/cases/cli/vue/index.test.ts @@ -1,7 +1,7 @@ -import path from 'node:path'; import { execSync } from 'node:child_process'; +import path from 'node:path'; +import { globContentJSON, rspackOnlyTest } from '@e2e/helper'; import { expect } from '@playwright/test'; -import { rspackOnlyTest, globContentJSON } from '@e2e/helper'; rspackOnlyTest('should build Vue sfc correctly', async () => { execSync('npx rsbuild build', { diff --git a/e2e/cases/configure-rspack/index.test.ts b/e2e/cases/configure-rspack/index.test.ts index fa241e0e13..fc9e3c0b98 100644 --- a/e2e/cases/configure-rspack/index.test.ts +++ b/e2e/cases/configure-rspack/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest( 'should allow to use tools.rspack to configure Rspack', diff --git a/e2e/cases/configure-webpack/index.test.ts b/e2e/cases/configure-webpack/index.test.ts index acd0c27514..c9a84c0b23 100644 --- a/e2e/cases/configure-webpack/index.test.ts +++ b/e2e/cases/configure-webpack/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, webpackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; webpackOnlyTest( 'should allow to use tools.webpackChain to configure Webpack', diff --git a/e2e/cases/css/css-minimize/index.test.ts b/e2e/cases/css/css-minimize/index.test.ts index 26609c699c..46b49d911d 100644 --- a/e2e/cases/css/css-minimize/index.test.ts +++ b/e2e/cases/css/css-minimize/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; import { pluginCssMinimizer } from '@rsbuild/plugin-css-minimizer'; rspackOnlyTest('should minimize CSS correctly by default', async () => { diff --git a/e2e/cases/css/css-modules-composes/index.test.ts b/e2e/cases/css/css-modules-composes/index.test.ts index 00bfad24dd..90d75a7756 100644 --- a/e2e/cases/css/css-modules-composes/index.test.ts +++ b/e2e/cases/css/css-modules-composes/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should compile CSS modules composes correctly', async () => { const rsbuild = await build({ diff --git a/e2e/cases/css/css-modules-dom/index.test.ts b/e2e/cases/css/css-modules-dom/index.test.ts index 14a35d50f7..efac8feb42 100644 --- a/e2e/cases/css/css-modules-dom/index.test.ts +++ b/e2e/cases/css/css-modules-dom/index.test.ts @@ -1,8 +1,8 @@ import { join, resolve } from 'node:path'; -import { fse } from '@rsbuild/shared'; import { build, gotoPage } from '@e2e/helper'; import { expect, test } from '@playwright/test'; import { pluginReact } from '@rsbuild/plugin-react'; +import { fse } from '@rsbuild/shared'; const fixtures = resolve(__dirname); diff --git a/e2e/cases/css/css-modules-dom/src/App.tsx b/e2e/cases/css/css-modules-dom/src/App.tsx index 68ebe031ae..da3be4f9b2 100644 --- a/e2e/cases/css/css-modules-dom/src/App.tsx +++ b/e2e/cases/css/css-modules-dom/src/App.tsx @@ -1,6 +1,6 @@ import './App.css'; -import stylesForSass from './App.module.scss'; import stylesForLess from './App.module.less'; +import stylesForSass from './App.module.scss'; const App = () => (
diff --git a/e2e/cases/css/css-modules-global/index.test.ts b/e2e/cases/css/css-modules-global/index.test.ts index d0d693342b..ef3fc63f09 100644 --- a/e2e/cases/css/css-modules-global/index.test.ts +++ b/e2e/cases/css/css-modules-global/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should compile CSS modules with :global() correctly', async () => { const rsbuild = await build({ diff --git a/e2e/cases/css/css-modules-ts-declaration/index.test.ts b/e2e/cases/css/css-modules-ts-declaration/index.test.ts index 9d16f6a39f..ed4dbfb249 100644 --- a/e2e/cases/css/css-modules-ts-declaration/index.test.ts +++ b/e2e/cases/css/css-modules-ts-declaration/index.test.ts @@ -1,7 +1,7 @@ import { join, resolve } from 'node:path'; -import { fse } from '@rsbuild/shared'; -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; +import { fse } from '@rsbuild/shared'; const fixtures = __dirname; diff --git a/e2e/cases/css/css-modules/index.test.ts b/e2e/cases/css/css-modules/index.test.ts index 511dada954..f6a75f4c56 100644 --- a/e2e/cases/css/css-modules/index.test.ts +++ b/e2e/cases/css/css-modules/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should compile CSS modules correctly', async () => { const rsbuild = await build({ diff --git a/e2e/cases/css/import-common-css/index.test.ts b/e2e/cases/css/import-common-css/index.test.ts index 9d1e10e05d..5b929574d9 100644 --- a/e2e/cases/css/import-common-css/index.test.ts +++ b/e2e/cases/css/import-common-css/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, proxyConsole } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should compile common css import correctly', async () => { const { restore, logs } = proxyConsole(); diff --git a/e2e/cases/css/import-loaders/index.test.ts b/e2e/cases/css/import-loaders/index.test.ts index f69bd7503f..3747b53c19 100644 --- a/e2e/cases/css/import-loaders/index.test.ts +++ b/e2e/cases/css/import-loaders/index.test.ts @@ -1,6 +1,6 @@ -import { expect } from '@playwright/test'; import { build } from '@e2e/helper'; import { webpackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; webpackOnlyTest( 'should compile CSS modules which depends on importLoaders correctly', diff --git a/e2e/cases/css/less-exclude/index.test.ts b/e2e/cases/css/less-exclude/index.test.ts index ea5594526b..49d4464b0e 100644 --- a/e2e/cases/css/less-exclude/index.test.ts +++ b/e2e/cases/css/less-exclude/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should exclude specified less file', async () => { const rsbuild = await build({ diff --git a/e2e/cases/css/less-import/index.test.ts b/e2e/cases/css/less-import/index.test.ts index 02dc9d620c..18dbe0ec44 100644 --- a/e2e/cases/css/less-import/index.test.ts +++ b/e2e/cases/css/less-import/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should compile less import correctly', async () => { const rsbuild = await build({ diff --git a/e2e/cases/css/less-inline-js/index.test.ts b/e2e/cases/css/less-inline-js/index.test.ts index 0bcd878b7d..688355a4df 100644 --- a/e2e/cases/css/less-inline-js/index.test.ts +++ b/e2e/cases/css/less-inline-js/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should compile less inline js correctly', async () => { const rsbuild = await build({ diff --git a/e2e/cases/css/less-npm-import/index.test.ts b/e2e/cases/css/less-npm-import/index.test.ts index a8b11c1d6c..b0c176bfdb 100644 --- a/e2e/cases/css/less-npm-import/index.test.ts +++ b/e2e/cases/css/less-npm-import/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { fse } from '@rsbuild/shared'; test('should compile less npm import correctly', async () => { diff --git a/e2e/cases/css/lightningcss/index.test.ts b/e2e/cases/css/lightningcss/index.test.ts index f08bb5cf7c..0625e104f8 100644 --- a/e2e/cases/css/lightningcss/index.test.ts +++ b/e2e/cases/css/lightningcss/index.test.ts @@ -1,5 +1,5 @@ -import { test, type Page, expect } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { type Page, expect, test } from '@playwright/test'; import { pluginLightningcss } from '@rsbuild/plugin-lightningcss'; import { pluginStylus } from '@rsbuild/plugin-stylus'; import { pluginSwc } from '@rsbuild/plugin-swc'; diff --git a/e2e/cases/css/lightningcss/src/_styl.js b/e2e/cases/css/lightningcss/src/_styl.js index 35f52ba4f3..f5c0e2617c 100644 --- a/e2e/cases/css/lightningcss/src/_styl.js +++ b/e2e/cases/css/lightningcss/src/_styl.js @@ -1,8 +1,8 @@ -import './minify.css'; -import './transform.css'; import a from './a.module.less'; import b from './b.module.scss'; import c from './c.module.styl'; +import './minify.css'; +import './transform.css'; const lessDom = document.getElementById('test-less'); lessDom.innerHTML = JSON.stringify(a); diff --git a/e2e/cases/css/lightningcss/src/index.js b/e2e/cases/css/lightningcss/src/index.js index 7a1835ba3e..3f9467a617 100644 --- a/e2e/cases/css/lightningcss/src/index.js +++ b/e2e/cases/css/lightningcss/src/index.js @@ -1,7 +1,7 @@ -import './minify.css'; -import './transform.css'; import a from './a.module.less'; import b from './b.module.scss'; +import './minify.css'; +import './transform.css'; const lessDom = document.getElementById('test-less'); lessDom.innerHTML = JSON.stringify(a); diff --git a/e2e/cases/css/multi-css/index.test.ts b/e2e/cases/css/multi-css/index.test.ts index 6a7f535e7a..2ea1069895 100644 --- a/e2e/cases/css/multi-css/index.test.ts +++ b/e2e/cases/css/multi-css/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should emit multiple css files correctly', async () => { const rsbuild = await build({ diff --git a/e2e/cases/css/nested-npm-import/index.test.ts b/e2e/cases/css/nested-npm-import/index.test.ts index 60693243d8..9da335af21 100644 --- a/e2e/cases/css/nested-npm-import/index.test.ts +++ b/e2e/cases/css/nested-npm-import/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { expect, test } from '@playwright/test'; import { build, proxyConsole } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { fse } from '@rsbuild/shared'; test('should compile nested npm import correctly', async () => { diff --git a/e2e/cases/css/relative-import/index.test.ts b/e2e/cases/css/relative-import/index.test.ts index 3a76bacbc9..82915f0c9d 100644 --- a/e2e/cases/css/relative-import/index.test.ts +++ b/e2e/cases/css/relative-import/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should compile CSS relative imports correctly', async () => { const rsbuild = await build({ diff --git a/e2e/cases/css/resolve-alias/index.test.ts b/e2e/cases/css/resolve-alias/index.test.ts index e29b059c37..d24c332460 100644 --- a/e2e/cases/css/resolve-alias/index.test.ts +++ b/e2e/cases/css/resolve-alias/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should compile CSS with alias correctly', async () => { const rsbuild = await build({ diff --git a/e2e/cases/css/resolve-url-loader/index.test.ts b/e2e/cases/css/resolve-url-loader/index.test.ts index 19c83fddc2..39c77f685b 100644 --- a/e2e/cases/css/resolve-url-loader/index.test.ts +++ b/e2e/cases/css/resolve-url-loader/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should resolve relative asset correctly in SCSS file', async () => { const rsbuild = await build({ diff --git a/e2e/cases/css/sass-exclude/index.test.ts b/e2e/cases/css/sass-exclude/index.test.ts index 8a299637f1..29f875a333 100644 --- a/e2e/cases/css/sass-exclude/index.test.ts +++ b/e2e/cases/css/sass-exclude/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should exclude specified scss file', async () => { const rsbuild = await build({ diff --git a/e2e/cases/css/style-loader/index.test.ts b/e2e/cases/css/style-loader/index.test.ts index 68390caa79..930472a19f 100644 --- a/e2e/cases/css/style-loader/index.test.ts +++ b/e2e/cases/css/style-loader/index.test.ts @@ -1,7 +1,7 @@ +import { join } from 'node:path'; import { build, dev, gotoPage, rspackOnlyTest } from '@e2e/helper'; import { expect, test } from '@playwright/test'; import { fse } from '@rsbuild/shared'; -import { join } from 'node:path'; const fixtures = __dirname; diff --git a/e2e/cases/css/style-loader/src/App.tsx b/e2e/cases/css/style-loader/src/App.tsx index 68ebe031ae..da3be4f9b2 100644 --- a/e2e/cases/css/style-loader/src/App.tsx +++ b/e2e/cases/css/style-loader/src/App.tsx @@ -1,6 +1,6 @@ import './App.css'; -import stylesForSass from './App.module.scss'; import stylesForLess from './App.module.less'; +import stylesForSass from './App.module.scss'; const App = () => (
diff --git a/e2e/cases/css/tailwindcss-mjs/postcss.config.mjs b/e2e/cases/css/tailwindcss-mjs/postcss.config.mjs index 11b7c07860..b16c2ead72 100644 --- a/e2e/cases/css/tailwindcss-mjs/postcss.config.mjs +++ b/e2e/cases/css/tailwindcss-mjs/postcss.config.mjs @@ -1,5 +1,5 @@ +import { dirname, join } from 'node:path'; import { fileURLToPath } from 'node:url'; -import { join, dirname } from 'node:path'; const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/e2e/cases/custom-dist-path/index.test.ts b/e2e/cases/custom-dist-path/index.test.ts index 7fbd7ce7b3..853f415975 100644 --- a/e2e/cases/custom-dist-path/index.test.ts +++ b/e2e/cases/custom-dist-path/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should allow to custom dist path of different files', async () => { const rsbuild = await build({ diff --git a/e2e/cases/custom-dist-path/src/index.js b/e2e/cases/custom-dist-path/src/index.js index 3601834eb2..f027649456 100644 --- a/e2e/cases/custom-dist-path/src/index.js +++ b/e2e/cases/custom-dist-path/src/index.js @@ -1,5 +1,5 @@ -import './index.css'; import small from '@assets/icon.png?url'; +import './index.css'; import(/* webpackChunkName: "foo" */ './async'); diff --git a/e2e/cases/decorator/2022-03/index.test.ts b/e2e/cases/decorator/2022-03/index.test.ts index e75d1a703c..90ba788086 100644 --- a/e2e/cases/decorator/2022-03/index.test.ts +++ b/e2e/cases/decorator/2022-03/index.test.ts @@ -1,5 +1,5 @@ -import { test, expect } from '@playwright/test'; import { build, gotoPage, proxyConsole, rspackOnlyTest } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginBabel } from '@rsbuild/plugin-babel'; test('should run stage 3 decorators correctly', async ({ page }) => { diff --git a/e2e/cases/decorator/basic/index.test.ts b/e2e/cases/decorator/basic/index.test.ts index 43b1480b3b..34b1c054b6 100644 --- a/e2e/cases/decorator/basic/index.test.ts +++ b/e2e/cases/decorator/basic/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginBabel } from '@rsbuild/plugin-babel'; test('should use legacy decorators by default', async ({ page }) => { diff --git a/e2e/cases/emit-assets/index.test.ts b/e2e/cases/emit-assets/index.test.ts index a50bfdcdf3..f7a6ef9b93 100644 --- a/e2e/cases/emit-assets/index.test.ts +++ b/e2e/cases/emit-assets/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should allow to disable emit assets for node target', async () => { const rsbuild = await build({ diff --git a/e2e/cases/eslint/basic/index.test.ts b/e2e/cases/eslint/basic/index.test.ts index f31cde72af..1369e12e75 100644 --- a/e2e/cases/eslint/basic/index.test.ts +++ b/e2e/cases/eslint/basic/index.test.ts @@ -1,6 +1,6 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; import { proxyConsole } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginEslint } from '@rsbuild/plugin-eslint'; test('should throw error when exist ESLint errors', async () => { diff --git a/e2e/cases/eslint/flat-config/index.test.ts b/e2e/cases/eslint/flat-config/index.test.ts index 30ad10a2f3..4c1726823a 100644 --- a/e2e/cases/eslint/flat-config/index.test.ts +++ b/e2e/cases/eslint/flat-config/index.test.ts @@ -1,6 +1,6 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; import { proxyConsole } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should throw error when exist ESLint errors', async () => { const { logs, restore } = proxyConsole(); diff --git a/e2e/cases/exports-presence/index.test.ts b/e2e/cases/exports-presence/index.test.ts index 7feb326d7a..dbcab9b832 100644 --- a/e2e/cases/exports-presence/index.test.ts +++ b/e2e/cases/exports-presence/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, proxyConsole, webpackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; // TODO: needs rspack exportsPresence error // https://github.com/web-infra-dev/rspack/issues/4323 diff --git a/e2e/cases/exports-presence/src/index.js b/e2e/cases/exports-presence/src/index.js index 3acd0e4082..ffbcf50d9f 100644 --- a/e2e/cases/exports-presence/src/index.js +++ b/e2e/cases/exports-presence/src/index.js @@ -1,3 +1,3 @@ -import { bb, aa } from './test'; +import { aa, bb } from './test'; console.log(aa, bb); diff --git a/e2e/cases/filename-hash/index.test.ts b/e2e/cases/filename-hash/index.test.ts index 0771d78674..0f4ed6ee66 100644 --- a/e2e/cases/filename-hash/index.test.ts +++ b/e2e/cases/filename-hash/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest('should allow to set hash format to fullhash', async () => { const rsbuild = await build({ diff --git a/e2e/cases/html-tags/basic/index.test.ts b/e2e/cases/html-tags/basic/index.test.ts index 2d315a88cb..1922ebe452 100644 --- a/e2e/cases/html-tags/basic/index.test.ts +++ b/e2e/cases/html-tags/basic/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should inject tags correctly', async () => { const rsbuild = await build({ diff --git a/e2e/cases/html-tags/function-usage/index.test.ts b/e2e/cases/html-tags/function-usage/index.test.ts index d63fa33c8a..83a5998308 100644 --- a/e2e/cases/html-tags/function-usage/index.test.ts +++ b/e2e/cases/html-tags/function-usage/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should inject tags with function usage correctly', async () => { const rsbuild = await build({ diff --git a/e2e/cases/html-tags/modify-by-entry/index.test.ts b/e2e/cases/html-tags/modify-by-entry/index.test.ts index 2f0bc83408..52f68c0dc6 100644 --- a/e2e/cases/html-tags/modify-by-entry/index.test.ts +++ b/e2e/cases/html-tags/modify-by-entry/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should allow to inject tags by entry name', async () => { const rsbuild = await build({ diff --git a/e2e/cases/html/app-icon/index.test.ts b/e2e/cases/html/app-icon/index.test.ts index ea94388237..3529573aa1 100644 --- a/e2e/cases/html/app-icon/index.test.ts +++ b/e2e/cases/html/app-icon/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should emit app icon to dist path', async () => { const rsbuild = await build({ diff --git a/e2e/cases/html/combined/html.test.ts b/e2e/cases/html/combined/html.test.ts index 35bfe3ad70..8857f56bd4 100644 --- a/e2e/cases/html/combined/html.test.ts +++ b/e2e/cases/html/combined/html.test.ts @@ -1,7 +1,7 @@ import { join } from 'node:path'; +import { build } from '@e2e/helper'; import { expect, test } from '@playwright/test'; import { fse } from '@rsbuild/shared'; -import { build } from '@e2e/helper'; test.describe('should combine multiple html config correctly', () => { let rsbuild: Awaited>; diff --git a/e2e/cases/html/cross-origin/index.test.ts b/e2e/cases/html/cross-origin/index.test.ts index f9bfdc84b9..b142f0864c 100644 --- a/e2e/cases/html/cross-origin/index.test.ts +++ b/e2e/cases/html/cross-origin/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should not apply crossOrigin by default', async () => { const rsbuild = await build({ diff --git a/e2e/cases/html/favicon/index.test.ts b/e2e/cases/html/favicon/index.test.ts index d4d65f2c01..fbf38c3e46 100644 --- a/e2e/cases/html/favicon/index.test.ts +++ b/e2e/cases/html/favicon/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should emit local favicon to dist path', async () => { const rsbuild = await build({ diff --git a/e2e/cases/html/filename-hash/index.test.ts b/e2e/cases/html/filename-hash/index.test.ts index acc7dcc918..6a0dfab811 100644 --- a/e2e/cases/html/filename-hash/index.test.ts +++ b/e2e/cases/html/filename-hash/index.test.ts @@ -1,6 +1,6 @@ import { join } from 'node:path'; -import { expect, test } from '@playwright/test'; import { build, globContentJSON } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should allow to generate HTML with filename hash', async () => { await build({ diff --git a/e2e/cases/html/html-plugin/index.test.ts b/e2e/cases/html/html-plugin/index.test.ts index c8f5290378..11101eec8e 100644 --- a/e2e/cases/html/html-plugin/index.test.ts +++ b/e2e/cases/html/html-plugin/index.test.ts @@ -1,7 +1,7 @@ -import { fse } from '@rsbuild/shared'; import { join } from 'node:path'; -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; +import { fse } from '@rsbuild/shared'; test('tools.htmlPlugin', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/html/inject/index.test.ts b/e2e/cases/html/inject/index.test.ts index 99d5274724..310cc4c8a1 100644 --- a/e2e/cases/html/inject/index.test.ts +++ b/e2e/cases/html/inject/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginRem } from '@rsbuild/plugin-rem'; test('injection script order should be as expected', async () => { diff --git a/e2e/cases/html/legal-comments/index.test.ts b/e2e/cases/html/legal-comments/index.test.ts index ba7f829e61..373843f934 100644 --- a/e2e/cases/html/legal-comments/index.test.ts +++ b/e2e/cases/html/legal-comments/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should preserve legal comments in HTML by default', async () => { const rsbuild = await build({ diff --git a/e2e/cases/html/meta/index.test.ts b/e2e/cases/html/meta/index.test.ts index d662af77c2..225bc12f22 100644 --- a/e2e/cases/html/meta/index.test.ts +++ b/e2e/cases/html/meta/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should not inject charset meta if template already contains it', async () => { const rsbuild = await build({ diff --git a/e2e/cases/html/minify/index.test.ts b/e2e/cases/html/minify/index.test.ts index c01262b669..c0be970d86 100644 --- a/e2e/cases/html/minify/index.test.ts +++ b/e2e/cases/html/minify/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; const fixtures = __dirname; diff --git a/e2e/cases/html/mount-id/index.test.ts b/e2e/cases/html/mount-id/index.test.ts index 550df61d19..e33e20e69b 100644 --- a/e2e/cases/html/mount-id/index.test.ts +++ b/e2e/cases/html/mount-id/index.test.ts @@ -1,7 +1,7 @@ import { join } from 'node:path'; +import { build, gotoPage } from '@e2e/helper'; import { expect, test } from '@playwright/test'; import { fse } from '@rsbuild/shared'; -import { build, gotoPage } from '@e2e/helper'; test.describe('should render mountId correctly', () => { let rsbuild: Awaited>; diff --git a/e2e/cases/html/output-structure/index.test.ts b/e2e/cases/html/output-structure/index.test.ts index 46f6acd350..1fe2f7cfd1 100644 --- a/e2e/cases/html/output-structure/index.test.ts +++ b/e2e/cases/html/output-structure/index.test.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import { join } from 'node:path'; -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('html.outputStructure', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/html/script-loading/index.test.ts b/e2e/cases/html/script-loading/index.test.ts index 5dbcf8b300..1756b4b721 100644 --- a/e2e/cases/html/script-loading/index.test.ts +++ b/e2e/cases/html/script-loading/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should apply defer by default', async () => { const rsbuild = await build({ diff --git a/e2e/cases/html/template/index.test.ts b/e2e/cases/html/template/index.test.ts index a93693be0b..17581950c0 100644 --- a/e2e/cases/html/template/index.test.ts +++ b/e2e/cases/html/template/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should set template via function correctly', async () => { const rsbuild = await build({ diff --git a/e2e/cases/html/title/index.test.ts b/e2e/cases/html/title/index.test.ts index 1f264e83ec..80ac15702d 100644 --- a/e2e/cases/html/title/index.test.ts +++ b/e2e/cases/html/title/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should generate default title correctly', async () => { const rsbuild = await build({ diff --git a/e2e/cases/ignore-css/removeCss.test.ts b/e2e/cases/ignore-css/removeCss.test.ts index f56f016fdf..6bd869e887 100644 --- a/e2e/cases/ignore-css/removeCss.test.ts +++ b/e2e/cases/ignore-css/removeCss.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should ignore css content when build node target', async () => { const rsbuild = await build({ diff --git a/e2e/cases/image-compress/index.test.ts b/e2e/cases/image-compress/index.test.ts index f8552c48c6..238a86de94 100644 --- a/e2e/cases/image-compress/index.test.ts +++ b/e2e/cases/image-compress/index.test.ts @@ -1,7 +1,7 @@ +import { readFileSync } from 'node:fs'; import { join } from 'node:path'; -import { expect, test } from '@playwright/test'; import { build, globContentJSON } from '@e2e/helper'; -import { readFileSync } from 'node:fs'; +import { expect, test } from '@playwright/test'; test('should compress image with use plugin-image-compress', async () => { await expect( diff --git a/e2e/cases/image-compress/src/index.js b/e2e/cases/image-compress/src/index.js index 02e4f0b331..2659aa618a 100644 --- a/e2e/cases/image-compress/src/index.js +++ b/e2e/cases/image-compress/src/index.js @@ -1,6 +1,6 @@ import imageIco from '@assets/image.ico?url'; -import imagePng from '@assets/image.png?url'; import imageJpeg from '@assets/image.jpeg?url'; +import imagePng from '@assets/image.png?url'; import imageSvg from '@assets/mobile.svg?url'; const images = [imageIco, imagePng, imageJpeg, imageSvg]; diff --git a/e2e/cases/import-json/index.test.ts b/e2e/cases/import-json/index.test.ts index 9879cec831..c72a5e5c90 100644 --- a/e2e/cases/import-json/index.test.ts +++ b/e2e/cases/import-json/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest('should import JSON correctly', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/import-toml/index.test.ts b/e2e/cases/import-toml/index.test.ts index 7ac8fae9c7..d4bf8d82da 100644 --- a/e2e/cases/import-toml/index.test.ts +++ b/e2e/cases/import-toml/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest('should import TOML correctly', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/import-yaml/index.test.ts b/e2e/cases/import-yaml/index.test.ts index a558aa9a56..39b8b90a07 100644 --- a/e2e/cases/import-yaml/index.test.ts +++ b/e2e/cases/import-yaml/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest('should import YAML correctly', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/inline-chunk/index.test.ts b/e2e/cases/inline-chunk/index.test.ts index 63e8587f9a..a82e14ac31 100644 --- a/e2e/cases/inline-chunk/index.test.ts +++ b/e2e/cases/inline-chunk/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import type { BundlerChain } from '@rsbuild/shared'; // use source-map for easy to test. By default, Rsbuild use hidden-source-map diff --git a/e2e/cases/inspect-config/debug.test.ts b/e2e/cases/inspect-config/debug.test.ts index 04518dab16..2d47e7e846 100644 --- a/e2e/cases/inspect-config/debug.test.ts +++ b/e2e/cases/inspect-config/debug.test.ts @@ -1,7 +1,7 @@ import path from 'node:path'; -import { fse } from '@rsbuild/shared'; -import { expect, test } from '@playwright/test'; import { build, dev, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; +import { fse } from '@rsbuild/shared'; const getRsbuildConfig = (dist: string) => path.resolve(__dirname, `./${dist}/rsbuild.config.mjs`); diff --git a/e2e/cases/inspect-config/index.test.ts b/e2e/cases/inspect-config/index.test.ts index df585220c7..814da0a35f 100644 --- a/e2e/cases/inspect-config/index.test.ts +++ b/e2e/cases/inspect-config/index.test.ts @@ -1,7 +1,7 @@ import path from 'node:path'; -import { fse } from '@rsbuild/shared'; -import { expect, test } from '@playwright/test'; import { createRsbuild } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; +import { fse } from '@rsbuild/shared'; const rsbuildConfig = path.resolve(__dirname, './dist/rsbuild.config.mjs'); const bundlerConfig = path.resolve( diff --git a/e2e/cases/javascript-api/custom-logger/index.test.ts b/e2e/cases/javascript-api/custom-logger/index.test.ts index 846e214b78..5cb959dae8 100644 --- a/e2e/cases/javascript-api/custom-logger/index.test.ts +++ b/e2e/cases/javascript-api/custom-logger/index.test.ts @@ -1,5 +1,5 @@ +import { build, proxyConsole, rspackOnlyTest } from '@e2e/helper'; import { expect } from '@playwright/test'; -import { build, rspackOnlyTest, proxyConsole } from '@e2e/helper'; rspackOnlyTest('should allow to customize logger', async () => { const { logs, restore } = proxyConsole('log'); diff --git a/e2e/cases/javascript-api/custom-logger/rsbuild.config.ts b/e2e/cases/javascript-api/custom-logger/rsbuild.config.ts index 749e743c26..330e1e06a3 100644 --- a/e2e/cases/javascript-api/custom-logger/rsbuild.config.ts +++ b/e2e/cases/javascript-api/custom-logger/rsbuild.config.ts @@ -1,4 +1,4 @@ -import { logger, defineConfig } from '@rsbuild/core'; +import { defineConfig, logger } from '@rsbuild/core'; const defaultReady = logger.ready; diff --git a/e2e/cases/javascript-api/load-env/index.test.ts b/e2e/cases/javascript-api/load-env/index.test.ts index b371f9293c..20913c61bf 100644 --- a/e2e/cases/javascript-api/load-env/index.test.ts +++ b/e2e/cases/javascript-api/load-env/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; import { loadEnv } from '@rsbuild/core'; rspackOnlyTest('should load env files correctly', () => { diff --git a/e2e/cases/javascript-api/register-plugin/index.test.ts b/e2e/cases/javascript-api/register-plugin/index.test.ts index fbf9f74fe7..a5d25854db 100644 --- a/e2e/cases/javascript-api/register-plugin/index.test.ts +++ b/e2e/cases/javascript-api/register-plugin/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; +import { globContentJSON, rspackOnlyTest } from '@e2e/helper'; import { expect } from '@playwright/test'; -import { rspackOnlyTest, globContentJSON } from '@e2e/helper'; import { createRsbuild } from '@rsbuild/core'; import { pluginVue } from '@rsbuild/plugin-vue'; diff --git a/e2e/cases/legal-comments/index.test.ts b/e2e/cases/legal-comments/index.test.ts index 63b2cfc80c..9db7823d86 100644 --- a/e2e/cases/legal-comments/index.test.ts +++ b/e2e/cases/legal-comments/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginReact } from '@rsbuild/plugin-react'; const fixtures = __dirname; diff --git a/e2e/cases/live-reload/index.test.ts b/e2e/cases/live-reload/index.test.ts index 6ffd2bfa57..dc8a96d9ad 100644 --- a/e2e/cases/live-reload/index.test.ts +++ b/e2e/cases/live-reload/index.test.ts @@ -1,7 +1,7 @@ -import path from 'node:path'; import fs from 'node:fs'; -import { test, expect } from '@playwright/test'; +import path from 'node:path'; import { dev, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; const appFile = path.join(__dirname, 'src/App.jsx'); let appCode: string; diff --git a/e2e/cases/mdx/preact/index.test.ts b/e2e/cases/mdx/preact/index.test.ts index ef2a307d34..b34e849b48 100644 --- a/e2e/cases/mdx/preact/index.test.ts +++ b/e2e/cases/mdx/preact/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest('should render MDX with Preact correctly', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/mdx/preact/rsbuild.config.ts b/e2e/cases/mdx/preact/rsbuild.config.ts index 7e744e956a..27ff483b48 100644 --- a/e2e/cases/mdx/preact/rsbuild.config.ts +++ b/e2e/cases/mdx/preact/rsbuild.config.ts @@ -1,6 +1,6 @@ import { defineConfig } from '@rsbuild/core'; -import { pluginPreact } from '@rsbuild/plugin-preact'; import { pluginMdx } from '@rsbuild/plugin-mdx'; +import { pluginPreact } from '@rsbuild/plugin-preact'; export default defineConfig({ plugins: [ diff --git a/e2e/cases/mdx/react/index.test.ts b/e2e/cases/mdx/react/index.test.ts index 22144cb405..bf2cc40bf7 100644 --- a/e2e/cases/mdx/react/index.test.ts +++ b/e2e/cases/mdx/react/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest('should render MDX with React correctly', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/mdx/react/rsbuild.config.ts b/e2e/cases/mdx/react/rsbuild.config.ts index 1cc049f396..306729f132 100644 --- a/e2e/cases/mdx/react/rsbuild.config.ts +++ b/e2e/cases/mdx/react/rsbuild.config.ts @@ -1,6 +1,6 @@ import { defineConfig } from '@rsbuild/core'; -import { pluginReact } from '@rsbuild/plugin-react'; import { pluginMdx } from '@rsbuild/plugin-mdx'; +import { pluginReact } from '@rsbuild/plugin-react'; export default defineConfig({ plugins: [pluginReact(), pluginMdx()], diff --git a/e2e/cases/mdx/vue/index.test.ts b/e2e/cases/mdx/vue/index.test.ts index c35ad0ebc9..d8e3ce5582 100644 --- a/e2e/cases/mdx/vue/index.test.ts +++ b/e2e/cases/mdx/vue/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest('should render MDX with Vue correctly', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/mdx/vue/rsbuild.config.ts b/e2e/cases/mdx/vue/rsbuild.config.ts index f2ad351cb2..095ce1a89b 100644 --- a/e2e/cases/mdx/vue/rsbuild.config.ts +++ b/e2e/cases/mdx/vue/rsbuild.config.ts @@ -1,6 +1,6 @@ import { defineConfig } from '@rsbuild/core'; -import { pluginVue } from '@rsbuild/plugin-vue'; import { pluginMdx } from '@rsbuild/plugin-mdx'; +import { pluginVue } from '@rsbuild/plugin-vue'; export default defineConfig({ plugins: [ diff --git a/e2e/cases/mjs-artifact/index.test.ts b/e2e/cases/mjs-artifact/index.test.ts index 2c589dfd71..10c081dd07 100644 --- a/e2e/cases/mjs-artifact/index.test.ts +++ b/e2e/cases/mjs-artifact/index.test.ts @@ -1,6 +1,6 @@ -import { expect, test } from '@playwright/test'; import { execSync } from 'node:child_process'; import path from 'node:path'; +import { expect, test } from '@playwright/test'; // check for https://github.com/web-infra-dev/rsbuild/pull/809 test('should import mjs artifact correctly', () => { diff --git a/e2e/cases/mjs-artifact/test.mjs b/e2e/cases/mjs-artifact/test.mjs index d79d377495..526b1162d8 100644 --- a/e2e/cases/mjs-artifact/test.mjs +++ b/e2e/cases/mjs-artifact/test.mjs @@ -2,29 +2,29 @@ import { pluginAssetsRetry } from '@rsbuild/plugin-assets-retry'; import { pluginBabel } from '@rsbuild/plugin-babel'; import { pluginCheckSyntax } from '@rsbuild/plugin-check-syntax'; import { pluginCssMinimizer } from '@rsbuild/plugin-css-minimizer'; -import { pluginImageCompress } from '@rsbuild/plugin-image-compress'; import { pluginEslint } from '@rsbuild/plugin-eslint'; +import { pluginImageCompress } from '@rsbuild/plugin-image-compress'; +import { pluginLightningcss } from '@rsbuild/plugin-lightningcss'; +import { pluginMdx } from '@rsbuild/plugin-mdx'; import { pluginNodePolyfill } from '@rsbuild/plugin-node-polyfill'; +import { pluginPreact } from '@rsbuild/plugin-preact'; import { pluginPug } from '@rsbuild/plugin-pug'; import { pluginReact } from '@rsbuild/plugin-react'; -import { pluginPreact } from '@rsbuild/plugin-preact'; import { pluginRem } from '@rsbuild/plugin-rem'; -import { pluginSvgr } from '@rsbuild/plugin-svgr'; import { pluginSolid } from '@rsbuild/plugin-solid'; -import { pluginSvelte } from '@rsbuild/plugin-svelte'; -import { pluginStylus } from '@rsbuild/plugin-stylus'; -import { pluginLightningcss } from '@rsbuild/plugin-lightningcss'; import { pluginSourceBuild } from '@rsbuild/plugin-source-build'; import { pluginStyledComponents } from '@rsbuild/plugin-styled-components'; -import { pluginUmd } from '@rsbuild/plugin-umd'; +import { pluginStylus } from '@rsbuild/plugin-stylus'; +import { pluginSvelte } from '@rsbuild/plugin-svelte'; +import { pluginSvgr } from '@rsbuild/plugin-svgr'; +import { pluginToml } from '@rsbuild/plugin-toml'; import { pluginTypeCheck } from '@rsbuild/plugin-type-check'; +import { pluginUmd } from '@rsbuild/plugin-umd'; import { pluginVue } from '@rsbuild/plugin-vue'; -import { pluginVue2 } from '@rsbuild/plugin-vue2'; import { pluginVueJsx } from '@rsbuild/plugin-vue-jsx'; +import { pluginVue2 } from '@rsbuild/plugin-vue2'; import { pluginVue2Jsx } from '@rsbuild/plugin-vue2-jsx'; -import { pluginToml } from '@rsbuild/plugin-toml'; import { pluginYaml } from '@rsbuild/plugin-yaml'; -import { pluginMdx } from '@rsbuild/plugin-mdx'; export default { pluginAssetsRetry, diff --git a/e2e/cases/module-federation/index.test.ts b/e2e/cases/module-federation/index.test.ts index 29ad36f10f..f99e88c55e 100644 --- a/e2e/cases/module-federation/index.test.ts +++ b/e2e/cases/module-federation/index.test.ts @@ -1,6 +1,6 @@ import { join } from 'node:path'; +import { dev, getRandomPort, gotoPage, rspackOnlyTest } from '@e2e/helper'; import { expect } from '@playwright/test'; -import { dev, gotoPage, getRandomPort, rspackOnlyTest } from '@e2e/helper'; const host = join(__dirname, 'host'); const remote = join(__dirname, 'remote'); diff --git a/e2e/cases/moment/index.test.ts b/e2e/cases/moment/index.test.ts index ffe61beb76..706a488e90 100644 --- a/e2e/cases/moment/index.test.ts +++ b/e2e/cases/moment/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('removeMomentLocale false (default)', async () => { const rsbuild = await build({ diff --git a/e2e/cases/multi-compiler/index.test.ts b/e2e/cases/multi-compiler/index.test.ts index 65ae3836f6..655d005dbd 100644 --- a/e2e/cases/multi-compiler/index.test.ts +++ b/e2e/cases/multi-compiler/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, dev, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('multi compiler build', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/node-addons/index.test.ts b/e2e/cases/node-addons/index.test.ts index 4980727d66..d4543bedfb 100644 --- a/e2e/cases/node-addons/index.test.ts +++ b/e2e/cases/node-addons/index.test.ts @@ -1,6 +1,6 @@ -import { expect, test } from '@playwright/test'; -import { build } from '@e2e/helper'; import { join } from 'node:path'; +import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { fse } from '@rsbuild/shared'; test('should compile Node addons correctly', async () => { diff --git a/e2e/cases/node-polyfill-tip/index.test.ts b/e2e/cases/node-polyfill-tip/index.test.ts index b5d3d7b226..94ae8973a1 100644 --- a/e2e/cases/node-polyfill-tip/index.test.ts +++ b/e2e/cases/node-polyfill-tip/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, proxyConsole } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should print tips if resolve Node.js builtin module failed', async () => { const { logs, restore } = proxyConsole(); diff --git a/e2e/cases/node-polyfill/index.test.ts b/e2e/cases/node-polyfill/index.test.ts index 6035d157a8..367d0b9de3 100644 --- a/e2e/cases/node-polyfill/index.test.ts +++ b/e2e/cases/node-polyfill/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should add node-polyfill when add node-polyfill plugin', async ({ page, diff --git a/e2e/cases/node-polyfill/rsbuild.config.ts b/e2e/cases/node-polyfill/rsbuild.config.ts index 26ba08a2bf..c00c5b0a0f 100644 --- a/e2e/cases/node-polyfill/rsbuild.config.ts +++ b/e2e/cases/node-polyfill/rsbuild.config.ts @@ -1,6 +1,6 @@ import { defineConfig } from '@rsbuild/core'; -import { pluginReact } from '@rsbuild/plugin-react'; import { pluginNodePolyfill } from '@rsbuild/plugin-node-polyfill'; +import { pluginReact } from '@rsbuild/plugin-react'; export default defineConfig({ plugins: [pluginNodePolyfill(), pluginReact()], diff --git a/e2e/cases/nonce/basic/index.test.ts b/e2e/cases/nonce/basic/index.test.ts index 02c81b574b..245371250b 100644 --- a/e2e/cases/nonce/basic/index.test.ts +++ b/e2e/cases/nonce/basic/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should apply nonce to script and style tags', async () => { const rsbuild = await build({ diff --git a/e2e/cases/nonce/dynamic-chunk/index.test.ts b/e2e/cases/nonce/dynamic-chunk/index.test.ts index b337658fdc..184beb7285 100644 --- a/e2e/cases/nonce/dynamic-chunk/index.test.ts +++ b/e2e/cases/nonce/dynamic-chunk/index.test.ts @@ -1,5 +1,5 @@ +import { build, dev, gotoPage } from '@e2e/helper'; import { expect, test } from '@playwright/test'; -import { dev, build, gotoPage } from '@e2e/helper'; test('should apply nonce to dynamic chunks in dev build', async ({ page }) => { const rsbuild = await dev({ diff --git a/e2e/cases/nonce/with-rem/index.test.ts b/e2e/cases/nonce/with-rem/index.test.ts index d3bec54d14..0de98d6ddb 100644 --- a/e2e/cases/nonce/with-rem/index.test.ts +++ b/e2e/cases/nonce/with-rem/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should inject rem runtime code with nonce', async () => { const rsbuild = await build({ diff --git a/e2e/cases/output/ascii/index.test.ts b/e2e/cases/output/ascii/index.test.ts index 7dfe84bea9..7858f722cb 100644 --- a/e2e/cases/output/ascii/index.test.ts +++ b/e2e/cases/output/ascii/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('output.charset default (ascii)', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/output/assets-retry/index.test.ts b/e2e/cases/output/assets-retry/index.test.ts index ecddb16c29..f0c684042c 100644 --- a/e2e/cases/output/assets-retry/index.test.ts +++ b/e2e/cases/output/assets-retry/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginAssetsRetry } from '@rsbuild/plugin-assets-retry'; test('should inline assets retry runtime code to html by default', async () => { diff --git a/e2e/cases/output/assets.test.ts b/e2e/cases/output/assets.test.ts index 806971ce94..579c25736e 100644 --- a/e2e/cases/output/assets.test.ts +++ b/e2e/cases/output/assets.test.ts @@ -1,6 +1,6 @@ import { join } from 'node:path'; -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginReact } from '@rsbuild/plugin-react'; const fixtures = __dirname; diff --git a/e2e/cases/output/clean-dist-path/index.test.ts b/e2e/cases/output/clean-dist-path/index.test.ts index 8b4b92edf9..825779d210 100644 --- a/e2e/cases/output/clean-dist-path/index.test.ts +++ b/e2e/cases/output/clean-dist-path/index.test.ts @@ -1,7 +1,7 @@ import { join } from 'node:path'; +import { build, proxyConsole } from '@e2e/helper'; import { expect, test } from '@playwright/test'; import { fse } from '@rsbuild/shared'; -import { build, proxyConsole } from '@e2e/helper'; const cwd = __dirname; const testDistFile = join(cwd, 'dist/test.json'); diff --git a/e2e/cases/output/copy/index.test.ts b/e2e/cases/output/copy/index.test.ts index 21c5a9a81e..3ea5d2d544 100644 --- a/e2e/cases/output/copy/index.test.ts +++ b/e2e/cases/output/copy/index.test.ts @@ -1,7 +1,7 @@ import { join } from 'node:path'; +import { build } from '@e2e/helper'; import { expect, test } from '@playwright/test'; import { fse } from '@rsbuild/shared'; -import { build } from '@e2e/helper'; test('should copy asset to dist folder correctly', async () => { await build({ diff --git a/e2e/cases/output/externals/tests/index.test.ts b/e2e/cases/output/externals/tests/index.test.ts index 82b719e6da..609bfb4a3e 100644 --- a/e2e/cases/output/externals/tests/index.test.ts +++ b/e2e/cases/output/externals/tests/index.test.ts @@ -1,6 +1,6 @@ import { join, resolve } from 'node:path'; -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginReact } from '@rsbuild/plugin-react'; const fixtures = resolve(__dirname, '../'); diff --git a/e2e/cases/performance/bundle-analyzer/index.test.ts b/e2e/cases/performance/bundle-analyzer/index.test.ts index 1640375185..a1aa529265 100644 --- a/e2e/cases/performance/bundle-analyzer/index.test.ts +++ b/e2e/cases/performance/bundle-analyzer/index.test.ts @@ -1,6 +1,6 @@ import { join } from 'node:path'; +import { build, dev, globContentJSON } from '@e2e/helper'; import { expect, test } from '@playwright/test'; -import { dev, build, globContentJSON } from '@e2e/helper'; test('should emit bundle analyze report correctly when dev', async ({ page, diff --git a/e2e/cases/performance/load-resource/index.test.ts b/e2e/cases/performance/load-resource/index.test.ts index 654c921a71..f7f988dab4 100644 --- a/e2e/cases/performance/load-resource/index.test.ts +++ b/e2e/cases/performance/load-resource/index.test.ts @@ -1,6 +1,6 @@ import { join } from 'node:path'; -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginReact } from '@rsbuild/plugin-react'; const fixtures = __dirname; diff --git a/e2e/cases/performance/load-resource/src/test.ts b/e2e/cases/performance/load-resource/src/test.ts index 024efc69ff..9ffee7b9ff 100644 --- a/e2e/cases/performance/load-resource/src/test.ts +++ b/e2e/cases/performance/load-resource/src/test.ts @@ -1,5 +1,5 @@ -import './test.css'; import Png from '@assets/image.png?url'; +import './test.css'; export { Png }; export const a = '1111'; diff --git a/e2e/cases/performance/performance.test.ts b/e2e/cases/performance/performance.test.ts index f1d95f8bd2..abbc35e17b 100644 --- a/e2e/cases/performance/performance.test.ts +++ b/e2e/cases/performance/performance.test.ts @@ -1,6 +1,6 @@ import { join, resolve } from 'node:path'; -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginReact } from '@rsbuild/plugin-react'; const fixtures = __dirname; diff --git a/e2e/cases/performance/print-file-size/index.test.ts b/e2e/cases/performance/print-file-size/index.test.ts index 7d3afffe36..11c5c6ca0a 100644 --- a/e2e/cases/performance/print-file-size/index.test.ts +++ b/e2e/cases/performance/print-file-size/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { expect, test } from '@playwright/test'; import { build, proxyConsole } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; const cwd = __dirname; diff --git a/e2e/cases/performance/remove-console/index.test.ts b/e2e/cases/performance/remove-console/index.test.ts index 247f64f09d..48fb23831c 100644 --- a/e2e/cases/performance/remove-console/index.test.ts +++ b/e2e/cases/performance/remove-console/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; const cwd = __dirname; diff --git a/e2e/cases/performance/single-vendor/index.test.ts b/e2e/cases/performance/single-vendor/index.test.ts index 18fe2204c7..056d77bb70 100644 --- a/e2e/cases/performance/single-vendor/index.test.ts +++ b/e2e/cases/performance/single-vendor/index.test.ts @@ -1,7 +1,7 @@ -import { expect, test } from '@playwright/test'; +import { basename } from 'node:path'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginReact } from '@rsbuild/plugin-react'; -import { basename } from 'node:path'; test('should generate vendor chunk when chunkSplit is "single-vendor"', async () => { const rsbuild = await build({ diff --git a/e2e/cases/performance/split-by-module/index.test.ts b/e2e/cases/performance/split-by-module/index.test.ts index 3448dc4d7c..bf2089fbc9 100644 --- a/e2e/cases/performance/split-by-module/index.test.ts +++ b/e2e/cases/performance/split-by-module/index.test.ts @@ -1,7 +1,7 @@ -import { expect, test } from '@playwright/test'; +import { basename } from 'node:path'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginReact } from '@rsbuild/plugin-react'; -import { basename } from 'node:path'; test('should generate module chunks when chunkSplit is "split-by-module"', async () => { const rsbuild = await build({ diff --git a/e2e/cases/plugin-api/plugin-after-build-hook/index.test.ts b/e2e/cases/plugin-api/plugin-after-build-hook/index.test.ts index 80904eadfd..ce0281c09a 100644 --- a/e2e/cases/plugin-api/plugin-after-build-hook/index.test.ts +++ b/e2e/cases/plugin-api/plugin-after-build-hook/index.test.ts @@ -1,5 +1,5 @@ import path from 'node:path'; -import { test, expect } from '@playwright/test'; +import { expect, test } from '@playwright/test'; import { type RsbuildPlugin, createRsbuild } from '@rsbuild/core'; import { fse } from '@rsbuild/shared'; diff --git a/e2e/cases/plugin-api/plugin-expose/index.test.ts b/e2e/cases/plugin-api/plugin-expose/index.test.ts index 7f100d788f..324bcb81fc 100644 --- a/e2e/cases/plugin-api/plugin-expose/index.test.ts +++ b/e2e/cases/plugin-api/plugin-expose/index.test.ts @@ -1,4 +1,4 @@ -import { test, expect } from '@playwright/test'; +import { expect, test } from '@playwright/test'; import { type RsbuildPlugin, createRsbuild } from '@rsbuild/core'; type ParentAPI = { diff --git a/e2e/cases/plugin-api/plugin-hooks/index.test.ts b/e2e/cases/plugin-api/plugin-hooks/index.test.ts index 126cacbee9..f0dc3c6a7a 100644 --- a/e2e/cases/plugin-api/plugin-hooks/index.test.ts +++ b/e2e/cases/plugin-api/plugin-hooks/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { test, expect } from '@playwright/test'; import { gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { type RsbuildPlugin, createRsbuild } from '@rsbuild/core'; import { fse, setNodeEnv } from '@rsbuild/shared'; diff --git a/e2e/cases/plugin-api/plugin-modify-tags/index.test.ts b/e2e/cases/plugin-api/plugin-modify-tags/index.test.ts index be5bd9d80e..57b534ee9c 100644 --- a/e2e/cases/plugin-api/plugin-modify-tags/index.test.ts +++ b/e2e/cases/plugin-api/plugin-modify-tags/index.test.ts @@ -1,5 +1,5 @@ -import { test, expect } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should allow plugin to modify HTML tags', async () => { const rsbuild = await build({ diff --git a/e2e/cases/plugin-api/plugin-transform/index.test.ts b/e2e/cases/plugin-api/plugin-transform/index.test.ts index c5f3dc73e8..42b71311be 100644 --- a/e2e/cases/plugin-api/plugin-transform/index.test.ts +++ b/e2e/cases/plugin-api/plugin-transform/index.test.ts @@ -1,5 +1,5 @@ -import { test, expect } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should allow plugin to transform code', async () => { const rsbuild = await build({ diff --git a/e2e/cases/polyfill/basic/index.test.ts b/e2e/cases/polyfill/basic/index.test.ts index 269ac00e45..072c3d659d 100644 --- a/e2e/cases/polyfill/basic/index.test.ts +++ b/e2e/cases/polyfill/basic/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { getPolyfillContent } from '../helper'; const EXPECT_VALUE = { diff --git a/e2e/cases/polyfill/browserslist/index.test.ts b/e2e/cases/polyfill/browserslist/index.test.ts index 2c96f01e33..6571cb3138 100644 --- a/e2e/cases/polyfill/browserslist/index.test.ts +++ b/e2e/cases/polyfill/browserslist/index.test.ts @@ -1,6 +1,6 @@ import { join } from 'node:path'; +import { build, dev, globContentJSON, gotoPage } from '@e2e/helper'; import { expect, test } from '@playwright/test'; -import { dev, build, globContentJSON, gotoPage } from '@e2e/helper'; import { getPolyfillContent } from '../helper'; test('should read browserslist for development env correctly', async ({ diff --git a/e2e/cases/preact/basic/index.test.ts b/e2e/cases/preact/basic/index.test.ts index 28831908b3..72e97e63dc 100644 --- a/e2e/cases/preact/basic/index.test.ts +++ b/e2e/cases/preact/basic/index.test.ts @@ -1,5 +1,5 @@ +import { build, dev, gotoPage, rspackOnlyTest } from '@e2e/helper'; import { expect } from '@playwright/test'; -import { dev, build, gotoPage, rspackOnlyTest } from '@e2e/helper'; rspackOnlyTest( 'should render basic Preact component in development correctly', diff --git a/e2e/cases/preview/index.test.ts b/e2e/cases/preview/index.test.ts index 00db28c397..dd10848c27 100644 --- a/e2e/cases/preview/index.test.ts +++ b/e2e/cases/preview/index.test.ts @@ -1,6 +1,6 @@ import { join } from 'node:path'; -import { expect, test } from '@playwright/test'; import { build, getRandomPort, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import type { RsbuildPlugin } from '@rsbuild/core'; test('should preview dist files correctly', async ({ page }) => { diff --git a/e2e/cases/prod-server/index.test.ts b/e2e/cases/prod-server/index.test.ts index 29fbed5c08..e0dab79a52 100644 --- a/e2e/cases/prod-server/index.test.ts +++ b/e2e/cases/prod-server/index.test.ts @@ -1,6 +1,6 @@ import { join } from 'node:path'; -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; const fixtures = __dirname; diff --git a/e2e/cases/progress/index.test.ts b/e2e/cases/progress/index.test.ts index ace9624231..2e2dd7dd04 100644 --- a/e2e/cases/progress/index.test.ts +++ b/e2e/cases/progress/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, webpackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; import { logger } from '@rsbuild/shared'; webpackOnlyTest('should emit progress log in non-TTY environment', async () => { diff --git a/e2e/cases/pug/basic/index.test.ts b/e2e/cases/pug/basic/index.test.ts index 92bcee3ffe..b7274a5f4c 100644 --- a/e2e/cases/pug/basic/index.test.ts +++ b/e2e/cases/pug/basic/index.test.ts @@ -1,5 +1,5 @@ -import { test, expect } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should allow to use .pug template file', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/pug/vue2-template/index.test.ts b/e2e/cases/pug/vue2-template/index.test.ts index 7391dbde84..496892f7fa 100644 --- a/e2e/cases/pug/vue2-template/index.test.ts +++ b/e2e/cases/pug/vue2-template/index.test.ts @@ -1,5 +1,5 @@ -import { test, expect } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should allow to use .pug template file', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/pug/vue3-template/index.test.ts b/e2e/cases/pug/vue3-template/index.test.ts index 7391dbde84..496892f7fa 100644 --- a/e2e/cases/pug/vue3-template/index.test.ts +++ b/e2e/cases/pug/vue3-template/index.test.ts @@ -1,5 +1,5 @@ -import { test, expect } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should allow to use .pug template file', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/react/basic/index.test.ts b/e2e/cases/react/basic/index.test.ts index 70c70bf790..f43d749041 100644 --- a/e2e/cases/react/basic/index.test.ts +++ b/e2e/cases/react/basic/index.test.ts @@ -1,5 +1,5 @@ +import { build, dev, gotoPage, rspackOnlyTest } from '@e2e/helper'; import { expect } from '@playwright/test'; -import { dev, build, gotoPage, rspackOnlyTest } from '@e2e/helper'; rspackOnlyTest( 'should render basic React component in development correctly', diff --git a/e2e/cases/react/enable-profiler/index.test.ts b/e2e/cases/react/enable-profiler/index.test.ts index 83e17a608a..9acb6fb8e0 100644 --- a/e2e/cases/react/enable-profiler/index.test.ts +++ b/e2e/cases/react/enable-profiler/index.test.ts @@ -1,5 +1,5 @@ -import { test, expect } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; const fixtures = __dirname; diff --git a/e2e/cases/react/legacy-jsx/index.test.ts b/e2e/cases/react/legacy-jsx/index.test.ts index 63f643c451..e68f4de76e 100644 --- a/e2e/cases/react/legacy-jsx/index.test.ts +++ b/e2e/cases/react/legacy-jsx/index.test.ts @@ -1,5 +1,5 @@ -import { test, expect } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; const fixtures = __dirname; diff --git a/e2e/cases/react/split-chunk/index.test.ts b/e2e/cases/react/split-chunk/index.test.ts index 29a26adbf4..a6a1e233a1 100644 --- a/e2e/cases/react/split-chunk/index.test.ts +++ b/e2e/cases/react/split-chunk/index.test.ts @@ -1,5 +1,5 @@ -import { test, expect } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginReact } from '@rsbuild/plugin-react'; const fixtures = __dirname; diff --git a/e2e/cases/react/split-chunk/src/index.js b/e2e/cases/react/split-chunk/src/index.js index d2da765c62..8742af5faa 100644 --- a/e2e/cases/react/split-chunk/src/index.js +++ b/e2e/cases/react/split-chunk/src/index.js @@ -1,7 +1,7 @@ import React from 'react'; import { createRoot } from 'react-dom/client'; -import App from './App'; import { Link } from 'react-router-dom'; +import App from './App'; const container = document.getElementById('root'); if (container) { diff --git a/e2e/cases/rem/basic/index.test.ts b/e2e/cases/rem/basic/index.test.ts index 064f5eff3d..2cfdac837c 100644 --- a/e2e/cases/rem/basic/index.test.ts +++ b/e2e/cases/rem/basic/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginReact } from '@rsbuild/plugin-react'; import { pluginRem } from '@rsbuild/plugin-rem'; diff --git a/e2e/cases/rem/basic/src/App.tsx b/e2e/cases/rem/basic/src/App.tsx index 68ebe031ae..da3be4f9b2 100644 --- a/e2e/cases/rem/basic/src/App.tsx +++ b/e2e/cases/rem/basic/src/App.tsx @@ -1,6 +1,6 @@ import './App.css'; -import stylesForSass from './App.module.scss'; import stylesForLess from './App.module.less'; +import stylesForSass from './App.module.scss'; const App = () => (
diff --git a/e2e/cases/rem/with-viewport/index.test.ts b/e2e/cases/rem/with-viewport/index.test.ts index 09cd39c4a9..cd9fd373fc 100644 --- a/e2e/cases/rem/with-viewport/index.test.ts +++ b/e2e/cases/rem/with-viewport/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { viewportValue } from './rsbuild.config'; test('should inject rem runtime code after meta tags', async () => { diff --git a/e2e/cases/resolve-pkg-imports/index.test.ts b/e2e/cases/resolve-pkg-imports/index.test.ts index 7cf9031dc2..5e47f74d6e 100644 --- a/e2e/cases/resolve-pkg-imports/index.test.ts +++ b/e2e/cases/resolve-pkg-imports/index.test.ts @@ -1,5 +1,5 @@ +import { build, dev, gotoPage } from '@e2e/helper'; import { expect, test } from '@playwright/test'; -import { dev, build, gotoPage } from '@e2e/helper'; test('should resolve package.json#imports correctly in dev build', async ({ page, diff --git a/e2e/cases/resolve-pkg-imports/src/index.js b/e2e/cases/resolve-pkg-imports/src/index.js index 2625668765..5d9a23984a 100644 --- a/e2e/cases/resolve-pkg-imports/src/index.js +++ b/e2e/cases/resolve-pkg-imports/src/index.js @@ -1,5 +1,5 @@ -import { foo } from '#foo'; import { test } from '#common/test'; +import { foo } from '#foo'; const fooEl = document.createElement('div'); fooEl.id = foo; diff --git a/e2e/cases/rsdoctor/index.test.ts b/e2e/cases/rsdoctor/index.test.ts index 1a1eddfebd..751b56fd38 100644 --- a/e2e/cases/rsdoctor/index.test.ts +++ b/e2e/cases/rsdoctor/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { expect } from '@playwright/test'; import { build, proxyConsole, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; import { fse } from '@rsbuild/shared'; const packagePath = path.join( diff --git a/e2e/cases/server/custom-server/index.test.ts b/e2e/cases/server/custom-server/index.test.ts index 36f9319575..f56bef27fe 100644 --- a/e2e/cases/server/custom-server/index.test.ts +++ b/e2e/cases/server/custom-server/index.test.ts @@ -1,7 +1,7 @@ -import { expect, test } from '@playwright/test'; import { gotoPage } from '@e2e/helper'; -import { startDevServer } from './scripts/server.mjs'; +import { expect, test } from '@playwright/test'; import { startDevServerPure } from './scripts/pureServer.mjs'; +import { startDevServer } from './scripts/server.mjs'; test('custom server', async ({ page }) => { const { config, close } = await startDevServer(__dirname); diff --git a/e2e/cases/server/custom-server/scripts/index.mjs b/e2e/cases/server/custom-server/scripts/index.mjs index 3561ecf720..6ccc764566 100644 --- a/e2e/cases/server/custom-server/scripts/index.mjs +++ b/e2e/cases/server/custom-server/scripts/index.mjs @@ -1,5 +1,5 @@ -import { startDevServer } from './server.mjs'; import { startDevServerPure } from './pureServer.mjs'; +import { startDevServer } from './server.mjs'; const isPure = process.argv[2] === 'pure'; diff --git a/e2e/cases/server/dev.test.ts b/e2e/cases/server/dev.test.ts index 12011c1dca..270e57adb8 100644 --- a/e2e/cases/server/dev.test.ts +++ b/e2e/cases/server/dev.test.ts @@ -1,8 +1,8 @@ import { join } from 'node:path'; -import { fse } from '@rsbuild/shared'; -import { expect, test } from '@playwright/test'; import { dev, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginReact } from '@rsbuild/plugin-react'; +import { fse } from '@rsbuild/shared'; const fixtures = __dirname; diff --git a/e2e/cases/server/history-api-fallback/historyApiFallback.test.ts b/e2e/cases/server/history-api-fallback/historyApiFallback.test.ts index 9d5f2811f4..e7ce1ddf5f 100644 --- a/e2e/cases/server/history-api-fallback/historyApiFallback.test.ts +++ b/e2e/cases/server/history-api-fallback/historyApiFallback.test.ts @@ -1,6 +1,6 @@ import { join } from 'node:path'; +import { build, dev, rspackOnlyTest } from '@e2e/helper'; import { expect, test } from '@playwright/test'; -import { dev, build, rspackOnlyTest } from '@e2e/helper'; import { pluginReact } from '@rsbuild/plugin-react'; const cwd = __dirname; diff --git a/e2e/cases/server/history-api-fallback/src/App.jsx b/e2e/cases/server/history-api-fallback/src/App.jsx index 81404ba450..fb5a2217e0 100644 --- a/e2e/cases/server/history-api-fallback/src/App.jsx +++ b/e2e/cases/server/history-api-fallback/src/App.jsx @@ -1,4 +1,4 @@ -import { BrowserRouter, Link, Route, Routes, Outlet } from 'react-router-dom'; +import { BrowserRouter, Link, Outlet, Route, Routes } from 'react-router-dom'; export const App = () => ( diff --git a/e2e/cases/server/htmlFallback.test.ts b/e2e/cases/server/htmlFallback.test.ts index e31cc8127e..35fe8649ea 100644 --- a/e2e/cases/server/htmlFallback.test.ts +++ b/e2e/cases/server/htmlFallback.test.ts @@ -1,7 +1,7 @@ +import fs from 'node:fs'; import { join } from 'node:path'; -import { expect, test } from '@playwright/test'; import { dev } from '@e2e/helper'; -import fs from 'node:fs'; +import { expect, test } from '@playwright/test'; const fixtures = __dirname; diff --git a/e2e/cases/server/ipv6-host/index.test.ts b/e2e/cases/server/ipv6-host/index.test.ts index 50f2c83bf4..17ec9f90ba 100644 --- a/e2e/cases/server/ipv6-host/index.test.ts +++ b/e2e/cases/server/ipv6-host/index.test.ts @@ -1,6 +1,6 @@ import { URL } from 'node:url'; -import { expect, test } from '@playwright/test'; import { dev } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should allow to listen ipv6 host', async ({ page }) => { const rsbuild = await dev({ diff --git a/e2e/cases/server/overlay/index.test.ts b/e2e/cases/server/overlay/index.test.ts index 252185dfb4..19dcc4895b 100644 --- a/e2e/cases/server/overlay/index.test.ts +++ b/e2e/cases/server/overlay/index.test.ts @@ -1,6 +1,6 @@ -import { expect, test } from '@playwright/test'; -import { dev, gotoPage, proxyConsole } from '@e2e/helper'; import { join } from 'node:path'; +import { dev, gotoPage, proxyConsole } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { fse } from '@rsbuild/shared'; const cwd = __dirname; diff --git a/e2e/cases/server/port/index.test.ts b/e2e/cases/server/port/index.test.ts index b326179498..aff40b3b26 100644 --- a/e2e/cases/server/port/index.test.ts +++ b/e2e/cases/server/port/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { dev, getRandomPort, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should allow to set port via server.port', async ({ page }) => { const errors: string[] = []; diff --git a/e2e/cases/server/print-urls/index.test.ts b/e2e/cases/server/print-urls/index.test.ts index 1c19eca876..e05ce97339 100644 --- a/e2e/cases/server/print-urls/index.test.ts +++ b/e2e/cases/server/print-urls/index.test.ts @@ -1,5 +1,5 @@ -import { test, expect } from '@playwright/test'; import { dev, proxyConsole } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; const cwd = __dirname; diff --git a/e2e/cases/server/proxy/index.test.ts b/e2e/cases/server/proxy/index.test.ts index c9a8709dfb..00567b397d 100644 --- a/e2e/cases/server/proxy/index.test.ts +++ b/e2e/cases/server/proxy/index.test.ts @@ -1,6 +1,6 @@ import { join } from 'node:path'; -import { expect, test } from '@playwright/test'; import { dev } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; const prj1 = join(__dirname, 'project1'); const prj2 = join(__dirname, 'project2'); diff --git a/e2e/cases/server/public-dir-with-template/index.test.ts b/e2e/cases/server/public-dir-with-template/index.test.ts index 401a017eb3..db9d2b62ca 100644 --- a/e2e/cases/server/public-dir-with-template/index.test.ts +++ b/e2e/cases/server/public-dir-with-template/index.test.ts @@ -1,5 +1,5 @@ +import { build, dev } from '@e2e/helper'; import { expect, test } from '@playwright/test'; -import { dev, build } from '@e2e/helper'; const cwd = __dirname; diff --git a/e2e/cases/server/public-dir/publicDir.test.ts b/e2e/cases/server/public-dir/publicDir.test.ts index 4371647502..74aa1ab67a 100644 --- a/e2e/cases/server/public-dir/publicDir.test.ts +++ b/e2e/cases/server/public-dir/publicDir.test.ts @@ -1,6 +1,6 @@ import { join } from 'node:path'; +import { build, dev } from '@e2e/helper'; import { expect, test } from '@playwright/test'; -import { dev, build } from '@e2e/helper'; const cwd = __dirname; diff --git a/e2e/cases/server/writeToDisk.test.ts b/e2e/cases/server/writeToDisk.test.ts index 0fff8b4e02..b1de3265be 100644 --- a/e2e/cases/server/writeToDisk.test.ts +++ b/e2e/cases/server/writeToDisk.test.ts @@ -1,6 +1,6 @@ import { join } from 'node:path'; -import { expect, test } from '@playwright/test'; import { dev, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; const fixtures = __dirname; diff --git a/e2e/cases/solid/hmr/index.test.ts b/e2e/cases/solid/hmr/index.test.ts index 23629b6a55..442c90a755 100644 --- a/e2e/cases/solid/hmr/index.test.ts +++ b/e2e/cases/solid/hmr/index.test.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; -import { test, expect } from '@playwright/test'; import { dev, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; rspackOnlyTest('hmr should work properly', async ({ page }) => { // HMR cases will fail in Windows diff --git a/e2e/cases/solid/index.test.ts b/e2e/cases/solid/index.test.ts index 84bb7f15a3..a195c480bf 100644 --- a/e2e/cases/solid/index.test.ts +++ b/e2e/cases/solid/index.test.ts @@ -1,9 +1,9 @@ import path from 'node:path'; +import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; import { expect } from '@playwright/test'; import { pluginBabel } from '@rsbuild/plugin-babel'; import { pluginSolid } from '@rsbuild/plugin-solid'; import { pluginStylus } from '@rsbuild/plugin-stylus'; -import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; const buildFixture = (rootDir: string): ReturnType => { const root = path.join(__dirname, rootDir); diff --git a/e2e/cases/solid/ref/index.test.ts b/e2e/cases/solid/ref/index.test.ts index 7ac4fd7ddb..726a3a997c 100644 --- a/e2e/cases/solid/ref/index.test.ts +++ b/e2e/cases/solid/ref/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { dev, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; // https://github.com/web-infra-dev/rsbuild/issues/1963 rspackOnlyTest('Solid ref should work', async ({ page }) => { diff --git a/e2e/cases/source-build/app/rsbuild.config.ts b/e2e/cases/source-build/app/rsbuild.config.ts index 721cc5dc39..3af8cb1634 100644 --- a/e2e/cases/source-build/app/rsbuild.config.ts +++ b/e2e/cases/source-build/app/rsbuild.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from '@rsbuild/core'; +import { pluginReact } from '@rsbuild/plugin-react'; import { pluginSourceBuild } from '@rsbuild/plugin-source-build'; import { pluginTypeCheck } from '@rsbuild/plugin-type-check'; -import { pluginReact } from '@rsbuild/plugin-react'; export default defineConfig({ plugins: [pluginSourceBuild(), pluginReact(), pluginTypeCheck()], diff --git a/e2e/cases/source-build/index.test.ts b/e2e/cases/source-build/index.test.ts index 590a8cd3db..df1b32cd8e 100644 --- a/e2e/cases/source-build/index.test.ts +++ b/e2e/cases/source-build/index.test.ts @@ -1,6 +1,6 @@ import { join } from 'node:path'; -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; const fixture = join(__dirname, 'app'); diff --git a/e2e/cases/source-map/source.test.ts b/e2e/cases/source-map/source.test.ts index 00a08177fe..d523db6ddc 100644 --- a/e2e/cases/source-map/source.test.ts +++ b/e2e/cases/source-map/source.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginReact } from '@rsbuild/plugin-react'; import sourceMap from 'source-map'; diff --git a/e2e/cases/source/alias-by-target/index.test.ts b/e2e/cases/source/alias-by-target/index.test.ts index 9593b88f6a..ab6005087b 100644 --- a/e2e/cases/source/alias-by-target/index.test.ts +++ b/e2e/cases/source/alias-by-target/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should allow to set alias by build target', async () => { const rsbuild = await build({ diff --git a/e2e/cases/source/custom-tsconfig/index.test.ts b/e2e/cases/source/custom-tsconfig/index.test.ts index 86f33262ab..e9398892ee 100644 --- a/e2e/cases/source/custom-tsconfig/index.test.ts +++ b/e2e/cases/source/custom-tsconfig/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('tsconfig paths should work and override the alias config', async ({ page, diff --git a/e2e/cases/source/entry-description-object/index.test.ts b/e2e/cases/source/entry-description-object/index.test.ts index a3e4f5a23a..d8d359c435 100644 --- a/e2e/cases/source/entry-description-object/index.test.ts +++ b/e2e/cases/source/entry-description-object/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { expect, test } from '@playwright/test'; import { build, globContentJSON } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should allow to set entry description object', async () => { await build({ diff --git a/e2e/cases/source/jsconfig-paths/index.test.ts b/e2e/cases/source/jsconfig-paths/index.test.ts index 86c000e187..4aa706a9dc 100644 --- a/e2e/cases/source/jsconfig-paths/index.test.ts +++ b/e2e/cases/source/jsconfig-paths/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; rspackOnlyTest( 'tsconfig paths should work and override the alias config', diff --git a/e2e/cases/source/multiple-entry/index.test.ts b/e2e/cases/source/multiple-entry/index.test.ts index bbcb571575..f1739eb877 100644 --- a/e2e/cases/source/multiple-entry/index.test.ts +++ b/e2e/cases/source/multiple-entry/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should allow to set entry by build target', async () => { const rsbuild = await build({ diff --git a/e2e/cases/source/plugin-import/helper.ts b/e2e/cases/source/plugin-import/helper.ts index 733d681bd9..5d12aa3d25 100644 --- a/e2e/cases/source/plugin-import/helper.ts +++ b/e2e/cases/source/plugin-import/helper.ts @@ -1,8 +1,8 @@ import path from 'node:path'; import { build } from '@e2e/helper'; import { expect, test } from '@playwright/test'; -import { fse } from '@rsbuild/shared'; import type { RsbuildConfig } from '@rsbuild/core'; +import { fse } from '@rsbuild/shared'; import type { TransformImport } from '@rsbuild/shared'; export const cases: Parameters[] = [ diff --git a/e2e/cases/source/plugin-import/index.test.ts b/e2e/cases/source/plugin-import/index.test.ts index e4d86c79b7..931d9a3d94 100644 --- a/e2e/cases/source/plugin-import/index.test.ts +++ b/e2e/cases/source/plugin-import/index.test.ts @@ -1,6 +1,6 @@ import { build } from '@e2e/helper'; import { expect, test } from '@playwright/test'; -import { cases, shareTest, copyPkgToNodeModules, findEntry } from './helper'; +import { cases, copyPkgToNodeModules, findEntry, shareTest } from './helper'; test('should import with template config', async () => { copyPkgToNodeModules(); diff --git a/e2e/cases/source/source-exclude/index.test.ts b/e2e/cases/source/source-exclude/index.test.ts index 75cb659e91..f2f0bd2c95 100644 --- a/e2e/cases/source/source-exclude/index.test.ts +++ b/e2e/cases/source/source-exclude/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { expect, test } from '@playwright/test'; import { build, proxyConsole } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginCheckSyntax } from '@rsbuild/plugin-check-syntax'; import { normalizeToPosixPath } from '@scripts/test-helper'; diff --git a/e2e/cases/source/source-include/index.test.ts b/e2e/cases/source/source-include/index.test.ts index 2524582a71..3d3ffd4301 100644 --- a/e2e/cases/source/source-include/index.test.ts +++ b/e2e/cases/source/source-include/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { expect, test } from '@playwright/test'; import { build, proxyConsole } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginCheckSyntax } from '@rsbuild/plugin-check-syntax'; import { normalizeToPosixPath } from '@scripts/test-helper'; diff --git a/e2e/cases/source/source.test.ts b/e2e/cases/source/source.test.ts index 31b79d4926..806374e555 100644 --- a/e2e/cases/source/source.test.ts +++ b/e2e/cases/source/source.test.ts @@ -1,6 +1,6 @@ import { join } from 'node:path'; -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; const fixtures = __dirname; diff --git a/e2e/cases/source/tsconfig-paths/index.test.ts b/e2e/cases/source/tsconfig-paths/index.test.ts index b4b6df3ae0..309a6a641b 100644 --- a/e2e/cases/source/tsconfig-paths/index.test.ts +++ b/e2e/cases/source/tsconfig-paths/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('tsconfig paths should work and override the alias config', async ({ page, diff --git a/e2e/cases/stats/stats-options/index.test.ts b/e2e/cases/stats/stats-options/index.test.ts index b8c3d73208..6e0c6595ee 100644 --- a/e2e/cases/stats/stats-options/index.test.ts +++ b/e2e/cases/stats/stats-options/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, proxyConsole } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should log warning by default', async () => { const { restore, logs } = proxyConsole(); diff --git a/e2e/cases/stylus-rem/index.test.ts b/e2e/cases/stylus-rem/index.test.ts index dba4703f85..9845846243 100644 --- a/e2e/cases/stylus-rem/index.test.ts +++ b/e2e/cases/stylus-rem/index.test.ts @@ -1,7 +1,7 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; -import { pluginStylus } from '@rsbuild/plugin-stylus'; +import { expect, test } from '@playwright/test'; import { pluginRem } from '@rsbuild/plugin-rem'; +import { pluginStylus } from '@rsbuild/plugin-stylus'; test('should compile stylus and rem correctly', async () => { const rsbuild = await build({ diff --git a/e2e/cases/stylus/index.test.ts b/e2e/cases/stylus/index.test.ts index 936aeaa418..d34cd7c8d0 100644 --- a/e2e/cases/stylus/index.test.ts +++ b/e2e/cases/stylus/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginStylus } from '@rsbuild/plugin-stylus'; test('should compile stylus correctly', async () => { diff --git a/e2e/cases/svelte/index.test.ts b/e2e/cases/svelte/index.test.ts index 429a10af3d..515d8fe8da 100644 --- a/e2e/cases/svelte/index.test.ts +++ b/e2e/cases/svelte/index.test.ts @@ -1,7 +1,7 @@ -import path from 'node:path'; import fs from 'node:fs'; -import { test, expect } from '@playwright/test'; +import path from 'node:path'; import { build, dev, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginSvelte } from '@rsbuild/plugin-svelte'; const buildFixture = ( diff --git a/e2e/cases/svg/svg-assets/index.test.ts b/e2e/cases/svg/svg-assets/index.test.ts index 66bf29d24c..7cc26ec438 100644 --- a/e2e/cases/svg/svg-assets/index.test.ts +++ b/e2e/cases/svg/svg-assets/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('SVGR basic usage', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/svg/svgo-minify-id-prefix/index.test.ts b/e2e/cases/svg/svgo-minify-id-prefix/index.test.ts index 1be918d4ee..e50c361ae6 100644 --- a/e2e/cases/svg/svgo-minify-id-prefix/index.test.ts +++ b/e2e/cases/svg/svgo-minify-id-prefix/index.test.ts @@ -1,6 +1,6 @@ import { readFileSync } from 'node:fs'; -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should add id prefix after svgo minification', async () => { const rsbuild = await build({ diff --git a/e2e/cases/svg/svgo-minify-view-box/index.test.ts b/e2e/cases/svg/svgo-minify-view-box/index.test.ts index 0a200019de..3c53353e1a 100644 --- a/e2e/cases/svg/svgo-minify-view-box/index.test.ts +++ b/e2e/cases/svg/svgo-minify-view-box/index.test.ts @@ -1,6 +1,6 @@ import { readFileSync } from 'node:fs'; -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should preserve viewBox after svgo minification', async () => { const buildOpts = { diff --git a/e2e/cases/svg/svgr-default-export-component/index.test.ts b/e2e/cases/svg/svgr-default-export-component/index.test.ts index 9bc4cbc8a6..ae95f289eb 100644 --- a/e2e/cases/svg/svgr-default-export-component/index.test.ts +++ b/e2e/cases/svg/svgr-default-export-component/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('Use SVGR and default export React component', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/svg/svgr-default-export-url/index.test.ts b/e2e/cases/svg/svgr-default-export-url/index.test.ts index 0f534044bc..dfc9135a73 100644 --- a/e2e/cases/svg/svgr-default-export-url/index.test.ts +++ b/e2e/cases/svg/svgr-default-export-url/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should import default from SVG with SVGR correctly', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/svg/svgr-default-export-url/src/App.jsx b/e2e/cases/svg/svgr-default-export-url/src/App.jsx index 49b445388e..db4d9ee13d 100644 --- a/e2e/cases/svg/svgr-default-export-url/src/App.jsx +++ b/e2e/cases/svg/svgr-default-export-url/src/App.jsx @@ -1,5 +1,5 @@ -import largeImg, { ReactComponent as Logo } from '@assets/mobile.svg'; import smallImg from '@assets/circle.svg'; +import largeImg, { ReactComponent as Logo } from '@assets/mobile.svg'; import './App.css'; function App() { diff --git a/e2e/cases/svg/svgr-disable-emit-asset/index.test.ts b/e2e/cases/svg/svgr-disable-emit-asset/index.test.ts index 7767958db2..e8cfad634e 100644 --- a/e2e/cases/svg/svgr-disable-emit-asset/index.test.ts +++ b/e2e/cases/svg/svgr-disable-emit-asset/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should import svg with SVGR plugin and query URL correctly', async () => { const rsbuild = await build({ diff --git a/e2e/cases/svg/svgr-exclude-importer/index.test.ts b/e2e/cases/svg/svgr-exclude-importer/index.test.ts index bd985bbfc0..d1404ea49c 100644 --- a/e2e/cases/svg/svgr-exclude-importer/index.test.ts +++ b/e2e/cases/svg/svgr-exclude-importer/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('Use SVGR and exclude some files', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/svg/svgr-exclude-importer/src/index.jsx b/e2e/cases/svg/svgr-exclude-importer/src/index.jsx index 75f3c28dc0..5d1fd7163e 100644 --- a/e2e/cases/svg/svgr-exclude-importer/src/index.jsx +++ b/e2e/cases/svg/svgr-exclude-importer/src/index.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { createRoot } from 'react-dom/client'; -import Foo from './Foo'; import Bar from './Bar'; +import Foo from './Foo'; const container = document.getElementById('root'); if (container) { diff --git a/e2e/cases/svg/svgr-exclude/index.test.ts b/e2e/cases/svg/svgr-exclude/index.test.ts index bd985bbfc0..d1404ea49c 100644 --- a/e2e/cases/svg/svgr-exclude/index.test.ts +++ b/e2e/cases/svg/svgr-exclude/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('Use SVGR and exclude some files', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/svg/svgr-exclude/src/index.jsx b/e2e/cases/svg/svgr-exclude/src/index.jsx index 75f3c28dc0..5d1fd7163e 100644 --- a/e2e/cases/svg/svgr-exclude/src/index.jsx +++ b/e2e/cases/svg/svgr-exclude/src/index.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { createRoot } from 'react-dom/client'; -import Foo from './Foo'; import Bar from './Bar'; +import Foo from './Foo'; const container = document.getElementById('root'); if (container) { diff --git a/e2e/cases/svg/svgr-external-react/index.test.ts b/e2e/cases/svg/svgr-external-react/index.test.ts index 02b9f916f2..cf388dfffa 100644 --- a/e2e/cases/svg/svgr-external-react/index.test.ts +++ b/e2e/cases/svg/svgr-external-react/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; // It's an old bug when use svgr in css and external react. test('Use SVGR and externals react', async ({ page }) => { diff --git a/e2e/cases/svg/svgr-mdx/index.test.ts b/e2e/cases/svg/svgr-mdx/index.test.ts index ec39650825..2270b86a04 100644 --- a/e2e/cases/svg/svgr-mdx/index.test.ts +++ b/e2e/cases/svg/svgr-mdx/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should import default from SVG with react query correctly', async ({ page, diff --git a/e2e/cases/svg/svgr-mdx/rsbuild.config.ts b/e2e/cases/svg/svgr-mdx/rsbuild.config.ts index b820ea22bc..20d629632d 100644 --- a/e2e/cases/svg/svgr-mdx/rsbuild.config.ts +++ b/e2e/cases/svg/svgr-mdx/rsbuild.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from '@rsbuild/core'; +import { pluginMdx } from '@rsbuild/plugin-mdx'; import { pluginReact } from '@rsbuild/plugin-react'; import { pluginSvgr } from '@rsbuild/plugin-svgr'; -import { pluginMdx } from '@rsbuild/plugin-mdx'; export default defineConfig({ plugins: [ diff --git a/e2e/cases/svg/svgr-named-export-component/index.test.ts b/e2e/cases/svg/svgr-named-export-component/index.test.ts index 9bc4cbc8a6..ae95f289eb 100644 --- a/e2e/cases/svg/svgr-named-export-component/index.test.ts +++ b/e2e/cases/svg/svgr-named-export-component/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('Use SVGR and default export React component', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/svg/svgr-query-custom/index.test.ts b/e2e/cases/svg/svgr-query-custom/index.test.ts index 92eacea413..587c91079b 100644 --- a/e2e/cases/svg/svgr-query-custom/index.test.ts +++ b/e2e/cases/svg/svgr-query-custom/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should import default from SVG with custom query correctly', async ({ page, diff --git a/e2e/cases/svg/svgr-query-custom/src/App.jsx b/e2e/cases/svg/svgr-query-custom/src/App.jsx index 75dc0faec4..4c764f3152 100644 --- a/e2e/cases/svg/svgr-query-custom/src/App.jsx +++ b/e2e/cases/svg/svgr-query-custom/src/App.jsx @@ -1,5 +1,5 @@ -import url from '@assets/circle.svg?url'; import Component from '@assets/circle.svg?custom'; +import url from '@assets/circle.svg?url'; function App() { return ( diff --git a/e2e/cases/svg/svgr-query-react-dynamic-import/index.test.ts b/e2e/cases/svg/svgr-query-react-dynamic-import/index.test.ts index d852bd725c..182e51a667 100644 --- a/e2e/cases/svg/svgr-query-react-dynamic-import/index.test.ts +++ b/e2e/cases/svg/svgr-query-react-dynamic-import/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; // https://github.com/web-infra-dev/rsbuild/issues/1766 test('should import default from SVG with react query and dynamic import correctly', async ({ diff --git a/e2e/cases/svg/svgr-query-react/index.test.ts b/e2e/cases/svg/svgr-query-react/index.test.ts index bf25b0dfd2..3fdc2697b7 100644 --- a/e2e/cases/svg/svgr-query-react/index.test.ts +++ b/e2e/cases/svg/svgr-query-react/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should import default from SVG with react query correctly', async ({ page, diff --git a/e2e/cases/svg/svgr-query-react/src/App.jsx b/e2e/cases/svg/svgr-query-react/src/App.jsx index 243f40a92e..89aa37ddb5 100644 --- a/e2e/cases/svg/svgr-query-react/src/App.jsx +++ b/e2e/cases/svg/svgr-query-react/src/App.jsx @@ -1,5 +1,5 @@ -import url from '@assets/circle.svg?url'; import Component from '@assets/circle.svg?react'; +import url from '@assets/circle.svg?url'; function App() { return ( diff --git a/e2e/cases/svg/svgr-query-url/index.test.ts b/e2e/cases/svg/svgr-query-url/index.test.ts index c5546a302b..3d60f68eaa 100644 --- a/e2e/cases/svg/svgr-query-url/index.test.ts +++ b/e2e/cases/svg/svgr-query-url/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should import svg with SVGR plugin and query URL correctly', async ({ page, diff --git a/e2e/cases/swc-plugin/index.test.ts b/e2e/cases/swc-plugin/index.test.ts index f0f7473c65..c59e16106c 100644 --- a/e2e/cases/swc-plugin/index.test.ts +++ b/e2e/cases/swc-plugin/index.test.ts @@ -1,5 +1,5 @@ +import { build, dev, gotoPage, rspackOnlyTest } from '@e2e/helper'; import { expect } from '@playwright/test'; -import { dev, build, gotoPage, rspackOnlyTest } from '@e2e/helper'; rspackOnlyTest( 'should run SWC Wasm plugin correctly in dev mode', diff --git a/e2e/cases/top-level-await/index.test.ts b/e2e/cases/top-level-await/index.test.ts index 9504c06e2d..7ab25931c0 100644 --- a/e2e/cases/top-level-await/index.test.ts +++ b/e2e/cases/top-level-await/index.test.ts @@ -1,5 +1,5 @@ -import { test, expect } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should run top level await correctly', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/transform-lodash/index.test.ts b/e2e/cases/transform-lodash/index.test.ts index eec55ebaa5..65318b1aee 100644 --- a/e2e/cases/transform-lodash/index.test.ts +++ b/e2e/cases/transform-lodash/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should support using transformImport to reduce lodash bundle size', async () => { const rsbuild = await build({ diff --git a/e2e/cases/type-check/basic/index.test.ts b/e2e/cases/type-check/basic/index.test.ts index db8ddd52c0..88c39d10f0 100644 --- a/e2e/cases/type-check/basic/index.test.ts +++ b/e2e/cases/type-check/basic/index.test.ts @@ -1,7 +1,7 @@ -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; -import { pluginTypeCheck } from '@rsbuild/plugin-type-check'; import { proxyConsole } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; +import { pluginTypeCheck } from '@rsbuild/plugin-type-check'; test('should throw error when exist type errors', async () => { const { logs, restore } = proxyConsole(); diff --git a/e2e/cases/type-check/exclude-node-modules/index.test.ts b/e2e/cases/type-check/exclude-node-modules/index.test.ts index 67432a6acc..a0827cfe8f 100644 --- a/e2e/cases/type-check/exclude-node-modules/index.test.ts +++ b/e2e/cases/type-check/exclude-node-modules/index.test.ts @@ -1,6 +1,6 @@ -import { expect, test } from '@playwright/test'; -import { build } from '@e2e/helper'; import { join } from 'node:path'; +import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { fse } from '@rsbuild/shared'; function createFooPackage() { diff --git a/e2e/cases/typescript/index.test.ts b/e2e/cases/typescript/index.test.ts index a36ae55876..1772299d3c 100644 --- a/e2e/cases/typescript/index.test.ts +++ b/e2e/cases/typescript/index.test.ts @@ -1,5 +1,5 @@ -import { test, expect } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; // TODO not supported yet test.skip('should compile const enum correctly', async () => { diff --git a/e2e/cases/umd/basic/index.test.ts b/e2e/cases/umd/basic/index.test.ts index b52ce52cab..6c8defb892 100644 --- a/e2e/cases/umd/basic/index.test.ts +++ b/e2e/cases/umd/basic/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should generate UMD bundle correctly', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/umd/export-array/index.test.ts b/e2e/cases/umd/export-array/index.test.ts index 97d9ed1b0c..5749714522 100644 --- a/e2e/cases/umd/export-array/index.test.ts +++ b/e2e/cases/umd/export-array/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should generate UMD bundle with default export correctly', async ({ page, diff --git a/e2e/cases/umd/export/index.test.ts b/e2e/cases/umd/export/index.test.ts index 97d9ed1b0c..5749714522 100644 --- a/e2e/cases/umd/export/index.test.ts +++ b/e2e/cases/umd/export/index.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should generate UMD bundle with default export correctly', async ({ page, diff --git a/e2e/cases/vue/jsx-basic/index.test.ts b/e2e/cases/vue/jsx-basic/index.test.ts index 0240c3996f..0ab5161a94 100644 --- a/e2e/cases/vue/jsx-basic/index.test.ts +++ b/e2e/cases/vue/jsx-basic/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest('should build basic Vue jsx correctly', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/vue/jsx-basic/rsbuild.config.ts b/e2e/cases/vue/jsx-basic/rsbuild.config.ts index a7108d4483..b148ab5a92 100644 --- a/e2e/cases/vue/jsx-basic/rsbuild.config.ts +++ b/e2e/cases/vue/jsx-basic/rsbuild.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from '@rsbuild/core'; +import { pluginBabel } from '@rsbuild/plugin-babel'; import { pluginVue } from '@rsbuild/plugin-vue'; import { pluginVueJsx } from '@rsbuild/plugin-vue-jsx'; -import { pluginBabel } from '@rsbuild/plugin-babel'; export default defineConfig({ plugins: [ diff --git a/e2e/cases/vue/jsx-basic/src/A.jsx b/e2e/cases/vue/jsx-basic/src/A.jsx index e49ad9c159..22d6237152 100644 --- a/e2e/cases/vue/jsx-basic/src/A.jsx +++ b/e2e/cases/vue/jsx-basic/src/A.jsx @@ -1,4 +1,4 @@ -import { ref, defineComponent } from 'vue'; +import { defineComponent, ref } from 'vue'; export default defineComponent({ name: 'Test', diff --git a/e2e/cases/vue/jsx-hmr/index.test.ts b/e2e/cases/vue/jsx-hmr/index.test.ts index b761e8f8e9..6d5fea947c 100644 --- a/e2e/cases/vue/jsx-hmr/index.test.ts +++ b/e2e/cases/vue/jsx-hmr/index.test.ts @@ -1,7 +1,7 @@ -import { expect, test, type Page } from '@playwright/test'; -import { dev, gotoPage, rspackOnlyTest } from '@e2e/helper'; -import path from 'node:path'; import fs from 'node:fs'; +import path from 'node:path'; +import { dev, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { type Page, expect, test } from '@playwright/test'; rspackOnlyTest('should render', async ({ page }) => { const rsbuild = await dev({ diff --git a/e2e/cases/vue/jsx-hmr/rsbuild.config.ts b/e2e/cases/vue/jsx-hmr/rsbuild.config.ts index 877442a3ee..fb83f410f3 100644 --- a/e2e/cases/vue/jsx-hmr/rsbuild.config.ts +++ b/e2e/cases/vue/jsx-hmr/rsbuild.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from '@rsbuild/core'; +import { pluginBabel } from '@rsbuild/plugin-babel'; import { pluginVue } from '@rsbuild/plugin-vue'; import { pluginVueJsx } from '@rsbuild/plugin-vue-jsx'; -import { pluginBabel } from '@rsbuild/plugin-babel'; export default defineConfig({ plugins: [ diff --git a/e2e/cases/vue/jsx-hmr/src/index.jsx b/e2e/cases/vue/jsx-hmr/src/index.jsx index ce9d1ef5a8..7d74335600 100644 --- a/e2e/cases/vue/jsx-hmr/src/index.jsx +++ b/e2e/cases/vue/jsx-hmr/src/index.jsx @@ -1,10 +1,10 @@ import { createApp } from 'vue'; -import { Named, NamedSpec, default as Default } from './Comps'; import { default as TsxDefault } from './Comp'; +import { default as Default, Named, NamedSpec } from './Comps'; import JsxScript from './Script.vue'; import JsxSrcImport from './SrcImport.vue'; -import JsxSetupSyntax from './setup-syntax-jsx.vue'; import TsImport from './TsImport.vue'; +import JsxSetupSyntax from './setup-syntax-jsx.vue'; function App() { return ( diff --git a/e2e/cases/vue/sfc-basic/index.test.ts b/e2e/cases/vue/sfc-basic/index.test.ts index c0a19d8531..1ee7d018fa 100644 --- a/e2e/cases/vue/sfc-basic/index.test.ts +++ b/e2e/cases/vue/sfc-basic/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest('should build basic Vue sfc correctly', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/vue/sfc-lang-jsx/index.test.ts b/e2e/cases/vue/sfc-lang-jsx/index.test.ts index 42ccf98f7d..c175ac6380 100644 --- a/e2e/cases/vue/sfc-lang-jsx/index.test.ts +++ b/e2e/cases/vue/sfc-lang-jsx/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest( 'should build Vue sfc with lang="jsx" correctly', diff --git a/e2e/cases/vue/sfc-lang-jsx/rsbuild.config.ts b/e2e/cases/vue/sfc-lang-jsx/rsbuild.config.ts index a7108d4483..b148ab5a92 100644 --- a/e2e/cases/vue/sfc-lang-jsx/rsbuild.config.ts +++ b/e2e/cases/vue/sfc-lang-jsx/rsbuild.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from '@rsbuild/core'; +import { pluginBabel } from '@rsbuild/plugin-babel'; import { pluginVue } from '@rsbuild/plugin-vue'; import { pluginVueJsx } from '@rsbuild/plugin-vue-jsx'; -import { pluginBabel } from '@rsbuild/plugin-babel'; export default defineConfig({ plugins: [ diff --git a/e2e/cases/vue/sfc-lang-ts/index.test.ts b/e2e/cases/vue/sfc-lang-ts/index.test.ts index a089970668..4581a33743 100644 --- a/e2e/cases/vue/sfc-lang-ts/index.test.ts +++ b/e2e/cases/vue/sfc-lang-ts/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest( 'should build Vue sfc with lang="ts" correctly', diff --git a/e2e/cases/vue/sfc-lang-tsx/index.test.ts b/e2e/cases/vue/sfc-lang-tsx/index.test.ts index ed13bec0eb..e6287e6871 100644 --- a/e2e/cases/vue/sfc-lang-tsx/index.test.ts +++ b/e2e/cases/vue/sfc-lang-tsx/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest( 'should build Vue sfc with lang="tsx" correctly', diff --git a/e2e/cases/vue/sfc-lang-tsx/rsbuild.config.ts b/e2e/cases/vue/sfc-lang-tsx/rsbuild.config.ts index a7108d4483..b148ab5a92 100644 --- a/e2e/cases/vue/sfc-lang-tsx/rsbuild.config.ts +++ b/e2e/cases/vue/sfc-lang-tsx/rsbuild.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from '@rsbuild/core'; +import { pluginBabel } from '@rsbuild/plugin-babel'; import { pluginVue } from '@rsbuild/plugin-vue'; import { pluginVueJsx } from '@rsbuild/plugin-vue-jsx'; -import { pluginBabel } from '@rsbuild/plugin-babel'; export default defineConfig({ plugins: [ diff --git a/e2e/cases/vue/sfc-style/index.test.ts b/e2e/cases/vue/sfc-style/index.test.ts index 8c6684c566..2d84069ca7 100644 --- a/e2e/cases/vue/sfc-style/index.test.ts +++ b/e2e/cases/vue/sfc-style/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest('should build Vue sfc style correctly', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/vue/sfc-style/src/index.js b/e2e/cases/vue/sfc-style/src/index.js index 11ab86700c..edcf645060 100644 --- a/e2e/cases/vue/sfc-style/src/index.js +++ b/e2e/cases/vue/sfc-style/src/index.js @@ -1,5 +1,5 @@ import { createApp } from 'vue'; -import './a.less'; import App from './App.vue'; +import './a.less'; createApp(App).mount('#root'); diff --git a/e2e/cases/vue/split-chunk/index.test.ts b/e2e/cases/vue/split-chunk/index.test.ts index 4527bf5f69..ee38f4e9a6 100644 --- a/e2e/cases/vue/split-chunk/index.test.ts +++ b/e2e/cases/vue/split-chunk/index.test.ts @@ -1,5 +1,5 @@ -import { test, expect } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginVue } from '@rsbuild/plugin-vue'; const fixtures = __dirname; diff --git a/e2e/cases/vue2/jsx-basic/index.test.ts b/e2e/cases/vue2/jsx-basic/index.test.ts index 0240c3996f..0ab5161a94 100644 --- a/e2e/cases/vue2/jsx-basic/index.test.ts +++ b/e2e/cases/vue2/jsx-basic/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest('should build basic Vue jsx correctly', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/vue2/jsx-basic/rsbuild.config.ts b/e2e/cases/vue2/jsx-basic/rsbuild.config.ts index 2507a08c91..0b0a282353 100644 --- a/e2e/cases/vue2/jsx-basic/rsbuild.config.ts +++ b/e2e/cases/vue2/jsx-basic/rsbuild.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from '@rsbuild/core'; +import { pluginBabel } from '@rsbuild/plugin-babel'; import { pluginVue2 } from '@rsbuild/plugin-vue2'; import { pluginVue2Jsx } from '@rsbuild/plugin-vue2-jsx'; -import { pluginBabel } from '@rsbuild/plugin-babel'; export default defineConfig({ plugins: [ diff --git a/e2e/cases/vue2/sfc-basic/index.test.ts b/e2e/cases/vue2/sfc-basic/index.test.ts index c0a19d8531..1ee7d018fa 100644 --- a/e2e/cases/vue2/sfc-basic/index.test.ts +++ b/e2e/cases/vue2/sfc-basic/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest('should build basic Vue sfc correctly', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/vue2/sfc-lang-jsx/index.test.ts b/e2e/cases/vue2/sfc-lang-jsx/index.test.ts index 42ccf98f7d..c175ac6380 100644 --- a/e2e/cases/vue2/sfc-lang-jsx/index.test.ts +++ b/e2e/cases/vue2/sfc-lang-jsx/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest( 'should build Vue sfc with lang="jsx" correctly', diff --git a/e2e/cases/vue2/sfc-lang-jsx/rsbuild.config.ts b/e2e/cases/vue2/sfc-lang-jsx/rsbuild.config.ts index 2507a08c91..0b0a282353 100644 --- a/e2e/cases/vue2/sfc-lang-jsx/rsbuild.config.ts +++ b/e2e/cases/vue2/sfc-lang-jsx/rsbuild.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from '@rsbuild/core'; +import { pluginBabel } from '@rsbuild/plugin-babel'; import { pluginVue2 } from '@rsbuild/plugin-vue2'; import { pluginVue2Jsx } from '@rsbuild/plugin-vue2-jsx'; -import { pluginBabel } from '@rsbuild/plugin-babel'; export default defineConfig({ plugins: [ diff --git a/e2e/cases/vue2/sfc-lang-ts/index.test.ts b/e2e/cases/vue2/sfc-lang-ts/index.test.ts index a089970668..4581a33743 100644 --- a/e2e/cases/vue2/sfc-lang-ts/index.test.ts +++ b/e2e/cases/vue2/sfc-lang-ts/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest( 'should build Vue sfc with lang="ts" correctly', diff --git a/e2e/cases/vue2/sfc-lang-tsx/index.test.ts b/e2e/cases/vue2/sfc-lang-tsx/index.test.ts index ed13bec0eb..e6287e6871 100644 --- a/e2e/cases/vue2/sfc-lang-tsx/index.test.ts +++ b/e2e/cases/vue2/sfc-lang-tsx/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest } from '@e2e/helper'; +import { expect } from '@playwright/test'; rspackOnlyTest( 'should build Vue sfc with lang="tsx" correctly', diff --git a/e2e/cases/vue2/sfc-lang-tsx/rsbuild.config.ts b/e2e/cases/vue2/sfc-lang-tsx/rsbuild.config.ts index 2507a08c91..0b0a282353 100644 --- a/e2e/cases/vue2/sfc-lang-tsx/rsbuild.config.ts +++ b/e2e/cases/vue2/sfc-lang-tsx/rsbuild.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from '@rsbuild/core'; +import { pluginBabel } from '@rsbuild/plugin-babel'; import { pluginVue2 } from '@rsbuild/plugin-vue2'; import { pluginVue2Jsx } from '@rsbuild/plugin-vue2-jsx'; -import { pluginBabel } from '@rsbuild/plugin-babel'; export default defineConfig({ plugins: [ diff --git a/e2e/cases/vue2/sfc-style/index.test.ts b/e2e/cases/vue2/sfc-style/index.test.ts index 03b3777a9f..a9bb13caa3 100644 --- a/e2e/cases/vue2/sfc-style/index.test.ts +++ b/e2e/cases/vue2/sfc-style/index.test.ts @@ -1,5 +1,5 @@ -import { expect } from '@playwright/test'; import { build, gotoPage, rspackOnlyTest as test } from '@e2e/helper'; +import { expect } from '@playwright/test'; test('should build Vue sfc style correctly', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/vue2/split-chunk/index.test.ts b/e2e/cases/vue2/split-chunk/index.test.ts index f934ed18eb..208d569214 100644 --- a/e2e/cases/vue2/split-chunk/index.test.ts +++ b/e2e/cases/vue2/split-chunk/index.test.ts @@ -1,5 +1,5 @@ -import { test, expect } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; import { pluginVue2 } from '@rsbuild/plugin-vue2'; const fixtures = __dirname; diff --git a/e2e/cases/wasm/index.test.ts b/e2e/cases/wasm/index.test.ts index edcc7bdbe4..2e936b9343 100644 --- a/e2e/cases/wasm/index.test.ts +++ b/e2e/cases/wasm/index.test.ts @@ -1,6 +1,6 @@ import { join } from 'node:path'; -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should allow to import wasm file', async ({ page }) => { const root = join(__dirname, 'wasm-basic'); diff --git a/e2e/cases/web-worker/new-worker/index.test.ts b/e2e/cases/web-worker/new-worker/index.test.ts index 307d57533c..89578434f6 100644 --- a/e2e/cases/web-worker/new-worker/index.test.ts +++ b/e2e/cases/web-worker/new-worker/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { expect, test } from '@playwright/test'; import { build, gotoPage } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should allow to build web-worker with new Worker', async ({ page }) => { const rsbuild = await build({ diff --git a/e2e/cases/web-worker/web-worker-target/index.test.ts b/e2e/cases/web-worker/web-worker-target/index.test.ts index 96228d0946..9e31d0e87a 100644 --- a/e2e/cases/web-worker/web-worker-target/index.test.ts +++ b/e2e/cases/web-worker/web-worker-target/index.test.ts @@ -1,6 +1,6 @@ import path from 'node:path'; -import { expect, test } from '@playwright/test'; import { build } from '@e2e/helper'; +import { expect, test } from '@playwright/test'; test('should build web-worker target correctly', async () => { const rsbuild = await build({ diff --git a/e2e/scripts/helper.ts b/e2e/scripts/helper.ts index 6e3710f47f..6143f7f0a8 100644 --- a/e2e/scripts/helper.ts +++ b/e2e/scripts/helper.ts @@ -1,7 +1,7 @@ import { platform } from 'node:os'; import { join } from 'node:path'; import { test } from '@playwright/test'; -import { fse, type ConsoleType, castArray } from '@rsbuild/shared'; +import { type ConsoleType, castArray, fse } from '@rsbuild/shared'; import glob, { convertPathToPattern, type Options as GlobOptions, diff --git a/e2e/scripts/shared.ts b/e2e/scripts/shared.ts index 09d3279cfa..2fd8e3d0d2 100644 --- a/e2e/scripts/shared.ts +++ b/e2e/scripts/shared.ts @@ -1,17 +1,17 @@ -import net from 'node:net'; -import { URL } from 'node:url'; import assert from 'node:assert'; +import net from 'node:net'; import { join } from 'node:path'; -import { fse } from '@rsbuild/shared'; -import { globContentJSON } from './helper'; -import { pluginSwc } from '@rsbuild/plugin-swc'; +import { URL } from 'node:url'; import type { + CreateRsbuildOptions, RsbuildConfig, RsbuildPlugin, RsbuildPlugins, - CreateRsbuildOptions, } from '@rsbuild/core'; +import { pluginSwc } from '@rsbuild/plugin-swc'; +import { fse } from '@rsbuild/shared'; import type { Page } from 'playwright'; +import { globContentJSON } from './helper'; export const getHrefByEntryName = (entryName: string, port: number) => { const htmlRoot = new URL(`http://localhost:${port}`); diff --git a/examples/lit/src/my-element.js b/examples/lit/src/my-element.js index 90194bde7b..49fce96a30 100644 --- a/examples/lit/src/my-element.js +++ b/examples/lit/src/my-element.js @@ -1,5 +1,5 @@ // biome-ignore lint/style/useFilenamingConvention: lint components use kebab-case -import { html, css, LitElement } from 'lit'; +import { LitElement, css, html } from 'lit'; export class MyElement extends LitElement { static styles = css` diff --git a/examples/mdx/rsbuild.config.ts b/examples/mdx/rsbuild.config.ts index 1cc049f396..306729f132 100644 --- a/examples/mdx/rsbuild.config.ts +++ b/examples/mdx/rsbuild.config.ts @@ -1,6 +1,6 @@ import { defineConfig } from '@rsbuild/core'; -import { pluginReact } from '@rsbuild/plugin-react'; import { pluginMdx } from '@rsbuild/plugin-mdx'; +import { pluginReact } from '@rsbuild/plugin-react'; export default defineConfig({ plugins: [pluginReact(), pluginMdx()], diff --git a/examples/module-federation/host/moduleFederation.config.ts b/examples/module-federation/host/moduleFederation.config.ts index 0fb7a5d12e..2ad166e4fc 100644 --- a/examples/module-federation/host/moduleFederation.config.ts +++ b/examples/module-federation/host/moduleFederation.config.ts @@ -1,5 +1,5 @@ -import { dependencies } from './package.json'; import type { Rspack } from '@rsbuild/core'; +import { dependencies } from './package.json'; export const mfConfig: Rspack.ModuleFederationPluginOptions = { name: 'host', diff --git a/examples/module-federation/remote/moduleFederation.config.ts b/examples/module-federation/remote/moduleFederation.config.ts index 04ec3dad19..9e2cd99de3 100644 --- a/examples/module-federation/remote/moduleFederation.config.ts +++ b/examples/module-federation/remote/moduleFederation.config.ts @@ -1,5 +1,5 @@ -import { dependencies } from './package.json'; import type { Rspack } from '@rsbuild/core'; +import { dependencies } from './package.json'; export const mfConfig: Rspack.ModuleFederationPluginOptions = { name: 'remote', diff --git a/examples/svelte/src/index.js b/examples/svelte/src/index.js index 6e1ba693db..a946c5b6a7 100644 --- a/examples/svelte/src/index.js +++ b/examples/svelte/src/index.js @@ -1,5 +1,5 @@ -import './index.css'; import App from './App.svelte'; +import './index.css'; const app = new App({ target: document.body, diff --git a/examples/vue2/src/index.js b/examples/vue2/src/index.js index decf834dc9..afef416655 100644 --- a/examples/vue2/src/index.js +++ b/examples/vue2/src/index.js @@ -1,6 +1,6 @@ -import './index.css'; import Vue from 'vue'; import App from './App.vue'; +import './index.css'; new Vue({ el: '#root', diff --git a/examples/vue3/src/index.js b/examples/vue3/src/index.js index 47b051a32e..aa3ede0b4e 100644 --- a/examples/vue3/src/index.js +++ b/examples/vue3/src/index.js @@ -1,5 +1,5 @@ -import './index.css'; import { createApp } from 'vue'; import App from './App.vue'; +import './index.css'; createApp(App).mount('#root'); diff --git a/package.json b/package.json index 17c0e12f33..f25e8ce103 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "check-spell": "npx cspell", "dev:doc": "cd website && pnpm run dev", "build:doc": "cd website && pnpm run build", - "lint": "biome lint . --diagnostic-level=warn && pnpm run check-spell", + "lint": "biome check . --diagnostic-level=warn && pnpm run check-spell", "prepare": "pnpm run build && simple-git-hooks", "sort-package-json": "npx sort-package-json \"packages/*/package.json\" \"packages/compat/*/package.json\"", "test": "pnpm run ut", @@ -33,6 +33,7 @@ "nano-staged": { "*.{md,mdx,json,css,less,scss}": "prettier --write", "*.{js,jsx,ts,tsx,mjs,cjs}": [ + "biome check --apply --formatter-enabled=false --linter-enabled=false", "prettier --write" ], "package.json": "pnpm run check-dependency-version" diff --git a/packages/compat/babel-preset/src/pluginLockCorejsVersion.ts b/packages/compat/babel-preset/src/pluginLockCorejsVersion.ts index 1ecee56176..00faf77e24 100644 --- a/packages/compat/babel-preset/src/pluginLockCorejsVersion.ts +++ b/packages/compat/babel-preset/src/pluginLockCorejsVersion.ts @@ -1,6 +1,6 @@ +import { readFileSync } from 'node:fs'; import nodePath from 'node:path'; import * as t from '@babel/types'; -import { readFileSync } from 'node:fs'; const CORE_JS_PKG_PATH = require.resolve('core-js/package.json'); diff --git a/packages/compat/babel-preset/src/web.ts b/packages/compat/babel-preset/src/web.ts index fde4b348cc..8d0e4e657e 100644 --- a/packages/compat/babel-preset/src/web.ts +++ b/packages/compat/babel-preset/src/web.ts @@ -1,8 +1,8 @@ import { join } from 'node:path'; -import { generateBaseConfig } from './base'; -import type { BabelConfig, WebPresetOptions } from './types'; import type { PresetEnvOptions } from '@rsbuild/plugin-babel'; +import { generateBaseConfig } from './base'; import { getCoreJsVersion } from './pluginLockCorejsVersion'; +import type { BabelConfig, WebPresetOptions } from './types'; const getDefaultPresetEnvOption = ( options: WebPresetOptions, diff --git a/packages/compat/plugin-swc/src/binding.ts b/packages/compat/plugin-swc/src/binding.ts index 1ff1167209..a55408916e 100644 --- a/packages/compat/plugin-swc/src/binding.ts +++ b/packages/compat/plugin-swc/src/binding.ts @@ -1,4 +1,4 @@ -import { Compiler as RawCompiler, type Output } from '@modern-js/swc-plugins'; +import { type Output, Compiler as RawCompiler } from '@modern-js/swc-plugins'; import type { TransformConfig } from './types'; export { diff --git a/packages/compat/plugin-swc/src/loader.ts b/packages/compat/plugin-swc/src/loader.ts index 312935928d..a143c93e9b 100644 --- a/packages/compat/plugin-swc/src/loader.ts +++ b/packages/compat/plugin-swc/src/loader.ts @@ -1,6 +1,6 @@ +import type { Options as SwcOptions } from '@modern-js/swc-plugins'; import { getBrowserslist } from '@rsbuild/shared'; import type { LoaderContext, LoaderDefinitionFunction } from 'webpack'; -import type { Options as SwcOptions } from '@modern-js/swc-plugins'; import { Compiler } from './binding'; import type { TransformConfig } from './types'; diff --git a/packages/compat/plugin-swc/src/minimizer.ts b/packages/compat/plugin-swc/src/minimizer.ts index 8cd9666c57..d0ce44840a 100644 --- a/packages/compat/plugin-swc/src/minimizer.ts +++ b/packages/compat/plugin-swc/src/minimizer.ts @@ -1,16 +1,16 @@ -import type { webpack } from '@rsbuild/webpack'; -import { merge } from 'lodash'; import { logger } from '@rsbuild/core'; import { - color, CSS_REGEX, + type NormalizedConfig, + color, getSwcMinimizerOptions, parseMinifyOptions, - type NormalizedConfig, } from '@rsbuild/shared'; -import type { Output, JsMinifyOptions, CssMinifyOptions } from './types'; +import type { webpack } from '@rsbuild/webpack'; +import { merge } from 'lodash'; import { minify, minifyCss } from './binding'; import { JS_REGEX } from './constants'; +import type { CssMinifyOptions, JsMinifyOptions, Output } from './types'; export interface NormalizedSwcMinifyOption { jsMinify?: JsMinifyOptions; diff --git a/packages/compat/plugin-swc/src/plugin.ts b/packages/compat/plugin-swc/src/plugin.ts index 90fb70fc5e..f2bd2b1f75 100644 --- a/packages/compat/plugin-swc/src/plugin.ts +++ b/packages/compat/plugin-swc/src/plugin.ts @@ -1,22 +1,22 @@ import path from 'node:path'; import { - SCRIPT_REGEX, DEFAULT_BROWSERSLIST, - applyScriptCondition, type RsbuildPlugin, + SCRIPT_REGEX, + applyScriptCondition, parseMinifyOptions, } from '@rsbuild/shared'; +import { SwcMinimizerPlugin } from './minimizer'; import type { - TransformConfig, - PluginSwcOptions, ObjPluginSwcOptions, + PluginSwcOptions, + TransformConfig, } from './types'; import { applyPluginConfig, checkUseMinify, removeUselessOptions, } from './utils'; -import { SwcMinimizerPlugin } from './minimizer'; /** * In this plugin, we do: diff --git a/packages/compat/plugin-swc/src/utils.ts b/packages/compat/plugin-swc/src/utils.ts index 326012e02c..6303964906 100644 --- a/packages/compat/plugin-swc/src/utils.ts +++ b/packages/compat/plugin-swc/src/utils.ts @@ -1,23 +1,23 @@ -import _ from 'lodash'; import fs from 'node:fs'; +import { applySwcDecoratorConfig } from '@rsbuild/core/internal'; import { + type ModifyChainUtils, + type NormalizedConfig, findUp, - isUsingHMR, - getCoreJsVersion, getBrowserslistWithDefault, + getCoreJsVersion, getDefaultStyledComponentsConfig, - type ModifyChainUtils, - type NormalizedConfig, + isUsingHMR, } from '@rsbuild/shared'; import semver from '@rsbuild/shared/semver'; +import _ from 'lodash'; +import { CORE_JS_DIR, CORE_JS_PKG_PATH, SWC_HELPERS_DIR } from './constants'; import { getDefaultSwcConfig } from './plugin'; import type { ObjPluginSwcOptions, PluginSwcOptions, TransformConfig, } from './types'; -import { CORE_JS_DIR, CORE_JS_PKG_PATH, SWC_HELPERS_DIR } from './constants'; -import { applySwcDecoratorConfig } from '@rsbuild/core/internal'; const isBeyondReact17 = async (cwd: string) => { const pkgPath = await findUp({ cwd, filename: 'package.json' }); diff --git a/packages/compat/plugin-swc/tests/concurrent.test.ts b/packages/compat/plugin-swc/tests/concurrent.test.ts index a0bda387f0..4fd065a48d 100644 --- a/packages/compat/plugin-swc/tests/concurrent.test.ts +++ b/packages/compat/plugin-swc/tests/concurrent.test.ts @@ -1,5 +1,5 @@ -import { Compiler } from '../src/binding'; import type { TransformConfig } from '@modern-js/swc-plugins'; +import { Compiler } from '../src/binding'; describe('concurrent compile', async () => { test('transform and transformSync', async () => { diff --git a/packages/compat/plugin-swc/tests/plugin.test.ts b/packages/compat/plugin-swc/tests/plugin.test.ts index 9ba7024e54..eb96b09d22 100644 --- a/packages/compat/plugin-swc/tests/plugin.test.ts +++ b/packages/compat/plugin-swc/tests/plugin.test.ts @@ -1,11 +1,11 @@ -import { createStubRsbuild } from '@scripts/test-helper'; -import { pluginSwc } from '../src'; -import { webpackProvider } from '@rsbuild/webpack'; -import { applyPluginConfig } from '../src/utils'; import type { - NormalizedConfig, ModifyWebpackChainUtils, + NormalizedConfig, } from '@rsbuild/shared'; +import { webpackProvider } from '@rsbuild/webpack'; +import { createStubRsbuild } from '@scripts/test-helper'; +import { pluginSwc } from '../src'; +import { applyPluginConfig } from '../src/utils'; const TEST_BUILDER_CONFIG = { output: {}, diff --git a/packages/compat/webpack/src/build.ts b/packages/compat/webpack/src/build.ts index db1b022afe..32bdf2a3ff 100644 --- a/packages/compat/webpack/src/build.ts +++ b/packages/compat/webpack/src/build.ts @@ -1,19 +1,19 @@ -import { createCompiler } from './createCompiler'; -import { initConfigs, type InitConfigsOptions } from './initConfigs'; import { - logger, - getNodeEnv, - setNodeEnv, - onCompileDone, - type Stats, - type Rspack, - type MultiStats, type BuildOptions, + type MultiStats, + type Rspack, type RspackConfig, + type Stats, + getNodeEnv, + logger, + onCompileDone, + setNodeEnv, } from '@rsbuild/shared'; import type { Configuration as WebpackConfig } from 'webpack'; // @ts-expect-error import WebpackMultiStats from 'webpack/lib/MultiStats'; +import { createCompiler } from './createCompiler'; +import { type InitConfigsOptions, initConfigs } from './initConfigs'; export const build = async ( initOptions: InitConfigsOptions, diff --git a/packages/compat/webpack/src/createCompiler.ts b/packages/compat/webpack/src/createCompiler.ts index bb1f481159..1ed53a80da 100644 --- a/packages/compat/webpack/src/createCompiler.ts +++ b/packages/compat/webpack/src/createCompiler.ts @@ -1,22 +1,22 @@ import { + type InternalContext, + formatStats, + getDevMiddleware, + getStatsOptions, +} from '@rsbuild/core/internal'; +import { + type Rspack, + type RspackConfig, + type Stats, debug, isDev, logger, onCompileDone, - type Stats, - type Rspack, - type RspackConfig, } from '@rsbuild/shared'; -import { - formatStats, - getStatsOptions, - getDevMiddleware, - type InternalContext, -} from '@rsbuild/core/internal'; -import type { WebpackConfig } from './types'; -import { initConfigs, type InitConfigsOptions } from './initConfigs'; // @ts-expect-error import WebpackMultiStats from 'webpack/lib/MultiStats'; +import { type InitConfigsOptions, initConfigs } from './initConfigs'; +import type { WebpackConfig } from './types'; export async function createCompiler({ context, diff --git a/packages/compat/webpack/src/initConfigs.ts b/packages/compat/webpack/src/initConfigs.ts index b37a076424..f4c650f73e 100644 --- a/packages/compat/webpack/src/initConfigs.ts +++ b/packages/compat/webpack/src/initConfigs.ts @@ -1,16 +1,16 @@ import { - isDebug, - type PluginManager, - type InspectConfigOptions, - type CreateRsbuildOptions, -} from '@rsbuild/shared'; -import { - initRsbuildConfig, type InternalContext, + initRsbuildConfig, } from '@rsbuild/core/internal'; +import { + type CreateRsbuildOptions, + type InspectConfigOptions, + type PluginManager, + isDebug, +} from '@rsbuild/shared'; import { inspectConfig } from './inspectConfig'; -import { generateWebpackConfig } from './webpackConfig'; import type { WebpackConfig } from './types'; +import { generateWebpackConfig } from './webpackConfig'; export type InitConfigsOptions = { context: InternalContext; diff --git a/packages/compat/webpack/src/inspectConfig.ts b/packages/compat/webpack/src/inspectConfig.ts index 2a48cf5ce4..c1b479e5b9 100644 --- a/packages/compat/webpack/src/inspectConfig.ts +++ b/packages/compat/webpack/src/inspectConfig.ts @@ -1,14 +1,14 @@ -import { join, isAbsolute } from 'node:path'; -import { initConfigs, type InitConfigsOptions } from './initConfigs'; +import { isAbsolute, join } from 'node:path'; import { - setNodeEnv, + type InspectConfigOptions, + type InspectConfigResult, + type NormalizedConfig, getNodeEnv, - stringifyConfig, outputInspectConfigFiles, - type NormalizedConfig, - type InspectConfigResult, - type InspectConfigOptions, + setNodeEnv, + stringifyConfig, } from '@rsbuild/shared'; +import { type InitConfigsOptions, initConfigs } from './initConfigs'; import type { WebpackConfig } from './types'; export async function inspectConfig({ diff --git a/packages/compat/webpack/src/plugins/copy.ts b/packages/compat/webpack/src/plugins/copy.ts index 29fa754199..0ff63f70ab 100644 --- a/packages/compat/webpack/src/plugins/copy.ts +++ b/packages/compat/webpack/src/plugins/copy.ts @@ -1,5 +1,5 @@ import fs from 'node:fs'; -import type { RsbuildPlugin, CopyPluginOptions } from '@rsbuild/shared'; +import type { CopyPluginOptions, RsbuildPlugin } from '@rsbuild/shared'; export const pluginCopy = (): RsbuildPlugin => ({ name: 'rsbuild-webpack:copy', diff --git a/packages/compat/webpack/src/plugins/css.ts b/packages/compat/webpack/src/plugins/css.ts index ca226aaa59..b78ef8e90b 100644 --- a/packages/compat/webpack/src/plugins/css.ts +++ b/packages/compat/webpack/src/plugins/css.ts @@ -1,19 +1,19 @@ import { + type BundlerChainRule, + type CSSExtractOptions, CSS_REGEX, - resolvePackage, - isUseCssExtract, - getPostcssLoaderOptions, - mergeChainedOptions, - getCssLoaderOptions, + type ModifyChainUtils, + type NormalizedConfig, + type RsbuildContext, + type RsbuildPlugin, getBrowserslistWithDefault, + getCssLoaderOptions, getCssModuleLocalIdentName, + getPostcssLoaderOptions, getSharedPkgCompiledPath, - type RsbuildContext, - type RsbuildPlugin, - type NormalizedConfig, - type BundlerChainRule, - type ModifyChainUtils, - type CSSExtractOptions, + isUseCssExtract, + mergeChainedOptions, + resolvePackage, } from '@rsbuild/shared'; export async function applyBaseCSSRule({ diff --git a/packages/compat/webpack/src/plugins/less.ts b/packages/compat/webpack/src/plugins/less.ts index 140097fbfa..3d7c2548a1 100644 --- a/packages/compat/webpack/src/plugins/less.ts +++ b/packages/compat/webpack/src/plugins/less.ts @@ -1,9 +1,9 @@ import { + type FileFilterUtil, LESS_REGEX, + type RsbuildPlugin, getLessLoaderOptions, getSharedPkgCompiledPath, - type RsbuildPlugin, - type FileFilterUtil, } from '@rsbuild/shared'; export type LessLoaderUtils = { diff --git a/packages/compat/webpack/src/plugins/output.ts b/packages/compat/webpack/src/plugins/output.ts index abdb77c54f..7700b7d1c2 100644 --- a/packages/compat/webpack/src/plugins/output.ts +++ b/packages/compat/webpack/src/plugins/output.ts @@ -1,11 +1,11 @@ import { posix } from 'node:path'; import { + type RsbuildPlugin, + applyOutputPlugin, getDistPath, getFilename, isUseCssExtract, - applyOutputPlugin, mergeChainedOptions, - type RsbuildPlugin, } from '@rsbuild/shared'; export const pluginOutput = (): RsbuildPlugin => ({ diff --git a/packages/compat/webpack/src/plugins/progress.ts b/packages/compat/webpack/src/plugins/progress.ts index d9242f0523..523f60834c 100644 --- a/packages/compat/webpack/src/plugins/progress.ts +++ b/packages/compat/webpack/src/plugins/progress.ts @@ -1,4 +1,4 @@ -import { TARGET_ID_MAP, type RsbuildPlugin } from '@rsbuild/shared'; +import { type RsbuildPlugin, TARGET_ID_MAP } from '@rsbuild/shared'; export const pluginProgress = (): RsbuildPlugin => ({ name: 'rsbuild-webpack:progress', diff --git a/packages/compat/webpack/src/plugins/resolve.ts b/packages/compat/webpack/src/plugins/resolve.ts index a0c6ec51e8..43d51c867d 100644 --- a/packages/compat/webpack/src/plugins/resolve.ts +++ b/packages/compat/webpack/src/plugins/resolve.ts @@ -1,10 +1,10 @@ import { - isWebTarget, - applyResolvePlugin, type BundlerChain, - type RsbuildTarget, - type RsbuildPlugin, type ChainIdentifier, + type RsbuildPlugin, + type RsbuildTarget, + applyResolvePlugin, + isWebTarget, } from '@rsbuild/shared'; async function applyTsConfigPathsPlugin({ diff --git a/packages/compat/webpack/src/plugins/sass.ts b/packages/compat/webpack/src/plugins/sass.ts index 5592e8435c..bb15430993 100644 --- a/packages/compat/webpack/src/plugins/sass.ts +++ b/packages/compat/webpack/src/plugins/sass.ts @@ -1,10 +1,10 @@ import { + type RsbuildPlugin, SASS_REGEX, getResolveUrlJoinFn, getSassLoaderOptions, getSharedPkgCompiledPath, patchCompilerGlobalLocation, - type RsbuildPlugin, } from '@rsbuild/shared'; export function pluginSass(): RsbuildPlugin { diff --git a/packages/compat/webpack/src/progress/ProgressPlugin.ts b/packages/compat/webpack/src/progress/ProgressPlugin.ts index 9d1feabd50..bf789310b5 100644 --- a/packages/compat/webpack/src/progress/ProgressPlugin.ts +++ b/packages/compat/webpack/src/progress/ProgressPlugin.ts @@ -1,5 +1,5 @@ -import webpack from 'webpack'; import { logger, prettyTime } from '@rsbuild/shared'; +import webpack from 'webpack'; import { bus, createFriendlyPercentage } from './helpers'; import { createNonTTYLogger } from './helpers/nonTty'; import type { Props } from './helpers/type'; diff --git a/packages/compat/webpack/src/progress/helpers/bar.ts b/packages/compat/webpack/src/progress/helpers/bar.ts index 253f345c68..340d8672b0 100644 --- a/packages/compat/webpack/src/progress/helpers/bar.ts +++ b/packages/compat/webpack/src/progress/helpers/bar.ts @@ -1,7 +1,7 @@ +import { color as colors } from '@rsbuild/shared'; import cliTruncate from '../../../compiled/cli-truncate'; import type { Props } from './type'; import { clamp } from './utils'; -import { color as colors } from '@rsbuild/shared'; const defaultOption: Props = { total: 100, diff --git a/packages/compat/webpack/src/progress/helpers/bus.ts b/packages/compat/webpack/src/progress/helpers/bus.ts index 14feeb86c8..cb1e07f9c0 100644 --- a/packages/compat/webpack/src/progress/helpers/bus.ts +++ b/packages/compat/webpack/src/progress/helpers/bus.ts @@ -1,11 +1,11 @@ import { Console } from 'node:console'; -import patchConsole from '../../../compiled/patch-console'; +import { getProgressColor } from '@rsbuild/shared'; import cliTruncate from '../../../compiled/cli-truncate'; -import type { Props } from './type'; +import patchConsole from '../../../compiled/patch-console'; import { FULL_WIDTH, renderBar } from './bar'; import { create } from './log'; import type { LogUpdate } from './log'; -import { getProgressColor } from '@rsbuild/shared'; +import type { Props } from './type'; class Bus { states: Partial[] = []; diff --git a/packages/compat/webpack/src/provider.ts b/packages/compat/webpack/src/provider.ts index 1bc5566d19..2e4ebcff05 100644 --- a/packages/compat/webpack/src/provider.ts +++ b/packages/compat/webpack/src/provider.ts @@ -1,16 +1,16 @@ import { - pickRsbuildConfig, - type CreateCompiler, - type RsbuildProvider, - type PreviewServerOptions, -} from '@rsbuild/shared'; -import { - plugins, - getPluginAPI, createContext, - initRsbuildConfig, createPublicContext, + getPluginAPI, + initRsbuildConfig, + plugins, } from '@rsbuild/core/internal'; +import { + type CreateCompiler, + type PreviewServerOptions, + type RsbuildProvider, + pickRsbuildConfig, +} from '@rsbuild/shared'; import { initConfigs } from './initConfigs'; export const webpackProvider: RsbuildProvider<'webpack'> = async ({ diff --git a/packages/compat/webpack/src/shared.ts b/packages/compat/webpack/src/shared.ts index 1d79d1cbfc..68ddf15d51 100644 --- a/packages/compat/webpack/src/shared.ts +++ b/packages/compat/webpack/src/shared.ts @@ -1,8 +1,8 @@ import fs from 'node:fs'; import { join } from 'node:path'; import { - getSharedPkgCompiledPath, type SharedCompiledPkgNames, + getSharedPkgCompiledPath, } from '@rsbuild/shared'; export const getCompiledPath = (packageName: string) => { diff --git a/packages/compat/webpack/src/types.ts b/packages/compat/webpack/src/types.ts index db104906f8..40d9241c2d 100644 --- a/packages/compat/webpack/src/types.ts +++ b/packages/compat/webpack/src/types.ts @@ -1,5 +1,5 @@ -import type webpack from 'webpack'; import type { WebpackChain } from '@rsbuild/shared'; +import type webpack from 'webpack'; import type { Configuration as WebpackConfig } from 'webpack'; export type { webpack, WebpackChain, WebpackConfig }; diff --git a/packages/compat/webpack/src/webpackConfig.ts b/packages/compat/webpack/src/webpackConfig.ts index 3ec2502e7c..25625cac7c 100644 --- a/packages/compat/webpack/src/webpackConfig.ts +++ b/packages/compat/webpack/src/webpackConfig.ts @@ -1,21 +1,21 @@ import { - debug, - castArray, - chainToConfig, - modifyBundlerChain, - mergeChainedOptions, + type InternalContext, + getChainUtils as getBaseChainUtils, +} from '@rsbuild/core/internal'; +import { type BundlerChain, - type RsbuildTarget, - type WebpackChain, type ModifyWebpackChainUtils, type ModifyWebpackConfigUtils, + type RsbuildTarget, + type WebpackChain, + castArray, + chainToConfig, + debug, + mergeChainedOptions, + modifyBundlerChain, } from '@rsbuild/shared'; -import { - getChainUtils as getBaseChainUtils, - type InternalContext, -} from '@rsbuild/core/internal'; -import { getCompiledPath } from './shared'; import type { RuleSetRule, WebpackPluginInstance } from 'webpack'; +import { getCompiledPath } from './shared'; import type { WebpackConfig } from './types'; async function modifyWebpackChain( diff --git a/packages/compat/webpack/tests/css.test.ts b/packages/compat/webpack/tests/css.test.ts index 16fde77b67..9c0ee89c3d 100644 --- a/packages/compat/webpack/tests/css.test.ts +++ b/packages/compat/webpack/tests/css.test.ts @@ -1,6 +1,6 @@ import { pluginCss } from '../src/plugins/css'; -import { pluginSass } from '../src/plugins/sass'; import { pluginLess } from '../src/plugins/less'; +import { pluginSass } from '../src/plugins/sass'; import { createStubRsbuild } from './helper'; describe('plugin-css', () => { diff --git a/packages/compat/webpack/tests/default.test.ts b/packages/compat/webpack/tests/default.test.ts index 11672737e7..dc242099c1 100644 --- a/packages/compat/webpack/tests/default.test.ts +++ b/packages/compat/webpack/tests/default.test.ts @@ -1,5 +1,5 @@ -import { createStubRsbuild } from './helper'; import type { RsbuildPlugin } from '@rsbuild/shared'; +import { createStubRsbuild } from './helper'; describe('applyDefaultPlugins', () => { it('should apply default plugins correctly', async () => { diff --git a/packages/compat/webpack/tests/helper.ts b/packages/compat/webpack/tests/helper.ts index bfc773879a..699d90d763 100644 --- a/packages/compat/webpack/tests/helper.ts +++ b/packages/compat/webpack/tests/helper.ts @@ -1,6 +1,6 @@ -import { webpackProvider } from '../src/provider'; -import type { RsbuildPlugin, CreateRsbuildOptions } from '@rsbuild/shared'; +import type { CreateRsbuildOptions, RsbuildPlugin } from '@rsbuild/shared'; import { createStubRsbuild as createBaseRsbuild } from '@scripts/test-helper'; +import { webpackProvider } from '../src/provider'; export async function createStubRsbuild({ rsbuildConfig = {}, diff --git a/packages/compat/webpack/tests/initConfigs.test.ts b/packages/compat/webpack/tests/initConfigs.test.ts index f072aabf87..e509371648 100644 --- a/packages/compat/webpack/tests/initConfigs.test.ts +++ b/packages/compat/webpack/tests/initConfigs.test.ts @@ -1,5 +1,5 @@ -import { createStubRsbuild } from './helper'; import type { RsbuildConfig, RsbuildPluginAPI } from '@rsbuild/shared'; +import { createStubRsbuild } from './helper'; describe('modifyRsbuildConfig', () => { it.skip('should not allow to modify Rsbuild config', async () => { diff --git a/packages/compat/webpack/tests/progress.test.ts b/packages/compat/webpack/tests/progress.test.ts index 8b9f2fa330..17a7b415db 100644 --- a/packages/compat/webpack/tests/progress.test.ts +++ b/packages/compat/webpack/tests/progress.test.ts @@ -1,6 +1,6 @@ -import { createStubRsbuild } from './helper'; import { pluginProgress } from '../src/plugins/progress'; import { createFriendlyPercentage } from '../src/progress/helpers'; +import { createStubRsbuild } from './helper'; describe('plugin-progress', () => { it('should register ProgressPlugin by default', async () => { diff --git a/packages/core/src/cli/commands.ts b/packages/core/src/cli/commands.ts index eff9f9bd5c..cb693bd59c 100644 --- a/packages/core/src/cli/commands.ts +++ b/packages/core/src/cli/commands.ts @@ -1,7 +1,7 @@ -import { join } from 'node:path'; import { existsSync } from 'node:fs'; -import { color, logger, type RsbuildMode } from '@rsbuild/shared'; -import { program, type Command } from '../../compiled/commander'; +import { join } from 'node:path'; +import { type RsbuildMode, color, logger } from '@rsbuild/shared'; +import { type Command, program } from '../../compiled/commander'; import { init } from './init'; export type CommonOptions = { diff --git a/packages/core/src/cli/init.ts b/packages/core/src/cli/init.ts index dec07f6c08..f6171eb547 100644 --- a/packages/core/src/cli/init.ts +++ b/packages/core/src/cli/init.ts @@ -1,6 +1,6 @@ import { isDev, logger } from '@rsbuild/shared'; -import { loadEnv } from '../loadEnv'; import { loadConfig, watchFiles } from '../config'; +import { loadEnv } from '../loadEnv'; import { onBeforeRestartServer } from '../server/restart'; import type { CommonOptions } from './commands'; diff --git a/packages/core/src/client/hmr/index.ts b/packages/core/src/client/hmr/index.ts index d8eb684972..697468f82a 100644 --- a/packages/core/src/client/hmr/index.ts +++ b/packages/core/src/client/hmr/index.ts @@ -4,7 +4,7 @@ * * Tips: this package will be bundled and running in the browser, do not import any Node.js modules. */ -import type { StatsError, ClientConfig } from '@rsbuild/shared'; +import type { ClientConfig, StatsError } from '@rsbuild/shared'; import { formatStatsMessages } from '../formatStats'; import { createSocketUrl } from './createSocketUrl'; diff --git a/packages/core/src/config.ts b/packages/core/src/config.ts index 6472e7d63e..97b0f06c12 100644 --- a/packages/core/src/config.ts +++ b/packages/core/src/config.ts @@ -1,46 +1,46 @@ import fs from 'node:fs'; import { isAbsolute, join } from 'node:path'; -import { restartDevServer } from './server/restart'; import { - color, - logger, - isObject, - debounce, - getNodeEnv, - findExists, - isFileExists, - DEFAULT_PORT, - JS_DIST_DIR, CSS_DIST_DIR, - SVG_DIST_DIR, - ROOT_DIST_DIR, - HTML_DIST_DIR, + DEFAULT_ASSET_PREFIX, + DEFAULT_DATA_URL_SIZE, + DEFAULT_DEV_HOST, + DEFAULT_MOUNT_ID, + DEFAULT_PORT, FONT_DIST_DIR, - WASM_DIST_DIR, + HTML_DIST_DIR, IMAGE_DIST_DIR, + JS_DIST_DIR, MEDIA_DIST_DIR, - TS_CONFIG_FILE, + ROOT_DIST_DIR, SERVER_DIST_DIR, - DEFAULT_DEV_HOST, - DEFAULT_MOUNT_ID, - DEFAULT_ASSET_PREFIX, - DEFAULT_DATA_URL_SIZE, SERVICE_WORKER_DIST_DIR, + SVG_DIST_DIR, + TS_CONFIG_FILE, + WASM_DIST_DIR, + color, + debounce, + findExists, + getNodeEnv, + isFileExists, + isObject, + logger, } from '@rsbuild/shared'; import type { - RsbuildEntry, - RsbuildConfig, NormalizedConfig, NormalizedDevConfig, - NormalizedToolsConfig, NormalizedHtmlConfig, NormalizedOutputConfig, - NormalizedSourceConfig, - NormalizedServerConfig, - NormalizedSecurityConfig, NormalizedPerformanceConfig, + NormalizedSecurityConfig, + NormalizedServerConfig, + NormalizedSourceConfig, + NormalizedToolsConfig, + RsbuildConfig, + RsbuildEntry, } from '@rsbuild/shared'; import { mergeRsbuildConfig } from './mergeConfig'; +import { restartDevServer } from './server/restart'; const getDefaultDevConfig = (): NormalizedDevConfig => ({ hmr: true, diff --git a/packages/core/src/createContext.ts b/packages/core/src/createContext.ts index 33e35002ac..3c0c79edd0 100644 --- a/packages/core/src/createContext.ts +++ b/packages/core/src/createContext.ts @@ -1,18 +1,18 @@ -import { join, isAbsolute } from 'node:path'; +import { isAbsolute, join } from 'node:path'; import { - logger, - getDistPath, type BundlerType, + type CreateRsbuildOptions, + type NormalizedConfig, type RsbuildConfig, - type RsbuildTarget, type RsbuildContext, - type NormalizedConfig, - type CreateRsbuildOptions, + type RsbuildTarget, + getDistPath, + logger, } from '@rsbuild/shared'; -import type { InternalContext } from './types'; -import { initHooks } from './initHooks'; import { withDefaultConfig } from './config'; +import { initHooks } from './initHooks'; import { getEntryObject } from './plugins/entry'; +import type { InternalContext } from './types'; function getAbsolutePath(root: string, filepath: string) { return isAbsolute(filepath) ? filepath : join(root, filepath); diff --git a/packages/core/src/createRsbuild.ts b/packages/core/src/createRsbuild.ts index ed0802e193..09b4fba789 100644 --- a/packages/core/src/createRsbuild.ts +++ b/packages/core/src/createRsbuild.ts @@ -1,9 +1,9 @@ import { - pick, - debug, + type CreateRsbuildOptions, type RsbuildInstance, type RsbuildProvider, - type CreateRsbuildOptions, + debug, + pick, } from '@rsbuild/shared'; import { createPluginManager } from './pluginManager'; diff --git a/packages/core/src/initHooks.ts b/packages/core/src/initHooks.ts index e457b01d8a..4e5f88d9f6 100644 --- a/packages/core/src/initHooks.ts +++ b/packages/core/src/initHooks.ts @@ -1,24 +1,24 @@ import { isFunction } from '@rsbuild/shared'; import type { - OnExitFn, AsyncHook, HookDescriptor, - OnAfterBuildFn, - OnBeforeBuildFn, - ModifyHTMLTagsFn, - OnCloseDevServerFn, - OnDevCompileDoneFn, ModifyBundlerChainFn, + ModifyHTMLTagsFn, + ModifyRsbuildConfigFn, ModifyRspackConfigFn, ModifyWebpackChainFn, ModifyWebpackConfigFn, - ModifyRsbuildConfigFn, + OnAfterBuildFn, + OnAfterCreateCompilerFn, OnAfterStartDevServerFn, - OnBeforeStartDevServerFn, OnAfterStartProdServerFn, - OnBeforeStartProdServerFn, - OnAfterCreateCompilerFn, + OnBeforeBuildFn, OnBeforeCreateCompilerFn, + OnBeforeStartDevServerFn, + OnBeforeStartProdServerFn, + OnCloseDevServerFn, + OnDevCompileDoneFn, + OnExitFn, } from '@rsbuild/shared'; export function createAsyncHook< diff --git a/packages/core/src/initPlugins.ts b/packages/core/src/initPlugins.ts index 881b732d3f..430a98af7e 100644 --- a/packages/core/src/initPlugins.ts +++ b/packages/core/src/initPlugins.ts @@ -1,17 +1,17 @@ import { join } from 'node:path'; import { - getDistPath, - removeLeadingSlash, - type TransformFn, type BundlerChain, + type GetRsbuildConfig, type PluginManager, type RsbuildPluginAPI, - type GetRsbuildConfig, + type TransformFn, type TransformHandler, + getDistPath, + removeLeadingSlash, } from '@rsbuild/shared'; +import type { Compiler } from '@rspack/core'; import { createPublicContext } from './createContext'; import type { InternalContext, NormalizedConfig } from './types'; -import type { Compiler } from '@rspack/core'; export function getHTMLPathByEntry( entryName: string, diff --git a/packages/core/src/mergeConfig.ts b/packages/core/src/mergeConfig.ts index 88b8acf36b..c3ceffbecc 100644 --- a/packages/core/src/mergeConfig.ts +++ b/packages/core/src/mergeConfig.ts @@ -1,8 +1,8 @@ import { + type RsbuildConfig, castArray, isFunction, isPlainObject, - type RsbuildConfig, } from '@rsbuild/shared'; const OVERRIDE_PATH = [ diff --git a/packages/core/src/pluginManager.ts b/packages/core/src/pluginManager.ts index c1dda9bb30..510f5c7d68 100644 --- a/packages/core/src/pluginManager.ts +++ b/packages/core/src/pluginManager.ts @@ -1,10 +1,10 @@ -import { color, debug, logger, isFunction } from '@rsbuild/shared'; +import { color, debug, isFunction, logger } from '@rsbuild/shared'; import type { + BundlerPluginInstance, Falsy, PluginManager, RsbuildPlugin, RsbuildPluginAPI, - BundlerPluginInstance, } from '@rsbuild/shared'; function validatePlugin(plugin: unknown) { diff --git a/packages/core/src/plugins/asset.ts b/packages/core/src/plugins/asset.ts index bc8a7a3a52..06e22af9d6 100644 --- a/packages/core/src/plugins/asset.ts +++ b/packages/core/src/plugins/asset.ts @@ -1,15 +1,15 @@ import path from 'node:path'; import { - getDistPath, - getFilename, + AUDIO_EXTENSIONS, + type BundlerChainRule, FONT_EXTENSIONS, IMAGE_EXTENSIONS, VIDEO_EXTENSIONS, - AUDIO_EXTENSIONS, - type BundlerChainRule, + getDistPath, + getFilename, } from '@rsbuild/shared'; -import type { RsbuildPlugin } from '../types'; import type { GeneratorOptionsByModuleType } from '@rspack/core'; +import type { RsbuildPlugin } from '../types'; const chainStaticAssetRule = ({ emit, diff --git a/packages/core/src/plugins/bundleAnalyzer.ts b/packages/core/src/plugins/bundleAnalyzer.ts index 7cc0c860ad..a1ac4bd7e4 100644 --- a/packages/core/src/plugins/bundleAnalyzer.ts +++ b/packages/core/src/plugins/bundleAnalyzer.ts @@ -1,5 +1,5 @@ import { isProd } from '@rsbuild/shared'; -import type { RsbuildConfig, RsbuildPlugin, NormalizedConfig } from '../types'; +import type { NormalizedConfig, RsbuildConfig, RsbuildPlugin } from '../types'; // There are two ways to enable the bundle analyzer: // 1. Set environment variable `BUNDLE_ANALYZE` diff --git a/packages/core/src/plugins/cache.ts b/packages/core/src/plugins/cache.ts index 995a9a49c2..35fc4038e3 100644 --- a/packages/core/src/plugins/cache.ts +++ b/packages/core/src/plugins/cache.ts @@ -2,10 +2,10 @@ import crypto from 'node:crypto'; import { isAbsolute, join } from 'node:path'; import { fse } from '@rsbuild/shared'; import { + type BuildCacheOptions, + type RsbuildContext, findExists, isFileExists, - type RsbuildContext, - type BuildCacheOptions, } from '@rsbuild/shared'; import type { NormalizedConfig, RsbuildPlugin } from '../types'; diff --git a/packages/core/src/plugins/cleanOutput.ts b/packages/core/src/plugins/cleanOutput.ts index 44d569f719..3884a8c8e3 100644 --- a/packages/core/src/plugins/cleanOutput.ts +++ b/packages/core/src/plugins/cleanOutput.ts @@ -1,5 +1,5 @@ import { sep } from 'node:path'; -import { fse, color, logger } from '@rsbuild/shared'; +import { color, fse, logger } from '@rsbuild/shared'; import type { RsbuildPlugin } from '../types'; const emptyDir = async (dir: string) => { diff --git a/packages/core/src/plugins/define.ts b/packages/core/src/plugins/define.ts index ed2f028983..86f58607f4 100644 --- a/packages/core/src/plugins/define.ts +++ b/packages/core/src/plugins/define.ts @@ -1,7 +1,7 @@ import { + type Define, getNodeEnv, getPublicPathFromChain, - type Define, } from '@rsbuild/shared'; import type { RsbuildPlugin } from '../types'; diff --git a/packages/core/src/plugins/entry.ts b/packages/core/src/plugins/entry.ts index 6306f5fb4d..c7e635c498 100644 --- a/packages/core/src/plugins/entry.ts +++ b/packages/core/src/plugins/entry.ts @@ -1,13 +1,13 @@ import { - color, + type RsbuildEntry, + type RsbuildTarget, castArray, + color, createVirtualModule, mergeChainedOptions, - type RsbuildEntry, - type RsbuildTarget, } from '@rsbuild/shared'; -import type { NormalizedConfig, RsbuildConfig, RsbuildPlugin } from '../types'; import type { EntryDescription } from '@rspack/core'; +import type { NormalizedConfig, RsbuildConfig, RsbuildPlugin } from '../types'; export function getEntryObject( config: RsbuildConfig | NormalizedConfig, diff --git a/packages/core/src/plugins/fileSize.ts b/packages/core/src/plugins/fileSize.ts index 37b7a0f245..8832ec0e32 100644 --- a/packages/core/src/plugins/fileSize.ts +++ b/packages/core/src/plugins/fileSize.ts @@ -3,13 +3,13 @@ * license at https://github.com/facebook/create-react-app/blob/master/LICENSE */ import path from 'node:path'; -import { fse, JS_REGEX, CSS_REGEX, HTML_REGEX } from '@rsbuild/shared'; +import { CSS_REGEX, HTML_REGEX, JS_REGEX, fse } from '@rsbuild/shared'; import { color, logger } from '@rsbuild/shared'; import type { - Stats, MultiStats, - StatsAsset, PrintFileSizeOptions, + Stats, + StatsAsset, } from '@rsbuild/shared'; import type { RsbuildPlugin } from '../types'; diff --git a/packages/core/src/plugins/html.ts b/packages/core/src/plugins/html.ts index f06786a5ba..d093b012f5 100644 --- a/packages/core/src/plugins/html.ts +++ b/packages/core/src/plugins/html.ts @@ -1,28 +1,28 @@ import path, { isAbsolute } from 'node:path'; import { - fse, - color, - isNil, - isURL, + applyToCompiler, castArray, + color, + createVirtualModule, + fse, getDistPath, + getHtmlMinifyOptions, + getPublicPathFromChain, isFileExists, - isPlainObject, isHtmlDisabled, - applyToCompiler, - createVirtualModule, + isNil, + isPlainObject, + isURL, mergeChainedOptions, - getHtmlMinifyOptions, - getPublicPathFromChain, } from '@rsbuild/shared'; -import type { EntryDescription } from '@rspack/core'; import type { + HTMLPluginOptions, HtmlConfig, - RsbuildPluginAPI, - NormalizedConfig, ModifyHTMLTagsFn, - HTMLPluginOptions, + NormalizedConfig, + RsbuildPluginAPI, } from '@rsbuild/shared'; +import type { EntryDescription } from '@rspack/core'; import type { HtmlInfo, TagConfig } from '../rspack/HtmlBasicPlugin'; import type { RsbuildPlugin } from '../types'; diff --git a/packages/core/src/plugins/inlineChunk.ts b/packages/core/src/plugins/inlineChunk.ts index 98a7597cea..7ee88330ea 100644 --- a/packages/core/src/plugins/inlineChunk.ts +++ b/packages/core/src/plugins/inlineChunk.ts @@ -1,9 +1,9 @@ import { - pick, - JS_REGEX, CSS_REGEX, - isHtmlDisabled, type InlineChunkTest, + JS_REGEX, + isHtmlDisabled, + pick, } from '@rsbuild/shared'; import type { RsbuildPlugin } from '../types'; diff --git a/packages/core/src/plugins/moduleFederation.ts b/packages/core/src/plugins/moduleFederation.ts index 6d5f5cb27a..3c932bb7e4 100644 --- a/packages/core/src/plugins/moduleFederation.ts +++ b/packages/core/src/plugins/moduleFederation.ts @@ -1,10 +1,10 @@ import { - DEFAULT_ASSET_PREFIX, type CacheGroup, + DEFAULT_ASSET_PREFIX, type RspackCompiler, } from '@rsbuild/shared'; -import type { RsbuildPlugin } from '../types'; import type { RspackPluginInstance } from '@rspack/core'; +import type { RsbuildPlugin } from '../types'; /** * Force remote entry not be affected by user's chunkSplit strategy, diff --git a/packages/core/src/plugins/resourceHints.ts b/packages/core/src/plugins/resourceHints.ts index 9eb0619d8a..0c99a234ac 100644 --- a/packages/core/src/plugins/resourceHints.ts +++ b/packages/core/src/plugins/resourceHints.ts @@ -1,7 +1,7 @@ import type { + DnsPrefetchOption, HtmlBasicTag, PreconnectOption, - DnsPrefetchOption, } from '@rsbuild/shared'; import type { RsbuildPlugin } from '../types'; diff --git a/packages/core/src/plugins/rsdoctor.ts b/packages/core/src/plugins/rsdoctor.ts index d968348ce7..86097d3a43 100644 --- a/packages/core/src/plugins/rsdoctor.ts +++ b/packages/core/src/plugins/rsdoctor.ts @@ -1,4 +1,4 @@ -import { color, logger, type BundlerPluginInstance } from '@rsbuild/shared'; +import { type BundlerPluginInstance, color, logger } from '@rsbuild/shared'; import type { RsbuildPlugin } from '../types'; type RsdoctorExports = { diff --git a/packages/core/src/plugins/server.ts b/packages/core/src/plugins/server.ts index b9e8f94856..36fd02cc81 100644 --- a/packages/core/src/plugins/server.ts +++ b/packages/core/src/plugins/server.ts @@ -1,5 +1,5 @@ +import { isAbsolute, join } from 'node:path'; import { fse } from '@rsbuild/shared'; -import { join, isAbsolute } from 'node:path'; import type { RsbuildPlugin } from '../types'; // For Rsbuild Server Config diff --git a/packages/core/src/plugins/splitChunks.ts b/packages/core/src/plugins/splitChunks.ts index 851ba14d45..95487fedce 100644 --- a/packages/core/src/plugins/splitChunks.ts +++ b/packages/core/src/plugins/splitChunks.ts @@ -1,12 +1,12 @@ import assert from 'node:assert'; import { - NODE_MODULES_REGEX, - createDependenciesRegExp, - type Polyfill, type CacheGroups, - type SplitChunks, type ForceSplitting, + NODE_MODULES_REGEX, + type Polyfill, type RsbuildChunkSplit, + type SplitChunks, + createDependenciesRegExp, } from '@rsbuild/shared'; import type { RsbuildPlugin } from '../types'; diff --git a/packages/core/src/plugins/startUrl.ts b/packages/core/src/plugins/startUrl.ts index aa0f795a9f..340dc2784a 100644 --- a/packages/core/src/plugins/startUrl.ts +++ b/packages/core/src/plugins/startUrl.ts @@ -1,7 +1,7 @@ -import { join } from 'node:path'; -import { debug, logger, castArray, type Routes } from '@rsbuild/shared'; import { exec } from 'node:child_process'; +import { join } from 'node:path'; import { promisify } from 'node:util'; +import { type Routes, castArray, debug, logger } from '@rsbuild/shared'; import type { RsbuildPlugin } from '../types'; const execAsync = promisify(exec); diff --git a/packages/core/src/provider/build.ts b/packages/core/src/provider/build.ts index fda35ad02c..71d891398a 100644 --- a/packages/core/src/provider/build.ts +++ b/packages/core/src/provider/build.ts @@ -1,14 +1,14 @@ -import { createCompiler } from './createCompiler'; -import { initConfigs, type InitConfigsOptions } from './initConfigs'; -import { logger, getNodeEnv, setNodeEnv, onCompileDone } from '@rsbuild/shared'; +import { getNodeEnv, logger, onCompileDone, setNodeEnv } from '@rsbuild/shared'; import type { - Stats, - MultiStats, BuildOptions, - RspackConfig, + MultiStats, RspackCompiler, + RspackConfig, RspackMultiCompiler, + Stats, } from '@rsbuild/shared'; +import { createCompiler } from './createCompiler'; +import { type InitConfigsOptions, initConfigs } from './initConfigs'; export const build = async ( initOptions: InitConfigsOptions, diff --git a/packages/core/src/provider/createCompiler.ts b/packages/core/src/provider/createCompiler.ts index 32c90a230a..9f3dfdb8e9 100644 --- a/packages/core/src/provider/createCompiler.ts +++ b/packages/core/src/provider/createCompiler.ts @@ -1,27 +1,27 @@ import { + type CreateDevMiddlewareReturns, + type MultiStats, + type RspackCompiler, + type RspackConfig, + type RspackMultiCompiler, + type Stats, + TARGET_ID_MAP, + color, + debug, isDev, isProd, - debug, - color, logger, - prettyTime, - TARGET_ID_MAP, onCompileDone, - type Stats, - type MultiStats, - type RspackConfig, - type RspackCompiler, - type RspackMultiCompiler, - type CreateDevMiddlewareReturns, + prettyTime, } from '@rsbuild/shared'; -import { initConfigs, type InitConfigsOptions } from './initConfigs'; -import type { InternalContext } from '../types'; import type { StatsCompilation } from '@rspack/core'; +import type { InternalContext } from '../types'; +import { type InitConfigsOptions, initConfigs } from './initConfigs'; import { formatStats, getStatsOptions, - rspackMinVersion, isSatisfyRspackVersion, + rspackMinVersion, } from './shared'; export async function createCompiler({ diff --git a/packages/core/src/provider/css-modules-typescript-pre-loader/index.ts b/packages/core/src/provider/css-modules-typescript-pre-loader/index.ts index e1f6b056e9..f7ca019cf5 100644 --- a/packages/core/src/provider/css-modules-typescript-pre-loader/index.ts +++ b/packages/core/src/provider/css-modules-typescript-pre-loader/index.ts @@ -1,12 +1,12 @@ -import cssModulesTypescriptLoader from '@rsbuild/shared/css-modules-typescript-loader'; import { + type CssModules, isCssModules, isInNodeModules, - type CssModules, } from '@rsbuild/shared'; +import type { CssModuleLocalsConvention } from '@rsbuild/shared'; +import cssModulesTypescriptLoader from '@rsbuild/shared/css-modules-typescript-loader'; import type { LoaderContext } from '@rspack/core'; import type { PostcssParsePluginOptions } from './postcssIcssExtractPlugin'; -import type { CssModuleLocalsConvention } from '@rsbuild/shared'; async function processCss( inputSource: string, diff --git a/packages/core/src/provider/css-modules-typescript-pre-loader/postcssIcssExtractPlugin.ts b/packages/core/src/provider/css-modules-typescript-pre-loader/postcssIcssExtractPlugin.ts index 7ac6b77fef..c917fdd647 100644 --- a/packages/core/src/provider/css-modules-typescript-pre-loader/postcssIcssExtractPlugin.ts +++ b/packages/core/src/provider/css-modules-typescript-pre-loader/postcssIcssExtractPlugin.ts @@ -1,6 +1,6 @@ +import { type CssModuleLocalsConvention, camelCase } from '@rsbuild/shared'; // @ts-expect-error import { extractICSS } from '@rsbuild/shared/icss-utils'; -import { camelCase, type CssModuleLocalsConvention } from '@rsbuild/shared'; import type { AcceptedPlugin as PostCSSPlugin } from 'postcss'; diff --git a/packages/core/src/provider/initConfigs.ts b/packages/core/src/provider/initConfigs.ts index 3c70269186..33650cbd17 100644 --- a/packages/core/src/provider/initConfigs.ts +++ b/packages/core/src/provider/initConfigs.ts @@ -1,18 +1,18 @@ import { - debug, - isDebug, + type CreateRsbuildOptions, + type InspectConfigOptions, type PluginManager, type RspackConfig, - type InspectConfigOptions, - type CreateRsbuildOptions, + debug, + isDebug, } from '@rsbuild/shared'; -import { mergeRsbuildConfig } from '../mergeConfig'; -import { updateContextByNormalizedConfig } from '../createContext'; -import { inspectConfig } from './inspectConfig'; -import { generateRspackConfig } from './rspackConfig'; import { normalizeConfig } from '../config'; +import { updateContextByNormalizedConfig } from '../createContext'; +import { mergeRsbuildConfig } from '../mergeConfig'; import { initPlugins } from '../pluginManager'; import type { InternalContext, NormalizedConfig } from '../types'; +import { inspectConfig } from './inspectConfig'; +import { generateRspackConfig } from './rspackConfig'; async function modifyRsbuildConfig(context: InternalContext) { debug('modify Rsbuild config'); diff --git a/packages/core/src/provider/inspectConfig.ts b/packages/core/src/provider/inspectConfig.ts index c8dd0f3393..248642a29a 100644 --- a/packages/core/src/provider/inspectConfig.ts +++ b/packages/core/src/provider/inspectConfig.ts @@ -1,15 +1,15 @@ -import { join, isAbsolute } from 'node:path'; -import { initConfigs, type InitConfigsOptions } from './initConfigs'; +import { isAbsolute, join } from 'node:path'; import { - setNodeEnv, + type InspectConfigOptions, + type InspectConfigResult, + type NormalizedConfig, + type RspackConfig, getNodeEnv, - stringifyConfig, outputInspectConfigFiles, - type RspackConfig, - type NormalizedConfig, - type InspectConfigResult, - type InspectConfigOptions, + setNodeEnv, + stringifyConfig, } from '@rsbuild/shared'; +import { type InitConfigsOptions, initConfigs } from './initConfigs'; export async function inspectConfig({ context, diff --git a/packages/core/src/provider/plugins/css.ts b/packages/core/src/provider/plugins/css.ts index 79535dbc7c..261c2cfff7 100644 --- a/packages/core/src/provider/plugins/css.ts +++ b/packages/core/src/provider/plugins/css.ts @@ -1,24 +1,24 @@ import path from 'node:path'; import { - logger, - kebabCase, - getBrowserslistWithDefault, - isUseCssExtract, - CSS_REGEX, - CSS_MODULES_REGEX, - getCssLoaderOptions, - getPostcssLoaderOptions, - getCssModuleLocalIdentName, - resolvePackage, - mergeChainedOptions, - getSharedPkgCompiledPath, type BundlerChain, + CSS_MODULES_REGEX, + CSS_REGEX, + type ModifyBundlerChainUtils, type RsbuildContext, type RspackRule, type RuleSetRule, - type ModifyBundlerChainUtils, + getBrowserslistWithDefault, + getCssLoaderOptions, + getCssModuleLocalIdentName, + getPostcssLoaderOptions, + getSharedPkgCompiledPath, + isUseCssExtract, + kebabCase, + logger, + mergeChainedOptions, + resolvePackage, } from '@rsbuild/shared'; -import type { RsbuildPlugin, NormalizedConfig } from '../../types'; +import type { NormalizedConfig, RsbuildPlugin } from '../../types'; export const enableNativeCss = (config: NormalizedConfig) => !config.output.injectStyles; diff --git a/packages/core/src/provider/plugins/less.ts b/packages/core/src/provider/plugins/less.ts index 9706ba0ace..0c6fcd32a3 100644 --- a/packages/core/src/provider/plugins/less.ts +++ b/packages/core/src/provider/plugins/less.ts @@ -1,9 +1,9 @@ -import type { RsbuildPlugin } from '../../types'; import { LESS_REGEX, getLessLoaderOptions, getSharedPkgCompiledPath, } from '@rsbuild/shared'; +import type { RsbuildPlugin } from '../../types'; export function pluginLess(): RsbuildPlugin { return { diff --git a/packages/core/src/provider/plugins/output.ts b/packages/core/src/provider/plugins/output.ts index d46801cab0..64168ea4c8 100644 --- a/packages/core/src/provider/plugins/output.ts +++ b/packages/core/src/provider/plugins/output.ts @@ -1,5 +1,5 @@ import { posix } from 'node:path'; -import { getDistPath, getFilename, applyOutputPlugin } from '@rsbuild/shared'; +import { applyOutputPlugin, getDistPath, getFilename } from '@rsbuild/shared'; import type { RsbuildPlugin } from '../../types'; export const pluginOutput = (): RsbuildPlugin => ({ diff --git a/packages/core/src/provider/plugins/resolve.ts b/packages/core/src/provider/plugins/resolve.ts index 1d5dffa1de..a50960ce24 100644 --- a/packages/core/src/provider/plugins/resolve.ts +++ b/packages/core/src/provider/plugins/resolve.ts @@ -1,5 +1,5 @@ -import type { RsbuildPlugin } from '../../types'; import { applyResolvePlugin } from '@rsbuild/shared'; +import type { RsbuildPlugin } from '../../types'; export const pluginResolve = (): RsbuildPlugin => ({ name: 'rsbuild:resolve', diff --git a/packages/core/src/provider/plugins/rspackProfile.ts b/packages/core/src/provider/plugins/rspackProfile.ts index f8b260f6a4..f328281114 100644 --- a/packages/core/src/provider/plugins/rspackProfile.ts +++ b/packages/core/src/provider/plugins/rspackProfile.ts @@ -1,8 +1,8 @@ -import type { RsbuildPlugin } from '../../types'; -import path from 'node:path'; import inspector from 'node:inspector'; +import path from 'node:path'; import { fse } from '@rsbuild/shared'; import { logger } from '@rsbuild/shared'; +import type { RsbuildPlugin } from '../../types'; export const stopProfiler = ( output: string, diff --git a/packages/core/src/provider/plugins/sass.ts b/packages/core/src/provider/plugins/sass.ts index d74074d666..3b12627631 100644 --- a/packages/core/src/provider/plugins/sass.ts +++ b/packages/core/src/provider/plugins/sass.ts @@ -1,9 +1,9 @@ import { SASS_REGEX, - getSassLoaderOptions, - patchCompilerGlobalLocation, getResolveUrlJoinFn, + getSassLoaderOptions, getSharedPkgCompiledPath, + patchCompilerGlobalLocation, } from '@rsbuild/shared'; import type { RsbuildPlugin } from '../../types'; diff --git a/packages/core/src/provider/plugins/swc.ts b/packages/core/src/provider/plugins/swc.ts index 52bfb7eb59..58930f15a1 100644 --- a/packages/core/src/provider/plugins/swc.ts +++ b/packages/core/src/provider/plugins/swc.ts @@ -1,25 +1,25 @@ +import path from 'node:path'; import { + type BuiltinSwcLoaderOptions, + type BundlerChain, + type Polyfill, + type RsbuildTarget, + SCRIPT_REGEX, + applyScriptCondition, cloneDeep, deepmerge, - isWebTarget, - SCRIPT_REGEX, - getJsSourceMap, + getBrowserslistWithDefault, getCoreJsVersion, + getJsSourceMap, + isWebTarget, mergeChainedOptions, - applyScriptCondition, - getBrowserslistWithDefault, - type Polyfill, - type BundlerChain, - type RsbuildTarget, - type BuiltinSwcLoaderOptions, } from '@rsbuild/shared'; -import path from 'node:path'; +import { PLUGIN_SWC_NAME } from '../../constants'; import type { - RsbuildPlugin, NormalizedConfig, NormalizedSourceConfig, + RsbuildPlugin, } from '../../types'; -import { PLUGIN_SWC_NAME } from '../../constants'; const builtinSwcLoaderName = 'builtin:swc-loader'; diff --git a/packages/core/src/provider/provider.ts b/packages/core/src/provider/provider.ts index 5f409e615e..b052fa9b06 100644 --- a/packages/core/src/provider/provider.ts +++ b/packages/core/src/provider/provider.ts @@ -1,13 +1,13 @@ import { - pickRsbuildConfig, type CreateCompiler, - type RsbuildProvider, type PreviewServerOptions, + type RsbuildProvider, + pickRsbuildConfig, } from '@rsbuild/shared'; import { createContext, createPublicContext } from '../createContext'; -import { initConfigs, initRsbuildConfig } from './initConfigs'; import { getPluginAPI } from '../initPlugins'; import { plugins } from '../plugins'; +import { initConfigs, initRsbuildConfig } from './initConfigs'; export const rspackProvider: RsbuildProvider = async ({ pluginManager, diff --git a/packages/core/src/provider/rspackConfig.ts b/packages/core/src/provider/rspackConfig.ts index 5433da181e..2b252b1d07 100644 --- a/packages/core/src/provider/rspackConfig.ts +++ b/packages/core/src/provider/rspackConfig.ts @@ -1,19 +1,19 @@ import { - debug, CHAIN_ID, + type ModifyChainUtils, + type ModifyRspackConfigUtils, + type RsbuildTarget, + type RspackConfig, castArray, - getNodeEnv, chainToConfig, - modifyBundlerChain, + debug, + getNodeEnv, mergeChainedOptions, - type RspackConfig, - type RsbuildTarget, - type ModifyChainUtils, - type ModifyRspackConfigUtils, + modifyBundlerChain, } from '@rsbuild/shared'; -import { getCompiledPath } from './shared'; -import type { InternalContext } from '../types'; import { getHTMLPlugin } from '../htmlUtils'; +import type { InternalContext } from '../types'; +import { getCompiledPath } from './shared'; async function modifyRspackConfig( context: InternalContext, diff --git a/packages/core/src/provider/shared.ts b/packages/core/src/provider/shared.ts index dbd83dd9b6..26c02c09ad 100644 --- a/packages/core/src/provider/shared.ts +++ b/packages/core/src/provider/shared.ts @@ -1,16 +1,16 @@ import { join } from 'node:path'; import { - color, - isMultiCompiler, - getSharedPkgCompiledPath, - type Stats, type MultiStats, type SharedCompiledPkgNames, + type Stats, type StatsError, + color, + getSharedPkgCompiledPath, + isMultiCompiler, } from '@rsbuild/shared'; import { fse } from '@rsbuild/shared'; -import { formatStatsMessages } from '../client/formatStats'; import type { StatsCompilation, StatsValue } from '@rspack/core'; +import { formatStatsMessages } from '../client/formatStats'; // depend on native IgnorePlugin export const rspackMinVersion = '0.6.2'; diff --git a/packages/core/src/rspack/HtmlAppIconPlugin.ts b/packages/core/src/rspack/HtmlAppIconPlugin.ts index af464614c2..1c77aff229 100644 --- a/packages/core/src/rspack/HtmlAppIconPlugin.ts +++ b/packages/core/src/rspack/HtmlAppIconPlugin.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; -import { posix, basename } from 'node:path'; -import type { Compiler, Compilation } from '@rspack/core'; -import { withPublicPath, getPublicPathFromCompiler } from '@rsbuild/shared'; +import { basename, posix } from 'node:path'; +import { getPublicPathFromCompiler, withPublicPath } from '@rsbuild/shared'; +import type { Compilation, Compiler } from '@rspack/core'; import { getHTMLPlugin } from '../htmlUtils'; type AppIconOptions = { diff --git a/packages/core/src/rspack/HtmlBasicPlugin.ts b/packages/core/src/rspack/HtmlBasicPlugin.ts index bf3a6af1f8..bed5e61e1f 100644 --- a/packages/core/src/rspack/HtmlBasicPlugin.ts +++ b/packages/core/src/rspack/HtmlBasicPlugin.ts @@ -1,16 +1,16 @@ -import type HtmlWebpackPlugin from 'html-webpack-plugin'; -import type { HtmlTagObject } from 'html-webpack-plugin'; -import type { Compiler, Compilation } from '@rspack/core'; import { - partition, - isFunction, - withPublicPath, - type HtmlTag, - type HtmlTagUtils, type HtmlBasicTag, + type HtmlTag, type HtmlTagDescriptor, + type HtmlTagUtils, type ModifyHTMLTagsFn, + isFunction, + partition, + withPublicPath, } from '@rsbuild/shared'; +import type { Compilation, Compiler } from '@rspack/core'; +import type HtmlWebpackPlugin from 'html-webpack-plugin'; +import type { HtmlTagObject } from 'html-webpack-plugin'; import { getHTMLPlugin } from '../htmlUtils'; export type TagConfig = { diff --git a/packages/core/src/rspack/InlineChunkHtmlPlugin.ts b/packages/core/src/rspack/InlineChunkHtmlPlugin.ts index 0f94a33020..3ad9dbd9a5 100644 --- a/packages/core/src/rspack/InlineChunkHtmlPlugin.ts +++ b/packages/core/src/rspack/InlineChunkHtmlPlugin.ts @@ -7,12 +7,12 @@ */ import { join } from 'node:path'; import { - isFunction, + type InlineChunkTest, addTrailingSlash, getPublicPathFromCompiler, - type InlineChunkTest, + isFunction, } from '@rsbuild/shared'; -import type { Compiler, Compilation } from '@rspack/core'; +import type { Compilation, Compiler } from '@rspack/core'; import type { HtmlTagObject } from 'html-webpack-plugin'; import { getHTMLPlugin } from '../htmlUtils'; diff --git a/packages/core/src/rspack/RemoveCssSourcemapPlugin.ts b/packages/core/src/rspack/RemoveCssSourcemapPlugin.ts index 72a60e8839..27c4536b6d 100644 --- a/packages/core/src/rspack/RemoveCssSourcemapPlugin.ts +++ b/packages/core/src/rspack/RemoveCssSourcemapPlugin.ts @@ -1,4 +1,4 @@ -import type { Compiler, Compilation } from '@rspack/core'; +import type { Compilation, Compiler } from '@rspack/core'; export class RemoveCssSourcemapPlugin { name: string; diff --git a/packages/core/src/rspack/preload/HtmlPreloadOrPrefetchPlugin.ts b/packages/core/src/rspack/preload/HtmlPreloadOrPrefetchPlugin.ts index a82926475b..76f2577bcb 100644 --- a/packages/core/src/rspack/preload/HtmlPreloadOrPrefetchPlugin.ts +++ b/packages/core/src/rspack/preload/HtmlPreloadOrPrefetchPlugin.ts @@ -15,22 +15,22 @@ * limitations under the License. */ -import type { Compiler, RspackPluginInstance, Compilation } from '@rspack/core'; -import type HtmlWebpackPlugin from 'html-webpack-plugin'; import { + type PreloadOrPreFetchOption, + getPublicPathFromCompiler, upperFirst, withPublicPath, - getPublicPathFromCompiler, - type PreloadOrPreFetchOption, } from '@rsbuild/shared'; +import type { Compilation, Compiler, RspackPluginInstance } from '@rspack/core'; +import type HtmlWebpackPlugin from 'html-webpack-plugin'; +import { getHTMLPlugin } from '../../htmlUtils'; import { - extractChunks, - doesChunkBelongToHtml, - determineAsValue, - type BeforeAssetTagGenerationHtmlPluginData, type As, + type BeforeAssetTagGenerationHtmlPluginData, + determineAsValue, + doesChunkBelongToHtml, + extractChunks, } from './helpers'; -import { getHTMLPlugin } from '../../htmlUtils'; const defaultOptions = { type: 'async-chunks' as const, diff --git a/packages/core/src/rspack/preload/helpers/determineAsValue.ts b/packages/core/src/rspack/preload/helpers/determineAsValue.ts index ec87235eb9..d2b8e52989 100644 --- a/packages/core/src/rspack/preload/helpers/determineAsValue.ts +++ b/packages/core/src/rspack/preload/helpers/determineAsValue.ts @@ -18,13 +18,13 @@ import path from 'node:path'; import { URL } from 'node:url'; -import type { As } from './type'; import { - FONT_EXTENSIONS, AUDIO_EXTENSIONS, + FONT_EXTENSIONS, IMAGE_EXTENSIONS, VIDEO_EXTENSIONS, } from '@rsbuild/shared'; +import type { As } from './type'; export function determineAsValue({ href, diff --git a/packages/core/src/rspack/preload/helpers/doesChunkBelongToHtml.ts b/packages/core/src/rspack/preload/helpers/doesChunkBelongToHtml.ts index f3db34f923..39594ac641 100644 --- a/packages/core/src/rspack/preload/helpers/doesChunkBelongToHtml.ts +++ b/packages/core/src/rspack/preload/helpers/doesChunkBelongToHtml.ts @@ -15,10 +15,10 @@ * limitations under the License. */ -import type { ChunkGroup } from './extractChunks'; +import type { PreloadOrPreFetchOption } from '@rsbuild/shared'; import type { Compilation } from '@rspack/core'; import type { Chunk } from 'webpack'; -import type { PreloadOrPreFetchOption } from '@rsbuild/shared'; +import type { ChunkGroup } from './extractChunks'; import type { BeforeAssetTagGenerationHtmlPluginData } from './type'; interface DoesChunkBelongToHtmlOptions { diff --git a/packages/core/src/rspack/preload/helpers/extractChunks.ts b/packages/core/src/rspack/preload/helpers/extractChunks.ts index 6479a99383..0d965e9de7 100644 --- a/packages/core/src/rspack/preload/helpers/extractChunks.ts +++ b/packages/core/src/rspack/preload/helpers/extractChunks.ts @@ -15,8 +15,8 @@ * limitations under the License. */ -import type { Chunk, Compilation } from 'webpack'; import type { PreloadIncludeType } from '@rsbuild/shared'; +import type { Chunk, Compilation } from 'webpack'; export type ChunkGroup = Compilation['chunkGroups'][0]; diff --git a/packages/core/src/rspack/transformLoader.ts b/packages/core/src/rspack/transformLoader.ts index dc12b3eaaf..90270f2fef 100644 --- a/packages/core/src/rspack/transformLoader.ts +++ b/packages/core/src/rspack/transformLoader.ts @@ -1,5 +1,5 @@ +import type { RspackSourceMap, TransformContext } from '@rsbuild/shared'; import type { LoaderContext } from '@rspack/core'; -import type { TransformContext, RspackSourceMap } from '@rsbuild/shared'; export default async function transform( this: LoaderContext<{ id: string }>, diff --git a/packages/core/src/server/compilerDevMiddleware.ts b/packages/core/src/server/compilerDevMiddleware.ts index c0a6278614..df7ff03c7f 100644 --- a/packages/core/src/server/compilerDevMiddleware.ts +++ b/packages/core/src/server/compilerDevMiddleware.ts @@ -1,11 +1,11 @@ import type { IncomingMessage, ServerResponse } from 'node:http'; import type { Socket } from 'node:net'; import type { + DevMiddleware as CustomDevMiddleware, + DevConfig, DevMiddlewareAPI, NextFunction, ServerConfig, - DevConfig, - DevMiddleware as CustomDevMiddleware, } from '@rsbuild/shared'; import { SocketServer } from './socketServer'; diff --git a/packages/core/src/server/devMiddleware.ts b/packages/core/src/server/devMiddleware.ts index ba7c447514..cb930eccdf 100644 --- a/packages/core/src/server/devMiddleware.ts +++ b/packages/core/src/server/devMiddleware.ts @@ -1,11 +1,11 @@ -import webpackDevMiddleware from '@rsbuild/shared/webpack-dev-middleware'; import { + type DevConfig, + type DevMiddleware, applyToCompiler, isClientCompiler, setupServerHooks, - type DevConfig, - type DevMiddleware, } from '@rsbuild/shared'; +import webpackDevMiddleware from '@rsbuild/shared/webpack-dev-middleware'; import type { Compiler, MultiCompiler } from '@rspack/core'; function applyHMREntry({ diff --git a/packages/core/src/server/devServer.ts b/packages/core/src/server/devServer.ts index 0f84b9403d..0c3d91f8d1 100644 --- a/packages/core/src/server/devServer.ts +++ b/packages/core/src/server/devServer.ts @@ -1,27 +1,27 @@ import { - debug, - getNodeEnv, - setNodeEnv, + type CreateDevMiddlewareReturns, + type CreateDevServerOptions, ROOT_DIST_DIR, - getAddressUrls, - isMultiCompiler, - getPublicPathFromCompiler, type RsbuildDevServer, - type StartServerResult, - type CreateDevServerOptions, type StartDevServerOptions, - type CreateDevMiddlewareReturns, + type StartServerResult, + debug, + getAddressUrls, + getNodeEnv, + getPublicPathFromCompiler, + isMultiCompiler, + setNodeEnv, } from '@rsbuild/shared'; -import { formatRoutes, getDevOptions, printServerURLs } from './helper'; import connect from '@rsbuild/shared/connect'; -import { onBeforeRestartServer } from './restart'; import type { InternalContext } from '../types'; -import { createHttpServer } from './httpServer'; import { - getMiddlewares, type RsbuildDevMiddlewareOptions, + getMiddlewares, } from './getDevMiddlewares'; +import { formatRoutes, getDevOptions, printServerURLs } from './helper'; +import { createHttpServer } from './httpServer'; import { notFoundMiddleware } from './middlewares'; +import { onBeforeRestartServer } from './restart'; export async function createDevServer< Options extends { diff --git a/packages/core/src/server/getDevMiddlewares.ts b/packages/core/src/server/getDevMiddlewares.ts index 9687e65f05..890369aecf 100644 --- a/packages/core/src/server/getDevMiddlewares.ts +++ b/packages/core/src/server/getDevMiddlewares.ts @@ -1,12 +1,13 @@ +import { isAbsolute, join } from 'node:path'; import url from 'node:url'; import type { - ServerAPIs, + CompileMiddlewareAPI, + DevConfig, Middlewares, - UpgradeEvent, RequestHandler, + ServerAPIs, ServerConfig, - CompileMiddlewareAPI, - DevConfig, + UpgradeEvent, } from '@rsbuild/shared'; import { isDebug } from '@rsbuild/shared'; import { @@ -14,7 +15,6 @@ import { getHtmlFallbackMiddleware, getRequestLoggerMiddleware, } from './middlewares'; -import { join, isAbsolute } from 'node:path'; export type RsbuildDevMiddlewareOptions = { pwd: string; diff --git a/packages/core/src/server/helper.ts b/packages/core/src/server/helper.ts index d177e7b290..895ebd6e71 100644 --- a/packages/core/src/server/helper.ts +++ b/packages/core/src/server/helper.ts @@ -1,21 +1,21 @@ import net from 'node:net'; import { + DEFAULT_DEV_HOST, + DEFAULT_PORT, color, - logger, deepmerge, - isFunction, getUrlLabel, + isFunction, + logger, normalizeUrl, - DEFAULT_PORT, - DEFAULT_DEV_HOST, } from '@rsbuild/shared'; import type { - Routes, DevConfig, + OutputStructure, PrintUrls, - RsbuildEntry, + Routes, RsbuildConfig, - OutputStructure, + RsbuildEntry, } from '@rsbuild/shared'; /** diff --git a/packages/core/src/server/middlewares.ts b/packages/core/src/server/middlewares.ts index 1c46b5940f..11dc21be92 100644 --- a/packages/core/src/server/middlewares.ts +++ b/packages/core/src/server/middlewares.ts @@ -1,15 +1,15 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import { parse } from 'node:url'; import { + type HtmlFallback, + type RequestHandler as Middleware, color, debug, - logger, isDebug, - type HtmlFallback, - type RequestHandler as Middleware, + logger, } from '@rsbuild/shared'; import type { NextHandleFunction } from '@rsbuild/shared/connect'; -import { parse } from 'node:url'; -import path from 'node:path'; -import fs from 'node:fs'; export const faviconFallbackMiddleware: Middleware = (req, res, next) => { if (req.url === '/favicon.ico') { diff --git a/packages/core/src/server/prodServer.ts b/packages/core/src/server/prodServer.ts index 3f8062c8a8..5ad5f9494e 100644 --- a/packages/core/src/server/prodServer.ts +++ b/packages/core/src/server/prodServer.ts @@ -1,26 +1,26 @@ import type { Server } from 'node:http'; -import connect from '@rsbuild/shared/connect'; import { join } from 'node:path'; -import sirv from '../../compiled/sirv'; import { - getNodeEnv, - setNodeEnv, + type PreviewServerOptions, ROOT_DIST_DIR, - getAddressUrls, - isDebug, - type ServerConfig, - type RsbuildConfig, type RequestHandler, + type RsbuildConfig, + type ServerConfig, type StartServerResult, - type PreviewServerOptions, + getAddressUrls, + getNodeEnv, + isDebug, + setNodeEnv, } from '@rsbuild/shared'; +import connect from '@rsbuild/shared/connect'; +import sirv from '../../compiled/sirv'; +import type { InternalContext } from '../types'; import { formatRoutes, getServerOptions, printServerURLs } from './helper'; +import { createHttpServer } from './httpServer'; import { faviconFallbackMiddleware, getRequestLoggerMiddleware, } from './middlewares'; -import type { InternalContext } from '../types'; -import { createHttpServer } from './httpServer'; type RsbuildProdServerOptions = { pwd: string; diff --git a/packages/core/src/server/proxy.ts b/packages/core/src/server/proxy.ts index 336ccbdb65..67f3bd1641 100644 --- a/packages/core/src/server/proxy.ts +++ b/packages/core/src/server/proxy.ts @@ -1,14 +1,14 @@ import { - createProxyMiddleware as baseCreateProxyMiddleware, - type RequestHandler, -} from '@rsbuild/shared/http-proxy-middleware'; -import { - logger, - type ProxyDetail, type RequestHandler as Middleware, + type ProxyDetail, type ProxyOptions, type UpgradeEvent, + logger, } from '@rsbuild/shared'; +import { + type RequestHandler, + createProxyMiddleware as baseCreateProxyMiddleware, +} from '@rsbuild/shared/http-proxy-middleware'; export function formatProxyOptions(proxyOptions: ProxyOptions) { const ret: ProxyDetail[] = []; diff --git a/packages/core/src/server/socketServer.ts b/packages/core/src/server/socketServer.ts index 40d7049342..eef3bcca89 100644 --- a/packages/core/src/server/socketServer.ts +++ b/packages/core/src/server/socketServer.ts @@ -1,7 +1,7 @@ import type { IncomingMessage } from 'node:http'; import type { Socket } from 'node:net'; +import { type DevConfig, type Stats, logger } from '@rsbuild/shared'; import ws from '../../compiled/ws'; -import { logger, type Stats, type DevConfig } from '@rsbuild/shared'; import { getAllStatsErrors, getAllStatsWarnings } from '../provider/shared'; interface ExtWebSocket extends ws { diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index d443b7f63d..28dcf8c475 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -1,10 +1,10 @@ import type { + NormalizedConfig, RsbuildConfig, - RsbuildPlugin, - RsbuildPlugins, RsbuildContext, - NormalizedConfig, + RsbuildPlugin, RsbuildPluginAPI, + RsbuildPlugins, TransformHandler, } from '@rsbuild/shared'; import type { Hooks } from './initHooks'; diff --git a/packages/core/tests/asset.test.ts b/packages/core/tests/asset.test.ts index 59f5ff0480..3e2ff69afa 100644 --- a/packages/core/tests/asset.test.ts +++ b/packages/core/tests/asset.test.ts @@ -1,6 +1,6 @@ import { FONT_EXTENSIONS } from '@rsbuild/shared'; import { createStubRsbuild } from '@scripts/test-helper'; -import { pluginAsset, getRegExpForExts } from '../src/plugins/asset'; +import { getRegExpForExts, pluginAsset } from '../src/plugins/asset'; describe('getRegExpForExts', () => { it('should get correct RegExp of exts', () => { diff --git a/packages/core/tests/createCompiler.test.ts b/packages/core/tests/createCompiler.test.ts index f1b9418706..9cac70c716 100644 --- a/packages/core/tests/createCompiler.test.ts +++ b/packages/core/tests/createCompiler.test.ts @@ -1,5 +1,5 @@ -import { createCompiler } from '../src/provider/createCompiler'; import { createContext } from '../src/createContext'; +import { createCompiler } from '../src/provider/createCompiler'; describe('createCompiler', () => { const createDefaultContext = () => diff --git a/packages/core/tests/default.test.ts b/packages/core/tests/default.test.ts index ef685bac3b..484d60cf74 100644 --- a/packages/core/tests/default.test.ts +++ b/packages/core/tests/default.test.ts @@ -1,5 +1,5 @@ -import { createStubRsbuild } from '@scripts/test-helper'; import type { RsbuildPlugin } from '@rsbuild/shared'; +import { createStubRsbuild } from '@scripts/test-helper'; import { BUILTIN_LOADER } from '../src/provider/shared'; describe('applyDefaultPlugins', () => { diff --git a/packages/core/tests/hooks.test.ts b/packages/core/tests/hooks.test.ts index 7e3a65b936..99e1e04f0c 100644 --- a/packages/core/tests/hooks.test.ts +++ b/packages/core/tests/hooks.test.ts @@ -1,5 +1,5 @@ -import { initHooks } from '../src/initHooks'; import { createStubRsbuild } from '@scripts/test-helper'; +import { initHooks } from '../src/initHooks'; describe('initHooks', () => { test('should init hooks correctly', async () => { diff --git a/packages/core/tests/html.test.ts b/packages/core/tests/html.test.ts index 0652517833..9fb81495d0 100644 --- a/packages/core/tests/html.test.ts +++ b/packages/core/tests/html.test.ts @@ -1,7 +1,7 @@ -import { pluginHtml } from '../src/plugins/html'; -import { pluginEntry } from '../src/plugins/entry'; -import { createStubRsbuild } from '@scripts/test-helper'; import type { HtmlConfig } from '@rsbuild/shared'; +import { createStubRsbuild } from '@scripts/test-helper'; +import { pluginEntry } from '../src/plugins/entry'; +import { pluginHtml } from '../src/plugins/html'; vi.mock('@rsbuild/shared', async (importOriginal) => { const mod = await importOriginal(); diff --git a/packages/core/tests/htmlHelper.test.ts b/packages/core/tests/htmlHelper.test.ts index 8c2208f098..3b6cbb4ba2 100644 --- a/packages/core/tests/htmlHelper.test.ts +++ b/packages/core/tests/htmlHelper.test.ts @@ -1,6 +1,6 @@ -import { hasTitle } from '../src/rspack/HtmlBasicPlugin'; -import { getHTMLPathByEntry } from '../src/initPlugins'; import type { NormalizedConfig } from '@rsbuild/shared'; +import { getHTMLPathByEntry } from '../src/initPlugins'; +import { hasTitle } from '../src/rspack/HtmlBasicPlugin'; test('should detect HTML title via "hasTitle" correctly', () => { expect(hasTitle()).toEqual(false); diff --git a/packages/core/tests/inlineChunk.test.ts b/packages/core/tests/inlineChunk.test.ts index 6d1ed915c1..051788eb89 100644 --- a/packages/core/tests/inlineChunk.test.ts +++ b/packages/core/tests/inlineChunk.test.ts @@ -1,7 +1,7 @@ +import { createStubRsbuild } from '@scripts/test-helper'; import { pluginEntry } from '../src/plugins/entry'; import { pluginHtml } from '../src/plugins/html'; import { pluginInlineChunk } from '../src/plugins/inlineChunk'; -import { createStubRsbuild } from '@scripts/test-helper'; describe('plugin-inline-chunk', () => { beforeEach(() => { diff --git a/packages/core/tests/mergeConfig.test.ts b/packages/core/tests/mergeConfig.test.ts index 8c06092d05..0517295611 100644 --- a/packages/core/tests/mergeConfig.test.ts +++ b/packages/core/tests/mergeConfig.test.ts @@ -1,5 +1,5 @@ +import type { RsbuildConfig, RspackConfig } from '@rsbuild/shared'; import { mergeRsbuildConfig } from '../src/mergeConfig'; -import type { RspackConfig, RsbuildConfig } from '@rsbuild/shared'; describe('mergeRsbuildConfig', () => { it('should use `false` to replace empty object', () => { diff --git a/packages/core/tests/minimize.test.ts b/packages/core/tests/minimize.test.ts index ff13f92783..d60d5017ff 100644 --- a/packages/core/tests/minimize.test.ts +++ b/packages/core/tests/minimize.test.ts @@ -1,7 +1,7 @@ import { createStubRsbuild } from '@scripts/test-helper'; -import { pluginMinimize } from '../src/provider/plugins/minimize'; -import { pluginHtml } from '../src/plugins/html'; import { pluginEntry } from '../src/plugins/entry'; +import { pluginHtml } from '../src/plugins/html'; +import { pluginMinimize } from '../src/provider/plugins/minimize'; describe('plugin-minimize', () => { it('should not apply minimizer in development', async () => { diff --git a/packages/core/tests/pluginStore.test.ts b/packages/core/tests/pluginStore.test.ts index fac159e90e..74b303189f 100644 --- a/packages/core/tests/pluginStore.test.ts +++ b/packages/core/tests/pluginStore.test.ts @@ -1,4 +1,4 @@ -import { initPlugins, createPluginManager } from '../src/pluginManager'; +import { createPluginManager, initPlugins } from '../src/pluginManager'; describe('initPlugins', () => { it('should sort plugin correctly', async () => { diff --git a/packages/core/tests/resolve.test.ts b/packages/core/tests/resolve.test.ts index da0f93e15a..166de85a9a 100644 --- a/packages/core/tests/resolve.test.ts +++ b/packages/core/tests/resolve.test.ts @@ -1,5 +1,5 @@ -import { pluginResolve } from '../src/provider/plugins/resolve'; import { createStubRsbuild } from '@scripts/test-helper'; +import { pluginResolve } from '../src/provider/plugins/resolve'; describe('plugin-resolve', () => { it('should apply default extensions correctly', async () => { diff --git a/packages/core/tests/rspackVersion.test.ts b/packages/core/tests/rspackVersion.test.ts index 1139765c4b..8c66166c7b 100644 --- a/packages/core/tests/rspackVersion.test.ts +++ b/packages/core/tests/rspackVersion.test.ts @@ -1,6 +1,6 @@ import { - rspackMinVersion, isSatisfyRspackVersion, + rspackMinVersion, } from '../src/provider/shared'; describe('rspack version', () => { diff --git a/packages/core/tests/server.test.ts b/packages/core/tests/server.test.ts index 7694b150b9..d51d6cec42 100644 --- a/packages/core/tests/server.test.ts +++ b/packages/core/tests/server.test.ts @@ -1,10 +1,10 @@ +import { isClientCompiler, setupServerHooks } from '@rsbuild/shared'; import { rspack } from '@rspack/core'; import { - mergeDevOptions, formatRoutes, + mergeDevOptions, printServerURLs, } from '../src/server/helper'; -import { isClientCompiler, setupServerHooks } from '@rsbuild/shared'; test('formatRoutes', () => { expect( diff --git a/packages/core/tests/splitChunks.test.ts b/packages/core/tests/splitChunks.test.ts index f63dab5a3e..48cc455e74 100644 --- a/packages/core/tests/splitChunks.test.ts +++ b/packages/core/tests/splitChunks.test.ts @@ -1,8 +1,8 @@ import { createStubRsbuild } from '@scripts/test-helper'; import { - pluginSplitChunks, MODULE_PATH_REGEX, getPackageNameFromModulePath, + pluginSplitChunks, } from '../src/plugins/splitChunks'; describe('plugin-split-chunks', () => { diff --git a/packages/core/tests/swc.test.ts b/packages/core/tests/swc.test.ts index 5a451e24b9..1215f584d5 100644 --- a/packages/core/tests/swc.test.ts +++ b/packages/core/tests/swc.test.ts @@ -1,6 +1,6 @@ import type { RsbuildConfig } from '@rsbuild/shared'; -import { pluginEntry } from '../src/plugins/entry'; import { createStubRsbuild } from '@scripts/test-helper'; +import { pluginEntry } from '../src/plugins/entry'; import { pluginSwc } from '../src/provider/plugins/swc'; describe('plugin-swc', () => { diff --git a/packages/core/tests/target.test.ts b/packages/core/tests/target.test.ts index eea9b46fab..8a857343bb 100644 --- a/packages/core/tests/target.test.ts +++ b/packages/core/tests/target.test.ts @@ -1,6 +1,6 @@ -import type { MockInstance } from 'vitest'; -import { createStubRsbuild } from '@scripts/test-helper'; import { getBrowserslist } from '@rsbuild/shared'; +import { createStubRsbuild } from '@scripts/test-helper'; +import type { MockInstance } from 'vitest'; import { pluginTarget } from '../src/plugins/target'; vi.mock('@rsbuild/shared', async (importOriginal) => { diff --git a/packages/create-rsbuild/src/index.ts b/packages/create-rsbuild/src/index.ts index 3cd1fb6e50..b945688d84 100644 --- a/packages/create-rsbuild/src/index.ts +++ b/packages/create-rsbuild/src/index.ts @@ -2,8 +2,8 @@ import fs from 'node:fs'; import path from 'node:path'; +import { cancel, isCancel, note, outro, select, text } from '@clack/prompts'; import { logger } from 'rslog'; -import { text, select, isCancel, cancel, note, outro } from '@clack/prompts'; function checkCancel(value: unknown) { if (isCancel(value)) { diff --git a/packages/create-rsbuild/template-svelte-js/src/index.js b/packages/create-rsbuild/template-svelte-js/src/index.js index 6e1ba693db..a946c5b6a7 100644 --- a/packages/create-rsbuild/template-svelte-js/src/index.js +++ b/packages/create-rsbuild/template-svelte-js/src/index.js @@ -1,5 +1,5 @@ -import './index.css'; import App from './App.svelte'; +import './index.css'; const app = new App({ target: document.body, diff --git a/packages/create-rsbuild/template-svelte-ts/src/index.ts b/packages/create-rsbuild/template-svelte-ts/src/index.ts index 6e1ba693db..a946c5b6a7 100644 --- a/packages/create-rsbuild/template-svelte-ts/src/index.ts +++ b/packages/create-rsbuild/template-svelte-ts/src/index.ts @@ -1,5 +1,5 @@ -import './index.css'; import App from './App.svelte'; +import './index.css'; const app = new App({ target: document.body, diff --git a/packages/create-rsbuild/template-vue2-js/src/index.js b/packages/create-rsbuild/template-vue2-js/src/index.js index decf834dc9..afef416655 100644 --- a/packages/create-rsbuild/template-vue2-js/src/index.js +++ b/packages/create-rsbuild/template-vue2-js/src/index.js @@ -1,6 +1,6 @@ -import './index.css'; import Vue from 'vue'; import App from './App.vue'; +import './index.css'; new Vue({ el: '#root', diff --git a/packages/create-rsbuild/template-vue2-ts/src/index.ts b/packages/create-rsbuild/template-vue2-ts/src/index.ts index decf834dc9..afef416655 100644 --- a/packages/create-rsbuild/template-vue2-ts/src/index.ts +++ b/packages/create-rsbuild/template-vue2-ts/src/index.ts @@ -1,6 +1,6 @@ -import './index.css'; import Vue from 'vue'; import App from './App.vue'; +import './index.css'; new Vue({ el: '#root', diff --git a/packages/create-rsbuild/template-vue3-js/src/index.js b/packages/create-rsbuild/template-vue3-js/src/index.js index 47b051a32e..aa3ede0b4e 100644 --- a/packages/create-rsbuild/template-vue3-js/src/index.js +++ b/packages/create-rsbuild/template-vue3-js/src/index.js @@ -1,5 +1,5 @@ -import './index.css'; import { createApp } from 'vue'; import App from './App.vue'; +import './index.css'; createApp(App).mount('#root'); diff --git a/packages/create-rsbuild/template-vue3-ts/src/index.ts b/packages/create-rsbuild/template-vue3-ts/src/index.ts index 47b051a32e..aa3ede0b4e 100644 --- a/packages/create-rsbuild/template-vue3-ts/src/index.ts +++ b/packages/create-rsbuild/template-vue3-ts/src/index.ts @@ -1,5 +1,5 @@ -import './index.css'; import { createApp } from 'vue'; import App from './App.vue'; +import './index.css'; createApp(App).mount('#root'); diff --git a/packages/monorepo-utils/src/common/getBaseData.ts b/packages/monorepo-utils/src/common/getBaseData.ts index 8fd782674d..959a013548 100644 --- a/packages/monorepo-utils/src/common/getBaseData.ts +++ b/packages/monorepo-utils/src/common/getBaseData.ts @@ -1,7 +1,7 @@ import path from 'node:path'; import type { MonorepoAnalyzer } from '../types'; -import { isMonorepo, type IsMonorepoFn } from './isMonorepo'; import type { GetProjectsFunc } from './getProjects'; +import { type IsMonorepoFn, isMonorepo } from './isMonorepo'; export interface IMonorepoBaseData { isMonorepo: boolean; diff --git a/packages/monorepo-utils/src/common/pnpm.ts b/packages/monorepo-utils/src/common/pnpm.ts index a672422c55..86aa01f7b3 100644 --- a/packages/monorepo-utils/src/common/pnpm.ts +++ b/packages/monorepo-utils/src/common/pnpm.ts @@ -2,10 +2,10 @@ import path from 'node:path'; import { fse } from '@rsbuild/shared'; import { parse } from '@rsbuild/shared/yaml'; import glob, { type Options as GlobOptions } from 'fast-glob'; +import { PACKAGE_JSON, PNPM_WORKSPACE_FILE } from '../constants'; import { Project } from '../project/project'; -import { PNPM_WORKSPACE_FILE, PACKAGE_JSON } from '../constants'; -import { readPackageJson } from '../utils'; import type { IPnpmWorkSpace } from '../types'; +import { readPackageJson } from '../utils'; export const getPatternsFromYaml = async (monorepoRoot: string) => { const workspaceYamlFilePath = path.join(monorepoRoot, PNPM_WORKSPACE_FILE); diff --git a/packages/monorepo-utils/src/project-utils/getDependentProjects.ts b/packages/monorepo-utils/src/project-utils/getDependentProjects.ts index f54c97cfb5..cba6c1d901 100644 --- a/packages/monorepo-utils/src/project-utils/getDependentProjects.ts +++ b/packages/monorepo-utils/src/project-utils/getDependentProjects.ts @@ -4,7 +4,7 @@ import { getMonorepoBaseData, getMonorepoSubProjects } from '../common'; import type { Project } from '../project/project'; import type { MonorepoAnalyzer } from '../types'; import { readPackageJson } from '../utils'; -import { defaultFilter, type Filter } from './filter'; +import { type Filter, defaultFilter } from './filter'; export type ExtraMonorepoStrategies = Record; diff --git a/packages/monorepo-utils/src/project/project.ts b/packages/monorepo-utils/src/project/project.ts index 26822e8787..1636b70717 100644 --- a/packages/monorepo-utils/src/project/project.ts +++ b/packages/monorepo-utils/src/project/project.ts @@ -1,8 +1,8 @@ import fs from 'node:fs'; import path from 'node:path'; -import type { INodePackageJson, ExportsConfig } from '../types/packageJson'; -import { readPackageJson } from '../utils'; import { PACKAGE_JSON } from '../constants'; +import type { ExportsConfig, INodePackageJson } from '../types/packageJson'; +import { readPackageJson } from '../utils'; export class Project { name: string; diff --git a/packages/monorepo-utils/src/types/index.ts b/packages/monorepo-utils/src/types/index.ts index b0771ec064..25e814986f 100644 --- a/packages/monorepo-utils/src/types/index.ts +++ b/packages/monorepo-utils/src/types/index.ts @@ -1,5 +1,5 @@ -import type { IsMonorepoFn } from '../common/isMonorepo'; import type { GetProjectsFunc } from '../common/getProjects'; +import type { IsMonorepoFn } from '../common/isMonorepo'; export * from './packageJson'; export * from './rushJson'; diff --git a/packages/plugin-assets-retry/src/AssetsRetryPlugin.ts b/packages/plugin-assets-retry/src/AssetsRetryPlugin.ts index 5d740b1530..c638c6cc30 100644 --- a/packages/plugin-assets-retry/src/AssetsRetryPlugin.ts +++ b/packages/plugin-assets-retry/src/AssetsRetryPlugin.ts @@ -1,10 +1,10 @@ import path from 'node:path'; import { + type Rspack, fse, - withPublicPath, generateScriptTag, getPublicPathFromCompiler, - type Rspack, + withPublicPath, } from '@rsbuild/shared'; import type HtmlWebpackPlugin from 'html-webpack-plugin'; import type { PluginAssetsRetryOptions } from './types'; diff --git a/packages/plugin-assets-retry/src/index.ts b/packages/plugin-assets-retry/src/index.ts index ca396d0abf..975a24e12b 100644 --- a/packages/plugin-assets-retry/src/index.ts +++ b/packages/plugin-assets-retry/src/index.ts @@ -1,5 +1,5 @@ -import { getDistPath, isHtmlDisabled } from '@rsbuild/shared'; import type { RsbuildPlugin } from '@rsbuild/core'; +import { getDistPath, isHtmlDisabled } from '@rsbuild/shared'; import type { PluginAssetsRetryOptions } from './types'; export type { PluginAssetsRetryOptions }; diff --git a/packages/plugin-assets-retry/src/runtime/index.ts b/packages/plugin-assets-retry/src/runtime/index.ts index d2e84d68e2..9f00ede324 100644 --- a/packages/plugin-assets-retry/src/runtime/index.ts +++ b/packages/plugin-assets-retry/src/runtime/index.ts @@ -1,8 +1,8 @@ // rsbuild/initial-chunk/retry import type { CrossOrigin } from '@rsbuild/shared'; import type { - PluginAssetsRetryOptions, AssetsRetryHookContext, + PluginAssetsRetryOptions, } from '../types'; interface ScriptElementAttributes { diff --git a/packages/plugin-assets-retry/tests/assetsRetry.test.ts b/packages/plugin-assets-retry/tests/assetsRetry.test.ts index 7b1f673b9f..283d2ab683 100644 --- a/packages/plugin-assets-retry/tests/assetsRetry.test.ts +++ b/packages/plugin-assets-retry/tests/assetsRetry.test.ts @@ -1,5 +1,5 @@ -import { pluginAssetsRetry } from '../src'; import { createStubRsbuild } from '../../compat/webpack/tests/helper'; +import { pluginAssetsRetry } from '../src'; describe('plugin-assets-retry', () => { it('should add assets retry plugin', async () => { diff --git a/packages/plugin-babel/src/helper.ts b/packages/plugin-babel/src/helper.ts index 7cf205cf92..bc935087a3 100644 --- a/packages/plugin-babel/src/helper.ts +++ b/packages/plugin-babel/src/helper.ts @@ -1,22 +1,22 @@ import { isAbsolute, normalize, sep } from 'node:path'; +import type { PluginOptions as BabelPluginOptions } from '@babel/core'; import { - castArray, - mergeChainedOptions, type BundlerChain, type ChainIdentifier, type NormalizedConfig, + castArray, + mergeChainedOptions, } from '@rsbuild/shared'; import upath from 'upath'; import type { - BabelPlugin, BabelConfigUtils, - PresetEnvOptions, - PresetReactOptions, + BabelLoaderOptions, + BabelPlugin, BabelTransformOptions, PluginBabelOptions, - BabelLoaderOptions, + PresetEnvOptions, + PresetReactOptions, } from './types'; -import type { PluginOptions as BabelPluginOptions } from '@babel/core'; export const BABEL_JS_RULE = 'babel-js'; diff --git a/packages/plugin-babel/src/plugin.ts b/packages/plugin-babel/src/plugin.ts index d51e3424fc..00c0ef3138 100644 --- a/packages/plugin-babel/src/plugin.ts +++ b/packages/plugin-babel/src/plugin.ts @@ -1,18 +1,18 @@ import path, { isAbsolute, join } from 'node:path'; import type { - RsbuildPlugin, - RsbuildContext, NormalizedConfig, + RsbuildContext, + RsbuildPlugin, } from '@rsbuild/core'; import { - fse, - isProd, + SCRIPT_REGEX, castArray, cloneDeep, + fse, getNodeEnv, - SCRIPT_REGEX, + isProd, } from '@rsbuild/shared'; -import { applyUserBabelConfig, BABEL_JS_RULE } from './helper'; +import { BABEL_JS_RULE, applyUserBabelConfig } from './helper'; import type { BabelLoaderOptions, PluginBabelOptions } from './types'; export const PLUGIN_BABEL_NAME = 'rsbuild:babel'; diff --git a/packages/plugin-babel/src/types.ts b/packages/plugin-babel/src/types.ts index 297f71ab2e..48afeefbe1 100644 --- a/packages/plugin-babel/src/types.ts +++ b/packages/plugin-babel/src/types.ts @@ -1,8 +1,8 @@ -import type { ChainedConfigWithUtils } from '@rsbuild/shared'; import type { PluginItem as BabelPlugin, TransformOptions as BabelTransformOptions, } from '@babel/core'; +import type { ChainedConfigWithUtils } from '@rsbuild/shared'; export type { BabelPlugin, BabelTransformOptions }; diff --git a/packages/plugin-babel/tests/index.test.ts b/packages/plugin-babel/tests/index.test.ts index 410269bf7a..bd4575016f 100644 --- a/packages/plugin-babel/tests/index.test.ts +++ b/packages/plugin-babel/tests/index.test.ts @@ -1,7 +1,7 @@ -import { expect, describe, it } from 'vitest'; -import { pluginBabel } from '../src'; -import { createStubRsbuild } from '@scripts/test-helper'; import { SCRIPT_REGEX } from '@rsbuild/shared'; +import { createStubRsbuild } from '@scripts/test-helper'; +import { describe, expect, it } from 'vitest'; +import { pluginBabel } from '../src'; describe('plugins/babel', () => { it('babel-loader should works with builtin:swc-loader', async () => { diff --git a/packages/plugin-check-syntax/src/CheckSyntaxPlugin.ts b/packages/plugin-check-syntax/src/CheckSyntaxPlugin.ts index 4880e0357a..17e0f4b0af 100644 --- a/packages/plugin-check-syntax/src/CheckSyntaxPlugin.ts +++ b/packages/plugin-check-syntax/src/CheckSyntaxPlugin.ts @@ -1,25 +1,25 @@ import { resolve } from 'node:path'; +import type { Rspack } from '@rsbuild/core'; +import { + HTML_REGEX, + JS_REGEX, + browserslistToESVersion, + fse, +} from '@rsbuild/shared'; import { parse } from 'acorn'; import { - printErrors, + checkIsExcludeSource, generateError, generateHtmlScripts, - checkIsExcludeSource, + printErrors, } from './helpers'; -import { - fse, - JS_REGEX, - HTML_REGEX, - browserslistToESVersion, -} from '@rsbuild/shared'; import type { + AcornParseError, + CheckSyntaxExclude, + CheckSyntaxOptions, ECMASyntaxError, EcmaVersion, - CheckSyntaxOptions, - CheckSyntaxExclude, - AcornParseError, } from './types'; -import type { Rspack } from '@rsbuild/core'; type Compiler = Rspack.Compiler; type Compilation = Rspack.Compilation; diff --git a/packages/plugin-check-syntax/src/helpers/generateError.ts b/packages/plugin-check-syntax/src/helpers/generateError.ts index df3dcf1e70..7a1822052c 100644 --- a/packages/plugin-check-syntax/src/helpers/generateError.ts +++ b/packages/plugin-check-syntax/src/helpers/generateError.ts @@ -1,11 +1,11 @@ -import { fse, color } from '@rsbuild/shared'; +import { color, fse } from '@rsbuild/shared'; import { SourceMapConsumer } from 'source-map'; -import { checkIsExcludeSource } from './utils'; import { - ECMASyntaxError, type AcornParseError, type CheckSyntaxExclude, + ECMASyntaxError, } from '../types'; +import { checkIsExcludeSource } from './utils'; export function displayCodePointer(code: string, pos: number) { const SUB_LEN = 80; diff --git a/packages/plugin-check-syntax/src/index.ts b/packages/plugin-check-syntax/src/index.ts index 2959463ecd..89d4521720 100644 --- a/packages/plugin-check-syntax/src/index.ts +++ b/packages/plugin-check-syntax/src/index.ts @@ -1,9 +1,9 @@ +import type { RsbuildPlugin } from '@rsbuild/core'; import { - getBrowserslistWithDefault, - type RsbuildTarget, type NormalizedConfig, + type RsbuildTarget, + getBrowserslistWithDefault, } from '@rsbuild/shared'; -import type { RsbuildPlugin } from '@rsbuild/core'; import type { CheckSyntaxOptions } from './types'; export type PluginCheckSyntaxOptions = CheckSyntaxOptions; diff --git a/packages/plugin-check-syntax/tests/CheckSyntaxPlugin.test.ts b/packages/plugin-check-syntax/tests/CheckSyntaxPlugin.test.ts index 6b55041675..a4b6a0eaa4 100644 --- a/packages/plugin-check-syntax/tests/CheckSyntaxPlugin.test.ts +++ b/packages/plugin-check-syntax/tests/CheckSyntaxPlugin.test.ts @@ -1,5 +1,5 @@ +import { displayCodePointer, makeCodeFrame } from '../src/helpers'; import { getHtmlScripts } from '../src/helpers/generateHtmlScripts'; -import { makeCodeFrame, displayCodePointer } from '../src/helpers'; describe('getHtmlScripts', () => { test('should extract inline scripts correctly', async () => { diff --git a/packages/plugin-css-minimizer/src/index.ts b/packages/plugin-css-minimizer/src/index.ts index 6af7e5b924..edab5fbf48 100644 --- a/packages/plugin-css-minimizer/src/index.ts +++ b/packages/plugin-css-minimizer/src/index.ts @@ -1,9 +1,9 @@ import type { RsbuildPlugin } from '@rsbuild/core'; import { - mergeChainedOptions, type BundlerChain, - type ChainedConfig, type ChainIdentifier, + type ChainedConfig, + mergeChainedOptions, parseMinifyOptions, } from '@rsbuild/shared'; import CssMinimizerWebpackPlugin from 'css-minimizer-webpack-plugin'; diff --git a/packages/plugin-image-compress/src/index.ts b/packages/plugin-image-compress/src/index.ts index 152042bcef..3dd3695cd2 100644 --- a/packages/plugin-image-compress/src/index.ts +++ b/packages/plugin-image-compress/src/index.ts @@ -1,5 +1,5 @@ -import type { RsbuildPlugin } from '@rsbuild/core'; import assert from 'node:assert'; +import type { RsbuildPlugin } from '@rsbuild/core'; import { ImageMinimizerPlugin } from './minimizer'; import { withDefaultOptions } from './shared/utils'; import type { Codecs, Options } from './types'; diff --git a/packages/plugin-image-compress/src/shared/codecs.ts b/packages/plugin-image-compress/src/shared/codecs.ts index 6892a4b6b4..32c46b1f80 100644 --- a/packages/plugin-image-compress/src/shared/codecs.ts +++ b/packages/plugin-image-compress/src/shared/codecs.ts @@ -1,9 +1,9 @@ import { Buffer } from 'node:buffer'; import { + Transformer, compressJpeg, losslessCompressPng, pngQuantize, - Transformer, } from '@napi-rs/image'; import svgo from 'svgo'; import type { Codec, Codecs } from '../types'; diff --git a/packages/plugin-lightningcss/src/loader.ts b/packages/plugin-lightningcss/src/loader.ts index 3cb8dfb112..226b71008a 100644 --- a/packages/plugin-lightningcss/src/loader.ts +++ b/packages/plugin-lightningcss/src/loader.ts @@ -1,3 +1,4 @@ +import { Buffer } from 'node:buffer'; /** * modified from https://github.com/fz6m/lightningcss-loader * MIT License https://github.com/fz6m/lightningcss-loader/blob/main/LICENSE @@ -5,7 +6,6 @@ */ import type { Rspack } from '@rsbuild/shared'; import { transform as _transform } from 'lightningcss'; -import { Buffer } from 'node:buffer'; import type { LightningCSSLoaderOptions } from './types'; const LOADER_NAME = 'lightningcss-loader'; diff --git a/packages/plugin-lightningcss/src/minimizer.ts b/packages/plugin-lightningcss/src/minimizer.ts index d971b3b8ba..c5ba21a0ad 100644 --- a/packages/plugin-lightningcss/src/minimizer.ts +++ b/packages/plugin-lightningcss/src/minimizer.ts @@ -1,12 +1,12 @@ +import { Buffer } from 'node:buffer'; +import { CSS_REGEX } from '@rsbuild/shared'; +import type { Rspack } from '@rsbuild/shared'; /** * modified from https://github.com/fz6m/lightningcss-loader * MIT License https://github.com/fz6m/lightningcss-loader/blob/main/LICENSE * Author @fz6m */ import { transform as _transform } from 'lightningcss'; -import { Buffer } from 'node:buffer'; -import { CSS_REGEX } from '@rsbuild/shared'; -import type { Rspack } from '@rsbuild/shared'; import type { LightningCSSMinifyPluginOptions } from './types'; const PLUGIN_NAME = 'lightningcss-minify-plugin'; diff --git a/packages/plugin-lightningcss/src/plugin.ts b/packages/plugin-lightningcss/src/plugin.ts index de58f9b065..df8b6cad7d 100644 --- a/packages/plugin-lightningcss/src/plugin.ts +++ b/packages/plugin-lightningcss/src/plugin.ts @@ -1,24 +1,24 @@ +import path from 'node:path'; import { getBrowserslistWithDefault, mergeChainedOptions, parseMinifyOptions, } from '@rsbuild/shared'; import type { - ModifyBundlerChainUtils, - RsbuildPlugin, BundlerChain, - RsbuildContext, + ModifyBundlerChainUtils, NormalizedConfig, + RsbuildContext, + RsbuildPlugin, RsbuildTarget, } from '@rsbuild/shared'; import browserslist from '@rsbuild/shared/browserslist'; import { browserslistToTargets as _browserslistToTargets } from 'lightningcss'; -import path from 'node:path'; +import type * as LightningCSS from 'lightningcss'; import type { LightningCSSLoaderOptions, PluginLightningcssOptions, } from './types'; -import type * as LightningCSS from 'lightningcss'; const PLUGIN_NAME = 'rsbuild:lightningcss'; diff --git a/packages/plugin-lightningcss/tests/index.test.ts b/packages/plugin-lightningcss/tests/index.test.ts index 4b47225f50..f11a0cff39 100644 --- a/packages/plugin-lightningcss/tests/index.test.ts +++ b/packages/plugin-lightningcss/tests/index.test.ts @@ -1,12 +1,12 @@ -import { expect, describe, it } from 'vitest'; -import { pluginLightningcss, lightningcss } from '../src'; -import { createStubRsbuild } from '@scripts/test-helper'; import { createRsbuild } from '@rsbuild/core'; import { + type RspackConfig, type RuleSetRule, isPlainObject, - type RspackConfig, } from '@rsbuild/shared'; +import { createStubRsbuild } from '@scripts/test-helper'; +import { describe, expect, it } from 'vitest'; +import { lightningcss, pluginLightningcss } from '../src'; const getCssRules = (rspackConfig: RspackConfig) => { const CSS_RULES = ['css', 'scss', 'sass', 'less', 'stylus']; diff --git a/packages/plugin-mdx/src/index.ts b/packages/plugin-mdx/src/index.ts index 2f13353db4..774f19bf93 100644 --- a/packages/plugin-mdx/src/index.ts +++ b/packages/plugin-mdx/src/index.ts @@ -1,5 +1,5 @@ -import type { RsbuildPlugin } from '@rsbuild/core'; import type { Options as MdxLoaderOptions } from '@mdx-js/loader'; +import type { RsbuildPlugin } from '@rsbuild/core'; export type PluginMdxOptions = { /** diff --git a/packages/plugin-mdx/tests/index.test.ts b/packages/plugin-mdx/tests/index.test.ts index be6fa8e4f4..0c29fb10a4 100644 --- a/packages/plugin-mdx/tests/index.test.ts +++ b/packages/plugin-mdx/tests/index.test.ts @@ -1,6 +1,6 @@ +import { createRsbuild } from '@rsbuild/core'; import { isPlainObject } from '@rsbuild/shared'; import { pluginMdx } from '../src'; -import { createRsbuild } from '@rsbuild/core'; describe('plugin-mdx', () => { it('should register mdx loader correctly', async () => { diff --git a/packages/plugin-preact/src/index.ts b/packages/plugin-preact/src/index.ts index 48ca8f2e89..d13b7017bc 100644 --- a/packages/plugin-preact/src/index.ts +++ b/packages/plugin-preact/src/index.ts @@ -1,5 +1,5 @@ import type { RsbuildConfig, RsbuildPlugin } from '@rsbuild/core'; -import { getNodeEnv, type SwcReactConfig } from '@rsbuild/shared'; +import { type SwcReactConfig, getNodeEnv } from '@rsbuild/shared'; export type PluginPreactOptions = { /** diff --git a/packages/plugin-preact/tests/index.test.ts b/packages/plugin-preact/tests/index.test.ts index 16508f558d..0cf1f3b317 100644 --- a/packages/plugin-preact/tests/index.test.ts +++ b/packages/plugin-preact/tests/index.test.ts @@ -1,6 +1,6 @@ -import { expect, describe, it } from 'vitest'; -import { pluginPreact } from '../src'; import { createRsbuild } from '@rsbuild/core'; +import { describe, expect, it } from 'vitest'; +import { pluginPreact } from '../src'; describe('plugins/preact', () => { const preactAlias = { diff --git a/packages/plugin-pug/src/index.ts b/packages/plugin-pug/src/index.ts index 0d6b826f8e..8f0c725860 100644 --- a/packages/plugin-pug/src/index.ts +++ b/packages/plugin-pug/src/index.ts @@ -1,5 +1,5 @@ -import { mergeChainedOptions } from '@rsbuild/shared'; import type { RsbuildPlugin } from '@rsbuild/core'; +import { mergeChainedOptions } from '@rsbuild/shared'; import type { Options as PugOptions } from 'pug'; export type PluginPugOptions = { diff --git a/packages/plugin-react/src/index.ts b/packages/plugin-react/src/index.ts index 1538ab5ec5..fdc5225d64 100644 --- a/packages/plugin-react/src/index.ts +++ b/packages/plugin-react/src/index.ts @@ -1,8 +1,8 @@ import type { RsbuildPlugin } from '@rsbuild/core'; import type { SwcReactConfig } from '@rsbuild/shared'; -import { applySplitChunksRule } from './splitChunks'; -import { applyBasicReactSupport, applyReactProfiler } from './react'; import { getNodeEnv } from '@rsbuild/shared'; +import { applyBasicReactSupport, applyReactProfiler } from './react'; +import { applySplitChunksRule } from './splitChunks'; export type SplitReactChunkOptions = { /** diff --git a/packages/plugin-react/src/react.ts b/packages/plugin-react/src/react.ts index 9ff359ab10..5af4a2b293 100644 --- a/packages/plugin-react/src/react.ts +++ b/packages/plugin-react/src/react.ts @@ -1,11 +1,11 @@ import path from 'node:path'; +import type { RsbuildConfig, RsbuildPluginAPI } from '@rsbuild/core'; import { - isUsingHMR, SCRIPT_REGEX, - modifySwcLoaderOptions, type SwcReactConfig, + isUsingHMR, + modifySwcLoaderOptions, } from '@rsbuild/shared'; -import type { RsbuildConfig, RsbuildPluginAPI } from '@rsbuild/core'; import type { PluginReactOptions } from '.'; export const applyBasicReactSupport = ( diff --git a/packages/plugin-react/src/splitChunks.ts b/packages/plugin-react/src/splitChunks.ts index 799c69f560..466a91ba0c 100644 --- a/packages/plugin-react/src/splitChunks.ts +++ b/packages/plugin-react/src/splitChunks.ts @@ -1,9 +1,9 @@ import type { RsbuildPluginAPI } from '@rsbuild/core'; import { - isProd, - isPlainObject, - createCacheGroups, type SplitChunks, + createCacheGroups, + isPlainObject, + isProd, } from '@rsbuild/shared'; import type { SplitReactChunkOptions } from '.'; diff --git a/packages/plugin-react/tests/features.test.ts b/packages/plugin-react/tests/features.test.ts index fe5432731e..3445365b98 100644 --- a/packages/plugin-react/tests/features.test.ts +++ b/packages/plugin-react/tests/features.test.ts @@ -1,7 +1,7 @@ -import { expect, describe, it, vi } from 'vitest'; -import { pluginReact } from '../src'; -import { createStubRsbuild } from '@scripts/test-helper'; import { SCRIPT_REGEX } from '@rsbuild/shared'; +import { createStubRsbuild } from '@scripts/test-helper'; +import { describe, expect, it, vi } from 'vitest'; +import { pluginReact } from '../src'; describe('splitChunks', () => { it('should apply antd/semi/... splitChunks rule when pkg is installed', async () => { diff --git a/packages/plugin-react/tests/index.test.ts b/packages/plugin-react/tests/index.test.ts index 8700309e6f..30541b606f 100644 --- a/packages/plugin-react/tests/index.test.ts +++ b/packages/plugin-react/tests/index.test.ts @@ -1,6 +1,6 @@ -import { expect, describe, it, vi } from 'vitest'; -import { pluginReact } from '../src'; import { createStubRsbuild } from '@scripts/test-helper'; +import { describe, expect, it, vi } from 'vitest'; +import { pluginReact } from '../src'; describe('plugins/react', () => { it('should work with swc-loader', async () => { diff --git a/packages/plugin-rem/src/AutoSetRootFontSizePlugin.ts b/packages/plugin-rem/src/AutoSetRootFontSizePlugin.ts index 9ee7298911..4b65b6d4ed 100644 --- a/packages/plugin-rem/src/AutoSetRootFontSizePlugin.ts +++ b/packages/plugin-rem/src/AutoSetRootFontSizePlugin.ts @@ -1,12 +1,12 @@ import path from 'node:path'; import { logger } from '@rsbuild/core'; import { - isProd, - withPublicPath, - generateScriptTag, - getPublicPathFromCompiler, type Rspack, type ScriptLoading, + generateScriptTag, + getPublicPathFromCompiler, + isProd, + withPublicPath, } from '@rsbuild/shared'; import type HtmlWebpackPlugin from 'html-webpack-plugin'; import type { PluginRemOptions } from './types'; diff --git a/packages/plugin-rem/src/index.ts b/packages/plugin-rem/src/index.ts index 8353bce73e..0f47975bb0 100644 --- a/packages/plugin-rem/src/index.ts +++ b/packages/plugin-rem/src/index.ts @@ -1,5 +1,5 @@ import type { RsbuildPlugin } from '@rsbuild/core'; -import { getDistPath, type PostCSSPlugin } from '@rsbuild/shared'; +import { type PostCSSPlugin, getDistPath } from '@rsbuild/shared'; import { cloneDeep } from '@rsbuild/shared'; import type { PluginRemOptions, PxToRemOptions } from './types'; diff --git a/packages/plugin-rem/tests/AutoSetRootFontSizePlugin.test.ts b/packages/plugin-rem/tests/AutoSetRootFontSizePlugin.test.ts index cebb5675ad..0c92abfd88 100644 --- a/packages/plugin-rem/tests/AutoSetRootFontSizePlugin.test.ts +++ b/packages/plugin-rem/tests/AutoSetRootFontSizePlugin.test.ts @@ -1,7 +1,7 @@ import { - getRootPixelCode, - genJSTemplate, DEFAULT_OPTIONS, + genJSTemplate, + getRootPixelCode, } from '../src/AutoSetRootFontSizePlugin'; const customOptions = { diff --git a/packages/plugin-rem/tests/index.test.ts b/packages/plugin-rem/tests/index.test.ts index cd737a6548..cf6effd859 100644 --- a/packages/plugin-rem/tests/index.test.ts +++ b/packages/plugin-rem/tests/index.test.ts @@ -1,8 +1,8 @@ -import { pluginRem } from '../src'; import { createStubRsbuild } from '@scripts/test-helper'; import { pluginCss } from '../../core/src/provider/plugins/css'; import { pluginLess } from '../../core/src/provider/plugins/less'; import { pluginSass } from '../../core/src/provider/plugins/sass'; +import { pluginRem } from '../src'; describe('plugin-rem', () => { it('should run rem plugin with default config', async () => { diff --git a/packages/plugin-solid/src/index.ts b/packages/plugin-solid/src/index.ts index 3b8087e415..8cce99e2b6 100644 --- a/packages/plugin-solid/src/index.ts +++ b/packages/plugin-solid/src/index.ts @@ -1,7 +1,7 @@ import type { RsbuildPlugin } from '@rsbuild/core'; -import type { SolidPresetOptions } from './types'; import { modifyBabelLoaderOptions } from '@rsbuild/plugin-babel'; import { isUsingHMR } from '@rsbuild/shared'; +import type { SolidPresetOptions } from './types'; export type PluginSolidOptions = { /** diff --git a/packages/plugin-solid/tests/index.test.ts b/packages/plugin-solid/tests/index.test.ts index 45624993ff..f69b37213f 100644 --- a/packages/plugin-solid/tests/index.test.ts +++ b/packages/plugin-solid/tests/index.test.ts @@ -1,7 +1,7 @@ -import { createStubRsbuild } from '@scripts/test-helper'; +import type { RsbuildConfig } from '@rsbuild/core'; import { pluginBabel } from '@rsbuild/plugin-babel'; +import { createStubRsbuild } from '@scripts/test-helper'; import { pluginSolid } from '../src'; -import type { RsbuildConfig } from '@rsbuild/core'; describe('plugin-solid', () => { const rsbuildConfig: RsbuildConfig = { diff --git a/packages/plugin-source-build/src/index.ts b/packages/plugin-source-build/src/index.ts index c32d045742..a0c83a03e3 100644 --- a/packages/plugin-source-build/src/index.ts +++ b/packages/plugin-source-build/src/index.ts @@ -1,13 +1,13 @@ import fs from 'node:fs'; import path from 'node:path'; -import { TS_CONFIG_FILE, fse } from '@rsbuild/shared'; import type { RsbuildPlugin } from '@rsbuild/core'; import { + type ExtraMonorepoStrategies, + type Project, filterByField, getDependentProjects, - type Project, - type ExtraMonorepoStrategies, } from '@rsbuild/monorepo-utils'; +import { TS_CONFIG_FILE, fse } from '@rsbuild/shared'; export const PLUGIN_SOURCE_BUILD_NAME = 'rsbuild:source-build'; diff --git a/packages/plugin-source-build/tests/index.test.ts b/packages/plugin-source-build/tests/index.test.ts index 3bfdc33502..059d1b1a24 100644 --- a/packages/plugin-source-build/tests/index.test.ts +++ b/packages/plugin-source-build/tests/index.test.ts @@ -1,5 +1,5 @@ -import { createStubRsbuild } from '@scripts/test-helper'; import { pluginBabel } from '@rsbuild/plugin-babel'; +import { createStubRsbuild } from '@scripts/test-helper'; import { pluginSourceBuild } from '../src'; describe('plugin-source-build', () => { diff --git a/packages/plugin-styled-components/src/index.ts b/packages/plugin-styled-components/src/index.ts index 99103fe777..2f3ecaa92a 100644 --- a/packages/plugin-styled-components/src/index.ts +++ b/packages/plugin-styled-components/src/index.ts @@ -1,10 +1,10 @@ import type { RsbuildConfig, RsbuildPlugin } from '@rsbuild/core'; import { + type ChainedConfig, + getDefaultStyledComponentsConfig, getNodeEnv, isServerTarget, mergeChainedOptions, - getDefaultStyledComponentsConfig, - type ChainedConfig, } from '@rsbuild/shared'; /** diff --git a/packages/plugin-styled-components/tests/index.test.ts b/packages/plugin-styled-components/tests/index.test.ts index fc865557d2..398669b8e6 100644 --- a/packages/plugin-styled-components/tests/index.test.ts +++ b/packages/plugin-styled-components/tests/index.test.ts @@ -1,7 +1,7 @@ -import { expect, describe, it } from 'vitest'; -import { pluginStyledComponents } from '../src'; import { createRsbuild } from '@rsbuild/core'; import { SCRIPT_REGEX } from '@rsbuild/shared'; +import { describe, expect, it } from 'vitest'; +import { pluginStyledComponents } from '../src'; describe('plugins/styled-components', () => { it('should apply styledComponents option to swc-loader', async () => { diff --git a/packages/plugin-svelte/src/index.ts b/packages/plugin-svelte/src/index.ts index 49427049a7..19d8401ddc 100644 --- a/packages/plugin-svelte/src/index.ts +++ b/packages/plugin-svelte/src/index.ts @@ -1,12 +1,12 @@ import path from 'node:path'; import { logger } from '@rsbuild/core'; -import { deepmerge } from '@rsbuild/shared'; import type { RsbuildPlugin } from '@rsbuild/core'; -import type { CompileOptions } from 'svelte/compiler'; +import { deepmerge } from '@rsbuild/shared'; import type { AutoPreprocessOptions, Transformer, } from 'svelte-preprocess/dist/types'; +import type { CompileOptions } from 'svelte/compiler'; export type { AutoPreprocessOptions, Transformer }; diff --git a/packages/plugin-svgr/src/index.ts b/packages/plugin-svgr/src/index.ts index 59cf22b11a..02b70c753e 100644 --- a/packages/plugin-svgr/src/index.ts +++ b/packages/plugin-svgr/src/index.ts @@ -1,13 +1,13 @@ import path from 'node:path'; +import type { RsbuildPlugin, Rspack } from '@rsbuild/core'; +import { PLUGIN_REACT_NAME } from '@rsbuild/plugin-react'; import { + SCRIPT_REGEX, SVG_REGEX, deepmerge, getDistPath, getFilename, - SCRIPT_REGEX, } from '@rsbuild/shared'; -import { PLUGIN_REACT_NAME } from '@rsbuild/plugin-react'; -import type { Rspack, RsbuildPlugin } from '@rsbuild/core'; import type { Config } from '@svgr/core'; export type SvgDefaultExport = 'component' | 'url'; diff --git a/packages/plugin-svgr/src/loader.ts b/packages/plugin-svgr/src/loader.ts index 29b2b16c47..5d2de47d2d 100644 --- a/packages/plugin-svgr/src/loader.ts +++ b/packages/plugin-svgr/src/loader.ts @@ -6,12 +6,12 @@ * modified from https://github.com/gregberge/svgr/blob/7595d378b73d4826a4cead165b3f32386b07315b/packages/webpack/src/index.ts */ -import { callbackify } from 'node:util'; -import { transform, type Config, type State } from '@svgr/core'; import { normalize } from 'node:path'; -import svgo from '@svgr/plugin-svgo'; -import jsx from '@svgr/plugin-jsx'; +import { callbackify } from 'node:util'; import type { Rspack } from '@rsbuild/core'; +import { type Config, type State, transform } from '@svgr/core'; +import jsx from '@svgr/plugin-jsx'; +import svgo from '@svgr/plugin-svgo'; const transformSvg = callbackify( async (contents: string, config: Config, state: Partial) => diff --git a/packages/plugin-svgr/tests/index.test.ts b/packages/plugin-svgr/tests/index.test.ts index d8b35245ed..c72b191637 100644 --- a/packages/plugin-svgr/tests/index.test.ts +++ b/packages/plugin-svgr/tests/index.test.ts @@ -1,8 +1,8 @@ -import { expect, describe, it } from 'vitest'; -import { type PluginSvgrOptions, pluginSvgr } from '../src'; -import { createStubRsbuild } from '@scripts/test-helper'; import { pluginReact } from '@rsbuild/plugin-react'; import { SVG_REGEX } from '@rsbuild/shared'; +import { createStubRsbuild } from '@scripts/test-helper'; +import { describe, expect, it } from 'vitest'; +import { type PluginSvgrOptions, pluginSvgr } from '../src'; describe('svgr', () => { const cases: Array<{ name: string; pluginConfig: PluginSvgrOptions }> = [ diff --git a/packages/plugin-type-check/src/index.ts b/packages/plugin-type-check/src/index.ts index 114375354d..e5bb2d57bc 100644 --- a/packages/plugin-type-check/src/index.ts +++ b/packages/plugin-type-check/src/index.ts @@ -1,11 +1,11 @@ -import { logger, type RsbuildPlugin } from '@rsbuild/core'; +import { type RsbuildPlugin, logger } from '@rsbuild/core'; import { - fse, CHAIN_ID, - deepmerge, + type ChainedConfig, NODE_MODULES_REGEX, + deepmerge, + fse, mergeChainedOptions, - type ChainedConfig, } from '@rsbuild/shared'; import type ForkTSCheckerPlugin from 'fork-ts-checker-webpack-plugin'; diff --git a/packages/plugin-umd/src/index.ts b/packages/plugin-umd/src/index.ts index 9d77320cc6..65d9e4e34b 100644 --- a/packages/plugin-umd/src/index.ts +++ b/packages/plugin-umd/src/index.ts @@ -1,5 +1,5 @@ -import { isProd } from '@rsbuild/shared'; import type { RsbuildPlugin } from '@rsbuild/core'; +import { isProd } from '@rsbuild/shared'; export type PluginUmdOptions = { /** diff --git a/packages/plugin-vue-jsx/src/index.ts b/packages/plugin-vue-jsx/src/index.ts index dcacd5448e..aa016edcbf 100644 --- a/packages/plugin-vue-jsx/src/index.ts +++ b/packages/plugin-vue-jsx/src/index.ts @@ -1,7 +1,7 @@ import type { RsbuildPlugin } from '@rsbuild/core'; -import type { VueJSXPluginOptions } from '@vue/babel-plugin-jsx'; import { modifyBabelLoaderOptions } from '@rsbuild/plugin-babel'; import { isUsingHMR } from '@rsbuild/shared'; +import type { VueJSXPluginOptions } from '@vue/babel-plugin-jsx'; export type PluginVueJsxOptions = { /** diff --git a/packages/plugin-vue-jsx/tests/index.test.ts b/packages/plugin-vue-jsx/tests/index.test.ts index 935b2255cd..98d3d8d883 100644 --- a/packages/plugin-vue-jsx/tests/index.test.ts +++ b/packages/plugin-vue-jsx/tests/index.test.ts @@ -1,7 +1,7 @@ -import { createStubRsbuild } from '@scripts/test-helper'; +import type { RsbuildConfig } from '@rsbuild/core'; import { pluginBabel } from '@rsbuild/plugin-babel'; +import { createStubRsbuild } from '@scripts/test-helper'; import { pluginVueJsx } from '../src'; -import type { RsbuildConfig } from '@rsbuild/core'; describe('plugin-vue-jsx', () => { const rsbuildConfig: RsbuildConfig = { diff --git a/packages/plugin-vue/src/index.ts b/packages/plugin-vue/src/index.ts index ea1ea1358e..dde11c9af0 100644 --- a/packages/plugin-vue/src/index.ts +++ b/packages/plugin-vue/src/index.ts @@ -1,6 +1,6 @@ +import type { RsbuildPlugin } from '@rsbuild/core'; import { deepmerge } from '@rsbuild/shared'; import { VueLoaderPlugin } from 'vue-loader'; -import type { RsbuildPlugin } from '@rsbuild/core'; import type { VueLoaderOptions } from 'vue-loader'; import { applySplitChunksRule } from './splitChunks'; diff --git a/packages/plugin-vue/src/splitChunks.ts b/packages/plugin-vue/src/splitChunks.ts index ec78c32e17..cd2985f6ed 100644 --- a/packages/plugin-vue/src/splitChunks.ts +++ b/packages/plugin-vue/src/splitChunks.ts @@ -1,8 +1,8 @@ import type { RsbuildPluginAPI } from '@rsbuild/core'; import { - isPlainObject, - createCacheGroups, type SplitChunks, + createCacheGroups, + isPlainObject, } from '@rsbuild/shared'; import type { SplitVueChunkOptions } from '.'; diff --git a/packages/plugin-vue2-jsx/tests/index.test.ts b/packages/plugin-vue2-jsx/tests/index.test.ts index 22a27ea988..c209bb88c4 100644 --- a/packages/plugin-vue2-jsx/tests/index.test.ts +++ b/packages/plugin-vue2-jsx/tests/index.test.ts @@ -1,7 +1,7 @@ -import { createStubRsbuild } from '@scripts/test-helper'; +import type { RsbuildConfig } from '@rsbuild/core'; import { pluginBabel } from '@rsbuild/plugin-babel'; +import { createStubRsbuild } from '@scripts/test-helper'; import { pluginVue2Jsx } from '../src'; -import type { RsbuildConfig } from '@rsbuild/core'; describe('plugin-vue2-jsx', () => { const rsbuildConfig: RsbuildConfig = { diff --git a/packages/plugin-vue2/src/index.ts b/packages/plugin-vue2/src/index.ts index 7381a6a67d..d0a788a227 100644 --- a/packages/plugin-vue2/src/index.ts +++ b/packages/plugin-vue2/src/index.ts @@ -1,9 +1,9 @@ +import type { RsbuildPlugin } from '@rsbuild/core'; import { deepmerge } from '@rsbuild/shared'; import { VueLoaderPlugin } from 'vue-loader'; -import type { RsbuildPlugin } from '@rsbuild/core'; import type { VueLoaderOptions } from 'vue-loader'; -import { applySplitChunksRule } from './splitChunks'; import { VueLoader15PitchFixPlugin } from './VueLoader15PitchFixPlugin'; +import { applySplitChunksRule } from './splitChunks'; export type SplitVueChunkOptions = { /** diff --git a/packages/plugin-vue2/src/splitChunks.ts b/packages/plugin-vue2/src/splitChunks.ts index 2991ebb876..33906efb63 100644 --- a/packages/plugin-vue2/src/splitChunks.ts +++ b/packages/plugin-vue2/src/splitChunks.ts @@ -1,8 +1,8 @@ import type { RsbuildPluginAPI } from '@rsbuild/core'; import { - isPlainObject, - createCacheGroups, type SplitChunks, + createCacheGroups, + isPlainObject, } from '@rsbuild/shared'; import type { SplitVueChunkOptions } from '.'; diff --git a/packages/shared/src/chain.ts b/packages/shared/src/chain.ts index d504a6ed6d..fe17b833ed 100644 --- a/packages/shared/src/chain.ts +++ b/packages/shared/src/chain.ts @@ -1,32 +1,32 @@ import { posix } from 'node:path'; -import { getDistPath, getFilename } from './fs'; -import { addTrailingSlash, isPlainObject, removeTailingSlash } from './utils'; -import { castArray, ensureAbsolutePath } from './utils'; -import { debug } from './logger'; +import type { EntryDescription } from '@rspack/core'; import { - DEFAULT_PORT, - TS_AND_JSX_REGEX, + DEFAULT_ASSET_PREFIX, DEFAULT_DEV_HOST, + DEFAULT_PORT, NODE_MODULES_REGEX, - DEFAULT_ASSET_PREFIX, + TS_AND_JSX_REGEX, } from './constants'; +import { getDistPath, getFilename } from './fs'; +import { debug } from './logger'; +import { mergeChainedOptions } from './mergeChainedOptions'; import type { + BuiltinSwcLoaderOptions, BundlerChain, - RsbuildEntry, - RspackConfig, - RsbuildConfig, - RsbuildTarget, - RsbuildContext, - CreateAsyncHook, BundlerChainRule, - NormalizedConfig, - RsbuildPluginAPI, + CreateAsyncHook, ModifyBundlerChainFn, ModifyBundlerChainUtils, - BuiltinSwcLoaderOptions, + NormalizedConfig, + RsbuildConfig, + RsbuildContext, + RsbuildEntry, + RsbuildPluginAPI, + RsbuildTarget, + RspackConfig, } from './types'; -import { mergeChainedOptions } from './mergeChainedOptions'; -import type { EntryDescription } from '@rspack/core'; +import { addTrailingSlash, isPlainObject, removeTailingSlash } from './utils'; +import { castArray, ensureAbsolutePath } from './utils'; export async function getBundlerChain() { const { default: WebpackChain } = await import('../compiled/webpack-chain'); diff --git a/packages/shared/src/config.ts b/packages/shared/src/config.ts index ef7f5368a3..da3f59979a 100644 --- a/packages/shared/src/config.ts +++ b/packages/shared/src/config.ts @@ -1,12 +1,12 @@ +import { join } from 'node:path'; +import fse from '../compiled/fs-extra'; +import { logger } from './logger'; import type { - RsbuildConfig, - NormalizedConfig, InspectConfigOptions, + NormalizedConfig, + RsbuildConfig, } from './types'; -import { logger } from './logger'; -import { join } from 'node:path'; -import fse from '../compiled/fs-extra'; -import { pick, color, upperFirst } from './utils'; +import { color, pick, upperFirst } from './utils'; export async function outputInspectConfigFiles({ rsbuildConfig, diff --git a/packages/shared/src/css.ts b/packages/shared/src/css.ts index 2938d0e24c..183926ce26 100644 --- a/packages/shared/src/css.ts +++ b/packages/shared/src/css.ts @@ -1,15 +1,15 @@ -import { CSS_MODULES_REGEX, NODE_MODULES_REGEX } from './constants'; import type { AcceptedPlugin } from 'postcss'; import deepmerge from '../compiled/deepmerge'; +import { CSS_MODULES_REGEX, NODE_MODULES_REGEX } from './constants'; import { mergeChainedOptions } from './mergeChainedOptions'; -import { isFunction, isPlainObject } from './utils'; import type { - RsbuildTarget, - PostCSSOptions, CSSLoaderOptions, NormalizedConfig, PostCSSLoaderOptions, + PostCSSOptions, + RsbuildTarget, } from './types'; +import { isFunction, isPlainObject } from './utils'; export const getCssModuleLocalIdentName = ( config: NormalizedConfig, diff --git a/packages/shared/src/fs.ts b/packages/shared/src/fs.ts index 929ec6d6fa..a2b9ef71ae 100644 --- a/packages/shared/src/fs.ts +++ b/packages/shared/src/fs.ts @@ -1,11 +1,11 @@ +import { constants, promises, statSync } from 'node:fs'; import path from 'node:path'; import fse from '../compiled/fs-extra'; -import { promises, constants, statSync } from 'node:fs'; import type { - RsbuildConfig, DistPathConfig, FilenameConfig, NormalizedConfig, + RsbuildConfig, } from './types'; export { fse }; diff --git a/packages/shared/src/getBrowserslist.ts b/packages/shared/src/getBrowserslist.ts index 90692867bd..84721ff46b 100644 --- a/packages/shared/src/getBrowserslist.ts +++ b/packages/shared/src/getBrowserslist.ts @@ -1,7 +1,7 @@ -import { getNodeEnv } from './utils'; import browserslist from '../compiled/browserslist'; import { DEFAULT_BROWSERSLIST } from './constants'; -import type { RsbuildTarget, OverrideBrowserslist } from './types'; +import type { OverrideBrowserslist, RsbuildTarget } from './types'; +import { getNodeEnv } from './utils'; // using cache to avoid multiple calls to loadConfig const browsersListCache = new Map(); diff --git a/packages/shared/src/getLoaderOptions.ts b/packages/shared/src/getLoaderOptions.ts index 2bccc95660..c252edc49a 100644 --- a/packages/shared/src/getLoaderOptions.ts +++ b/packages/shared/src/getLoaderOptions.ts @@ -1,13 +1,13 @@ import path from 'node:path'; +import { mergeChainedOptions } from './mergeChainedOptions'; import type { - ToolsSassConfig, - ToolsLessConfig, FileFilterUtil, - SassLoaderOptions, LessLoaderOptions, + SassLoaderOptions, + ToolsLessConfig, + ToolsSassConfig, } from './types'; import { castArray, deepmerge, getSharedPkgCompiledPath } from './utils'; -import { mergeChainedOptions } from './mergeChainedOptions'; export const getSassLoaderOptions = ( rsbuildSassConfig: ToolsSassConfig | undefined, diff --git a/packages/shared/src/loaders/cssModulesTypescriptLoader.ts b/packages/shared/src/loaders/cssModulesTypescriptLoader.ts index fc7e4de387..1807eee055 100644 --- a/packages/shared/src/loaders/cssModulesTypescriptLoader.ts +++ b/packages/shared/src/loaders/cssModulesTypescriptLoader.ts @@ -12,9 +12,9 @@ import fs from 'node:fs'; import path from 'node:path'; -import LineDiff from '../../compiled/line-diff'; import type { LoaderContext } from '@rspack/core'; -import { isCssModules, type CssLoaderModules, isInNodeModules } from '../css'; +import LineDiff from '../../compiled/line-diff'; +import { type CssLoaderModules, isCssModules, isInNodeModules } from '../css'; const bannerMessage = '// This file is automatically generated.\n// Please do not change this file!'; diff --git a/packages/shared/src/logger.ts b/packages/shared/src/logger.ts index fdcb7276dc..66cc824471 100644 --- a/packages/shared/src/logger.ts +++ b/packages/shared/src/logger.ts @@ -1,4 +1,4 @@ -import { logger, type Logger } from '../compiled/rslog'; +import { type Logger, logger } from '../compiled/rslog'; import { color } from './utils'; // setup the logger level diff --git a/packages/shared/src/mergeChainedOptions.ts b/packages/shared/src/mergeChainedOptions.ts index a49e55d45a..bb672edc0b 100644 --- a/packages/shared/src/mergeChainedOptions.ts +++ b/packages/shared/src/mergeChainedOptions.ts @@ -1,8 +1,8 @@ import type { - Falsy, ChainedConfig, - ChainedConfigWithUtils, ChainedConfigCombineUtils, + ChainedConfigWithUtils, + Falsy, } from './types'; import { isFunction, isPlainObject } from './utils'; diff --git a/packages/shared/src/minimize.ts b/packages/shared/src/minimize.ts index 3f7ae9a42c..047b62686a 100644 --- a/packages/shared/src/minimize.ts +++ b/packages/shared/src/minimize.ts @@ -1,11 +1,11 @@ -import { isObject } from './utils'; +import type { SwcJsMinimizerRspackPluginOptions } from '@rspack/core'; +import deepmerge from '../compiled/deepmerge'; import type { + HTMLPluginOptions, MinifyJSOptions, NormalizedConfig, - HTMLPluginOptions, } from './types'; -import type { SwcJsMinimizerRspackPluginOptions } from '@rspack/core'; -import deepmerge from '../compiled/deepmerge'; +import { isObject } from './utils'; function applyRemoveConsole( options: MinifyJSOptions, diff --git a/packages/shared/src/types/config/dev.ts b/packages/shared/src/types/config/dev.ts index 90cda93a99..d8212fe49e 100644 --- a/packages/shared/src/types/config/dev.ts +++ b/packages/shared/src/types/config/dev.ts @@ -1,5 +1,5 @@ -import type { ArrayOrNot } from '../utils'; import type { IncomingMessage, ServerResponse } from 'node:http'; +import type { ArrayOrNot } from '../utils'; export type ProgressBarConfig = { id?: string; diff --git a/packages/shared/src/types/config/html.ts b/packages/shared/src/types/config/html.ts index 86640c1303..2fff1d4567 100644 --- a/packages/shared/src/types/config/html.ts +++ b/packages/shared/src/types/config/html.ts @@ -1,7 +1,7 @@ import type { ArrayOrNot, - ChainedConfigWithUtils, ChainedConfigCombineUtils, + ChainedConfigWithUtils, } from '../utils'; export type CrossOrigin = 'anonymous' | 'use-credentials'; diff --git a/packages/shared/src/types/config/index.ts b/packages/shared/src/types/config/index.ts index 06967bd861..b7895b2281 100644 --- a/packages/shared/src/types/config/index.ts +++ b/packages/shared/src/types/config/index.ts @@ -1,17 +1,17 @@ +import type { ModuleFederationPluginOptions } from '@rspack/core'; +import type { RsbuildPlugins, RsbuildProvider } from '..'; +import type { DeepReadonly } from '../utils'; import type { DevConfig, NormalizedDevConfig } from './dev'; -import type { ServerConfig, NormalizedServerConfig } from './server'; import type { HtmlConfig, NormalizedHtmlConfig } from './html'; -import type { OutputConfig, NormalizedOutputConfig } from './output'; -import type { SourceConfig, NormalizedSourceConfig } from './source'; -import type { SecurityConfig, NormalizedSecurityConfig } from './security'; +import type { NormalizedOutputConfig, OutputConfig } from './output'; import type { - PerformanceConfig, NormalizedPerformanceConfig, + PerformanceConfig, } from './performance'; -import type { ToolsConfig, NormalizedToolsConfig } from './tools'; -import type { DeepReadonly } from '../utils'; -import type { RsbuildPlugins, RsbuildProvider } from '..'; -import type { ModuleFederationPluginOptions } from '@rspack/core'; +import type { NormalizedSecurityConfig, SecurityConfig } from './security'; +import type { NormalizedServerConfig, ServerConfig } from './server'; +import type { NormalizedSourceConfig, SourceConfig } from './source'; +import type { NormalizedToolsConfig, ToolsConfig } from './tools'; export type ModuleFederationConfig = { options: ModuleFederationPluginOptions; diff --git a/packages/shared/src/types/config/output.ts b/packages/shared/src/types/config/output.ts index 694875d0f2..d067f90b06 100644 --- a/packages/shared/src/types/config/output.ts +++ b/packages/shared/src/types/config/output.ts @@ -1,11 +1,11 @@ -import type { RspackConfig } from '../rspack'; -import type { RsbuildTarget } from '../rsbuild'; import type { CopyRspackPluginOptions, Externals, SwcJsMinimizerRspackPluginOptions, } from '@rspack/core'; import type { HTMLPluginOptions } from '../../types'; +import type { RsbuildTarget } from '../rsbuild'; +import type { RspackConfig } from '../rspack'; export type DistPathConfig = { /** diff --git a/packages/shared/src/types/config/source.ts b/packages/shared/src/types/config/source.ts index 5b5ed0ae9a..296c2d2285 100644 --- a/packages/shared/src/types/config/source.ts +++ b/packages/shared/src/types/config/source.ts @@ -1,9 +1,9 @@ +import type { RuleSetCondition } from '@rspack/core'; import type { RsbuildEntry, RsbuildTarget } from '../rsbuild'; import type { - ChainedConfigWithUtils, ChainedConfigCombineUtils, + ChainedConfigWithUtils, } from '../utils'; -import type { RuleSetCondition } from '@rspack/core'; export type Alias = Record; diff --git a/packages/shared/src/types/config/tools.ts b/packages/shared/src/types/config/tools.ts index 4251d3a18e..b7792a2b70 100644 --- a/packages/shared/src/types/config/tools.ts +++ b/packages/shared/src/types/config/tools.ts @@ -1,34 +1,34 @@ +import type { Options as HTMLPluginOptions } from 'html-webpack-plugin'; +import type { BundlerChain } from '../bundlerConfig'; +import type { BundlerPluginInstance } from '../bundlerConfig'; +import type { ModifyBundlerChainUtils, ModifyChainUtils } from '../hooks'; import type { - ArrayOrNot, - WebpackChain, - ChainedConfig, - FileFilterUtil, - ChainedConfigWithUtils, -} from '../utils'; + ModifyWebpackChainUtils, + ModifyWebpackConfigUtils, +} from '../plugin'; import type { - WebpackConfig, - PostCSSPlugin, + BuiltinSwcLoaderOptions, + RspackConfig, + RspackRule, +} from '../rspack'; +import type { + AutoprefixerOptions, + CSSExtractOptions, CSSLoaderOptions, - SassLoaderOptions, LessLoaderOptions, - CSSExtractOptions, - StyleLoaderOptions, - AutoprefixerOptions, PostCSSLoaderOptions, + PostCSSPlugin, + SassLoaderOptions, + StyleLoaderOptions, + WebpackConfig, } from '../thirdParty'; -import type { BundlerChain } from '../bundlerConfig'; -import type { ModifyBundlerChainUtils, ModifyChainUtils } from '../hooks'; -import type { - RspackRule, - RspackConfig, - BuiltinSwcLoaderOptions, -} from '../rspack'; -import type { Options as HTMLPluginOptions } from 'html-webpack-plugin'; -import type { BundlerPluginInstance } from '../bundlerConfig'; import type { - ModifyWebpackChainUtils, - ModifyWebpackConfigUtils, -} from '../plugin'; + ArrayOrNot, + ChainedConfig, + ChainedConfigWithUtils, + FileFilterUtil, + WebpackChain, +} from '../utils'; export type { HTMLPluginOptions }; diff --git a/packages/shared/src/types/hooks.ts b/packages/shared/src/types/hooks.ts index f66f749992..d7e188979e 100644 --- a/packages/shared/src/types/hooks.ts +++ b/packages/shared/src/types/hooks.ts @@ -1,11 +1,11 @@ import type { ChainIdentifier } from '../chain'; -import type { Stats, MultiStats } from './stats'; -import type { NodeEnv, MaybePromise } from './utils'; -import type { RsbuildTarget } from './rsbuild'; import type { BundlerChain } from './bundlerConfig'; -import type { Rspack, RspackConfig } from './rspack'; import type { HtmlBasicTag, RsbuildConfig } from './config'; +import type { RsbuildTarget } from './rsbuild'; +import type { Rspack, RspackConfig } from './rspack'; +import type { MultiStats, Stats } from './stats'; import type { WebpackConfig } from './thirdParty'; +import type { MaybePromise, NodeEnv } from './utils'; export type OnBeforeBuildFn = (params: { bundlerConfigs?: B extends 'rspack' ? RspackConfig[] : WebpackConfig[]; diff --git a/packages/shared/src/types/plugin.ts b/packages/shared/src/types/plugin.ts index 212e7252c3..89634527da 100644 --- a/packages/shared/src/types/plugin.ts +++ b/packages/shared/src/types/plugin.ts @@ -1,36 +1,36 @@ -import type { Falsy, WebpackChain } from './utils'; +import type { RuleSetCondition } from '@rspack/core'; import type { - OnExitFn, + RuleSetRule, + Configuration as WebpackConfig, + WebpackPluginInstance, +} from 'webpack'; +import type { ChainIdentifier } from '../chain'; +import type { + ModifyRspackConfigUtils, + NormalizedConfig, + RsbuildConfig, +} from './config'; +import type { RsbuildContext } from './context'; +import type { + ModifyBundlerChainFn, + ModifyChainUtils, + ModifyHTMLTagsFn, + ModifyRsbuildConfigFn, OnAfterBuildFn, - OnBeforeBuildFn, - OnCloseDevServerFn, - OnDevCompileDoneFn, + OnAfterCreateCompilerFn, OnAfterStartDevServerFn, - OnBeforeStartDevServerFn, OnAfterStartProdServerFn, - OnBeforeStartProdServerFn, - OnAfterCreateCompilerFn, + OnBeforeBuildFn, OnBeforeCreateCompilerFn, - ModifyChainUtils, - ModifyHTMLTagsFn, - ModifyBundlerChainFn, - ModifyRsbuildConfigFn, + OnBeforeStartDevServerFn, + OnBeforeStartProdServerFn, + OnCloseDevServerFn, + OnDevCompileDoneFn, + OnExitFn, } from './hooks'; -import type { RsbuildContext } from './context'; -import type { - RsbuildConfig, - NormalizedConfig, - ModifyRspackConfigUtils, -} from './config'; -import type { MaybePromise } from './utils'; import type { RspackConfig, RspackSourceMap } from './rspack'; -import type { RuleSetCondition } from '@rspack/core'; -import type { - RuleSetRule, - WebpackPluginInstance, - Configuration as WebpackConfig, -} from 'webpack'; -import type { ChainIdentifier } from '../chain'; +import type { Falsy, WebpackChain } from './utils'; +import type { MaybePromise } from './utils'; type HookOrder = 'pre' | 'post' | 'default'; diff --git a/packages/shared/src/types/provider.ts b/packages/shared/src/types/provider.ts index 60fded0d65..07f25ea347 100644 --- a/packages/shared/src/types/provider.ts +++ b/packages/shared/src/types/provider.ts @@ -1,11 +1,11 @@ -import type { PluginManager, RsbuildPluginAPI } from './plugin'; -import type { RsbuildContext } from './context'; import type { Compiler, MultiCompiler } from '@rspack/core'; -import type { RsbuildMode, CreateRsbuildOptions } from './rsbuild'; -import type { StartServerResult, RsbuildDevServer } from './server'; import type { NormalizedConfig } from './config'; -import type { WebpackConfig } from './thirdParty'; +import type { RsbuildContext } from './context'; +import type { PluginManager, RsbuildPluginAPI } from './plugin'; +import type { CreateRsbuildOptions, RsbuildMode } from './rsbuild'; import type { RspackConfig } from './rspack'; +import type { RsbuildDevServer, StartServerResult } from './server'; +import type { WebpackConfig } from './thirdParty'; export type Bundler = 'rspack' | 'webpack'; diff --git a/packages/shared/src/types/rsbuild.ts b/packages/shared/src/types/rsbuild.ts index 3853494430..399205f8f6 100644 --- a/packages/shared/src/types/rsbuild.ts +++ b/packages/shared/src/types/rsbuild.ts @@ -1,8 +1,8 @@ -import type { PluginManager } from './plugin'; +import type { EntryDescription } from '@rspack/core'; import type { RsbuildConfig } from './config'; import type { RsbuildContext } from './context'; -import type { RsbuildProvider, ProviderInstance } from './provider'; -import type { EntryDescription } from '@rspack/core'; +import type { PluginManager } from './plugin'; +import type { ProviderInstance, RsbuildProvider } from './provider'; export type RsbuildTarget = 'web' | 'node' | 'web-worker' | 'service-worker'; diff --git a/packages/shared/src/types/server.ts b/packages/shared/src/types/server.ts index 059a8bacf7..0f52c95bb9 100644 --- a/packages/shared/src/types/server.ts +++ b/packages/shared/src/types/server.ts @@ -1,13 +1,13 @@ import type { IncomingMessage, ServerResponse } from 'node:http'; import type { Socket } from 'node:net'; +import type { Server as ConnectServer } from '../../compiled/connect'; import type { + DevConfig, NextFunction, RequestHandler, ServerAPIs, - DevConfig, } from './config/dev'; import type { RspackCompiler, RspackMultiCompiler } from './rspack'; -import type { Server as ConnectServer } from '../../compiled/connect'; export type Middleware = ( req: IncomingMessage, diff --git a/packages/shared/src/types/stats.ts b/packages/shared/src/types/stats.ts index 44032b678a..b78641e6e5 100644 --- a/packages/shared/src/types/stats.ts +++ b/packages/shared/src/types/stats.ts @@ -1,4 +1,4 @@ -import type { Compilation, StatsValue, StatsCompilation } from '@rspack/core'; +import type { Compilation, StatsCompilation, StatsValue } from '@rspack/core'; export type { StatsError, StatsAsset } from '@rspack/core'; diff --git a/packages/shared/src/types/thirdParty.ts b/packages/shared/src/types/thirdParty.ts index 1bdb470e77..76a80864b8 100644 --- a/packages/shared/src/types/thirdParty.ts +++ b/packages/shared/src/types/thirdParty.ts @@ -1,18 +1,18 @@ -import type { - Options as SassOptions, - LegacyOptions as LegacySassOptions, -} from '../../compiled/sass'; -import type * as SassLoader from '../../compiled/sass-loader'; -import type Less from '../../compiled/less'; import type { LoaderContext } from '@rspack/core'; -import type { AcceptedPlugin, ProcessOptions } from 'postcss'; -import type { Configuration as WebpackConfig } from 'webpack'; import type { - PluginOptions as MiniCSSExtractPluginOptions, LoaderOptions as MiniCSSExtractLoaderOptions, + PluginOptions as MiniCSSExtractPluginOptions, } from 'mini-css-extract-plugin'; -import type { Options as AutoprefixerOptions } from '../../compiled/autoprefixer'; +import type { AcceptedPlugin, ProcessOptions } from 'postcss'; import type { MinifyOptions } from 'terser'; +import type { Configuration as WebpackConfig } from 'webpack'; +import type { Options as AutoprefixerOptions } from '../../compiled/autoprefixer'; +import type Less from '../../compiled/less'; +import type { + LegacyOptions as LegacySassOptions, + Options as SassOptions, +} from '../../compiled/sass'; +import type * as SassLoader from '../../compiled/sass-loader'; export interface CSSExtractOptions { pluginOptions?: MiniCSSExtractPluginOptions; diff --git a/packages/shared/src/url.ts b/packages/shared/src/url.ts index 134753821f..9a9b2bab0f 100644 --- a/packages/shared/src/url.ts +++ b/packages/shared/src/url.ts @@ -1,7 +1,7 @@ +import { isIPv6 } from 'node:net'; import os from 'node:os'; -import { URL } from 'node:url'; import { posix } from 'node:path'; -import { isIPv6 } from 'node:net'; +import { URL } from 'node:url'; import { DEFAULT_DEV_HOST } from './constants'; // remove repeat '/' diff --git a/packages/shared/src/utils.ts b/packages/shared/src/utils.ts index 7554dc9380..1cb43d66cf 100644 --- a/packages/shared/src/utils.ts +++ b/packages/shared/src/utils.ts @@ -1,24 +1,24 @@ import path from 'node:path'; import type { Compiler, MultiCompiler } from '@rspack/core'; import type { - Stats, - NodeEnv, - MultiStats, + Compiler as WebpackCompiler, + MultiCompiler as WebpackMultiCompiler, +} from 'webpack'; +import deepmerge from '../compiled/deepmerge'; +import fse from '../compiled/fs-extra'; +import color from '../compiled/picocolors'; +import { DEFAULT_ASSET_PREFIX } from './constants'; +import type { CacheGroups, CompilerTapFn, - RsbuildTarget, ModifyChainUtils, + MultiStats, + NodeEnv, NormalizedConfig, + RsbuildTarget, SharedCompiledPkgNames, + Stats, } from './types'; -import fse from '../compiled/fs-extra'; -import deepmerge from '../compiled/deepmerge'; -import color from '../compiled/picocolors'; -import { DEFAULT_ASSET_PREFIX } from './constants'; -import type { - Compiler as WebpackCompiler, - MultiCompiler as WebpackMultiCompiler, -} from 'webpack'; export { color, deepmerge }; diff --git a/packages/shared/tests/config.test.ts b/packages/shared/tests/config.test.ts index d803a9a01f..2b6c2f21be 100644 --- a/packages/shared/tests/config.test.ts +++ b/packages/shared/tests/config.test.ts @@ -1,5 +1,5 @@ import webpack from 'webpack'; -import { stringifyConfig, pickRsbuildConfig } from '../src/config'; +import { pickRsbuildConfig, stringifyConfig } from '../src/config'; describe('stringifyConfig', () => { it('should stringify webpack config correctly', async () => { diff --git a/packages/shared/tests/css.test.ts b/packages/shared/tests/css.test.ts index 91f6348008..5af9e931d7 100644 --- a/packages/shared/tests/css.test.ts +++ b/packages/shared/tests/css.test.ts @@ -1,10 +1,10 @@ +import autoprefixer from '../compiled/autoprefixer'; +import type { NormalizedConfig } from '../src'; import { - isCssModules, applyAutoprefixer, + isCssModules, normalizeCssLoaderOptions, } from '../src/css'; -import autoprefixer from '../compiled/autoprefixer'; -import type { NormalizedConfig } from '../src'; describe('normalizeCssLoaderOptions', () => { it('should enable exportOnlyLocals correctly', () => { diff --git a/packages/shared/tests/mergeChainedOptions.test.ts b/packages/shared/tests/mergeChainedOptions.test.ts index efaeeca290..ef0528a404 100644 --- a/packages/shared/tests/mergeChainedOptions.test.ts +++ b/packages/shared/tests/mergeChainedOptions.test.ts @@ -1,4 +1,4 @@ -import { mergeChainedOptions, isNil } from '../src'; +import { isNil, mergeChainedOptions } from '../src'; describe('mergeChainedOptions', () => { test('should return default options', () => { diff --git a/packages/shared/tests/url.test.ts b/packages/shared/tests/url.test.ts index be52dfe038..9767e21503 100644 --- a/packages/shared/tests/url.test.ts +++ b/packages/shared/tests/url.test.ts @@ -1,4 +1,4 @@ -import { withPublicPath, normalizeUrl } from '../src/url'; +import { normalizeUrl, withPublicPath } from '../src/url'; const PUBLIC_PATH = 'https://www.example.com/static'; diff --git a/scripts/check-changeset/src/index.ts b/scripts/check-changeset/src/index.ts index fe8f5a9e65..12962fa5db 100644 --- a/scripts/check-changeset/src/index.ts +++ b/scripts/check-changeset/src/index.ts @@ -1,6 +1,6 @@ import path from 'node:path'; import readChangesets from '@changesets/read'; -import { getPackages, type Package } from '@manypkg/get-packages'; +import { type Package, getPackages } from '@manypkg/get-packages'; type VersionType = 'major' | 'minor' | 'patch' | 'none'; type Release = { diff --git a/scripts/modern.base.config.ts b/scripts/modern.base.config.ts index fc2306933b..75f62b121f 100644 --- a/scripts/modern.base.config.ts +++ b/scripts/modern.base.config.ts @@ -1,7 +1,7 @@ import { + type PartialBaseBuildConfig, defineConfig, moduleTools, - type PartialBaseBuildConfig, } from '@modern-js/module-tools'; const define = { diff --git a/scripts/prebundle/src/constant.ts b/scripts/prebundle/src/constant.ts index 9748bdb714..918efc8ac9 100644 --- a/scripts/prebundle/src/constant.ts +++ b/scripts/prebundle/src/constant.ts @@ -1,7 +1,7 @@ import path, { join } from 'node:path'; -import type { ParsedTask, TaskConfig } from './types'; import fs, { copySync } from 'fs-extra'; import { replaceFileContent } from './helper'; +import type { ParsedTask, TaskConfig } from './types'; export const ROOT_DIR = join(__dirname, '..', '..', '..'); export const PACKAGES_DIR = join(ROOT_DIR, 'packages'); diff --git a/scripts/prebundle/src/helper.ts b/scripts/prebundle/src/helper.ts index 3190856eb1..51e6005424 100644 --- a/scripts/prebundle/src/helper.ts +++ b/scripts/prebundle/src/helper.ts @@ -1,6 +1,6 @@ import { dirname, join } from 'node:path'; import fs from 'fs-extra'; -import { TASKS, DIST_DIR, PACKAGES_DIR } from './constant'; +import { DIST_DIR, PACKAGES_DIR, TASKS } from './constant'; import type { ParsedTask } from './types'; export function findDepPath(name: string) { diff --git a/scripts/prebundle/src/prebundle.ts b/scripts/prebundle/src/prebundle.ts index d8c06ffc76..bb283649ac 100644 --- a/scripts/prebundle/src/prebundle.ts +++ b/scripts/prebundle/src/prebundle.ts @@ -1,8 +1,8 @@ import { join } from 'node:path'; import ncc from '@vercel/ncc'; import { Package as DtsPacker } from 'dts-packer'; -import fs from 'fs-extra'; import fastGlob from 'fast-glob'; +import fs from 'fs-extra'; import { DEFAULT_EXTERNALS } from './constant'; import { pick, replaceFileContent } from './helper'; import type { ParsedTask } from './types'; diff --git a/scripts/test-helper/src/index.ts b/scripts/test-helper/src/index.ts index 88e455f575..268d465573 100644 --- a/scripts/test-helper/src/index.ts +++ b/scripts/test-helper/src/index.ts @@ -1,8 +1,8 @@ import { isPathString, normalizeToPosixPath } from './path'; import { + type PathMatcher, applyMatcherReplacement, createDefaultPathMatchers, - type PathMatcher, } from './pathSerializer'; export { normalizeToPosixPath } from './path'; diff --git a/scripts/test-helper/src/path.ts b/scripts/test-helper/src/path.ts index fa1f2dc43c..8a16685301 100644 --- a/scripts/test-helper/src/path.ts +++ b/scripts/test-helper/src/path.ts @@ -1,6 +1,6 @@ -import path from 'node:path'; -import os from 'node:os'; import fs from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; import _ from 'lodash'; import upath from 'upath'; diff --git a/scripts/test-helper/src/pathSerializer.ts b/scripts/test-helper/src/pathSerializer.ts index 9875a04748..a236bea1a7 100644 --- a/scripts/test-helper/src/pathSerializer.ts +++ b/scripts/test-helper/src/pathSerializer.ts @@ -1,9 +1,9 @@ import os from 'node:os'; import _ from 'lodash'; import { - splitPathString, compilePathMatcherRegExp, getRealTemporaryDirectory, + splitPathString, } from './path'; /** Different from */ diff --git a/scripts/test-helper/src/rsbuild.ts b/scripts/test-helper/src/rsbuild.ts index 37dcc5a5f1..9ec7b2d273 100644 --- a/scripts/test-helper/src/rsbuild.ts +++ b/scripts/test-helper/src/rsbuild.ts @@ -1,10 +1,10 @@ import type { - RspackConfig, - RsbuildProvider, - RsbuildPlugin, - RsbuildInstance, - CreateRsbuildOptions, BundlerPluginInstance, + CreateRsbuildOptions, + RsbuildInstance, + RsbuildPlugin, + RsbuildProvider, + RspackConfig, } from '@rsbuild/shared'; const getRspackProvider = async () => { diff --git a/scripts/test-helper/vitest.setup.ts b/scripts/test-helper/vitest.setup.ts index b0e9e95eeb..259a54485a 100644 --- a/scripts/test-helper/vitest.setup.ts +++ b/scripts/test-helper/vitest.setup.ts @@ -1,5 +1,5 @@ import path from 'node:path'; -import { expect, beforeAll } from 'vitest'; +import { beforeAll, expect } from 'vitest'; import { createSnapshotSerializer } from './dist'; beforeAll((suite) => { diff --git a/vitest.workspace.ts b/vitest.workspace.ts index 28eef551d8..ae33886ef7 100644 --- a/vitest.workspace.ts +++ b/vitest.workspace.ts @@ -1,5 +1,5 @@ -import { defineWorkspace } from 'vitest/config'; import { Console } from 'node:console'; +import { defineWorkspace } from 'vitest/config'; // Disable color in test process.env.NO_COLOR = '1'; diff --git a/website/components/Overview.tsx b/website/components/Overview.tsx index d85763e98e..313e535a6a 100644 --- a/website/components/Overview.tsx +++ b/website/components/Overview.tsx @@ -1,6 +1,6 @@ import { Link } from 'rspress/theme'; -import { useUrl } from './utils'; import styles from './Overview.module.scss'; +import { useUrl } from './utils'; export interface GroupItem { text: string; diff --git a/website/components/Step.tsx b/website/components/Step.tsx index 7b47ccb1ce..799f4924aa 100644 --- a/website/components/Step.tsx +++ b/website/components/Step.tsx @@ -1,6 +1,6 @@ import { Link } from 'rspress/theme'; -import { useUrl } from './utils'; import styles from './Step.module.scss'; +import { useUrl } from './utils'; const Step = (props: { href: string; title: string; description: string }) => { return ( diff --git a/website/components/utils.ts b/website/components/utils.ts index b416cb0209..baff69d1bc 100644 --- a/website/components/utils.ts +++ b/website/components/utils.ts @@ -1,4 +1,4 @@ -import { useLang, withBase, usePageData } from 'rspress/runtime'; +import { useLang, usePageData, withBase } from 'rspress/runtime'; export function useUrl(url: string) { const lang = useLang(); diff --git a/website/rspress.config.ts b/website/rspress.config.ts index 0c29bd503e..1b199ed2b0 100644 --- a/website/rspress.config.ts +++ b/website/rspress.config.ts @@ -1,10 +1,10 @@ import path from 'node:path'; -import { defineConfig } from 'rspress/config'; -import { rsbuildPluginOverview } from './theme/rsbuildPluginOverview'; import { pluginRss } from '@rspress/plugin-rss'; -import { pluginFontOpenSans } from 'rspress-plugin-font-open-sans'; -import { pluginOpenGraph } from 'rsbuild-plugin-open-graph'; import { pluginGoogleAnalytics } from 'rsbuild-plugin-google-analytics'; +import { pluginOpenGraph } from 'rsbuild-plugin-open-graph'; +import { pluginFontOpenSans } from 'rspress-plugin-font-open-sans'; +import { defineConfig } from 'rspress/config'; +import { rsbuildPluginOverview } from './theme/rsbuildPluginOverview'; export default defineConfig({ plugins: [ diff --git a/website/theme/index.tsx b/website/theme/index.tsx index 583dc2aedb..7e912d8e46 100644 --- a/website/theme/index.tsx +++ b/website/theme/index.tsx @@ -1,6 +1,6 @@ -import Theme from 'rspress/theme'; import { RsfamilyNavIcon } from 'rsfamily-nav-icon'; import 'rsfamily-nav-icon/dist/index.css'; +import Theme from 'rspress/theme'; import './index.scss'; const Layout = () => } />; diff --git a/website/theme/rsbuildPluginOverview.ts b/website/theme/rsbuildPluginOverview.ts index dd4ae3a106..ca6958cad5 100644 --- a/website/theme/rsbuildPluginOverview.ts +++ b/website/theme/rsbuildPluginOverview.ts @@ -1,6 +1,6 @@ +import path from 'node:path'; import type { RsbuildPlugin } from '@rsbuild/core'; import glob from 'fast-glob'; -import path from 'node:path'; import type { Group } from '../components/Overview'; const camelCase = (input: string): string =>