sonda 0.1.3 → 0.2.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/CHANGELOG.md CHANGED
@@ -1,17 +1,51 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0
4
+
5
+ Besides the new features listed below, this release changes some default behaviors. Now, sonda will not read external source maps or calculate file sizes after compression with GZIP and Brotli. If you want to use these features, use the following new configuration options:
6
+
7
+ ```json
8
+ {
9
+ "detailed": true,
10
+ "gzip": true,
11
+ "brotli": true
12
+ }
13
+ ```
14
+
15
+ Please refer to README.md for more information.
16
+
17
+ ### Minor Changes
18
+
19
+ - Add switch to toggle between uncompressed, GZIP, and Brotli treemap diagrams.
20
+ - Do not read dependency source maps by default. Use the `detailed` configuration option to read them.
21
+ - Update modal for assets to display how much code comes from ESM, CJS, or unknown sources.
22
+ - Improve GZIP and Brotli compression size estimations instead of showing worst-case sizes.
23
+ - Add modal for assets that displays the bundled, GZIP, and Brotli sizes.
24
+ - Update modal for assets to list external dependencies.
25
+ - Do not calculate GZIP and Brotli sizes by default. Use the `gzip` and `brotli` configuration options to calculate them.
26
+
27
+ ### Patch Changes
28
+
29
+ - Correctly load source maps when `sourceMappingURL` contains URL params.
30
+ - Remove unnecessary `#__PURE__` comments.
31
+
32
+ ## 0.1.4
33
+
34
+ - Show "No data to display" with a helpful message when there is no data to display in the report.
35
+ - Prevent black boxes in tree maps with large `[unassigned]` tiles.
36
+
3
37
  ## 0.1.3
4
38
 
5
- Show the approximate file and folder size after GZIP and Brotli compression.
39
+ - Show the approximate file and folder size after GZIP and Brotli compression
6
40
 
7
41
  ## 0.1.2
8
42
 
9
- Use the `open` package to open the generated reports.
43
+ - Use the `open` package to open the generated reports.
10
44
 
11
45
  ## 0.1.1
12
46
 
13
- Use `execFileSync` instead of `exec` to prevent potential shell injection when the path contains characters that the shell interprets in a special way, for instance quotes and spaces.
47
+ - Use `execFileSync` instead of `exec` to prevent potential shell injection when the path contains characters that the shell interprets in a special way, for instance quotes and spaces.
14
48
 
15
49
  ## 0.1.0
16
50
 
17
- Initial release of sonda that allowed generating an `'html'` and `'json'` report for bundles generated by Vite, Rollup, Webpack, and esbuild.
51
+ - Initial release of sonda that allowed generating an `'html'` and `'json'` report for bundles generated by Vite, Rollup, Webpack, and esbuild.
package/README.md CHANGED
@@ -9,6 +9,8 @@ Sonda works with the following bundlers:
9
9
  * esbuild
10
10
  * webpack
11
11
 
12
+ ![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)
13
+
12
14
  ## Installation
13
15
 
14
16
  Start by installing the package:
@@ -19,7 +21,8 @@ npm install sonda --save-dev
19
21
 
20
22
  Then register the bundler-specific plugin and enable the source maps. **Remember to use Sonda in development mode only**.
21
23
 
22
- ### Vite
24
+ <details>
25
+ <summary>Vite</summary>
23
26
 
24
27
  ```javascript
25
28
  // vite.config.js
@@ -37,7 +40,10 @@ export default defineConfig( {
37
40
  } );
38
41
  ```
39
42
 
40
- ### Rollup
43
+ </details>
44
+
45
+ <details>
46
+ <summary>Rollup</summary>
41
47
 
42
48
  ```javascript
43
49
  // rollup.config.js
@@ -46,13 +52,13 @@ import { defineConfig } from 'rollup';
46
52
  import { SondaRollupPlugin } from 'sonda';
47
53
 
48
54
  export default defineConfig( {
49
- output: {
50
- // Other options are skipped for brevity
51
- sourcemap: true,
52
- },
53
- plugins: [
54
- SondaRollupPlugin(),
55
- ]
55
+ output: {
56
+ // Other options are skipped for brevity
57
+ sourcemap: true,
58
+ },
59
+ plugins: [
60
+ SondaRollupPlugin(),
61
+ ]
56
62
  } );
57
63
  ```
58
64
 
@@ -68,23 +74,29 @@ styles( {
68
74
  } )
69
75
  ```
70
76
 
71
- ### esbuild
77
+ </details>
78
+
79
+ <details>
80
+ <summary>esbuild</summary>
72
81
 
73
82
  ```javascript
74
83
  import { build } from 'esbuild';
75
84
  import { SondaEsbuildPlugin } from 'sonda';
76
85
 
77
86
  build( {
78
- sourcemap: true,
79
- plugins: [
80
- SondaEsbuildPlugin()
81
- ]
87
+ sourcemap: true,
88
+ plugins: [
89
+ SondaEsbuildPlugin()
90
+ ]
82
91
  } );
83
92
  ```
84
93
 
85
94
  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`).
86
95
 
87
- ### webpack
96
+ </details>
97
+
98
+ <details>
99
+ <summary>webpack</summary>
88
100
 
89
101
  ```javascript
90
102
  // webpack.config.js
@@ -101,9 +113,20 @@ module.exports = {
101
113
 
102
114
  Internally, Sonda changes the default webpack configuration to output relative paths in the source maps instead of using the `webpack://` protocol (`devtoolModuleFilenameTemplate: '[absolute-resource-path]'`).
103
115
 
116
+ </details>
117
+
104
118
  ## Options
105
119
 
106
- Each plugin accepts an optional configuration object. The following options are available.
120
+ Each plugin accepts an optional configuration object with the following options. Example:
121
+
122
+ ```javascript
123
+ SondaRollupPlugin( {
124
+ format: 'html',
125
+ open: true,
126
+ gzip: true,
127
+ brotli: true,
128
+ } )
129
+ ```
107
130
 
108
131
  ### `format`
109
132
 
@@ -121,3 +144,25 @@ The format of the output. The following formats are supported:
121
144
  * **Default:** `true`
122
145
 
123
146
  Whether to open the report in the default program for given file extension (`.html` or `.json` depending on the `format` option) after the build.
147
+
148
+ ### `gzip`
149
+
150
+ * **Type:** `boolean`
151
+ * **Default:** `false`
152
+
153
+ Whether to calculate the sizes of assets after compression with GZIP.
154
+
155
+ The report will also include the estimated compressed sizes of the individual files that make up each asset. However, unlike the compressed size of the entire asset, the estimates for individual files are not completely accurate and should only be used as a reference.
156
+
157
+ Enabling this option will increase the time it takes to generate the report.
158
+
159
+ ### `brotli`
160
+
161
+ * **Type:** `boolean`
162
+ * **Default:** `false`
163
+
164
+ Whether to calculate the sizes of assets after compression with Brotli.
165
+
166
+ The report will also include the estimated compressed sizes of the individual files that make up each asset. However, unlike the compressed size of the entire asset, the estimates for individual files are not completely accurate and should only be used as a reference.
167
+
168
+ Enabling this option will increase the time it takes to generate the report.
package/dist/index.cjs CHANGED
@@ -7,11 +7,14 @@ var remapping = require('@ampproject/remapping');
7
7
  var zlib = require('zlib');
8
8
 
9
9
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
10
- const cwd = /* #__ PURE__ */ process.cwd();
10
+ const cwd = /* #__PURE__ */ process.cwd();
11
11
  function normalizeOptions(options) {
12
12
  const defaultOptions = {
13
13
  open: true,
14
- format: 'html'
14
+ format: 'html',
15
+ detailed: false,
16
+ gzip: false,
17
+ brotli: false
15
18
  };
16
19
  return Object.assign({}, defaultOptions, options);
17
20
  }
@@ -34,9 +37,10 @@ function normalizePath(path$1) {
34
37
  }
35
38
  /**
36
39
  sourceMappingURL=data:application/json;charset=utf-8;base64,data
37
- sourceMappingURL=data:application/json;base64,data
40
+ sourceMappingURL=data:application/json;base64,data
38
41
  sourceMappingURL=data:application/json;uri,data
39
42
  sourceMappingURL=map-file-comment.css.map
43
+ sourceMappingURL=map-file-comment.css.map?query=value
40
44
  */ const sourceMappingRegExp = /[@#]\s*sourceMappingURL=(\S+)\b/g;
41
45
  function loadCodeAndMap(codePath) {
42
46
  if (!fs.existsSync(codePath)) {
@@ -71,7 +75,8 @@ function loadMap(codePath, sourceMappingURL) {
71
75
  mapPath: codePath
72
76
  };
73
77
  }
74
- const mapPath = path.join(codePath, '..', sourceMappingURL);
78
+ const sourceMapFilename = new URL(sourceMappingURL, 'file://').pathname;
79
+ const mapPath = path.join(path.dirname(codePath), sourceMapFilename);
75
80
  if (!fs.existsSync(mapPath)) {
76
81
  return null;
77
82
  }
@@ -102,7 +107,7 @@ function normalizeSourcesPaths(map, mapPath) {
102
107
  });
103
108
  }
104
109
 
105
- function mapSourceMap(map, dirPath, inputs) {
110
+ function mapSourceMap(map, dirPath, inputs, options) {
106
111
  const alreadyRemapped = new Set();
107
112
  const remapped = remapping(map, (file, ctx)=>{
108
113
  var _ctx;
@@ -114,8 +119,11 @@ function mapSourceMap(map, dirPath, inputs) {
114
119
  if (!codeMap) {
115
120
  return;
116
121
  }
122
+ if (!options.detailed) {
123
+ return null;
124
+ }
117
125
  const parentPath = normalizePath(file);
118
- const { format } = inputs[parentPath];
126
+ const format = inputs[parentPath]?.format ?? 'unknown';
119
127
  codeMap.map?.sources.filter((source)=>source !== null).forEach((source, index)=>{
120
128
  const normalizedPath = normalizePath(source);
121
129
  if (parentPath === normalizedPath) {
@@ -136,75 +144,130 @@ function mapSourceMap(map, dirPath, inputs) {
136
144
  return remapped;
137
145
  }
138
146
 
139
- function getBytesPerSource(code, map) {
140
- const contributions = new Array(map.sources.length).fill('');
141
- // Split the source code by lines
147
+ const UNASSIGNED = '[unassigned]';
148
+ function getBytesPerSource(code, map, assetSizes, options) {
149
+ const contributions = getContributions(map.sources);
150
+ // Split the code into lines
142
151
  const codeLines = code.split(RegExp("(?<=\\r?\\n)"));
143
- for(let lineIndex = 0; lineIndex < map.mappings.length; lineIndex++){
144
- const line = map.mappings[lineIndex];
152
+ for(let lineIndex = 0; lineIndex < codeLines.length; lineIndex++){
145
153
  const lineCode = codeLines[lineIndex];
146
- for(let mappingIndex = 0; mappingIndex < line.length; mappingIndex++){
154
+ const mappings = map.mappings[lineIndex] || [];
155
+ let currentColumn = 0;
156
+ for(let i = 0; i <= mappings.length; i++){
147
157
  // 0: generatedColumn
148
- // 1: fileIndex
158
+ // 1: sourceIndex
149
159
  // 2: originalLine
150
160
  // 3: originalColumn
151
161
  // 4: nameIndex
152
- const [startColumn, fileIndex] = line[mappingIndex];
153
- const endColumn = line[mappingIndex + 1]?.[0] ?? lineCode.length;
154
- contributions[fileIndex] += lineCode.slice(startColumn, endColumn);
162
+ const mapping = mappings[i];
163
+ const startColumn = mapping?.[0] ?? lineCode.length;
164
+ const endColumn = mappings[i + 1]?.[0] ?? lineCode.length;
165
+ // Slice the code from currentColumn to startColumn for unassigned code
166
+ if (startColumn > currentColumn) {
167
+ contributions.set(UNASSIGNED, contributions.get(UNASSIGNED) + lineCode.slice(currentColumn, startColumn));
168
+ }
169
+ if (mapping) {
170
+ // Slice the code from startColumn to endColumn for assigned code
171
+ const sourceIndex = mapping?.[1];
172
+ const codeSlice = lineCode.slice(startColumn, endColumn);
173
+ const source = sourceIndex !== undefined ? map.sources[sourceIndex] : UNASSIGNED;
174
+ contributions.set(source, contributions.get(source) + codeSlice);
175
+ currentColumn = endColumn;
176
+ } else {
177
+ currentColumn = startColumn;
178
+ }
155
179
  }
156
180
  }
157
- return new Map(contributions.map((code, index)=>[
158
- map.sources[index],
159
- getSizes(code)
160
- ]));
181
+ // Compute sizes for each source
182
+ const sourceSizes = new Map();
183
+ const contributionsSum = {
184
+ uncompressed: 0,
185
+ gzip: 0,
186
+ brotli: 0
187
+ };
188
+ for (const [source, codeSegment] of contributions){
189
+ const sizes = getSizes(codeSegment, options);
190
+ contributionsSum.uncompressed += sizes.uncompressed;
191
+ contributionsSum.gzip += sizes.gzip;
192
+ contributionsSum.brotli += sizes.brotli;
193
+ sourceSizes.set(source, sizes);
194
+ }
195
+ return adjustSizes(sourceSizes, assetSizes, contributionsSum, options);
161
196
  }
162
- function getSizes(code) {
197
+ function getSizes(code, options) {
163
198
  return {
164
199
  uncompressed: Buffer.byteLength(code),
165
- gzip: zlib.gzipSync(code).length,
166
- brotli: zlib.brotliCompressSync(code).length
200
+ gzip: options.gzip ? zlib.gzipSync(code).length : 0,
201
+ brotli: options.brotli ? zlib.brotliCompressSync(code).length : 0
167
202
  };
168
203
  }
204
+ function getContributions(sources) {
205
+ const contributions = new Map();
206
+ // Populate contributions with sources
207
+ sources.filter((source)=>source !== null).forEach((source)=>contributions.set(source, ''));
208
+ // Add entry for the code that is not assigned to any source
209
+ contributions.set(UNASSIGNED, '');
210
+ return contributions;
211
+ }
212
+ /**
213
+ * Compression efficiency improves with the size of the file.
214
+ *
215
+ * However, what we have is the compressed size of the entire bundle (`actual`),
216
+ * the sum of all files compressed individually (`sum`) and the compressed
217
+ * size of a given file (`content`). The last value is essentially a “worst-case”
218
+ * scenario, and the actual size of the file in the bundle is likely to be smaller.
219
+ *
220
+ * We use this information to estimate the actual size of the file in the bundle
221
+ * after compression.
222
+ */ function adjustSizes(sources, asset, sums, options) {
223
+ const gzipDelta = options.gzip ? asset.gzip / sums.gzip : 0;
224
+ const brotliDelta = options.brotli ? asset.brotli / sums.brotli : 0;
225
+ for (const [source, sizes] of sources){
226
+ sources.set(source, {
227
+ uncompressed: sizes.uncompressed,
228
+ gzip: options.gzip ? Math.round(sizes.gzip * gzipDelta) : 0,
229
+ brotli: options.brotli ? Math.round(sizes.brotli * brotliDelta) : 0
230
+ });
231
+ }
232
+ return sources;
233
+ }
169
234
 
170
- function generateJsonReport(assets, inputs) {
171
- const outputsEntries = assets.filter((asset)=>!asset.endsWith('.map')).map((asset)=>processAsset(asset, inputs)).filter((output)=>!!output);
235
+ function generateJsonReport(assets, inputs, options) {
236
+ const outputs = assets.filter((asset)=>!asset.endsWith('.map')).reduce((carry, asset)=>{
237
+ const data = processAsset(asset, inputs, options);
238
+ if (data) {
239
+ carry[normalizePath(asset)] = data;
240
+ }
241
+ return carry;
242
+ }, {});
172
243
  return {
173
244
  inputs,
174
- outputs: Object.fromEntries(outputsEntries)
245
+ outputs
175
246
  };
176
247
  }
177
- function generateHtmlReport(assets, inputs) {
178
- const json = generateJsonReport(assets, inputs);
179
- const __dirname = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
248
+ function generateHtmlReport(assets, inputs, options) {
249
+ const json = generateJsonReport(assets, inputs, options);
250
+ const __dirname = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
180
251
  const template = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf-8');
181
252
  return template.replace('__REPORT_DATA__', JSON.stringify(json));
182
253
  }
183
- function processAsset(asset, inputs) {
254
+ function processAsset(asset, inputs, options) {
184
255
  const maybeCodeMap = loadCodeAndMap(asset);
185
256
  if (!hasCodeAndMap(maybeCodeMap)) {
186
257
  return;
187
258
  }
188
259
  const { code, map } = maybeCodeMap;
189
- const mapped = mapSourceMap(map, path.dirname(asset), inputs);
260
+ const mapped = mapSourceMap(map, path.dirname(asset), inputs, options);
190
261
  mapped.sources = mapped.sources.map((source)=>normalizePath(source));
191
- const bytes = getBytesPerSource(code, mapped);
192
- return [
193
- normalizePath(asset),
194
- {
195
- ...getSizes(code),
196
- inputs: mapped.sources.reduce((acc, source)=>{
197
- if (source) {
198
- acc[normalizePath(source)] = bytes.get(source) ?? {
199
- uncompressed: 0,
200
- gzip: 0,
201
- brotli: 0
202
- };
203
- }
204
- return acc;
205
- }, {})
206
- }
207
- ];
262
+ const assetSizes = getSizes(code, options);
263
+ const bytes = getBytesPerSource(code, mapped, assetSizes, options);
264
+ return {
265
+ ...assetSizes,
266
+ inputs: Array.from(bytes).reduce((carry, [source, sizes])=>{
267
+ carry[normalizePath(source)] = sizes;
268
+ return carry;
269
+ }, {})
270
+ };
208
271
  }
209
272
  function hasCodeAndMap(result) {
210
273
  return Boolean(result && result.code && result.map);
@@ -213,17 +276,17 @@ function hasCodeAndMap(result) {
213
276
  async function generateReportFromAssets(assets, inputs, options) {
214
277
  const { default: open } = await import('open');
215
278
  const handler = options.format === 'html' ? saveHtml : saveJson;
216
- const path = handler(assets, inputs);
279
+ const path = handler(assets, inputs, options);
217
280
  options.open && path && open(path);
218
281
  }
219
- function saveHtml(assets, inputs) {
220
- const report = generateHtmlReport(assets, inputs);
282
+ function saveHtml(assets, inputs, options) {
283
+ const report = generateHtmlReport(assets, inputs, options);
221
284
  const path$1 = path.join(process.cwd(), 'sonda-report.html');
222
285
  fs.writeFileSync(path$1, report);
223
286
  return path$1;
224
287
  }
225
- function saveJson(assets, inputs) {
226
- const report = generateJsonReport(assets, inputs);
288
+ function saveJson(assets, inputs, options) {
289
+ const report = generateJsonReport(assets, inputs, options);
227
290
  const path$1 = path.join(process.cwd(), 'sonda-report.json');
228
291
  fs.writeFileSync(path$1, JSON.stringify(report, null, 2));
229
292
  return path$1;
@@ -253,8 +316,8 @@ function SondaEsbuildPlugin(options) {
253
316
  };
254
317
  }
255
318
 
256
- const esmRegex = /* #__ PURE__ */ /\.m[tj]sx?$/;
257
- const cjsRegex = /* #__ PURE__ */ /\.c[tj]sx?$/;
319
+ const esmRegex = /\.m[tj]sx?$/;
320
+ const cjsRegex = /\.c[tj]sx?$/;
258
321
  function SondaRollupPlugin(options) {
259
322
  let inputs = {};
260
323
  return {
@@ -284,7 +347,7 @@ function getFormat$1(moduleId, isCommonJS) {
284
347
  return 'unknown';
285
348
  }
286
349
 
287
- const jsRegexp = /\.[c|m]?[t|j]s[x]?$/;
350
+ const jsRegexp = /\.[c|m]?[t|j]s[x]?$/;
288
351
  class SondaWebpackPlugin {
289
352
  apply(compiler) {
290
353
  compiler.options.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';
@@ -337,5 +400,4 @@ function isNormalModule(module) {
337
400
  exports.SondaEsbuildPlugin = SondaEsbuildPlugin;
338
401
  exports.SondaRollupPlugin = SondaRollupPlugin;
339
402
  exports.SondaWebpackPlugin = SondaWebpackPlugin;
340
- exports.loadCodeAndMap = loadCodeAndMap;
341
403
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/utils.ts","../src/sourcemap/load.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 { relative, posix, sep } from 'path';\nimport type { Options } from './types';\n\nconst cwd = /* #__ PURE__ */ process.cwd();\n\nexport function normalizeOptions( options?: Partial<Options> ) {\n\tconst defaultOptions: Options = {\n\t\topen: true,\n\t\tformat: 'html',\n\t};\n\n\treturn Object.assign( {}, defaultOptions, options ) as Options;\n}\n\nexport function normalizePath( path: string ): string {\n\t// Unicode escape sequences used by Rollup and Vite to identify virtual modules\n\tconst normalized = path.replace( /^\\0/, '' )\n\n\t// Transform absolute paths to relative paths\n\tconst relativized = relative( cwd, normalized );\n\n\t// Ensure paths are POSIX-compliant - https://stackoverflow.com/a/63251716/4617687\n\treturn relativized.replaceAll( sep, posix.sep );\n}\n","import { existsSync, readFileSync } from 'fs';\nimport { dirname, join, resolve, isAbsolute } from 'path';\nimport type { MaybeCodeMap } from '../types.js';\nimport type { EncodedSourceMap } from '@ampproject/remapping';\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 */\nfunction parseSourceMapInput( str: string ): EncodedSourceMap {\n\treturn JSON.parse( str.replace( /^\\)]}'[^\\n]*\\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*/\nconst sourceMappingRegExp = /[@#]\\s*sourceMappingURL=(\\S+)\\b/g;\n\nexport function loadCodeAndMap( codePath: string ): MaybeCodeMap {\n\tif ( !existsSync( codePath ) ) {\n\t\treturn null;\n\t}\n\n\tconst code = readFileSync( codePath, 'utf-8' );\n\n\tconst extractedComment = code.includes( 'sourceMappingURL' ) && Array.from( code.matchAll( sourceMappingRegExp ) ).at( -1 );\n\n\tif ( !extractedComment || !extractedComment.length ) {\n\t\treturn { code };\n\t}\n\n\tconst maybeMap = loadMap( codePath, extractedComment[ 1 ] );\n\n\tif ( !maybeMap ) {\n\t\treturn { code };\n\t}\n\n\tconst { map, mapPath } = maybeMap;\n\n\tmap.sources = normalizeSourcesPaths( map, mapPath );\n\tdelete map.sourceRoot;\n\n\treturn {\n\t\tcode,\n\t\tmap\n\t};\n}\n\nfunction loadMap( codePath: string, sourceMappingURL: string ): { map: EncodedSourceMap; mapPath: string } | null {\n\tif ( sourceMappingURL.startsWith( 'data:' ) ) {\n\t\tconst map = parseDataUrl( sourceMappingURL );\n\n\t\treturn {\n\t\t\tmap: parseSourceMapInput( map ),\n\t\t\tmapPath: codePath\n\t\t};\n\t}\n\n\tconst mapPath = join( codePath, '..', sourceMappingURL );\n\n\tif ( !existsSync( mapPath ) ) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\tmap: parseSourceMapInput( readFileSync( mapPath, 'utf-8' ) ),\n\t\tmapPath\n\t};\n}\n\nfunction parseDataUrl( url: string ): string {\n\tconst [ prefix, payload ] = url.split( ',' );\n\tconst encoding = prefix.split( ';' ).at( -1 );\n\n\tswitch ( encoding ) {\n\t\tcase 'base64':\n\t\t\treturn Buffer.from( payload, 'base64' ).toString();\n\t\tcase 'uri':\n\t\t\treturn decodeURIComponent( payload );\n\t\tdefault:\n\t\t\tthrow new Error( 'Unsupported source map encoding: ' + encoding );\n\t}\n}\n\nfunction normalizeSourcesPaths( map: EncodedSourceMap, mapPath: string ): EncodedSourceMap[ 'sources' ] {\n\tconst mapDir = dirname( mapPath );\n\n\treturn map.sources.map( source => {\n\t\tif ( !source ) {\n\t\t\treturn source;\n\t\t}\n\n\t\treturn isAbsolute( source )\n\t\t\t? source\n\t\t\t: resolve( mapDir, map.sourceRoot ?? '.', source );\n\t} );\n}\n","import { default as remapping, type DecodedSourceMap, type EncodedSourceMap } from '@ampproject/remapping';\nimport { loadCodeAndMap } from './load';\nimport { resolve } from 'path';\nimport type { ReportInput } from '../types';\nimport { normalizePath } from '../utils';\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 = loadCodeAndMap( resolve( dirPath, file ) );\n\n\t\tif ( !codeMap ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst parentPath = normalizePath( file );\n\t\tconst { format } = inputs[ parentPath ];\n\n\t\tcodeMap.map?.sources\n\t\t\t.filter( source => source !== null )\n\t\t\t.forEach( ( source, index ) => {\n\t\t\t\tconst normalizedPath = normalizePath( source );\n\n\t\t\t\tif ( parentPath === normalizedPath ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tinputs[ normalizedPath ] = {\n\t\t\t\t\tbytes: Buffer.byteLength( codeMap.map!.sourcesContent?.[ index ] ?? '' ),\n\t\t\t\t\tformat,\n\t\t\t\t\timports: [],\n\t\t\t\t\tbelongsTo: parentPath\n\t\t\t\t};\n\t\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","import { gzipSync, brotliCompressSync } from 'zlib';\nimport type { DecodedSourceMap } from '@ampproject/remapping';\nimport type { Sizes } from '../types';\n\nexport function getBytesPerSource( code: string, map: DecodedSourceMap ): Map<string, Sizes> {\n\tconst contributions = new Array( map.sources.length ).fill( '' );\n\n\t// Split the source code by lines\n\tconst codeLines = code.split( /(?<=\\r?\\n)/ );\n\n\tfor ( let lineIndex = 0; lineIndex < map.mappings.length; lineIndex++ ) {\n\t\tconst line = map.mappings[ lineIndex ];\n\t\tconst lineCode = codeLines[ lineIndex ];\n\n\t\tfor ( let mappingIndex = 0; mappingIndex < line.length; mappingIndex++ ) {\n\t\t\t// 0: generatedColumn\n\t\t\t// 1: fileIndex\n\t\t\t// 2: originalLine\n\t\t\t// 3: originalColumn\n\t\t\t// 4: nameIndex\n\n\t\t\tconst [ startColumn, fileIndex ] = line[ mappingIndex ];\n\t\t\tconst endColumn = line[ mappingIndex + 1 ]?.[ 0 ] ?? lineCode.length;\n\n\t\t\tcontributions[ fileIndex! ] += lineCode.slice( startColumn, endColumn );\n\t\t}\n\t}\n\n\treturn new Map<string, Sizes>( \n\t\tcontributions.map( ( code, index ) => [ map.sources[ index ]!, getSizes( code ) ] )\n\t);\n}\n\nexport function getSizes( code: string ): Sizes {\n\treturn {\n\t\tuncompressed: Buffer.byteLength( code ),\n\t\tgzip: gzipSync( code ).length,\n\t\tbrotli: brotliCompressSync( code ).length\n\t};\n}\n","import { dirname, resolve } from 'path';\nimport { fileURLToPath } from 'url';\nimport { readFileSync } from 'fs';\nimport { mapSourceMap } from './sourcemap/map.js';\nimport { getBytesPerSource, getSizes } from './sourcemap/bytes.js';\nimport { loadCodeAndMap } from './sourcemap/load.js';\nimport type {\n JsonReport,\n MaybeCodeMap,\n ReportInput,\n ReportOutput,\n CodeMap,\n ReportOutputInput\n} from './types.js';\nimport { normalizePath } from './utils.js';\n\nexport function generateJsonReport(\n assets: Array<string>,\n inputs: Record<string, ReportInput>\n): JsonReport {\n const outputsEntries = assets\n .filter( asset => !asset.endsWith( '.map' ) )\n .map( asset => processAsset( asset, inputs ) )\n .filter( output => !!output );\n\n return {\n inputs,\n outputs: Object.fromEntries( outputsEntries )\n };\n}\n\nexport function generateHtmlReport(\n assets: Array<string>,\n inputs: Record<string, ReportInput>\n): string {\n const json = generateJsonReport( assets, inputs );\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__', JSON.stringify( json ) );\n}\n\nfunction processAsset( asset: string, inputs: Record<string, ReportInput> ): [ string, ReportOutput ] | void {\n const maybeCodeMap = loadCodeAndMap( asset );\n\n if ( !hasCodeAndMap( maybeCodeMap ) ) {\n return;\n }\n\n const { code, map } = maybeCodeMap;\n const mapped = mapSourceMap( map, dirname( asset ), inputs );\n\n mapped.sources = mapped.sources.map( source => normalizePath( source! ) );\n\n const bytes = getBytesPerSource( code, mapped );\n\n return [ normalizePath( asset ), {\n ...getSizes( code ),\n inputs: mapped.sources.reduce( ( acc, source ) => {\n if ( source ) {\n acc[ normalizePath( source ) ] = bytes.get( source ) ?? {\n uncompressed: 0,\n gzip: 0,\n brotli: 0\n };\n }\n\n return acc;\n }, {} as Record<string, ReportOutputInput> )\n } ];\n}\n\nfunction hasCodeAndMap( result: MaybeCodeMap ): result is Required<CodeMap> {\n return Boolean( result && result.code && result.map );\n}\n","import { join } from 'path';\nimport { writeFileSync } from 'fs';\nimport { generateHtmlReport, generateJsonReport } from '../report.js';\nimport type { Options, JsonReport } from '../types.js';\n\nexport async function generateReportFromAssets(\n\tassets: string[],\n\tinputs: JsonReport[ 'inputs' ],\n\toptions: Options\n): Promise<void> {\n\tconst { default: open } = await import( 'open' );\n\n\tconst handler = options.format === 'html'\n\t\t? saveHtml\n\t\t: saveJson;\n\n\tconst path = handler( assets, inputs );\n\n\toptions.open && path && open( path );\n}\n\nfunction saveHtml(\n\tassets: string[],\n\tinputs: JsonReport[ 'inputs' ]\n): string | null {\n\tconst report = generateHtmlReport( assets, inputs );\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): string | null {\n\tconst report = generateJsonReport( assets, inputs );\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 { normalizeOptions } from '../utils';\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\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 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\t\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\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 ),\n\t\t\t\t\tinputs,\n\t\t\t\t\tnormalizeOptions( options )\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\t};\n}\n","import { join, resolve, dirname } from 'path';\nimport { normalizeOptions, normalizePath } 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\nconst esmRegex = /* #__ PURE__ */ /\\.m[tj]sx?$/;\nconst cjsRegex = /* #__ PURE__ */ /\\.c[tj]sx?$/;\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\tnormalizeOptions( options )\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 || esmRegex.test( moduleId ) ) {\n\t\treturn 'esm';\n\t}\n\n\treturn'unknown';\n}\n","import { join } from 'path';\nimport { normalizeOptions, normalizePath } from '../utils';\nimport { generateReportFromAssets } from '../report/generate';\nimport type { Options, ModuleFormat, JsonReport } from '../types';\nimport { NormalModule, type Compiler, type Module } from 'webpack';\n\nconst jsRegexp = /* #__PURE__ */ /\\.[c|m]?[t|j]s[x]?$/;\n\nexport class SondaWebpackPlugin {\n\toptions: Partial<Options>;\n\tinputs: JsonReport[ 'inputs' ];\n\n\tconstructor ( options?: Partial<Options> ) {\n\t\tthis.options = options || {};\n\t\tthis.inputs = {};\n\t}\n\n\tapply( compiler: Compiler ): void {\n\t\tcompiler.options.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';\n\n\t\tcompiler.hooks.compilation.tap( 'SondaWebpackPlugin', ( compilation ) => {\n\t\t\tcompilation.hooks.optimizeModules.tap( 'SondaWebpackPlugin', ( modules ) => {\n\t\t\t\tArray\n\t\t\t\t\t.from( modules )\n\t\t\t\t\t.forEach( module => {\n\t\t\t\t\t\tif ( !isNormalModule( module ) ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst imports = module.dependencies.reduce( ( acc, dependency ) => {\n\t\t\t\t\t\t\tconst module = compilation.moduleGraph.getModule( dependency );\n\n\t\t\t\t\t\t\tif ( isNormalModule( module ) ) {\n\t\t\t\t\t\t\t\tacc.push( normalizePath( module.resource ) );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t}, [] as Array<string> );\n\n\t\t\t\t\t\tthis.inputs[ normalizePath( module.resource ) ] = {\n\t\t\t\t\t\t\tbytes: module.size(),\n\t\t\t\t\t\t\tformat: getFormat( module ),\n\t\t\t\t\t\t\timports,\n\t\t\t\t\t\t\tbelongsTo: null,\n\t\t\t\t\t\t};\n\t\t\t\t\t} );\n\t\t\t} );\n\t\t} );\n\n\t\tcompiler.hooks.emit.tapAsync( 'SondaWebpackPlugin', ( compilation, callback ) => {\n\t\t\tconst outputPath = compiler.options.output.path || compiler.outputPath || process.cwd();\n\t\t\tconst assets = Object.keys( compilation.assets ).map( name => join( outputPath, name ) );\n\n\t\t\tgenerateReportFromAssets(\n\t\t\t\tassets,\n\t\t\t\tthis.inputs,\n\t\t\t\tnormalizeOptions( this.options )\n\t\t\t)\n\t\t\t.then(() => callback());\n\t\t} );\n\t}\n}\n\nfunction getFormat( module: NormalModule ): ModuleFormat {\n\tif ( !jsRegexp.test( module.resource ) ) {\n\t\treturn 'unknown';\n\t}\n\n\tif ( module.type === 'javascript/esm' || module.buildMeta?.exportsType === 'namespace' ) {\n\t\treturn 'esm';\n\t}\n\n\treturn 'cjs';\n}\n\nfunction isNormalModule( module: Module | NormalModule | null ): module is NormalModule {\n\treturn module !== null && 'resource' in module;\n}\n"],"names":["cwd","process","normalizeOptions","options","defaultOptions","open","format","Object","assign","normalizePath","path","normalized","replace","relativized","relative","replaceAll","sep","posix","parseSourceMapInput","str","JSON","parse","sourceMappingRegExp","loadCodeAndMap","codePath","existsSync","code","readFileSync","extractedComment","includes","Array","from","matchAll","at","length","maybeMap","loadMap","map","mapPath","sources","normalizeSourcesPaths","sourceRoot","sourceMappingURL","startsWith","parseDataUrl","join","url","prefix","payload","split","encoding","Buffer","toString","decodeURIComponent","Error","mapDir","dirname","source","isAbsolute","resolve","mapSourceMap","dirPath","inputs","alreadyRemapped","Set","remapped","remapping","file","ctx","has","add","codeMap","parentPath","filter","forEach","index","normalizedPath","bytes","byteLength","sourcesContent","imports","belongsTo","content","decodedMappings","getBytesPerSource","contributions","fill","codeLines","lineIndex","mappings","line","lineCode","mappingIndex","startColumn","fileIndex","endColumn","slice","Map","getSizes","uncompressed","gzip","gzipSync","brotli","brotliCompressSync","generateJsonReport","assets","outputsEntries","asset","endsWith","processAsset","output","outputs","fromEntries","generateHtmlReport","json","__dirname","fileURLToPath","template","stringify","maybeCodeMap","hasCodeAndMap","mapped","reduce","acc","get","result","Boolean","generateReportFromAssets","default","handler","saveHtml","saveJson","report","writeFileSync","SondaEsbuildPlugin","name","setup","build","initialOptions","metafile","onEnd","console","error","entries","data","keys","esmRegex","cjsRegex","SondaRollupPlugin","writeBundle","dir","bundle","outputDir","moduleParsed","module","id","getFormat","meta","commonjs","isCommonJS","importedIds","moduleId","test","jsRegexp","SondaWebpackPlugin","apply","compiler","devtoolModuleFilenameTemplate","hooks","compilation","tap","optimizeModules","modules","isNormalModule","dependencies","dependency","moduleGraph","getModule","push","resource","size","emit","tapAsync","callback","outputPath","then","constructor","type","buildMeta","exportsType"],"mappings":";;;;;;;;;AAGA,MAAMA,GAAM,oBAAiBC,OAAAA,CAAQD,GAAG,EAAA,CAAA;AAEjC,SAASE,iBAAkBC,OAA0B,EAAA;AAC3D,IAAA,MAAMC,cAA0B,GAAA;QAC/BC,IAAM,EAAA,IAAA;QACNC,MAAQ,EAAA,MAAA;AACT,KAAA,CAAA;AAEA,IAAA,OAAOC,MAAOC,CAAAA,MAAM,CAAE,IAAIJ,cAAgBD,EAAAA,OAAAA,CAAAA,CAAAA;AAC3C,CAAA;AAEO,SAASM,cAAeC,MAAY,EAAA;;AAE1C,IAAA,MAAMC,UAAaD,GAAAA,MAAAA,CAAKE,OAA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R,KAAA;IAEA,OAAO,KAAA,CAAA;AACR,CAAA;AAEA,SAAShB,eAAgBnB,MAAoC,EAAA;IAC5D,OAAOA,MAAAA,KAAW,QAAQ,UAAcA,IAAAA,MAAAA,CAAAA;AACzC;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/utils.ts","../../load-source-map/dist/index.js","../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 { relative, posix, sep } from 'path';\nimport type { Options } from './types';\n\nconst cwd = /* #__PURE__ */ process.cwd();\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\tgzip: false,\n\t\tbrotli: false,\n\t};\n\n\treturn Object.assign( {}, defaultOptions, options ) as Options;\n}\n\nexport function normalizePath( path: string ): string {\n\t// Unicode escape sequences used by Rollup and Vite to identify virtual modules\n\tconst normalized = path.replace( /^\\0/, '' )\n\n\t// Transform absolute paths to relative paths\n\tconst relativized = relative( cwd, normalized );\n\n\t// Ensure paths are POSIX-compliant - https://stackoverflow.com/a/63251716/4617687\n\treturn relativized.replaceAll( sep, posix.sep );\n}\n","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 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}\nfunction 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\nexport { loadCodeAndMap };\n//# sourceMappingURL=index.js.map\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 { Options, ReportInput } from '../types';\n\nexport function mapSourceMap(\n\tmap: EncodedSourceMap,\n\tdirPath: string,\n\tinputs: Record<string, ReportInput>,\n\toptions: Options\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 = loadCodeAndMap( resolve( dirPath, file ) );\n\n\t\tif ( !codeMap ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( !options.detailed ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst parentPath = normalizePath( file );\n\t\tconst format = inputs[ parentPath ]?.format ?? 'unknown';\n\n\t\tcodeMap.map?.sources\n\t\t\t.filter( source => source !== null )\n\t\t\t.forEach( ( source, index ) => {\n\t\t\t\tconst normalizedPath = normalizePath( source );\n\n\t\t\t\tif ( parentPath === normalizedPath ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tinputs[ normalizedPath ] = {\n\t\t\t\t\tbytes: Buffer.byteLength( codeMap.map!.sourcesContent?.[ index ] ?? '' ),\n\t\t\t\t\tformat,\n\t\t\t\t\timports: [],\n\t\t\t\t\tbelongsTo: parentPath\n\t\t\t\t};\n\t\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","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 { dirname, resolve } from 'path';\nimport { fileURLToPath } from 'url';\nimport { readFileSync } from 'fs';\nimport { loadCodeAndMap } from 'load-source-map';\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 outputs = assets\n .filter( asset => !asset.endsWith( '.map' ) )\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,\n 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__', 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 = mapSourceMap( map, dirname( asset ), inputs, options );\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\n return {\n ...assetSizes,\n inputs: Array.from( bytes ).reduce( ( carry, [ source, sizes ] ) => {\n carry[ normalizePath( source ) ] = sizes;\n\n return carry;\n }, {} as Record<string, ReportOutputInput> )\n };\n}\n\nfunction hasCodeAndMap( result: MaybeCodeMap ): result is Required<CodeMap> {\n return Boolean( result && result.code && result.map );\n}\n","import { join } from 'path';\nimport { writeFileSync } from 'fs';\nimport { generateHtmlReport, generateJsonReport } from '../report.js';\nimport type { Options, JsonReport } from '../types.js';\n\nexport async function generateReportFromAssets(\n\tassets: string[],\n\tinputs: JsonReport[ 'inputs' ],\n\toptions: Options\n): Promise<void> {\n\tconst { default: open } = await import( 'open' );\n\n\tconst handler = options.format === 'html'\n\t\t? saveHtml\n\t\t: saveJson;\n\n\tconst path = handler( assets, inputs, options );\n\n\toptions.open && path && open( 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 { normalizeOptions } from '../utils';\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\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 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\t\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\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 ),\n\t\t\t\t\tinputs,\n\t\t\t\t\tnormalizeOptions( options )\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\t};\n}\n","import { join, resolve, dirname } from 'path';\nimport { normalizeOptions, normalizePath } 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\nconst esmRegex = /\\.m[tj]sx?$/;\nconst cjsRegex = /\\.c[tj]sx?$/;\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\tnormalizeOptions( options )\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 || esmRegex.test( moduleId ) ) {\n\t\treturn 'esm';\n\t}\n\n\treturn'unknown';\n}\n","import { join } from 'path';\nimport { normalizeOptions, normalizePath } from '../utils';\nimport { generateReportFromAssets } from '../report/generate';\nimport type { Options, ModuleFormat, JsonReport } from '../types';\nimport { NormalModule, type Compiler, type Module } from 'webpack';\n\nconst jsRegexp = /\\.[c|m]?[t|j]s[x]?$/;\n\nexport class SondaWebpackPlugin {\n\toptions: Partial<Options>;\n\tinputs: JsonReport[ 'inputs' ];\n\n\tconstructor ( options?: Partial<Options> ) {\n\t\tthis.options = options || {};\n\t\tthis.inputs = {};\n\t}\n\n\tapply( compiler: Compiler ): void {\n\t\tcompiler.options.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';\n\n\t\tcompiler.hooks.compilation.tap( 'SondaWebpackPlugin', ( compilation ) => {\n\t\t\tcompilation.hooks.optimizeModules.tap( 'SondaWebpackPlugin', ( modules ) => {\n\t\t\t\tArray\n\t\t\t\t\t.from( modules )\n\t\t\t\t\t.forEach( module => {\n\t\t\t\t\t\tif ( !isNormalModule( module ) ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst imports = module.dependencies.reduce( ( acc, dependency ) => {\n\t\t\t\t\t\t\tconst module = compilation.moduleGraph.getModule( dependency );\n\n\t\t\t\t\t\t\tif ( isNormalModule( module ) ) {\n\t\t\t\t\t\t\t\tacc.push( normalizePath( module.resource ) );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t}, [] as Array<string> );\n\n\t\t\t\t\t\tthis.inputs[ normalizePath( module.resource ) ] = {\n\t\t\t\t\t\t\tbytes: module.size(),\n\t\t\t\t\t\t\tformat: getFormat( module ),\n\t\t\t\t\t\t\timports,\n\t\t\t\t\t\t\tbelongsTo: null,\n\t\t\t\t\t\t};\n\t\t\t\t\t} );\n\t\t\t} );\n\t\t} );\n\n\t\tcompiler.hooks.emit.tapAsync( 'SondaWebpackPlugin', ( compilation, callback ) => {\n\t\t\tconst outputPath = compiler.options.output.path || compiler.outputPath || process.cwd();\n\t\t\tconst assets = Object.keys( compilation.assets ).map( name => join( outputPath, name ) );\n\n\t\t\tgenerateReportFromAssets(\n\t\t\t\tassets,\n\t\t\t\tthis.inputs,\n\t\t\t\tnormalizeOptions( this.options )\n\t\t\t)\n\t\t\t.then(() => callback());\n\t\t} );\n\t}\n}\n\nfunction getFormat( module: NormalModule ): ModuleFormat {\n\tif ( !jsRegexp.test( module.resource ) ) {\n\t\treturn 'unknown';\n\t}\n\n\tif ( module.type === 'javascript/esm' || module.buildMeta?.exportsType === 'namespace' ) {\n\t\treturn 'esm';\n\t}\n\n\treturn 'cjs';\n}\n\nfunction isNormalModule( module: Module | NormalModule | null ): module is NormalModule {\n\treturn module !== null && 'resource' in module;\n}\n"],"names":["cwd","process","normalizeOptions","options","defaultOptions","open","format","detailed","gzip","brotli","Object","assign","normalizePath","path","normalized","replace","relativized","relative","replaceAll","sep","posix","parseSourceMapInput","str","JSON","parse","sourceMappingRegExp","loadCodeAndMap","codePath","existsSync","code","readFileSync","extractedComment","includes","Array","from","matchAll","at","length","maybeMap","loadMap","map","mapPath","sources","normalizeSourcesPaths","sourceRoot","sourceMappingURL","startsWith","parseDataUrl","sourceMapFilename","URL","pathname","join","dirname","url","prefix","payload","split","encoding","Buffer","toString","decodeURIComponent","Error","mapDir","source","isAbsolute","resolve","mapSourceMap","dirPath","inputs","alreadyRemapped","Set","remapped","remapping","file","ctx","has","add","codeMap","parentPath","filter","forEach","index","normalizedPath","bytes","byteLength","sourcesContent","imports","belongsTo","content","decodedMappings","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","outputs","endsWith","reduce","carry","data","processAsset","generateHtmlReport","json","__dirname","fileURLToPath","template","stringify","maybeCodeMap","hasCodeAndMap","mapped","result","Boolean","generateReportFromAssets","default","handler","saveHtml","saveJson","report","writeFileSync","SondaEsbuildPlugin","name","setup","build","initialOptions","metafile","onEnd","console","error","entries","acc","keys","esmRegex","cjsRegex","SondaRollupPlugin","writeBundle","dir","bundle","outputDir","moduleParsed","module","id","getFormat","meta","commonjs","isCommonJS","importedIds","moduleId","test","jsRegexp","SondaWebpackPlugin","apply","compiler","output","devtoolModuleFilenameTemplate","hooks","compilation","tap","optimizeModules","modules","isNormalModule","dependencies","dependency","moduleGraph","getModule","push","resource","size","emit","tapAsync","callback","outputPath","then","constructor","type","buildMeta","exportsType"],"mappings":";;;;;;;;;AAGA,MAAMA,GAAM,mBAAgBC,OAAAA,CAAQD,GAAG,EAAA,CAAA;AAEhC,SAASE,iBAAkBC,OAA0B,EAAA;AAC3D,IAAA,MAAMC,cAA0B,GAAA;QAC/BC,IAAM,EAAA,IAAA;QACNC,MAAQ,EAAA,MAAA;QACRC,QAAU,EAAA,KAAA;QACVC,IAAM,EAAA,KAAA;QACNC,MAAQ,EAAA,KAAA;AACT,KAAA,CAAA;AAEA,IAAA,OAAOC,MAAOC,CAAAA,MAAM,CAAE,IAAIP,cAAgBD,EAAAA,OAAAA,CAAAA,CAAAA;AAC3C,CAAA;AAEO,SAASS,cAAeC,MAAY,EAAA;;AAE1C,IAAA,MAAMC,UAAaD,GAAAA,MAAAA,CAAKE,OAAO,CAAE,KAAO,EAAA,EAAA,CAAA,CAAA;;IAGxC,MAAMC,WAAAA,GAAcC,cAAUjB,GAAKc,EAAAA,UAAAA,CAAAA,CAAAA;;AAGnC,IAAA,OAAOE,WAAYE,CAAAA,UAAU,CAAEC,QAAAA,EAAKC,WAAMD,GAAG,CAAA,CAAA;AAC9C;;ACLA;;;;;IAMA,SAASE,mBAAAA,CAAqBC,GAAW,EAAA;AACxC,IAAA,OAAOC,IAAKC,CAAAA,KAAK,CAAEF,GAAIP,CAAAA,OAAO,CAAE,gBAAkB,EAAA,EAAA,CAAA,CAAA,CAAA;AACnD,CAAA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