rollup-plugin-webpack-stats 0.2.0 → 0.2.1
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 +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +86 -6
- package/dist/index.js.map +1 -0
- package/dist/transform.d.ts +39 -39
- package/package.json +25 -22
- package/dist/rollup-plugin-webpack-stats.cjs.development.js +0 -107
- package/dist/rollup-plugin-webpack-stats.cjs.development.js.map +0 -1
- package/dist/rollup-plugin-webpack-stats.cjs.production.min.js +0 -2
- package/dist/rollup-plugin-webpack-stats.cjs.production.min.js.map +0 -1
- package/dist/rollup-plugin-webpack-stats.esm.js +0 -100
- package/dist/rollup-plugin-webpack-stats.esm.js.map +0 -1
- package/src/index.ts +0 -28
- package/src/transform.ts +0 -135
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
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
9
|
|
|
10
10
|
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
11
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Plugin } from 'rollup';
|
|
2
|
-
import { BundleTransformOptions } from './transform';
|
|
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
|
-
export declare const webpackStats: (options?: WebpackStatsOptions) => Plugin;
|
|
1
|
+
import { Plugin } from 'rollup';
|
|
2
|
+
import { BundleTransformOptions } from './transform';
|
|
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
|
+
export declare const webpackStats: (options?: WebpackStatsOptions) => Plugin;
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,88 @@
|
|
|
1
|
+
'use strict';
|
|
1
2
|
|
|
2
|
-
|
|
3
|
+
var path = require('path');
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const getByteSize = (content) => {
|
|
6
|
+
if (typeof content === 'string') {
|
|
7
|
+
return Buffer.from(content).length;
|
|
8
|
+
}
|
|
9
|
+
return content?.length || 0;
|
|
10
|
+
};
|
|
11
|
+
const bundleToWebpackStats = (bundle, customOptions) => {
|
|
12
|
+
const options = {
|
|
13
|
+
moduleOriginalSize: false,
|
|
14
|
+
...customOptions,
|
|
15
|
+
};
|
|
16
|
+
const items = Object.values(bundle);
|
|
17
|
+
const assets = [];
|
|
18
|
+
const chunks = [];
|
|
19
|
+
const moduleByFileName = {};
|
|
20
|
+
items.forEach(item => {
|
|
21
|
+
if (item.type === 'chunk') {
|
|
22
|
+
assets.push({
|
|
23
|
+
name: item.fileName,
|
|
24
|
+
size: getByteSize(item.code),
|
|
25
|
+
});
|
|
26
|
+
const chunkId = item.name;
|
|
27
|
+
chunks.push({
|
|
28
|
+
id: chunkId,
|
|
29
|
+
entry: item.isEntry,
|
|
30
|
+
initial: !item.isDynamicEntry,
|
|
31
|
+
files: [item.fileName],
|
|
32
|
+
names: [item.name],
|
|
33
|
+
});
|
|
34
|
+
Object.entries(item.modules).forEach(([modulePath, moduleInfo]) => {
|
|
35
|
+
// Remove unexpected rollup null prefix
|
|
36
|
+
const normalizedModulePath = modulePath.replace('\u0000', '');
|
|
37
|
+
const relativeModulePath = path.relative(process.cwd(), normalizedModulePath);
|
|
38
|
+
// Match webpack output - add current directory prefix for child modules
|
|
39
|
+
const relativeModulePathWithPrefix = relativeModulePath.match(/^\.\./)
|
|
40
|
+
? relativeModulePath
|
|
41
|
+
: `.${path.sep}${relativeModulePath}`;
|
|
42
|
+
const moduleEntry = moduleByFileName[relativeModulePathWithPrefix];
|
|
43
|
+
if (moduleEntry) {
|
|
44
|
+
moduleEntry.chunks.push(chunkId);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
moduleByFileName[relativeModulePathWithPrefix] = {
|
|
48
|
+
name: relativeModulePathWithPrefix,
|
|
49
|
+
size: options.moduleOriginalSize
|
|
50
|
+
? moduleInfo.originalLength
|
|
51
|
+
: moduleInfo.renderedLength,
|
|
52
|
+
chunks: [chunkId],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
else if (item.type === 'asset') {
|
|
58
|
+
assets.push({
|
|
59
|
+
name: item.fileName,
|
|
60
|
+
size: getByteSize(item.source.toString()),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
else ;
|
|
64
|
+
});
|
|
65
|
+
return {
|
|
66
|
+
builtAt: Date.now(),
|
|
67
|
+
assets,
|
|
68
|
+
chunks,
|
|
69
|
+
modules: Object.values(moduleByFileName),
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const NAME = 'webpackStats';
|
|
74
|
+
const webpackStats = (options = {}) => ({
|
|
75
|
+
name: NAME,
|
|
76
|
+
generateBundle(_, bundle) {
|
|
77
|
+
const output = bundleToWebpackStats(bundle, options);
|
|
78
|
+
this.emitFile({
|
|
79
|
+
type: 'asset',
|
|
80
|
+
fileName: options?.fileName || 'webpack-stats.json',
|
|
81
|
+
source: JSON.stringify(output),
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
exports.bundleToWebpackStats = bundleToWebpackStats;
|
|
87
|
+
exports.webpackStats = webpackStats;
|
|
88
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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.name;\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":[],"mappings":";;;;AACA,MAAM,WAAW,GAAG,CAAC,OAAO,KAAK;AACjC,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;AACrC,QAAQ,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;AAC3C,KAAK;AACL,IAAI,OAAO,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC;AAChC,CAAC,CAAC;AACU,MAAC,oBAAoB,GAAG,CAAC,MAAM,EAAE,aAAa,KAAK;AAC/D,IAAI,MAAM,OAAO,GAAG;AACpB,QAAQ,kBAAkB,EAAE,KAAK;AACjC,QAAQ,GAAG,aAAa;AACxB,KAAK,CAAC;AACN,IAAI,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACxC,IAAI,MAAM,MAAM,GAAG,EAAE,CAAC;AACtB,IAAI,MAAM,MAAM,GAAG,EAAE,CAAC;AACtB,IAAI,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAChC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,IAAI;AAC1B,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE;AACnC,YAAY,MAAM,CAAC,IAAI,CAAC;AACxB,gBAAgB,IAAI,EAAE,IAAI,CAAC,QAAQ;AACnC,gBAAgB,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;AAC5C,aAAa,CAAC,CAAC;AACf,YAAY,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC;AACtC,YAAY,MAAM,CAAC,IAAI,C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AACzC,qBAAqB,CAAC;AACtB,iBAAiB;AACjB,aAAa,CAAC,CAAC;AACf,SAAS;AACT,aAAa,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE;AACxC,YAAY,MAAM,CAAC,IAAI,CAAC;AACxB,gBAAgB,IAAI,EAAE,IAAI,CAAC,QAAQ;AACnC,gBAAgB,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;AACzD,aAAa,CAAC,CAAC;AACf,SAAS;AACT,aAAa,CAEJ;AACT,KAAK,CAAC,CAAC;AACP,IAAI,OAAO;AACX,QAAQ,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE;AAC3B,QAAQ,MAAM;AACd,QAAQ,MAAM;AACd,QAAQ,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC;AAChD,KAAK,CAAC;AACN;;ACnEA,MAAM,IAAI,GAAG,cAAc,CAAC;AAChB,MAAC,YAAY,GAAG,CAAC,OAAO,GAAG,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/dist/transform.d.ts
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { OutputBundle } from 'rollup';
|
|
2
|
-
export
|
|
3
|
-
name: string;
|
|
4
|
-
size?: number;
|
|
5
|
-
};
|
|
6
|
-
export interface WebpackStatsFilteredChunk {
|
|
7
|
-
id: number | string;
|
|
8
|
-
entry: boolean;
|
|
9
|
-
initial: boolean;
|
|
10
|
-
files?: Array<string>;
|
|
11
|
-
names?: Array<string>;
|
|
12
|
-
}
|
|
13
|
-
export interface WebpackStatsFilteredModule {
|
|
14
|
-
name: string;
|
|
15
|
-
size?: number;
|
|
16
|
-
chunks: Array<string | number>;
|
|
17
|
-
}
|
|
18
|
-
export interface WebpackStatsFilteredConcatenatedModule {
|
|
19
|
-
name: string;
|
|
20
|
-
size?: number;
|
|
21
|
-
}
|
|
22
|
-
export interface WebpackStatsFilteredRootModule extends WebpackStatsFilteredModule {
|
|
23
|
-
modules?: Array<WebpackStatsFilteredConcatenatedModule>;
|
|
24
|
-
}
|
|
25
|
-
export interface WebpackStatsFiltered {
|
|
26
|
-
builtAt?: number;
|
|
27
|
-
hash?: string;
|
|
28
|
-
assets?: Array<WebpackStatsFilteredAsset>;
|
|
29
|
-
chunks?: Array<WebpackStatsFilteredChunk>;
|
|
30
|
-
modules?: Array<WebpackStatsFilteredRootModule>;
|
|
31
|
-
}
|
|
32
|
-
export
|
|
33
|
-
/**
|
|
34
|
-
* Extract module original size or rendered size
|
|
35
|
-
* default: false
|
|
36
|
-
*/
|
|
37
|
-
moduleOriginalSize?: boolean;
|
|
38
|
-
};
|
|
39
|
-
export declare const bundleToWebpackStats: (bundle: OutputBundle, customOptions?: BundleTransformOptions
|
|
1
|
+
import { OutputBundle } from 'rollup';
|
|
2
|
+
export type WebpackStatsFilteredAsset = {
|
|
3
|
+
name: string;
|
|
4
|
+
size?: number;
|
|
5
|
+
};
|
|
6
|
+
export interface WebpackStatsFilteredChunk {
|
|
7
|
+
id: number | string;
|
|
8
|
+
entry: boolean;
|
|
9
|
+
initial: boolean;
|
|
10
|
+
files?: Array<string>;
|
|
11
|
+
names?: Array<string>;
|
|
12
|
+
}
|
|
13
|
+
export interface WebpackStatsFilteredModule {
|
|
14
|
+
name: string;
|
|
15
|
+
size?: number;
|
|
16
|
+
chunks: Array<string | number>;
|
|
17
|
+
}
|
|
18
|
+
export interface WebpackStatsFilteredConcatenatedModule {
|
|
19
|
+
name: string;
|
|
20
|
+
size?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface WebpackStatsFilteredRootModule extends WebpackStatsFilteredModule {
|
|
23
|
+
modules?: Array<WebpackStatsFilteredConcatenatedModule>;
|
|
24
|
+
}
|
|
25
|
+
export interface WebpackStatsFiltered {
|
|
26
|
+
builtAt?: number;
|
|
27
|
+
hash?: string;
|
|
28
|
+
assets?: Array<WebpackStatsFilteredAsset>;
|
|
29
|
+
chunks?: Array<WebpackStatsFilteredChunk>;
|
|
30
|
+
modules?: Array<WebpackStatsFilteredRootModule>;
|
|
31
|
+
}
|
|
32
|
+
export type BundleTransformOptions = {
|
|
33
|
+
/**
|
|
34
|
+
* Extract module original size or rendered size
|
|
35
|
+
* default: false
|
|
36
|
+
*/
|
|
37
|
+
moduleOriginalSize?: boolean;
|
|
38
|
+
};
|
|
39
|
+
export declare const bundleToWebpackStats: (bundle: OutputBundle, customOptions?: BundleTransformOptions) => WebpackStatsFiltered;
|
package/package.json
CHANGED
|
@@ -1,41 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rollup-plugin-webpack-stats",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
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"
|
|
27
26
|
},
|
|
28
27
|
"scripts": {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"test": "
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
28
|
+
"build": "rollup -c rollup.config.mjs",
|
|
29
|
+
"lint": "exit 0",
|
|
30
|
+
"test:unit": "vitest test/unit",
|
|
31
|
+
"test:package": "vitest test/package",
|
|
32
|
+
"bump": "./scripts/bump.sh",
|
|
33
|
+
"release": "./scripts/release.sh"
|
|
35
34
|
},
|
|
36
35
|
"husky": {
|
|
37
36
|
"hooks": {
|
|
38
|
-
"pre-commit": "
|
|
37
|
+
"pre-commit": "npm run lint"
|
|
39
38
|
}
|
|
40
39
|
},
|
|
41
40
|
"prettier": {
|
|
@@ -44,14 +43,18 @@
|
|
|
44
43
|
"singleQuote": true,
|
|
45
44
|
"trailingComma": "es5"
|
|
46
45
|
},
|
|
47
|
-
"module": "dist/rollup-plugin-webpack-stats.esm.js",
|
|
48
46
|
"devDependencies": {
|
|
49
|
-
"
|
|
50
|
-
"rollup": "
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
47
|
+
"@release-it/conventional-changelog": "7.0.0",
|
|
48
|
+
"@rollup/plugin-typescript": "11.1.3",
|
|
49
|
+
"@tsconfig/node14": "14.1.0",
|
|
50
|
+
"@types/node": "20.5.6",
|
|
51
|
+
"dotenv": "16.3.1",
|
|
52
|
+
"husky": "8.0.3",
|
|
53
|
+
"release-it": "16.1.5",
|
|
54
|
+
"rollup": "3.28.1",
|
|
55
|
+
"tslib": "2.6.2",
|
|
56
|
+
"typescript": "5.2.2",
|
|
57
|
+
"vitest": "0.34.3"
|
|
55
58
|
},
|
|
56
59
|
"peerDependencies": {
|
|
57
60
|
"rollup": "^3.0.0"
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
|
-
|
|
7
|
-
var path = _interopDefault(require('path'));
|
|
8
|
-
|
|
9
|
-
function _extends() {
|
|
10
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
11
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
12
|
-
var source = arguments[i];
|
|
13
|
-
for (var key in source) {
|
|
14
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
15
|
-
target[key] = source[key];
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return target;
|
|
20
|
-
};
|
|
21
|
-
return _extends.apply(this, arguments);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
var getByteSize = function getByteSize(content) {
|
|
25
|
-
if (typeof content === 'string') {
|
|
26
|
-
return Buffer.from(content).length;
|
|
27
|
-
}
|
|
28
|
-
return (content == null ? void 0 : content.length) || 0;
|
|
29
|
-
};
|
|
30
|
-
var bundleToWebpackStats = function bundleToWebpackStats(bundle, customOptions) {
|
|
31
|
-
var options = _extends({
|
|
32
|
-
moduleOriginalSize: false
|
|
33
|
-
}, customOptions);
|
|
34
|
-
var items = Object.values(bundle);
|
|
35
|
-
var assets = [];
|
|
36
|
-
var chunks = [];
|
|
37
|
-
var moduleByFileName = {};
|
|
38
|
-
items.forEach(function (item) {
|
|
39
|
-
if (item.type === 'chunk') {
|
|
40
|
-
assets.push({
|
|
41
|
-
name: item.fileName,
|
|
42
|
-
size: getByteSize(item.code)
|
|
43
|
-
});
|
|
44
|
-
var chunkId = item.name;
|
|
45
|
-
chunks.push({
|
|
46
|
-
id: chunkId,
|
|
47
|
-
entry: item.isEntry,
|
|
48
|
-
initial: !item.isDynamicEntry,
|
|
49
|
-
files: [item.fileName],
|
|
50
|
-
names: [item.name]
|
|
51
|
-
});
|
|
52
|
-
Object.entries(item.modules).forEach(function (_ref) {
|
|
53
|
-
var modulePath = _ref[0],
|
|
54
|
-
moduleInfo = _ref[1];
|
|
55
|
-
// Remove unexpected rollup null prefix
|
|
56
|
-
var normalizedModulePath = modulePath.replace("\0", '');
|
|
57
|
-
var relativeModulePath = path.relative(process.cwd(), normalizedModulePath);
|
|
58
|
-
// Match webpack output - add current directory prefix for child modules
|
|
59
|
-
var relativeModulePathWithPrefix = relativeModulePath.match(/^\.\./) ? relativeModulePath : "." + path.sep + relativeModulePath;
|
|
60
|
-
var moduleEntry = moduleByFileName[relativeModulePathWithPrefix];
|
|
61
|
-
if (moduleEntry) {
|
|
62
|
-
moduleEntry.chunks.push(chunkId);
|
|
63
|
-
} else {
|
|
64
|
-
moduleByFileName[relativeModulePathWithPrefix] = {
|
|
65
|
-
name: relativeModulePathWithPrefix,
|
|
66
|
-
size: options.moduleOriginalSize ? moduleInfo.originalLength : moduleInfo.renderedLength,
|
|
67
|
-
chunks: [chunkId]
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
} else if (item.type === 'asset') {
|
|
72
|
-
assets.push({
|
|
73
|
-
name: item.fileName,
|
|
74
|
-
size: getByteSize(item.source.toString())
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
return {
|
|
79
|
-
builtAt: Date.now(),
|
|
80
|
-
assets: assets,
|
|
81
|
-
chunks: chunks,
|
|
82
|
-
modules: Object.values(moduleByFileName)
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
var NAME = 'webpackStats';
|
|
87
|
-
var webpackStats = function webpackStats(options) {
|
|
88
|
-
if (options === void 0) {
|
|
89
|
-
options = {};
|
|
90
|
-
}
|
|
91
|
-
return {
|
|
92
|
-
name: NAME,
|
|
93
|
-
generateBundle: function generateBundle(_, bundle) {
|
|
94
|
-
var _options;
|
|
95
|
-
var output = bundleToWebpackStats(bundle, options);
|
|
96
|
-
this.emitFile({
|
|
97
|
-
type: 'asset',
|
|
98
|
-
fileName: ((_options = options) == null ? void 0 : _options.fileName) || 'webpack-stats.json',
|
|
99
|
-
source: JSON.stringify(output)
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
exports.bundleToWebpackStats = bundleToWebpackStats;
|
|
106
|
-
exports.webpackStats = webpackStats;
|
|
107
|
-
//# sourceMappingURL=rollup-plugin-webpack-stats.cjs.development.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rollup-plugin-webpack-stats.cjs.development.js","sources":["../src/transform.ts","../src/index.ts"],"sourcesContent":["import path from 'path';\nimport { OutputBundle } from 'rollup';\n\n// https://github.com/relative-ci/bundle-stats/blob/master/packages/plugin-webpack-filter/src/index.ts\nexport type WebpackStatsFilteredAsset = {\n name: string;\n size?: number;\n};\n\nexport interface WebpackStatsFilteredChunk {\n id: number | string;\n entry: boolean;\n initial: boolean;\n files?: Array<string>;\n names?: Array<string>;\n}\n\nexport interface WebpackStatsFilteredModule {\n name: string;\n size?: number;\n chunks: Array<string | number>;\n}\n\nexport interface WebpackStatsFilteredConcatenatedModule {\n name: string;\n size?: number;\n}\n\nexport interface WebpackStatsFilteredRootModule\n extends WebpackStatsFilteredModule {\n modules?: Array<WebpackStatsFilteredConcatenatedModule>;\n}\n\nexport interface WebpackStatsFiltered {\n builtAt?: number;\n hash?: string;\n assets?: Array<WebpackStatsFilteredAsset>;\n chunks?: Array<WebpackStatsFilteredChunk>;\n modules?: Array<WebpackStatsFilteredRootModule>;\n}\n\nconst getByteSize = (content: string | Buffer): number => {\n if (typeof content === 'string') {\n return Buffer.from(content).length;\n }\n\n return content?.length || 0;\n};\n\nexport type BundleTransformOptions = {\n /**\n * Extract module original size or rendered size\n * default: false\n */\n moduleOriginalSize?: boolean;\n};\n\nexport const bundleToWebpackStats = (\n bundle: OutputBundle,\n customOptions?: BundleTransformOptions\n): WebpackStatsFiltered => {\n const options = {\n moduleOriginalSize: false,\n ...customOptions,\n };\n\n const items = Object.values(bundle);\n\n const assets: Array<WebpackStatsFilteredAsset> = [];\n const chunks: Array<WebpackStatsFilteredChunk> = [];\n\n const moduleByFileName: Record<string, WebpackStatsFilteredModule> = {};\n\n items.forEach(item => {\n if (item.type === 'chunk') {\n assets.push({\n name: item.fileName,\n size: getByteSize(item.code),\n });\n\n const chunkId = item.name;\n\n chunks.push({\n id: chunkId,\n entry: item.isEntry,\n initial: !item.isDynamicEntry,\n files: [item.fileName],\n names: [item.name],\n });\n\n Object.entries(item.modules).forEach(([modulePath, moduleInfo]) => {\n // Remove unexpected rollup null prefix\n const normalizedModulePath = modulePath.replace('\\u0000', '');\n\n const relativeModulePath = path.relative(\n process.cwd(),\n normalizedModulePath\n );\n\n // Match webpack output - add current directory prefix for child modules\n const relativeModulePathWithPrefix = relativeModulePath.match(/^\\.\\./)\n ? relativeModulePath\n : `.${path.sep}${relativeModulePath}`;\n\n const moduleEntry = moduleByFileName[relativeModulePathWithPrefix];\n\n if (moduleEntry) {\n moduleEntry.chunks.push(chunkId);\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 } else if (item.type === 'asset') {\n assets.push({\n name: item.fileName,\n size: getByteSize(item.source.toString()),\n });\n } else {\n // noop for unknown types\n }\n });\n\n return {\n builtAt: Date.now(),\n assets,\n chunks,\n modules: Object.values(moduleByFileName),\n };\n};\n","import { Plugin } from 'rollup';\n\nimport { BundleTransformOptions, bundleToWebpackStats } from './transform';\n\nexport { bundleToWebpackStats } from './transform';\n\nconst NAME = 'webpackStats';\n\ninterface WebpackStatsOptions extends BundleTransformOptions {\n /**\n * JSON file output fileName\n * default: webpack-stats.json\n */\n fileName?: string;\n}\n\nexport const webpackStats = (options: WebpackStatsOptions = {}): Plugin => ({\n name: NAME,\n generateBundle(_, bundle) {\n const output = bundleToWebpackStats(bundle, options);\n\n this.emitFile({\n type: 'asset',\n fileName: options?.fileName || 'webpack-stats.json',\n source: JSON.stringify(output),\n });\n },\n});\n"],"names":["getByteSize","content","Buffer","from","length","bundleToWebpackStats","bundle","customOptions","options","moduleOriginalSize","items","Object","values","assets","chunks","moduleByFileName","forEach","item","type","push","name","fileName","size","code","chunkId","id","entry","isEntry","initial","isDynamicEntry","files","names","entries","modules","modulePath","moduleInfo","normalizedModulePath","replace","relativeModulePath","path","relative","process","cwd","relativeModulePathWithPrefix","match","sep","moduleEntry","originalLength","renderedLength","source","toString","builtAt","Date","now","NAME","webpackStats","generateBundle","_","output","emitFile","JSON","stringify"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyCA,IAAMA,WAAW,GAAG,SAAdA,WAAW,CAAIC,OAAwB;EAC3C,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;IAC/B,OAAOC,MAAM,CAACC,IAAI,CAACF,OAAO,CAAC,CAACG,MAAM;;EAGpC,OAAO,CAAAH,OAAO,oBAAPA,OAAO,CAAEG,MAAM,KAAI,CAAC;AAC7B,CAAC;IAUYC,oBAAoB,GAAG,SAAvBA,oBAAoB,CAC/BC,MAAoB,EACpBC,aAAsC;EAEtC,IAAMC,OAAO;IACXC,kBAAkB,EAAE;KACjBF,aAAa,CACjB;EAED,IAAMG,KAAK,GAAGC,MAAM,CAACC,MAAM,CAACN,MAAM,CAAC;EAEnC,IAAMO,MAAM,GAAqC,EAAE;EACnD,IAAMC,MA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,OAAO,CAACC,kBAAkB,GAC5B0B,UAAU,CAACY,cAAc,GACzBZ,UAAU,CAACa,cAAc;YAC7BlC,MAAM,EAAE,CAACU,OAAO;WACjB;;OAEJ,CAAC;KACH,MAAM,IAAIP,IAAI,CAACC,IAAI,KAAK,OAAO,EAAE;MAChCL,MAAM,CAACM,IAAI,CAAC;QACVC,IAAI,EAAEH,IAAI,CAACI,QAAQ;QACnBC,IAAI,EAAEtB,WAAW,CAACiB,IAAI,CAACgC,MAAM,CAACC,QAAQ,EAAE;OACzC,CAAC;;GAIL,CAAC;EAEF,OAAO;IACLC,OAAO,EAAEC,IAAI,CAACC,GAAG,EAAE;IACnBxC,MAAM,EAANA,MAAM;IACNC,MAAM,EAANA,MAAM;IACNmB,OAAO,EAAEtB,MAAM,CAACC,MAAM,CAACG,gBAAgB;GACxC;AACH;;AChIA,IAAMuC,IAAI,GAAG,cAAc;AAU3B,IAAaC,YAAY,GAAG,SAAfA,YAAY,CAAI/C;MAAAA;IAAAA,UAA+B,EAAE;;EAAA,OAAc;IAC1EY,IAAI,EAAEkC,IAAI;IACVE,cAAc,0BAACC,CAAC,EAAEnD,MAAM;;MACtB,IAAMoD,MAAM,GAAGrD,oBAAoB,CAACC,MAAM,EAAEE,OAAO,CAAC;MAEpD,IAAI,CAACmD,QAAQ,CAAC;QACZzC,IAAI,EAAE,OAAO;QACbG,QAAQ,EAAE,aAAAb,OAAO,qBAAP,SAASa,QAAQ,KAAI,oBAAoB;QACnD4B,MAAM,EAAEW,IAAI,CAACC,SAAS,CAACH,MAAM;OAC9B,CAAC;;GAEL;AAAA,CAAC;;;;;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("path"))&&"object"==typeof e&&"default"in e?e.default:e;function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}var a=function(e){return"string"==typeof e?Buffer.from(e).length:(null==e?void 0:e.length)||0},i=function(e,i){var r=n({moduleOriginalSize:!1},i),s=Object.values(e),u=[],o=[],l={};return s.forEach((function(e){if("chunk"===e.type){u.push({name:e.fileName,size:a(e.code)});var n=e.name;o.push({id:n,entry:e.isEntry,initial:!e.isDynamicEntry,files:[e.fileName],names:[e.name]}),Object.entries(e.modules).forEach((function(e){var a=e[1],i=e[0].replace("\0",""),s=t.relative(process.cwd(),i),u=s.match(/^\.\./)?s:"."+t.sep+s,o=l[u];o?o.chunks.push(n):l[u]={name:u,size:r.moduleOriginalSize?a.originalLength:a.renderedLength,chunks:[n]}}))}else"asset"===e.type&&u.push({name:e.fileName,size:a(e.source.toString())})})),{builtAt:Date.now(),assets:u,chunks:o,modules:Object.values(l)}};exports.bundleToWebpackStats=i,exports.webpackStats=function(e){return void 0===e&&(e={}),{name:"webpackStats",generateBundle:function(t,n){var a,r=i(n,e);this.emitFile({type:"asset",fileName:(null==(a=e)?void 0:a.fileName)||"webpack-stats.json",source:JSON.stringify(r)})}}};
|
|
2
|
-
//# sourceMappingURL=rollup-plugin-webpack-stats.cjs.production.min.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rollup-plugin-webpack-stats.cjs.production.min.js","sources":["../src/transform.ts","../src/index.ts"],"sourcesContent":["import path from 'path';\nimport { OutputBundle } from 'rollup';\n\n// https://github.com/relative-ci/bundle-stats/blob/master/packages/plugin-webpack-filter/src/index.ts\nexport type WebpackStatsFilteredAsset = {\n name: string;\n size?: number;\n};\n\nexport interface WebpackStatsFilteredChunk {\n id: number | string;\n entry: boolean;\n initial: boolean;\n files?: Array<string>;\n names?: Array<string>;\n}\n\nexport interface WebpackStatsFilteredModule {\n name: string;\n size?: number;\n chunks: Array<string | number>;\n}\n\nexport interface WebpackStatsFilteredConcatenatedModule {\n name: string;\n size?: number;\n}\n\nexport interface WebpackStatsFilteredRootModule\n extends WebpackStatsFilteredModule {\n modules?: Array<WebpackStatsFilteredConcatenatedModule>;\n}\n\nexport interface WebpackStatsFiltered {\n builtAt?: number;\n hash?: string;\n assets?: Array<WebpackStatsFilteredAsset>;\n chunks?: Array<WebpackStatsFilteredChunk>;\n modules?: Array<WebpackStatsFilteredRootModule>;\n}\n\nconst getByteSize = (content: string | Buffer): number => {\n if (typeof content === 'string') {\n return Buffer.from(content).length;\n }\n\n return content?.length || 0;\n};\n\nexport type BundleTransformOptions = {\n /**\n * Extract module original size or rendered size\n * default: false\n */\n moduleOriginalSize?: boolean;\n};\n\nexport const bundleToWebpackStats = (\n bundle: OutputBundle,\n customOptions?: BundleTransformOptions\n): WebpackStatsFiltered => {\n const options = {\n moduleOriginalSize: false,\n ...customOptions,\n };\n\n const items = Object.values(bundle);\n\n const assets: Array<WebpackStatsFilteredAsset> = [];\n const chunks: Array<WebpackStatsFilteredChunk> = [];\n\n const moduleByFileName: Record<string, WebpackStatsFilteredModule> = {};\n\n items.forEach(item => {\n if (item.type === 'chunk') {\n assets.push({\n name: item.fileName,\n size: getByteSize(item.code),\n });\n\n const chunkId = item.name;\n\n chunks.push({\n id: chunkId,\n entry: item.isEntry,\n initial: !item.isDynamicEntry,\n files: [item.fileName],\n names: [item.name],\n });\n\n Object.entries(item.modules).forEach(([modulePath, moduleInfo]) => {\n // Remove unexpected rollup null prefix\n const normalizedModulePath = modulePath.replace('\\u0000', '');\n\n const relativeModulePath = path.relative(\n process.cwd(),\n normalizedModulePath\n );\n\n // Match webpack output - add current directory prefix for child modules\n const relativeModulePathWithPrefix = relativeModulePath.match(/^\\.\\./)\n ? relativeModulePath\n : `.${path.sep}${relativeModulePath}`;\n\n const moduleEntry = moduleByFileName[relativeModulePathWithPrefix];\n\n if (moduleEntry) {\n moduleEntry.chunks.push(chunkId);\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 } else if (item.type === 'asset') {\n assets.push({\n name: item.fileName,\n size: getByteSize(item.source.toString()),\n });\n } else {\n // noop for unknown types\n }\n });\n\n return {\n builtAt: Date.now(),\n assets,\n chunks,\n modules: Object.values(moduleByFileName),\n };\n};\n","import { Plugin } from 'rollup';\n\nimport { BundleTransformOptions, bundleToWebpackStats } from './transform';\n\nexport { bundleToWebpackStats } from './transform';\n\nconst NAME = 'webpackStats';\n\ninterface WebpackStatsOptions extends BundleTransformOptions {\n /**\n * JSON file output fileName\n * default: webpack-stats.json\n */\n fileName?: string;\n}\n\nexport const webpackStats = (options: WebpackStatsOptions = {}): Plugin => ({\n name: NAME,\n generateBundle(_, bundle) {\n const output = bundleToWebpackStats(bundle, options);\n\n this.emitFile({\n type: 'asset',\n fileName: options?.fileName || 'webpack-stats.json',\n source: JSON.stringify(output),\n });\n },\n});\n"],"names":["getByteSize","content","Buffer","from","length","bundleToWebpackStats","bundle","customOptions","options","moduleOriginalSize","items","Object","values","assets","chunks","moduleByFileName","forEach","item","type","push","name","fileName","size","code","chunkId","id","entry","isEntry","initial","isDynamicEntry","files","names","entries","modules","moduleInfo","normalizedModulePath","replace","relativeModulePath","path","relative","process","cwd","relativeModulePathWithPrefix","match","sep","moduleEntry","originalLength","renderedLength","source","toString","builtAt","Date","now","generateBundle","_","output","this","emitFile","_options","JSON","stringify"],"mappings":"kXAyCA,IAAMA,EAAc,SAACC,GACnB,MAAuB,iBAAZA,EACFC,OAAOC,KAAKF,GAASG,cAGvBH,SAAAA,EAASG,SAAU,GAWfC,EAAuB,SAClCC,EACAC,GAEA,IAAMC,KACJC,oBAAoB,GACjBF,GAGCG,EAAQC,OAAOC,OAAON,GAEtBO,EAA2C,GAC3CC,EAA2C,GAE3CC,EAA+D,GAyDrE,OAvDAL,EAAMM,SAAQ,SAAAC,GACZ,GAAkB,UAAdA,EAAKC,KAAkB,CACzBL,EAAOM,KAAK,CACVC,KAAMH,EAAKI,SACXC,KAAMtB,EAAYiB,EAAKM,QAGzB,IAAMC,EAAUP,EAAKG,KAErBN,EAAOK,KAAK,CACVM,GAAID,EACJE,MAAOT,EAAKU,QACZC,SAAUX,EAAKY,eACfC,MAAO,CAACb,EAAKI,UACbU,MAAO,CAACd,EAAKG,QAGfT,OAAOqB,QAAQf,EAAKgB,SAASjB,SAAQ,gBAAckB,OAE3CC,OAAkCC,QAAQ,KAAU,IAEpDC,EAAqBC,EAAKC,SAC9BC,QAAQC,MACRN,GAIIO,EAA+BL,EAAmBM,MAAM,SAC1DN,MACIC,EAAKM,IAAMP,EAEbQ,EAAc9B,EAAiB2B,GAEjCG,EACFA,EAAY/B,OAAOK,KAAKK,GAExBT,EAAiB2B,GAAgC,CAC/CtB,KAAMsB,EACNpB,KAAMd,EAAQC,mBACVyB,EAAWY,eACXZ,EAAWa,eACfjC,OAAQ,CAACU,WAIQ,UAAdP,EAAKC,MACdL,EAAOM,KAAK,CACVC,KAAMH,EAAKI,SACXC,KAAMtB,EAAYiB,EAAK+B,OAAOC,iBAO7B,CACLC,QAASC,KAAKC,MACdvC,OAAAA,EACAC,OAAAA,EACAmB,QAAStB,OAAOC,OAAOG,yDCpHC,SAACP,GAAiC,gBAAjCA,IAAAA,EAA+B,IAAgB,CAC1EY,KAXW,eAYXiC,wBAAeC,EAAGhD,SACViD,EAASlD,EAAqBC,EAAQE,GAE5CgD,KAAKC,SAAS,CACZvC,KAAM,QACNG,mBAAUb,UAAAkD,EAASrC,WAAY,qBAC/B2B,OAAQW,KAAKC,UAAUL"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
|
|
3
|
-
function _extends() {
|
|
4
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
5
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
6
|
-
var source = arguments[i];
|
|
7
|
-
for (var key in source) {
|
|
8
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
9
|
-
target[key] = source[key];
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return target;
|
|
14
|
-
};
|
|
15
|
-
return _extends.apply(this, arguments);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
var getByteSize = function getByteSize(content) {
|
|
19
|
-
if (typeof content === 'string') {
|
|
20
|
-
return Buffer.from(content).length;
|
|
21
|
-
}
|
|
22
|
-
return (content == null ? void 0 : content.length) || 0;
|
|
23
|
-
};
|
|
24
|
-
var bundleToWebpackStats = function bundleToWebpackStats(bundle, customOptions) {
|
|
25
|
-
var options = _extends({
|
|
26
|
-
moduleOriginalSize: false
|
|
27
|
-
}, customOptions);
|
|
28
|
-
var items = Object.values(bundle);
|
|
29
|
-
var assets = [];
|
|
30
|
-
var chunks = [];
|
|
31
|
-
var moduleByFileName = {};
|
|
32
|
-
items.forEach(function (item) {
|
|
33
|
-
if (item.type === 'chunk') {
|
|
34
|
-
assets.push({
|
|
35
|
-
name: item.fileName,
|
|
36
|
-
size: getByteSize(item.code)
|
|
37
|
-
});
|
|
38
|
-
var chunkId = item.name;
|
|
39
|
-
chunks.push({
|
|
40
|
-
id: chunkId,
|
|
41
|
-
entry: item.isEntry,
|
|
42
|
-
initial: !item.isDynamicEntry,
|
|
43
|
-
files: [item.fileName],
|
|
44
|
-
names: [item.name]
|
|
45
|
-
});
|
|
46
|
-
Object.entries(item.modules).forEach(function (_ref) {
|
|
47
|
-
var modulePath = _ref[0],
|
|
48
|
-
moduleInfo = _ref[1];
|
|
49
|
-
// Remove unexpected rollup null prefix
|
|
50
|
-
var normalizedModulePath = modulePath.replace("\0", '');
|
|
51
|
-
var relativeModulePath = path.relative(process.cwd(), normalizedModulePath);
|
|
52
|
-
// Match webpack output - add current directory prefix for child modules
|
|
53
|
-
var relativeModulePathWithPrefix = relativeModulePath.match(/^\.\./) ? relativeModulePath : "." + path.sep + relativeModulePath;
|
|
54
|
-
var moduleEntry = moduleByFileName[relativeModulePathWithPrefix];
|
|
55
|
-
if (moduleEntry) {
|
|
56
|
-
moduleEntry.chunks.push(chunkId);
|
|
57
|
-
} else {
|
|
58
|
-
moduleByFileName[relativeModulePathWithPrefix] = {
|
|
59
|
-
name: relativeModulePathWithPrefix,
|
|
60
|
-
size: options.moduleOriginalSize ? moduleInfo.originalLength : moduleInfo.renderedLength,
|
|
61
|
-
chunks: [chunkId]
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
} else if (item.type === 'asset') {
|
|
66
|
-
assets.push({
|
|
67
|
-
name: item.fileName,
|
|
68
|
-
size: getByteSize(item.source.toString())
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
return {
|
|
73
|
-
builtAt: Date.now(),
|
|
74
|
-
assets: assets,
|
|
75
|
-
chunks: chunks,
|
|
76
|
-
modules: Object.values(moduleByFileName)
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
var NAME = 'webpackStats';
|
|
81
|
-
var webpackStats = function webpackStats(options) {
|
|
82
|
-
if (options === void 0) {
|
|
83
|
-
options = {};
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
name: NAME,
|
|
87
|
-
generateBundle: function generateBundle(_, bundle) {
|
|
88
|
-
var _options;
|
|
89
|
-
var output = bundleToWebpackStats(bundle, options);
|
|
90
|
-
this.emitFile({
|
|
91
|
-
type: 'asset',
|
|
92
|
-
fileName: ((_options = options) == null ? void 0 : _options.fileName) || 'webpack-stats.json',
|
|
93
|
-
source: JSON.stringify(output)
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export { bundleToWebpackStats, webpackStats };
|
|
100
|
-
//# sourceMappingURL=rollup-plugin-webpack-stats.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rollup-plugin-webpack-stats.esm.js","sources":["../src/transform.ts","../src/index.ts"],"sourcesContent":["import path from 'path';\nimport { OutputBundle } from 'rollup';\n\n// https://github.com/relative-ci/bundle-stats/blob/master/packages/plugin-webpack-filter/src/index.ts\nexport type WebpackStatsFilteredAsset = {\n name: string;\n size?: number;\n};\n\nexport interface WebpackStatsFilteredChunk {\n id: number | string;\n entry: boolean;\n initial: boolean;\n files?: Array<string>;\n names?: Array<string>;\n}\n\nexport interface WebpackStatsFilteredModule {\n name: string;\n size?: number;\n chunks: Array<string | number>;\n}\n\nexport interface WebpackStatsFilteredConcatenatedModule {\n name: string;\n size?: number;\n}\n\nexport interface WebpackStatsFilteredRootModule\n extends WebpackStatsFilteredModule {\n modules?: Array<WebpackStatsFilteredConcatenatedModule>;\n}\n\nexport interface WebpackStatsFiltered {\n builtAt?: number;\n hash?: string;\n assets?: Array<WebpackStatsFilteredAsset>;\n chunks?: Array<WebpackStatsFilteredChunk>;\n modules?: Array<WebpackStatsFilteredRootModule>;\n}\n\nconst getByteSize = (content: string | Buffer): number => {\n if (typeof content === 'string') {\n return Buffer.from(content).length;\n }\n\n return content?.length || 0;\n};\n\nexport type BundleTransformOptions = {\n /**\n * Extract module original size or rendered size\n * default: false\n */\n moduleOriginalSize?: boolean;\n};\n\nexport const bundleToWebpackStats = (\n bundle: OutputBundle,\n customOptions?: BundleTransformOptions\n): WebpackStatsFiltered => {\n const options = {\n moduleOriginalSize: false,\n ...customOptions,\n };\n\n const items = Object.values(bundle);\n\n const assets: Array<WebpackStatsFilteredAsset> = [];\n const chunks: Array<WebpackStatsFilteredChunk> = [];\n\n const moduleByFileName: Record<string, WebpackStatsFilteredModule> = {};\n\n items.forEach(item => {\n if (item.type === 'chunk') {\n assets.push({\n name: item.fileName,\n size: getByteSize(item.code),\n });\n\n const chunkId = item.name;\n\n chunks.push({\n id: chunkId,\n entry: item.isEntry,\n initial: !item.isDynamicEntry,\n files: [item.fileName],\n names: [item.name],\n });\n\n Object.entries(item.modules).forEach(([modulePath, moduleInfo]) => {\n // Remove unexpected rollup null prefix\n const normalizedModulePath = modulePath.replace('\\u0000', '');\n\n const relativeModulePath = path.relative(\n process.cwd(),\n normalizedModulePath\n );\n\n // Match webpack output - add current directory prefix for child modules\n const relativeModulePathWithPrefix = relativeModulePath.match(/^\\.\\./)\n ? relativeModulePath\n : `.${path.sep}${relativeModulePath}`;\n\n const moduleEntry = moduleByFileName[relativeModulePathWithPrefix];\n\n if (moduleEntry) {\n moduleEntry.chunks.push(chunkId);\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 } else if (item.type === 'asset') {\n assets.push({\n name: item.fileName,\n size: getByteSize(item.source.toString()),\n });\n } else {\n // noop for unknown types\n }\n });\n\n return {\n builtAt: Date.now(),\n assets,\n chunks,\n modules: Object.values(moduleByFileName),\n };\n};\n","import { Plugin } from 'rollup';\n\nimport { BundleTransformOptions, bundleToWebpackStats } from './transform';\n\nexport { bundleToWebpackStats } from './transform';\n\nconst NAME = 'webpackStats';\n\ninterface WebpackStatsOptions extends BundleTransformOptions {\n /**\n * JSON file output fileName\n * default: webpack-stats.json\n */\n fileName?: string;\n}\n\nexport const webpackStats = (options: WebpackStatsOptions = {}): Plugin => ({\n name: NAME,\n generateBundle(_, bundle) {\n const output = bundleToWebpackStats(bundle, options);\n\n this.emitFile({\n type: 'asset',\n fileName: options?.fileName || 'webpack-stats.json',\n source: JSON.stringify(output),\n });\n },\n});\n"],"names":["getByteSize","content","Buffer","from","length","bundleToWebpackStats","bundle","customOptions","options","moduleOriginalSize","items","Object","values","assets","chunks","moduleByFileName","forEach","item","type","push","name","fileName","size","code","chunkId","id","entry","isEntry","initial","isDynamicEntry","files","names","entries","modules","modulePath","moduleInfo","normalizedModulePath","replace","relativeModulePath","path","relative","process","cwd","relativeModulePathWithPrefix","match","sep","moduleEntry","originalLength","renderedLength","source","toString","builtAt","Date","now","NAME","webpackStats","generateBundle","_","output","emitF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AAM;;MACtB,IAAMoD,MAAM,GAAGrD,oBAAoB,CAACC,MAAM,EAAEE,OAAO,CAAC;MAEpD,IAAI,CAACmD,QAAQ,CAAC;QACZzC,IAAI,EAAE,OAAO;QACbG,QAAQ,EAAE,aAAAb,OAAO,qBAAP,SAASa,QAAQ,KAAI,oBAAoB;QACnD4B,MAAM,EAAEW,IAAI,CAACC,SAAS,CAACH,MAAM;OAC9B,CAAC;;GAEL;AAAA,CAAC;;;;"}
|
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
|
-
};
|