sonda 0.5.0 → 0.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.1
4
+
5
+ Sonda has a new home. You can now visit [https://sonda.dev](https://sonda.dev) for installation and usage instructions, or try it out at [https://sonda.dev/demo](https://sonda.dev/demo).
6
+
7
+ ### Patch Changes
8
+
9
+ - d6e2d76: Add links to Sonda documentation
10
+
11
+ ## 0.6.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 0e92901: Add the `filename` option to allow changing the report output path
16
+
3
17
  ## 0.5.0
4
18
 
5
19
  ### Minor Changes
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Sonda is a universal visualizer and analyzer for JavaScript and CSS bundles. It analyzes the source maps and shows the size of each module after tree-shaking and minification to get the most accurate report.
4
4
 
5
- Sonda works with the following bundlers:
5
+ Sonda is more accurate and detailed than some alternatives and works with the following bundlers:
6
6
 
7
7
  * Vite
8
8
  * Rollup
@@ -10,201 +10,14 @@ Sonda works with the following bundlers:
10
10
  * webpack
11
11
  * Rspack
12
12
 
13
- ![HTML report generated by Sonda with open modal containing file details and tree map diagram in the background](https://raw.githubusercontent.com/filipsobol/sonda/refs/heads/main/docs/public/details.png)
14
-
15
13
  ## Installation
16
14
 
17
- Start by installing the package:
18
-
19
- ```bash
20
- npm install sonda --save-dev
21
- ```
22
-
23
- Then register the bundler-specific plugin and enable the source maps. **Remember to use Sonda in development mode only**.
24
-
25
- <details>
26
- <summary>Vite</summary>
27
-
28
- ```javascript
29
- // vite.config.js
30
-
31
- import { defineConfig } from 'vite';
32
- import { SondaRollupPlugin } from 'sonda';
33
-
34
- export default defineConfig( {
35
- plugins: [
36
- SondaRollupPlugin(),
37
- ],
38
- build: {
39
- sourcemap: true
40
- }
41
- } );
42
- ```
43
-
44
- </details>
45
-
46
- <details>
47
- <summary>Rollup</summary>
48
-
49
- ```javascript
50
- // rollup.config.js
51
-
52
- import { defineConfig } from 'rollup';
53
- import { SondaRollupPlugin } from 'sonda';
54
-
55
- export default defineConfig( {
56
- output: {
57
- // Other options are skipped for brevity
58
- sourcemap: true,
59
- },
60
- plugins: [
61
- SondaRollupPlugin(),
62
- ]
63
- } );
64
- ```
65
-
66
- Some Rollup plugins may not support source maps by default. Check their documentation to enable them. Examples for `@rollup/plugin-commonjs` and `rollup-plugin-styles` are shown below.
67
-
68
- ```javascript
69
- commonjs( {
70
- sourceMap: true,
71
- } ),
72
- styles( {
73
- mode: 'extract',
74
- sourceMap: true,
75
- } )
76
- ```
77
-
78
- </details>
79
-
80
- <details>
81
- <summary>esbuild</summary>
82
-
83
- ```javascript
84
- import { build } from 'esbuild';
85
- import { SondaEsbuildPlugin } from 'sonda';
86
-
87
- build( {
88
- sourcemap: true,
89
- plugins: [
90
- SondaEsbuildPlugin()
91
- ]
92
- } );
93
- ```
94
-
95
- Unlike for other bundlers, the esbuild plugin relies not only on source maps but also on the metafile. The plugin should automatically enable the metafile option for you, but if you get the error, be sure to enable it manually (`metafile: true`).
96
-
97
- </details>
98
-
99
- <details>
100
- <summary>webpack</summary>
101
-
102
- ```javascript
103
- // webpack.config.js
104
-
105
- const { SondaWebpackPlugin } = require( 'sonda' );
106
-
107
- module.exports = {
108
- devtool: 'source-map',
109
- plugins: [
110
- new SondaWebpackPlugin(),
111
- ],
112
- };
113
- ```
114
-
115
- Internally, Sonda changes the default webpack configuration to output absolute paths in the source maps instead of using the `webpack://` protocol (`devtoolModuleFilenameTemplate: '[absolute-resource-path]'`).
116
-
117
- </details>
118
-
119
- <details>
120
- <summary>Rspack</summary>
121
-
122
- ```javascript
123
- // rspack.config.js
124
-
125
- import { SondaWebpackPlugin } from 'sonda';
126
-
127
- export default {
128
- devtool: 'source-map',
129
- plugins: [
130
- new SondaWebpackPlugin(),
131
- ],
132
- };
133
- ```
134
-
135
- Internally, Sonda changes the default Rspack configuration to output absolute paths in the source maps instead of using the `webpack://` protocol (`devtoolModuleFilenameTemplate: '[absolute-resource-path]'`).
136
-
137
- </details>
138
-
139
- ## Options
140
-
141
- Each plugin accepts an optional configuration object with the following options. Example:
142
-
143
- ```javascript
144
- SondaRollupPlugin( {
145
- format: 'html',
146
- open: true,
147
- detailed: true,
148
- gzip: true,
149
- brotli: true,
150
- } )
151
- ```
152
-
153
- ### `format`
154
-
155
- * **Type:** `string`
156
- * **Default:** `'html'`
157
-
158
- Determines the output format of the report. The following formats are supported:
159
-
160
- * `'html'` - HTML file with treemap
161
- * `'json'` - JSON file
162
-
163
- ### `open`
164
-
165
- * **Type:** `boolean`
166
- * **Default:** `true`
167
-
168
- Determines whether to open the report in the default program for given file extension (`.html` or `.json` depending on the `format` option) after the build.
169
-
170
- ### `detailed`
171
-
172
- * **Type:** `boolean`
173
- * **Default:** `false`
174
-
175
- Determines whether to read the source maps of imported modules.
176
-
177
- By default, external dependencies that are bundled into a single file appear as a single asset in the report. When this option is enabled, the report will instead include the source files of the imported modules, if they have source maps.
178
-
179
- Enabling this option will increase the time needed to generate the report and reduce the accuracy of estimated GZIP and Brotli sizes for individual files.
180
-
181
- ### `sources`
182
-
183
- * **Type:** `boolean`
184
- * **Default:** `false`
185
-
186
- Determines whether to include the source maps of the assets in the report to visualize which parts of the code contribute to the final bundle size.
187
-
188
- ⚠️ Enabling this option will significantly increase the report size and include it in the **source code** of the assets. If you work with proprietary code, be cautious when sharing the report. ⚠️
189
-
190
- ### `gzip`
191
-
192
- * **Type:** `boolean`
193
- * **Default:** `false`
194
-
195
- Determines whether to calculate the sizes of assets after compression with GZIP.
196
-
197
- The report will include estimated compressed sizes for each file within an asset. However, unlike the compressed size of the entire asset, these individual file estimates are approximate and should be used as a general reference.
198
-
199
- Enabling this option will increase the time needed to generate the report.
200
-
201
- ### `brotli`
15
+ For installation and usage instructions, visit [https://sonda.dev](https://sonda.dev).
202
16
 
203
- * **Type:** `boolean`
204
- * **Default:** `false`
17
+ ## Demo
205
18
 
206
- Determines whether to calculate the sizes of assets after compression with Brotli.
19
+ You can try Sonda at [https://sonda.dev/demo](https://sonda.dev/demo).
207
20
 
208
- The report will include estimated compressed sizes for each file within an asset. However, unlike the compressed size of the entire asset, these individual file estimates are approximate and should be used as a general reference.
21
+ ## Screenshot
209
22
 
210
- Enabling this option will increase the time needed to generate the report.
23
+ ![HTML report generated by Sonda with open modal containing file details and tree map diagram in the background](https://raw.githubusercontent.com/filipsobol/sonda/refs/heads/main/docs/public/details.jpg)
package/dist/index.cjs CHANGED
@@ -107,15 +107,20 @@ function parseDataUrl(url) {
107
107
  const cjsRegex = /\.c[tj]sx?$/;
108
108
  const jsRegexp = /\.[cm]?[tj]s[x]?$/;
109
109
  function normalizeOptions(options) {
110
+ const format = options?.format || options?.filename?.split('.').at(-1) || 'html';
110
111
  const defaultOptions = {
112
+ format,
113
+ filename: 'sonda-report.' + format,
111
114
  open: true,
112
- format: 'html',
113
115
  detailed: false,
114
116
  sources: false,
115
117
  gzip: false,
116
118
  brotli: false
117
119
  };
118
- return Object.assign({}, defaultOptions, options);
120
+ // Merge user options with the defaults
121
+ const normalizedOptions = Object.assign({}, defaultOptions, options);
122
+ normalizedOptions.filename = normalizeOutputPath(normalizedOptions);
123
+ return normalizedOptions;
119
124
  }
120
125
  function normalizePath(pathToNormalize) {
121
126
  // Unicode escape sequences used by Rollup and Vite to identify virtual modules
@@ -125,6 +130,25 @@ function normalizePath(pathToNormalize) {
125
130
  // Ensure paths are POSIX-compliant - https://stackoverflow.com/a/63251716/4617687
126
131
  return relativized.replaceAll(path.win32.sep, path.posix.sep);
127
132
  }
133
+ function normalizeOutputPath(options) {
134
+ let path$1 = options.filename;
135
+ const expectedExtension = '.' + options.format;
136
+ // Ensure the filename is an absolute path
137
+ if (!path.isAbsolute(path$1)) {
138
+ path$1 = path.join(process.cwd(), path$1);
139
+ }
140
+ // Ensure that the `filename` extension matches the `format` option
141
+ if (expectedExtension !== path.extname(path$1)) {
142
+ console.warn('\x1b[0;33m' + // Make the message yellow
143
+ `Sonda: The file extension specified in the 'filename' does not match the 'format' option. ` + `The extension will be changed to '${expectedExtension}'.`);
144
+ path$1 = path.format({
145
+ ...path.parse(path$1),
146
+ base: '',
147
+ ext: expectedExtension
148
+ });
149
+ }
150
+ return path$1;
151
+ }
128
152
 
129
153
  function mapSourceMap(map, dirPath, inputs) {
130
154
  const alreadyRemapped = new Set();
@@ -322,27 +346,32 @@ function sortObjectKeys(object) {
322
346
  async function generateReportFromAssets(assets, inputs, userOptions) {
323
347
  const options = normalizeOptions(userOptions);
324
348
  const handler = options.format === 'html' ? saveHtml : saveJson;
325
- const path = handler(assets, inputs, options);
326
- if (!options.open || !path) {
349
+ const report = handler(assets, inputs, options);
350
+ const outputDirectory = path.dirname(options.filename);
351
+ // Ensure the output directory exists
352
+ if (!fs.existsSync(outputDirectory)) {
353
+ fs.mkdirSync(outputDirectory, {
354
+ recursive: true
355
+ });
356
+ }
357
+ // Write the report to the file system
358
+ fs.writeFileSync(options.filename, report);
359
+ if (!options.open) {
327
360
  return;
328
361
  }
329
362
  /**
330
363
  * `open` is ESM-only package, so we need to import it
331
364
  * dynamically to make it work in CommonJS environment.
332
365
  */ const { default: open } = await import('open');
333
- open(path);
366
+ // Open the report in the default program for the file extension
367
+ open(options.filename);
334
368
  }
335
369
  function saveHtml(assets, inputs, options) {
336
- const report = generateHtmlReport(assets, inputs, options);
337
- const path$1 = path.join(process.cwd(), 'sonda-report.html');
338
- fs.writeFileSync(path$1, report);
339
- return path$1;
370
+ return generateHtmlReport(assets, inputs, options);
340
371
  }
341
372
  function saveJson(assets, inputs, options) {
342
373
  const report = generateJsonReport(assets, inputs, options);
343
- const path$1 = path.join(process.cwd(), 'sonda-report.json');
344
- fs.writeFileSync(path$1, JSON.stringify(report, null, 2));
345
- return path$1;
374
+ return JSON.stringify(report, null, 2);
346
375
  }
347
376
 
348
377
  function SondaEsbuildPlugin(options = {}) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../load-source-map/dist/index.js","../src/utils.ts","../src/sourcemap/map.ts","../src/sourcemap/bytes.ts","../src/report.ts","../src/report/generate.ts","../src/bundlers/esbuild.ts","../src/bundlers/rollup.ts","../src/bundlers/webpack.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'fs';\nimport { join, dirname, isAbsolute, resolve } from 'path';\n\n/**\n * Strip any JSON XSSI avoidance prefix from the string (as documented in the source maps specification),\n * and parses the string as JSON.\n *\n * https://github.com/mozilla/source-map/blob/3cb92cc3b73bfab27c146bae4ef2bc09dbb4e5ed/lib/util.js#L162-L164\n */ function parseSourceMapInput(str) {\n return JSON.parse(str.replace(/^\\)]}'[^\\n]*\\n/, \"\"));\n}\n/**\n\tsourceMappingURL=data:application/json;charset=utf-8;base64,data\n\tsourceMappingURL=data:application/json;base64,data\n\tsourceMappingURL=data:application/json;uri,data\n\tsourceMappingURL=map-file-comment.css.map\n\tsourceMappingURL=map-file-comment.css.map?query=value\n*/ const sourceMappingRegExp = /[@#]\\s*sourceMappingURL=(\\S+)\\b/g;\nfunction loadCodeAndMap(codePath) {\n if (!existsSync(codePath)) {\n return null;\n }\n const code = readFileSync(codePath, 'utf-8');\n const extractedComment = code.includes('sourceMappingURL') && Array.from(code.matchAll(sourceMappingRegExp)).at(-1);\n if (!extractedComment || !extractedComment.length) {\n return {\n code\n };\n }\n const maybeMap = loadMap(codePath, extractedComment[1]);\n if (!maybeMap) {\n return {\n code\n };\n }\n const { map, mapPath } = maybeMap;\n map.sources = normalizeSourcesPaths(map, mapPath);\n map.sourcesContent = loadMissingSourcesContent(map);\n delete map.sourceRoot;\n return {\n code,\n map\n };\n}\nfunction loadMap(codePath, sourceMappingURL) {\n if (sourceMappingURL.startsWith('data:')) {\n const map = parseDataUrl(sourceMappingURL);\n return {\n map: parseSourceMapInput(map),\n mapPath: codePath\n };\n }\n const sourceMapFilename = new URL(sourceMappingURL, 'file://').pathname;\n const mapPath = join(dirname(codePath), sourceMapFilename);\n if (!existsSync(mapPath)) {\n return null;\n }\n return {\n map: parseSourceMapInput(readFileSync(mapPath, 'utf-8')),\n mapPath\n };\n}\nfunction parseDataUrl(url) {\n const [prefix, payload] = url.split(',');\n const encoding = prefix.split(';').at(-1);\n switch(encoding){\n case 'base64':\n return Buffer.from(payload, 'base64').toString();\n case 'uri':\n return decodeURIComponent(payload);\n default:\n throw new Error('Unsupported source map encoding: ' + encoding);\n }\n}\n/**\n * Normalize the paths of the sources in the source map to be absolute paths.\n */ function normalizeSourcesPaths(map, mapPath) {\n const mapDir = dirname(mapPath);\n return map.sources.map((source)=>{\n if (!source) {\n return source;\n }\n return isAbsolute(source) ? source : resolve(mapDir, map.sourceRoot ?? '.', source);\n });\n}\n/**\n * Loop through the sources and try to load missing `sourcesContent` from the file system.\n */ function loadMissingSourcesContent(map) {\n return map.sources.map((source, index)=>{\n if (map.sourcesContent?.[index]) {\n return map.sourcesContent[index];\n }\n if (source && existsSync(source)) {\n return readFileSync(source, 'utf-8');\n }\n return null;\n });\n}\n\nexport { loadCodeAndMap };\n//# sourceMappingURL=index.js.map\n","import { relative, win32, posix } from 'path';\nimport type { Options } from './types';\n\nexport const esmRegex: RegExp = /\\.m[tj]sx?$/;\nexport const cjsRegex: RegExp = /\\.c[tj]sx?$/;\nexport const jsRegexp: RegExp = /\\.[cm]?[tj]s[x]?$/;\n\nexport function normalizeOptions( options?: Partial<Options> ) {\n\tconst defaultOptions: Options = {\n\t\topen: true,\n\t\tformat: 'html',\n\t\tdetailed: false,\n\t\tsources: false,\n\t\tgzip: false,\n\t\tbrotli: false,\n\t};\n\n\treturn Object.assign( {}, defaultOptions, options ) as Options;\n}\n\nexport function normalizePath( pathToNormalize: string ): string {\n\t// Unicode escape sequences used by Rollup and Vite to identify virtual modules\n\tconst normalized = pathToNormalize.replace( /^\\0/, '' )\n\n\t// Transform absolute paths to relative paths\n\tconst relativized = relative( process.cwd(), normalized );\n\n\t// Ensure paths are POSIX-compliant - https://stackoverflow.com/a/63251716/4617687\n\treturn relativized.replaceAll( win32.sep, posix.sep );\n}\n","import { default as remapping, type DecodedSourceMap, type EncodedSourceMap } from '@ampproject/remapping';\nimport { loadCodeAndMap } from 'load-source-map';\nimport { resolve } from 'path';\nimport { normalizePath } from '../utils';\nimport type { CodeMap, ReportInput } from '../types';\n\nexport function mapSourceMap(\n\tmap: EncodedSourceMap,\n\tdirPath: string,\n\tinputs: Record<string, ReportInput>\n): DecodedSourceMap {\n\tconst alreadyRemapped = new Set<string>();\n\tconst remapped = remapping( map, ( file, ctx ) => {\n\t\tif ( alreadyRemapped.has( file ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\talreadyRemapped.add( file );\n\n\t\tconst codeMap = addSourcesToInputs(\n\t\t\tresolve( dirPath, file ),\n\t\t\tinputs\n\t\t);\n\n\t\tif ( !codeMap ) {\n\t\t\treturn;\n\t\t}\n\n\t\tctx.content ??= codeMap.code;\n\n\t\treturn codeMap.map;\n\t}, { decodedMappings: true } );\n\n\treturn remapped as DecodedSourceMap;\n}\n\n/**\n * Loads the source map of a given file and adds its \"sources\" to the given inputs object.\n */\nexport function addSourcesToInputs(\n\tpath: string,\n\tinputs: Record<string, ReportInput>\n): CodeMap | null {\n\tconst codeMap = loadCodeAndMap( path );\n\n\tif ( !codeMap ) {\n\t\treturn null;\n\t}\n\n\tconst parentPath = normalizePath( path );\n\tconst format = inputs[ parentPath ]?.format ?? 'unknown';\n\n\tcodeMap.map?.sources\n\t\t.filter( source => source !== null )\n\t\t.forEach( ( source, index ) => {\n\t\t\tconst normalizedPath = normalizePath( source );\n\n\t\t\tif ( parentPath === normalizedPath ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tinputs[ normalizedPath ] = {\n\t\t\t\tbytes: Buffer.byteLength( codeMap.map!.sourcesContent?.[ index ] ?? '' ),\n\t\t\t\tformat,\n\t\t\t\timports: [],\n\t\t\t\tbelongsTo: parentPath\n\t\t\t};\n\t\t} );\n\t\n\treturn codeMap;\n}\n","import { gzipSync, brotliCompressSync } from 'zlib';\nimport type { DecodedSourceMap, SourceMapSegment } from '@ampproject/remapping';\nimport type { Options, Sizes } from '../types';\n\nconst UNASSIGNED = '[unassigned]';\n\nexport function getBytesPerSource(\n\tcode: string,\n\tmap: DecodedSourceMap,\n\tassetSizes: Sizes,\n\toptions: Options\n): Map<string, Sizes> {\n\tconst contributions = getContributions( map.sources );\n\n\t// Split the code into lines\n\tconst codeLines = code.split( /(?<=\\r?\\n)/ );\n\n\tfor ( let lineIndex = 0; lineIndex < codeLines.length; lineIndex++ ) {\n\t\tconst lineCode = codeLines[ lineIndex ];\n\t\tconst mappings = map.mappings[ lineIndex ] || [];\n\t\tlet currentColumn = 0;\n\n\t\tfor ( let i = 0; i <= mappings.length; i++ ) {\n\t\t\t// 0: generatedColumn\n\t\t\t// 1: sourceIndex\n\t\t\t// 2: originalLine\n\t\t\t// 3: originalColumn\n\t\t\t// 4: nameIndex\n\n\t\t\tconst mapping: SourceMapSegment | undefined = mappings[ i ];\n\t\t\tconst startColumn = mapping?.[ 0 ] ?? lineCode.length;\n\t\t\tconst endColumn = mappings[ i + 1 ]?.[ 0 ] ?? lineCode.length;\n\n\t\t\t// Slice the code from currentColumn to startColumn for unassigned code\n\t\t\tif ( startColumn > currentColumn ) {\n\t\t\t\tcontributions.set( UNASSIGNED, contributions.get( UNASSIGNED ) + lineCode.slice( currentColumn, startColumn ) );\n\t\t\t}\n\n\t\t\tif ( mapping ) {\n\t\t\t\t// Slice the code from startColumn to endColumn for assigned code\n\t\t\t\tconst sourceIndex = mapping?.[ 1 ];\n\t\t\t\tconst codeSlice = lineCode.slice( startColumn, endColumn );\n\t\t\t\tconst source = sourceIndex !== undefined ? map.sources[ sourceIndex ]! : UNASSIGNED;\n\n\t\t\t\tcontributions.set( source, contributions.get( source ) + codeSlice );\n\t\t\t\tcurrentColumn = endColumn;\n\t\t\t} else {\n\t\t\t\tcurrentColumn = startColumn;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Compute sizes for each source\n\tconst sourceSizes = new Map<string, Sizes>();\n\n\tconst contributionsSum: Sizes = {\n\t\tuncompressed: 0,\n\t\tgzip: 0,\n\t\tbrotli: 0\n\t};\n\n\tfor ( const [ source, codeSegment ] of contributions ) {\n\t\tconst sizes = getSizes( codeSegment, options );\n\n\t\tcontributionsSum.uncompressed += sizes.uncompressed;\n\t\tcontributionsSum.gzip += sizes.gzip;\n\t\tcontributionsSum.brotli += sizes.brotli;\n\n\t\tsourceSizes.set( source, sizes );\n\t}\n\n\treturn adjustSizes( sourceSizes, assetSizes, contributionsSum, options );\n}\n\nexport function getSizes(\n\tcode: string,\n\toptions: Options\n): Sizes {\n\treturn {\n\t\tuncompressed: Buffer.byteLength( code ),\n\t\tgzip: options.gzip ? gzipSync( code ).length : 0,\n\t\tbrotli: options.brotli ? brotliCompressSync( code ).length : 0\n\t};\n}\n\nfunction getContributions( sources: Array<string | null> ): Map<string, string> {\n\tconst contributions = new Map<string, string>();\n\n\t// Populate contributions with sources\n\tsources\n\t\t.filter( source => source !== null )\n\t\t.forEach( source => contributions.set( source, '' ) );\n\n\t// Add entry for the code that is not assigned to any source\n\tcontributions.set( UNASSIGNED, '' );\n\n\treturn contributions;\n}\n\n/**\n * Compression efficiency improves with the size of the file.\n *\n * However, what we have is the compressed size of the entire bundle (`actual`),\n * the sum of all files compressed individually (`sum`) and the compressed\n * size of a given file (`content`). The last value is essentially a “worst-case”\n * scenario, and the actual size of the file in the bundle is likely to be smaller.\n *\n * We use this information to estimate the actual size of the file in the bundle\n * after compression.\n */\nfunction adjustSizes(\n\tsources: Map<string, Sizes>,\n\tasset: Sizes,\n\tsums: Sizes,\n\toptions: Options\n): Map<string, Sizes> {\n\tconst gzipDelta = options.gzip ? asset.gzip / sums.gzip : 0;\n\tconst brotliDelta = options.brotli ? asset.brotli / sums.brotli : 0;\n\n\tfor ( const [ source, sizes ] of sources ) {\n\t\tsources.set( source, {\n\t\t\tuncompressed: sizes.uncompressed,\n\t\t\tgzip: options.gzip ? Math.round( sizes.gzip * gzipDelta ) : 0,\n\t\t\tbrotli: options.brotli ? Math.round( sizes.brotli * brotliDelta ) : 0\n\t\t} );\n\t}\n\n\treturn sources;\n}\n","import { readFileSync } from 'fs';\nimport { fileURLToPath } from 'url';\nimport { dirname, extname, resolve } from 'path';\nimport { loadCodeAndMap } from 'load-source-map';\nimport { decode } from '@jridgewell/sourcemap-codec';\nimport { mapSourceMap } from './sourcemap/map.js';\nimport { getBytesPerSource, getSizes } from './sourcemap/bytes.js';\nimport type {\n JsonReport,\n MaybeCodeMap,\n ReportInput,\n ReportOutput,\n CodeMap,\n ReportOutputInput,\n Options\n} from './types.js';\nimport { normalizePath } from './utils.js';\n\nexport function generateJsonReport(\n assets: Array<string>,\n inputs: Record<string, ReportInput>,\n options: Options\n): JsonReport {\n const acceptedExtensions = [ '.js', '.css' ];\n\n const outputs = assets\n .filter( asset => acceptedExtensions.includes( extname( asset ) ) )\n .reduce( ( carry, asset ) => {\n const data = processAsset( asset, inputs, options );\n\n if ( data ) {\n carry[ normalizePath( asset ) ] = data;\n }\n\n return carry;\n }, {} as Record<string, ReportOutput> );\n\n return {\n inputs: sortObjectKeys( inputs ),\n outputs: sortObjectKeys( outputs )\n };\n}\n\nexport function generateHtmlReport(\n assets: Array<string>,\n inputs: Record<string, ReportInput>,\n options: Options\n): string {\n const json = generateJsonReport( assets, inputs, options );\n const __dirname = dirname( fileURLToPath( import.meta.url ) );\n const template = readFileSync( resolve( __dirname, './index.html' ), 'utf-8' );\n\n return template.replace( '__REPORT_DATA__', encodeURIComponent( JSON.stringify( json ) ) );\n}\n\nfunction processAsset(\n asset: string,\n inputs: Record<string, ReportInput>,\n options: Options\n): ReportOutput | void {\n const maybeCodeMap = loadCodeAndMap( asset );\n\n if ( !hasCodeAndMap( maybeCodeMap ) ) {\n return;\n }\n\n const { code, map } = maybeCodeMap;\n const mapped = options.detailed\n ? mapSourceMap( map, dirname( asset ), inputs )\n : { ...map, mappings: decode( map.mappings ) };\n\n mapped.sources = mapped.sources.map( source => normalizePath( source! ) );\n\n const assetSizes = getSizes( code, options );\n const bytes = getBytesPerSource( code, mapped, assetSizes, options );\n const outputInputs = Array\n .from( bytes )\n .reduce( ( carry, [ source, sizes ] ) => {\n carry[ normalizePath( source ) ] = sizes;\n\n return carry;\n }, {} as Record<string, ReportOutputInput> );\n\n return {\n ...assetSizes,\n inputs: sortObjectKeys( outputInputs ),\n map: options.sources ? {\n version: 3,\n names: [],\n mappings: mapped.mappings,\n sources: mapped.sources,\n sourcesContent: mapped.sourcesContent,\n } : undefined\n };\n}\n\nfunction hasCodeAndMap( result: MaybeCodeMap ): result is Required<CodeMap> {\n return Boolean( result && result.code && result.map );\n}\n\nfunction sortObjectKeys<T extends unknown>( object: Record<string, T> ): Record<string, T> {\n return Object\n .keys( object )\n .sort()\n .reduce( ( carry, key ) => {\n carry[ key ] = object[ key ];\n\n return carry;\n }, {} as Record<string, T> );\n} \n","import { join } from 'path';\nimport { writeFileSync } from 'fs';\nimport { generateHtmlReport, generateJsonReport } from '../report.js';\nimport type { Options, JsonReport } from '../types.js';\nimport { normalizeOptions } from '../utils.js';\n\nexport async function generateReportFromAssets(\n\tassets: string[],\n\tinputs: JsonReport[ 'inputs' ],\n\tuserOptions: Partial<Options>\n): Promise<void> {\n\tconst options = normalizeOptions( userOptions );\n\tconst handler = options.format === 'html' ? saveHtml : saveJson;\n\tconst path = handler( assets, inputs, options );\n\n\tif ( !options.open || !path ) {\n\t\treturn;\n\t}\n\n\t/**\n\t * `open` is ESM-only package, so we need to import it\n\t * dynamically to make it work in CommonJS environment.\n\t */\n\tconst { default: open } = await import( 'open' );\n\n\topen( path );\n}\n\nfunction saveHtml(\n\tassets: string[],\n\tinputs: JsonReport[ 'inputs' ],\n\toptions: Options\n): string | null {\n\tconst report = generateHtmlReport( assets, inputs, options );\n\tconst path = join( process.cwd(), 'sonda-report.html' );\n\n\twriteFileSync( path, report );\n\n\treturn path;\n}\n\nfunction saveJson(\n\tassets: string[],\n\tinputs: JsonReport[ 'inputs' ],\n\toptions: Options\n): string | null {\n\tconst report = generateJsonReport( assets, inputs, options );\n\tconst path = join( process.cwd(), 'sonda-report.json' );\n\n\twriteFileSync( path, JSON.stringify( report, null, 2 ) );\n\n\treturn path;\n}\n","import { resolve } from 'path';\nimport { addSourcesToInputs } from '../sourcemap/map';\nimport { generateReportFromAssets } from '../report/generate';\nimport type { Plugin } from 'esbuild';\nimport type { Options, JsonReport } from '../types';\n\nexport function SondaEsbuildPlugin( options: Partial<Options> = {} ): Plugin {\n\treturn {\n\t\tname: 'sonda',\n\t\tsetup( build ) {\n\t\t\tbuild.initialOptions.metafile = true;\n\n\t\t\t// Esbuild already reads the existing source maps, so there's no need to do it again\n\t\t\toptions.detailed = false;\n\n\t\t\tbuild.onEnd( result => {\n\t\t\t\tif ( !result.metafile ) {\n\t\t\t\t\treturn console.error( 'Metafile is required for SondaEsbuildPlugin to work.' );\n\t\t\t\t}\n\n\t\t\t\tconst cwd = process.cwd();\n\t\t\t\tconst inputs = Object\n\t\t\t\t\t.entries( result.metafile.inputs )\n\t\t\t\t\t.reduce( ( acc, [ path, data ] ) => {\n\t\t\t\t\t\tacc[ path ] = {\n\t\t\t\t\t\t\tbytes: data.bytes,\n\t\t\t\t\t\t\tformat: data.format ?? 'unknown',\n\t\t\t\t\t\t\timports: data.imports.map( data => data.path ),\n\t\t\t\t\t\t\tbelongsTo: null,\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Because esbuild already reads the existing source maps, there may be\n\t\t\t\t\t\t * cases where some report \"outputs\" include \"inputs\" don't exist in the\n\t\t\t\t\t\t * main \"inputs\" object. To avoid this, we parse each esbuild input and\n\t\t\t\t\t\t * add its sources to the \"inputs\" object.\n\t\t\t\t\t\t */\n\t\t\t\t\t\taddSourcesToInputs(\n\t\t\t\t\t\t\tresolve( cwd, path ),\n\t\t\t\t\t\t\tacc\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t}, {} as JsonReport[ 'inputs' ] );\n\n\t\t\t\treturn generateReportFromAssets(\n\t\t\t\t\tObject.keys( result.metafile.outputs ).map( path => resolve( cwd, path ) ),\n\t\t\t\t\tinputs,\n\t\t\t\t\toptions\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\t};\n}\n","import { join, resolve, dirname } from 'path';\nimport { normalizePath, cjsRegex, jsRegexp } from '../utils.js';\nimport { generateReportFromAssets } from '../report/generate.js';\nimport type { Options, ModuleFormat, JsonReport } from '../types.js';\nimport type { Plugin, ModuleInfo, NormalizedOutputOptions, OutputBundle } from 'rollup';\n\nexport function SondaRollupPlugin( options: Partial<Options> = {} ): Plugin {\n\tlet inputs: JsonReport[ 'inputs' ] = {};\n\n\treturn {\n\t\tname: 'sonda',\n\n\t\twriteBundle(\n\t\t\t{ dir, file }: NormalizedOutputOptions,\n\t\t\tbundle: OutputBundle\n\t\t) {\n\t\t\tconst outputDir = resolve( process.cwd(), dir ?? dirname( file! ) );\n\t\t\tconst assets = Object.keys( bundle ).map( name => join( outputDir, name ) );\n\n\t\t\treturn generateReportFromAssets(\n\t\t\t\tassets,\n\t\t\t\tinputs,\n\t\t\t\toptions\n\t\t\t);\n\t\t},\n\n\t\tmoduleParsed( module: ModuleInfo ) {\n\t\t\tinputs[ normalizePath( module.id ) ] = {\n\t\t\t\tbytes: module.code ? Buffer.byteLength( module.code ) : 0,\n\t\t\t\tformat: getFormat( module.id, module.meta.commonjs?.isCommonJS ),\n\t\t\t\timports: module.importedIds.map( id => normalizePath( id ) ),\n\t\t\t\tbelongsTo: null,\n\t\t\t};\n\t\t}\n\t};\n}\n\nfunction getFormat( moduleId: string, isCommonJS: boolean | undefined ): ModuleFormat {\n\tif ( isCommonJS === true || cjsRegex.test( moduleId ) ) {\n\t\treturn 'cjs';\n\t}\n\n\tif ( isCommonJS === false || jsRegexp.test( moduleId ) ) {\n\t\treturn 'esm';\n\t}\n\n\treturn'unknown';\n}\n","import { join } from 'path';\nimport { normalizePath, jsRegexp } from '../utils';\nimport { generateReportFromAssets } from '../report/generate';\nimport type { Compiler, StatsModule } from 'webpack';\nimport type { Options, ModuleFormat, JsonReport } from '../types';\n\nexport class SondaWebpackPlugin {\n\toptions: Partial<Options>;\n\n\tconstructor ( options: Partial<Options> = {} ) {\n\t\tthis.options = options;\n\t}\n\n\tapply( compiler: Compiler ): void {\n\t\tcompiler.options.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';\n\n\t\tcompiler.hooks.afterEmit.tapPromise( 'SondaWebpackPlugin', compilation => {\n\t\t\tconst inputs: JsonReport[ 'inputs' ] = {};\n\t\t\tconst stats = compilation.getStats().toJson( {\n\t\t\t\tmodules: true,\n\t\t\t\tprovidedExports: true,\n\t\t\t} );\n\n\t\t\tconst outputPath = stats.outputPath || compiler.outputPath;\n\t\t\tconst modules: Array<StatsModule> = stats.modules\n\t\t\t\t?.flatMap( mod => mod.modules ? [ mod, ...mod.modules ] : mod )\n\t\t\t\t.filter( mod => mod.nameForCondition && !mod.codeGenerated )\n\t\t\t\t.filter( ( mod, index, self ) => self.findIndex( m => m.nameForCondition === mod.nameForCondition ) === index )\n\t\t\t\t|| [];\n\n\t\t\tmodules.forEach( module => {\n\t\t\t\tconst imports = modules.reduce( ( acc, { nameForCondition, issuerName, reasons } ) => {\n\t\t\t\t\tif ( issuerName === module.name || reasons?.some( reason => reason.resolvedModule === module.name ) ) {\n\t\t\t\t\t\tacc.push( normalizePath( nameForCondition! ) );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn acc;\n\t\t\t\t}, [] as Array<string> );\n\n\t\t\t\tinputs[ normalizePath( module.nameForCondition! ) ] = {\n\t\t\t\t\tbytes: module.size || 0,\n\t\t\t\t\tformat: getFormat( module ),\n\t\t\t\t\timports,\n\t\t\t\t\tbelongsTo: null\n\t\t\t\t};\n\t\t\t} );\n\n\t\t\treturn generateReportFromAssets(\n\t\t\t\tstats.assets?.map( asset => join( outputPath, asset.name ) ) || [],\n\t\t\t\tinputs,\n\t\t\t\tthis.options\n\t\t\t);\n\t\t} );\n\t}\n}\n\nfunction getFormat( module: StatsModule ): ModuleFormat {\n\tif ( !jsRegexp.test( module.nameForCondition! ) ) {\n\t\treturn 'unknown';\n\t}\n\n\t/**\n\t * Sometimes ESM modules have `moduleType` set as `javascript/auto`, so we\n\t * also need to check if the module has exports to determine if it's ESM.\n\t */\n\tif ( module.moduleType === 'javascript/esm' || !!module.providedExports?.length ) {\n\t\treturn 'esm';\n\t}\n\n\treturn 'cjs';\n}\n"],"names":["parseSourceMapInput","str","JSON","parse","replace","sourceMappingRegExp","loadCodeAndMap","codePath","existsSync","code","readFileSync","extractedComment","includes","Array","from","matchAll","at","length","maybeMap","loadMap","map","mapPath","sources","normalizeSourcesPaths","sourcesContent","loadMissingSourcesContent","sourceRoot","sourceMappingURL","startsWith","parseDataUrl","sourceMapFilename","URL","pathname","join","dirname","url","prefix","payload","split","encoding","Buffer","toString","decodeURIComponent","Error","mapDir","source","isAbsolute","resolve","index","cjsRegex","jsRegexp","normalizeOptions","options","defaultOptions","open","format","detailed","gzip","brotli","Object","assign","normalizePath","pathToNormalize","normalized","relativized","relative","process","cwd","replaceAll","win32","sep","posix","mapSourceMap","dirPath","inputs","alreadyRemapped","Set","remapped","remapping","file","ctx","has","add","codeMap","addSourcesToInputs","content","decodedMappings","path","parentPath","filter","forEach","normalizedPath","bytes","byteLength","imports","belongsTo","UNASSIGNED","getBytesPerSource","assetSizes","contributions","getContributions","codeLines","lineIndex","lineCode","mappings","currentColumn","i","mapping","startColumn","endColumn","set","get","slice","sourceIndex","codeSlice","undefined","sourceSizes","Map","contributionsSum","uncompressed","codeSegment","sizes","getSizes","adjustSizes","gzipSync","brotliCompressSync","asset","sums","gzipDelta","brotliDelta","Math","round","generateJsonReport","assets","acceptedExtensions","outputs","extname","reduce","carry","data","processAsset","sortObjectKeys","generateHtmlReport","json","__dirname","fileURLToPath","template","encodeURIComponent","stringify","maybeCodeMap","hasCodeAndMap","mapped","decode","outputInputs","version","names","result","Boolean","object","keys","sort","key","generateReportFromAssets","userOptions","handler","saveHtml","saveJson","default","report","writeFileSync","SondaEsbuildPlugin","name","setup","build","initialOptions","metafile","onEnd","console","error","entries","acc","SondaRollupPlugin","writeBundle","dir","bundle","outputDir","moduleParsed","module","id","getFormat","meta","commonjs","isCommonJS","importedIds","moduleId","test","SondaWebpackPlugin","apply","compiler","output","devtoolModuleFilenameTemplate","hooks","afterEmit","tapPromise","compilation","stats","getStats","toJson","modules","providedExports","outputPath","flatMap","mod","nameForCondition","codeGenerated","self","findIndex","m","issuerName","reasons","some","reason","resolvedModule","push","size","constructor","moduleType"],"mappings":";;;;;;;;;;AAqBA;;;;;IAMA,SAASA,mBAAAA,CAAqBC,GAAW,EAAA;IACxC,OAAOC,IAAAA,CAAKC,KAAK,CAAEF,GAAIG,CAAAA,OAAO,CAAE,gBAAkB,EAAA,EAAA,CAAA,CAAA;AACnD;AAEA;;;;;;AAMA,GACA,MAAMC,mBAAsB,GAAA,kCAAA;AAErB,SAASC,cAAAA,CAAgBC,QAAgB,EAAA;AAC/C,IAAA,IAAK,CAACC,aAAAA,CAAYD,QAAa,CAAA,EAAA;AAC9B,QAAA,OAAO,IAAA;AACR;AAEA,IAAA,MAAME,IAAAA,GAAOC,eAAAA,CAAcH,QAAU,EAAA,OAAA,CAAA;IAErC,MAAMI,gBAAmBF,GAAAA,IAAAA,CAAKG,QAAQ,CAAE,kBAAA,CAAA,IAAwBC,KAAMC,CAAAA,IAAI,CAAEL,IAAAA,CAAKM,QAAQ,CAAEV,mBAAwBW,CAAAA,CAAAA,CAAAA,EAAE,CAAE,CAAC,CAAA,CAAA;AAExH,IAAA,IAAK,CAACL,gBAAAA,IAAoB,CAACA,gBAAAA,CAAiBM,MAAM,EAAG;QACpD,OAAO;AAAER,YAAAA;SAAK;AACf;IAEA,MAAMS,QAAWC,GAAAA,OAAAA,CAASZ,QAAUI,EAAAA,gBAAgB,CAAE,CAAG,CAAA,CAA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sourcemap/map.ts","../src/sourcemap/bytes.ts","../src/report.ts","../src/report/generate.ts","../src/bundlers/esbuild.ts","../src/bundlers/rollup.ts","../src/bundlers/webpack.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'fs';\nimport { join, dirname, isAbsolute, resolve } from 'path';\n\n/**\n * Strip any JSON XSSI avoidance prefix from the string (as documented in the source maps specification),\n * and parses the string as JSON.\n *\n * https://github.com/mozilla/source-map/blob/3cb92cc3b73bfab27c146bae4ef2bc09dbb4e5ed/lib/util.js#L162-L164\n */ function parseSourceMapInput(str) {\n return JSON.parse(str.replace(/^\\)]}'[^\\n]*\\n/, \"\"));\n}\n/**\n\tsourceMappingURL=data:application/json;charset=utf-8;base64,data\n\tsourceMappingURL=data:application/json;base64,data\n\tsourceMappingURL=data:application/json;uri,data\n\tsourceMappingURL=map-file-comment.css.map\n\tsourceMappingURL=map-file-comment.css.map?query=value\n*/ const sourceMappingRegExp = /[@#]\\s*sourceMappingURL=(\\S+)\\b/g;\nfunction loadCodeAndMap(codePath) {\n if (!existsSync(codePath)) {\n return null;\n }\n const code = readFileSync(codePath, 'utf-8');\n const extractedComment = code.includes('sourceMappingURL') && Array.from(code.matchAll(sourceMappingRegExp)).at(-1);\n if (!extractedComment || !extractedComment.length) {\n return {\n code\n };\n }\n const maybeMap = loadMap(codePath, extractedComment[1]);\n if (!maybeMap) {\n return {\n code\n };\n }\n const { map, mapPath } = maybeMap;\n map.sources = normalizeSourcesPaths(map, mapPath);\n map.sourcesContent = loadMissingSourcesContent(map);\n delete map.sourceRoot;\n return {\n code,\n map\n };\n}\nfunction loadMap(codePath, sourceMappingURL) {\n if (sourceMappingURL.startsWith('data:')) {\n const map = parseDataUrl(sourceMappingURL);\n return {\n map: parseSourceMapInput(map),\n mapPath: codePath\n };\n }\n const sourceMapFilename = new URL(sourceMappingURL, 'file://').pathname;\n const mapPath = join(dirname(codePath), sourceMapFilename);\n if (!existsSync(mapPath)) {\n return null;\n }\n return {\n map: parseSourceMapInput(readFileSync(mapPath, 'utf-8')),\n mapPath\n };\n}\nfunction parseDataUrl(url) {\n const [prefix, payload] = url.split(',');\n const encoding = prefix.split(';').at(-1);\n switch(encoding){\n case 'base64':\n return Buffer.from(payload, 'base64').toString();\n case 'uri':\n return decodeURIComponent(payload);\n default:\n throw new Error('Unsupported source map encoding: ' + encoding);\n }\n}\n/**\n * Normalize the paths of the sources in the source map to be absolute paths.\n */ function normalizeSourcesPaths(map, mapPath) {\n const mapDir = dirname(mapPath);\n return map.sources.map((source)=>{\n if (!source) {\n return source;\n }\n return isAbsolute(source) ? source : resolve(mapDir, map.sourceRoot ?? '.', source);\n });\n}\n/**\n * Loop through the sources and try to load missing `sourcesContent` from the file system.\n */ function loadMissingSourcesContent(map) {\n return map.sources.map((source, index)=>{\n if (map.sourcesContent?.[index]) {\n return map.sourcesContent[index];\n }\n if (source && existsSync(source)) {\n return readFileSync(source, 'utf-8');\n }\n return null;\n });\n}\n\nexport { loadCodeAndMap };\n//# sourceMappingURL=index.js.map\n","import { join, relative, win32, posix, extname, isAbsolute, format, parse } from 'path';\nimport type { Options } from './types';\n\nexport const esmRegex: RegExp = /\\.m[tj]sx?$/;\nexport const cjsRegex: RegExp = /\\.c[tj]sx?$/;\nexport const jsRegexp: RegExp = /\\.[cm]?[tj]s[x]?$/;\n\nexport function normalizeOptions( options?: Partial<Options> ): Options {\n\tconst format = options?.format\n\t\t|| options?.filename?.split( '.' ).at( -1 ) as Options['format']\n\t\t|| 'html';\n\n\tconst defaultOptions: Options = {\n\t\tformat,\n\t\tfilename: 'sonda-report.' + format,\n\t\topen: true,\n\t\tdetailed: false,\n\t\tsources: false,\n\t\tgzip: false,\n\t\tbrotli: false,\n\t};\n\n\t// Merge user options with the defaults\n\tconst normalizedOptions = Object.assign( {}, defaultOptions, options ) satisfies Options;\n\n\tnormalizedOptions.filename = normalizeOutputPath( normalizedOptions );\n\n\treturn normalizedOptions;\n}\n\nexport function normalizePath( pathToNormalize: string ): string {\n\t// Unicode escape sequences used by Rollup and Vite to identify virtual modules\n\tconst normalized = pathToNormalize.replace( /^\\0/, '' )\n\n\t// Transform absolute paths to relative paths\n\tconst relativized = relative( process.cwd(), normalized );\n\n\t// Ensure paths are POSIX-compliant - https://stackoverflow.com/a/63251716/4617687\n\treturn relativized.replaceAll( win32.sep, posix.sep );\n}\n\nfunction normalizeOutputPath( options: Options ): string {\n\tlet path = options.filename;\n\tconst expectedExtension = '.' + options.format;\n\n\t// Ensure the filename is an absolute path\n\tif ( !isAbsolute( path ) ) {\n\t\tpath = join( process.cwd(), path );\n\t}\n\n\t// Ensure that the `filename` extension matches the `format` option\n\tif ( expectedExtension !== extname( path ) ) {\n\t\tconsole.warn(\n\t\t\t'\\x1b[0;33m' + // Make the message yellow\n\t\t\t`Sonda: The file extension specified in the 'filename' does not match the 'format' option. ` +\n\t\t\t`The extension will be changed to '${ expectedExtension }'.`\n\t\t);\n\n\t\tpath = format( { ...parse( path ), base: '', ext: expectedExtension } )\n\t}\n\n\treturn path;\n}\n","import { default as remapping, type DecodedSourceMap, type EncodedSourceMap } from '@ampproject/remapping';\nimport { loadCodeAndMap } from 'load-source-map';\nimport { resolve } from 'path';\nimport { normalizePath } from '../utils';\nimport type { CodeMap, ReportInput } from '../types';\n\nexport function mapSourceMap(\n\tmap: EncodedSourceMap,\n\tdirPath: string,\n\tinputs: Record<string, ReportInput>\n): DecodedSourceMap {\n\tconst alreadyRemapped = new Set<string>();\n\tconst remapped = remapping( map, ( file, ctx ) => {\n\t\tif ( alreadyRemapped.has( file ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\talreadyRemapped.add( file );\n\n\t\tconst codeMap = addSourcesToInputs(\n\t\t\tresolve( dirPath, file ),\n\t\t\tinputs\n\t\t);\n\n\t\tif ( !codeMap ) {\n\t\t\treturn;\n\t\t}\n\n\t\tctx.content ??= codeMap.code;\n\n\t\treturn codeMap.map;\n\t}, { decodedMappings: true } );\n\n\treturn remapped as DecodedSourceMap;\n}\n\n/**\n * Loads the source map of a given file and adds its \"sources\" to the given inputs object.\n */\nexport function addSourcesToInputs(\n\tpath: string,\n\tinputs: Record<string, ReportInput>\n): CodeMap | null {\n\tconst codeMap = loadCodeAndMap( path );\n\n\tif ( !codeMap ) {\n\t\treturn null;\n\t}\n\n\tconst parentPath = normalizePath( path );\n\tconst format = inputs[ parentPath ]?.format ?? 'unknown';\n\n\tcodeMap.map?.sources\n\t\t.filter( source => source !== null )\n\t\t.forEach( ( source, index ) => {\n\t\t\tconst normalizedPath = normalizePath( source );\n\n\t\t\tif ( parentPath === normalizedPath ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tinputs[ normalizedPath ] = {\n\t\t\t\tbytes: Buffer.byteLength( codeMap.map!.sourcesContent?.[ index ] ?? '' ),\n\t\t\t\tformat,\n\t\t\t\timports: [],\n\t\t\t\tbelongsTo: parentPath\n\t\t\t};\n\t\t} );\n\t\n\treturn codeMap;\n}\n","import { gzipSync, brotliCompressSync } from 'zlib';\nimport type { DecodedSourceMap, SourceMapSegment } from '@ampproject/remapping';\nimport type { Options, Sizes } from '../types';\n\nconst UNASSIGNED = '[unassigned]';\n\nexport function getBytesPerSource(\n\tcode: string,\n\tmap: DecodedSourceMap,\n\tassetSizes: Sizes,\n\toptions: Options\n): Map<string, Sizes> {\n\tconst contributions = getContributions( map.sources );\n\n\t// Split the code into lines\n\tconst codeLines = code.split( /(?<=\\r?\\n)/ );\n\n\tfor ( let lineIndex = 0; lineIndex < codeLines.length; lineIndex++ ) {\n\t\tconst lineCode = codeLines[ lineIndex ];\n\t\tconst mappings = map.mappings[ lineIndex ] || [];\n\t\tlet currentColumn = 0;\n\n\t\tfor ( let i = 0; i <= mappings.length; i++ ) {\n\t\t\t// 0: generatedColumn\n\t\t\t// 1: sourceIndex\n\t\t\t// 2: originalLine\n\t\t\t// 3: originalColumn\n\t\t\t// 4: nameIndex\n\n\t\t\tconst mapping: SourceMapSegment | undefined = mappings[ i ];\n\t\t\tconst startColumn = mapping?.[ 0 ] ?? lineCode.length;\n\t\t\tconst endColumn = mappings[ i + 1 ]?.[ 0 ] ?? lineCode.length;\n\n\t\t\t// Slice the code from currentColumn to startColumn for unassigned code\n\t\t\tif ( startColumn > currentColumn ) {\n\t\t\t\tcontributions.set( UNASSIGNED, contributions.get( UNASSIGNED ) + lineCode.slice( currentColumn, startColumn ) );\n\t\t\t}\n\n\t\t\tif ( mapping ) {\n\t\t\t\t// Slice the code from startColumn to endColumn for assigned code\n\t\t\t\tconst sourceIndex = mapping?.[ 1 ];\n\t\t\t\tconst codeSlice = lineCode.slice( startColumn, endColumn );\n\t\t\t\tconst source = sourceIndex !== undefined ? map.sources[ sourceIndex ]! : UNASSIGNED;\n\n\t\t\t\tcontributions.set( source, contributions.get( source ) + codeSlice );\n\t\t\t\tcurrentColumn = endColumn;\n\t\t\t} else {\n\t\t\t\tcurrentColumn = startColumn;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Compute sizes for each source\n\tconst sourceSizes = new Map<string, Sizes>();\n\n\tconst contributionsSum: Sizes = {\n\t\tuncompressed: 0,\n\t\tgzip: 0,\n\t\tbrotli: 0\n\t};\n\n\tfor ( const [ source, codeSegment ] of contributions ) {\n\t\tconst sizes = getSizes( codeSegment, options );\n\n\t\tcontributionsSum.uncompressed += sizes.uncompressed;\n\t\tcontributionsSum.gzip += sizes.gzip;\n\t\tcontributionsSum.brotli += sizes.brotli;\n\n\t\tsourceSizes.set( source, sizes );\n\t}\n\n\treturn adjustSizes( sourceSizes, assetSizes, contributionsSum, options );\n}\n\nexport function getSizes(\n\tcode: string,\n\toptions: Options\n): Sizes {\n\treturn {\n\t\tuncompressed: Buffer.byteLength( code ),\n\t\tgzip: options.gzip ? gzipSync( code ).length : 0,\n\t\tbrotli: options.brotli ? brotliCompressSync( code ).length : 0\n\t};\n}\n\nfunction getContributions( sources: Array<string | null> ): Map<string, string> {\n\tconst contributions = new Map<string, string>();\n\n\t// Populate contributions with sources\n\tsources\n\t\t.filter( source => source !== null )\n\t\t.forEach( source => contributions.set( source, '' ) );\n\n\t// Add entry for the code that is not assigned to any source\n\tcontributions.set( UNASSIGNED, '' );\n\n\treturn contributions;\n}\n\n/**\n * Compression efficiency improves with the size of the file.\n *\n * However, what we have is the compressed size of the entire bundle (`actual`),\n * the sum of all files compressed individually (`sum`) and the compressed\n * size of a given file (`content`). The last value is essentially a “worst-case”\n * scenario, and the actual size of the file in the bundle is likely to be smaller.\n *\n * We use this information to estimate the actual size of the file in the bundle\n * after compression.\n */\nfunction adjustSizes(\n\tsources: Map<string, Sizes>,\n\tasset: Sizes,\n\tsums: Sizes,\n\toptions: Options\n): Map<string, Sizes> {\n\tconst gzipDelta = options.gzip ? asset.gzip / sums.gzip : 0;\n\tconst brotliDelta = options.brotli ? asset.brotli / sums.brotli : 0;\n\n\tfor ( const [ source, sizes ] of sources ) {\n\t\tsources.set( source, {\n\t\t\tuncompressed: sizes.uncompressed,\n\t\t\tgzip: options.gzip ? Math.round( sizes.gzip * gzipDelta ) : 0,\n\t\t\tbrotli: options.brotli ? Math.round( sizes.brotli * brotliDelta ) : 0\n\t\t} );\n\t}\n\n\treturn sources;\n}\n","import { readFileSync } from 'fs';\nimport { fileURLToPath } from 'url';\nimport { dirname, extname, resolve } from 'path';\nimport { loadCodeAndMap } from 'load-source-map';\nimport { decode } from '@jridgewell/sourcemap-codec';\nimport { mapSourceMap } from './sourcemap/map.js';\nimport { getBytesPerSource, getSizes } from './sourcemap/bytes.js';\nimport type {\n JsonReport,\n MaybeCodeMap,\n ReportInput,\n ReportOutput,\n CodeMap,\n ReportOutputInput,\n Options\n} from './types.js';\nimport { normalizePath } from './utils.js';\n\nexport function generateJsonReport(\n assets: Array<string>,\n inputs: Record<string, ReportInput>,\n options: Options\n): JsonReport {\n const acceptedExtensions = [ '.js', '.css' ];\n\n const outputs = assets\n .filter( asset => acceptedExtensions.includes( extname( asset ) ) )\n .reduce( ( carry, asset ) => {\n const data = processAsset( asset, inputs, options );\n\n if ( data ) {\n carry[ normalizePath( asset ) ] = data;\n }\n\n return carry;\n }, {} as Record<string, ReportOutput> );\n\n return {\n inputs: sortObjectKeys( inputs ),\n outputs: sortObjectKeys( outputs )\n };\n}\n\nexport function generateHtmlReport(\n assets: Array<string>,\n inputs: Record<string, ReportInput>,\n options: Options\n): string {\n const json = generateJsonReport( assets, inputs, options );\n const __dirname = dirname( fileURLToPath( import.meta.url ) );\n const template = readFileSync( resolve( __dirname, './index.html' ), 'utf-8' );\n\n return template.replace( '__REPORT_DATA__', encodeURIComponent( JSON.stringify( json ) ) );\n}\n\nfunction processAsset(\n asset: string,\n inputs: Record<string, ReportInput>,\n options: Options\n): ReportOutput | void {\n const maybeCodeMap = loadCodeAndMap( asset );\n\n if ( !hasCodeAndMap( maybeCodeMap ) ) {\n return;\n }\n\n const { code, map } = maybeCodeMap;\n const mapped = options.detailed\n ? mapSourceMap( map, dirname( asset ), inputs )\n : { ...map, mappings: decode( map.mappings ) };\n\n mapped.sources = mapped.sources.map( source => normalizePath( source! ) );\n\n const assetSizes = getSizes( code, options );\n const bytes = getBytesPerSource( code, mapped, assetSizes, options );\n const outputInputs = Array\n .from( bytes )\n .reduce( ( carry, [ source, sizes ] ) => {\n carry[ normalizePath( source ) ] = sizes;\n\n return carry;\n }, {} as Record<string, ReportOutputInput> );\n\n return {\n ...assetSizes,\n inputs: sortObjectKeys( outputInputs ),\n map: options.sources ? {\n version: 3,\n names: [],\n mappings: mapped.mappings,\n sources: mapped.sources,\n sourcesContent: mapped.sourcesContent,\n } : undefined\n };\n}\n\nfunction hasCodeAndMap( result: MaybeCodeMap ): result is Required<CodeMap> {\n return Boolean( result && result.code && result.map );\n}\n\nfunction sortObjectKeys<T extends unknown>( object: Record<string, T> ): Record<string, T> {\n return Object\n .keys( object )\n .sort()\n .reduce( ( carry, key ) => {\n carry[ key ] = object[ key ];\n\n return carry;\n }, {} as Record<string, T> );\n} \n","import { dirname } from 'path';\nimport { existsSync, mkdirSync, writeFileSync } from 'fs';\nimport { generateHtmlReport, generateJsonReport } from '../report.js';\nimport type { Options, JsonReport } from '../types.js';\nimport { normalizeOptions } from '../utils.js';\n\nexport async function generateReportFromAssets(\n\tassets: string[],\n\tinputs: JsonReport[ 'inputs' ],\n\tuserOptions: Partial<Options>\n): Promise<void> {\n\tconst options = normalizeOptions( userOptions );\n\tconst handler = options.format === 'html' ? saveHtml : saveJson;\n\tconst report = handler( assets, inputs, options );\n\tconst outputDirectory = dirname( options.filename );\n\n\t// Ensure the output directory exists\n\tif ( !existsSync( outputDirectory ) ) {\n\t\tmkdirSync( outputDirectory, { recursive: true } );\n\t}\n\n\t// Write the report to the file system\n\twriteFileSync( options.filename, report );\n\n\tif ( !options.open ) {\n\t\treturn;\n\t}\n\n\t/**\n\t * `open` is ESM-only package, so we need to import it\n\t * dynamically to make it work in CommonJS environment.\n\t */\n\tconst { default: open } = await import( 'open' );\n\n\t// Open the report in the default program for the file extension\n\topen( options.filename );\n}\n\nfunction saveHtml(\n\tassets: string[],\n\tinputs: JsonReport[ 'inputs' ],\n\toptions: Options\n): string {\n\treturn generateHtmlReport( assets, inputs, options );\n}\n\nfunction saveJson(\n\tassets: string[],\n\tinputs: JsonReport[ 'inputs' ],\n\toptions: Options\n): string {\n\tconst report = generateJsonReport( assets, inputs, options );\n\n\treturn JSON.stringify( report, null, 2 );\n}\n","import { resolve } from 'path';\nimport { addSourcesToInputs } from '../sourcemap/map';\nimport { generateReportFromAssets } from '../report/generate';\nimport type { Plugin } from 'esbuild';\nimport type { Options, JsonReport } from '../types';\n\nexport function SondaEsbuildPlugin( options: Partial<Options> = {} ): Plugin {\n\treturn {\n\t\tname: 'sonda',\n\t\tsetup( build ) {\n\t\t\tbuild.initialOptions.metafile = true;\n\n\t\t\t// Esbuild already reads the existing source maps, so there's no need to do it again\n\t\t\toptions.detailed = false;\n\n\t\t\tbuild.onEnd( result => {\n\t\t\t\tif ( !result.metafile ) {\n\t\t\t\t\treturn console.error( 'Metafile is required for SondaEsbuildPlugin to work.' );\n\t\t\t\t}\n\n\t\t\t\tconst cwd = process.cwd();\n\t\t\t\tconst inputs = Object\n\t\t\t\t\t.entries( result.metafile.inputs )\n\t\t\t\t\t.reduce( ( acc, [ path, data ] ) => {\n\t\t\t\t\t\tacc[ path ] = {\n\t\t\t\t\t\t\tbytes: data.bytes,\n\t\t\t\t\t\t\tformat: data.format ?? 'unknown',\n\t\t\t\t\t\t\timports: data.imports.map( data => data.path ),\n\t\t\t\t\t\t\tbelongsTo: null,\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Because esbuild already reads the existing source maps, there may be\n\t\t\t\t\t\t * cases where some report \"outputs\" include \"inputs\" don't exist in the\n\t\t\t\t\t\t * main \"inputs\" object. To avoid this, we parse each esbuild input and\n\t\t\t\t\t\t * add its sources to the \"inputs\" object.\n\t\t\t\t\t\t */\n\t\t\t\t\t\taddSourcesToInputs(\n\t\t\t\t\t\t\tresolve( cwd, path ),\n\t\t\t\t\t\t\tacc\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t}, {} as JsonReport[ 'inputs' ] );\n\n\t\t\t\treturn generateReportFromAssets(\n\t\t\t\t\tObject.keys( result.metafile.outputs ).map( path => resolve( cwd, path ) ),\n\t\t\t\t\tinputs,\n\t\t\t\t\toptions\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\t};\n}\n","import { join, resolve, dirname } from 'path';\nimport { normalizePath, cjsRegex, jsRegexp } from '../utils.js';\nimport { generateReportFromAssets } from '../report/generate.js';\nimport type { Options, ModuleFormat, JsonReport } from '../types.js';\nimport type { Plugin, ModuleInfo, NormalizedOutputOptions, OutputBundle } from 'rollup';\n\nexport function SondaRollupPlugin( options: Partial<Options> = {} ): Plugin {\n\tlet inputs: JsonReport[ 'inputs' ] = {};\n\n\treturn {\n\t\tname: 'sonda',\n\n\t\twriteBundle(\n\t\t\t{ dir, file }: NormalizedOutputOptions,\n\t\t\tbundle: OutputBundle\n\t\t) {\n\t\t\tconst outputDir = resolve( process.cwd(), dir ?? dirname( file! ) );\n\t\t\tconst assets = Object.keys( bundle ).map( name => join( outputDir, name ) );\n\n\t\t\treturn generateReportFromAssets(\n\t\t\t\tassets,\n\t\t\t\tinputs,\n\t\t\t\toptions\n\t\t\t);\n\t\t},\n\n\t\tmoduleParsed( module: ModuleInfo ) {\n\t\t\tinputs[ normalizePath( module.id ) ] = {\n\t\t\t\tbytes: module.code ? Buffer.byteLength( module.code ) : 0,\n\t\t\t\tformat: getFormat( module.id, module.meta.commonjs?.isCommonJS ),\n\t\t\t\timports: module.importedIds.map( id => normalizePath( id ) ),\n\t\t\t\tbelongsTo: null,\n\t\t\t};\n\t\t}\n\t};\n}\n\nfunction getFormat( moduleId: string, isCommonJS: boolean | undefined ): ModuleFormat {\n\tif ( isCommonJS === true || cjsRegex.test( moduleId ) ) {\n\t\treturn 'cjs';\n\t}\n\n\tif ( isCommonJS === false || jsRegexp.test( moduleId ) ) {\n\t\treturn 'esm';\n\t}\n\n\treturn'unknown';\n}\n","import { join } from 'path';\nimport { normalizePath, jsRegexp } from '../utils';\nimport { generateReportFromAssets } from '../report/generate';\nimport type { Compiler, StatsModule } from 'webpack';\nimport type { Options, ModuleFormat, JsonReport } from '../types';\n\nexport class SondaWebpackPlugin {\n\toptions: Partial<Options>;\n\n\tconstructor ( options: Partial<Options> = {} ) {\n\t\tthis.options = options;\n\t}\n\n\tapply( compiler: Compiler ): void {\n\t\tcompiler.options.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';\n\n\t\tcompiler.hooks.afterEmit.tapPromise( 'SondaWebpackPlugin', compilation => {\n\t\t\tconst inputs: JsonReport[ 'inputs' ] = {};\n\t\t\tconst stats = compilation.getStats().toJson( {\n\t\t\t\tmodules: true,\n\t\t\t\tprovidedExports: true,\n\t\t\t} );\n\n\t\t\tconst outputPath = stats.outputPath || compiler.outputPath;\n\t\t\tconst modules: Array<StatsModule> = stats.modules\n\t\t\t\t?.flatMap( mod => mod.modules ? [ mod, ...mod.modules ] : mod )\n\t\t\t\t.filter( mod => mod.nameForCondition && !mod.codeGenerated )\n\t\t\t\t.filter( ( mod, index, self ) => self.findIndex( m => m.nameForCondition === mod.nameForCondition ) === index )\n\t\t\t\t|| [];\n\n\t\t\tmodules.forEach( module => {\n\t\t\t\tconst imports = modules.reduce( ( acc, { nameForCondition, issuerName, reasons } ) => {\n\t\t\t\t\tif ( issuerName === module.name || reasons?.some( reason => reason.resolvedModule === module.name ) ) {\n\t\t\t\t\t\tacc.push( normalizePath( nameForCondition! ) );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn acc;\n\t\t\t\t}, [] as Array<string> );\n\n\t\t\t\tinputs[ normalizePath( module.nameForCondition! ) ] = {\n\t\t\t\t\tbytes: module.size || 0,\n\t\t\t\t\tformat: getFormat( module ),\n\t\t\t\t\timports,\n\t\t\t\t\tbelongsTo: null\n\t\t\t\t};\n\t\t\t} );\n\n\t\t\treturn generateReportFromAssets(\n\t\t\t\tstats.assets?.map( asset => join( outputPath, asset.name ) ) || [],\n\t\t\t\tinputs,\n\t\t\t\tthis.options\n\t\t\t);\n\t\t} );\n\t}\n}\n\nfunction getFormat( module: StatsModule ): ModuleFormat {\n\tif ( !jsRegexp.test( module.nameForCondition! ) ) {\n\t\treturn 'unknown';\n\t}\n\n\t/**\n\t * Sometimes ESM modules have `moduleType` set as `javascript/auto`, so we\n\t * also need to check if the module has exports to determine if it's ESM.\n\t */\n\tif ( module.moduleType === 'javascript/esm' || !!module.providedExports?.length ) {\n\t\treturn 'esm';\n\t}\n\n\treturn 'cjs';\n}\n"],"names":["parseSourceMapInput","str","JSON","parse","replace","sourceMappingRegExp","loadCodeAndMap","codePath","existsSync","code","readFileSync","extractedComment","includes","Array","from","matchAll","at","length","maybeMap","loadMap","map","mapPath","sources","normalizeSourcesPaths","sourcesContent","loadMissingSourcesContent","sourceRoot","sourceMappingURL","startsWith","parseDataUrl","sourceMapFilename","URL","pathname","join","dirname","url","prefix","payload","split","encoding","Buffer","toString","decodeURIComponent","Error","mapDir","source","isAbsolute","resolve","index","cjsRegex","jsRegexp","normalizeOptions","options","format","filename","defaultOptions","open","detailed","gzip","brotli","normalizedOptions","Object","assign","normalizeOutputPath","normalizePath","pathToNormalize","normalized","relativized","relative","process","cwd","replaceAll","win32","sep","posix","path","expectedExtension","extname","console","warn","base","ext","mapSourceMap","dirPath","inputs","alreadyRemapped","Set","remapped","remapping","file","ctx","has","add","codeMap","addSourcesToInputs","content","decodedMappings","parentPath","filter","forEach","normalizedPath","bytes","byteLength","imports","belongsTo","UNASSIGNED","getBytesPerSource","assetSizes","contributions","getContributions","codeLines","lineIndex","lineCode","mappings","currentColumn","i","mapping","startColumn","endColumn","set","get","slice","sourceIndex","codeSlice","undefined","sourceSizes","Map","contributionsSum","uncompressed","codeSegment","sizes","getSizes","adjustSizes","gzipSync","brotliCompressSync","asset","sums","gzipDelta","brotliDelta","Math","round","generateJsonReport","assets","acceptedExtensions","outputs","reduce","carry","data","processAsset","sortObjectKeys","generateHtmlReport","json","__dirname","fileURLToPath","template","encodeURIComponent","stringify","maybeCodeMap","hasCodeAndMap","mapped","decode","outputInputs","version","names","result","Boolean","object","keys","sort","key","generateReportFromAssets","userOptions","handler","saveHtml","saveJson","report","outputDirectory","mkdirSync","recursive","writeFileSync","default","SondaEsbuildPlugin","name","setup","build","initialOptions","metafile","onEnd","error","entries","acc","SondaRollupPlugin","writeBundle","dir","bundle","outputDir","moduleParsed","module","id","getFormat","meta","commonjs","isCommonJS","importedIds","moduleId","test","SondaWebpackPlugin","apply","compiler","output","devtoolModuleFilenameTemplate","hooks","afterEmit","tapPromise","compilation","stats","getStats","toJson","modules","providedExports","outputPath","flatMap","mod","nameForCondition","codeGenerated","self","findIndex","m","issuerName","reasons","some","reason","resolvedModule","push","size","constructor","moduleType"],"mappings":";;;;;;;;;;AAqBA;;;;;IAMA,SAASA,mBAAAA,CAAqBC,GAAW,EAAA;IACxC,OAAOC,IAAAA,CAAKC,KAAK,CAAEF,G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