sonda 0.2.1 → 0.3.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,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b7831e3: Update the webpack plugin to make it work with Rspack
8
+
9
+ ### Patch Changes
10
+
11
+ - 30ddb2b: Add missing `sourcesContent` to source maps when they are available in the filesystem
12
+ - e825cfa: Configure npm package provenance
13
+ - e825cfa: Fix missing `inputs` in the report created by the esbuild plugin.
14
+
15
+ ## 0.2.2
16
+
17
+ ### Patch Changes
18
+
19
+ - 97fcbb3: Round module type percentages to two decimal places
20
+
3
21
  ## 0.2.1
4
22
 
5
23
  ### Patch Changes
package/README.md CHANGED
@@ -111,7 +111,27 @@ module.exports = {
111
111
  };
112
112
  ```
113
113
 
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]'`).
114
+ 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]'`).
115
+
116
+ </details>
117
+
118
+ <details>
119
+ <summary>Rspack</summary>
120
+
121
+ ```javascript
122
+ // rspack.config.js
123
+
124
+ import { SondaWebpackPlugin } from 'sonda';
125
+
126
+ export default {
127
+ devtool: 'source-map',
128
+ plugins: [
129
+ new SondaWebpackPlugin(),
130
+ ],
131
+ };
132
+ ```
133
+
134
+ 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]'`).
115
135
 
116
136
  </details>
117
137
 
@@ -123,6 +143,7 @@ Each plugin accepts an optional configuration object with the following options.
123
143
  SondaRollupPlugin( {
124
144
  format: 'html',
125
145
  open: true,
146
+ detailed: true,
126
147
  gzip: true,
127
148
  brotli: true,
128
149
  } )
@@ -1 +1 @@
1
- {"version":3,"file":"esbuild.d.ts","sourceRoot":"","sources":["../../src/bundlers/esbuild.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAc,MAAM,UAAU,CAAC;AAEpD,wBAAgB,kBAAkB,CAAE,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAI,MAAM,CAiCvE"}
1
+ {"version":3,"file":"esbuild.d.ts","sourceRoot":"","sources":["../../src/bundlers/esbuild.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAc,MAAM,UAAU,CAAC;AAGpD,wBAAgB,kBAAkB,CAAE,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAI,MAAM,CAiDvE"}
@@ -1,8 +1,7 @@
1
- import type { Options, JsonReport } from '../types';
2
- import { type Compiler } from 'webpack';
1
+ import type { Compiler } from 'webpack';
2
+ import type { Options } from '../types';
3
3
  export declare class SondaWebpackPlugin {
4
4
  options: Partial<Options>;
5
- inputs: JsonReport['inputs'];
6
5
  constructor(options?: Partial<Options>);
7
6
  apply(compiler: Compiler): void;
8
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../../src/bundlers/webpack.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAgB,UAAU,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,EAAgB,KAAK,QAAQ,EAAe,MAAM,SAAS,CAAC;AAInE,qBAAa,kBAAkB;IAC9B,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1B,MAAM,EAAE,UAAU,CAAE,QAAQ,CAAE,CAAC;gBAEjB,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC;IAKxC,KAAK,CAAE,QAAQ,EAAE,QAAQ,GAAI,IAAI;CA4CjC"}
1
+ {"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../../src/bundlers/webpack.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAe,MAAM,SAAS,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAA4B,MAAM,UAAU,CAAC;AAIlE,qBAAa,kBAAkB;IAC9B,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;gBAEZ,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC;IAIxC,KAAK,CAAE,QAAQ,EAAE,QAAQ,GAAI,IAAI;CAqCjC"}
package/dist/index.cjs CHANGED
@@ -3,6 +3,7 @@
3
3
  var path = require('path');
4
4
  var fs = require('fs');
5
5
  var url = require('url');
6
+ var sourcemapCodec = require('@jridgewell/sourcemap-codec');
6
7
  var remapping = require('@ampproject/remapping');
7
8
  var zlib = require('zlib');
8
9
 
@@ -61,6 +62,7 @@ function loadCodeAndMap(codePath) {
61
62
  }
62
63
  const { map, mapPath } = maybeMap;
63
64
  map.sources = normalizeSourcesPaths(map, mapPath);
65
+ map.sourcesContent = loadMissingSourcesContent(map);
64
66
  delete map.sourceRoot;
65
67
  return {
66
68
  code,
@@ -97,7 +99,9 @@ function parseDataUrl(url) {
97
99
  throw new Error('Unsupported source map encoding: ' + encoding);
98
100
  }
99
101
  }
100
- function normalizeSourcesPaths(map, mapPath) {
102
+ /**
103
+ * Normalize the paths of the sources in the source map to be absolute paths.
104
+ */ function normalizeSourcesPaths(map, mapPath) {
101
105
  const mapDir = path.dirname(mapPath);
102
106
  return map.sources.map((source)=>{
103
107
  if (!source) {
@@ -106,8 +110,21 @@ function normalizeSourcesPaths(map, mapPath) {
106
110
  return path.isAbsolute(source) ? source : path.resolve(mapDir, map.sourceRoot ?? '.', source);
107
111
  });
108
112
  }
113
+ /**
114
+ * Loop through the sources and try to load missing `sourcesContent` from the file system.
115
+ */ function loadMissingSourcesContent(map) {
116
+ return map.sources.map((source, index)=>{
117
+ if (map.sourcesContent?.[index]) {
118
+ return map.sourcesContent[index];
119
+ }
120
+ if (source && fs.existsSync(source)) {
121
+ return fs.readFileSync(source, 'utf-8');
122
+ }
123
+ return null;
124
+ });
125
+ }
109
126
 
110
- function mapSourceMap(map, dirPath, inputs, options) {
127
+ function mapSourceMap(map, dirPath, inputs) {
111
128
  const alreadyRemapped = new Set();
112
129
  const remapped = remapping(map, (file, ctx)=>{
113
130
  var _ctx;
@@ -115,27 +132,10 @@ function mapSourceMap(map, dirPath, inputs, options) {
115
132
  return;
116
133
  }
117
134
  alreadyRemapped.add(file);
118
- const codeMap = loadCodeAndMap(path.resolve(dirPath, file));
135
+ const codeMap = addSourcesToInputs(path.resolve(dirPath, file), inputs);
119
136
  if (!codeMap) {
120
137
  return;
121
138
  }
122
- if (!options.detailed) {
123
- return null;
124
- }
125
- const parentPath = normalizePath(file);
126
- const format = inputs[parentPath]?.format ?? 'unknown';
127
- codeMap.map?.sources.filter((source)=>source !== null).forEach((source, index)=>{
128
- const normalizedPath = normalizePath(source);
129
- if (parentPath === normalizedPath) {
130
- return;
131
- }
132
- inputs[normalizedPath] = {
133
- bytes: Buffer.byteLength(codeMap.map.sourcesContent?.[index] ?? ''),
134
- format,
135
- imports: [],
136
- belongsTo: parentPath
137
- };
138
- });
139
139
  (_ctx = ctx).content ?? (_ctx.content = codeMap.code);
140
140
  return codeMap.map;
141
141
  }, {
@@ -143,6 +143,29 @@ function mapSourceMap(map, dirPath, inputs, options) {
143
143
  });
144
144
  return remapped;
145
145
  }
146
+ /**
147
+ * Loads the source map of a given file and adds its "sources" to the given inputs object.
148
+ */ function addSourcesToInputs(path, inputs) {
149
+ const codeMap = loadCodeAndMap(path);
150
+ if (!codeMap) {
151
+ return null;
152
+ }
153
+ const parentPath = normalizePath(path);
154
+ const format = inputs[parentPath]?.format ?? 'unknown';
155
+ codeMap.map?.sources.filter((source)=>source !== null).forEach((source, index)=>{
156
+ const normalizedPath = normalizePath(source);
157
+ if (parentPath === normalizedPath) {
158
+ return;
159
+ }
160
+ inputs[normalizedPath] = {
161
+ bytes: Buffer.byteLength(codeMap.map.sourcesContent?.[index] ?? ''),
162
+ format,
163
+ imports: [],
164
+ belongsTo: parentPath
165
+ };
166
+ });
167
+ return codeMap;
168
+ }
146
169
 
147
170
  const UNASSIGNED = '[unassigned]';
148
171
  function getBytesPerSource(code, map, assetSizes, options) {
@@ -257,7 +280,10 @@ function processAsset(asset, inputs, options) {
257
280
  return;
258
281
  }
259
282
  const { code, map } = maybeCodeMap;
260
- const mapped = mapSourceMap(map, path.dirname(asset), inputs, options);
283
+ const mapped = options.detailed ? mapSourceMap(map, path.dirname(asset), inputs) : {
284
+ ...map,
285
+ mappings: sourcemapCodec.decode(map.mappings)
286
+ };
261
287
  mapped.sources = mapped.sources.map((source)=>normalizePath(source));
262
288
  const assetSizes = getSizes(code, options);
263
289
  const bytes = getBytesPerSource(code, mapped, assetSizes, options);
@@ -301,13 +327,23 @@ function SondaEsbuildPlugin(options) {
301
327
  if (!result.metafile) {
302
328
  return console.error('Metafile is required for SondaEsbuildPlugin to work.');
303
329
  }
304
- const inputs = Object.entries(result.metafile.inputs).reduce((acc, [path, data])=>{
305
- acc[path] = {
330
+ const cwd = process.cwd();
331
+ const normalizedOptions = normalizeOptions(options);
332
+ // Esbuild already reads the existing source maps, so there's no need to do it again
333
+ normalizedOptions.detailed = false;
334
+ const inputs = Object.entries(result.metafile.inputs).reduce((acc, [path$1, data])=>{
335
+ acc[path$1] = {
306
336
  bytes: data.bytes,
307
337
  format: data.format ?? 'unknown',
308
338
  imports: data.imports.map((data)=>data.path),
309
339
  belongsTo: null
310
340
  };
341
+ /**
342
+ * Because esbuild already reads the existing source maps, there may be
343
+ * cases where some report "outputs" include "inputs" don't exist in the
344
+ * main "inputs" object. To avoid this, we parse each esbuild input and
345
+ * add its sources to the "inputs" object.
346
+ */ addSourcesToInputs(path.resolve(cwd, path$1), acc);
311
347
  return acc;
312
348
  }, {});
313
349
  return generateReportFromAssets(Object.keys(result.metafile.outputs), inputs, normalizeOptions(options));
@@ -351,51 +387,47 @@ const jsRegexp = /\.[c|m]?[t|j]s[x]?$/;
351
387
  class SondaWebpackPlugin {
352
388
  apply(compiler) {
353
389
  compiler.options.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';
354
- compiler.hooks.compilation.tap('SondaWebpackPlugin', (compilation)=>{
355
- compilation.hooks.optimizeModules.tap('SondaWebpackPlugin', (modules)=>{
356
- Array.from(modules).forEach((module)=>{
357
- if (!isNormalModule(module)) {
358
- return;
390
+ compiler.hooks.afterEmit.tapPromise('SondaWebpackPlugin', (compilation)=>{
391
+ const inputs = {};
392
+ const stats = compilation.getStats().toJson({
393
+ modules: true,
394
+ providedExports: true
395
+ });
396
+ const outputPath = stats.outputPath || compiler.outputPath;
397
+ const modules = stats.modules?.filter((mod)=>mod.nameForCondition && mod.moduleType !== 'asset/inline') || [];
398
+ modules.forEach((module)=>{
399
+ const imports = modules.reduce((acc, { nameForCondition, issuerName, reasons })=>{
400
+ if (issuerName === module.name || reasons?.some((reason)=>reason.resolvedModule === module.name)) {
401
+ acc.push(normalizePath(nameForCondition));
359
402
  }
360
- const imports = module.dependencies.reduce((acc, dependency)=>{
361
- const module = compilation.moduleGraph.getModule(dependency);
362
- if (isNormalModule(module)) {
363
- acc.push(normalizePath(module.resource));
364
- }
365
- return acc;
366
- }, []);
367
- this.inputs[normalizePath(module.resource)] = {
368
- bytes: module.size(),
369
- format: getFormat(module),
370
- imports,
371
- belongsTo: null
372
- };
373
- });
403
+ return acc;
404
+ }, []);
405
+ inputs[normalizePath(module.nameForCondition)] = {
406
+ bytes: module.size || 0,
407
+ format: getFormat(module),
408
+ imports,
409
+ belongsTo: null
410
+ };
374
411
  });
375
- });
376
- compiler.hooks.emit.tapAsync('SondaWebpackPlugin', (compilation, callback)=>{
377
- const outputPath = compiler.options.output.path || compiler.outputPath || process.cwd();
378
- const assets = Object.keys(compilation.assets).map((name)=>path.join(outputPath, name));
379
- generateReportFromAssets(assets, this.inputs, normalizeOptions(this.options)).then(()=>callback());
412
+ return generateReportFromAssets(stats.assets?.map((asset)=>path.join(outputPath, asset.name)) || [], inputs, normalizeOptions(this.options));
380
413
  });
381
414
  }
382
415
  constructor(options){
383
416
  this.options = options || {};
384
- this.inputs = {};
385
417
  }
386
418
  }
387
419
  function getFormat(module) {
388
- if (!jsRegexp.test(module.resource)) {
420
+ if (!jsRegexp.test(module.nameForCondition)) {
389
421
  return 'unknown';
390
422
  }
391
- if (module.type === 'javascript/esm' || module.buildMeta?.exportsType === 'namespace') {
423
+ /**
424
+ * Sometimes ESM modules have `moduleType` set as `javascript/auto`, so we
425
+ * also need to check if the module has exports to determine if it's ESM.
426
+ */ if (module.moduleType === 'javascript/esm' || !!module.providedExports?.length) {
392
427
  return 'esm';
393
428
  }
394
429
  return 'cjs';
395
430
  }
396
- function isNormalModule(module) {
397
- return module !== null && 'resource' in module;
398
- }
399
431
 
400
432
  exports.SondaEsbuildPlugin = SondaEsbuildPlugin;
401
433
  exports.SondaRollupPlugin = SondaRollupPlugin;
@@ -1 +1 @@
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,OAAO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AAA;AACrF,YAAA,MAAM+H,MAASrH,GAAAA,MAAAA,CAAOyJ,IAAI,CAAEyB,WAAY7D,CAAAA,MAAM,CAAGvF,CAAAA,GAAG,CAAEiH,CAAAA,IAAQtG,GAAAA,SAAAA,CAAMwJ,UAAYlD,EAAAA,IAAAA,CAAAA,CAAAA,CAAAA;AAEhFR,YAAAA,wBAAAA,CACClB,MACA,EAAA,IAAI,CAAC3D,MAAM,EACXlE,gBAAAA,CAAkB,IAAI,CAACC,OAAO,CAAA,CAAA,CAE9ByM,IAAI,CAAC,IAAMF,QAAAA,EAAAA,CAAAA,CAAAA;AACb,SAAA,CAAA,CAAA;AACD,KAAA;AAhDAG,IAAAA,WAAAA,CAAc1M,OAA0B,CAAG;AAC1C,QAAA,IAAI,CAACA,OAAO,GAAGA,OAAAA,IAAW,EAAC,CAAA;QAC3B,IAAI,CAACiE,MAAM,GAAG,EAAC,CAAA;AAChB,KAAA;AA8CD,CAAA;AAEA,SAAS0G,UAAWF,MAAoB,EAAA;AACvC,IAAA,IAAK,CAACS,QAASD,CAAAA,IAAI,CAAER,MAAAA,CAAO0B,QAAQ,CAAK,EAAA;QACxC,OAAO,SAAA,CAAA;AACR,KAAA;IAEA,IAAK1B,MAAAA,CAAOkC,IAAI,KAAK,gBAAA,IAAoBlC,OAAOmC,SAAS,EAAEC,gBAAgB,WAAc,EAAA;QACxF,OAAO,KAAA,CAAA;AACR,KAAA;IAEA,OAAO,KAAA,CAAA;AACR,CAAA;AAEA,SAAShB,eAAgBpB,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 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 { 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 { dirname, resolve } from 'path';\nimport { fileURLToPath } from 'url';\nimport { readFileSync } from 'fs';\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 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 = 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\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 { resolve } from 'path';\nimport { normalizeOptions } from '../utils';\nimport { generateReportFromAssets } from '../report/generate';\nimport type { Plugin } from 'esbuild';\nimport type { Options, JsonReport } from '../types';\nimport { addSourcesToInputs } from '../sourcemap/map';\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 cwd = process.cwd();\n\t\t\t\tconst normalizedOptions = normalizeOptions( options );\n\n\t\t\t\t// Esbuild already reads the existing source maps, so there's no need to do it again\n\t\t\t\tnormalizedOptions.detailed = false;\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\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 ),\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 { Compiler, StatsModule } from 'webpack';\nimport type { Options, ModuleFormat, JsonReport } from '../types';\n\nconst jsRegexp = /\\.[c|m]?[t|j]s[x]?$/;\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 = stats.modules?.filter( mod => mod.nameForCondition && mod.moduleType !== 'asset/inline' ) || [];\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\tnormalizeOptions( this.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":["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","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","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","outputs","endsWith","reduce","carry","data","processAsset","generateHtmlReport","json","__dirname","fileURLToPath","template","stringify","maybeCodeMap","hasCodeAndMap","mapped","decode","result","Boolean","generateReportFromAssets","default","handler","saveHtml","saveJson","report","writeFileSync","SondaEsbuildPlugin","name","setup","build","initialOptions","metafile","onEnd","console","error","normalizedOptions","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","afterEmit","tapPromise","compilation","stats","getStats","toJson","modules","providedExports","outputPath","mod","nameForCondition","moduleType","issuerName","reasons","some","reason","resolvedModule","push","size","constructor"],"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,GAAA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CAgN,IAAAA,WAAAA,CAAchN,OAA0B,CAAG;AAC1C,QAAA,IAAI,CAACA,OAAO,GAAGA,OAAAA,IAAW,EAAC,CAAA;AAC5B,KAAA;AAuCD,CAAA;AAEA,SAAS+K,UAAWF,MAAmB,EAAA;AACtC,IAAA,IAAK,CAACS,QAASD,CAAAA,IAAI,CAAER,MAAAA,CAAO0B,gBAAgB,CAAM,EAAA;QACjD,OAAO,SAAA,CAAA;AACR,KAAA;AAEA;;;KAIA,IAAK1B,MAAO2B,CAAAA,UAAU,KAAK,gBAAA,IAAoB,CAAC,CAAC3B,MAAAA,CAAOuB,eAAe,EAAElK,MAAS,EAAA;QACjF,OAAO,KAAA,CAAA;AACR,KAAA;IAEA,OAAO,KAAA,CAAA;AACR;;;;;;"}
package/dist/index.html CHANGED
@@ -1,3 +1,3 @@
1
1
  <!doctype html><html lang="en"><head><meta charset="UTF-8"/><link rel="icon" href="data:;base64,iVBORw0KGgo="/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Sonda report</title><link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='512' height='512' fill='none'%3E%3Cpath fill='%23FACC15' d='M0 0h512v512H0V0Z'/%3E%3Cpath fill='%23000' d='m264.536 203.704-41.984 89.6-21.504-9.728c-20.139-9.216-35.669-21.504-46.592-36.864-10.923-15.36-16.384-37.717-16.384-67.072 0-37.547 9.728-65.536 29.184-83.968 19.797-18.773 52.395-28.33 97.792-28.672 18.773 0 35.84.853 51.2 2.56s27.648 3.584 36.864 5.632l13.824 2.56-10.24 82.432-12.8-1.536c-8.192-1.024-18.432-1.877-30.72-2.56-12.288-1.024-24.235-1.536-35.84-1.536-12.288 0-21.675 1.877-28.16 5.632-6.144 3.413-9.216 10.069-9.216 19.968 0 5.461 2.219 9.899 6.656 13.312 4.437 3.413 10.411 6.827 17.92 10.24Zm-18.432 100.864 42.496-90.624 22.016 9.728c23.211 10.24 40.107 23.04 50.688 38.4 10.581 15.019 15.872 36.523 15.872 64.512 0 37.888-9.899 67.072-29.696 87.552-19.797 20.48-52.395 30.891-97.792 31.232-22.528 0-43.52-1.536-62.976-4.608-19.456-2.731-36.693-5.973-51.712-9.728l10.24-82.432 12.288 2.048c8.533 1.365 19.797 2.731 33.792 4.096 13.995 1.365 29.355 2.048 46.08 2.048 12.971 0 22.699-1.877 29.184-5.632 6.485-3.755 9.728-9.899 9.728-18.432 0-5.803-1.536-10.411-4.608-13.824-3.072-3.413-8.533-6.827-16.384-10.24l-9.216-4.096Z'/%3E%3C/svg%3E"/><script type="module" crossorigin>var Fr=Object.defineProperty;var qe=t=>{throw TypeError(t)};var qr=(t,e,r)=>e in t?Fr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Q=(t,e,r)=>qr(t,typeof e!="symbol"?e+"":e,r),ce=(t,e,r)=>e.has(t)||qe("Cannot "+r);var nt=(t,e,r)=>(ce(t,e,"read from private field"),r?r.call(t):e.get(t)),zt=(t,e,r)=>e.has(t)?qe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),de=(t,e,r,n)=>(ce(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),He=(t,e,r)=>(ce(t,e,"access private method"),r);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=r(i);fetch(i.href,o)}})();window.SONDA_JSON_REPORT=JSON.parse(String.raw`__REPORT_DATA__`);const Hr=!1;var Te=Array.isArray,Ne=Array.from,Wr=Object.defineProperty,Rt=Object.getOwnPropertyDescriptor,Ur=Object.getOwnPropertyDescriptors,Vr=Object.prototype,Gr=Array.prototype,nr=Object.getPrototypeOf;function Jr(t){return typeof t=="function"}const Pt=()=>{};function Kr(t){return t()}function he(t){for(var e=0;e<t.length;e++)t[e]()}const ot=2,ir=4,Tt=8,Ae=16,st=32,ne=64,gt=128,Kt=256,Y=512,vt=1024,Bt=2048,_t=4096,jt=8192,or=16384,Ft=32768,Yr=1<<18,Yt=1<<19,ct=Symbol("$state"),Zr=Symbol("");function sr(t){return t===this.v}function ar(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Xr(t){return!ar(t,this.v)}function Qr(t){throw new Error("effect_in_teardown")}function $r(){throw new Error("effect_in_unowned_derived")}function tn(t){throw new Error("effect_orphan")}function en(){throw new Error("effect_update_depth_exceeded")}function rn(){throw new Error("state_descriptors_fixed")}function nn(){throw new Error("state_prototype_fixed")}function on(){throw new Error("state_unsafe_local_read")}function sn(){throw new Error("state_unsafe_mutation")}function G(t){return{f:0,v:t,reactions:null,equals:sr,version:0}}function B(t){return ln(G(t))}function an(t){var r;const e=G(t);return e.equals=Xr,R!==null&&R.l!==null&&((r=R.l).s??(r.s=[])).push(e),e}function ln(t){return z!==null&&z.f&ot&&(rt===null?En([t]):rt.push(t)),t}function T(t,e){return z!==null&&me()&&z.f&ot&&(rt===null||!rt.includes(t))&&sn(),t.equals(e)||(t.v=e,t.version=yr(),lr(t,vt),me()&&O!==null&&O.f&Y&&!(O.f&st)&&(j!==null&&j.includes(t)?(et(O,vt),le(O)):dt===null?kn([t]):dt.push(t))),e}function lr(t,e){var r=t.reactions;if(r!==null)for(var n=me(),i=r.length,o=0;o<i;o++){var s=r[o],f=s.f;f&vt||!n&&s===O||(et(s,e),f&(Y|gt)&&(f&ot?lr(s,Bt):le(s)))}}const Me=1,ze=2,ur=4,un=8,fn=16,cn=4,dn=1,vn=2,q=Symbol();let fr=!1;function H(t,e=null,r){if(typeof t!="object"||t===null||ct in t)return t;const n=nr(t);if(n!==Vr&&n!==Gr)return t;var i=new Map,o=Te(t),s=G(0);o&&i.set("length",G(t.length));var f;return new Proxy(t,{defineProperty(a,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&rn();var d=i.get(l);return d===void 0?(d=G(u.value),i.set(l,d)):T(d,H(u.value,f)),!0},deleteProperty(a,l){var u=i.get(l);return u===void 0?l in a&&i.set(l,G(q)):(T(u,q),We(s)),!0},get(a,l,u){var _;if(l===ct)return t;var d=i.get(l),v=l in a;if(d===void 0&&(!v||(_=Rt(a,l))!=null&&_.writable)&&(d=G(H(v?a[l]:q,f)),i.set(l,d)),d!==void 0){var c=h(d);return c===q?void 0:c}return Reflect.get(a,l,u)},getOwnPropertyDescriptor(a,l){var u=Reflect.getOwnPropertyDescriptor(a,l);if(u&&"value"in u){var d=i.get(l);d&&(u.value=h(d))}else if(u===void 0){var v=i.get(l),c=v==null?void 0:v.v;if(v!==void 0&&c!==q)return{enumerable:!0,configurable:!0,value:c,writable:!0}}return u},has(a,l){var c;if(l===ct)return!0;var u=i.get(l),d=u!==void 0&&u.v!==q||Reflect.has(a,l);if(u!==void 0||O!==null&&(!d||(c=Rt(a,l))!=null&&c.writable)){u===void 0&&(u=G(d?H(a[l],f):q),i.set(l,u));var v=h(u);if(v===q)return!1}return d},set(a,l,u,d){var w;var v=i.get(l),c=l in a;if(o&&l==="length")for(var _=u;_<v.v;_+=1){var p=i.get(_+"");p!==void 0?T(p,q):_ in a&&(p=G(q),i.set(_+"",p))}v===void 0?(!c||(w=Rt(a,l))!=null&&w.writable)&&(v=G(void 0),T(v,H(u,f)),i.set(l,v)):(c=v.v!==q,T(v,H(u,f)));var x=Reflect.getOwnPropertyDescriptor(a,l);if(x!=null&&x.set&&x.set.call(d,u),!c){if(o&&typeof l=="string"){var b=i.get("length"),E=Number(l);Number.isInteger(E)&&E>=b.v&&T(b,E+1)}We(s)}return!0},ownKeys(a){h(s);var l=Reflect.ownKeys(a).filter(v=>{var c=i.get(v);return c===void 0||c.v!==q});for(var[u,d]of i)d.v!==q&&!(u in a)&&l.push(u);return l},setPrototypeOf(){nn()}})}function We(t,e=1){T(t,t.v+e)}function Ue(t){return t!==null&&typeof t=="object"&&ct in t?t[ct]:t}function hn(t,e){return Object.is(Ue(t),Ue(e))}var Ve,it,cr,dr;function _n(){if(Ve===void 0){Ve=window,it=document;var t=Element.prototype,e=Node.prototype;cr=Rt(e,"firstChild").get,dr=Rt(e,"nextSibling").get,t.__click=void 0,t.__className="",t.__attributes=null,t.__e=void 0,Text.prototype.__t=void 0}}function Pe(t=""){return document.createTextNode(t)}function Ot(t){return cr.call(t)}function ie(t){return dr.call(t)}function g(t){return Ot(t)}function C(t,e){{var r=Ot(t);return r instanceof Comment&&r.data===""?ie(r):r}}function m(t,e=1,r=!1){let n=t;for(;e--;)n=ie(n);return n}function pn(t){t.textContent=""}function vr(t){O===null&&z===null&&tn(),z!==null&&z.f&gt&&$r(),Le&&Qr()}function gn(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function Nt(t,e,r,n=!0){var i=(t&ne)!==0,o=O,s={ctx:R,deps:null,nodes_start:null,nodes_end:null,f:t|vt,first:null,fn:e,last:null,next:null,parent:i?null:o,prev:null,teardown:null,transitions:null,version:0};if(r){var f=xt;try{Ge(!0),ae(s),s.f|=or}catch(u){throw wt(s),u}finally{Ge(f)}}else e!==null&&le(s);var a=r&&s.deps===null&&s.first===null&&s.nodes_start===null&&s.teardown===null;if(!a&&!i&&n&&(o!==null&&gn(s,o),z!==null&&z.f&ot)){var l=z;(l.children??(l.children=[])).push(s)}return s}function wn(t){const e=Nt(Tt,null,!1);return et(e,Y),e.teardown=t,e}function _e(t){vr();var e=O!==null&&(O.f&Tt)!==0&&R!==null&&!R.m;if(e){var r=R;(r.e??(r.e=[])).push({fn:t,parent:O})}else{var n=At(t);return n}}function mn(t){return vr(),De(t)}function bn(t){const e=Nt(ne,t,!0);return()=>{wt(e)}}function At(t){return Nt(ir,t,!1)}function De(t){return Nt(Tt,t,!0)}function A(t){return De(t)}function oe(t,e=0){return Nt(Tt|Ae|e,t,!0)}function pt(t,e=!0){return Nt(Tt|st,t,!0,e)}function hr(t){var e=t.teardown;if(e!==null){const r=Le,n=z;Je(!0),Ke(null);try{e.call(null)}finally{Je(r),Ke(n)}}}function wt(t,e=!0){var r=!1;if((e||t.f&Yr)&&t.nodes_start!==null){for(var n=t.nodes_start,i=t.nodes_end;n!==null;){var o=n===i?null:ie(n);n.remove(),n=o}r=!0}Er(t,e&&!r),Ct(t,0),et(t,jt);var s=t.transitions;if(s!==null)for(const a of s)a.stop();hr(t);var f=t.parent;f!==null&&f.first!==null&&_r(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.parent=t.fn=t.nodes_start=t.nodes_end=null}function _r(t){var e=t.parent,r=t.prev,n=t.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),e!==null&&(e.first===t&&(e.first=n),e.last===t&&(e.last=r))}function Zt(t,e){var r=[];Re(t,r,!0),pr(r,()=>{wt(t),e&&e()})}function pr(t,e){var r=t.length;if(r>0){var n=()=>--r||e();for(var i of t)i.out(n)}else e()}function Re(t,e,r){if(!(t.f&_t)){if(t.f^=_t,t.transitions!==null)for(const s of t.transitions)(s.is_global||r)&&e.push(s);for(var n=t.first;n!==null;){var i=n.next,o=(n.f&Ft)!==0||(n.f&st)!==0;Re(n,e,o?r:!1),n=i}}}function Xt(t){gr(t,!0)}function gr(t,e){if(t.f&_t){t.f^=_t,qt(t)&&ae(t);for(var r=t.first;r!==null;){var n=r.next,i=(r.f&Ft)!==0||(r.f&st)!==0;gr(r,i?e:!1),r=n}if(t.transitions!==null)for(const o of t.transitions)(o.is_global||e)&&o.in()}}let pe=!1,ge=[];function yn(){pe=!1;const t=ge.slice();ge=[],he(t)}function se(t){pe||(pe=!0,queueMicrotask(yn)),ge.push(t)}function S(t){let e=ot|vt;O===null&&(e|=gt);const r={children:null,deps:null,equals:sr,f:e,fn:t,reactions:null,v:null,version:0};if(z!==null&&z.f&ot){var n=z;(n.children??(n.children=[])).push(r)}return r}function wr(t){var e=t.children;if(e!==null){t.children=null;for(var r=0;r<e.length;r+=1){var n=e[r];n.f&ot?xn(n):wt(n)}}}function mr(t){var e;wr(t),e=xr(t);var r=(yt||t.f&gt)&&t.deps!==null?Bt:Y;et(t,r),t.equals(e)||(t.v=e,t.version=yr())}function xn(t){wr(t),Ct(t,0),et(t,jt),t.children=t.deps=t.reactions=t.fn=null}let Qt=!1,xt=!1,Le=!1;function Ge(t){xt=t}function Je(t){Le=t}let we=[],Lt=0;let z=null;function Ke(t){z=t}let O=null;function Ye(t){O=t}let rt=null;function En(t){rt=t}let j=null,V=0,dt=null;function kn(t){dt=t}let br=0,yt=!1,R=null;function yr(){return++br}function me(){return R!==null&&R.l===null}function qt(t){var s,f;var e=t.f;if(e&vt)return!0;if(e&Bt){var r=t.deps,n=(e&gt)!==0;if(r!==null){var i;if(e&Kt){for(i=0;i<r.length;i++)((s=r[i]).reactions??(s.reactions=[])).push(t);t.f^=Kt}for(i=0;i<r.length;i++){var o=r[i];if(qt(o)&&mr(o),n&&O!==null&&!yt&&!((f=o==null?void 0:o.reactions)!=null&&f.includes(t))&&(o.reactions??(o.reactions=[])).push(t),o.version>t.version)return!0}}n||et(t,Y)}return!1}function On(t,e,r){throw t}function xr(t){var u;var e=j,r=V,n=dt,i=z,o=yt,s=rt;j=null,V=0,dt=null,z=t.f&(st|ne)?null:t,yt=!xt&&(t.f&gt)!==0,rt=null;try{var f=(0,t.fn)(),a=t.deps;if(j!==null){var l;if(Ct(t,V),a!==null&&V>0)for(a.length=V+j.length,l=0;l<j.length;l++)a[V+l]=j[l];else t.deps=a=j;if(!yt)for(l=V;l<a.length;l++)((u=a[l]).reactions??(u.reactions=[])).push(t)}else a!==null&&V<a.length&&(Ct(t,V),a.length=V);return f}finally{j=e,V=r,dt=n,z=i,yt=o,rt=s}}function Sn(t,e){let r=e.reactions;if(r!==null){var n=r.indexOf(t);if(n!==-1){var i=r.length-1;i===0?r=e.reactions=null:(r[n]=r[i],r.pop())}}r===null&&e.f&ot&&(j===null||!j.includes(e))&&(et(e,Bt),e.f&(gt|Kt)||(e.f^=Kt),Ct(e,0))}function Ct(t,e){var r=t.deps;if(r!==null)for(var n=e;n<r.length;n++)Sn(t,r[n])}function Er(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){var n=r.next;wt(r,e),r=n}}function ae(t){var e=t.f;if(!(e&jt)){et(t,Y);var r=O,n=R;O=t,R=t.ctx;try{e&Ae||Er(t),hr(t);var i=xr(t);t.teardown=typeof i=="function"?i:null,t.version=br}catch(o){On(o)}finally{O=r,R=n}}}function Tn(){Lt>1e3&&(Lt=0,en()),Lt++}function Nn(t){var e=t.length;if(e!==0){Tn();var r=xt;xt=!0;try{for(var n=0;n<e;n++){var i=t[n];if(i.f&Yt&&(i.f^=Yt),i.first===null&&!(i.f&st))Ze([i]);else{var o=[];kr(i,o),Ze(o)}}}finally{xt=r}}}function Ze(t){var e=t.length;if(e!==0)for(var r=0;r<e;r++){var n=t[r];!(n.f&(jt|_t))&&qt(n)&&(ae(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?_r(n):n.fn=null))}}function An(){if(Qt=!1,Lt>1001)return;const t=we;we=[],Nn(t),Qt||(Lt=0)}function le(t){Qt||(Qt=!0,queueMicrotask(An));for(var e=t;e.parent!==null;){e=e.parent;var r=e.f;if(r&st){if(!(r&Y))return;e.f^=Y}if(r&ne){if(r&Yt)return;e.f^=Yt}}we.push(e)}function kr(t,e){var r=t.first,n=[];t:for(;r!==null;){var i=r.f,o=(i&_t)===0,s=(i&st)!==0,f=(i&Y)!==0,a=r.first;if(o&&(!s||!f))if(s&&et(r,Y),i&Tt){if(!s&&qt(r)&&ae(r),a=r.first,a!==null){r=a;continue}}else i&ir&&n.push(r);var l=r.next;if(l===null){let v=r.parent;for(;v!==null;){if(t===v)break t;var u=v.next;if(u!==null){r=u;continue t}v=v.parent}}r=l}for(var d=0;d<n.length;d++)a=n[d],e.push(a),kr(a,e)}function h(t){var e=t.f;if(e&jt)return t.v;if(z!==null){rt!==null&&rt.includes(t)&&on();var r=z.deps;j===null&&r!==null&&r[V]===t?V++:j===null?j=[t]:j.push(t),dt!==null&&O!==null&&O.f&Y&&!(O.f&st)&&dt.includes(t)&&(et(O,vt),le(O))}if(e&ot){var n=t;qt(n)&&mr(n)}return t.v}function Ht(t){const e=z;try{return z=null,t()}finally{z=e}}const Mn=~(vt|Bt|Y);function et(t,e){t.f=t.f&Mn|e}function W(t,e=!1,r){R={p:R,c:null,e:null,m:!1,s:t,x:null,l:null},e||(R.l={s:null,u:null,r1:[],r2:G(!1)})}function U(t){const e=R;if(e!==null){const o=e.e;if(o!==null){var r=O;e.e=null;try{for(var n=0;n<o.length;n++){var i=o[n];Ye(i.parent),At(i.fn)}}finally{Ye(r)}}R=e.p,e.m=!0}return{}}function zn(t){if(!(typeof t!="object"||!t||t instanceof EventTarget)){if(ct in t)be(t);else if(!Array.isArray(t))for(let e in t){const r=t[e];typeof r=="object"&&r&&ct in r&&be(r)}}}function be(t,e=new Set){if(typeof t=="object"&&t!==null&&!(t instanceof EventTarget)&&!e.has(t)){e.add(t),t instanceof Date&&t.getTime();for(let n in t)try{be(t[n],e)}catch{}const r=nr(t);if(r!==Object.prototype&&r!==Array.prototype&&r!==Map.prototype&&r!==Set.prototype&&r!==Date.prototype){const n=Ur(r);for(let i in n){const o=n[i].get;if(o)try{o.call(t)}catch{}}}}}const Or=new Set,ye=new Set;function Pn(t,e,r,n){function i(o){if(n.capture||Dt.call(e,o),!o.cancelBubble)return r.call(this,o)}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?se(()=>{e.addEventListener(t,i,n)}):e.addEventListener(t,i,n),i}function Et(t,e,r,n,i){var o={capture:n,passive:i},s=Pn(t,e,r,o);(e===document.body||e===window||e===document)&&wn(()=>{e.removeEventListener(t,s,o)})}function ue(t){for(var e=0;e<t.length;e++)Or.add(t[e]);for(var r of ye)r(t)}function Dt(t){var x;var e=this,r=e.ownerDocument,n=t.type,i=((x=t.composedPath)==null?void 0:x.call(t))||[],o=i[0]||t.target,s=0,f=t.__root;if(f){var a=i.indexOf(f);if(a!==-1&&(e===document||e===window)){t.__root=e;return}var l=i.indexOf(e);if(l===-1)return;a<=l&&(s=a)}if(o=i[s]||t.target,o!==e){Wr(t,"currentTarget",{configurable:!0,get(){return o||r}});try{for(var u,d=[];o!==null;){var v=o.assignedSlot||o.parentNode||o.host||null;try{var c=o["__"+n];if(c!==void 0&&!o.disabled)if(Te(c)){var[_,...p]=c;_.apply(o,[t,...p])}else c.call(o,t)}catch(b){u?d.push(b):u=b}if(t.cancelBubble||v===e||v===null)break;o=v}if(u){for(let b of d)queueMicrotask(()=>{throw b});throw u}}finally{t.__root=e,delete t.currentTarget}}}function Sr(t){var e=document.createElement("template");return e.innerHTML=t,e.content}function $t(t,e){var r=O;r.nodes_start===null&&(r.nodes_start=t,r.nodes_end=e)}function N(t,e){var r=(e&dn)!==0,n=(e&vn)!==0,i,o=!t.startsWith("<!>");return()=>{i===void 0&&(i=Sr(o?t:"<!>"+t),r||(i=Ot(i)));var s=n?document.importNode(i,!0):i.cloneNode(!0);if(r){var f=Ot(s),a=s.lastChild;$t(f,a)}else $t(s,s);return s}}function Tr(t,e,r="svg"){var n=!t.startsWith("<!>"),i=`<${r}>${n?t:"<!>"+t}</${r}>`,o;return()=>{if(!o){var s=Sr(i),f=Ot(s);o=Ot(f)}var a=o.cloneNode(!0);return $t(a,a),a}}function Ce(){var t=document.createDocumentFragment(),e=document.createComment(""),r=Pe();return t.append(e,r),$t(e,r),t}function k(t,e){t!==null&&t.before(e)}const Dn=["wheel","mousewheel","touchstart","touchmove"];function Rn(t){return Dn.includes(t)}let xe=!0;function M(t,e){e!==(t.__t??(t.__t=t.nodeValue))&&(t.__t=e,t.nodeValue=e==null?"":e+"")}function Ln(t,e){const r=e.anchor??e.target.appendChild(Pe());return Cn(t,{...e,anchor:r})}const bt=new Map;function Cn(t,{target:e,anchor:r,props:n={},events:i,context:o,intro:s=!0}){_n();var f=new Set,a=d=>{for(var v=0;v<d.length;v++){var c=d[v];if(!f.has(c)){f.add(c);var _=Rn(c);e.addEventListener(c,Dt,{passive:_});var p=bt.get(c);p===void 0?(document.addEventListener(c,Dt,{passive:_}),bt.set(c,1)):bt.set(c,p+1)}}};a(Ne(Or)),ye.add(a);var l=void 0,u=bn(()=>(pt(()=>{if(o){W({});var d=R;d.c=o}i&&(n.$$events=i),xe=s,l=t(r,n)||{},xe=!0,o&&U()}),()=>{for(var d of f){e.removeEventListener(d,Dt);var v=bt.get(d);--v===0?(document.removeEventListener(d,Dt),bt.delete(d)):bt.set(d,v)}ye.delete(a),Xe.delete(l)}));return Xe.set(l,u),l}let Xe=new WeakMap;function L(t,e,r,n=null,i=!1){var o=t,s=null,f=null,a=null,l=i?Ft:0;oe(()=>{a!==(a=!!e())&&(a?(s?Xt(s):s=pt(()=>r(o)),f&&Zt(f,()=>{f=null})):(f?Xt(f):n&&(f=pt(()=>n(o))),s&&Zt(s,()=>{s=null})))},l)}function In(t,e,r){var n=t,i=q,o;oe(()=>{ar(i,i=e())&&(o&&Zt(o),o=pt(()=>r(n)))})}let ve=null;function Bn(t,e){return e}function jn(t,e,r,n){for(var i=[],o=e.length,s=0;s<o;s++)Re(e[s].e,i,!0);var f=o>0&&i.length===0&&r!==null;if(f){var a=r.parentNode;pn(a),a.append(r),n.clear(),at(t,e[0].prev,e[o-1].next)}pr(i,()=>{for(var l=0;l<o;l++){var u=e[l];f||(n.delete(u.k),at(t,u.prev,u.next)),wt(u.e,!f)}})}function Ie(t,e,r,n,i,o=null){var s=t,f={flags:e,items:new Map,first:null},a=(e&ur)!==0;if(a){var l=t;s=l.appendChild(Pe())}var u=null;oe(()=>{var d=r(),v=Te(d)?d:d==null?[]:Ne(d),c=v.length;Fn(v,f,s,i,e,n),o!==null&&(c===0?u?Xt(u):u=pt(()=>o(s)):u!==null&&Zt(u,()=>{u=null}))})}function Fn(t,e,r,n,i,o){var Wt,Mt,Ut,Vt;var s=(i&un)!==0,f=(i&(Me|ze))!==0,a=t.length,l=e.items,u=e.first,d=u,v,c=null,_,p=[],x=[],b,E,w,y;if(s)for(y=0;y<a;y+=1)b=t[y],E=o(b,y),w=l.get(E),w!==void 0&&((Wt=w.a)==null||Wt.measure(),(_??(_=new Set)).add(w));for(y=0;y<a;y+=1){if(b=t[y],E=o(b,y),w=l.get(E),w===void 0){var Z=d?d.e.nodes_start:r;c=Hn(Z,e,c,c===null?e.first:c.next,b,E,y,n,i),l.set(E,c),p=[],x=[],d=c.next;continue}if(f&&qn(w,b,y,i),w.e.f&_t&&(Xt(w.e),s&&((Mt=w.a)==null||Mt.unfix(),(_??(_=new Set)).delete(w))),w!==d){if(v!==void 0&&v.has(w)){if(p.length<x.length){var X=x[0],P;c=X.prev;var D=p[0],J=p[p.length-1];for(P=0;P<p.length;P+=1)Qe(p[P],X,r);for(P=0;P<x.length;P+=1)v.delete(x[P]);at(e,D.prev,J.next),at(e,c,D),at(e,J,X),d=X,c=J,y-=1,p=[],x=[]}else v.delete(w),Qe(w,d,r),at(e,w.prev,w.next),at(e,w,c===null?e.first:c.next),at(e,c,w),c=w;continue}for(p=[],x=[];d!==null&&d.k!==E;)(v??(v=new Set)).add(d),x.push(d),d=d.next;if(d===null)continue;w=d}p.push(w),c=w,d=w.next}if(d!==null||v!==void 0){for(var F=v===void 0?[]:Ne(v);d!==null;)F.push(d),d=d.next;var mt=F.length;if(mt>0){var fe=i&ur&&a===0?r:null;if(s){for(y=0;y<mt;y+=1)(Ut=F[y].a)==null||Ut.measure();for(y=0;y<mt;y+=1)(Vt=F[y].a)==null||Vt.fix()}jn(e,F,fe,l)}}s&&se(()=>{var Gt;if(_!==void 0)for(w of _)(Gt=w.a)==null||Gt.apply()}),O.first=e.first&&e.first.e,O.last=c&&c.e}function qn(t,e,r,n){n&Me&&T(t.v,e),n&ze?T(t.i,r):t.i=r}function Hn(t,e,r,n,i,o,s,f,a){var l=ve;try{var u=(a&Me)!==0,d=(a&fn)===0,v=u?d?an(i):G(i):i,c=a&ze?G(s):s,_={i:c,v,k:o,a:null,e:null,prev:r,next:n};return ve=_,_.e=pt(()=>f(t,v,c),fr),_.e.prev=r&&r.e,_.e.next=n&&n.e,r===null?e.first=_:(r.next=_,r.e.next=_.e),n!==null&&(n.prev=_,n.e.prev=_.e),_}finally{ve=l}}function Qe(t,e,r){for(var n=t.next?t.next.e.nodes_start:r,i=e?e.e.nodes_start:r,o=t.e.nodes_start;o!==n;){var s=ie(o);i.before(o),o=s}}function at(t,e,r){e===null?t.first=r:(e.next=r,e.e.next=r&&r.e),r!==null&&(r.prev=e,r.e.prev=e&&e.e)}function Wn(t,e,...r){var n=t,i=Pt,o;oe(()=>{i!==(i=e())&&(o&&(wt(o),o=null),o=pt(()=>i(n,...r)))},Ft)}function I(t,e,r,n){r=r==null?null:r+"";var i=t.__attributes??(t.__attributes={});i[e]!==(i[e]=r)&&(e==="loading"&&(t[Zr]=r),r===null?t.removeAttribute(e):t.setAttribute(e,r))}function Un(t,e){var r=t.__className,n=Vn(e);(r!==n||fr)&&(n===""?t.removeAttribute("class"):t.setAttribute("class",n),t.__className=n)}function Vn(t){return t??""}function te(t,e,r){if(r){if(t.classList.contains(e))return;t.classList.add(e)}else{if(!t.classList.contains(e))return;t.classList.remove(e)}}function $e(t,e,r,n,i){var o=t.__attributes??(t.__attributes={}),s=t.style,f="style-"+e;o[f]===r&&s.getPropertyValue(e)===r||(o[f]=r,r==null?s.removeProperty(e):s.setProperty(e,r,""))}const Gn=requestAnimationFrame,Jn=()=>performance.now(),ut={tick:t=>Gn(t),now:()=>Jn(),tasks:new Set};function Nr(t){ut.tasks.forEach(e=>{e.c(t)||(ut.tasks.delete(e),e.f())}),ut.tasks.size!==0&&ut.tick(Nr)}function Kn(t){let e;return ut.tasks.size===0&&ut.tick(Nr),{promise:new Promise(r=>{ut.tasks.add(e={c:t,f:r})}),abort(){ut.tasks.delete(e)}}}function Jt(t,e){t.dispatchEvent(new CustomEvent(e))}function Yn(t){const e=t.split("-");return e.length===1?e[0]:e[0]+e.slice(1).map(r=>r[0].toUpperCase()+r.slice(1)).join("")}function tr(t){const e={},r=t.split(";");for(const n of r){const[i,o]=n.split(":");if(!i||o===void 0)break;const s=Yn(i.trim());e[s]=o.trim()}return e}const Zn=t=>t;function Xn(t,e,r,n){var i=(t&cn)!==0,o="both",s,f=e.inert,a,l;function u(){return s??(s=r()(e,(n==null?void 0:n())??{},{direction:o}))}var d={is_global:i,in(){e.inert=f,Jt(e,"introstart"),a=Ee(e,u(),l,1,()=>{Jt(e,"introend"),a==null||a.abort(),a=s=void 0})},out(p){e.inert=!0,Jt(e,"outrostart"),l=Ee(e,u(),a,0,()=>{Jt(e,"outroend"),p==null||p()})},stop:()=>{a==null||a.abort(),l==null||l.abort()}},v=O;if((v.transitions??(v.transitions=[])).push(d),xe){var c=i;if(!c){for(var _=v.parent;_&&_.f&Ft;)for(;(_=_.parent)&&!(_.f&Ae););c=!_||(_.f&or)!==0}c&&At(()=>{Ht(()=>d.in())})}}function Ee(t,e,r,n,i){var o=n===1;if(Jr(e)){var s,f=!1;return se(()=>{if(!f){var x=e({direction:o?"in":"out"});s=Ee(t,x,r,n,i)}}),{abort:()=>{f=!0,s==null||s.abort()},deactivate:()=>s.deactivate(),reset:()=>s.reset(),t:()=>s.t()}}if(r==null||r.deactivate(),!(e!=null&&e.duration))return i(),{abort:Pt,deactivate:Pt,reset:Pt,t:()=>n};const{delay:a=0,css:l,tick:u,easing:d=Zn}=e;var v=[];if(o&&r===void 0&&(u&&u(0,1),l)){var c=tr(l(0,1));v.push(c,c)}var _=()=>1-n,p=t.animate(v,{duration:a});return p.onfinish=()=>{var x=(r==null?void 0:r.t())??1-n;r==null||r.abort();var b=n-x,E=e.duration*Math.abs(b),w=[];if(E>0){if(l)for(var y=Math.ceil(E/16.666666666666668),Z=0;Z<=y;Z+=1){var X=x+b*d(Z/y),P=l(X,1-X);w.push(tr(P))}_=()=>{var D=p.currentTime;return x+b*d(D/E)},u&&Kn(()=>{if(p.playState!=="running")return!1;var D=_();return u(D,1-D),!0})}p=t.animate(w,{duration:E,fill:"forwards"}),p.onfinish=()=>{_=()=>n,u==null||u(n,1-n),i()}},{abort:()=>{p&&(p.cancel(),p.effect=null)},deactivate:()=>{i=Pt},reset:()=>{n===0&&(u==null||u(1,0))},t:()=>_()}}function ke(t,e,r){if(t.multiple)return $n(t,e);for(var n of t.options){var i=Ar(n);if(hn(i,e)){n.selected=!0;return}}(!r||e!==void 0)&&(t.selectedIndex=-1)}function Qn(t,e){let r=!0;At(()=>{e&&ke(t,Ht(e),r),r=!1;var n=new MutationObserver(()=>{var i=t.__value;ke(t,i)});return n.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),()=>{n.disconnect()}})}function $n(t,e){for(var r of t.options)r.selected=~e.indexOf(Ar(r))}function Ar(t){return"__value"in t?t.__value:t.value}var lt,kt,It,ee,Mr;const re=class re{constructor(e){zt(this,ee);zt(this,lt,new WeakMap);zt(this,kt);zt(this,It);de(this,It,e)}observe(e,r){var n=nt(this,lt).get(e)||new Set;return n.add(r),nt(this,lt).set(e,n),He(this,ee,Mr).call(this).observe(e,nt(this,It)),()=>{var i=nt(this,lt).get(e);i.delete(r),i.size===0&&(nt(this,lt).delete(e),nt(this,kt).unobserve(e))}}};lt=new WeakMap,kt=new WeakMap,It=new WeakMap,ee=new WeakSet,Mr=function(){return nt(this,kt)??de(this,kt,new ResizeObserver(e=>{for(var r of e){re.entries.set(r.target,r);for(var n of nt(this,lt).get(r.target)||[])n(r)}}))},Q(re,"entries",new WeakMap);let Oe=re;var ti=new Oe({box:"border-box"});function ft(t,e,r){var n=ti.observe(t,()=>r(t[e]));At(()=>(Ht(()=>r(t[e])),n))}function er(t,e){return t===e||(t==null?void 0:t[ct])===e}function ei(t={},e,r,n){return At(()=>{var i,o;return De(()=>{i=o,o=[],Ht(()=>{t!==r(...o)&&(e(t,...o),i&&er(r(...i),t)&&e(null,...i))})}),()=>{se(()=>{o&&er(r(...o),t)&&e(null,...o)})}}),t}function Be(){const t=R,e=t.l.u;e&&(e.b.length&&mn(()=>{rr(t),he(e.b)}),_e(()=>{const r=Ht(()=>e.m.map(Kr));return()=>{for(const n of r)typeof n=="function"&&n()}}),e.a.length&&_e(()=>{rr(t),he(e.a)}))}function rr(t){if(t.l.s)for(const e of t.l.s)h(e);zn(t.s)}const ri="5";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(ri);const ni=t=>t;function ii(t,{delay:e=0,duration:r=400,easing:n=ni}={}){const i=+getComputedStyle(t).opacity;return{delay:e,duration:r,easing:n,css:o=>`opacity: ${o*i}`}}function oi(t){return Object.entries(t.outputs).map(([e,r])=>{const n=new si;return Object.entries(r.inputs).forEach(([i,o])=>n.insert(i,o)),n.root.name=e,n.root.uncompressed=r.uncompressed,n.root.gzip=r.gzip,n.root.brotli=r.brotli,n.optimize(),n})}function ht(t){return"items"in t}class si{constructor(){Q(this,"root");this.root=this.createNode("","")}createNode(e,r){return{name:e,path:r,uncompressed:0,gzip:0,brotli:0,items:[]}}insert(e,r){const n=e.split("/"),i=n.pop();let o=this.root;n.forEach(s=>{let f=o.items.find(a=>ht(a)&&a.name===s);f||(f=this.createNode(s,o.path?`${o.path}/${s}`:s),o.items.push(f)),o=f,o.uncompressed+=r.uncompressed,o.gzip+=r.gzip,o.brotli+=r.brotli}),o.items.push({name:i,path:o.path?`${o.path}/${i}`:i,uncompressed:r.uncompressed,gzip:r.gzip,brotli:r.brotli})}optimize(){const e=[this.root];for(;e.length;){const r=e.pop();for(;r.items.length===1&&ht(r.items[0]);){const n=r.items[0];r.name=`${r.name}/${n.name}`,r.path=n.path,r.items=n.items}r.items.sort((n,i)=>i.uncompressed-n.uncompressed),r.items.forEach(n=>ht(n)&&e.push(n))}}get(e){let r=this.root;for(;r&&r.path!==e;)r=ht(r)&&r.items.find(n=>e.startsWith(n.path))||null;return r}}const Se=oi(window.SONDA_JSON_REPORT);function ai(){let t=B(0);const e=S(()=>Se.at(h(t)));return{get index(){return h(t)},get output(){return h(e)},setIndex(r){T(t,H(r))}}}function li(){let t=B("uncompressed");return{get type(){return h(t)},setType(e){T(t,H(e))}}}function ui(){let t=H({file:null,folder:null,output:null}),e=H([]);return{get file(){return t.file},get folder(){return t.folder},get output(){return t.output},open(r,n){e.push(r),t[r]=n},close(){e.length!==0&&(t[e.pop()]=null)}}}const K=ai(),St=li(),$=ui();var fi=()=>$.close(),ci=N('<div class="fixed top-0 right-0 left-0 bottom-0 flex justify-center items-center"><div class="fixed bg-gray-200/70 w-full h-full backdrop-blur-sm" aria-hidden="true"></div> <div class="bg-white relative flex flex-col rounded-lg border p-6 shadow-lg overflow-hidden max-h-[95vh] max-w-[95vw]"><div class="mb-4"><h2 class="py-2 pr-6 block align-text-bottom font-semibold leading-none tracking-tight text-base border-b-2 border-gray-300 border-dashed"> </h2> <button aria-label="Close dialog" class="absolute top-0 right-0 mt-2 mr-2 flex justify-center items-center border border-transparent rounded-full w-10 h-10 text-gray-600 hover:text-gray-900"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M0 0h24v24H0z" stroke="none"></path><path d="M18 6 6 18M6 6l12 12"></path></svg></button></div> <!></div></div>');function je(t,e){W(e,!0);let r=B(void 0);function n(v){v.target===h(r)&&$.close()}var i=ci();Et("click",it.body,n);var o=g(i);ei(o,v=>T(r,v),()=>h(r));var s=m(o,2),f=g(s),a=g(f),l=g(a),u=m(a,2);u.__click=[fi];var d=m(f,2);Wn(d,()=>e.children),A(()=>{te(s,"w-[95vw]",e.large),te(s,"h-[95vh]",e.large),M(l,e.heading)}),Xn(3,i,()=>ii,()=>({duration:150})),k(t,i),U()}ue(["click"]);function tt(t){const r=["b","KiB","MiB","GiB","TiB","PiB"];let n=t,i=0;for(;n>1024&&r.length>i+1;)n=n/1024,i++;return`${i?n.toFixed(2):n} ${r[i]}`}var di=N('<span class="text-gray-900"> </span> <span class="text-gray-600"> </span>',1),vi=Tr('<g><rect shape-rendering="crispEdges" vector-effect="non-scaling-stroke"></rect><foreignObject class="pointer-events-none"><p xmlns="http://www.w3.org/1999/xhtml" class="p-1 size-full text-center text-xs truncate"><!></p></foreignObject><!></g>');function hi(t,e){W(e,!0);const r=20,n=6,i=22,o=S(()=>e.tile.width-n*2),s=S(()=>e.tile.height-n-i),f=S(()=>tt(e.content[St.type])),a=S(()=>Math.min(e.content[St.type]/e.totalBytes*100,100).toFixed(2)),l=S(()=>`color-mix(in oklch, #fca5a5 ${h(a)}%, #86efac)`),u=S(()=>e.tile.width>=i*1.75&&e.tile.height>=i),d=S(()=>!ht(e.content)||h(s)<=r||h(o)<=r?[]:e.content.items);var v=vi(),c=g(v);A(()=>Un(c,`stroke-gray-500 ${(ht(e.content)?"cursor-zoom-in":"cursor-pointer")??""} svelte-ks9kyg`));var _=m(c),p=g(_),x=g(p);L(x,()=>h(u),E=>{var w=di(),y=C(w),Z=g(y),X=m(y,2),P=g(X);A(()=>{M(Z,e.content.name),M(P,`- ${h(f)??""}`)}),k(E,w)});var b=m(_);L(b,()=>h(d).length,E=>{var w=S(()=>e.tile.x+n),y=S(()=>e.tile.y+i);zr(E,{get content(){return h(d)},get totalBytes(){return e.totalBytes},get width(){return h(o)},get height(){return h(s)},get xStart(){return h(w)},get yStart(){return h(y)}})}),A(()=>{I(c,"data-tile",e.content.path),I(c,"data-hover",`${e.content.name} - ${h(f)} (${h(a)}%)`),I(c,"x",e.tile.x),I(c,"y",e.tile.y),I(c,"width",e.tile.width),I(c,"height",e.tile.height),I(c,"fill",h(l)),I(_,"x",e.tile.x),I(_,"y",e.tile.y),I(_,"width",e.tile.width),I(_,"height",e.tile.height)}),k(t,v),U()}class _i{constructor(e,r,n,i=0,o=0){Q(this,"sizes");Q(this,"tiles");Q(this,"xStart");Q(this,"yStart");Q(this,"widthLeft");Q(this,"heightLeft");const s=e.reduce((a,l)=>a+l,0),f=n*r/s;this.sizes=new Float32Array(e.length);for(let a=0;a<e.length;a++)this.sizes[a]=e[a]*f;this.tiles=new Array,this.xStart=i,this.yStart=o,this.widthLeft=r,this.heightLeft=n}layout(e,r,n,i,o){let s=i?this.yStart:this.xStart,f;const a=this.sizes,l=this.tiles;for(let u=e;u<=r;u++)f=a[u]/n,i?l.push({x:this.xStart,y:s,width:n,height:f}):l.push({x:s,y:this.yStart,width:f,height:n}),s+=f,o++;return i?(this.xStart+=n,this.widthLeft-=n):(this.yStart+=n,this.heightLeft-=n),o}calculate(){let e=this.heightLeft<this.widthLeft,r=e?this.heightLeft:this.widthLeft,n=r*r,i=0,o=0,s=this.sizes[0],f=this.sizes[0],a=this.sizes[0],l=0,u=s*s,d=Math.max(n*a/u,u/(n*f));for(let v=1;v<this.sizes.length;v++){const c=this.sizes[v],_=s+c,p=f<c?f:c,x=a>c?a:c,b=_*_,E=Math.max(n*x/b,b/(n*p));(d<=E?1:0)?(l=this.layout(i,o,s/r,e,l),e=this.heightLeft<this.widthLeft,r=e?this.heightLeft:this.widthLeft,n=r*r,i=v,o=v,s=c,f=c,a=c,u=c*c,d=Math.max(n*a/u,u/(n*f))):(o=v,s=_,f=p,a=x,u=b,d=E)}return l=this.layout(i,o,s/r,e,l),this.tiles}}function zr(t,e){W(e,!0);const r=S(()=>Array.isArray(e.content)?Object.values(e.content):[e.content]),n=S(()=>new _i(h(r).map(f=>f[St.type]),e.width,e.height,e.xStart,e.yStart).calculate());var i=Ce(),o=C(i);Ie(o,18,()=>h(n),s=>s,(s,f,a)=>{hi(s,{get tile(){return f},get content(){return h(r)[h(a)]},get totalBytes(){return e.totalBytes}})}),k(t,i),U()}var pi=Tr('<svg xmlns="http://www.w3.org/2000/svg" role="img"><!></svg>');function Pr(t,e){W(e,!0);var r=Ce(),n=C(r);In(n,()=>[e.content.path,e.width,e.height],i=>{var o=pi(),s=g(o),f=S(()=>e.width-1),a=S(()=>e.height-1);zr(s,{get content(){return e.content},get totalBytes(){return e.content[St.type]},get width(){return h(f)},get height(){return h(a)},xStart:.5,yStart:.5}),A(()=>{I(o,"width",e.width),I(o,"height",e.height)}),k(i,o)}),k(t,r),U()}var gi=N('<span>Approx. GZIP size</span> <span class="font-bold"> </span>',1),wi=N('<span>Approx. Brotli size</span> <span class="font-bold"> </span>',1),mi=N('<div class="mb-4 grid grid-cols-[auto_1fr] gap-x-8"><span>Bundled size</span> <span class="font-bold"> </span> <!> <!></div> <div class="flex-grow overflow-hidden"><!></div>',1);function bi(t,e){W(e,!0);let r=B(0),n=B(0);je(t,{get heading(){return e.folder.path},large:!0,children:o=>{var s=mi(),f=C(s),a=m(g(f),2),l=g(a);A(()=>M(l,tt(e.folder.uncompressed)));var u=m(a,2);L(u,()=>e.folder.gzip,_=>{var p=gi(),x=m(C(p),2),b=g(x);A(()=>M(b,tt(e.folder.gzip))),k(_,p)});var d=m(u,2);L(d,()=>e.folder.brotli,_=>{var p=wi(),x=m(C(p),2),b=g(x);A(()=>M(b,tt(e.folder.brotli))),k(_,p)});var v=m(f,2),c=g(v);Pr(c,{get content(){return e.folder},get width(){return h(r)},get height(){return h(n)}}),ft(v,"clientWidth",_=>T(r,_)),ft(v,"clientHeight",_=>T(n,_)),k(o,s)}}),U()}class yi{constructor(){Q(this,"depth",0);Q(this,"tree",[])}process(e){const r=this.getImporters(e);if(!r.length)return;if(r.length===1)return this.addLast(`imported by ${r[0]}`),this.process(r[0]);const n=r.pop();r.forEach(i=>this.add(`imported by ${i}`)),this.addLast(`imported by ${n}`)}getImporters(e){return e?Object.entries(window.SONDA_JSON_REPORT.inputs).filter(([,r])=>r.imports.includes(e)).map(([r])=>r):[]}addLast(e){this.tree.push(" ".repeat(this.depth*4)+"└── "+e),this.depth++}add(e){this.tree.push(" ".repeat(this.depth*4)+"├── "+e)}render(e){const r=window.SONDA_JSON_REPORT.inputs[e];return r.belongsTo&&(this.tree.push(`└── part of the ${r.belongsTo} bundle`),this.depth++,e=r.belongsTo),this.process(e),this.tree.join(`
2
- `)}}var xi=N('<span>File format</span> <span class="font-bold"> </span>',1),Ei=N('<span>Approx. GZIP size</span> <span class="font-bold"> </span>',1),ki=N('<span>Approx. Brotli size</span> <span class="font-bold"> </span>',1),Oi=N('<p class="mt-12">This file is in the bundle, because it is:</p> <code class="mt-2 p-4 w-max leading-5 bg-slate-200 rounded overflow-auto min-w-full"><pre> </pre></code>',1),Si=N('<div class="flex flex-col overflow-y-auto"><div class="grid grid-cols-[auto_1fr] gap-x-8"><!> <span>Original file size</span> <span class="font-bold"> </span> <span>Bundled size</span> <span class="font-bold"> </span> <!> <!></div> <!></div>');function Ti(t,e){W(e,!0);const r=S(()=>window.SONDA_JSON_REPORT.inputs[e.file.path]),n=S(()=>{var s;if(h(r))return h(r).format.toUpperCase();const o=(s=window.SONDA_JSON_REPORT.inputs[e.file.path])==null?void 0:s.belongsTo;return o?window.SONDA_JSON_REPORT.inputs[o].format.toUpperCase:"UNKNOWN"}),i=S(()=>h(r)?new yi().render(e.file.path):null);je(t,{get heading(){return e.file.path},children:s=>{var f=Si(),a=g(f),l=g(a);L(l,()=>h(n)!=="UNKNOWN",b=>{var E=xi(),w=m(C(E),2),y=g(w);A(()=>M(y,h(n))),k(b,E)});var u=m(l,4),d=g(u);A(()=>{var b;return M(d,tt(((b=h(r))==null?void 0:b.bytes)||0))});var v=m(u,4),c=g(v);A(()=>M(c,tt(e.file.uncompressed)));var _=m(v,2);L(_,()=>e.file.gzip,b=>{var E=Ei(),w=m(C(E),2),y=g(w);A(()=>M(y,tt(e.file.gzip))),k(b,E)});var p=m(_,2);L(p,()=>e.file.brotli,b=>{var E=ki(),w=m(C(E),2),y=g(w);A(()=>M(y,tt(e.file.brotli))),k(b,E)});var x=m(a,2);L(x,()=>h(i),b=>{var E=Oi(),w=m(C(E),2),y=g(w),Z=g(y);A(()=>M(Z,h(i))),k(b,E)}),k(s,f)}}),U()}var Ni=N('<span>GZIP size</span> <span class="font-bold"> </span>',1),Ai=N('<span>Brotli size</span> <span class="font-bold"> </span>',1),Mi=N('<p class="mt-12">Module types</p> <div class="mt-2 h-10 w-[40rem] max-w-full flex rounded-lg overflow-hidden"><div class="bg-yellow-300 h-full"></div> <div class="bg-blue-300 h-full"></div> <div class="bg-gray-200 h-full"></div></div> <div class="flex justify-between mt-2"><div class="flex items-center space-x-2"><div class="inline-block w-4 h-4 bg-yellow-300"></div> <p>ESM: <span class="font-semibold"> </span></p></div> <div class="flex items-center space-x-2"><div class="inline-block w-4 h-4 bg-blue-300"></div> <p>CJS: <span class="font-semibold"> </span></p></div> <div class="flex items-center space-x-2"><div class="inline-block w-4 h-4 bg-gray-300"></div> <p>Unknown: <span class="font-semibold"> </span></p></div></div>',1),zi=N('<code class="mt-2 p-4 w-max leading-5 bg-slate-200 rounded overflow-auto min-w-full"><pre> </pre></code>'),Pi=N('<div class="flex flex-col overflow-y-auto"><div class="grid grid-cols-[auto_1fr] gap-x-8"><span>Bundled size</span> <span class="font-bold"> </span> <!> <!></div></div> <!> <p class="mt-12">This asset includes <span class="font-semibold"> </span> external dependencies</p> <!>',1);function Di(t,e){W(e,!0);const r=S(()=>window.SONDA_JSON_REPORT.outputs[e.output.root.name]),n=S(()=>{const l={esm:0,cjs:0,unknown:0},u=window.SONDA_JSON_REPORT.inputs;return Object.entries(h(r).inputs).forEach(([d,v])=>{var _;const c=((_=u[d])==null?void 0:_.format)??"unknown";l[c]+=v.uncompressed}),l}),i=S(()=>Math.round(h(n).esm/h(r).uncompressed*100)),o=S(()=>Math.round(h(n).cjs/h(r).uncompressed*100)),s=S(()=>Math.round(h(n).unknown/h(r).uncompressed*100)),f=S(()=>{const l=/(?:.*node_modules\/)(@[^\/]+\/[^\/]+|[^\/]+)/;return Object.keys(h(r).inputs).map(u=>{var d;return((d=u.match(l))==null?void 0:d[1])??null}).filter((u,d,v)=>u!==null&&v.indexOf(u)===d).sort()}),a=S(()=>h(f).map((l,u,d)=>d.length===u+1?`└── ${l}`:`├── ${l}`).join(`
2
+ `)}}var xi=N('<span>File format</span> <span class="font-bold"> </span>',1),Ei=N('<span>Approx. GZIP size</span> <span class="font-bold"> </span>',1),ki=N('<span>Approx. Brotli size</span> <span class="font-bold"> </span>',1),Oi=N('<p class="mt-12">This file is in the bundle, because it is:</p> <code class="mt-2 p-4 w-max leading-5 bg-slate-200 rounded overflow-auto min-w-full"><pre> </pre></code>',1),Si=N('<div class="flex flex-col overflow-y-auto"><div class="grid grid-cols-[auto_1fr] gap-x-8"><!> <span>Original file size</span> <span class="font-bold"> </span> <span>Bundled size</span> <span class="font-bold"> </span> <!> <!></div> <!></div>');function Ti(t,e){W(e,!0);const r=S(()=>window.SONDA_JSON_REPORT.inputs[e.file.path]),n=S(()=>{var s;if(h(r))return h(r).format.toUpperCase();const o=(s=window.SONDA_JSON_REPORT.inputs[e.file.path])==null?void 0:s.belongsTo;return o?window.SONDA_JSON_REPORT.inputs[o].format.toUpperCase:"UNKNOWN"}),i=S(()=>h(r)?new yi().render(e.file.path):null);je(t,{get heading(){return e.file.path},children:s=>{var f=Si(),a=g(f),l=g(a);L(l,()=>h(n)!=="UNKNOWN",b=>{var E=xi(),w=m(C(E),2),y=g(w);A(()=>M(y,h(n))),k(b,E)});var u=m(l,4),d=g(u);A(()=>{var b;return M(d,tt(((b=h(r))==null?void 0:b.bytes)||0))});var v=m(u,4),c=g(v);A(()=>M(c,tt(e.file.uncompressed)));var _=m(v,2);L(_,()=>e.file.gzip,b=>{var E=Ei(),w=m(C(E),2),y=g(w);A(()=>M(y,tt(e.file.gzip))),k(b,E)});var p=m(_,2);L(p,()=>e.file.brotli,b=>{var E=ki(),w=m(C(E),2),y=g(w);A(()=>M(y,tt(e.file.brotli))),k(b,E)});var x=m(a,2);L(x,()=>h(i),b=>{var E=Oi(),w=m(C(E),2),y=g(w),Z=g(y);A(()=>M(Z,h(i))),k(b,E)}),k(s,f)}}),U()}var Ni=N('<span>GZIP size</span> <span class="font-bold"> </span>',1),Ai=N('<span>Brotli size</span> <span class="font-bold"> </span>',1),Mi=N('<p class="mt-12">Module types</p> <div class="mt-2 h-10 w-[40rem] max-w-full flex rounded-lg overflow-hidden"><div class="bg-yellow-300 h-full"></div> <div class="bg-blue-300 h-full"></div> <div class="bg-gray-200 h-full"></div></div> <div class="flex justify-between mt-2"><div class="flex items-center space-x-2"><div class="inline-block w-4 h-4 bg-yellow-300"></div> <p>ESM: <span class="font-semibold"> </span></p></div> <div class="flex items-center space-x-2"><div class="inline-block w-4 h-4 bg-blue-300"></div> <p>CJS: <span class="font-semibold"> </span></p></div> <div class="flex items-center space-x-2"><div class="inline-block w-4 h-4 bg-gray-300"></div> <p>Unknown: <span class="font-semibold"> </span></p></div></div>',1),zi=N('<code class="mt-2 p-4 w-max leading-5 bg-slate-200 rounded overflow-auto min-w-full"><pre> </pre></code>'),Pi=N('<div class="flex flex-col overflow-y-auto"><div class="grid grid-cols-[auto_1fr] gap-x-8"><span>Bundled size</span> <span class="font-bold"> </span> <!> <!></div></div> <!> <p class="mt-12">This asset includes <span class="font-semibold"> </span> external dependencies</p> <!>',1);function Di(t,e){W(e,!0);const r=S(()=>window.SONDA_JSON_REPORT.outputs[e.output.root.name]),n=S(()=>{const l={esm:0,cjs:0,unknown:0},u=window.SONDA_JSON_REPORT.inputs;return Object.entries(h(r).inputs).forEach(([d,v])=>{var _;const c=((_=u[d])==null?void 0:_.format)??"unknown";l[c]+=v.uncompressed}),l}),i=S(()=>Math.round(h(n).esm/h(r).uncompressed*1e4)/100),o=S(()=>Math.round(h(n).cjs/h(r).uncompressed*1e4)/100),s=S(()=>Math.round(h(n).unknown/h(r).uncompressed*1e4)/100),f=S(()=>{const l=/(?:.*node_modules\/)(@[^\/]+\/[^\/]+|[^\/]+)/;return Object.keys(h(r).inputs).map(u=>{var d;return((d=u.match(l))==null?void 0:d[1])??null}).filter((u,d,v)=>u!==null&&v.indexOf(u)===d).sort()}),a=S(()=>h(f).map((l,u,d)=>d.length===u+1?`└── ${l}`:`├── ${l}`).join(`
3
3
  `));je(t,{get heading(){return e.output.root.name},children:u=>{var d=Pi(),v=C(d),c=g(v),_=m(g(c),2),p=g(_);A(()=>M(p,tt(e.output.root.uncompressed)));var x=m(_,2);L(x,()=>e.output.root.gzip,P=>{var D=Ni(),J=m(C(D),2),F=g(J);A(()=>M(F,tt(e.output.root.gzip))),k(P,D)});var b=m(x,2);L(b,()=>e.output.root.brotli,P=>{var D=Ai(),J=m(C(D),2),F=g(J);A(()=>M(F,tt(e.output.root.brotli))),k(P,D)});var E=m(v,2);L(E,()=>h(s)<100,P=>{var D=Mi(),J=m(C(D),2),F=g(J),mt=m(F,2),fe=m(mt,2),Wt=m(J,2),Mt=g(Wt),Ut=m(g(Mt),2),Vt=m(g(Ut)),Gt=g(Vt),Fe=m(Mt,2),Dr=m(g(Fe),2),Rr=m(g(Dr)),Lr=g(Rr),Cr=m(Fe,2),Ir=m(g(Cr),2),Br=m(g(Ir)),jr=g(Br);A(()=>{I(F,"style",`width: ${h(i)}%`),I(mt,"style",`width: ${h(o)}%`),I(fe,"style",`width: ${h(s)}%`),M(Gt,`${h(i)??""}%`),M(Lr,`${h(o)??""}%`),M(jr,`${h(s)??""}%`)}),k(P,D)});var w=m(E,2),y=m(g(w)),Z=g(y),X=m(w,2);L(X,()=>h(f).length>0,P=>{var D=zi(),J=g(D),F=g(J);A(()=>M(F,h(a))),k(P,D)}),A(()=>M(Z,h(f).length)),k(u,d)}}),U()}var Ri=N("<!> <!> <!>",1);function Li(t,e){W(e,!1),Be();var r=Ri(),n=C(r);L(n,()=>$.folder,s=>{bi(s,{get folder(){return $.folder}})});var i=m(n,2);L(i,()=>$.file,s=>{Ti(s,{get file(){return $.file}})});var o=m(i,2);L(o,()=>$.output,s=>{Di(s,{get output(){return $.output}})}),k(t,r),U()}var Ci=(t,e)=>St.setType(e()),Ii=N('<button type="button" class="px-4 py-2 text-sm font-medium hover:bg-gray-100 text-gray-900 border border-gray-300 first:rounded-s-lg last:rounded-e-lg focus:ring-1 focus:ring-blue-300 focus:z-10 svelte-2f0583"> </button>'),Bi=N('<div class="inline-flex space-x-[-1px] bg-white" role="group"></div>');function ji(t,e){W(e,!0);const r=S(()=>K.output.root.gzip>0),n=S(()=>K.output.root.brotli>0),i=S(()=>{const f=[["uncompressed","Uncompressed"]];return h(r)&&f.push(["gzip","GZIP"]),h(n)&&f.push(["brotli","Brotli"]),f});var o=Ce(),s=C(o);L(s,()=>h(i).length>1,f=>{var a=Bi();Ie(a,21,()=>h(i),([l,u])=>l,(l,u)=>{let d=()=>h(u)[0],v=()=>h(u)[1];var c=Ii();c.__click=[Ci,d];var _=g(c);A(()=>{te(c,"active",d()===St.type),M(_,v())}),k(l,c)}),k(f,a)}),k(t,o),U()}ue(["click"]);function Fi(t){K.setIndex(Number(t.target.value))}var qi=N("<option> </option>"),Hi=N('<select class="text-gray-900 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-1 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 h-10 min-w-80"></select>'),Wi=N('<div class="flex items-center justify-center space-x-2 max-w-sm"><!></div>');function Ui(t,e){W(e,!1),Be();var r=Wi(),n=g(r);L(n,()=>Se.length>0,i=>{var o=Hi();Qn(o,()=>K.index);var s;o.__change=[Fi],Ie(o,5,()=>Se,Bn,(f,a,l)=>{var u=qi();u.value=(u.__value=l)==null?"":l;var d=g(u);A(()=>M(d,`${l+1}. ${h(a).root.name??""}`)),k(f,u)}),A(()=>{s!==(s=K.index)&&(o.value=(o.__value=K.index)==null?"":K.index,ke(o,K.index))}),k(i,o)}),k(t,r),U()}ue(["change"]);function Vi(){$.open("output",K.output)}var Gi=N('<button aria-label="Details of the entire build output" class="text-gray-900 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-1 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 h-10"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-gray-900"><path d="M0 0h24v24H0z" stroke="none" shape-rendering="geometricPrecision"></path><path d="M8 5H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h5.697M18 12V7a2 2 0 0 0-2-2h-2" shape-rendering="geometricPrecision"></path><path d="M8 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v0a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2zM8 11h4M8 15h3M14 17.5a2.5 2.5 0 1 0 5 0 2.5 2.5 0 1 0-5 0M18.5 19.5 21 22" shape-rendering="geometricPrecision"></path></svg></button>');function Ji(t,e){W(e,!1),Be();var r=Gi();r.__click=[Vi],k(t,r),U()}ue(["click"]);var Ki=N('<div class="flex flex-row p-4 items-center space-y-0 h-16 justify-end space-x-2 bg-gray-50 shadow"><!> <!> <!> <a href="https://github.com/filipsobol/sonda" target="_blank" aria-label="GitHub repository" class="flex items-center text-gray-900 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-1 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 h-10"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-gray-900"><path d="M0 0h24v24H0z" stroke="none" shape-rendering="geometricPrecision"></path><path d="M9 19c-4.3 1.4-4.3-2.5-6-3m12 5v-3.5c0-1 .1-1.4-.5-2 2.8-.3 5.5-1.4 5.5-6a4.6 4.6 0 0 0-1.3-3.2 4.2 4.2 0 0 0-.1-3.2s-1.1-.3-3.5 1.3a12.3 12.3 0 0 0-6.2 0C6.5 2.8 5.4 3.1 5.4 3.1a4.2 4.2 0 0 0-.1 3.2A4.6 4.6 0 0 0 4 9.5c0 4.6 2.7 5.7 5.5 6-.6.6-.6 1.2-.5 2V21" shape-rendering="geometricPrecision"></path></svg></a></div>');function Yi(t){var e=Ki(),r=g(e);ji(r,{});var n=m(r,2);Ui(n,{});var i=m(n,2);Ji(i,{}),k(t,e)}var Zi=N('<div class="flex-grow flex flex-col mt-24 items-center w-full h-full"><svg xmlns="http://www.w3.org/2000/svg" width="96" height="96" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="text-yellow-400 fill-yellow-100"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 21a9 9 0 1 1 0 -18a9 9 0 0 1 0 18z"></path><path d="M8 16l1 -1l1.5 1l1.5 -1l1.5 1l1.5 -1l1 1"></path><path d="M8.5 11.5l1.5 -1.5l-1.5 -1.5"></path><path d="M15.5 11.5l-1.5 -1.5l1.5 -1.5"></path></svg> <h2 class="mt-8 text-3xl font-semibold text-gray-800">No data to display</h2> <p class="mt-4 text-lg text-gray-500">Did you enable source maps in the bundler configuration?</p></div>');function Xi(t){var e=Zi();k(t,e)}var Qi=N('<div role="tooltip" class="fixed z-10 px-2 py-1 bg-gray-800 text-gray-100 rounded-md whitespace-nowrap pointer-events-none will-change-transform" style="transform: translate( var(--x), var(--y) )"> </div>');function $i(t,e){W(e,!0);const r=12;let n=B(0),i=B(0),o=B(0),s=B(0),f=B(0),a=B(0),l=B(""),u=B("0px"),d=B("0px");_e(()=>{h(l)&&(T(u,(h(f)+h(n)+r>h(o)?h(f)-h(n)-r:h(f)+r)+"px"),T(d,(h(a)+h(i)+r>h(s)?h(a)-h(i):h(a)+r)+"px"))});function v({target:p,clientX:x,clientY:b}){T(l,H(p instanceof Element&&p.getAttribute("data-hover")||"")),T(f,H(x)),T(a,H(b))}var c=Qi();Et("mouseover",it.body,v),Et("mousemove",it.body,v),Et("mouseleave",it.body,()=>T(l,""));var _=g(c);A(()=>{te(c,"invisible",!h(l)),$e(c,"--x",h(u)),$e(c,"--y",h(d)),M(_,h(l))}),ft(it.body,"clientWidth",p=>T(o,H(p))),ft(it.body,"clientHeight",p=>T(s,H(p))),ft(c,"clientWidth",p=>T(n,p)),ft(c,"clientHeight",p=>T(i,p)),k(t,c),U()}var to=N('<div role="application" class="wrapper relative flex flex-col overflow-hidden h-screen w-screen"><!> <div class="flex-grow overflow-hidden"><!></div></div> <!> <!>',1);function eo(t,e){W(e,!0);let r=B(0),n=B(0);function i({target:c}){const _=c instanceof Element&&c.getAttribute("data-tile");if(!_)return;const p=K.output.get(_);p&&$.open(ht(p)?"folder":"file",p)}function o(c){c.key==="Escape"&&(c.stopPropagation(),$.close())}var s=to();Et("click",it.body,i),Et("keydown",it.body,o);var f=C(s),a=g(f);Yi(a);var l=m(a,2),u=g(l);L(u,()=>K,c=>{Pr(c,{get content(){return K.output.root},get width(){return h(r)},get height(){return h(n)}})},c=>{Xi(c)});var d=m(f,2);Li(d,{});var v=m(d,2);$i(v,{}),ft(l,"clientWidth",c=>T(r,c)),ft(l,"clientHeight",c=>T(n,c)),k(t,s),U()}Ln(eo,{target:document.getElementById("app")});</script><style rel="stylesheet" crossorigin>rect.svelte-ks9kyg:hover{filter:brightness(1.15)}button.active.svelte-2f0583,button.active.svelte-2f0583:hover{background-color:#e5e7eb}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / .5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / .5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:after,:before{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.bottom-0{bottom:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.z-10{z-index:10}.mb-4{margin-bottom:1rem}.mr-2{margin-right:.5rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-24{margin-top:6rem}.mt-4{margin-top:1rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.size-full{width:100%;height:100%}.h-10{height:2.5rem}.h-16{height:4rem}.h-4{height:1rem}.h-\[95vh\]{height:95vh}.h-full{height:100%}.h-screen{height:100vh}.max-h-\[95vh\]{max-height:95vh}.min-h-screen{min-height:100vh}.w-10{width:2.5rem}.w-4{width:1rem}.w-\[40rem\]{width:40rem}.w-\[95vw\]{width:95vw}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-screen{width:100vw}.min-w-80{min-width:20rem}.min-w-full{min-width:100%}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-sm{max-width:24rem}.flex-grow{flex-grow:1}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.cursor-zoom-in{cursor:zoom-in}.grid-cols-\[auto_1fr\]{grid-template-columns:auto 1fr}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-x-8{-moz-column-gap:2rem;column-gap:2rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-\[-1px\]>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(-1px * var(--tw-space-x-reverse));margin-left:calc(-1px * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.border{border-width:1px}.border-b-2{border-bottom-width:2px}.border-dashed{border-style:dashed}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.border-transparent{border-color:transparent}.bg-blue-300{--tw-bg-opacity:1;background-color:rgb(147 197 253 / var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity))}.bg-gray-200\/70{background-color:#e5e7ebb3}.bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219 / var(--tw-bg-opacity))}.bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity))}.bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55 / var(--tw-bg-opacity))}.bg-slate-200{--tw-bg-opacity:1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-yellow-300{--tw-bg-opacity:1;background-color:rgb(253 224 71 / var(--tw-bg-opacity))}.fill-yellow-100{fill:#fef9c3}.stroke-gray-500{stroke:#6b7280}.p-1{padding:.25rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pr-6{padding-right:1.5rem}.text-center{text-align:center}.align-text-bottom{vertical-align:text-bottom}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-5{line-height:1.25rem}.leading-none{line-height:1}.tracking-tight{letter-spacing:-.025em}.text-gray-100{--tw-text-opacity:1;color:rgb(243 244 246 / var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity))}.text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity))}.text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21 / var(--tw-text-opacity))}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / .1),0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px rgb(0 0 0 / .1),0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.will-change-transform{will-change:transform}.first\:rounded-s-lg:first-child{border-start-start-radius:.5rem;border-end-start-radius:.5rem}.last\:rounded-e-lg:last-child{border-start-end-radius:.5rem;border-end-end-radius:.5rem}.hover\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.hover\:text-gray-900:hover{--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity))}.focus\:z-10:focus{z-index:10}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\:ring-blue-300:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(147 197 253 / var(--tw-ring-opacity))}</style></head><body class="flex w-screen h-screen font-mono"><div id="app" class="flex w-screen min-h-screen"></div></body></html>
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { relative, sep, posix, join, dirname, isAbsolute, resolve } from 'path';
2
2
  import { existsSync, readFileSync, writeFileSync } from 'fs';
3
3
  import { fileURLToPath } from 'url';
4
+ import { decode } from '@jridgewell/sourcemap-codec';
4
5
  import remapping from '@ampproject/remapping';
5
6
  import { gzipSync, brotliCompressSync } from 'zlib';
6
7
 
@@ -58,6 +59,7 @@ function loadCodeAndMap(codePath) {
58
59
  }
59
60
  const { map, mapPath } = maybeMap;
60
61
  map.sources = normalizeSourcesPaths(map, mapPath);
62
+ map.sourcesContent = loadMissingSourcesContent(map);
61
63
  delete map.sourceRoot;
62
64
  return {
63
65
  code,
@@ -94,7 +96,9 @@ function parseDataUrl(url) {
94
96
  throw new Error('Unsupported source map encoding: ' + encoding);
95
97
  }
96
98
  }
97
- function normalizeSourcesPaths(map, mapPath) {
99
+ /**
100
+ * Normalize the paths of the sources in the source map to be absolute paths.
101
+ */ function normalizeSourcesPaths(map, mapPath) {
98
102
  const mapDir = dirname(mapPath);
99
103
  return map.sources.map((source)=>{
100
104
  if (!source) {
@@ -103,8 +107,21 @@ function normalizeSourcesPaths(map, mapPath) {
103
107
  return isAbsolute(source) ? source : resolve(mapDir, map.sourceRoot ?? '.', source);
104
108
  });
105
109
  }
110
+ /**
111
+ * Loop through the sources and try to load missing `sourcesContent` from the file system.
112
+ */ function loadMissingSourcesContent(map) {
113
+ return map.sources.map((source, index)=>{
114
+ if (map.sourcesContent?.[index]) {
115
+ return map.sourcesContent[index];
116
+ }
117
+ if (source && existsSync(source)) {
118
+ return readFileSync(source, 'utf-8');
119
+ }
120
+ return null;
121
+ });
122
+ }
106
123
 
107
- function mapSourceMap(map, dirPath, inputs, options) {
124
+ function mapSourceMap(map, dirPath, inputs) {
108
125
  const alreadyRemapped = new Set();
109
126
  const remapped = remapping(map, (file, ctx)=>{
110
127
  var _ctx;
@@ -112,27 +129,10 @@ function mapSourceMap(map, dirPath, inputs, options) {
112
129
  return;
113
130
  }
114
131
  alreadyRemapped.add(file);
115
- const codeMap = loadCodeAndMap(resolve(dirPath, file));
132
+ const codeMap = addSourcesToInputs(resolve(dirPath, file), inputs);
116
133
  if (!codeMap) {
117
134
  return;
118
135
  }
119
- if (!options.detailed) {
120
- return null;
121
- }
122
- const parentPath = normalizePath(file);
123
- const format = inputs[parentPath]?.format ?? 'unknown';
124
- codeMap.map?.sources.filter((source)=>source !== null).forEach((source, index)=>{
125
- const normalizedPath = normalizePath(source);
126
- if (parentPath === normalizedPath) {
127
- return;
128
- }
129
- inputs[normalizedPath] = {
130
- bytes: Buffer.byteLength(codeMap.map.sourcesContent?.[index] ?? ''),
131
- format,
132
- imports: [],
133
- belongsTo: parentPath
134
- };
135
- });
136
136
  (_ctx = ctx).content ?? (_ctx.content = codeMap.code);
137
137
  return codeMap.map;
138
138
  }, {
@@ -140,6 +140,29 @@ function mapSourceMap(map, dirPath, inputs, options) {
140
140
  });
141
141
  return remapped;
142
142
  }
143
+ /**
144
+ * Loads the source map of a given file and adds its "sources" to the given inputs object.
145
+ */ function addSourcesToInputs(path, inputs) {
146
+ const codeMap = loadCodeAndMap(path);
147
+ if (!codeMap) {
148
+ return null;
149
+ }
150
+ const parentPath = normalizePath(path);
151
+ const format = inputs[parentPath]?.format ?? 'unknown';
152
+ codeMap.map?.sources.filter((source)=>source !== null).forEach((source, index)=>{
153
+ const normalizedPath = normalizePath(source);
154
+ if (parentPath === normalizedPath) {
155
+ return;
156
+ }
157
+ inputs[normalizedPath] = {
158
+ bytes: Buffer.byteLength(codeMap.map.sourcesContent?.[index] ?? ''),
159
+ format,
160
+ imports: [],
161
+ belongsTo: parentPath
162
+ };
163
+ });
164
+ return codeMap;
165
+ }
143
166
 
144
167
  const UNASSIGNED = '[unassigned]';
145
168
  function getBytesPerSource(code, map, assetSizes, options) {
@@ -254,7 +277,10 @@ function processAsset(asset, inputs, options) {
254
277
  return;
255
278
  }
256
279
  const { code, map } = maybeCodeMap;
257
- const mapped = mapSourceMap(map, dirname(asset), inputs, options);
280
+ const mapped = options.detailed ? mapSourceMap(map, dirname(asset), inputs) : {
281
+ ...map,
282
+ mappings: decode(map.mappings)
283
+ };
258
284
  mapped.sources = mapped.sources.map((source)=>normalizePath(source));
259
285
  const assetSizes = getSizes(code, options);
260
286
  const bytes = getBytesPerSource(code, mapped, assetSizes, options);
@@ -298,6 +324,10 @@ function SondaEsbuildPlugin(options) {
298
324
  if (!result.metafile) {
299
325
  return console.error('Metafile is required for SondaEsbuildPlugin to work.');
300
326
  }
327
+ const cwd = process.cwd();
328
+ const normalizedOptions = normalizeOptions(options);
329
+ // Esbuild already reads the existing source maps, so there's no need to do it again
330
+ normalizedOptions.detailed = false;
301
331
  const inputs = Object.entries(result.metafile.inputs).reduce((acc, [path, data])=>{
302
332
  acc[path] = {
303
333
  bytes: data.bytes,
@@ -305,6 +335,12 @@ function SondaEsbuildPlugin(options) {
305
335
  imports: data.imports.map((data)=>data.path),
306
336
  belongsTo: null
307
337
  };
338
+ /**
339
+ * Because esbuild already reads the existing source maps, there may be
340
+ * cases where some report "outputs" include "inputs" don't exist in the
341
+ * main "inputs" object. To avoid this, we parse each esbuild input and
342
+ * add its sources to the "inputs" object.
343
+ */ addSourcesToInputs(resolve(cwd, path), acc);
308
344
  return acc;
309
345
  }, {});
310
346
  return generateReportFromAssets(Object.keys(result.metafile.outputs), inputs, normalizeOptions(options));
@@ -348,51 +384,47 @@ const jsRegexp = /\.[c|m]?[t|j]s[x]?$/;
348
384
  class SondaWebpackPlugin {
349
385
  apply(compiler) {
350
386
  compiler.options.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';
351
- compiler.hooks.compilation.tap('SondaWebpackPlugin', (compilation)=>{
352
- compilation.hooks.optimizeModules.tap('SondaWebpackPlugin', (modules)=>{
353
- Array.from(modules).forEach((module)=>{
354
- if (!isNormalModule(module)) {
355
- return;
387
+ compiler.hooks.afterEmit.tapPromise('SondaWebpackPlugin', (compilation)=>{
388
+ const inputs = {};
389
+ const stats = compilation.getStats().toJson({
390
+ modules: true,
391
+ providedExports: true
392
+ });
393
+ const outputPath = stats.outputPath || compiler.outputPath;
394
+ const modules = stats.modules?.filter((mod)=>mod.nameForCondition && mod.moduleType !== 'asset/inline') || [];
395
+ modules.forEach((module)=>{
396
+ const imports = modules.reduce((acc, { nameForCondition, issuerName, reasons })=>{
397
+ if (issuerName === module.name || reasons?.some((reason)=>reason.resolvedModule === module.name)) {
398
+ acc.push(normalizePath(nameForCondition));
356
399
  }
357
- const imports = module.dependencies.reduce((acc, dependency)=>{
358
- const module = compilation.moduleGraph.getModule(dependency);
359
- if (isNormalModule(module)) {
360
- acc.push(normalizePath(module.resource));
361
- }
362
- return acc;
363
- }, []);
364
- this.inputs[normalizePath(module.resource)] = {
365
- bytes: module.size(),
366
- format: getFormat(module),
367
- imports,
368
- belongsTo: null
369
- };
370
- });
400
+ return acc;
401
+ }, []);
402
+ inputs[normalizePath(module.nameForCondition)] = {
403
+ bytes: module.size || 0,
404
+ format: getFormat(module),
405
+ imports,
406
+ belongsTo: null
407
+ };
371
408
  });
372
- });
373
- compiler.hooks.emit.tapAsync('SondaWebpackPlugin', (compilation, callback)=>{
374
- const outputPath = compiler.options.output.path || compiler.outputPath || process.cwd();
375
- const assets = Object.keys(compilation.assets).map((name)=>join(outputPath, name));
376
- generateReportFromAssets(assets, this.inputs, normalizeOptions(this.options)).then(()=>callback());
409
+ return generateReportFromAssets(stats.assets?.map((asset)=>join(outputPath, asset.name)) || [], inputs, normalizeOptions(this.options));
377
410
  });
378
411
  }
379
412
  constructor(options){
380
413
  this.options = options || {};
381
- this.inputs = {};
382
414
  }
383
415
  }
384
416
  function getFormat(module) {
385
- if (!jsRegexp.test(module.resource)) {
417
+ if (!jsRegexp.test(module.nameForCondition)) {
386
418
  return 'unknown';
387
419
  }
388
- if (module.type === 'javascript/esm' || module.buildMeta?.exportsType === 'namespace') {
420
+ /**
421
+ * Sometimes ESM modules have `moduleType` set as `javascript/auto`, so we
422
+ * also need to check if the module has exports to determine if it's ESM.
423
+ */ if (module.moduleType === 'javascript/esm' || !!module.providedExports?.length) {
389
424
  return 'esm';
390
425
  }
391
426
  return 'cjs';
392
427
  }
393
- function isNormalModule(module) {
394
- return module !== null && 'resource' in module;
395
- }
396
428
 
397
429
  export { SondaEsbuildPlugin, SondaRollupPlugin, SondaWebpackPlugin };
398
430
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","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,IAAY,EAAA;;AAE1C,IAAA,MAAMC,UAAaD,GAAAA,IAAAA,CAAKE,OAAO,CAAE,KAAO,EAAA,EAAA,CAAA,CAAA;;IAGxC,MAAMC,WAAAA,GAAcC,SAAUjB,GAAKc,EAAAA,UAAAA,CAAAA,CAAAA;;AAGnC,IAAA,OAAOE,WAAYE,CAAAA,UAAU,CAAEC,GAAAA,EAAKC,MAAMD,GAAG,CAAA,CAAA;AAC9C;;ACLA;;;;;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,CAAAA;AACb,SAAA,CAAA,CAAA;AACD,KAAA;AAhDAG,IAAAA,WAAAA,CAAc1M,OAA0B,CAAG;AAC1C,QAAA,IAAI,CAACA,OAAO,GAAGA,OAAAA,IAAW,EAAC,CAAA;QAC3B,IAAI,CAACiE,MAAM,GAAG,EAAC,CAAA;AAChB,KAAA;AA8CD,CAAA;AAEA,SAAS0G,UAAWF,MAAoB,EAAA;AACvC,IAAA,IAAK,CAACS,QAASD,CAAAA,IAAI,CAAER,MAAAA,CAAO0B,QAAQ,CAAK,EAAA;QACxC,OAAO,SAAA,CAAA;AACR,KAAA;IAEA,IAAK1B,MAAAA,CAAOkC,IAAI,KAAK,gBAAA,IAAoBlC,OAAOmC,SAAS,EAAEC,gBAAgB,WAAc,EAAA;QACxF,OAAO,KAAA,CAAA;AACR,KAAA;IAEA,OAAO,KAAA,CAAA;AACR,CAAA;AAEA,SAAShB,eAAgBpB,MAAoC,EAAA;IAC5D,OAAOA,MAAAA,KAAW,QAAQ,UAAcA,IAAAA,MAAAA,CAAAA;AACzC;;;;"}
1
+ {"version":3,"file":"index.js","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 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 { 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 { dirname, resolve } from 'path';\nimport { fileURLToPath } from 'url';\nimport { readFileSync } from 'fs';\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 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 = 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\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 { resolve } from 'path';\nimport { normalizeOptions } from '../utils';\nimport { generateReportFromAssets } from '../report/generate';\nimport type { Plugin } from 'esbuild';\nimport type { Options, JsonReport } from '../types';\nimport { addSourcesToInputs } from '../sourcemap/map';\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 cwd = process.cwd();\n\t\t\t\tconst normalizedOptions = normalizeOptions( options );\n\n\t\t\t\t// Esbuild already reads the existing source maps, so there's no need to do it again\n\t\t\t\tnormalizedOptions.detailed = false;\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\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 ),\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 { Compiler, StatsModule } from 'webpack';\nimport type { Options, ModuleFormat, JsonReport } from '../types';\n\nconst jsRegexp = /\\.[c|m]?[t|j]s[x]?$/;\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 = stats.modules?.filter( mod => mod.nameForCondition && mod.moduleType !== 'asset/inline' ) || [];\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\tnormalizeOptions( this.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":["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","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","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","outputs","endsWith","reduce","carry","data","processAsset","generateHtmlReport","json","__dirname","fileURLToPath","template","stringify","maybeCodeMap","hasCodeAndMap","mapped","decode","result","Boolean","generateReportFromAssets","default","handler","saveHtml","saveJson","report","writeFileSync","SondaEsbuildPlugin","name","setup","build","initialOptions","metafile","onEnd","console","error","normalizedOptions","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","afterEmit","tapPromise","compilation","stats","getStats","toJson","modules","providedExports","outputPath","mod","nameForCondition","moduleType","issuerName","reasons","some","reason","resolvedModule","push","size","constructor"],"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,IAAY,EAAA;;AAE1C,IAAA,MAAMC,UAAaD,GAAAA,IAAAA,CAAKE,OAAO,CAAE,KAAO,EAAA,EAAA,CAAA,CAAA;;IAGxC,MAAMC,WAAAA,GAAcC,SAAUjB,GAAKc,EAAAA,UAAAA,CAAAA,CAAAA;;AAGnC,IAAA,OAAOE,WAAYE,CAAAA,UAAU,CAAEC,GAAAA,EAAKC,MAAMD,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,CA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CAAC3B,MAAAA,CAAOuB,eAAe,EAAElK,MAAS,EAAA;QACjF,OAAO,KAAA,CAAA;AACR,KAAA;IAEA,OAAO,KAAA,CAAA;AACR;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,UAAU,EAEV,WAAW,EAIX,OAAO,EACR,MAAM,YAAY,CAAC;AAGpB,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACnC,OAAO,EAAE,OAAO,GACf,UAAU,CAiBZ;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACnC,OAAO,EAAE,OAAO,GACf,MAAM,CAMR"}
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,UAAU,EAEV,WAAW,EAIX,OAAO,EACR,MAAM,YAAY,CAAC;AAGpB,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACnC,OAAO,EAAE,OAAO,GACf,UAAU,CAiBZ;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACnC,OAAO,EAAE,OAAO,GACf,MAAM,CAMR"}
@@ -1,4 +1,8 @@
1
1
  import { type DecodedSourceMap, type EncodedSourceMap } from '@ampproject/remapping';
2
- import type { Options, ReportInput } from '../types';
3
- export declare function mapSourceMap(map: EncodedSourceMap, dirPath: string, inputs: Record<string, ReportInput>, options: Options): DecodedSourceMap;
2
+ import type { CodeMap, ReportInput } from '../types';
3
+ export declare function mapSourceMap(map: EncodedSourceMap, dirPath: string, inputs: Record<string, ReportInput>): DecodedSourceMap;
4
+ /**
5
+ * Loads the source map of a given file and adds its "sources" to the given inputs object.
6
+ */
7
+ export declare function addSourcesToInputs(path: string, inputs: Record<string, ReportInput>): CodeMap | null;
4
8
  //# sourceMappingURL=map.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/sourcemap/map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAI3G,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAErD,wBAAgB,YAAY,CAC3B,GAAG,EAAE,gBAAgB,EACrB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACnC,OAAO,EAAE,OAAO,GACd,gBAAgB,CA6ClB"}
1
+ {"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/sourcemap/map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAI3G,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAErD,wBAAgB,YAAY,CAC3B,GAAG,EAAE,gBAAgB,EACrB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GACjC,gBAAgB,CAwBlB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GACjC,OAAO,GAAG,IAAI,CA4BhB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sonda",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Universal visualizer and analyzer for JavaScript and CSS bundles. Works with Vite, Rollup, webpack, and esbuild",
5
5
  "keywords": [
6
6
  "bundle analyzer",
@@ -34,6 +34,7 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@ampproject/remapping": "^2.3.0",
37
+ "@jridgewell/sourcemap-codec": "^1.5.0",
37
38
  "open": "^10.1.0"
38
39
  }
39
40
  }