Detalhes do pacote

webpackbar

unjs5.1mMIT7.0.0

Elegant ProgressBar and Profiler for Webpack and Rspack

readme (leia-me)

npm version npm downloads

Elegant ProgressBar and Profiler for Webpack and Rspack.

✔ Display elegant progress bar while building or watch

✔ Support of multiple concurrent builds (useful for SSR)

✔ Pretty print filename and loaders

✔ Windows compatible

✔ Fully customizable using reporters

✔ Advanced build profiler


Multi progress bars



Build Profiler


Getting Started

To begin, you'll need to install webpackbar:

# ✨ Auto-detect
npx nypm install webpackbar

# npm
npm install webpackbar

# yarn
yarn add webpackbar

# pnpm
pnpm install webpackbar

# bun
bun install webpackbar

# deno
deno install webpackbar

Then add the reporter as a plugin to your webpack config (make sure webpack peer dependency is installed).

webpack.config.mjs

import WebpackBar from "webpackbar";

export default {
  entry: "./src/entry.js",
  plugins: [
    new WebpackBar({
      /* options */
    }),
  ],
};

For using with Rspack, you can use webpackbar/rspack (make sure @rspack/core peer dependency is installed).

rspack.config.mjs:

import WebpackBar from "webpackbar/rspack";

export default {
  entry: "./src/entry.js",
  plugins: [
    new WebpackBar({
      /* options */
    }),
  ],
};

Options

name

  • Default: webpack

Name.

color

  • Default: green

Primary color (can be HEX like #xxyyzz or a web color like green).

profile

  • Default: false

Enable profiler.

fancy

  • Default: true when not in CI or testing mode.

Enable bars reporter.

basic

  • Default: true when running in minimal environments.

Enable a simple log reporter (only start and end).

reporter

Register a custom reporter.

reporters

  • Default: []

Register an Array of your custom reporters. (Same as reporter but array)

Custom Reporters

Webpackbar comes with a fancy progress-bar out of the box. But you may want to show progress somewhere else or provide your own.

For this purpose, you can provide one or more extra reporters using reporter and reporters options.

NOTE: If you plan to provide your own reporter, don't forget to setting fancy and basic options to false to prevent conflicts.

A reporter should be instance of a class or plain object and functions for special hooks. It is not necessary to implement all functions, webpackbar only calls those that exists.

Simple logger:

const logger = {
  start(context) {
    // Called when (re)compile is started
  },
  change(context) {
    // Called when a file changed on watch mode
  },
  update(context) {
    // Called after each progress update
  },
  done(context) {
    // Called when compile finished
  },
  progress(context) {
    // Called when build progress updated
  },
  allDone(context) {
    // Called when _all_ compiles finished
  },
  beforeAllDone(context) {},
  afterAllDone(context) {},
};

context is the reference to the plugin. You can use context.state to access status.

Schema of context.state:

{
  start, progress, message, details, request, hasErrors;
}

License

MIT

changelog (log de mudanças)

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

v7.0.0

compare changes

🚀 Enhancements

  • Support rspack (#149)

🩹 Fixes

  • Missing compilation completion information in concurrent mode. #81 (#141, #81)

💅 Refactors

  • Update repo (379d628)
  • Uses ansis for color support (#145)
  • Use named export of markdown-table (c0be4d7)

📦 Build

  • Inline esm-only dependencies (e58277f)

🏡 Chore

❤️ Contributors

v6.0.1

compare changes

🩹 Fixes

  • Node 14 compatibility (#138)

🏡 Chore

❤️ Contributors

v6.0.0

compare changes

🩹 Fixes

  • Typo in ci test config (c3471a1)
  • Typo in ci test config (758143b)
  • Automatically add profile reporter when profile option enabled (#94)

💅 Refactors

📦 Build

  • Add types export conditions (#108)
  • Downgrade cjs-incompatible dependencies (e24d1cd)

🏡 Chore

  • Update renovate config (cf4f93b)
  • deps: ⚠️ Upgrade consola to v3 and minimum node version (#128)
  • Update dependencies (02609e8)

🤖 CI

⚠️ Breaking Changes

  • ⚠️ Update repo (e7d217c)
  • deps: ⚠️ Upgrade consola to v3 and minimum node version (#128)

❤️ Contributors

5.0.2 (2021-11-05)

Bug Fixes

5.0.1 (2021-11-05)

Bug Fixes

  • lower Node.js engine to 12 (e19ede4)

5.0.0 (2021-11-05)

Features

Bug Fixes

  • bundle esm-only deps for cjs support (5301919)
  • line width compare with columns (#90) (96a5a70)
  • types: make constructor argument optional (#80) (fdf097d)

5.0.0-3 (2020-11-02)

5.0.0-2 (2020-11-02)

Bug Fixes

  • pkg: use peerDependencies (cf13805)
  • reporter resolve fixes (02d503b)

5.0.0-1 (2020-11-02)

5.0.0-0 (2020-11-02)

Features

4.0.0 (2019-08-05)

chore

  • deps: update dependency wrap-ansi to v6 (#49) (0970f70)

BREAKING CHANGES

  • deps: Require Node.js 8

3.2.0 (2019-04-18)

Bug Fixes

Features

3.1.5 (2019-01-12)

Bug Fixes

  • fancy: eliminate the probability of replacement of stream.write conflicts (#39) (b3b9c62)

3.1.4 (2018-12-11)

Bug Fixes

  • avoid object.values for node < 7 compability (83fcd06)

3.1.3 (2018-11-14)

3.1.2 (2018-11-09)

Bug Fixes

  • profile: use context.state (0d92aae)
  • revert back afterPlugins to call _ensureState (2f17454)
  • update profile reporter (4f28403)
  • stats: fix typo (d2f6edb)

3.1.1 (2018-11-09)

Bug Fixes

  • prevent calling done hook twice (1753826)
  • plugin: handle conditions that start is not available (4e0dc73)

3.1.0 (2018-11-09)

Features

  • prevent adding multi instances to the same compiler (759a4e6)
  • log-update: support concurrent writes to stdout/stderr on render (d51c508)

3.0.5 (2018-11-09)

Bug Fixes

  • detect and support old consola instance (9fc6e09)

3.0.4 (2018-11-09)

Bug Fixes

3.0.3 (2018-11-08)

3.0.2 (2018-11-08)

Bug Fixes

  • fancy: resume consola befor we die! (ea1c6a8)
  • stats: report errors before we die (53aa6bb)

3.0.1 (2018-11-08)

Bug Fixes

  • windows and linux don't support fsync (8be7459)

3.0.0 (2018-11-07)

3.0.0-3 (2018-11-07)

Bug Fixes

  • unused plugin instances store state in global (556f830)

Features

  • add change hook support (8057e4c)

3.0.0-2 (2018-11-04)

Bug Fixes

  • convert name using startCase (4264503)
  • fix globalState bug (8c0441b)
  • handler assignment should be happened after super() call (150699d)
  • minor fixes (d7a10c9)
  • refactor and memory improvements (74d265a)
  • stability and improvements (7e3e9ad)
  • typo (5dcd6bf)
  • use compile instead of beforeCompile to prevent duplicate calls (05cf301)

Features

  • allow easily disabling reporters (f96ad47)
  • improve stats reporter (09459af)
  • rework bars reporter using a rewrite of log-update (d918a9a)

Reverts

  • revert 100% check condition (c2632ef)

3.0.0-1 (2018-11-02)

Features

  • bars: consola integration (8db1118)
  • consola integration with bars (1c22321)
  • use a shared throttle for bars (91512c1)

3.0.0-0 (2018-11-02)

Bug Fixes

Features

  • reporters and draftlog (6541a1c)
  • support single reporter option (0a10a08)

Performance Improvements

2.6.3 (2018-08-18)

2.6.2 (2018-08-12)

Bug Fixes

  • ESLint is broken when using eslint-plugin-import (783f243)

2.6.1 (2018-04-04)

Bug Fixes

2.6.0 (2018-04-04)

Features

2.5.0 (2018-04-04)

Features

  • windows visual improvements (2ae8339)

2.4.0 (2018-04-01)

Features

  • add compile stats to the sharedState (3973f6b)

2.3.2 (2018-03-31)

Bug Fixes

2.3.1 (2018-03-31)

Bug Fixes

2.3.0 (2018-03-31)

Features

  • colorize: try chalk built-in colors first (73fd89e)

2.2.1 (2018-03-31)

2.2.0 (2018-03-31)

Features

2.1.0 (2018-03-31)

Features

  • show inactive parallel tasks (2862002)

2.0.3 (2018-03-31)

Bug Fixes

  • honor options.stream everywhere (34733b7)

2.0.2 (2018-03-31)

Bug Fixes

  • fix compiled message in minimal mode (80f7ac2)

2.0.1 (2018-03-31)

Bug Fixes

  • fix cannot read property 'write' of undefined (ccb1d65)

2.0.0 (2018-03-31)

Features

BREAKING CHANGES

  • behaviour and options changed. Refer to the new docs

1.5.1 (2018-03-28)

Bug Fixes

1.5.0 (2018-03-28)

Features

  • options.buildTitle & consistent number of output lines (1263fc1)

1.4.0 (2018-03-28)

Features

  • accept done callback as an option (30bfd1e)
  • better handling for 100% state and clear: false (a2c823f)

1.3.0 (2018-03-27)

Features

  • enabled option with smart defaults. (0d22e4c)

1.2.1 (2018-03-27)

Bug Fixes

1.2.0 (2018-03-27)

Features

  • new options: stream, profile, clear and showCursor. (#3) (80f5f17)
  • support hex colors. (#2) (1c7cc0b)

1.1.4 (2018-03-26)

Bug Fixes

1.1.3 (2018-03-24)

Bug Fixes

1.1.2 (2018-03-24)

Bug Fixes

  • profile: ignore requests without any file or loaders (d3eb446)

1.1.1 (2018-03-24)

1.1.0 (2018-03-24)

Features

1.0.0 (2018-03-24)

Change Log

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

x.x.x / <year>-<month>-<day>

  • Bug fix -
  • Feature -
  • Chore -
  • Docs -