rollup-plugin-stats 1.5.3 → 1.6.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/dist/cjs/extract.cjs +1 -0
- package/dist/cjs/extract.d.cts +2 -0
- package/dist/cjs/extract2.cjs +2 -0
- package/dist/cjs/extract2.cjs.map +1 -0
- package/dist/cjs/extract2.d.cts +56 -0
- package/dist/cjs/index.cjs +2 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.cts +32 -0
- package/dist/esm/extract.d.mts +2 -0
- package/dist/esm/extract.mjs +1 -0
- package/dist/esm/extract2.d.mts +56 -0
- package/dist/esm/extract2.mjs +2 -0
- package/dist/esm/extract2.mjs.map +1 -0
- package/dist/esm/index.d.mts +32 -0
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -0
- package/package.json +22 -23
- package/dist/extract.cjs +0 -100
- package/dist/extract.cjs.map +0 -1
- package/dist/extract.d.ts +0 -48
- package/dist/extract.mjs +0 -98
- package/dist/extract.mjs.map +0 -1
- package/dist/index.cjs +0 -82
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -22
- package/dist/index.mjs +0 -80
- package/dist/index.mjs.map +0 -1
- package/dist/utils/check-exclude-filepath.d.ts +0 -7
- package/dist/utils/format-file-size.d.ts +0 -1
- package/dist/utils/omit.d.ts +0 -1
- package/dist/utils/round.d.ts +0 -1
- package/dist/write.d.ts +0 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./extract2.cjs`);module.exports=e.t;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as ModuleStats, c as StatsOptions, i as ChunkStatsOptionalProperties, l as extractRollupStats, n as AssetStatsOptionalProperties, o as ModuleStatsOptionalProperties, r as ChunkStats, s as Stats, t as AssetStats } from "./extract2.cjs";
|
|
2
|
+
export { AssetStats, AssetStatsOptionalProperties, ChunkStats, ChunkStatsOptionalProperties, ModuleStats, ModuleStatsOptionalProperties, Stats, StatsOptions, extractRollupStats as default };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e,t){let n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}function t(e,n){if(!n)return!1;if(Array.isArray(n)){let r=!1;for(let i=0;i<=n.length-1&&r===!1;i++)r=t(e,n[i]);return r}return typeof n==`function`?n(e):typeof n==`string`?!!e.match(n):`test`in n?n.test(e):!1}function n(n,r={}){let{source:i=!1,map:a=!1,excludeAssets:o,excludeModules:s}=r,c={};return Object.entries(n).forEach(([n,r])=>{if(!t(n,o)){if(r.type===`asset`){let t=[];i||t.push(`source`),c[n]=e(r,t);return}if(r.type===`chunk`){let o=[];i||o.push(`code`),a||o.push(`map`);let l=e(r,o),u={};Object.entries(l.modules).forEach(([n,r])=>{if(t(n,s))return;let a=[];i||a.push(`code`),u[n]=e(r,a)}),l.modules=u,c[n]=l;return}}}),c}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
|
|
2
|
+
//# sourceMappingURL=extract2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract2.cjs","names":["output: Stats","assetStatsOmitKeys: Array<keyof AssetStatsOptionalProperties>","chunkStatsOmitKeys: Array<keyof ChunkStatsOptionalProperties>","chunkModulesStats: ChunkStats['modules']","moduleStatsOmitKeys: Array<keyof ModuleStatsOptionalProperties>"],"sources":["../../src/utils/omit.ts","../../src/utils/check-exclude-filepath.ts","../../src/extract.ts"],"sourcesContent":["export function omit<D extends object, K extends keyof D = keyof D>(\n data: D,\n keys: K[],\n): Omit<D, K> {\n const result = {} as D;\n const objectKeys = Object.keys(data) as Array<K>;\n\n objectKeys.forEach((key) => {\n if (!keys.includes(key)) {\n result[key] = data[key];\n }\n });\n\n return result;\n}\n","type ExcludeFilepathParam = string | RegExp | ((filepath: string) => boolean);\n\nexport type ExcludeFilepathPatterns = ExcludeFilepathParam | Array<ExcludeFilepathParam>;\n\n/**\n * Check if filepath should be excluded based on patterns\n */\nexport function checkExcludeFilepath(\n filepath: string,\n patterns?: ExcludeFilepathPatterns,\n): boolean {\n if (!patterns) {\n return false;\n }\n\n if (Array.isArray(patterns)) {\n let res = false;\n\n for (let i = 0; i <= patterns.length - 1 && res === false; i++) {\n res = checkExcludeFilepath(filepath, patterns[i]);\n }\n\n return res;\n }\n\n if (typeof patterns === 'function') {\n return patterns(filepath);\n }\n\n if (typeof patterns === 'string') {\n return Boolean(filepath.match(patterns));\n }\n\n if ('test' in patterns) {\n return patterns.test(filepath);\n }\n\n return false;\n}\n","import type { OutputAsset, OutputBundle, OutputChunk, RenderedModule } from 'rollup';\nimport { omit } from './utils/omit';\nimport { type ExcludeFilepathPatterns, checkExcludeFilepath } from './utils/check-exclude-filepath';\n\nexport type AssetStatsOptionalProperties = {\n source?: OutputAsset['source'];\n};\n\nexport type AssetStats = Omit<OutputAsset, keyof AssetStatsOptionalProperties> & AssetStatsOptionalProperties;\n\nexport type ModuleStatsOptionalProperties = {\n code?: RenderedModule['code'] | null;\n};\n\nexport type ModuleStats = Omit<RenderedModule, keyof ModuleStatsOptionalProperties> & ModuleStatsOptionalProperties;\n\nexport type ChunkStatsOptionalProperties = {\n code?: OutputChunk['code'];\n map?: OutputChunk['map']; \n};\n\nexport type ChunkStats = Omit<OutputChunk, keyof ChunkStatsOptionalProperties | 'modules'> & {\n modules: Record<string, ModuleStats>;\n} & ChunkStatsOptionalProperties;\n\nexport type Stats = Record<string, AssetStats | ChunkStats>;\n\nexport type StatsOptions = {\n /**\n * Output asset/module sources\n * @default false \n */\n source?: boolean;\n /**\n * Output chunk map\n * @default false \n */\n map?: boolean;\n /**\n * Exclude matching assets\n */\n excludeAssets?: ExcludeFilepathPatterns;\n /**\n * Exclude matching modules\n */\n excludeModules?: ExcludeFilepathPatterns;\n}\n\n/**\n * Extract bundler stats\n *\n * Shallow clone stats object before any processing using `omit` to\n * 1. resolve getters\n * 2. prevent changes to the stats object\n *\n * @NOTE structuredClone is not supported by rolldown-vite: https://github.com/vitejs/rolldown-vite/issues/128\n */\nexport default function extractRollupStats(bundle: OutputBundle, options: StatsOptions = {}): Stats {\n const { source = false, map = false, excludeAssets, excludeModules } = options;\n\n const output: Stats = {};\n\n Object.entries(bundle).forEach(([bundleEntryFilepath, bundleEntryStats]) => {\n // Skip extraction if the entry filepath matches the exclude assets pattern\n if (checkExcludeFilepath(bundleEntryFilepath, excludeAssets)) {\n return;\n }\n\n if (bundleEntryStats.type === \"asset\") {\n const assetStatsOmitKeys: Array<keyof AssetStatsOptionalProperties> = [];\n\n // Skip asset source if options.source is false\n if (!source) {\n assetStatsOmitKeys.push('source'); \n }\n\n output[bundleEntryFilepath] = omit(\n bundleEntryStats,\n assetStatsOmitKeys,\n ) as AssetStats;\n\n return;\n }\n\n if (bundleEntryStats.type === \"chunk\") {\n const chunkStatsOmitKeys: Array<keyof ChunkStatsOptionalProperties> = [];\n\n // Skip chunk source if options.source is false\n if (!source) {\n chunkStatsOmitKeys.push('code');\n }\n\n // Skip chunk map if options.map is false\n if (!map) {\n chunkStatsOmitKeys.push('map');\n }\n\n const chunkStats = omit(bundleEntryStats, chunkStatsOmitKeys) as ChunkStats;\n\n\n // Extract chunk modules stats\n const chunkModulesStats: ChunkStats['modules'] = {};\n\n Object.entries(chunkStats.modules).forEach(([bundleModuleFilepath, bundleModuleStats]) => {\n // Skip module extraction if the filepath matches the exclude modules pattern\n if (checkExcludeFilepath(bundleModuleFilepath, excludeModules)) {\n return;\n }\n\n const moduleStatsOmitKeys: Array<keyof ModuleStatsOptionalProperties> = [];\n\n // Skip module source if options.source is false\n if (!source) {\n moduleStatsOmitKeys.push('code');\n }\n\n chunkModulesStats[bundleModuleFilepath] = omit(\n bundleModuleStats,\n moduleStatsOmitKeys,\n ) as ModuleStats;\n });\n\n chunkStats.modules = chunkModulesStats;\n\n output[bundleEntryFilepath] = chunkStats;\n\n return;\n }\n });\n \n return output;\n}\n"],"mappings":"AAAA,S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AAwB,EACxC,EACA,EACD,EACD,CAEF,EAAW,QAAU,EAErB,EAAO,GAAuB,EAE9B,UAEF,CAEK"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { OutputAsset, OutputBundle, OutputChunk, RenderedModule } from "rollup";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/check-exclude-filepath.d.ts
|
|
4
|
+
type ExcludeFilepathParam = string | RegExp | ((filepath: string) => boolean);
|
|
5
|
+
type ExcludeFilepathPatterns = ExcludeFilepathParam | Array<ExcludeFilepathParam>;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/extract.d.ts
|
|
8
|
+
type AssetStatsOptionalProperties = {
|
|
9
|
+
source?: OutputAsset['source'];
|
|
10
|
+
};
|
|
11
|
+
type AssetStats = Omit<OutputAsset, keyof AssetStatsOptionalProperties> & AssetStatsOptionalProperties;
|
|
12
|
+
type ModuleStatsOptionalProperties = {
|
|
13
|
+
code?: RenderedModule['code'] | null;
|
|
14
|
+
};
|
|
15
|
+
type ModuleStats = Omit<RenderedModule, keyof ModuleStatsOptionalProperties> & ModuleStatsOptionalProperties;
|
|
16
|
+
type ChunkStatsOptionalProperties = {
|
|
17
|
+
code?: OutputChunk['code'];
|
|
18
|
+
map?: OutputChunk['map'];
|
|
19
|
+
};
|
|
20
|
+
type ChunkStats = Omit<OutputChunk, keyof ChunkStatsOptionalProperties | 'modules'> & {
|
|
21
|
+
modules: Record<string, ModuleStats>;
|
|
22
|
+
} & ChunkStatsOptionalProperties;
|
|
23
|
+
type Stats = Record<string, AssetStats | ChunkStats>;
|
|
24
|
+
type StatsOptions = {
|
|
25
|
+
/**
|
|
26
|
+
* Output asset/module sources
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
source?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Output chunk map
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
map?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Exclude matching assets
|
|
37
|
+
*/
|
|
38
|
+
excludeAssets?: ExcludeFilepathPatterns;
|
|
39
|
+
/**
|
|
40
|
+
* Exclude matching modules
|
|
41
|
+
*/
|
|
42
|
+
excludeModules?: ExcludeFilepathPatterns;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Extract bundler stats
|
|
46
|
+
*
|
|
47
|
+
* Shallow clone stats object before any processing using `omit` to
|
|
48
|
+
* 1. resolve getters
|
|
49
|
+
* 2. prevent changes to the stats object
|
|
50
|
+
*
|
|
51
|
+
* @NOTE structuredClone is not supported by rolldown-vite: https://github.com/vitejs/rolldown-vite/issues/128
|
|
52
|
+
*/
|
|
53
|
+
declare function extractRollupStats(bundle: OutputBundle, options?: StatsOptions): Stats;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { ModuleStats as a, StatsOptions as c, ChunkStatsOptionalProperties as i, extractRollupStats as l, AssetStatsOptionalProperties as n, ModuleStatsOptionalProperties as o, ChunkStats as r, Stats as s, AssetStats as t };
|
|
56
|
+
//# sourceMappingURL=extract2.d.cts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require(`./extract2.cjs`);let l=require(`node:path`);l=s(l);let u=require(`node:process`);u=s(u);let d=require(`node:fs/promises`);d=s(d);async function f(e,t){let n=JSON.stringify(t,null,2);return await d.default.mkdir(l.default.dirname(e),{recursive:!0}),await d.default.writeFile(e,n),{filepath:e,content:n}}function p(e,t=2){let n=10^t;return Math.round(e*n)/n}const m={BYTE:{symbol:`B`,multiplier:1},KILO:{symbol:`KiB`,multiplier:1024},MEGA:{symbol:`MiB`,multiplier:1024*1024}};function h(e){let t=m.BYTE;return typeof e==`number`?(t=e<m.KILO.multiplier?m.BYTE:e<m.MEGA.multiplier?m.KILO:m.MEGA,`${p(e/t.multiplier,2)}${t.symbol}`):`0${t.symbol}`}const g=`rollupStats`,_=`stats.json`;function v(e={}){return{name:`rollupStats`,async generateBundle(t,n){let{fileName:r,stats:i,write:a=f}=(typeof e==`function`?e(t):e)||{},o=r||`stats.json`,s=l.default.isAbsolute(o)?o:l.default.join(t.dir||u.default.cwd(),o),d=c.t(n,i);try{let e=await a(s,d),t=Buffer.byteLength(e.content,`utf-8`);this.info(`Stats saved to ${e.filepath} (${h(t)})`)}catch(e){this.warn(e)}}}}var y=v;module.exports=y;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["fs","path","path","process","extractRollupStats","error: any"],"sources":["../../src/write.ts","../../src/utils/round.ts","../../src/utils/format-file-size.ts","../../src/index.ts"],"sourcesContent":["import path from 'node:path';\nimport fs from 'node:fs/promises';\n\nexport type RollupStatsWriteResponse = {\n filepath: string;\n content: string;\n};\n\nexport type RollupStatsWrite = (\n filepath: string,\n stats: Record<string, unknown>\n) => RollupStatsWriteResponse;\n\nexport async function rollupStatsWrite<\n T extends Record<string, unknown> = Record<string, unknown>,\n>(filepath: string, stats: T): Promise<RollupStatsWriteResponse> {\n const content = JSON.stringify(stats, null, 2);\n\n // Create base directory if it does not exist\n await fs.mkdir(path.dirname(filepath), { recursive: true });\n\n await fs.writeFile(filepath, content);\n\n return {\n filepath,\n content,\n };\n}\n","export function round(value: number, precision = 2) {\n const multiplier = 10 ^ precision;\n return Math.round(value * multiplier) / multiplier; \n}\n","import { round } from './round';\n\nconst FILE_SIZE = {\n BYTE: {\n symbol: 'B',\n multiplier: 1,\n },\n KILO: {\n symbol: 'KiB',\n multiplier: 1024,\n },\n MEGA: {\n symbol: 'MiB',\n multiplier: 1024 * 1024,\n },\n}\n\nexport function formatFileSize(value?: number | null): string {\n let unit = FILE_SIZE.BYTE;\n\n if (typeof value !== 'number') {\n return `0${unit.symbol}`;\n }\n\n if (value < FILE_SIZE.KILO.multiplier) {\n unit = FILE_SIZE.BYTE;\n } else if (value < FILE_SIZE.MEGA.multiplier) {\n unit = FILE_SIZE.KILO;\n } else {\n unit = FILE_SIZE.MEGA;\n }\n\n return `${round(value / unit.multiplier, 2)}${unit.symbol}`;\n}\n","import path from 'node:path';\nimport process from 'node:process';\nimport type { Plugin, OutputOptions } from 'rollup';\n\nimport extractRollupStats, { type StatsOptions } from './extract';\nimport { type RollupStatsWrite, rollupStatsWrite } from './write';\nimport { formatFileSize } from './utils/format-file-size';\n\nconst PLUGIN_NAME = 'rollupStats';\nconst DEFAULT_FILE_NAME = 'stats.json';\n\nexport type RollupStatsOptions = {\n /**\n * Output filename relative to Rollup output directory or absolute\n * @default: stats.json\n */\n fileName?: string;\n /**\n * Rollup stats options\n */\n stats?: StatsOptions;\n /**\n * Custom file writer\n * @default - fs.write(FILENAME, JSON.stringify(STATS, null, 2));\n */\n write?: RollupStatsWrite;\n};\n\ntype RollupStatsOptionsOrOutputOptions =\n | RollupStatsOptions\n | ((outputOptions: OutputOptions) => RollupStatsOptions);\n\n\nfunction rollupStats(options: RollupStatsOptionsOrOutputOptions = {}): Plugin {\n return {\n name: PLUGIN_NAME,\n async generateBundle(context, bundle) {\n const resolvedOptions = typeof options === 'function' ? options(context) : options;\n const { fileName, stats: statsOptions, write = rollupStatsWrite } = resolvedOptions || {};\n\n const resolvedFileName = fileName || DEFAULT_FILE_NAME;\n const filepath = path.isAbsolute(resolvedFileName)\n ? resolvedFileName\n : path.join(context.dir || process.cwd(), resolvedFileName);\n\n const stats = extractRollupStats(bundle, statsOptions);\n\n try {\n const res = await write(filepath, stats);\n const outputSize = Buffer.byteLength(res.content, 'utf-8');\n\n this.info(`Stats saved to ${res.filepath} (${formatFileSize(outputSize)})`);\n } catch (error: any) { // eslint-disable-line\n // Log error, but do not throw to allow the compilation to continue\n this.warn(error);\n }\n },\n } satisfies Plugin;\n}\n\nexport default rollupStats;\n\n"],"mappings":"gnBAaA,eAAsB,EAEpB,EAAkB,EAA6C,CAC/D,IAAM,EAAU,KAAK,UAAU,EAAO,KAAM,EAAE,CAO9C,OAJA,MAAMA,EAAAA,QAAG,MAAMC,EAAAA,QAAK,QAAQ,EAAS,CAAE,CAAE,UAAW,GAAM,CAAC,CAE3D,MAAMD,EAAAA,QAAG,UAAU,EAAU,EAAQ,CAE9B,CACL,WACA,UACD,CC1BH,SAAgB,EAAM,EAAe,EAAY,EAAG,CAClD,IAAM,EAAa,GAAK,EACxB,OAAO,KAAK,MAAM,EAAQ,EAAW,CAAG,ECA1C,MAAM,EAAY,CAChB,KAAM,CACJ,OAAQ,IACR,WAAY,EACb,CACD,KAAM,CACJ,OAAQ,MACR,WAAY,KACb,CACD,KAAM,CACJ,OAAQ,MACR,WAAY,KAAO,KACpB,CACF,CAED,SAAgB,EAAe,EAA+B,CAC5D,IAAI,EAAO,EAAU,KAcrB,OAZI,OAAO,GAAU,UAIrB,AAKE,EALE,EAAQ,EAAU,KAAK,WAClB,EAAU,KACR,EAAQ,EAAU,KAAK,WACzB,EAAU,KAEV,EAAU,KAGZ,GAAG,EAAM,EAAQ,EAAK,WAAY,EAAE,GAAG,EAAK,UAX1C,IAAI,EAAK,SCbpB,MAAM,EAAc,cACd,EAAoB,aAwB1B,SAAS,EAAY,EAA6C,EAAE,CAAU,CAC5E,MAAO,CACL,KAAM,cACN,MAAM,eAAe,EAAS,EAAQ,CAEpC,GAAM,CAAE,WAAU,MAAO,EAAc,QAAQ,IADvB,OAAO,GAAY,WAAa,EAAQ,EAAQ,CAAG,IACY,EAAE,CAEnF,EAAmB,GAAY,aAC/B,EAAWE,EAAAA,QAAK,WAAW,EAAiB,CAC9C,EACAA,EAAAA,QAAK,KAAK,EAAQ,KAAOC,EAAAA,QAAQ,KAAK,CAAE,EAAiB,CAEvD,EAAQC,EAAAA,EAAmB,EAAQ,EAAa,CAEtD,GAAI,CACF,IAAM,EAAM,MAAM,EAAM,EAAU,EAAM,CAClC,EAAa,OAAO,WAAW,EAAI,QAAS,QAAQ,CAE1D,KAAK,KAAK,kBAAkB,EAAI,SAAS,IAAI,EAAe,EAAW,CAAC,GAAG,OACpEC,EAAY,CAEnB,KAAK,KAAK,EAAM,GAGrB,CAGH,IAAA,EAAe"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { c as StatsOptions } from "./extract2.cjs";
|
|
2
|
+
import { OutputOptions, Plugin } from "rollup";
|
|
3
|
+
|
|
4
|
+
//#region src/write.d.ts
|
|
5
|
+
type RollupStatsWriteResponse = {
|
|
6
|
+
filepath: string;
|
|
7
|
+
content: string;
|
|
8
|
+
};
|
|
9
|
+
type RollupStatsWrite = (filepath: string, stats: Record<string, unknown>) => RollupStatsWriteResponse;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/index.d.ts
|
|
12
|
+
type RollupStatsOptions = {
|
|
13
|
+
/**
|
|
14
|
+
* Output filename relative to Rollup output directory or absolute
|
|
15
|
+
* @default: stats.json
|
|
16
|
+
*/
|
|
17
|
+
fileName?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Rollup stats options
|
|
20
|
+
*/
|
|
21
|
+
stats?: StatsOptions;
|
|
22
|
+
/**
|
|
23
|
+
* Custom file writer
|
|
24
|
+
* @default - fs.write(FILENAME, JSON.stringify(STATS, null, 2));
|
|
25
|
+
*/
|
|
26
|
+
write?: RollupStatsWrite;
|
|
27
|
+
};
|
|
28
|
+
type RollupStatsOptionsOrOutputOptions = RollupStatsOptions | ((outputOptions: OutputOptions) => RollupStatsOptions);
|
|
29
|
+
declare function rollupStats(options?: RollupStatsOptionsOrOutputOptions): Plugin;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { RollupStatsOptions, rollupStats as default };
|
|
32
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as ModuleStats, c as StatsOptions, i as ChunkStatsOptionalProperties, l as extractRollupStats, n as AssetStatsOptionalProperties, o as ModuleStatsOptionalProperties, r as ChunkStats, s as Stats, t as AssetStats } from "./extract2.mjs";
|
|
2
|
+
export { AssetStats, AssetStatsOptionalProperties, ChunkStats, ChunkStatsOptionalProperties, ModuleStats, ModuleStatsOptionalProperties, Stats, StatsOptions, extractRollupStats as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./extract2.mjs";export{e as default};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { OutputAsset, OutputBundle, OutputChunk, RenderedModule } from "rollup";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/check-exclude-filepath.d.ts
|
|
4
|
+
type ExcludeFilepathParam = string | RegExp | ((filepath: string) => boolean);
|
|
5
|
+
type ExcludeFilepathPatterns = ExcludeFilepathParam | Array<ExcludeFilepathParam>;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/extract.d.ts
|
|
8
|
+
type AssetStatsOptionalProperties = {
|
|
9
|
+
source?: OutputAsset['source'];
|
|
10
|
+
};
|
|
11
|
+
type AssetStats = Omit<OutputAsset, keyof AssetStatsOptionalProperties> & AssetStatsOptionalProperties;
|
|
12
|
+
type ModuleStatsOptionalProperties = {
|
|
13
|
+
code?: RenderedModule['code'] | null;
|
|
14
|
+
};
|
|
15
|
+
type ModuleStats = Omit<RenderedModule, keyof ModuleStatsOptionalProperties> & ModuleStatsOptionalProperties;
|
|
16
|
+
type ChunkStatsOptionalProperties = {
|
|
17
|
+
code?: OutputChunk['code'];
|
|
18
|
+
map?: OutputChunk['map'];
|
|
19
|
+
};
|
|
20
|
+
type ChunkStats = Omit<OutputChunk, keyof ChunkStatsOptionalProperties | 'modules'> & {
|
|
21
|
+
modules: Record<string, ModuleStats>;
|
|
22
|
+
} & ChunkStatsOptionalProperties;
|
|
23
|
+
type Stats = Record<string, AssetStats | ChunkStats>;
|
|
24
|
+
type StatsOptions = {
|
|
25
|
+
/**
|
|
26
|
+
* Output asset/module sources
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
source?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Output chunk map
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
map?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Exclude matching assets
|
|
37
|
+
*/
|
|
38
|
+
excludeAssets?: ExcludeFilepathPatterns;
|
|
39
|
+
/**
|
|
40
|
+
* Exclude matching modules
|
|
41
|
+
*/
|
|
42
|
+
excludeModules?: ExcludeFilepathPatterns;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Extract bundler stats
|
|
46
|
+
*
|
|
47
|
+
* Shallow clone stats object before any processing using `omit` to
|
|
48
|
+
* 1. resolve getters
|
|
49
|
+
* 2. prevent changes to the stats object
|
|
50
|
+
*
|
|
51
|
+
* @NOTE structuredClone is not supported by rolldown-vite: https://github.com/vitejs/rolldown-vite/issues/128
|
|
52
|
+
*/
|
|
53
|
+
declare function extractRollupStats(bundle: OutputBundle, options?: StatsOptions): Stats;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { ModuleStats as a, StatsOptions as c, ChunkStatsOptionalProperties as i, extractRollupStats as l, AssetStatsOptionalProperties as n, ModuleStatsOptionalProperties as o, ChunkStats as r, Stats as s, AssetStats as t };
|
|
56
|
+
//# sourceMappingURL=extract2.d.mts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e,t){let n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}function t(e,n){if(!n)return!1;if(Array.isArray(n)){let r=!1;for(let i=0;i<=n.length-1&&r===!1;i++)r=t(e,n[i]);return r}return typeof n==`function`?n(e):typeof n==`string`?!!e.match(n):`test`in n?n.test(e):!1}function n(n,r={}){let{source:i=!1,map:a=!1,excludeAssets:o,excludeModules:s}=r,c={};return Object.entries(n).forEach(([n,r])=>{if(!t(n,o)){if(r.type===`asset`){let t=[];i||t.push(`source`),c[n]=e(r,t);return}if(r.type===`chunk`){let o=[];i||o.push(`code`),a||o.push(`map`);let l=e(r,o),u={};Object.entries(l.modules).forEach(([n,r])=>{if(t(n,s))return;let a=[];i||a.push(`code`),u[n]=e(r,a)}),l.modules=u,c[n]=l;return}}}),c}export{n as t};
|
|
2
|
+
//# sourceMappingURL=extract2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract2.mjs","names":["output: Stats","assetStatsOmitKeys: Array<keyof AssetStatsOptionalProperties>","chunkStatsOmitKeys: Array<keyof ChunkStatsOptionalProperties>","chunkModulesStats: ChunkStats['modules']","moduleStatsOmitKeys: Array<keyof ModuleStatsOptionalProperties>"],"sources":["../../src/utils/omit.ts","../../src/utils/check-exclude-filepath.ts","../../src/extract.ts"],"sourcesContent":["export function omit<D extends object, K extends keyof D = keyof D>(\n data: D,\n keys: K[],\n): Omit<D, K> {\n const result = {} as D;\n const objectKeys = Object.keys(data) as Array<K>;\n\n objectKeys.forEach((key) => {\n if (!keys.includes(key)) {\n result[key] = data[key];\n }\n });\n\n return result;\n}\n","type ExcludeFilepathParam = string | RegExp | ((filepath: string) => boolean);\n\nexport type ExcludeFilepathPatterns = ExcludeFilepathParam | Array<ExcludeFilepathParam>;\n\n/**\n * Check if filepath should be excluded based on patterns\n */\nexport function checkExcludeFilepath(\n filepath: string,\n patterns?: ExcludeFilepathPatterns,\n): boolean {\n if (!patterns) {\n return false;\n }\n\n if (Array.isArray(patterns)) {\n let res = false;\n\n for (let i = 0; i <= patterns.length - 1 && res === false; i++) {\n res = checkExcludeFilepath(filepath, patterns[i]);\n }\n\n return res;\n }\n\n if (typeof patterns === 'function') {\n return patterns(filepath);\n }\n\n if (typeof patterns === 'string') {\n return Boolean(filepath.match(patterns));\n }\n\n if ('test' in patterns) {\n return patterns.test(filepath);\n }\n\n return false;\n}\n","import type { OutputAsset, OutputBundle, OutputChunk, RenderedModule } from 'rollup';\nimport { omit } from './utils/omit';\nimport { type ExcludeFilepathPatterns, checkExcludeFilepath } from './utils/check-exclude-filepath';\n\nexport type AssetStatsOptionalProperties = {\n source?: OutputAsset['source'];\n};\n\nexport type AssetStats = Omit<OutputAsset, keyof AssetStatsOptionalProperties> & AssetStatsOptionalProperties;\n\nexport type ModuleStatsOptionalProperties = {\n code?: RenderedModule['code'] | null;\n};\n\nexport type ModuleStats = Omit<RenderedModule, keyof ModuleStatsOptionalProperties> & ModuleStatsOptionalProperties;\n\nexport type ChunkStatsOptionalProperties = {\n code?: OutputChunk['code'];\n map?: OutputChunk['map']; \n};\n\nexport type ChunkStats = Omit<OutputChunk, keyof ChunkStatsOptionalProperties | 'modules'> & {\n modules: Record<string, ModuleStats>;\n} & ChunkStatsOptionalProperties;\n\nexport type Stats = Record<string, AssetStats | ChunkStats>;\n\nexport type StatsOptions = {\n /**\n * Output asset/module sources\n * @default false \n */\n source?: boolean;\n /**\n * Output chunk map\n * @default false \n */\n map?: boolean;\n /**\n * Exclude matching assets\n */\n excludeAssets?: ExcludeFilepathPatterns;\n /**\n * Exclude matching modules\n */\n excludeModules?: ExcludeFilepathPatterns;\n}\n\n/**\n * Extract bundler stats\n *\n * Shallow clone stats object before any processing using `omit` to\n * 1. resolve getters\n * 2. prevent changes to the stats object\n *\n * @NOTE structuredClone is not supported by rolldown-vite: https://github.com/vitejs/rolldown-vite/issues/128\n */\nexport default function extractRollupStats(bundle: OutputBundle, options: StatsOptions = {}): Stats {\n const { source = false, map = false, excludeAssets, excludeModules } = options;\n\n const output: Stats = {};\n\n Object.entries(bundle).forEach(([bundleEntryFilepath, bundleEntryStats]) => {\n // Skip extraction if the entry filepath matches the exclude assets pattern\n if (checkExcludeFilepath(bundleEntryFilepath, excludeAssets)) {\n return;\n }\n\n if (bundleEntryStats.type === \"asset\") {\n const assetStatsOmitKeys: Array<keyof AssetStatsOptionalProperties> = [];\n\n // Skip asset source if options.source is false\n if (!source) {\n assetStatsOmitKeys.push('source'); \n }\n\n output[bundleEntryFilepath] = omit(\n bundleEntryStats,\n assetStatsOmitKeys,\n ) as AssetStats;\n\n return;\n }\n\n if (bundleEntryStats.type === \"chunk\") {\n const chunkStatsOmitKeys: Array<keyof ChunkStatsOptionalProperties> = [];\n\n // Skip chunk source if options.source is false\n if (!source) {\n chunkStatsOmitKeys.push('code');\n }\n\n // Skip chunk map if options.map is false\n if (!map) {\n chunkStatsOmitKeys.push('map');\n }\n\n const chunkStats = omit(bundleEntryStats, chunkStatsOmitKeys) as ChunkStats;\n\n\n // Extract chunk modules stats\n const chunkModulesStats: ChunkStats['modules'] = {};\n\n Object.entries(chunkStats.modules).forEach(([bundleModuleFilepath, bundleModuleStats]) => {\n // Skip module extraction if the filepath matches the exclude modules pattern\n if (checkExcludeFilepath(bundleModuleFilepath, excludeModules)) {\n return;\n }\n\n const moduleStatsOmitKeys: Array<keyof ModuleStatsOptionalProperties> = [];\n\n // Skip module source if options.source is false\n if (!source) {\n moduleStatsOmitKeys.push('code');\n }\n\n chunkModulesStats[bundleModuleFilepath] = omit(\n bundleModuleStats,\n moduleStatsOmitKeys,\n ) as ModuleStats;\n });\n\n chunkStats.modules = chunkModulesStats;\n\n output[bundleEntryFilepath] = chunkStats;\n\n return;\n }\n });\n \n return output;\n}\n"],"mappings":"AAAA,SAAgB,EACd,EACA,EACY,CACZ,IAAM,EAAS,EAAE,CASjB,OARmB,OAAO,KAAK,EAAK,CAEzB,QAAS,GAAQ,CACrB,EAAK,SAAS,EAAI,GACrB,EAAO,GAAO,EAAK,KAErB,CAEK,ECNT,SAAgB,EACd,EACA,EACS,CACT,GAAI,CAAC,EACH,MAAO,GAGT,GAAI,MAAM,QAAQ,EAAS,CAAE,CAC3B,IAAI,EAAM,GAEV,IAAK,IAAI,EAAI,EAAG,GAAK,EAAS,OAAS,GAAK,IAAQ,GAAO,IACzD,EAAM,EAAqB,EAAU,EAAS,GAAG,CAGnD,OAAO,EAeT,OAZI,OAAO,GAAa,WACf,EAAS,EAAS,CAGvB,OAAO,GAAa,SACf,EAAQ,EAAS,MAAM,EAAS,CAGrC,SAAU,EACL,EAAS,KAAK,EAAS,CAGzB,GCoBT,SAAwB,EAAmB,EAAsB,EAAwB,EAAE,CAAS,CAClG,GAAM,CAAE,SAAS,GAAO,MAAM,GAAO,gBAAe,kBAAmB,EAEjEA,EAAgB,EAAE,CAsExB,OApEA,OAAO,QAAQ,EAAO,CAAC,SAAS,CAAC,EAAqB,KAAsB,CAEtE,MAAqB,EAAqB,EAAc,CAI5D,IAAI,EAAiB,OAAS,QAAS,CACrC,IAAMC,EAAgE,EAAE,CAGnE,GACH,EAAmB,KAAK,SAAS,CAGnC,EAAO,GAAuB,EAC5B,EACA,EACD,CAED,OAGF,GAAI,EAAiB,OAAS,QAAS,CACrC,IAAMC,EAAgE,EAAE,CAGnE,GACH,EAAmB,KAAK,OAAO,CAI5B,GACH,EAAmB,KAAK,MAAM,CAGhC,IAAM,EAAa,EAAK,EAAkB,EAAmB,CAIvDC,EAA2C,EAAE,CAEnD,OAAO,QAAQ,EAAW,QAAQ,CAAC,SAAS,CAAC,EAAsB,KAAuB,CAExF,GAAI,EAAqB,EAAsB,EAAe,CAC5D,OAGF,IAAMC,EAAkE,EAAE,CAGrE,GACH,EAAoB,KAAK,OAAO,CAGlC,EAAkB,GAAwB,EACxC,EACA,EACD,EACD,CAEF,EAAW,QAAU,EAErB,EAAO,GAAuB,EAE9B,UAEF,CAEK"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { c as StatsOptions } from "./extract2.mjs";
|
|
2
|
+
import { OutputOptions, Plugin } from "rollup";
|
|
3
|
+
|
|
4
|
+
//#region src/write.d.ts
|
|
5
|
+
type RollupStatsWriteResponse = {
|
|
6
|
+
filepath: string;
|
|
7
|
+
content: string;
|
|
8
|
+
};
|
|
9
|
+
type RollupStatsWrite = (filepath: string, stats: Record<string, unknown>) => RollupStatsWriteResponse;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/index.d.ts
|
|
12
|
+
type RollupStatsOptions = {
|
|
13
|
+
/**
|
|
14
|
+
* Output filename relative to Rollup output directory or absolute
|
|
15
|
+
* @default: stats.json
|
|
16
|
+
*/
|
|
17
|
+
fileName?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Rollup stats options
|
|
20
|
+
*/
|
|
21
|
+
stats?: StatsOptions;
|
|
22
|
+
/**
|
|
23
|
+
* Custom file writer
|
|
24
|
+
* @default - fs.write(FILENAME, JSON.stringify(STATS, null, 2));
|
|
25
|
+
*/
|
|
26
|
+
write?: RollupStatsWrite;
|
|
27
|
+
};
|
|
28
|
+
type RollupStatsOptionsOrOutputOptions = RollupStatsOptions | ((outputOptions: OutputOptions) => RollupStatsOptions);
|
|
29
|
+
declare function rollupStats(options?: RollupStatsOptionsOrOutputOptions): Plugin;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { RollupStatsOptions, rollupStats as default };
|
|
32
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./extract2.mjs";import t from"node:path";import n from"node:process";import r from"node:fs/promises";async function i(e,n){let i=JSON.stringify(n,null,2);return await r.mkdir(t.dirname(e),{recursive:!0}),await r.writeFile(e,i),{filepath:e,content:i}}function a(e,t=2){let n=10^t;return Math.round(e*n)/n}const o={BYTE:{symbol:`B`,multiplier:1},KILO:{symbol:`KiB`,multiplier:1024},MEGA:{symbol:`MiB`,multiplier:1024*1024}};function s(e){let t=o.BYTE;return typeof e==`number`?(t=e<o.KILO.multiplier?o.BYTE:e<o.MEGA.multiplier?o.KILO:o.MEGA,`${a(e/t.multiplier,2)}${t.symbol}`):`0${t.symbol}`}function c(r={}){return{name:`rollupStats`,async generateBundle(a,o){let{fileName:c,stats:l,write:u=i}=(typeof r==`function`?r(a):r)||{},d=c||`stats.json`,f=t.isAbsolute(d)?d:t.join(a.dir||n.cwd(),d),p=e(o,l);try{let e=await u(f,p),t=Buffer.byteLength(e.content,`utf-8`);this.info(`Stats saved to ${e.filepath} (${s(t)})`)}catch(e){this.warn(e)}}}}var l=c;export{l as default};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["error: any"],"sources":["../../src/write.ts","../../src/utils/round.ts","../../src/utils/format-file-size.ts","../../src/index.ts"],"sourcesContent":["import path from 'node:path';\nimport fs from 'node:fs/promises';\n\nexport type RollupStatsWriteResponse = {\n filepath: string;\n content: string;\n};\n\nexport type RollupStatsWrite = (\n filepath: string,\n stats: Record<string, unknown>\n) => RollupStatsWriteResponse;\n\nexport async function rollupStatsWrite<\n T extends Record<string, unknown> = Record<string, unknown>,\n>(filepath: string, stats: T): Promise<RollupStatsWriteResponse> {\n const content = JSON.stringify(stats, null, 2);\n\n // Create base directory if it does not exist\n await fs.mkdir(path.dirname(filepath), { recursive: true });\n\n await fs.writeFile(filepath, content);\n\n return {\n filepath,\n content,\n };\n}\n","export function round(value: number, precision = 2) {\n const multiplier = 10 ^ precision;\n return Math.round(value * multiplier) / multiplier; \n}\n","import { round } from './round';\n\nconst FILE_SIZE = {\n BYTE: {\n symbol: 'B',\n multiplier: 1,\n },\n KILO: {\n symbol: 'KiB',\n multiplier: 1024,\n },\n MEGA: {\n symbol: 'MiB',\n multiplier: 1024 * 1024,\n },\n}\n\nexport function formatFileSize(value?: number | null): string {\n let unit = FILE_SIZE.BYTE;\n\n if (typeof value !== 'number') {\n return `0${unit.symbol}`;\n }\n\n if (value < FILE_SIZE.KILO.multiplier) {\n unit = FILE_SIZE.BYTE;\n } else if (value < FILE_SIZE.MEGA.multiplier) {\n unit = FILE_SIZE.KILO;\n } else {\n unit = FILE_SIZE.MEGA;\n }\n\n return `${round(value / unit.multiplier, 2)}${unit.symbol}`;\n}\n","import path from 'node:path';\nimport process from 'node:process';\nimport type { Plugin, OutputOptions } from 'rollup';\n\nimport extractRollupStats, { type StatsOptions } from './extract';\nimport { type RollupStatsWrite, rollupStatsWrite } from './write';\nimport { formatFileSize } from './utils/format-file-size';\n\nconst PLUGIN_NAME = 'rollupStats';\nconst DEFAULT_FILE_NAME = 'stats.json';\n\nexport type RollupStatsOptions = {\n /**\n * Output filename relative to Rollup output directory or absolute\n * @default: stats.json\n */\n fileName?: string;\n /**\n * Rollup stats options\n */\n stats?: StatsOptions;\n /**\n * Custom file writer\n * @default - fs.write(FILENAME, JSON.stringify(STATS, null, 2));\n */\n write?: RollupStatsWrite;\n};\n\ntype RollupStatsOptionsOrOutputOptions =\n | RollupStatsOptions\n | ((outputOptions: OutputOptions) => RollupStatsOptions);\n\n\nfunction rollupStats(options: RollupStatsOptionsOrOutputOptions = {}): Plugin {\n return {\n name: PLUGIN_NAME,\n async generateBundle(context, bundle) {\n const resolvedOptions = typeof options === 'function' ? options(context) : options;\n const { fileName, stats: statsOptions, write = rollupStatsWrite } = resolvedOptions || {};\n\n const resolvedFileName = fileName || DEFAULT_FILE_NAME;\n const filepath = path.isAbsolute(resolvedFileName)\n ? resolvedFileName\n : path.join(context.dir || process.cwd(), resolvedFileName);\n\n const stats = extractRollupStats(bundle, statsOptions);\n\n try {\n const res = await write(filepath, stats);\n const outputSize = Buffer.byteLength(res.content, 'utf-8');\n\n this.info(`Stats saved to ${res.filepath} (${formatFileSize(outputSize)})`);\n } catch (error: any) { // eslint-disable-line\n // Log error, but do not throw to allow the compilation to continue\n this.warn(error);\n }\n },\n } satisfies Plugin;\n}\n\nexport default rollupStats;\n\n"],"mappings":"wHAaA,eAAsB,EAEpB,EAAkB,EAA6C,CAC/D,IAAM,EAAU,KAAK,UAAU,EAAO,KAAM,EAAE,CAO9C,OAJA,MAAM,EAAG,MAAM,EAAK,QAAQ,EAAS,CAAE,CAAE,UAAW,GAAM,CAAC,CAE3D,MAAM,EAAG,UAAU,EAAU,EAAQ,CA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version": "1.
|
|
4
|
+
"version": "1.6.0-beta.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
7
7
|
"repository": {
|
|
@@ -24,29 +24,29 @@
|
|
|
24
24
|
"stats",
|
|
25
25
|
"bundle-stats"
|
|
26
26
|
],
|
|
27
|
-
"main": "dist/index.
|
|
28
|
-
"module": "dist/index.mjs",
|
|
29
|
-
"typings": "dist/index.d.ts",
|
|
27
|
+
"main": "dist/cjs/index.js",
|
|
28
|
+
"module": "dist/esm/index.mjs",
|
|
29
|
+
"typings": "dist/esm/index.d.ts",
|
|
30
30
|
"files": [
|
|
31
31
|
"dist"
|
|
32
32
|
],
|
|
33
33
|
"exports": {
|
|
34
34
|
".": {
|
|
35
|
-
"types": "./dist/index.d.ts",
|
|
36
|
-
"import": "./dist/index.mjs",
|
|
37
|
-
"require": "./dist/index.
|
|
35
|
+
"types": "./dist/esm/index.d.ts",
|
|
36
|
+
"import": "./dist/esm/index.mjs",
|
|
37
|
+
"require": "./dist/cjs/index.js"
|
|
38
38
|
},
|
|
39
39
|
"./extract": {
|
|
40
|
-
"types": "./dist/extract.d.ts",
|
|
41
|
-
"import": "./dist/extract.mjs",
|
|
42
|
-
"require": "./dist/extract.
|
|
40
|
+
"types": "./dist/esm/extract.d.ts",
|
|
41
|
+
"import": "./dist/esm/extract.mjs",
|
|
42
|
+
"require": "./dist/cjs/extract.js"
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=18"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
|
-
"build": "
|
|
49
|
+
"build": "tsdown",
|
|
50
50
|
"lint": "eslint .",
|
|
51
51
|
"format": "prettier --write .",
|
|
52
52
|
"test:unit": "vitest test/unit",
|
|
@@ -63,22 +63,21 @@
|
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@eslint/js": "9.39.
|
|
67
|
-
"@release-it/conventional-changelog": "10.0.
|
|
68
|
-
"@rollup/plugin-typescript": "12.3.0",
|
|
66
|
+
"@eslint/js": "9.39.2",
|
|
67
|
+
"@release-it/conventional-changelog": "10.0.4",
|
|
69
68
|
"@tsconfig/node18": "18.2.6",
|
|
70
|
-
"@types/node": "
|
|
69
|
+
"@types/node": "25.0.3",
|
|
71
70
|
"deep-freeze-strict": "1.1.1",
|
|
72
|
-
"eslint": "9.39.
|
|
73
|
-
"globals": "
|
|
71
|
+
"eslint": "9.39.2",
|
|
72
|
+
"globals": "17.0.0",
|
|
74
73
|
"husky": "8.0.3",
|
|
75
|
-
"memfs": "4.51.
|
|
76
|
-
"prettier": "3.
|
|
77
|
-
"release-it": "19.
|
|
78
|
-
"
|
|
74
|
+
"memfs": "4.51.1",
|
|
75
|
+
"prettier": "3.7.4",
|
|
76
|
+
"release-it": "19.2.2",
|
|
77
|
+
"tsdown": "0.18.4",
|
|
79
78
|
"typescript": "5.9.3",
|
|
80
|
-
"typescript-eslint": "8.
|
|
81
|
-
"vitest": "4.0.
|
|
79
|
+
"typescript-eslint": "8.51.0",
|
|
80
|
+
"vitest": "4.0.16"
|
|
82
81
|
},
|
|
83
82
|
"peerDependencies": {
|
|
84
83
|
"rolldown": "^1.0.0-beta.0",
|
package/dist/extract.cjs
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function omit(data, keys) {
|
|
4
|
-
const result = {};
|
|
5
|
-
const objectKeys = Object.keys(data);
|
|
6
|
-
objectKeys.forEach((key) => {
|
|
7
|
-
if (!keys.includes(key)) {
|
|
8
|
-
result[key] = data[key];
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
return result;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Check if filepath should be excluded based on patterns
|
|
16
|
-
*/
|
|
17
|
-
function checkExcludeFilepath(filepath, patterns) {
|
|
18
|
-
if (!patterns) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
if (Array.isArray(patterns)) {
|
|
22
|
-
let res = false;
|
|
23
|
-
for (let i = 0; i <= patterns.length - 1 && res === false; i++) {
|
|
24
|
-
res = checkExcludeFilepath(filepath, patterns[i]);
|
|
25
|
-
}
|
|
26
|
-
return res;
|
|
27
|
-
}
|
|
28
|
-
if (typeof patterns === 'function') {
|
|
29
|
-
return patterns(filepath);
|
|
30
|
-
}
|
|
31
|
-
if (typeof patterns === 'string') {
|
|
32
|
-
return Boolean(filepath.match(patterns));
|
|
33
|
-
}
|
|
34
|
-
if ('test' in patterns) {
|
|
35
|
-
return patterns.test(filepath);
|
|
36
|
-
}
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Extract bundler stats
|
|
42
|
-
*
|
|
43
|
-
* Shallow clone stats object before any processing using `omit` to
|
|
44
|
-
* 1. resolve getters
|
|
45
|
-
* 2. prevent changes to the stats object
|
|
46
|
-
*
|
|
47
|
-
* @NOTE structuredClone is not supported by rolldown-vite: https://github.com/vitejs/rolldown-vite/issues/128
|
|
48
|
-
*/
|
|
49
|
-
function extractRollupStats(bundle, options = {}) {
|
|
50
|
-
const { source = false, map = false, excludeAssets, excludeModules } = options;
|
|
51
|
-
const output = {};
|
|
52
|
-
Object.entries(bundle).forEach(([bundleEntryFilepath, bundleEntryStats]) => {
|
|
53
|
-
// Skip extraction if the entry filepath matches the exclude assets pattern
|
|
54
|
-
if (checkExcludeFilepath(bundleEntryFilepath, excludeAssets)) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (bundleEntryStats.type === "asset") {
|
|
58
|
-
const assetStatsOmitKeys = [];
|
|
59
|
-
// Skip asset source if options.source is false
|
|
60
|
-
if (!source) {
|
|
61
|
-
assetStatsOmitKeys.push('source');
|
|
62
|
-
}
|
|
63
|
-
output[bundleEntryFilepath] = omit(bundleEntryStats, assetStatsOmitKeys);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (bundleEntryStats.type === "chunk") {
|
|
67
|
-
const chunkStatsOmitKeys = [];
|
|
68
|
-
// Skip chunk source if options.source is false
|
|
69
|
-
if (!source) {
|
|
70
|
-
chunkStatsOmitKeys.push('code');
|
|
71
|
-
}
|
|
72
|
-
// Skip chunk map if options.map is false
|
|
73
|
-
if (!map) {
|
|
74
|
-
chunkStatsOmitKeys.push('map');
|
|
75
|
-
}
|
|
76
|
-
const chunkStats = omit(bundleEntryStats, chunkStatsOmitKeys);
|
|
77
|
-
// Extract chunk modules stats
|
|
78
|
-
const chunkModulesStats = {};
|
|
79
|
-
Object.entries(chunkStats.modules).forEach(([bundleModuleFilepath, bundleModuleStats]) => {
|
|
80
|
-
// Skip module extraction if the filepath matches the exclude modules pattern
|
|
81
|
-
if (checkExcludeFilepath(bundleModuleFilepath, excludeModules)) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
const moduleStatsOmitKeys = [];
|
|
85
|
-
// Skip module source if options.source is false
|
|
86
|
-
if (!source) {
|
|
87
|
-
moduleStatsOmitKeys.push('code');
|
|
88
|
-
}
|
|
89
|
-
chunkModulesStats[bundleModuleFilepath] = omit(bundleModuleStats, moduleStatsOmitKeys);
|
|
90
|
-
});
|
|
91
|
-
chunkStats.modules = chunkModulesStats;
|
|
92
|
-
output[bundleEntryFilepath] = chunkStats;
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
return output;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
module.exports = extractRollupStats;
|
|
100
|
-
//# sourceMappingURL=extract.cjs.map
|
package/dist/extract.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract.cjs","sources":["../src/utils/omit.ts","../src/utils/check-exclude-filepath.ts","../src/extract.ts"],"sourcesContent":[null,null,null],"names":[],"mappings":";;AAAM,SAAU,IAAI,CAClB,IAAO,EACP,IAAS,EAAA;IAET,MAAM,MAAM,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X,oBAAA,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC;gBAClC;gBAEA,iBAAiB,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAC5C,iBAAiB,EACjB,mBAAmB,CACL;AAClB,YAAA,CAAC,CAAC;AAEF,YAAA,UAAU,CAAC,OAAO,GAAG,iBAAiB;AAEtC,YAAA,MAAM,CAAC,mBAAmB,CAAC,GAAG,UAAU;YAExC;QACF;AACF,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,MAAM;AACf;;;;"}
|
package/dist/extract.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { OutputAsset, OutputBundle, OutputChunk, RenderedModule } from 'rollup';
|
|
2
|
-
import { type ExcludeFilepathPatterns } from './utils/check-exclude-filepath';
|
|
3
|
-
export type AssetStatsOptionalProperties = {
|
|
4
|
-
source?: OutputAsset['source'];
|
|
5
|
-
};
|
|
6
|
-
export type AssetStats = Omit<OutputAsset, keyof AssetStatsOptionalProperties> & AssetStatsOptionalProperties;
|
|
7
|
-
export type ModuleStatsOptionalProperties = {
|
|
8
|
-
code?: RenderedModule['code'] | null;
|
|
9
|
-
};
|
|
10
|
-
export type ModuleStats = Omit<RenderedModule, keyof ModuleStatsOptionalProperties> & ModuleStatsOptionalProperties;
|
|
11
|
-
export type ChunkStatsOptionalProperties = {
|
|
12
|
-
code?: OutputChunk['code'];
|
|
13
|
-
map?: OutputChunk['map'];
|
|
14
|
-
};
|
|
15
|
-
export type ChunkStats = Omit<OutputChunk, keyof ChunkStatsOptionalProperties | 'modules'> & {
|
|
16
|
-
modules: Record<string, ModuleStats>;
|
|
17
|
-
} & ChunkStatsOptionalProperties;
|
|
18
|
-
export type Stats = Record<string, AssetStats | ChunkStats>;
|
|
19
|
-
export type StatsOptions = {
|
|
20
|
-
/**
|
|
21
|
-
* Output asset/module sources
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
|
-
source?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Output chunk map
|
|
27
|
-
* @default false
|
|
28
|
-
*/
|
|
29
|
-
map?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Exclude matching assets
|
|
32
|
-
*/
|
|
33
|
-
excludeAssets?: ExcludeFilepathPatterns;
|
|
34
|
-
/**
|
|
35
|
-
* Exclude matching modules
|
|
36
|
-
*/
|
|
37
|
-
excludeModules?: ExcludeFilepathPatterns;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Extract bundler stats
|
|
41
|
-
*
|
|
42
|
-
* Shallow clone stats object before any processing using `omit` to
|
|
43
|
-
* 1. resolve getters
|
|
44
|
-
* 2. prevent changes to the stats object
|
|
45
|
-
*
|
|
46
|
-
* @NOTE structuredClone is not supported by rolldown-vite: https://github.com/vitejs/rolldown-vite/issues/128
|
|
47
|
-
*/
|
|
48
|
-
export default function extractRollupStats(bundle: OutputBundle, options?: StatsOptions): Stats;
|
package/dist/extract.mjs
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
function omit(data, keys) {
|
|
2
|
-
const result = {};
|
|
3
|
-
const objectKeys = Object.keys(data);
|
|
4
|
-
objectKeys.forEach((key) => {
|
|
5
|
-
if (!keys.includes(key)) {
|
|
6
|
-
result[key] = data[key];
|
|
7
|
-
}
|
|
8
|
-
});
|
|
9
|
-
return result;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Check if filepath should be excluded based on patterns
|
|
14
|
-
*/
|
|
15
|
-
function checkExcludeFilepath(filepath, patterns) {
|
|
16
|
-
if (!patterns) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
if (Array.isArray(patterns)) {
|
|
20
|
-
let res = false;
|
|
21
|
-
for (let i = 0; i <= patterns.length - 1 && res === false; i++) {
|
|
22
|
-
res = checkExcludeFilepath(filepath, patterns[i]);
|
|
23
|
-
}
|
|
24
|
-
return res;
|
|
25
|
-
}
|
|
26
|
-
if (typeof patterns === 'function') {
|
|
27
|
-
return patterns(filepath);
|
|
28
|
-
}
|
|
29
|
-
if (typeof patterns === 'string') {
|
|
30
|
-
return Boolean(filepath.match(patterns));
|
|
31
|
-
}
|
|
32
|
-
if ('test' in patterns) {
|
|
33
|
-
return patterns.test(filepath);
|
|
34
|
-
}
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Extract bundler stats
|
|
40
|
-
*
|
|
41
|
-
* Shallow clone stats object before any processing using `omit` to
|
|
42
|
-
* 1. resolve getters
|
|
43
|
-
* 2. prevent changes to the stats object
|
|
44
|
-
*
|
|
45
|
-
* @NOTE structuredClone is not supported by rolldown-vite: https://github.com/vitejs/rolldown-vite/issues/128
|
|
46
|
-
*/
|
|
47
|
-
function extractRollupStats(bundle, options = {}) {
|
|
48
|
-
const { source = false, map = false, excludeAssets, excludeModules } = options;
|
|
49
|
-
const output = {};
|
|
50
|
-
Object.entries(bundle).forEach(([bundleEntryFilepath, bundleEntryStats]) => {
|
|
51
|
-
// Skip extraction if the entry filepath matches the exclude assets pattern
|
|
52
|
-
if (checkExcludeFilepath(bundleEntryFilepath, excludeAssets)) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (bundleEntryStats.type === "asset") {
|
|
56
|
-
const assetStatsOmitKeys = [];
|
|
57
|
-
// Skip asset source if options.source is false
|
|
58
|
-
if (!source) {
|
|
59
|
-
assetStatsOmitKeys.push('source');
|
|
60
|
-
}
|
|
61
|
-
output[bundleEntryFilepath] = omit(bundleEntryStats, assetStatsOmitKeys);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (bundleEntryStats.type === "chunk") {
|
|
65
|
-
const chunkStatsOmitKeys = [];
|
|
66
|
-
// Skip chunk source if options.source is false
|
|
67
|
-
if (!source) {
|
|
68
|
-
chunkStatsOmitKeys.push('code');
|
|
69
|
-
}
|
|
70
|
-
// Skip chunk map if options.map is false
|
|
71
|
-
if (!map) {
|
|
72
|
-
chunkStatsOmitKeys.push('map');
|
|
73
|
-
}
|
|
74
|
-
const chunkStats = omit(bundleEntryStats, chunkStatsOmitKeys);
|
|
75
|
-
// Extract chunk modules stats
|
|
76
|
-
const chunkModulesStats = {};
|
|
77
|
-
Object.entries(chunkStats.modules).forEach(([bundleModuleFilepath, bundleModuleStats]) => {
|
|
78
|
-
// Skip module extraction if the filepath matches the exclude modules pattern
|
|
79
|
-
if (checkExcludeFilepath(bundleModuleFilepath, excludeModules)) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
const moduleStatsOmitKeys = [];
|
|
83
|
-
// Skip module source if options.source is false
|
|
84
|
-
if (!source) {
|
|
85
|
-
moduleStatsOmitKeys.push('code');
|
|
86
|
-
}
|
|
87
|
-
chunkModulesStats[bundleModuleFilepath] = omit(bundleModuleStats, moduleStatsOmitKeys);
|
|
88
|
-
});
|
|
89
|
-
chunkStats.modules = chunkModulesStats;
|
|
90
|
-
output[bundleEntryFilepath] = chunkStats;
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
return output;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export { extractRollupStats as default };
|
|
98
|
-
//# sourceMappingURL=extract.mjs.map
|
package/dist/extract.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract.mjs","sources":["../src/utils/omit.ts","../src/utils/check-exclude-filepath.ts","../src/extract.ts"],"sourcesContent":[null,null,null],"names":[],"mappings":"AAAM,SAAU,IAAI,CAClB,IAAO,EACP,IAAS,EAAA;IAET,MAAM,MAAM,GAAG,EAAO;IACtB,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAa;AAEhD,IAAA,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,KAAI;QACzB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACvB,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAA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CAAC,GAAG,UAAU;YAExC;QACF;AACF,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,MAAM;AACf;;;;"}
|
package/dist/index.cjs
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var path = require('node:path');
|
|
4
|
-
var process = require('node:process');
|
|
5
|
-
var extract = require('./extract.cjs');
|
|
6
|
-
var fs = require('node:fs/promises');
|
|
7
|
-
|
|
8
|
-
async function rollupStatsWrite(filepath, stats) {
|
|
9
|
-
const content = JSON.stringify(stats, null, 2);
|
|
10
|
-
// Create base directory if it does not exist
|
|
11
|
-
await fs.mkdir(path.dirname(filepath), { recursive: true });
|
|
12
|
-
await fs.writeFile(filepath, content);
|
|
13
|
-
return {
|
|
14
|
-
filepath,
|
|
15
|
-
content,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function round(value, precision = 2) {
|
|
20
|
-
const multiplier = 10 ^ precision;
|
|
21
|
-
return Math.round(value * multiplier) / multiplier;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const FILE_SIZE = {
|
|
25
|
-
BYTE: {
|
|
26
|
-
symbol: 'B',
|
|
27
|
-
multiplier: 1,
|
|
28
|
-
},
|
|
29
|
-
KILO: {
|
|
30
|
-
symbol: 'KiB',
|
|
31
|
-
multiplier: 1024,
|
|
32
|
-
},
|
|
33
|
-
MEGA: {
|
|
34
|
-
symbol: 'MiB',
|
|
35
|
-
multiplier: 1024 * 1024,
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
function formatFileSize(value) {
|
|
39
|
-
let unit = FILE_SIZE.BYTE;
|
|
40
|
-
if (typeof value !== 'number') {
|
|
41
|
-
return `0${unit.symbol}`;
|
|
42
|
-
}
|
|
43
|
-
if (value < FILE_SIZE.KILO.multiplier) {
|
|
44
|
-
unit = FILE_SIZE.BYTE;
|
|
45
|
-
}
|
|
46
|
-
else if (value < FILE_SIZE.MEGA.multiplier) {
|
|
47
|
-
unit = FILE_SIZE.KILO;
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
unit = FILE_SIZE.MEGA;
|
|
51
|
-
}
|
|
52
|
-
return `${round(value / unit.multiplier, 2)}${unit.symbol}`;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const PLUGIN_NAME = 'rollupStats';
|
|
56
|
-
const DEFAULT_FILE_NAME = 'stats.json';
|
|
57
|
-
function rollupStats(options = {}) {
|
|
58
|
-
return {
|
|
59
|
-
name: PLUGIN_NAME,
|
|
60
|
-
async generateBundle(context, bundle) {
|
|
61
|
-
const resolvedOptions = typeof options === 'function' ? options(context) : options;
|
|
62
|
-
const { fileName, stats: statsOptions, write = rollupStatsWrite } = resolvedOptions || {};
|
|
63
|
-
const resolvedFileName = fileName || DEFAULT_FILE_NAME;
|
|
64
|
-
const filepath = path.isAbsolute(resolvedFileName)
|
|
65
|
-
? resolvedFileName
|
|
66
|
-
: path.join(context.dir || process.cwd(), resolvedFileName);
|
|
67
|
-
const stats = extract(bundle, statsOptions);
|
|
68
|
-
try {
|
|
69
|
-
const res = await write(filepath, stats);
|
|
70
|
-
const outputSize = Buffer.byteLength(res.content, 'utf-8');
|
|
71
|
-
this.info(`Stats saved to ${res.filepath} (${formatFileSize(outputSize)})`);
|
|
72
|
-
}
|
|
73
|
-
catch (error) { // eslint-disable-line
|
|
74
|
-
// Log error, but do not throw to allow the compilation to continue
|
|
75
|
-
this.warn(error);
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
module.exports = rollupStats;
|
|
82
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/write.ts","../src/utils/round.ts","../src/utils/format-file-size.ts","../src/index.ts"],"sourcesContent":[null,null,null,null],"names":["extractRollupStats"],"mappings":";;;;;;;AAaO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,EAAK,cAAc,CAAC,UAAU,CAAC,CAAA,CAAA,CAAG,CAAC;YAC7E;AAAE,YAAA,OAAO,KAAU,EAAE;;AAEnB,gBAAA,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;YAClB;QACF,CAAC;KACe;AACpB;;;;"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Plugin, OutputOptions } from 'rollup';
|
|
2
|
-
import { type StatsOptions } from './extract';
|
|
3
|
-
import { type RollupStatsWrite } from './write';
|
|
4
|
-
export type RollupStatsOptions = {
|
|
5
|
-
/**
|
|
6
|
-
* Output filename relative to Rollup output directory or absolute
|
|
7
|
-
* @default: stats.json
|
|
8
|
-
*/
|
|
9
|
-
fileName?: string;
|
|
10
|
-
/**
|
|
11
|
-
* Rollup stats options
|
|
12
|
-
*/
|
|
13
|
-
stats?: StatsOptions;
|
|
14
|
-
/**
|
|
15
|
-
* Custom file writer
|
|
16
|
-
* @default - fs.write(FILENAME, JSON.stringify(STATS, null, 2));
|
|
17
|
-
*/
|
|
18
|
-
write?: RollupStatsWrite;
|
|
19
|
-
};
|
|
20
|
-
type RollupStatsOptionsOrOutputOptions = RollupStatsOptions | ((outputOptions: OutputOptions) => RollupStatsOptions);
|
|
21
|
-
declare function rollupStats(options?: RollupStatsOptionsOrOutputOptions): Plugin;
|
|
22
|
-
export default rollupStats;
|
package/dist/index.mjs
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import process from 'node:process';
|
|
3
|
-
import extractRollupStats from './extract.mjs';
|
|
4
|
-
import fs from 'node:fs/promises';
|
|
5
|
-
|
|
6
|
-
async function rollupStatsWrite(filepath, stats) {
|
|
7
|
-
const content = JSON.stringify(stats, null, 2);
|
|
8
|
-
// Create base directory if it does not exist
|
|
9
|
-
await fs.mkdir(path.dirname(filepath), { recursive: true });
|
|
10
|
-
await fs.writeFile(filepath, content);
|
|
11
|
-
return {
|
|
12
|
-
filepath,
|
|
13
|
-
content,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function round(value, precision = 2) {
|
|
18
|
-
const multiplier = 10 ^ precision;
|
|
19
|
-
return Math.round(value * multiplier) / multiplier;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const FILE_SIZE = {
|
|
23
|
-
BYTE: {
|
|
24
|
-
symbol: 'B',
|
|
25
|
-
multiplier: 1,
|
|
26
|
-
},
|
|
27
|
-
KILO: {
|
|
28
|
-
symbol: 'KiB',
|
|
29
|
-
multiplier: 1024,
|
|
30
|
-
},
|
|
31
|
-
MEGA: {
|
|
32
|
-
symbol: 'MiB',
|
|
33
|
-
multiplier: 1024 * 1024,
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
function formatFileSize(value) {
|
|
37
|
-
let unit = FILE_SIZE.BYTE;
|
|
38
|
-
if (typeof value !== 'number') {
|
|
39
|
-
return `0${unit.symbol}`;
|
|
40
|
-
}
|
|
41
|
-
if (value < FILE_SIZE.KILO.multiplier) {
|
|
42
|
-
unit = FILE_SIZE.BYTE;
|
|
43
|
-
}
|
|
44
|
-
else if (value < FILE_SIZE.MEGA.multiplier) {
|
|
45
|
-
unit = FILE_SIZE.KILO;
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
unit = FILE_SIZE.MEGA;
|
|
49
|
-
}
|
|
50
|
-
return `${round(value / unit.multiplier, 2)}${unit.symbol}`;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const PLUGIN_NAME = 'rollupStats';
|
|
54
|
-
const DEFAULT_FILE_NAME = 'stats.json';
|
|
55
|
-
function rollupStats(options = {}) {
|
|
56
|
-
return {
|
|
57
|
-
name: PLUGIN_NAME,
|
|
58
|
-
async generateBundle(context, bundle) {
|
|
59
|
-
const resolvedOptions = typeof options === 'function' ? options(context) : options;
|
|
60
|
-
const { fileName, stats: statsOptions, write = rollupStatsWrite } = resolvedOptions || {};
|
|
61
|
-
const resolvedFileName = fileName || DEFAULT_FILE_NAME;
|
|
62
|
-
const filepath = path.isAbsolute(resolvedFileName)
|
|
63
|
-
? resolvedFileName
|
|
64
|
-
: path.join(context.dir || process.cwd(), resolvedFileName);
|
|
65
|
-
const stats = extractRollupStats(bundle, statsOptions);
|
|
66
|
-
try {
|
|
67
|
-
const res = await write(filepath, stats);
|
|
68
|
-
const outputSize = Buffer.byteLength(res.content, 'utf-8');
|
|
69
|
-
this.info(`Stats saved to ${res.filepath} (${formatFileSize(outputSize)})`);
|
|
70
|
-
}
|
|
71
|
-
catch (error) { // eslint-disable-line
|
|
72
|
-
// Log error, but do not throw to allow the compilation to continue
|
|
73
|
-
this.warn(error);
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export { rollupStats as default };
|
|
80
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/write.ts","../src/utils/round.ts","../src/utils/format-file-size.ts","../src/index.ts"],"sourcesContent":[null,null,null,null],"names":[],"mappings":";;;;;AAaO,eAAe,gBAAgB,CAEpC,QAAgB,EAAE,KAAQ,EAAA;AAC1B,IAAA,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;;AAG9C,IAAA,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAE3D,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC;IAErC,OAAO;QACL,QAAQ;QACR,OAAO;KACR;AACH;;SC3BgB,KAAK,CAAC,KAAa,EAAE,SAAS,GAAG,CAAC,EAAA;AAChD,IAAA,MAAM,UAAU,GAAG,EAAE,GAAG,SAAS;IACjC,OAAO,IAAI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AO,KAAK,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO;AAClF,YAAA,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,GAAG,gBAAgB,EAAE,GAAG,eAAe,IAAI,EAAE;AAEzF,YAAA,MAAM,gBAAgB,GAAG,QAAQ,IAAI,iBAAiB;AACtD,YAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,gBAAgB;AAC/C,kBAAE;AACF,kBAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,gBAAgB,CAAC;YAE7D,MAAM,KAAK,GAAG,kBAAkB,CAAC,MAAM,EAAE,YAAY,CAAC;AAEtD,YAAA,IAAI;gBACF,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC;AACxC,gBAAA,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC;AAE1D,gBAAA,IAAI,CAAC,IAAI,CAAC,CAAA,eAAA,EAAkB,GAAG,CAAC,QAAQ,CAAA,EAAA,EAAK,cAAc,CAAC,UAAU,CAAC,CAAA,CAAA,CAAG,CAAC;YAC7E;AAAE,YAAA,OAAO,KAAU,EAAE;;AAEnB,gBAAA,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;YAClB;QACF,CAAC;KACe;AACpB;;;;"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
type ExcludeFilepathParam = string | RegExp | ((filepath: string) => boolean);
|
|
2
|
-
export type ExcludeFilepathPatterns = ExcludeFilepathParam | Array<ExcludeFilepathParam>;
|
|
3
|
-
/**
|
|
4
|
-
* Check if filepath should be excluded based on patterns
|
|
5
|
-
*/
|
|
6
|
-
export declare function checkExcludeFilepath(filepath: string, patterns?: ExcludeFilepathPatterns): boolean;
|
|
7
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function formatFileSize(value?: number | null): string;
|
package/dist/utils/omit.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function omit<D extends object, K extends keyof D = keyof D>(data: D, keys: K[]): Omit<D, K>;
|
package/dist/utils/round.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function round(value: number, precision?: number): number;
|
package/dist/write.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export type RollupStatsWriteResponse = {
|
|
2
|
-
filepath: string;
|
|
3
|
-
content: string;
|
|
4
|
-
};
|
|
5
|
-
export type RollupStatsWrite = (filepath: string, stats: Record<string, unknown>) => RollupStatsWriteResponse;
|
|
6
|
-
export declare function rollupStatsWrite<T extends Record<string, unknown> = Record<string, unknown>>(filepath: string, stats: T): Promise<RollupStatsWriteResponse>;
|