rollup-plugin-webpack-stats 1.0.0-beta.0 → 1.0.0-beta.2
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 +12 -12
- package/dist/index.d.ts +19 -2
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/transform.d.ts +1 -1
- package/dist/utils.d.ts +3 -1
- package/package.json +1 -1
- package/dist/plugin.d.ts +0 -21
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
|
+
const { webpackStats } = require('rollup-plugin-webpack-stats');
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
module.exports = {
|
|
32
32
|
plugins: [
|
|
33
33
|
// add it as the last plugin
|
|
34
|
-
|
|
34
|
+
webpackStats(),
|
|
35
35
|
],
|
|
36
36
|
};
|
|
37
37
|
```
|
|
@@ -39,12 +39,12 @@ export default {
|
|
|
39
39
|
```js
|
|
40
40
|
// vite.config.js
|
|
41
41
|
import { defineConfig } from 'vite';
|
|
42
|
-
import
|
|
42
|
+
import { webpackStats } 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
|
+
webpackStats(),
|
|
48
48
|
],
|
|
49
49
|
}));
|
|
50
50
|
```
|
|
@@ -60,12 +60,12 @@ export default defineConfig((env) => ({
|
|
|
60
60
|
#### Output to a custom filename
|
|
61
61
|
```js
|
|
62
62
|
// rollup.config.js
|
|
63
|
-
|
|
63
|
+
const { webpackStats } = require('rollup-plugin-webpack-stats');
|
|
64
64
|
|
|
65
65
|
module.exports = {
|
|
66
66
|
plugins: [
|
|
67
67
|
// add it as the last plugin
|
|
68
|
-
|
|
68
|
+
webpackStats({
|
|
69
69
|
filename: 'artifacts/stats.json,
|
|
70
70
|
}),
|
|
71
71
|
],
|
|
@@ -75,12 +75,12 @@ module.exports = {
|
|
|
75
75
|
#### Exclude `.map` files
|
|
76
76
|
```js
|
|
77
77
|
// rollup.config.js
|
|
78
|
-
|
|
78
|
+
const { webpackStats } = require('rollup-plugin-webpack-stats');
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
module.exports = {
|
|
81
81
|
plugins: [
|
|
82
82
|
// add it as the last plugin
|
|
83
|
-
|
|
83
|
+
webpackStats({
|
|
84
84
|
excludeAssets: /\.map$/,
|
|
85
85
|
}),
|
|
86
86
|
],
|
|
@@ -92,7 +92,7 @@ export default {
|
|
|
92
92
|
// for the the modern and legacy outputs
|
|
93
93
|
import { defineConfig } from 'vite';
|
|
94
94
|
import legacy from '@vitejs/plugin-legacy';
|
|
95
|
-
import
|
|
95
|
+
import { webpackStats } from 'rollup-plugin-webpack-stats';
|
|
96
96
|
|
|
97
97
|
export default defineConfig((env) => ({
|
|
98
98
|
build: {
|
|
@@ -103,7 +103,7 @@ export default defineConfig((env) => ({
|
|
|
103
103
|
// Output webpack-stats-legacy.json file for the legacy build
|
|
104
104
|
// Stats are an output plugin, as plugin-legacy works by injecting
|
|
105
105
|
// an additional output, that duplicates the plugins configured here
|
|
106
|
-
|
|
106
|
+
webpackStats((options) => {
|
|
107
107
|
const isLegacy = options.format === 'system';
|
|
108
108
|
return {
|
|
109
109
|
fileName: `webpack-stats${isLegacy ? '-legacy' : '-modern'}.json`,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Plugin, OutputOptions } from 'rollup';
|
|
2
|
+
import type { BundleTransformOptions } from './transform';
|
|
3
3
|
export { bundleToWebpackStats } 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?: BundleTransformOptions['excludeAssets'];
|
|
14
|
+
/**
|
|
15
|
+
* Exclude matching modules
|
|
16
|
+
*/
|
|
17
|
+
excludeModules?: BundleTransformOptions['excludeModules'];
|
|
18
|
+
}
|
|
19
|
+
type WebpackStatsOptionsOrBuilder = WebpackStatsOptions | ((outputOptions: OutputOptions) => WebpackStatsOptions);
|
|
20
|
+
export declare const webpackStats: (options?: WebpackStatsOptionsOrBuilder) => Plugin;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var path = require('path');
|
|
6
4
|
var crypto = require('crypto');
|
|
7
5
|
|
|
@@ -143,5 +141,5 @@ const webpackStats = (options = {}) => ({
|
|
|
143
141
|
});
|
|
144
142
|
|
|
145
143
|
exports.bundleToWebpackStats = bundleToWebpackStats;
|
|
146
|
-
exports.
|
|
144
|
+
exports.webpackStats = webpackStats;
|
|
147
145
|
//# 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/index.ts"],"sourcesContent":[null,null,null],"names":[],"mappings":";;;;;AAIA,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,CA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CAAC,IAAI,KAAK,OAAO,EAAE;YAChC,IAAI,oBAAoB,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,aAAa,CAAC,EAAE;gBAC9D,OAAO;aACR;YAED,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,IAAI,CAAC,QAAQ;gBACnB,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC1C,aAAA,CAAC,CAAC;SACJ;aAAM,CAEN;AACH,KAAC,CAAC,CAAC;IAEH,OAAO;AACL,QAAA,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE;QACnB,MAAM;QACN,MAAM;AACN,QAAA,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC;KACzC,CAAC;AACJ;;AC9IA,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/transform.d.ts
CHANGED
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { OutputChunk } from 'rollup';
|
|
3
|
-
import type { ExcludeFilepathOption } from './types';
|
|
4
3
|
/**
|
|
5
4
|
* Get content byte size
|
|
6
5
|
*/
|
|
@@ -10,7 +9,10 @@ export declare function getByteSize(content: string | Buffer): number;
|
|
|
10
9
|
*/
|
|
11
10
|
export declare function getHash(filepath: string): string;
|
|
12
11
|
export declare function getChunkId(chunk: OutputChunk): string;
|
|
12
|
+
type ExcludeFilepathParam = string | RegExp | ((filepath: string) => boolean);
|
|
13
|
+
export type ExcludeFilepathOption = ExcludeFilepathParam | Array<ExcludeFilepathParam>;
|
|
13
14
|
/**
|
|
14
15
|
* Check if filepath should be excluded based on a config
|
|
15
16
|
*/
|
|
16
17
|
export declare function checkExcludeFilepath(filepath: string, option?: ExcludeFilepathOption): boolean;
|
|
18
|
+
export {};
|
package/package.json
CHANGED
package/dist/plugin.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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 {};
|