@mogzol/webpackbar 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +223 -0
- package/dist/rspack.cjs +39 -0
- package/dist/rspack.d.cts +12 -0
- package/dist/rspack.d.mts +12 -0
- package/dist/rspack.d.ts +12 -0
- package/dist/rspack.mjs +33 -0
- package/dist/shared/webpackbar.07fec22c.mjs +1815 -0
- package/dist/shared/webpackbar.28dc8790.d.cts +124 -0
- package/dist/shared/webpackbar.28dc8790.d.mts +124 -0
- package/dist/shared/webpackbar.28dc8790.d.ts +124 -0
- package/dist/shared/webpackbar.67d03d0b.cjs +1825 -0
- package/dist/webpack.cjs +42 -0
- package/dist/webpack.d.cts +2 -0
- package/dist/webpack.d.mts +2 -0
- package/dist/webpack.d.ts +2 -0
- package/dist/webpack.mjs +36 -0
- package/package.json +93 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Pooya Parsa <pooya@pi0.io>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# Fork of [@unjs/webpackbar](https://github.com/unjs/webpackbar)
|
|
2
|
+
|
|
3
|
+
This fork includes two improvements over the original v7.0.0 from unjs:
|
|
4
|
+
|
|
5
|
+
- Fix line counting so that the bar doesn't get duplicated when log lines wrap ([#164](https://github.com/unjs/webpackbar/issues/164))
|
|
6
|
+
- Add a `keepOnBottom` config option to keep the bar on the bottom of the log output instead of the
|
|
7
|
+
top ([#97](https://github.com/unjs/webpackbar/issues/97))
|
|
8
|
+
|
|
9
|
+
Other than that it is identical to the unjs version.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<!-- automd:badges packagephobia -->
|
|
14
|
+
|
|
15
|
+
[](https://npmjs.com/package/@mogzol/webpackbar)
|
|
16
|
+
[](https://npm.chart.dev/@mogzol/webpackbar)
|
|
17
|
+
[](https://packagephobia.com/result?p=@mogzol/webpackbar)
|
|
18
|
+
|
|
19
|
+
<!-- /automd -->
|
|
20
|
+
|
|
21
|
+
<div align="center">
|
|
22
|
+
<!-- replace with accurate logo e.g from https://worldvectorlogo.com/ -->
|
|
23
|
+
<img width="200" height="200" hspace="25" src="./assets/logo.svg">
|
|
24
|
+
<a href="https://webpack.js.org/">
|
|
25
|
+
<img width="200" height="200" hspace="25" src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon-square-big.svg">
|
|
26
|
+
</a>
|
|
27
|
+
<p>Elegant ProgressBar and Profiler for [Webpack](https://webpack.js.org/) and [Rspack](https://rspack.dev/). </p>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
✔ Display elegant progress bar while building or watch
|
|
31
|
+
|
|
32
|
+
✔ Support of multiple concurrent builds (useful for SSR)
|
|
33
|
+
|
|
34
|
+
✔ Pretty print filename and loaders
|
|
35
|
+
|
|
36
|
+
✔ Windows compatible
|
|
37
|
+
|
|
38
|
+
✔ Fully customizable using reporters
|
|
39
|
+
|
|
40
|
+
✔ Advanced build profiler
|
|
41
|
+
|
|
42
|
+
<div align="center">
|
|
43
|
+
<br>
|
|
44
|
+
<img src="./assets/screen1.png" width="600px">
|
|
45
|
+
<p>Multi progress bars</p>
|
|
46
|
+
<br>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div align="center">
|
|
50
|
+
<br>
|
|
51
|
+
<img src="./assets/screen2.png" width="600px">
|
|
52
|
+
<p>Build Profiler</p>
|
|
53
|
+
<br>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<h2 align="center">Getting Started</h2>
|
|
57
|
+
|
|
58
|
+
To begin, you'll need to install `webpackbar`:
|
|
59
|
+
|
|
60
|
+
<!-- automd:pm-i -->
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
# ✨ Auto-detect
|
|
64
|
+
npx nypm install @mogzol/webpackbar
|
|
65
|
+
|
|
66
|
+
# npm
|
|
67
|
+
npm install @mogzol/webpackbar
|
|
68
|
+
|
|
69
|
+
# yarn
|
|
70
|
+
yarn add @mogzol/webpackbar
|
|
71
|
+
|
|
72
|
+
# pnpm
|
|
73
|
+
pnpm install @mogzol/webpackbar
|
|
74
|
+
|
|
75
|
+
# bun
|
|
76
|
+
bun install @mogzol/webpackbar
|
|
77
|
+
|
|
78
|
+
# deno
|
|
79
|
+
deno install @mogzol/webpackbar
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
<!-- /automd -->
|
|
83
|
+
|
|
84
|
+
Then add the reporter as a plugin to your webpack config (make sure `webpack` peer dependency is installed).
|
|
85
|
+
|
|
86
|
+
**`webpack.config.mjs`**
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
import WebpackBar from "webpackbar";
|
|
90
|
+
|
|
91
|
+
export default {
|
|
92
|
+
entry: "./src/entry.js",
|
|
93
|
+
plugins: [
|
|
94
|
+
new WebpackBar({
|
|
95
|
+
/* options */
|
|
96
|
+
}),
|
|
97
|
+
],
|
|
98
|
+
};
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
For using with [Rspack](https://rspack.dev/), you can use `webpackbar/rspack` (make sure `@rspack/core` peer dependency is installed).
|
|
102
|
+
|
|
103
|
+
**`rspack.config.mjs`**:
|
|
104
|
+
|
|
105
|
+
```js
|
|
106
|
+
import WebpackBar from "webpackbar/rspack";
|
|
107
|
+
|
|
108
|
+
export default {
|
|
109
|
+
entry: "./src/entry.js",
|
|
110
|
+
plugins: [
|
|
111
|
+
new WebpackBar({
|
|
112
|
+
/* options */
|
|
113
|
+
}),
|
|
114
|
+
],
|
|
115
|
+
};
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
<h2 align="center">Options</h2>
|
|
119
|
+
|
|
120
|
+
### `name`
|
|
121
|
+
|
|
122
|
+
- Default: `webpack`
|
|
123
|
+
|
|
124
|
+
Name.
|
|
125
|
+
|
|
126
|
+
### `color`
|
|
127
|
+
|
|
128
|
+
- Default: `green`
|
|
129
|
+
|
|
130
|
+
Primary color (can be HEX like `#xxyyzz` or a web color like `green`).
|
|
131
|
+
|
|
132
|
+
### `profile`
|
|
133
|
+
|
|
134
|
+
- Default: `false`
|
|
135
|
+
|
|
136
|
+
Enable profiler.
|
|
137
|
+
|
|
138
|
+
### `fancy`
|
|
139
|
+
|
|
140
|
+
- Default: `true` when not in CI or testing mode.
|
|
141
|
+
|
|
142
|
+
Enable bars reporter.
|
|
143
|
+
|
|
144
|
+
### `basic`
|
|
145
|
+
|
|
146
|
+
- Default: `true` when running in minimal environments.
|
|
147
|
+
|
|
148
|
+
Enable a simple log reporter (only start and end).
|
|
149
|
+
|
|
150
|
+
### `reporter`
|
|
151
|
+
|
|
152
|
+
Register a custom reporter.
|
|
153
|
+
|
|
154
|
+
### `reporters`
|
|
155
|
+
|
|
156
|
+
- Default: `[]`
|
|
157
|
+
|
|
158
|
+
Register an Array of your custom reporters. (Same as `reporter` but array)
|
|
159
|
+
|
|
160
|
+
<h2 align="center">Custom Reporters</h2>
|
|
161
|
+
|
|
162
|
+
Webpackbar comes with a fancy progress-bar out of the box.
|
|
163
|
+
But you may want to show progress somewhere else or provide your own.
|
|
164
|
+
|
|
165
|
+
For this purpose, you can provide one or more extra reporters using `reporter` and `reporters` options.
|
|
166
|
+
|
|
167
|
+
**NOTE:** If you plan to provide your own reporter, don't forget to setting `fancy` and `basic` options to false to prevent conflicts.
|
|
168
|
+
|
|
169
|
+
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.
|
|
170
|
+
|
|
171
|
+
**Simple logger:**
|
|
172
|
+
|
|
173
|
+
```js
|
|
174
|
+
const logger = {
|
|
175
|
+
start(context) {
|
|
176
|
+
// Called when (re)compile is started
|
|
177
|
+
},
|
|
178
|
+
change(context) {
|
|
179
|
+
// Called when a file changed on watch mode
|
|
180
|
+
},
|
|
181
|
+
update(context) {
|
|
182
|
+
// Called after each progress update
|
|
183
|
+
},
|
|
184
|
+
done(context) {
|
|
185
|
+
// Called when compile finished
|
|
186
|
+
},
|
|
187
|
+
progress(context) {
|
|
188
|
+
// Called when build progress updated
|
|
189
|
+
},
|
|
190
|
+
allDone(context) {
|
|
191
|
+
// Called when _all_ compiles finished
|
|
192
|
+
},
|
|
193
|
+
beforeAllDone(context) {},
|
|
194
|
+
afterAllDone(context) {},
|
|
195
|
+
};
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
`context` is the reference to the plugin. You can use `context.state` to access status.
|
|
199
|
+
|
|
200
|
+
**Schema of `context.state`:**
|
|
201
|
+
|
|
202
|
+
```js
|
|
203
|
+
{
|
|
204
|
+
start, progress, message, details, request, hasErrors;
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
<h2 align="center">License</h2>
|
|
209
|
+
|
|
210
|
+
[MIT](./LICENSE)
|
|
211
|
+
|
|
212
|
+
<!-- Refs -->
|
|
213
|
+
|
|
214
|
+
[standard-js-src]: https://flat.badgen.net/badge/code%20style/standard/green
|
|
215
|
+
[standard-js-href]: https://standardjs.com
|
|
216
|
+
[npm-version-src]: https://flat.badgen.net/npm/v/webpackbar/latest
|
|
217
|
+
[npm-version-href]: https://npmjs.com/package/webpackbar
|
|
218
|
+
[npm-downloads-src]: https://flat.badgen.net/npm/dm/webpackbar
|
|
219
|
+
[npm-downloads-href]: https://npmjs.com/package/webpackbar
|
|
220
|
+
[package-phobia-src]: https://flat.badgen.net/packagephobia/install/webpackbar
|
|
221
|
+
[package-phobia-href]: https://packagephobia.now.sh/result?p=webpackbar
|
|
222
|
+
[checks-src]: https://flat.badgen.net/github/checks/nuxt-contrib/webpackbar/master
|
|
223
|
+
[checks-href]: https://github.com/nuxt-contrib/webpackbar/actions
|
package/dist/rspack.cjs
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const rspack = require('@rspack/core');
|
|
4
|
+
const plugin = require('./shared/webpackbar.67d03d0b.cjs');
|
|
5
|
+
require('std-env');
|
|
6
|
+
require('pretty-time');
|
|
7
|
+
require('node:path');
|
|
8
|
+
require('ansis');
|
|
9
|
+
require('consola');
|
|
10
|
+
require('node:process');
|
|
11
|
+
require('string-width');
|
|
12
|
+
|
|
13
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
14
|
+
|
|
15
|
+
const rspack__default = /*#__PURE__*/_interopDefaultCompat(rspack);
|
|
16
|
+
|
|
17
|
+
var __defProp = Object.defineProperty;
|
|
18
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
19
|
+
var __publicField = (obj, key, value) => {
|
|
20
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
class WebpackBarProgressPlugin extends rspack__default.ProgressPlugin {
|
|
24
|
+
constructor(options) {
|
|
25
|
+
super((percent, message, ...details) => {
|
|
26
|
+
if (this.webpackbar) {
|
|
27
|
+
this.webpackbar.updateProgress(percent, message, details);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
__publicField(this, "webpackbar");
|
|
31
|
+
this.webpackbar = new plugin.WebpackBar(options);
|
|
32
|
+
}
|
|
33
|
+
apply(compiler) {
|
|
34
|
+
super.apply(compiler);
|
|
35
|
+
this.webpackbar.apply(compiler);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports = WebpackBarProgressPlugin;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import rspack from '@rspack/core';
|
|
2
|
+
import { W as WebpackBar, a as WebpackBarOptions } from './shared/webpackbar.28dc8790.cjs';
|
|
3
|
+
export { R as Reporter, S as State } from './shared/webpackbar.28dc8790.cjs';
|
|
4
|
+
import 'webpack';
|
|
5
|
+
|
|
6
|
+
declare class WebpackBarProgressPlugin extends rspack.ProgressPlugin {
|
|
7
|
+
webpackbar: WebpackBar;
|
|
8
|
+
constructor(options?: WebpackBarOptions);
|
|
9
|
+
apply(compiler: any): void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { WebpackBarOptions, WebpackBarProgressPlugin as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import rspack from '@rspack/core';
|
|
2
|
+
import { W as WebpackBar, a as WebpackBarOptions } from './shared/webpackbar.28dc8790.mjs';
|
|
3
|
+
export { R as Reporter, S as State } from './shared/webpackbar.28dc8790.mjs';
|
|
4
|
+
import 'webpack';
|
|
5
|
+
|
|
6
|
+
declare class WebpackBarProgressPlugin extends rspack.ProgressPlugin {
|
|
7
|
+
webpackbar: WebpackBar;
|
|
8
|
+
constructor(options?: WebpackBarOptions);
|
|
9
|
+
apply(compiler: any): void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { WebpackBarOptions, WebpackBarProgressPlugin as default };
|
package/dist/rspack.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import rspack from '@rspack/core';
|
|
2
|
+
import { W as WebpackBar, a as WebpackBarOptions } from './shared/webpackbar.28dc8790.js';
|
|
3
|
+
export { R as Reporter, S as State } from './shared/webpackbar.28dc8790.js';
|
|
4
|
+
import 'webpack';
|
|
5
|
+
|
|
6
|
+
declare class WebpackBarProgressPlugin extends rspack.ProgressPlugin {
|
|
7
|
+
webpackbar: WebpackBar;
|
|
8
|
+
constructor(options?: WebpackBarOptions);
|
|
9
|
+
apply(compiler: any): void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { WebpackBarOptions, WebpackBarProgressPlugin as default };
|
package/dist/rspack.mjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import rspack from '@rspack/core';
|
|
2
|
+
import { W as WebpackBar } from './shared/webpackbar.07fec22c.mjs';
|
|
3
|
+
import 'std-env';
|
|
4
|
+
import 'pretty-time';
|
|
5
|
+
import 'node:path';
|
|
6
|
+
import 'ansis';
|
|
7
|
+
import 'consola';
|
|
8
|
+
import 'node:process';
|
|
9
|
+
import 'string-width';
|
|
10
|
+
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __publicField = (obj, key, value) => {
|
|
14
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15
|
+
return value;
|
|
16
|
+
};
|
|
17
|
+
class WebpackBarProgressPlugin extends rspack.ProgressPlugin {
|
|
18
|
+
constructor(options) {
|
|
19
|
+
super((percent, message, ...details) => {
|
|
20
|
+
if (this.webpackbar) {
|
|
21
|
+
this.webpackbar.updateProgress(percent, message, details);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
__publicField(this, "webpackbar");
|
|
25
|
+
this.webpackbar = new WebpackBar(options);
|
|
26
|
+
}
|
|
27
|
+
apply(compiler) {
|
|
28
|
+
super.apply(compiler);
|
|
29
|
+
this.webpackbar.apply(compiler);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { WebpackBarProgressPlugin as default };
|