rollup-plugin-webpack-stats 0.4.0 → 1.0.0-beta.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/README.md +46 -15
- package/dist/index.d.ts +2 -20
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +21 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -26,12 +26,12 @@ yarn add --dev rollup-plugin-webpack-stats
|
|
|
26
26
|
|
|
27
27
|
```js
|
|
28
28
|
// rollup.config.js
|
|
29
|
-
|
|
29
|
+
import webpackStatsPlugin from 'rollup-plugin-webpack-stats';
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
export default {
|
|
32
32
|
plugins: [
|
|
33
33
|
// add it as the last plugin
|
|
34
|
-
|
|
34
|
+
webpackStatsPlugin(),
|
|
35
35
|
],
|
|
36
36
|
};
|
|
37
37
|
```
|
|
@@ -39,22 +39,60 @@ module.exports = {
|
|
|
39
39
|
```js
|
|
40
40
|
// vite.config.js
|
|
41
41
|
import { defineConfig } from 'vite';
|
|
42
|
-
import
|
|
42
|
+
import webpackStatsPlugin from 'rollup-plugin-webpack-stats';
|
|
43
43
|
|
|
44
44
|
export default defineConfig((env) => ({
|
|
45
45
|
plugins: [
|
|
46
46
|
// Output webpack-stats.json file
|
|
47
|
-
|
|
47
|
+
webpackStatsPlugin(),
|
|
48
48
|
],
|
|
49
49
|
}));
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
### Options
|
|
53
|
+
|
|
54
|
+
- `fileName` - JSON stats file inside rollup/vite output directory
|
|
55
|
+
- `excludeAssets` - exclude matching assets: `string | RegExp | ((filepath: string) => boolean) | Array<string | RegExp | ((filepath: string) => boolean)>`
|
|
56
|
+
- `excludeModules` - exclude matching modules: `string | RegExp | ((filepath: string) => boolean) | Array<string | RegExp | ((filepath: string) => boolean)>`
|
|
57
|
+
|
|
58
|
+
### Examples
|
|
59
|
+
|
|
60
|
+
#### Output to a custom filename
|
|
61
|
+
```js
|
|
62
|
+
// rollup.config.js
|
|
63
|
+
import webpackStatsPlugin from 'rollup-plugin-webpack-stats';
|
|
64
|
+
|
|
65
|
+
module.exports = {
|
|
66
|
+
plugins: [
|
|
67
|
+
// add it as the last plugin
|
|
68
|
+
webpackStatsPlugin({
|
|
69
|
+
filename: 'artifacts/stats.json,
|
|
70
|
+
}),
|
|
71
|
+
],
|
|
72
|
+
};
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### Exclude `.map` files
|
|
76
|
+
```js
|
|
77
|
+
// rollup.config.js
|
|
78
|
+
import webpackStatsPlugin from 'rollup-plugin-webpack-stats';
|
|
79
|
+
|
|
80
|
+
export default {
|
|
81
|
+
plugins: [
|
|
82
|
+
// add it as the last plugin
|
|
83
|
+
webpackStatsPlugin({
|
|
84
|
+
excludeAssets: /\.map$/,
|
|
85
|
+
}),
|
|
86
|
+
],
|
|
87
|
+
};
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### Vite.js - multiple stats files when using plugin-legacy
|
|
52
91
|
```js
|
|
53
|
-
// vite.config.js - using plugin-legacy, and generating a stats file
|
|
54
92
|
// for the the modern and legacy outputs
|
|
55
93
|
import { defineConfig } from 'vite';
|
|
56
94
|
import legacy from '@vitejs/plugin-legacy';
|
|
57
|
-
import
|
|
95
|
+
import webpackStatsPlugin from 'rollup-plugin-webpack-stats';
|
|
58
96
|
|
|
59
97
|
export default defineConfig((env) => ({
|
|
60
98
|
build: {
|
|
@@ -65,7 +103,7 @@ export default defineConfig((env) => ({
|
|
|
65
103
|
// Output webpack-stats-legacy.json file for the legacy build
|
|
66
104
|
// Stats are an output plugin, as plugin-legacy works by injecting
|
|
67
105
|
// an additional output, that duplicates the plugins configured here
|
|
68
|
-
|
|
106
|
+
webpackStatsPlugin((options) => {
|
|
69
107
|
const isLegacy = options.format === 'system';
|
|
70
108
|
return {
|
|
71
109
|
fileName: `webpack-stats${isLegacy ? '-legacy' : '-modern'}.json`,
|
|
@@ -83,13 +121,6 @@ export default defineConfig((env) => ({
|
|
|
83
121
|
}));
|
|
84
122
|
```
|
|
85
123
|
|
|
86
|
-
### Options
|
|
87
|
-
|
|
88
|
-
- `fileName` - JSON stats file inside rollup/vite output directory
|
|
89
|
-
- `excludeAssets` - exclude matching assets: `string | RegExp | ((filepath: string) => boolean) | Array<string | RegExp | ((filepath: string) => boolean)>`
|
|
90
|
-
- `excludeModules` - exclude matching modules: `string | RegExp | ((filepath: string) => boolean) | Array<string | RegExp | ((filepath: string) => boolean)>`
|
|
91
|
-
|
|
92
|
-
|
|
93
124
|
## Resources
|
|
94
125
|
|
|
95
126
|
- [Vite - Using plugins](https://vitejs.dev/guide/using-plugins)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { BundleTransformOptions } from './transform';
|
|
1
|
+
import { webpackStats } from './plugin';
|
|
2
|
+
export default webpackStats;
|
|
4
3
|
export { bundleToWebpackStats } from './transform';
|
|
5
|
-
interface WebpackStatsOptions extends BundleTransformOptions {
|
|
6
|
-
/**
|
|
7
|
-
* JSON file output fileName
|
|
8
|
-
* default: webpack-stats.json
|
|
9
|
-
*/
|
|
10
|
-
fileName?: string;
|
|
11
|
-
/**
|
|
12
|
-
* Exclude matching assets
|
|
13
|
-
*/
|
|
14
|
-
excludeAssets?: ExcludeFilepathOption;
|
|
15
|
-
/**
|
|
16
|
-
* Exclude matching modules
|
|
17
|
-
*/
|
|
18
|
-
excludeModules?: ExcludeFilepathOption;
|
|
19
|
-
}
|
|
20
|
-
type WebpackStatsOptionsOrBuilder = WebpackStatsOptions | ((outputOptions: OutputOptions) => WebpackStatsOptions);
|
|
21
|
-
export declare const webpackStats: (options?: WebpackStatsOptionsOrBuilder) => Plugin;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var path = require('path');
|
|
4
6
|
var crypto = require('crypto');
|
|
5
7
|
|
|
@@ -141,5 +143,5 @@ const webpackStats = (options = {}) => ({
|
|
|
141
143
|
});
|
|
142
144
|
|
|
143
145
|
exports.bundleToWebpackStats = bundleToWebpackStats;
|
|
144
|
-
exports.
|
|
146
|
+
exports.default = webpackStats;
|
|
145
147
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/utils.ts","../src/transform.ts","../src/
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/utils.ts","../src/transform.ts","../src/plugin.ts"],"sourcesContent":[null,null,null],"names":[],"mappings":";;;;;;;AAMA,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB;;AAEG;AACG,SAAU,WAAW,CAAC,OAAwB,EAAA;AAClD,IAAA,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;KACpC;AAED,IAAA,OAAO,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED;;AAEG;AACG,SAAU,OAAO,CAAC,QAAgB,EAAA;IACtC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC3C,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;AACnF,CAAC;AAEK,SAAU,UAAU,CAAC,KAAkB,EAAA;AAC3C,IAAA,IAAI,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC;;IAGvB,IAAI,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,CAAC,EAAE;AAC/B,QAAA,MAAM,k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KACzC,CAAC;AACJ;;AChJA,MAAM,IAAI,GAAG,cAAc,CAAC;AAsBf,MAAA,YAAY,GAAG,CAC1B,UAAwC,EAAE,MAC9B;AACZ,IAAA,IAAI,EAAE,IAAI;IACV,cAAc,CAAC,aAAa,EAAE,MAAM,EAAA;AAClC,QAAA,MAAM,eAAe,GACnB,OAAO,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC;QACnE,MAAM,MAAM,GAAG,oBAAoB,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;QAE7D,IAAI,CAAC,QAAQ,CAAC;AACZ,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,QAAQ,EAAE,eAAe,CAAC,QAAQ,IAAI,oBAAoB;AAC1D,YAAA,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;AAC/B,SAAA,CAAC,CAAC;KACJ;AACF,CAAA;;;;;"}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Plugin, OutputOptions } from 'rollup';
|
|
2
|
+
import type { ExcludeFilepathOption } from './types';
|
|
3
|
+
import { BundleTransformOptions } from './transform';
|
|
4
|
+
interface WebpackStatsOptions extends BundleTransformOptions {
|
|
5
|
+
/**
|
|
6
|
+
* JSON file output fileName
|
|
7
|
+
* default: webpack-stats.json
|
|
8
|
+
*/
|
|
9
|
+
fileName?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Exclude matching assets
|
|
12
|
+
*/
|
|
13
|
+
excludeAssets?: ExcludeFilepathOption;
|
|
14
|
+
/**
|
|
15
|
+
* Exclude matching modules
|
|
16
|
+
*/
|
|
17
|
+
excludeModules?: ExcludeFilepathOption;
|
|
18
|
+
}
|
|
19
|
+
type WebpackStatsOptionsOrBuilder = WebpackStatsOptions | ((outputOptions: OutputOptions) => WebpackStatsOptions);
|
|
20
|
+
export declare const webpackStats: (options?: WebpackStatsOptionsOrBuilder) => Plugin;
|
|
21
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rollup-plugin-webpack-stats",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-beta.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"engines": {
|
|
25
|
-
"node": ">=
|
|
25
|
+
"node": ">=18"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "rollup -c rollup.config.mjs",
|