rollup-plugin-stats 2.1.0 → 2.1.1-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/extract.cjs.map +1 -1
- package/dist/extract.d.cts +1 -1
- package/dist/extract.d.cts.map +1 -1
- package/dist/extract.d.mts +1 -1
- package/dist/extract.d.mts.map +1 -1
- package/dist/extract.mjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/src/types.d.cts +140 -6
- package/dist/src/types.d.cts.map +1 -1
- package/dist/src/types.d.mts +140 -6
- package/dist/src/types.d.mts.map +1 -1
- package/package.json +1 -3
package/dist/extract.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.cjs","names":["checkExcludeFilepath","omit"],"sources":["../src/extract.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"extract.cjs","names":["checkExcludeFilepath","omit"],"sources":["../src/extract.ts"],"sourcesContent":["import { omit } from './utils/omit';\n\nimport {\n type ExcludeFilepathPatterns,\n checkExcludeFilepath,\n} from './utils/check-exclude-filepath';\nimport type {\n OutputAsset,\n OutputBundle,\n OutputChunk,\n RenderedModule,\n} from './types';\n\nexport type AssetStatsOptionalProperties = {\n source?: OutputAsset['source'];\n};\n\nexport type AssetStats = Omit<OutputAsset, keyof AssetStatsOptionalProperties> &\n AssetStatsOptionalProperties;\n\nexport type ModuleStatsOptionalProperties = {\n code?: RenderedModule['code'] | null;\n};\n\nexport type ModuleStats = Omit<\n RenderedModule,\n keyof ModuleStatsOptionalProperties\n> &\n ModuleStatsOptionalProperties;\n\nexport type ChunkStatsOptionalProperties = {\n code?: OutputChunk['code'];\n map?: OutputChunk['map'];\n};\n\nexport type ChunkStats = Omit<\n OutputChunk,\n keyof ChunkStatsOptionalProperties | 'modules'\n> & {\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(\n bundle: OutputBundle,\n options: StatsOptions = {}\n): Stats {\n const {\n source = false,\n map = false,\n excludeAssets,\n excludeModules,\n } = 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(\n bundleEntryStats,\n chunkStatsOmitKeys\n ) as ChunkStats;\n\n // Extract chunk modules stats\n const chunkModulesStats: ChunkStats['modules'] = {};\n\n Object.entries(chunkStats.modules).forEach(\n ([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<\n keyof ModuleStatsOptionalProperties\n > = [];\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\n chunkStats.modules = chunkModulesStats;\n\n output[bundleEntryFilepath] = chunkStats;\n\n return;\n }\n });\n\n return output;\n}\n"],"mappings":";;;;;;;;;;;;;AA0EA,SAAwB,mBACtB,QACA,UAAwB,EAAE,EACnB;CACP,MAAM,EACJ,SAAS,OACT,MAAM,OACN,eACA,mBACE;CAEJ,MAAM,SAAgB,EAAE;AAExB,QAAO,QAAQ,OAAO,CAAC,SAAS,CAAC,qBAAqB,sBAAsB;AAE1E,MAAIA,oDAAqB,qBAAqB,cAAc,CAC1D;AAGF,MAAI,iBAAiB,SAAS,SAAS;GACrC,MAAM,qBAAgE,EAAE;AAGxE,OAAI,CAAC,OACH,oBAAmB,KAAK,SAAS;AAGnC,UAAO,uBAAuBC,kBAC5B,kBACA,mBACD;AAED;;AAGF,MAAI,iBAAiB,SAAS,SAAS;GACrC,MAAM,qBAAgE,EAAE;AAGxE,OAAI,CAAC,OACH,oBAAmB,KAAK,OAAO;AAIjC,OAAI,CAAC,IACH,oBAAmB,KAAK,MAAM;GAGhC,MAAM,aAAaA,kBACjB,kBACA,mBACD;GAGD,MAAM,oBAA2C,EAAE;AAEnD,UAAO,QAAQ,WAAW,QAAQ,CAAC,SAChC,CAAC,sBAAsB,uBAAuB;AAE7C,QAAID,oDAAqB,sBAAsB,eAAe,CAC5D;IAGF,MAAM,sBAEF,EAAE;AAGN,QAAI,CAAC,OACH,qBAAoB,KAAK,OAAO;AAGlC,sBAAkB,wBAAwBC,kBACxC,mBACA,oBACD;KAEJ;AAED,cAAW,UAAU;AAErB,UAAO,uBAAuB;AAE9B;;GAEF;AAEF,QAAO"}
|
package/dist/extract.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExcludeFilepathPatterns } from "./src/utils/check-exclude-filepath.cjs";
|
|
2
|
-
import { OutputAsset, OutputBundle, OutputChunk, RenderedModule } from "
|
|
2
|
+
import { OutputAsset, OutputBundle, OutputChunk, RenderedModule } from "./src/types.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/extract.d.ts
|
|
5
5
|
type AssetStatsOptionalProperties = {
|
package/dist/extract.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.cts","names":[],"sources":["../src/extract.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"extract.d.cts","names":[],"sources":["../src/extract.ts"],"mappings":";;;;KAaY,4BAAA;EACV,MAAA,GAAS,WAAA;AAAA;AAAA,KAGC,UAAA,GAAa,IAAA,CAAK,WAAA,QAAmB,4BAAA,IAC/C,4BAAA;AAAA,KAEU,6BAAA;EACV,IAAA,GAAO,cAAA;AAAA;AAAA,KAGG,WAAA,GAAc,IAAA,CACxB,cAAA,QACM,6BAAA,IAEN,6BAAA;AAAA,KAEU,4BAAA;EACV,IAAA,GAAO,WAAA;EACP,GAAA,GAAM,WAAA;AAAA;AAAA,KAGI,UAAA,GAAa,IAAA,CACvB,WAAA,QACM,4BAAA;EAEN,OAAA,EAAS,MAAA,SAAe,WAAA;AAAA,IACtB,4BAAA;AAAA,KAEQ,KAAA,GAAQ,MAAA,SAAe,UAAA,GAAa,UAAA;AAAA,KAEpC,YAAA;EA3BkB;;;;EAgC5B,MAAA;EA7BU;;;;EAkCV,GAAA;EA9BU;;;EAkCV,aAAA,GAAgB,uBAAA;EAhCV;;;EAoCN,cAAA,GAAiB,uBAAA;AAAA;;;;;;;AAhCnB;;;iBA4CwB,kBAAA,CACtB,MAAA,EAAQ,YAAA,EACR,OAAA,GAAS,YAAA,GACR,KAAA"}
|
package/dist/extract.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExcludeFilepathPatterns } from "./src/utils/check-exclude-filepath.mjs";
|
|
2
|
-
import { OutputAsset, OutputBundle, OutputChunk, RenderedModule } from "
|
|
2
|
+
import { OutputAsset, OutputBundle, OutputChunk, RenderedModule } from "./src/types.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/extract.d.ts
|
|
5
5
|
type AssetStatsOptionalProperties = {
|
package/dist/extract.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.mts","names":[],"sources":["../src/extract.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"extract.d.mts","names":[],"sources":["../src/extract.ts"],"mappings":";;;;KAaY,4BAAA;EACV,MAAA,GAAS,WAAA;AAAA;AAAA,KAGC,UAAA,GAAa,IAAA,CAAK,WAAA,QAAmB,4BAAA,IAC/C,4BAAA;AAAA,KAEU,6BAAA;EACV,IAAA,GAAO,cAAA;AAAA;AAAA,KAGG,WAAA,GAAc,IAAA,CACxB,cAAA,QACM,6BAAA,IAEN,6BAAA;AAAA,KAEU,4BAAA;EACV,IAAA,GAAO,WAAA;EACP,GAAA,GAAM,WAAA;AAAA;AAAA,KAGI,UAAA,GAAa,IAAA,CACvB,WAAA,QACM,4BAAA;EAEN,OAAA,EAAS,MAAA,SAAe,WAAA;AAAA,IACtB,4BAAA;AAAA,KAEQ,KAAA,GAAQ,MAAA,SAAe,UAAA,GAAa,UAAA;AAAA,KAEpC,YAAA;EA3BkB;;;;EAgC5B,MAAA;EA7BU;;;;EAkCV,GAAA;EA9BU;;;EAkCV,aAAA,GAAgB,uBAAA;EAhCV;;;EAoCN,cAAA,GAAiB,uBAAA;AAAA;;;;;;;AAhCnB;;;iBA4CwB,kBAAA,CACtB,MAAA,EAAQ,YAAA,EACR,OAAA,GAAS,YAAA,GACR,KAAA"}
|
package/dist/extract.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.mjs","names":[],"sources":["../src/extract.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"extract.mjs","names":[],"sources":["../src/extract.ts"],"sourcesContent":["import { omit } from './utils/omit';\n\nimport {\n type ExcludeFilepathPatterns,\n checkExcludeFilepath,\n} from './utils/check-exclude-filepath';\nimport type {\n OutputAsset,\n OutputBundle,\n OutputChunk,\n RenderedModule,\n} from './types';\n\nexport type AssetStatsOptionalProperties = {\n source?: OutputAsset['source'];\n};\n\nexport type AssetStats = Omit<OutputAsset, keyof AssetStatsOptionalProperties> &\n AssetStatsOptionalProperties;\n\nexport type ModuleStatsOptionalProperties = {\n code?: RenderedModule['code'] | null;\n};\n\nexport type ModuleStats = Omit<\n RenderedModule,\n keyof ModuleStatsOptionalProperties\n> &\n ModuleStatsOptionalProperties;\n\nexport type ChunkStatsOptionalProperties = {\n code?: OutputChunk['code'];\n map?: OutputChunk['map'];\n};\n\nexport type ChunkStats = Omit<\n OutputChunk,\n keyof ChunkStatsOptionalProperties | 'modules'\n> & {\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(\n bundle: OutputBundle,\n options: StatsOptions = {}\n): Stats {\n const {\n source = false,\n map = false,\n excludeAssets,\n excludeModules,\n } = 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(\n bundleEntryStats,\n chunkStatsOmitKeys\n ) as ChunkStats;\n\n // Extract chunk modules stats\n const chunkModulesStats: ChunkStats['modules'] = {};\n\n Object.entries(chunkStats.modules).forEach(\n ([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<\n keyof ModuleStatsOptionalProperties\n > = [];\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\n chunkStats.modules = chunkModulesStats;\n\n output[bundleEntryFilepath] = chunkStats;\n\n return;\n }\n });\n\n return output;\n}\n"],"mappings":";;;;;;;;;;;;;AA0EA,SAAwB,mBACtB,QACA,UAAwB,EAAE,EACnB;CACP,MAAM,EACJ,SAAS,OACT,MAAM,OACN,eACA,mBACE;CAEJ,MAAM,SAAgB,EAAE;AAExB,QAAO,QAAQ,OAAO,CAAC,SAAS,CAAC,qBAAqB,sBAAsB;AAE1E,MAAI,qBAAqB,qBAAqB,cAAc,CAC1D;AAGF,MAAI,iBAAiB,SAAS,SAAS;GACrC,MAAM,qBAAgE,EAAE;AAGxE,OAAI,CAAC,OACH,oBAAmB,KAAK,SAAS;AAGnC,UAAO,uBAAuB,KAC5B,kBACA,mBACD;AAED;;AAGF,MAAI,iBAAiB,SAAS,SAAS;GACrC,MAAM,qBAAgE,EAAE;AAGxE,OAAI,CAAC,OACH,oBAAmB,KAAK,OAAO;AAIjC,OAAI,CAAC,IACH,oBAAmB,KAAK,MAAM;GAGhC,MAAM,aAAa,KACjB,kBACA,mBACD;GAGD,MAAM,oBAA2C,EAAE;AAEnD,UAAO,QAAQ,WAAW,QAAQ,CAAC,SAChC,CAAC,sBAAsB,uBAAuB;AAE7C,QAAI,qBAAqB,sBAAsB,eAAe,CAC5D;IAGF,MAAM,sBAEF,EAAE;AAGN,QAAI,CAAC,OACH,qBAAoB,KAAK,OAAO;AAGlC,sBAAkB,wBAAwB,KACxC,mBACA,oBACD;KAEJ;AAED,cAAW,UAAU;AAErB,UAAO,uBAAuB;AAE9B;;GAEF;AAEF,QAAO"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { OutputOptions, Plugin } from "./src/types.cjs";
|
|
1
2
|
import { StatsOptions } from "./extract.cjs";
|
|
2
3
|
import { RollupStatsWrite } from "./src/write.cjs";
|
|
3
|
-
import { OutputOptions, Plugin } from "./src/types.cjs";
|
|
4
4
|
|
|
5
5
|
//#region src/index.d.ts
|
|
6
6
|
type RollupStatsOptions = {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { OutputOptions, Plugin } from "./src/types.mjs";
|
|
1
2
|
import { StatsOptions } from "./extract.mjs";
|
|
2
3
|
import { RollupStatsWrite } from "./src/write.mjs";
|
|
3
|
-
import { OutputOptions, Plugin } from "./src/types.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/index.d.ts
|
|
6
6
|
type RollupStatsOptions = {
|
package/dist/src/types.d.cts
CHANGED
|
@@ -1,9 +1,143 @@
|
|
|
1
|
-
import { OutputBundle, OutputOptions, Plugin } from "rollup";
|
|
2
|
-
import { Plugin as Plugin$1 } from "vite";
|
|
3
|
-
|
|
4
1
|
//#region src/types.d.ts
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
/**
|
|
3
|
+
* A generated asset entry in the output bundle (e.g. CSS, images, JSON).
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* type: 'asset',
|
|
8
|
+
* fileName: 'assets/logo-CvPeBknE.svg',
|
|
9
|
+
* names: ['logo'],
|
|
10
|
+
* originalFileNames: ['src/assets/logo.svg'],
|
|
11
|
+
* source: '<svg xmlns="http://www.w3.org/2000/svg">...</svg>',
|
|
12
|
+
* }
|
|
13
|
+
*/
|
|
14
|
+
type OutputAsset = {
|
|
15
|
+
/** Discriminant literal identifying this entry as an asset. */type: 'asset'; /** All entry names that reference this asset. */
|
|
16
|
+
names: string[]; /** Original source file names this asset was generated from. */
|
|
17
|
+
originalFileNames: string[]; /** The asset content as a string (text assets) or a `Uint8Array` (binary assets). */
|
|
18
|
+
source: string | Uint8Array; /** The emitted file name of the asset relative to the output directory. */
|
|
19
|
+
fileName: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A generated JavaScript chunk entry in the output bundle.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* {
|
|
26
|
+
* type: 'chunk',
|
|
27
|
+
* fileName: 'assets/index-DpgTxXR6.js',
|
|
28
|
+
* name: 'index',
|
|
29
|
+
* facadeModuleId: '/project/src/index.ts',
|
|
30
|
+
* isEntry: true,
|
|
31
|
+
* isDynamicEntry: false,
|
|
32
|
+
* exports: ['default'],
|
|
33
|
+
* imports: ['assets/vendor-CvaBJZ2l.js'],
|
|
34
|
+
* dynamicImports: ['assets/lazy-Dj3OKb2X.js'],
|
|
35
|
+
* modules: { '/project/src/index.ts': { renderedLength: 120, ... } },
|
|
36
|
+
* code: '"use strict";...',
|
|
37
|
+
* map: null,
|
|
38
|
+
* }
|
|
39
|
+
*/
|
|
40
|
+
type OutputChunk = {
|
|
41
|
+
/** Discriminant literal identifying this entry as a JavaScript chunk. */type: 'chunk'; /** Names exported by this chunk. */
|
|
42
|
+
exports: string[];
|
|
43
|
+
/**
|
|
44
|
+
* The module ID of the entry point that this chunk acts as a facade for,
|
|
45
|
+
* or `null` when this chunk is not an entry facade.
|
|
46
|
+
*/
|
|
47
|
+
facadeModuleId: string | null; /** Whether this chunk is a dynamic entry point (i.e. produced by a dynamic `import()`). */
|
|
48
|
+
isDynamicEntry: boolean; /** Whether this chunk is a static entry point declared in the Vite, Rolldown, Rollup input options. */
|
|
49
|
+
isEntry: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The chunk name as used in `chunkFileNames` and `entryFileNames` patterns,
|
|
52
|
+
* without any content hash.
|
|
53
|
+
*/
|
|
54
|
+
name: string; /** File names of chunks that are dynamically imported by this chunk. */
|
|
55
|
+
dynamicImports: string[]; /** The emitted file name of the chunk relative to the output directory. */
|
|
56
|
+
fileName: string; /** File names of chunks that are statically imported by this chunk. */
|
|
57
|
+
imports: string[];
|
|
58
|
+
/**
|
|
59
|
+
* Per-module render stats for every module included in this chunk,
|
|
60
|
+
* keyed by the module's original file path.
|
|
61
|
+
*/
|
|
62
|
+
modules: Record<string, RenderedModule>; /** The rendered JavaScript source code of this chunk. */
|
|
63
|
+
code: string; /** Source map for this chunk, or `null` when source maps are not enabled. */
|
|
64
|
+
map: SourceMap | null;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Stats for an individual module included in an output chunk.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* {
|
|
71
|
+
* code: 'export { add } from "./math.js";',
|
|
72
|
+
* originalLength: 512,
|
|
73
|
+
* removedExports: ['subtract'],
|
|
74
|
+
* renderedExports: ['add'],
|
|
75
|
+
* renderedLength: 34,
|
|
76
|
+
* }
|
|
77
|
+
*/
|
|
78
|
+
type RenderedModule = {
|
|
79
|
+
/**
|
|
80
|
+
* The module code that Vite, Rolldown or Rollup included in the bundle, or `null` when the
|
|
81
|
+
* module was fully tree-shaken.
|
|
82
|
+
*/
|
|
83
|
+
readonly code: string | null; /** Size of the original module source in bytes, before any transformations. */
|
|
84
|
+
originalLength: number; /** Exports removed from this module by tree-shaking. */
|
|
85
|
+
removedExports: string[]; /** Exports from this module that are retained in the final bundle. */
|
|
86
|
+
renderedExports: string[]; /** Size of the rendered module code in bytes. */
|
|
87
|
+
renderedLength: number;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Standard source map v3 object mapping generated code back to original sources.
|
|
91
|
+
*
|
|
92
|
+
* @see https://sourcemaps.info/spec.html
|
|
93
|
+
*/
|
|
94
|
+
type SourceMap = {
|
|
95
|
+
/** Name of the generated file this source map corresponds to. */file: string; /** Base64 VLQ-encoded string describing the source mappings. */
|
|
96
|
+
mappings: string; /** Original symbol names referenced by the mappings. */
|
|
97
|
+
names: string[]; /** Paths to the original source files. */
|
|
98
|
+
sources: string[]; /** Optional inline content of each original source file, parallel to `sources`. */
|
|
99
|
+
sourcesContent?: string[]; /** Source map specification version — always `3`. */
|
|
100
|
+
version: number;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* The complete output bundle produced by Vite, Rolldown or Rollup — a map from emitted file name
|
|
104
|
+
* to its corresponding asset or chunk descriptor.
|
|
105
|
+
*/
|
|
106
|
+
type OutputBundle = Record<string, OutputAsset | OutputChunk>;
|
|
107
|
+
/**
|
|
108
|
+
* Relevant subset of Vite, Rolldown, Rollup's output options passed to the `generateBundle` hook.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* { dir: 'dist' }
|
|
112
|
+
*/
|
|
113
|
+
type OutputOptions = {
|
|
114
|
+
/** Output directory for the generated files. */dir?: string;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Subset of the Vite, Rolldown, Rollup plugin hook context (`this`) used by this plugin.
|
|
118
|
+
*/
|
|
119
|
+
type PluginContext = {
|
|
120
|
+
/** Log an informational message through Vite, Rolldown, Rollup's logging pipeline. */info: (message: string) => void; /** Log a warning through bundler's logging pipeline without stopping the build. */
|
|
121
|
+
warn: (message: string) => void;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Minimum plugin interface compatible with Vite, Rolldown and Rollup.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* {
|
|
128
|
+
* name: 'rollupStats',
|
|
129
|
+
* async generateBundle(outputOptions, bundle) { ... },
|
|
130
|
+
* }
|
|
131
|
+
*/
|
|
132
|
+
type Plugin = {
|
|
133
|
+
/** Unique identifier for the plugin, used in error messages and logs. */name: string;
|
|
134
|
+
/**
|
|
135
|
+
* Hook called after the bundle has been fully generated but before it is
|
|
136
|
+
* written to disk. Receives the resolved output options and the complete
|
|
137
|
+
* output bundle map.
|
|
138
|
+
*/
|
|
139
|
+
generateBundle?: (this: PluginContext, outputOptions: OutputOptions, bundle: OutputBundle, isWrite: boolean) => void | Promise<void>;
|
|
140
|
+
};
|
|
7
141
|
//#endregion
|
|
8
|
-
export {
|
|
142
|
+
export { OutputAsset, OutputBundle, OutputChunk, OutputOptions, Plugin, RenderedModule };
|
|
9
143
|
//# sourceMappingURL=types.d.cts.map
|
package/dist/src/types.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/types.ts"],"mappings":";;AAYA;;;;;;;;;;;KAAY,WAAA;EAgCA,+DA9BV,IAAA;EAEA,KAAA,YAyDS;EAvDT,iBAAA,YA2Dc;EAzDd,MAAA,WAAiB,UAAA,EA0BjB;EAxBA,QAAA;AAAA;;;;;;;;;;;;;;;AAsEF;;;;;KAhDY,WAAA;EAyDV,yEAvDA,IAAA,WA2DA;EAzDA,OAAA;EAyDc;AACd;;;EArDA,cAAA,iBA8DA;EA5DA,cAAA,WAgEA;EA9DA,OAAA;EAkEA;;;;EA7DA,IAAA,UAsEsB;EApEtB,cAAA,YAoEwC;EAlExC,QAAA,UAkEyB;EAhEzB,OAAA;EAgE+B;;;;EA3D/B,OAAA,EAAS,MAAA,SAAe,cAAA,GA2DyC;EAzDjE,IAAA,UAiEuB;EA/DvB,GAAA,EAAK,SAAA;AAAA;;AAkEL;;;;;;;;;;AAqBF;KAxEY,cAAA;;;;;WAKD,IAAA,iBAgFU;EA9EnB,cAAA,UAmEA;EAjEA,cAAA,YAwEQ;EAtER,eAAA,YAuEiB;EArEjB,cAAA;AAAA;;;;;;KAQG,SAAA;mEAEH,IAAA;EAEA,QAAA;EAEA,KAAA;EAEA,OAAA;EAEA,cAAA;EAEA,OAAA;AAAA;;;;;KAOU,YAAA,GAAe,MAAA,SAAe,WAAA,GAAc,WAAA;;;;;;;KAQ5C,aAAA;kDAEV,GAAA;AAAA;;;;KAMG,aAAA;wFAEH,IAAA,GAAO,OAAA;EAEP,IAAA,GAAO,OAAA;AAAA;;;;;;;;;;KAYG,MAAA;2EAEV,IAAA;;;;;;EAMA,cAAA,IACE,IAAA,EAAM,aAAA,EACN,aAAA,EAAe,aAAA,EACf,MAAA,EAAQ,YAAA,EACR,OAAA,qBACU,OAAA;AAAA"}
|
package/dist/src/types.d.mts
CHANGED
|
@@ -1,9 +1,143 @@
|
|
|
1
|
-
import { OutputBundle, OutputOptions, Plugin } from "rollup";
|
|
2
|
-
import { Plugin as Plugin$1 } from "vite";
|
|
3
|
-
|
|
4
1
|
//#region src/types.d.ts
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
/**
|
|
3
|
+
* A generated asset entry in the output bundle (e.g. CSS, images, JSON).
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* type: 'asset',
|
|
8
|
+
* fileName: 'assets/logo-CvPeBknE.svg',
|
|
9
|
+
* names: ['logo'],
|
|
10
|
+
* originalFileNames: ['src/assets/logo.svg'],
|
|
11
|
+
* source: '<svg xmlns="http://www.w3.org/2000/svg">...</svg>',
|
|
12
|
+
* }
|
|
13
|
+
*/
|
|
14
|
+
type OutputAsset = {
|
|
15
|
+
/** Discriminant literal identifying this entry as an asset. */type: 'asset'; /** All entry names that reference this asset. */
|
|
16
|
+
names: string[]; /** Original source file names this asset was generated from. */
|
|
17
|
+
originalFileNames: string[]; /** The asset content as a string (text assets) or a `Uint8Array` (binary assets). */
|
|
18
|
+
source: string | Uint8Array; /** The emitted file name of the asset relative to the output directory. */
|
|
19
|
+
fileName: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A generated JavaScript chunk entry in the output bundle.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* {
|
|
26
|
+
* type: 'chunk',
|
|
27
|
+
* fileName: 'assets/index-DpgTxXR6.js',
|
|
28
|
+
* name: 'index',
|
|
29
|
+
* facadeModuleId: '/project/src/index.ts',
|
|
30
|
+
* isEntry: true,
|
|
31
|
+
* isDynamicEntry: false,
|
|
32
|
+
* exports: ['default'],
|
|
33
|
+
* imports: ['assets/vendor-CvaBJZ2l.js'],
|
|
34
|
+
* dynamicImports: ['assets/lazy-Dj3OKb2X.js'],
|
|
35
|
+
* modules: { '/project/src/index.ts': { renderedLength: 120, ... } },
|
|
36
|
+
* code: '"use strict";...',
|
|
37
|
+
* map: null,
|
|
38
|
+
* }
|
|
39
|
+
*/
|
|
40
|
+
type OutputChunk = {
|
|
41
|
+
/** Discriminant literal identifying this entry as a JavaScript chunk. */type: 'chunk'; /** Names exported by this chunk. */
|
|
42
|
+
exports: string[];
|
|
43
|
+
/**
|
|
44
|
+
* The module ID of the entry point that this chunk acts as a facade for,
|
|
45
|
+
* or `null` when this chunk is not an entry facade.
|
|
46
|
+
*/
|
|
47
|
+
facadeModuleId: string | null; /** Whether this chunk is a dynamic entry point (i.e. produced by a dynamic `import()`). */
|
|
48
|
+
isDynamicEntry: boolean; /** Whether this chunk is a static entry point declared in the Vite, Rolldown, Rollup input options. */
|
|
49
|
+
isEntry: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The chunk name as used in `chunkFileNames` and `entryFileNames` patterns,
|
|
52
|
+
* without any content hash.
|
|
53
|
+
*/
|
|
54
|
+
name: string; /** File names of chunks that are dynamically imported by this chunk. */
|
|
55
|
+
dynamicImports: string[]; /** The emitted file name of the chunk relative to the output directory. */
|
|
56
|
+
fileName: string; /** File names of chunks that are statically imported by this chunk. */
|
|
57
|
+
imports: string[];
|
|
58
|
+
/**
|
|
59
|
+
* Per-module render stats for every module included in this chunk,
|
|
60
|
+
* keyed by the module's original file path.
|
|
61
|
+
*/
|
|
62
|
+
modules: Record<string, RenderedModule>; /** The rendered JavaScript source code of this chunk. */
|
|
63
|
+
code: string; /** Source map for this chunk, or `null` when source maps are not enabled. */
|
|
64
|
+
map: SourceMap | null;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Stats for an individual module included in an output chunk.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* {
|
|
71
|
+
* code: 'export { add } from "./math.js";',
|
|
72
|
+
* originalLength: 512,
|
|
73
|
+
* removedExports: ['subtract'],
|
|
74
|
+
* renderedExports: ['add'],
|
|
75
|
+
* renderedLength: 34,
|
|
76
|
+
* }
|
|
77
|
+
*/
|
|
78
|
+
type RenderedModule = {
|
|
79
|
+
/**
|
|
80
|
+
* The module code that Vite, Rolldown or Rollup included in the bundle, or `null` when the
|
|
81
|
+
* module was fully tree-shaken.
|
|
82
|
+
*/
|
|
83
|
+
readonly code: string | null; /** Size of the original module source in bytes, before any transformations. */
|
|
84
|
+
originalLength: number; /** Exports removed from this module by tree-shaking. */
|
|
85
|
+
removedExports: string[]; /** Exports from this module that are retained in the final bundle. */
|
|
86
|
+
renderedExports: string[]; /** Size of the rendered module code in bytes. */
|
|
87
|
+
renderedLength: number;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Standard source map v3 object mapping generated code back to original sources.
|
|
91
|
+
*
|
|
92
|
+
* @see https://sourcemaps.info/spec.html
|
|
93
|
+
*/
|
|
94
|
+
type SourceMap = {
|
|
95
|
+
/** Name of the generated file this source map corresponds to. */file: string; /** Base64 VLQ-encoded string describing the source mappings. */
|
|
96
|
+
mappings: string; /** Original symbol names referenced by the mappings. */
|
|
97
|
+
names: string[]; /** Paths to the original source files. */
|
|
98
|
+
sources: string[]; /** Optional inline content of each original source file, parallel to `sources`. */
|
|
99
|
+
sourcesContent?: string[]; /** Source map specification version — always `3`. */
|
|
100
|
+
version: number;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* The complete output bundle produced by Vite, Rolldown or Rollup — a map from emitted file name
|
|
104
|
+
* to its corresponding asset or chunk descriptor.
|
|
105
|
+
*/
|
|
106
|
+
type OutputBundle = Record<string, OutputAsset | OutputChunk>;
|
|
107
|
+
/**
|
|
108
|
+
* Relevant subset of Vite, Rolldown, Rollup's output options passed to the `generateBundle` hook.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* { dir: 'dist' }
|
|
112
|
+
*/
|
|
113
|
+
type OutputOptions = {
|
|
114
|
+
/** Output directory for the generated files. */dir?: string;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Subset of the Vite, Rolldown, Rollup plugin hook context (`this`) used by this plugin.
|
|
118
|
+
*/
|
|
119
|
+
type PluginContext = {
|
|
120
|
+
/** Log an informational message through Vite, Rolldown, Rollup's logging pipeline. */info: (message: string) => void; /** Log a warning through bundler's logging pipeline without stopping the build. */
|
|
121
|
+
warn: (message: string) => void;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Minimum plugin interface compatible with Vite, Rolldown and Rollup.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* {
|
|
128
|
+
* name: 'rollupStats',
|
|
129
|
+
* async generateBundle(outputOptions, bundle) { ... },
|
|
130
|
+
* }
|
|
131
|
+
*/
|
|
132
|
+
type Plugin = {
|
|
133
|
+
/** Unique identifier for the plugin, used in error messages and logs. */name: string;
|
|
134
|
+
/**
|
|
135
|
+
* Hook called after the bundle has been fully generated but before it is
|
|
136
|
+
* written to disk. Receives the resolved output options and the complete
|
|
137
|
+
* output bundle map.
|
|
138
|
+
*/
|
|
139
|
+
generateBundle?: (this: PluginContext, outputOptions: OutputOptions, bundle: OutputBundle, isWrite: boolean) => void | Promise<void>;
|
|
140
|
+
};
|
|
7
141
|
//#endregion
|
|
8
|
-
export {
|
|
142
|
+
export { OutputAsset, OutputBundle, OutputChunk, OutputOptions, Plugin, RenderedModule };
|
|
9
143
|
//# sourceMappingURL=types.d.mts.map
|
package/dist/src/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/types.ts"],"mappings":";;AAYA;;;;;;;;;;;KAAY,WAAA;EAgCA,+DA9BV,IAAA;EAEA,KAAA,YAyDS;EAvDT,iBAAA,YA2Dc;EAzDd,MAAA,WAAiB,UAAA,EA0BjB;EAxBA,QAAA;AAAA;;;;;;;;;;;;;;;AAsEF;;;;;KAhDY,WAAA;EAyDV,yEAvDA,IAAA,WA2DA;EAzDA,OAAA;EAyDc;AACd;;;EArDA,cAAA,iBA8DA;EA5DA,cAAA,WAgEA;EA9DA,OAAA;EAkEA;;;;EA7DA,IAAA,UAsEsB;EApEtB,cAAA,YAoEwC;EAlExC,QAAA,UAkEyB;EAhEzB,OAAA;EAgE+B;;;;EA3D/B,OAAA,EAAS,MAAA,SAAe,cAAA,GA2DyC;EAzDjE,IAAA,UAiEuB;EA/DvB,GAAA,EAAK,SAAA;AAAA;;AAkEL;;;;;;;;;;AAqBF;KAxEY,cAAA;;;;;WAKD,IAAA,iBAgFU;EA9EnB,cAAA,UAmEA;EAjEA,cAAA,YAwEQ;EAtER,eAAA,YAuEiB;EArEjB,cAAA;AAAA;;;;;;KAQG,SAAA;mEAEH,IAAA;EAEA,QAAA;EAEA,KAAA;EAEA,OAAA;EAEA,cAAA;EAEA,OAAA;AAAA;;;;;KAOU,YAAA,GAAe,MAAA,SAAe,WAAA,GAAc,WAAA;;;;;;;KAQ5C,aAAA;kDAEV,GAAA;AAAA;;;;KAMG,aAAA;wFAEH,IAAA,GAAO,OAAA;EAEP,IAAA,GAAO,OAAA;AAAA;;;;;;;;;;KAYG,MAAA;2EAEV,IAAA;;;;;;EAMA,cAAA,IACE,IAAA,EAAM,aAAA,EACN,aAAA,EAAe,aAAA,EACf,MAAA,EAAQ,YAAA,EACR,OAAA,qBACU,OAAA;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rollup-plugin-stats",
|
|
3
3
|
"description": "Vite/Rolldown/Rollup plugin to generate bundle stats JSON file",
|
|
4
|
-
"version": "2.1.0",
|
|
4
|
+
"version": "2.1.1-beta.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
7
7
|
"repository": {
|
|
@@ -86,11 +86,9 @@
|
|
|
86
86
|
"prettier": "3.8.1",
|
|
87
87
|
"release-it": "19.2.4",
|
|
88
88
|
"rimraf": "6.1.3",
|
|
89
|
-
"rollup": "4.59.0",
|
|
90
89
|
"tsdown": "0.21.2",
|
|
91
90
|
"typescript": "5.9.3",
|
|
92
91
|
"typescript-eslint": "8.57.0",
|
|
93
|
-
"vite": "7.3.1",
|
|
94
92
|
"vitest": "4.1.0"
|
|
95
93
|
},
|
|
96
94
|
"peerDependencies": {
|