diff --git a/packages/rspack/builder.mjs b/packages/rspack/builder.mjs index 14b2475188..642ad78f1d 100644 --- a/packages/rspack/builder.mjs +++ b/packages/rspack/builder.mjs @@ -1,5 +1,7 @@ import webpack from '@rspack/core' +export { default as WebpackBarPlugin } from 'webpackbar/rspack' + export const builder = 'rspack' export { webpack } export const MiniCssExtractPlugin = webpack.CssExtractRspackPlugin diff --git a/packages/rspack/package.json b/packages/rspack/package.json index 6bc0f403f0..8d88e95f3e 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -72,7 +72,7 @@ "webpack-dev-middleware": "^7.4.2", "webpack-hot-middleware": "^2.26.1", "webpack-virtual-modules": "^0.6.2", - "webpackbar": "^6.0.1" + "webpackbar": "^7.0.0" }, "devDependencies": { "@nuxt/schema": "workspace:*", diff --git a/packages/webpack/builder.d.ts b/packages/webpack/builder.d.ts index a7924b945d..5180da54ed 100644 --- a/packages/webpack/builder.d.ts +++ b/packages/webpack/builder.d.ts @@ -3,6 +3,7 @@ declare module '#builder' { import type MiniCssExtractPlugin from 'mini-css-extract-plugin' export const webpack: typeof Webpack + export const WebpackBarPlugin: typeof import('webpackbar').default export const MiniCssExtractPlugin: typeof MiniCssExtractPlugin export const builder: 'webpack' | 'rspack' } diff --git a/packages/webpack/builder.mjs b/packages/webpack/builder.mjs index 4de1c41293..e33279fea9 100644 --- a/packages/webpack/builder.mjs +++ b/packages/webpack/builder.mjs @@ -1,3 +1,4 @@ export const builder = 'webpack' export { default as webpack } from 'webpack' export { default as MiniCssExtractPlugin } from 'mini-css-extract-plugin' +export { default as WebpackBarPlugin } from 'webpackbar' diff --git a/packages/webpack/package.json b/packages/webpack/package.json index bb09ad0386..c85270c2df 100644 --- a/packages/webpack/package.json +++ b/packages/webpack/package.json @@ -70,7 +70,7 @@ "webpack-bundle-analyzer": "^4.10.2", "webpack-dev-middleware": "^7.4.2", "webpack-hot-middleware": "^2.26.1", - "webpackbar": "^6.0.1" + "webpackbar": "^7.0.0" }, "devDependencies": { "@nuxt/schema": "workspace:*", diff --git a/packages/webpack/src/presets/base.ts b/packages/webpack/src/presets/base.ts index cb8ff8ecf0..07b6052002 100644 --- a/packages/webpack/src/presets/base.ts +++ b/packages/webpack/src/presets/base.ts @@ -1,7 +1,6 @@ import { normalize, resolve } from 'pathe' // @ts-expect-error missing types import TimeFixPlugin from 'time-fix-plugin' -import WebpackBar from 'webpackbar' import type { Configuration } from 'webpack' import { logger } from '@nuxt/kit' // @ts-expect-error missing types @@ -15,7 +14,7 @@ import WarningIgnorePlugin from '../plugins/warning-ignore' import type { WebpackConfigContext } from '../utils/config' import { applyPresets, fileName } from '../utils/config' -import { builder, webpack } from '#builder' +import { WebpackBarPlugin, builder, webpack } from '#builder' export async function base (ctx: WebpackConfigContext) { await applyPresets(ctx, [ @@ -88,7 +87,7 @@ function basePlugins (ctx: WebpackConfigContext) { server: 'orange', modern: 'blue', } - ctx.config.plugins.push(new WebpackBar({ + ctx.config.plugins.push(new WebpackBarPlugin({ name: ctx.name, color: colors[ctx.name as keyof typeof colors], reporters: ['stats'], @@ -101,18 +100,18 @@ function basePlugins (ctx: WebpackConfigContext) { ctx.nuxt.callHook(`${builder}:change`, shortPath) } }, - done: ({ state }) => { - if (state.hasErrors) { + done: (_, { stats }) => { + if (stats.hasErrors()) { ctx.nuxt.callHook(`${builder}:error`) } else { - logger.success(`${state.name} ${state.message}`) + logger.success(`Finished building ${stats.compilation.name ?? 'Nuxt app'}`) } }, allDone: () => { ctx.nuxt.callHook(`${builder}:done`) }, - progress ({ statesArray }) { - ctx.nuxt.callHook(`${builder}:progress`, statesArray) + progress: ({ webpackbar }) => { + ctx.nuxt.callHook(`${builder}:progress`, webpackbar.statesArray) }, }, }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 65fd9f45f2..d7d3bd82d3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -639,8 +639,8 @@ importers: specifier: ^0.6.2 version: 0.6.2 webpackbar: - specifier: ^6.0.1 - version: 6.0.1(webpack@5.96.1) + specifier: ^7.0.0 + version: 7.0.0(@rspack/core@1.0.14)(webpack@5.96.1) devDependencies: '@nuxt/schema': specifier: workspace:* @@ -1089,8 +1089,8 @@ importers: specifier: ^2.26.1 version: 2.26.1 webpackbar: - specifier: ^6.0.1 - version: 6.0.1(webpack@5.96.1) + specifier: ^7.0.0 + version: 7.0.0(@rspack/core@1.0.14)(webpack@5.96.1) devDependencies: '@nuxt/schema': specifier: workspace:* @@ -3455,6 +3455,10 @@ packages: resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} engines: {node: '>=12'} + ansis@3.3.2: + resolution: {integrity: sha512-cFthbBlt+Oi0i9Pv/j6YdVWJh54CtjGACaMPCIrEV4Ha7HWsIjXDwseYV79TIL0B4+KfSwD5S70PeQDkPUd1rA==} + engines: {node: '>=15'} + anymatch@3.1.3: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} @@ -4507,10 +4511,6 @@ packages: picomatch: optional: true - figures@3.2.0: - resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==} - engines: {node: '>=8'} - file-entry-cache@8.0.0: resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==} engines: {node: '>=16.0.0'} @@ -5451,9 +5451,6 @@ packages: resolution: {integrity: sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==} hasBin: true - markdown-table@2.0.0: - resolution: {integrity: sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A==} - markdown-table@3.0.3: resolution: {integrity: sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw==} @@ -6549,10 +6546,6 @@ packages: remark-stringify@11.0.0: resolution: {integrity: sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==} - repeat-string@1.6.1: - resolution: {integrity: sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==} - engines: {node: '>=0.10'} - require-directory@2.1.1: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} engines: {node: '>=0.10.0'} @@ -7668,11 +7661,17 @@ packages: webpack-cli: optional: true - webpackbar@6.0.1: - resolution: {integrity: sha512-TnErZpmuKdwWBdMoexjio3KKX6ZtoKHRVvLIU0A47R0VVBDtx3ZyOJDktgYixhoJokZTYTt1Z37OkO9pnGJa9Q==} + webpackbar@7.0.0: + resolution: {integrity: sha512-aS9soqSO2iCHgqHoCrj4LbfGQUboDCYJPSFOAchEK+9psIjNrfSWW4Y0YEz67MKURNvMmfo0ycOg9d/+OOf9/Q==} engines: {node: '>=14.21.3'} peerDependencies: + '@rspack/core': '*' webpack: 3 || 4 || 5 + peerDependenciesMeta: + '@rspack/core': + optional: true + webpack: + optional: true whatwg-mimetype@3.0.0: resolution: {integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==} @@ -10443,6 +10442,8 @@ snapshots: ansi-styles@6.2.1: {} + ansis@3.3.2: {} + anymatch@3.1.3: dependencies: normalize-path: 3.0.0 @@ -11655,10 +11656,6 @@ snapshots: optionalDependencies: picomatch: 4.0.2 - figures@3.2.0: - dependencies: - escape-string-regexp: 1.0.5 - file-entry-cache@8.0.0: dependencies: flat-cache: 4.0.1 @@ -12644,10 +12641,6 @@ snapshots: punycode.js: 2.3.1 uc.micro: 2.1.0 - markdown-table@2.0.0: - dependencies: - repeat-string: 1.6.1 - markdown-table@3.0.3: {} markdownlint-cli@0.42.0: @@ -14073,8 +14066,6 @@ snapshots: mdast-util-to-markdown: 2.1.0 unified: 11.0.5 - repeat-string@1.6.1: {} - require-directory@2.1.1: {} require-from-string@2.0.2: {} @@ -15402,17 +15393,15 @@ snapshots: - esbuild - uglify-js - webpackbar@6.0.1(webpack@5.96.1): + webpackbar@7.0.0(@rspack/core@1.0.14)(webpack@5.96.1): dependencies: - ansi-escapes: 4.3.2 - chalk: 4.1.2 + ansis: 3.3.2 consola: 3.2.3 - figures: 3.2.0 - markdown-table: 2.0.0 pretty-time: 1.1.0 std-env: 3.7.0 + optionalDependencies: + '@rspack/core': 1.0.14 webpack: 5.96.1 - wrap-ansi: 7.0.0 whatwg-mimetype@3.0.0: {}