rollup-plugin-webpack-stats 0.2.1-beta.1 → 0.2.2-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 +2 -1
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -8
- package/src/index.ts +0 -28
- package/src/transform.ts +0 -135
package/README.md
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
[](https://www.npmjs.com/package/rollup-plugin-webpack-stats)
|
|
7
7
|

|
|
8
|
-
[](https://github.com/vio/rollup-plugin-webpack-stats/actions/workflows/ci.yml)
|
|
9
|
+
[](https://socket.dev/npm/package/rollup-plugin-webpack-stats)
|
|
9
10
|
|
|
10
11
|
Generate rollup stats JSON file with a [bundle-stats](https://github.com/relative-ci/bundle-stats/tree/master/packages/cli) webpack [supported structure](https://github.com/relative-ci/bundle-stats/blob/master/packages/plugin-webpack-filter/src/index.ts).
|
|
11
12
|
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var crypto = require('crypto');
|
|
3
4
|
var path = require('path');
|
|
4
5
|
|
|
6
|
+
const HASH_LENGTH = 7;
|
|
5
7
|
const getByteSize = (content) => {
|
|
6
8
|
if (typeof content === 'string') {
|
|
7
9
|
return Buffer.from(content).length;
|
|
8
10
|
}
|
|
9
11
|
return content?.length || 0;
|
|
10
12
|
};
|
|
13
|
+
const getHash = (text) => {
|
|
14
|
+
const digest = crypto.createHash('sha256');
|
|
15
|
+
return digest.update(Buffer.from(text)).digest('hex').substr(0, HASH_LENGTH);
|
|
16
|
+
};
|
|
17
|
+
const getChunkId = (chunk) => {
|
|
18
|
+
let value = chunk.name;
|
|
19
|
+
// Use entry module relative path
|
|
20
|
+
if (chunk.moduleIds?.length > 0) {
|
|
21
|
+
const absoluteModulePath = chunk.moduleIds[chunk.moduleIds.length - 1];
|
|
22
|
+
value = path.relative(process.cwd(), absoluteModulePath);
|
|
23
|
+
}
|
|
24
|
+
return getHash([chunk, value].join('-'));
|
|
25
|
+
};
|
|
11
26
|
const bundleToWebpackStats = (bundle, customOptions) => {
|
|
12
27
|
const options = {
|
|
13
28
|
moduleOriginalSize: false,
|
|
@@ -23,7 +38,7 @@ const bundleToWebpackStats = (bundle, customOptions) => {
|
|
|
23
38
|
name: item.fileName,
|
|
24
39
|
size: getByteSize(item.code),
|
|
25
40
|
});
|
|
26
|
-
const chunkId = item
|
|
41
|
+
const chunkId = getChunkId(item);
|
|
27
42
|
chunks.push({
|
|
28
43
|
id: chunkId,
|
|
29
44
|
entry: item.isEntry,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/transform.ts","../src/index.ts"],"sourcesContent":["import path from 'path';\nconst getByteSize = (content) => {\n if (typeof content === 'string') {\n return Buffer.from(content).length;\n }\n return content?.length || 0;\n};\nexport const bundleToWebpackStats = (bundle, customOptions) => {\n const options = {\n moduleOriginalSize: false,\n ...customOptions,\n };\n const items = Object.values(bundle);\n const assets = [];\n const chunks = [];\n const moduleByFileName = {};\n items.forEach(item => {\n if (item.type === 'chunk') {\n assets.push({\n name: item.fileName,\n size: getByteSize(item.code),\n });\n const chunkId = item
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/transform.ts","../src/index.ts"],"sourcesContent":["import crypto from 'crypto';\nimport path from 'path';\nconst HASH_LENGTH = 7;\nconst getByteSize = (content) => {\n if (typeof content === 'string') {\n return Buffer.from(content).length;\n }\n return content?.length || 0;\n};\nconst getHash = (text) => {\n const digest = crypto.createHash('sha256');\n return digest.update(Buffer.from(text)).digest('hex').substr(0, HASH_LENGTH);\n};\nconst getChunkId = (chunk) => {\n let value = chunk.name;\n // Use entry module relative path\n if (chunk.moduleIds?.length > 0) {\n const absoluteModulePath = chunk.moduleIds[chunk.moduleIds.length - 1];\n value = path.relative(process.cwd(), absoluteModulePath);\n }\n return getHash([chunk, value].join('-'));\n};\nexport const bundleToWebpackStats = (bundle, customOptions) => {\n const options = {\n moduleOriginalSize: false,\n ...customOptions,\n };\n const items = Object.values(bundle);\n const assets = [];\n const chunks = [];\n const moduleByFileName = {};\n items.forEach(item => {\n if (item.type === 'chunk') {\n assets.push({\n name: item.fileName,\n size: getByteSize(item.code),\n });\n const chunkId = getChunkId(item);\n chunks.push({\n id: chunkId,\n entry: item.isEntry,\n initial: !item.isDynamicEntry,\n files: [item.fileName],\n names: [item.name],\n });\n Object.entries(item.modules).forEach(([modulePath, moduleInfo]) => {\n // Remove unexpected rollup null prefix\n const normalizedModulePath = modulePath.replace('\\u0000', '');\n const relativeModulePath = path.relative(process.cwd(), normalizedModulePath);\n // Match webpack output - add current directory prefix for child modules\n const relativeModulePathWithPrefix = relativeModulePath.match(/^\\.\\./)\n ? relativeModulePath\n : `.${path.sep}${relativeModulePath}`;\n const moduleEntry = moduleByFileName[relativeModulePathWithPrefix];\n if (moduleEntry) {\n moduleEntry.chunks.push(chunkId);\n }\n else {\n moduleByFileName[relativeModulePathWithPrefix] = {\n name: relativeModulePathWithPrefix,\n size: options.moduleOriginalSize\n ? moduleInfo.originalLength\n : moduleInfo.renderedLength,\n chunks: [chunkId],\n };\n }\n });\n }\n else if (item.type === 'asset') {\n assets.push({\n name: item.fileName,\n size: getByteSize(item.source.toString()),\n });\n }\n else {\n // noop for unknown types\n }\n });\n return {\n builtAt: Date.now(),\n assets,\n chunks,\n modules: Object.values(moduleByFileName),\n };\n};\n//# sourceMappingURL=transform.js.map","import { bundleToWebpackStats } from './transform';\nexport { bundleToWebpackStats } from './transform';\nconst NAME = 'webpackStats';\nexport const webpackStats = (options = {}) => ({\n name: NAME,\n generateBundle(_, bundle) {\n const output = bundleToWebpackStats(bundle, options);\n this.emitFile({\n type: 'asset',\n fileName: options?.fileName || 'webpack-stats.json',\n source: JSON.stringify(output),\n });\n },\n});\n//# sourceMappingURL=index.js.map"],"names":[],"mapp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,EAAE,MAAM;AAC/C,IAAI,IAAI,EAAE,IAAI;AACd,IAAI,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE;AAC9B,QAAQ,MAAM,MAAM,GAAG,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC7D,QAAQ,IAAI,CAAC,QAAQ,CAAC;AACtB,YAAY,IAAI,EAAE,OAAO;AACzB,YAAY,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,oBAAoB;AAC/D,YAAY,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;AAC1C,SAAS,CAAC,CAAC;AACX,KAAK;AACL,CAAC;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rollup-plugin-webpack-stats",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2-beta.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"typings": "dist/index.d.ts",
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "Viorel Cojocaru",
|
|
10
|
-
"email": "vio@
|
|
11
|
-
"url": "https://
|
|
10
|
+
"email": "vio@relative-ci.com",
|
|
11
|
+
"url": "https://relative-ci.com"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
|
-
"url": "git+https://github.com/
|
|
15
|
+
"url": "git+https://github.com/relative-ci/rollup-plugin-webpack-stats.git"
|
|
16
16
|
},
|
|
17
17
|
"bugs": {
|
|
18
|
-
"url": "https://github.com/
|
|
18
|
+
"url": "https://github.com/relative-ci/rollup-plugin-webpack-stats/issues"
|
|
19
19
|
},
|
|
20
|
-
"homepage": "https://github.com/
|
|
20
|
+
"homepage": "https://github.com/relative-ci/rollup-plugin-webpack-stats/blob/master/#readme",
|
|
21
21
|
"files": [
|
|
22
|
-
"dist"
|
|
23
|
-
"src"
|
|
22
|
+
"dist"
|
|
24
23
|
],
|
|
25
24
|
"engines": {
|
|
26
25
|
"node": ">=14"
|
package/src/index.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Plugin } from 'rollup';
|
|
2
|
-
|
|
3
|
-
import { BundleTransformOptions, bundleToWebpackStats } from './transform';
|
|
4
|
-
|
|
5
|
-
export { bundleToWebpackStats } from './transform';
|
|
6
|
-
|
|
7
|
-
const NAME = 'webpackStats';
|
|
8
|
-
|
|
9
|
-
interface WebpackStatsOptions extends BundleTransformOptions {
|
|
10
|
-
/**
|
|
11
|
-
* JSON file output fileName
|
|
12
|
-
* default: webpack-stats.json
|
|
13
|
-
*/
|
|
14
|
-
fileName?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const webpackStats = (options: WebpackStatsOptions = {}): Plugin => ({
|
|
18
|
-
name: NAME,
|
|
19
|
-
generateBundle(_, bundle) {
|
|
20
|
-
const output = bundleToWebpackStats(bundle, options);
|
|
21
|
-
|
|
22
|
-
this.emitFile({
|
|
23
|
-
type: 'asset',
|
|
24
|
-
fileName: options?.fileName || 'webpack-stats.json',
|
|
25
|
-
source: JSON.stringify(output),
|
|
26
|
-
});
|
|
27
|
-
},
|
|
28
|
-
});
|
package/src/transform.ts
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import { OutputBundle } from 'rollup';
|
|
3
|
-
|
|
4
|
-
// https://github.com/relative-ci/bundle-stats/blob/master/packages/plugin-webpack-filter/src/index.ts
|
|
5
|
-
export type WebpackStatsFilteredAsset = {
|
|
6
|
-
name: string;
|
|
7
|
-
size?: number;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export interface WebpackStatsFilteredChunk {
|
|
11
|
-
id: number | string;
|
|
12
|
-
entry: boolean;
|
|
13
|
-
initial: boolean;
|
|
14
|
-
files?: Array<string>;
|
|
15
|
-
names?: Array<string>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface WebpackStatsFilteredModule {
|
|
19
|
-
name: string;
|
|
20
|
-
size?: number;
|
|
21
|
-
chunks: Array<string | number>;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface WebpackStatsFilteredConcatenatedModule {
|
|
25
|
-
name: string;
|
|
26
|
-
size?: number;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface WebpackStatsFilteredRootModule
|
|
30
|
-
extends WebpackStatsFilteredModule {
|
|
31
|
-
modules?: Array<WebpackStatsFilteredConcatenatedModule>;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface WebpackStatsFiltered {
|
|
35
|
-
builtAt?: number;
|
|
36
|
-
hash?: string;
|
|
37
|
-
assets?: Array<WebpackStatsFilteredAsset>;
|
|
38
|
-
chunks?: Array<WebpackStatsFilteredChunk>;
|
|
39
|
-
modules?: Array<WebpackStatsFilteredRootModule>;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const getByteSize = (content: string | Buffer): number => {
|
|
43
|
-
if (typeof content === 'string') {
|
|
44
|
-
return Buffer.from(content).length;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return content?.length || 0;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export type BundleTransformOptions = {
|
|
51
|
-
/**
|
|
52
|
-
* Extract module original size or rendered size
|
|
53
|
-
* default: false
|
|
54
|
-
*/
|
|
55
|
-
moduleOriginalSize?: boolean;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const bundleToWebpackStats = (
|
|
59
|
-
bundle: OutputBundle,
|
|
60
|
-
customOptions?: BundleTransformOptions
|
|
61
|
-
): WebpackStatsFiltered => {
|
|
62
|
-
const options = {
|
|
63
|
-
moduleOriginalSize: false,
|
|
64
|
-
...customOptions,
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const items = Object.values(bundle);
|
|
68
|
-
|
|
69
|
-
const assets: Array<WebpackStatsFilteredAsset> = [];
|
|
70
|
-
const chunks: Array<WebpackStatsFilteredChunk> = [];
|
|
71
|
-
|
|
72
|
-
const moduleByFileName: Record<string, WebpackStatsFilteredModule> = {};
|
|
73
|
-
|
|
74
|
-
items.forEach(item => {
|
|
75
|
-
if (item.type === 'chunk') {
|
|
76
|
-
assets.push({
|
|
77
|
-
name: item.fileName,
|
|
78
|
-
size: getByteSize(item.code),
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
const chunkId = item.name;
|
|
82
|
-
|
|
83
|
-
chunks.push({
|
|
84
|
-
id: chunkId,
|
|
85
|
-
entry: item.isEntry,
|
|
86
|
-
initial: !item.isDynamicEntry,
|
|
87
|
-
files: [item.fileName],
|
|
88
|
-
names: [item.name],
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
Object.entries(item.modules).forEach(([modulePath, moduleInfo]) => {
|
|
92
|
-
// Remove unexpected rollup null prefix
|
|
93
|
-
const normalizedModulePath = modulePath.replace('\u0000', '');
|
|
94
|
-
|
|
95
|
-
const relativeModulePath = path.relative(
|
|
96
|
-
process.cwd(),
|
|
97
|
-
normalizedModulePath
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
// Match webpack output - add current directory prefix for child modules
|
|
101
|
-
const relativeModulePathWithPrefix = relativeModulePath.match(/^\.\./)
|
|
102
|
-
? relativeModulePath
|
|
103
|
-
: `.${path.sep}${relativeModulePath}`;
|
|
104
|
-
|
|
105
|
-
const moduleEntry = moduleByFileName[relativeModulePathWithPrefix];
|
|
106
|
-
|
|
107
|
-
if (moduleEntry) {
|
|
108
|
-
moduleEntry.chunks.push(chunkId);
|
|
109
|
-
} else {
|
|
110
|
-
moduleByFileName[relativeModulePathWithPrefix] = {
|
|
111
|
-
name: relativeModulePathWithPrefix,
|
|
112
|
-
size: options.moduleOriginalSize
|
|
113
|
-
? moduleInfo.originalLength
|
|
114
|
-
: moduleInfo.renderedLength,
|
|
115
|
-
chunks: [chunkId],
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
} else if (item.type === 'asset') {
|
|
120
|
-
assets.push({
|
|
121
|
-
name: item.fileName,
|
|
122
|
-
size: getByteSize(item.source.toString()),
|
|
123
|
-
});
|
|
124
|
-
} else {
|
|
125
|
-
// noop for unknown types
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
return {
|
|
130
|
-
builtAt: Date.now(),
|
|
131
|
-
assets,
|
|
132
|
-
chunks,
|
|
133
|
-
modules: Object.values(moduleByFileName),
|
|
134
|
-
};
|
|
135
|
-
};
|