sonda 0.2.2 → 0.4.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 +24 -0
- package/README.md +23 -1
- package/dist/bundlers/esbuild.d.ts.map +1 -1
- package/dist/bundlers/rollup.d.ts.map +1 -1
- package/dist/bundlers/webpack.d.ts +2 -3
- package/dist/bundlers/webpack.d.ts.map +1 -1
- package/dist/index.cjs +126 -87
- package/dist/index.cjs.map +1 -1
- package/dist/index.html +2 -3
- package/dist/index.js +125 -86
- package/dist/index.js.map +1 -1
- package/dist/report/generate.d.ts +1 -1
- package/dist/report/generate.d.ts.map +1 -1
- package/dist/report.d.ts.map +1 -1
- package/dist/sourcemap/map.d.ts +6 -2
- package/dist/sourcemap/map.d.ts.map +1 -1
- package/dist/utils.d.ts +4 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -1,29 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { join, dirname, isAbsolute, resolve, relative, win32, posix } from 'path';
|
|
2
|
+
import remapping from '@ampproject/remapping';
|
|
2
3
|
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
|
3
4
|
import { fileURLToPath } from 'url';
|
|
4
|
-
import
|
|
5
|
+
import { decode } from '@jridgewell/sourcemap-codec';
|
|
5
6
|
import { gzipSync, brotliCompressSync } from 'zlib';
|
|
6
7
|
|
|
7
|
-
const cwd = /* #__PURE__ */ process.cwd();
|
|
8
|
-
function normalizeOptions(options) {
|
|
9
|
-
const defaultOptions = {
|
|
10
|
-
open: true,
|
|
11
|
-
format: 'html',
|
|
12
|
-
detailed: false,
|
|
13
|
-
gzip: false,
|
|
14
|
-
brotli: false
|
|
15
|
-
};
|
|
16
|
-
return Object.assign({}, defaultOptions, options);
|
|
17
|
-
}
|
|
18
|
-
function normalizePath(path) {
|
|
19
|
-
// Unicode escape sequences used by Rollup and Vite to identify virtual modules
|
|
20
|
-
const normalized = path.replace(/^\0/, '');
|
|
21
|
-
// Transform absolute paths to relative paths
|
|
22
|
-
const relativized = relative(cwd, normalized);
|
|
23
|
-
// Ensure paths are POSIX-compliant - https://stackoverflow.com/a/63251716/4617687
|
|
24
|
-
return relativized.replaceAll(sep, posix.sep);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
8
|
/**
|
|
28
9
|
* Strip any JSON XSSI avoidance prefix from the string (as documented in the source maps specification),
|
|
29
10
|
* and parses the string as JSON.
|
|
@@ -58,6 +39,7 @@ function loadCodeAndMap(codePath) {
|
|
|
58
39
|
}
|
|
59
40
|
const { map, mapPath } = maybeMap;
|
|
60
41
|
map.sources = normalizeSourcesPaths(map, mapPath);
|
|
42
|
+
map.sourcesContent = loadMissingSourcesContent(map);
|
|
61
43
|
delete map.sourceRoot;
|
|
62
44
|
return {
|
|
63
45
|
code,
|
|
@@ -94,7 +76,9 @@ function parseDataUrl(url) {
|
|
|
94
76
|
throw new Error('Unsupported source map encoding: ' + encoding);
|
|
95
77
|
}
|
|
96
78
|
}
|
|
97
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Normalize the paths of the sources in the source map to be absolute paths.
|
|
81
|
+
*/ function normalizeSourcesPaths(map, mapPath) {
|
|
98
82
|
const mapDir = dirname(mapPath);
|
|
99
83
|
return map.sources.map((source)=>{
|
|
100
84
|
if (!source) {
|
|
@@ -103,8 +87,42 @@ function normalizeSourcesPaths(map, mapPath) {
|
|
|
103
87
|
return isAbsolute(source) ? source : resolve(mapDir, map.sourceRoot ?? '.', source);
|
|
104
88
|
});
|
|
105
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Loop through the sources and try to load missing `sourcesContent` from the file system.
|
|
92
|
+
*/ function loadMissingSourcesContent(map) {
|
|
93
|
+
return map.sources.map((source, index)=>{
|
|
94
|
+
if (map.sourcesContent?.[index]) {
|
|
95
|
+
return map.sourcesContent[index];
|
|
96
|
+
}
|
|
97
|
+
if (source && existsSync(source)) {
|
|
98
|
+
return readFileSync(source, 'utf-8');
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const cjsRegex = /\.c[tj]sx?$/;
|
|
105
|
+
const jsRegexp = /\.[cm]?[tj]s[x]?$/;
|
|
106
|
+
function normalizeOptions(options) {
|
|
107
|
+
const defaultOptions = {
|
|
108
|
+
open: true,
|
|
109
|
+
format: 'html',
|
|
110
|
+
detailed: false,
|
|
111
|
+
gzip: false,
|
|
112
|
+
brotli: false
|
|
113
|
+
};
|
|
114
|
+
return Object.assign({}, defaultOptions, options);
|
|
115
|
+
}
|
|
116
|
+
function normalizePath(pathToNormalize) {
|
|
117
|
+
// Unicode escape sequences used by Rollup and Vite to identify virtual modules
|
|
118
|
+
const normalized = pathToNormalize.replace(/^\0/, '');
|
|
119
|
+
// Transform absolute paths to relative paths
|
|
120
|
+
const relativized = relative(process.cwd(), normalized);
|
|
121
|
+
// Ensure paths are POSIX-compliant - https://stackoverflow.com/a/63251716/4617687
|
|
122
|
+
return relativized.replaceAll(win32.sep, posix.sep);
|
|
123
|
+
}
|
|
106
124
|
|
|
107
|
-
function mapSourceMap(map, dirPath, inputs
|
|
125
|
+
function mapSourceMap(map, dirPath, inputs) {
|
|
108
126
|
const alreadyRemapped = new Set();
|
|
109
127
|
const remapped = remapping(map, (file, ctx)=>{
|
|
110
128
|
var _ctx;
|
|
@@ -112,27 +130,10 @@ function mapSourceMap(map, dirPath, inputs, options) {
|
|
|
112
130
|
return;
|
|
113
131
|
}
|
|
114
132
|
alreadyRemapped.add(file);
|
|
115
|
-
const codeMap =
|
|
133
|
+
const codeMap = addSourcesToInputs(resolve(dirPath, file), inputs);
|
|
116
134
|
if (!codeMap) {
|
|
117
135
|
return;
|
|
118
136
|
}
|
|
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
137
|
(_ctx = ctx).content ?? (_ctx.content = codeMap.code);
|
|
137
138
|
return codeMap.map;
|
|
138
139
|
}, {
|
|
@@ -140,6 +141,29 @@ function mapSourceMap(map, dirPath, inputs, options) {
|
|
|
140
141
|
});
|
|
141
142
|
return remapped;
|
|
142
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Loads the source map of a given file and adds its "sources" to the given inputs object.
|
|
146
|
+
*/ function addSourcesToInputs(path, inputs) {
|
|
147
|
+
const codeMap = loadCodeAndMap(path);
|
|
148
|
+
if (!codeMap) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
const parentPath = normalizePath(path);
|
|
152
|
+
const format = inputs[parentPath]?.format ?? 'unknown';
|
|
153
|
+
codeMap.map?.sources.filter((source)=>source !== null).forEach((source, index)=>{
|
|
154
|
+
const normalizedPath = normalizePath(source);
|
|
155
|
+
if (parentPath === normalizedPath) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
inputs[normalizedPath] = {
|
|
159
|
+
bytes: Buffer.byteLength(codeMap.map.sourcesContent?.[index] ?? ''),
|
|
160
|
+
format,
|
|
161
|
+
imports: [],
|
|
162
|
+
belongsTo: parentPath
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
return codeMap;
|
|
166
|
+
}
|
|
143
167
|
|
|
144
168
|
const UNASSIGNED = '[unassigned]';
|
|
145
169
|
function getBytesPerSource(code, map, assetSizes, options) {
|
|
@@ -254,7 +278,10 @@ function processAsset(asset, inputs, options) {
|
|
|
254
278
|
return;
|
|
255
279
|
}
|
|
256
280
|
const { code, map } = maybeCodeMap;
|
|
257
|
-
const mapped = mapSourceMap(map, dirname(asset), inputs
|
|
281
|
+
const mapped = options.detailed ? mapSourceMap(map, dirname(asset), inputs) : {
|
|
282
|
+
...map,
|
|
283
|
+
mappings: decode(map.mappings)
|
|
284
|
+
};
|
|
258
285
|
mapped.sources = mapped.sources.map((source)=>normalizePath(source));
|
|
259
286
|
const assetSizes = getSizes(code, options);
|
|
260
287
|
const bytes = getBytesPerSource(code, mapped, assetSizes, options);
|
|
@@ -270,11 +297,18 @@ function hasCodeAndMap(result) {
|
|
|
270
297
|
return Boolean(result && result.code && result.map);
|
|
271
298
|
}
|
|
272
299
|
|
|
273
|
-
async function generateReportFromAssets(assets, inputs,
|
|
274
|
-
const
|
|
300
|
+
async function generateReportFromAssets(assets, inputs, userOptions) {
|
|
301
|
+
const options = normalizeOptions(userOptions);
|
|
275
302
|
const handler = options.format === 'html' ? saveHtml : saveJson;
|
|
276
303
|
const path = handler(assets, inputs, options);
|
|
277
|
-
options.open
|
|
304
|
+
if (!options.open || !path) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* `open` is ESM-only package, so we need to import it
|
|
309
|
+
* dynamically to make it work in CommonJS environment.
|
|
310
|
+
*/ const { default: open } = await import('open');
|
|
311
|
+
open(path);
|
|
278
312
|
}
|
|
279
313
|
function saveHtml(assets, inputs, options) {
|
|
280
314
|
const report = generateHtmlReport(assets, inputs, options);
|
|
@@ -289,15 +323,18 @@ function saveJson(assets, inputs, options) {
|
|
|
289
323
|
return path;
|
|
290
324
|
}
|
|
291
325
|
|
|
292
|
-
function SondaEsbuildPlugin(options) {
|
|
326
|
+
function SondaEsbuildPlugin(options = {}) {
|
|
293
327
|
return {
|
|
294
328
|
name: 'sonda',
|
|
295
329
|
setup (build) {
|
|
296
330
|
build.initialOptions.metafile = true;
|
|
331
|
+
// Esbuild already reads the existing source maps, so there's no need to do it again
|
|
332
|
+
options.detailed = false;
|
|
297
333
|
build.onEnd((result)=>{
|
|
298
334
|
if (!result.metafile) {
|
|
299
335
|
return console.error('Metafile is required for SondaEsbuildPlugin to work.');
|
|
300
336
|
}
|
|
337
|
+
const cwd = process.cwd();
|
|
301
338
|
const inputs = Object.entries(result.metafile.inputs).reduce((acc, [path, data])=>{
|
|
302
339
|
acc[path] = {
|
|
303
340
|
bytes: data.bytes,
|
|
@@ -305,24 +342,28 @@ function SondaEsbuildPlugin(options) {
|
|
|
305
342
|
imports: data.imports.map((data)=>data.path),
|
|
306
343
|
belongsTo: null
|
|
307
344
|
};
|
|
345
|
+
/**
|
|
346
|
+
* Because esbuild already reads the existing source maps, there may be
|
|
347
|
+
* cases where some report "outputs" include "inputs" don't exist in the
|
|
348
|
+
* main "inputs" object. To avoid this, we parse each esbuild input and
|
|
349
|
+
* add its sources to the "inputs" object.
|
|
350
|
+
*/ addSourcesToInputs(resolve(cwd, path), acc);
|
|
308
351
|
return acc;
|
|
309
352
|
}, {});
|
|
310
|
-
return generateReportFromAssets(Object.keys(result.metafile.outputs), inputs,
|
|
353
|
+
return generateReportFromAssets(Object.keys(result.metafile.outputs).map((path)=>resolve(cwd, path)), inputs, options);
|
|
311
354
|
});
|
|
312
355
|
}
|
|
313
356
|
};
|
|
314
357
|
}
|
|
315
358
|
|
|
316
|
-
|
|
317
|
-
const cjsRegex = /\.c[tj]sx?$/;
|
|
318
|
-
function SondaRollupPlugin(options) {
|
|
359
|
+
function SondaRollupPlugin(options = {}) {
|
|
319
360
|
let inputs = {};
|
|
320
361
|
return {
|
|
321
362
|
name: 'sonda',
|
|
322
363
|
writeBundle ({ dir, file }, bundle) {
|
|
323
364
|
const outputDir = resolve(process.cwd(), dir ?? dirname(file));
|
|
324
365
|
const assets = Object.keys(bundle).map((name)=>join(outputDir, name));
|
|
325
|
-
return generateReportFromAssets(assets, inputs,
|
|
366
|
+
return generateReportFromAssets(assets, inputs, options);
|
|
326
367
|
},
|
|
327
368
|
moduleParsed (module) {
|
|
328
369
|
inputs[normalizePath(module.id)] = {
|
|
@@ -338,61 +379,59 @@ function getFormat$1(moduleId, isCommonJS) {
|
|
|
338
379
|
if (isCommonJS === true || cjsRegex.test(moduleId)) {
|
|
339
380
|
return 'cjs';
|
|
340
381
|
}
|
|
341
|
-
if (isCommonJS === false ||
|
|
382
|
+
if (isCommonJS === false || jsRegexp.test(moduleId)) {
|
|
342
383
|
return 'esm';
|
|
343
384
|
}
|
|
344
385
|
return 'unknown';
|
|
345
386
|
}
|
|
346
387
|
|
|
347
|
-
const jsRegexp = /\.[c|m]?[t|j]s[x]?$/;
|
|
348
388
|
class SondaWebpackPlugin {
|
|
349
389
|
apply(compiler) {
|
|
350
390
|
compiler.options.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';
|
|
351
|
-
compiler.hooks.
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
391
|
+
compiler.hooks.afterEmit.tapPromise('SondaWebpackPlugin', (compilation)=>{
|
|
392
|
+
const inputs = {};
|
|
393
|
+
const stats = compilation.getStats().toJson({
|
|
394
|
+
modules: true,
|
|
395
|
+
providedExports: true
|
|
396
|
+
});
|
|
397
|
+
const outputPath = stats.outputPath || compiler.outputPath;
|
|
398
|
+
const modules = stats.modules?.flatMap((mod)=>mod.modules ? [
|
|
399
|
+
mod,
|
|
400
|
+
...mod.modules
|
|
401
|
+
] : mod).filter((mod)=>mod.nameForCondition && !mod.codeGenerated).filter((mod, index, self)=>self.findIndex((m)=>m.nameForCondition === mod.nameForCondition) === index) || [];
|
|
402
|
+
modules.forEach((module)=>{
|
|
403
|
+
const imports = modules.reduce((acc, { nameForCondition, issuerName, reasons })=>{
|
|
404
|
+
if (issuerName === module.name || reasons?.some((reason)=>reason.resolvedModule === module.name)) {
|
|
405
|
+
acc.push(normalizePath(nameForCondition));
|
|
356
406
|
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
bytes: module.size(),
|
|
366
|
-
format: getFormat(module),
|
|
367
|
-
imports,
|
|
368
|
-
belongsTo: null
|
|
369
|
-
};
|
|
370
|
-
});
|
|
407
|
+
return acc;
|
|
408
|
+
}, []);
|
|
409
|
+
inputs[normalizePath(module.nameForCondition)] = {
|
|
410
|
+
bytes: module.size || 0,
|
|
411
|
+
format: getFormat(module),
|
|
412
|
+
imports,
|
|
413
|
+
belongsTo: null
|
|
414
|
+
};
|
|
371
415
|
});
|
|
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());
|
|
416
|
+
return generateReportFromAssets(stats.assets?.map((asset)=>join(outputPath, asset.name)) || [], inputs, this.options);
|
|
377
417
|
});
|
|
378
418
|
}
|
|
379
|
-
constructor(options){
|
|
380
|
-
this.options = options
|
|
381
|
-
this.inputs = {};
|
|
419
|
+
constructor(options = {}){
|
|
420
|
+
this.options = options;
|
|
382
421
|
}
|
|
383
422
|
}
|
|
384
423
|
function getFormat(module) {
|
|
385
|
-
if (!jsRegexp.test(module.
|
|
424
|
+
if (!jsRegexp.test(module.nameForCondition)) {
|
|
386
425
|
return 'unknown';
|
|
387
426
|
}
|
|
388
|
-
|
|
427
|
+
/**
|
|
428
|
+
* Sometimes ESM modules have `moduleType` set as `javascript/auto`, so we
|
|
429
|
+
* also need to check if the module has exports to determine if it's ESM.
|
|
430
|
+
*/ if (module.moduleType === 'javascript/esm' || !!module.providedExports?.length) {
|
|
389
431
|
return 'esm';
|
|
390
432
|
}
|
|
391
433
|
return 'cjs';
|
|
392
434
|
}
|
|
393
|
-
function isNormalModule(module) {
|
|
394
|
-
return module !== null && 'resource' in module;
|
|
395
|
-
}
|
|
396
435
|
|
|
397
436
|
export { SondaEsbuildPlugin, SondaRollupPlugin, SondaWebpackPlugin };
|
|
398
437
|
//# 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;;;;;IAMA,SAASE,mBAAAA,CAAqBC,GAAW,EAAA;AACxC,IAAA,OAAOC,IAAKC,CAAAA,KAAK,CAAEF,G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C1C,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":["../../load-source-map/dist/index.js","../src/utils.ts","../src/sourcemap/map.ts","../src/sourcemap/bytes.ts","../src/report.ts","../src/report/generate.ts","../src/bundlers/esbuild.ts","../src/bundlers/rollup.ts","../src/bundlers/webpack.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'fs';\nimport { join, dirname, isAbsolute, resolve } from 'path';\n\n/**\n * Strip any JSON XSSI avoidance prefix from the string (as documented in the source maps specification),\n * and parses the string as JSON.\n *\n * https://github.com/mozilla/source-map/blob/3cb92cc3b73bfab27c146bae4ef2bc09dbb4e5ed/lib/util.js#L162-L164\n */ function parseSourceMapInput(str) {\n return JSON.parse(str.replace(/^\\)]}'[^\\n]*\\n/, \"\"));\n}\n/**\n\tsourceMappingURL=data:application/json;charset=utf-8;base64,data\n\tsourceMappingURL=data:application/json;base64,data\n\tsourceMappingURL=data:application/json;uri,data\n\tsourceMappingURL=map-file-comment.css.map\n\tsourceMappingURL=map-file-comment.css.map?query=value\n*/ const sourceMappingRegExp = /[@#]\\s*sourceMappingURL=(\\S+)\\b/g;\nfunction loadCodeAndMap(codePath) {\n if (!existsSync(codePath)) {\n return null;\n }\n const code = readFileSync(codePath, 'utf-8');\n const extractedComment = code.includes('sourceMappingURL') && Array.from(code.matchAll(sourceMappingRegExp)).at(-1);\n if (!extractedComment || !extractedComment.length) {\n return {\n code\n };\n }\n const maybeMap = loadMap(codePath, extractedComment[1]);\n if (!maybeMap) {\n return {\n code\n };\n }\n const { map, mapPath } = maybeMap;\n map.sources = normalizeSourcesPaths(map, mapPath);\n map.sourcesContent = loadMissingSourcesContent(map);\n delete map.sourceRoot;\n return {\n code,\n map\n };\n}\nfunction loadMap(codePath, sourceMappingURL) {\n if (sourceMappingURL.startsWith('data:')) {\n const map = parseDataUrl(sourceMappingURL);\n return {\n map: parseSourceMapInput(map),\n mapPath: codePath\n };\n }\n const sourceMapFilename = new URL(sourceMappingURL, 'file://').pathname;\n const mapPath = join(dirname(codePath), sourceMapFilename);\n if (!existsSync(mapPath)) {\n return null;\n }\n return {\n map: parseSourceMapInput(readFileSync(mapPath, 'utf-8')),\n mapPath\n };\n}\nfunction parseDataUrl(url) {\n const [prefix, payload] = url.split(',');\n const encoding = prefix.split(';').at(-1);\n switch(encoding){\n case 'base64':\n return Buffer.from(payload, 'base64').toString();\n case 'uri':\n return decodeURIComponent(payload);\n default:\n throw new Error('Unsupported source map encoding: ' + encoding);\n }\n}\n/**\n * Normalize the paths of the sources in the source map to be absolute paths.\n */ function normalizeSourcesPaths(map, mapPath) {\n const mapDir = dirname(mapPath);\n return map.sources.map((source)=>{\n if (!source) {\n return source;\n }\n return isAbsolute(source) ? source : resolve(mapDir, map.sourceRoot ?? '.', source);\n });\n}\n/**\n * Loop through the sources and try to load missing `sourcesContent` from the file system.\n */ function loadMissingSourcesContent(map) {\n return map.sources.map((source, index)=>{\n if (map.sourcesContent?.[index]) {\n return map.sourcesContent[index];\n }\n if (source && existsSync(source)) {\n return readFileSync(source, 'utf-8');\n }\n return null;\n });\n}\n\nexport { loadCodeAndMap };\n//# sourceMappingURL=index.js.map\n","import { relative, win32, posix } from 'path';\nimport type { Options } from './types';\n\nexport const esmRegex: RegExp = /\\.m[tj]sx?$/;\nexport const cjsRegex: RegExp = /\\.c[tj]sx?$/;\nexport const jsRegexp: RegExp = /\\.[cm]?[tj]s[x]?$/;\n\nexport function normalizeOptions( options?: Partial<Options> ) {\n\tconst defaultOptions: Options = {\n\t\topen: true,\n\t\tformat: 'html',\n\t\tdetailed: false,\n\t\tgzip: false,\n\t\tbrotli: false,\n\t};\n\n\treturn Object.assign( {}, defaultOptions, options ) as Options;\n}\n\nexport function normalizePath( pathToNormalize: string ): string {\n\t// Unicode escape sequences used by Rollup and Vite to identify virtual modules\n\tconst normalized = pathToNormalize.replace( /^\\0/, '' )\n\n\t// Transform absolute paths to relative paths\n\tconst relativized = relative( process.cwd(), normalized );\n\n\t// Ensure paths are POSIX-compliant - https://stackoverflow.com/a/63251716/4617687\n\treturn relativized.replaceAll( win32.sep, posix.sep );\n}\n","import { default as remapping, type DecodedSourceMap, type EncodedSourceMap } from '@ampproject/remapping';\nimport { loadCodeAndMap } from 'load-source-map';\nimport { resolve } from 'path';\nimport { normalizePath } from '../utils';\nimport type { CodeMap, ReportInput } from '../types';\n\nexport function mapSourceMap(\n\tmap: EncodedSourceMap,\n\tdirPath: string,\n\tinputs: Record<string, ReportInput>\n): DecodedSourceMap {\n\tconst alreadyRemapped = new Set<string>();\n\tconst remapped = remapping( map, ( file, ctx ) => {\n\t\tif ( alreadyRemapped.has( file ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\talreadyRemapped.add( file );\n\n\t\tconst codeMap = addSourcesToInputs(\n\t\t\tresolve( dirPath, file ),\n\t\t\tinputs\n\t\t);\n\n\t\tif ( !codeMap ) {\n\t\t\treturn;\n\t\t}\n\n\t\tctx.content ??= codeMap.code;\n\n\t\treturn codeMap.map;\n\t}, { decodedMappings: true } );\n\n\treturn remapped as DecodedSourceMap;\n}\n\n/**\n * Loads the source map of a given file and adds its \"sources\" to the given inputs object.\n */\nexport function addSourcesToInputs(\n\tpath: string,\n\tinputs: Record<string, ReportInput>\n): CodeMap | null {\n\tconst codeMap = loadCodeAndMap( path );\n\n\tif ( !codeMap ) {\n\t\treturn null;\n\t}\n\n\tconst parentPath = normalizePath( path );\n\tconst format = inputs[ parentPath ]?.format ?? 'unknown';\n\n\tcodeMap.map?.sources\n\t\t.filter( source => source !== null )\n\t\t.forEach( ( source, index ) => {\n\t\t\tconst normalizedPath = normalizePath( source );\n\n\t\t\tif ( parentPath === normalizedPath ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tinputs[ normalizedPath ] = {\n\t\t\t\tbytes: Buffer.byteLength( codeMap.map!.sourcesContent?.[ index ] ?? '' ),\n\t\t\t\tformat,\n\t\t\t\timports: [],\n\t\t\t\tbelongsTo: parentPath\n\t\t\t};\n\t\t} );\n\t\n\treturn codeMap;\n}\n","import { gzipSync, brotliCompressSync } from 'zlib';\nimport type { DecodedSourceMap, SourceMapSegment } from '@ampproject/remapping';\nimport type { Options, Sizes } from '../types';\n\nconst UNASSIGNED = '[unassigned]';\n\nexport function getBytesPerSource(\n\tcode: string,\n\tmap: DecodedSourceMap,\n\tassetSizes: Sizes,\n\toptions: Options\n): Map<string, Sizes> {\n\tconst contributions = getContributions( map.sources );\n\n\t// Split the code into lines\n\tconst codeLines = code.split( /(?<=\\r?\\n)/ );\n\n\tfor ( let lineIndex = 0; lineIndex < codeLines.length; lineIndex++ ) {\n\t\tconst lineCode = codeLines[ lineIndex ];\n\t\tconst mappings = map.mappings[ lineIndex ] || [];\n\t\tlet currentColumn = 0;\n\n\t\tfor ( let i = 0; i <= mappings.length; i++ ) {\n\t\t\t// 0: generatedColumn\n\t\t\t// 1: sourceIndex\n\t\t\t// 2: originalLine\n\t\t\t// 3: originalColumn\n\t\t\t// 4: nameIndex\n\n\t\t\tconst mapping: SourceMapSegment | undefined = mappings[ i ];\n\t\t\tconst startColumn = mapping?.[ 0 ] ?? lineCode.length;\n\t\t\tconst endColumn = mappings[ i + 1 ]?.[ 0 ] ?? lineCode.length;\n\n\t\t\t// Slice the code from currentColumn to startColumn for unassigned code\n\t\t\tif ( startColumn > currentColumn ) {\n\t\t\t\tcontributions.set( UNASSIGNED, contributions.get( UNASSIGNED ) + lineCode.slice( currentColumn, startColumn ) );\n\t\t\t}\n\n\t\t\tif ( mapping ) {\n\t\t\t\t// Slice the code from startColumn to endColumn for assigned code\n\t\t\t\tconst sourceIndex = mapping?.[ 1 ];\n\t\t\t\tconst codeSlice = lineCode.slice( startColumn, endColumn );\n\t\t\t\tconst source = sourceIndex !== undefined ? map.sources[ sourceIndex ]! : UNASSIGNED;\n\n\t\t\t\tcontributions.set( source, contributions.get( source ) + codeSlice );\n\t\t\t\tcurrentColumn = endColumn;\n\t\t\t} else {\n\t\t\t\tcurrentColumn = startColumn;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Compute sizes for each source\n\tconst sourceSizes = new Map<string, Sizes>();\n\n\tconst contributionsSum: Sizes = {\n\t\tuncompressed: 0,\n\t\tgzip: 0,\n\t\tbrotli: 0\n\t};\n\n\tfor ( const [ source, codeSegment ] of contributions ) {\n\t\tconst sizes = getSizes( codeSegment, options );\n\n\t\tcontributionsSum.uncompressed += sizes.uncompressed;\n\t\tcontributionsSum.gzip += sizes.gzip;\n\t\tcontributionsSum.brotli += sizes.brotli;\n\n\t\tsourceSizes.set( source, sizes );\n\t}\n\n\treturn adjustSizes( sourceSizes, assetSizes, contributionsSum, options );\n}\n\nexport function getSizes(\n\tcode: string,\n\toptions: Options\n): Sizes {\n\treturn {\n\t\tuncompressed: Buffer.byteLength( code ),\n\t\tgzip: options.gzip ? gzipSync( code ).length : 0,\n\t\tbrotli: options.brotli ? brotliCompressSync( code ).length : 0\n\t};\n}\n\nfunction getContributions( sources: Array<string | null> ): Map<string, string> {\n\tconst contributions = new Map<string, string>();\n\n\t// Populate contributions with sources\n\tsources\n\t\t.filter( source => source !== null )\n\t\t.forEach( source => contributions.set( source, '' ) );\n\n\t// Add entry for the code that is not assigned to any source\n\tcontributions.set( UNASSIGNED, '' );\n\n\treturn contributions;\n}\n\n/**\n * Compression efficiency improves with the size of the file.\n *\n * However, what we have is the compressed size of the entire bundle (`actual`),\n * the sum of all files compressed individually (`sum`) and the compressed\n * size of a given file (`content`). The last value is essentially a “worst-case”\n * scenario, and the actual size of the file in the bundle is likely to be smaller.\n *\n * We use this information to estimate the actual size of the file in the bundle\n * after compression.\n */\nfunction adjustSizes(\n\tsources: Map<string, Sizes>,\n\tasset: Sizes,\n\tsums: Sizes,\n\toptions: Options\n): Map<string, Sizes> {\n\tconst gzipDelta = options.gzip ? asset.gzip / sums.gzip : 0;\n\tconst brotliDelta = options.brotli ? asset.brotli / sums.brotli : 0;\n\n\tfor ( const [ source, sizes ] of sources ) {\n\t\tsources.set( source, {\n\t\t\tuncompressed: sizes.uncompressed,\n\t\t\tgzip: options.gzip ? Math.round( sizes.gzip * gzipDelta ) : 0,\n\t\t\tbrotli: options.brotli ? Math.round( sizes.brotli * brotliDelta ) : 0\n\t\t} );\n\t}\n\n\treturn sources;\n}\n","import { readFileSync } from 'fs';\nimport { fileURLToPath } from 'url';\nimport { dirname, resolve } from 'path';\nimport { loadCodeAndMap } from 'load-source-map';\nimport { decode } from '@jridgewell/sourcemap-codec';\nimport { mapSourceMap } from './sourcemap/map.js';\nimport { getBytesPerSource, getSizes } from './sourcemap/bytes.js';\nimport type {\n JsonReport,\n MaybeCodeMap,\n ReportInput,\n ReportOutput,\n CodeMap,\n ReportOutputInput,\n Options\n} from './types.js';\nimport { normalizePath } from './utils.js';\n\nexport function generateJsonReport(\n assets: Array<string>,\n inputs: Record<string, ReportInput>,\n options: Options\n): JsonReport {\n const 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';\nimport { normalizeOptions } from '../utils.js';\n\nexport async function generateReportFromAssets(\n\tassets: string[],\n\tinputs: JsonReport[ 'inputs' ],\n\tuserOptions: Partial<Options>\n): Promise<void> {\n\tconst options = normalizeOptions( userOptions );\n\tconst handler = options.format === 'html' ? saveHtml : saveJson;\n\tconst path = handler( assets, inputs, options );\n\n\tif ( !options.open || !path ) {\n\t\treturn;\n\t}\n\n\t/**\n\t * `open` is ESM-only package, so we need to import it\n\t * dynamically to make it work in CommonJS environment.\n\t */\n\tconst { default: open } = await import( 'open' );\n\n\topen( path );\n}\n\nfunction saveHtml(\n\tassets: string[],\n\tinputs: JsonReport[ 'inputs' ],\n\toptions: Options\n): string | null {\n\tconst report = generateHtmlReport( assets, inputs, options );\n\tconst path = join( process.cwd(), 'sonda-report.html' );\n\n\twriteFileSync( path, report );\n\n\treturn path;\n}\n\nfunction saveJson(\n\tassets: string[],\n\tinputs: JsonReport[ 'inputs' ],\n\toptions: Options\n): string | null {\n\tconst report = generateJsonReport( assets, inputs, options );\n\tconst path = join( process.cwd(), 'sonda-report.json' );\n\n\twriteFileSync( path, JSON.stringify( report, null, 2 ) );\n\n\treturn path;\n}\n","import { resolve } from 'path';\nimport { addSourcesToInputs } from '../sourcemap/map';\nimport { generateReportFromAssets } from '../report/generate';\nimport type { Plugin } from 'esbuild';\nimport type { Options, JsonReport } from '../types';\n\nexport function SondaEsbuildPlugin( options: Partial<Options> = {} ): Plugin {\n\treturn {\n\t\tname: 'sonda',\n\t\tsetup( build ) {\n\t\t\tbuild.initialOptions.metafile = true;\n\n\t\t\t// Esbuild already reads the existing source maps, so there's no need to do it again\n\t\t\toptions.detailed = false;\n\n\t\t\tbuild.onEnd( result => {\n\t\t\t\tif ( !result.metafile ) {\n\t\t\t\t\treturn console.error( 'Metafile is required for SondaEsbuildPlugin to work.' );\n\t\t\t\t}\n\n\t\t\t\tconst cwd = process.cwd();\n\t\t\t\tconst inputs = Object\n\t\t\t\t\t.entries( result.metafile.inputs )\n\t\t\t\t\t.reduce( ( acc, [ path, data ] ) => {\n\t\t\t\t\t\tacc[ path ] = {\n\t\t\t\t\t\t\tbytes: data.bytes,\n\t\t\t\t\t\t\tformat: data.format ?? 'unknown',\n\t\t\t\t\t\t\timports: data.imports.map( data => data.path ),\n\t\t\t\t\t\t\tbelongsTo: null,\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Because esbuild already reads the existing source maps, there may be\n\t\t\t\t\t\t * cases where some report \"outputs\" include \"inputs\" don't exist in the\n\t\t\t\t\t\t * main \"inputs\" object. To avoid this, we parse each esbuild input and\n\t\t\t\t\t\t * add its sources to the \"inputs\" object.\n\t\t\t\t\t\t */\n\t\t\t\t\t\taddSourcesToInputs(\n\t\t\t\t\t\t\tresolve( cwd, path ),\n\t\t\t\t\t\t\tacc\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t}, {} as JsonReport[ 'inputs' ] );\n\n\t\t\t\treturn generateReportFromAssets(\n\t\t\t\t\tObject.keys( result.metafile.outputs ).map( path => resolve( cwd, path ) ),\n\t\t\t\t\tinputs,\n\t\t\t\t\toptions\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\t};\n}\n","import { join, resolve, dirname } from 'path';\nimport { normalizePath, cjsRegex, jsRegexp } from '../utils.js';\nimport { generateReportFromAssets } from '../report/generate.js';\nimport type { Options, ModuleFormat, JsonReport } from '../types.js';\nimport type { Plugin, ModuleInfo, NormalizedOutputOptions, OutputBundle } from 'rollup';\n\nexport function SondaRollupPlugin( options: Partial<Options> = {} ): Plugin {\n\tlet inputs: JsonReport[ 'inputs' ] = {};\n\n\treturn {\n\t\tname: 'sonda',\n\n\t\twriteBundle(\n\t\t\t{ dir, file }: NormalizedOutputOptions,\n\t\t\tbundle: OutputBundle\n\t\t) {\n\t\t\tconst outputDir = resolve( process.cwd(), dir ?? dirname( file! ) );\n\t\t\tconst assets = Object.keys( bundle ).map( name => join( outputDir, name ) );\n\n\t\t\treturn generateReportFromAssets(\n\t\t\t\tassets,\n\t\t\t\tinputs,\n\t\t\t\toptions\n\t\t\t);\n\t\t},\n\n\t\tmoduleParsed( module: ModuleInfo ) {\n\t\t\tinputs[ normalizePath( module.id ) ] = {\n\t\t\t\tbytes: module.code ? Buffer.byteLength( module.code ) : 0,\n\t\t\t\tformat: getFormat( module.id, module.meta.commonjs?.isCommonJS ),\n\t\t\t\timports: module.importedIds.map( id => normalizePath( id ) ),\n\t\t\t\tbelongsTo: null,\n\t\t\t};\n\t\t}\n\t};\n}\n\nfunction getFormat( moduleId: string, isCommonJS: boolean | undefined ): ModuleFormat {\n\tif ( isCommonJS === true || cjsRegex.test( moduleId ) ) {\n\t\treturn 'cjs';\n\t}\n\n\tif ( isCommonJS === false || jsRegexp.test( moduleId ) ) {\n\t\treturn 'esm';\n\t}\n\n\treturn'unknown';\n}\n","import { join } from 'path';\nimport { normalizePath, jsRegexp } from '../utils';\nimport { generateReportFromAssets } from '../report/generate';\nimport type { Compiler, StatsModule } from 'webpack';\nimport type { Options, ModuleFormat, JsonReport } from '../types';\n\nexport class SondaWebpackPlugin {\n\toptions: Partial<Options>;\n\n\tconstructor ( options: Partial<Options> = {} ) {\n\t\tthis.options = options;\n\t}\n\n\tapply( compiler: Compiler ): void {\n\t\tcompiler.options.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';\n\n\t\tcompiler.hooks.afterEmit.tapPromise( 'SondaWebpackPlugin', compilation => {\n\t\t\tconst inputs: JsonReport[ 'inputs' ] = {};\n\t\t\tconst stats = compilation.getStats().toJson( {\n\t\t\t\tmodules: true,\n\t\t\t\tprovidedExports: true,\n\t\t\t} );\n\n\t\t\tconst outputPath = stats.outputPath || compiler.outputPath;\n\t\t\tconst modules: Array<StatsModule> = stats.modules\n\t\t\t\t?.flatMap( mod => mod.modules ? [ mod, ...mod.modules ] : mod )\n\t\t\t\t.filter( mod => mod.nameForCondition && !mod.codeGenerated )\n\t\t\t\t.filter( ( mod, index, self ) => self.findIndex( m => m.nameForCondition === mod.nameForCondition ) === index )\n\t\t\t\t|| [];\n\n\t\t\tmodules.forEach( module => {\n\t\t\t\tconst imports = modules.reduce( ( acc, { nameForCondition, issuerName, reasons } ) => {\n\t\t\t\t\tif ( issuerName === module.name || reasons?.some( reason => reason.resolvedModule === module.name ) ) {\n\t\t\t\t\t\tacc.push( normalizePath( nameForCondition! ) );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn acc;\n\t\t\t\t}, [] as Array<string> );\n\n\t\t\t\tinputs[ normalizePath( module.nameForCondition! ) ] = {\n\t\t\t\t\tbytes: module.size || 0,\n\t\t\t\t\tformat: getFormat( module ),\n\t\t\t\t\timports,\n\t\t\t\t\tbelongsTo: null\n\t\t\t\t};\n\t\t\t} );\n\n\t\t\treturn generateReportFromAssets(\n\t\t\t\tstats.assets?.map( asset => join( outputPath, asset.name ) ) || [],\n\t\t\t\tinputs,\n\t\t\t\tthis.options\n\t\t\t);\n\t\t} );\n\t}\n}\n\nfunction getFormat( module: StatsModule ): ModuleFormat {\n\tif ( !jsRegexp.test( module.nameForCondition! ) ) {\n\t\treturn 'unknown';\n\t}\n\n\t/**\n\t * Sometimes ESM modules have `moduleType` set as `javascript/auto`, so we\n\t * also need to check if the module has exports to determine if it's ESM.\n\t */\n\tif ( module.moduleType === 'javascript/esm' || !!module.providedExports?.length ) {\n\t\treturn 'esm';\n\t}\n\n\treturn 'cjs';\n}\n"],"names":["parseSourceMapInput","str","JSON","parse","replace","sourceMappingRegExp","loadCodeAndMap","codePath","existsSync","code","readFileSync","extractedComment","includes","Array","from","matchAll","at","length","maybeMap","loadMap","map","mapPath","sources","normalizeSourcesPaths","sourcesContent","loadMissingSourcesContent","sourceRoot","sourceMappingURL","startsWith","parseDataUrl","sourceMapFilename","URL","pathname","join","dirname","url","prefix","payload","split","encoding","Buffer","toString","decodeURIComponent","Error","mapDir","source","isAbsolute","resolve","index","cjsRegex","jsRegexp","normalizeOptions","options","defaultOptions","open","format","detailed","gzip","brotli","Object","assign","normalizePath","pathToNormalize","normalized","relativized","relative","process","cwd","replaceAll","win32","sep","posix","mapSourceMap","dirPath","inputs","alreadyRemapped","Set","remapped","remapping","file","ctx","has","add","codeMap","addSourcesToInputs","content","decodedMappings","path","parentPath","filter","forEach","normalizedPath","bytes","byteLength","imports","belongsTo","UNASSIGNED","getBytesPerSource","assetSizes","contributions","getContributions","codeLines","lineIndex","lineCode","mappings","currentColumn","i","mapping","startColumn","endColumn","set","get","slice","sourceIndex","codeSlice","undefined","sourceSizes","Map","contributionsSum","uncompressed","codeSegment","sizes","getSizes","adjustSizes","gzipSync","brotliCompressSync","asset","sums","gzipDelta","brotliDelta","Math","round","generateJsonReport","assets","outputs","endsWith","reduce","carry","data","processAsset","generateHtmlReport","json","__dirname","fileURLToPath","template","stringify","maybeCodeMap","hasCodeAndMap","mapped","decode","result","Boolean","generateReportFromAssets","userOptions","handler","saveHtml","saveJson","default","report","writeFileSync","SondaEsbuildPlugin","name","setup","build","initialOptions","metafile","onEnd","console","error","entries","acc","keys","SondaRollupPlugin","writeBundle","dir","bundle","outputDir","moduleParsed","module","id","getFormat","meta","commonjs","isCommonJS","importedIds","moduleId","test","SondaWebpackPlugin","apply","compiler","output","devtoolModuleFilenameTemplate","hooks","afterEmit","tapPromise","compilation","stats","getStats","toJson","modules","providedExports","outputPath","flatMap","mod","nameForCondition","codeGenerated","self","findIndex","m","issuerName","reasons","some","reason","resolvedModule","push","size","constructor","moduleType"],"mappings":";;;;;;;AAqBA;;;;;IAMA,SAASA,mBAAAA,CAAqBC,GAAW,EAAA;AACxC,IAAA,OAAOC,IAAKC,CAAAA,KAAK,CAAEF,GAAIG,CAAAA,OAAO,CAAE,gBAAkB,EAAA,EAAA,CAAA,CAAA,CAAA;AACnD,CAAA;AAEA;;;;;;AAMA,GACA,MAAMC,mBAAsB,GAAA,kCAAA,CAAA;AAErB,SAASC,cAAAA,CAAgBC,QAAgB,EAAA;AAC/C,IAAA,IAAK,CAACC,UAAAA,CAAYD,QAAa,CAAA,EAAA;AAC9B,QAAA,OAAO,IAAA,CAAA;KACR;AAEA,IAAA,MAAME,IAAAA,GAAOC,YAAAA,CAAcH,QAAU,EAAA,OAAA,CAAA,CAAA;IAErC,MAAMI,gBAAmBF,GAAAA,IAAAA,CAAKG,QAAQ,CAAE,kBAAwBC,CAAAA,IAAAA,KAAMC,CAAAA,IAAI,CAAEL,IAAAA,CAAKM,QAAQ,CAAEV,mBAAwBW,CAAAA,CAAAA,CAAAA,EAAE,CAAE,CAAC,CAAA,CAAA,CAA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AM,EAAEjH,GAAAA,CAAK0G,CAAAA,KAAS7F,GAAAA,IAAAA,CAAMwK,UAAY3E,EAAAA,KAAAA,CAAMmC,IAAI,CAAQ,CAAA,IAAA,EAAE,EAClEvF,MACA,EAAA,IAAI,CAACtB,OAAO,CAAA,CAAA;AAEd,SAAA,CAAA,CAAA;AACD,KAAA;IA5CAoK,WAAcpK,CAAAA,OAAAA,GAA4B,EAAE,CAAG;QAC9C,IAAI,CAACA,OAAO,GAAGA,OAAAA,CAAAA;AAChB,KAAA;AA2CD,CAAA;AAEA,SAASgI,UAAWF,MAAmB,EAAA;AACtC,IAAA,IAAK,CAAChI,QAASwI,CAAAA,IAAI,CAAER,MAAAA,CAAO0B,gBAAgB,CAAM,EAAA;QACjD,OAAO,SAAA,CAAA;AACR,KAAA;AAEA;;;KAIA,IAAK1B,MAAOuC,CAAAA,UAAU,KAAK,gBAAA,IAAoB,CAAC,CAACvC,MAAAA,CAAOsB,eAAe,EAAEvL,MAAS,EAAA;QACjF,OAAO,KAAA,CAAA;AACR,KAAA;IAEA,OAAO,KAAA,CAAA;AACR;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Options, JsonReport } from '../types.js';
|
|
2
|
-
export declare function generateReportFromAssets(assets: string[], inputs: JsonReport['inputs'],
|
|
2
|
+
export declare function generateReportFromAssets(assets: string[], inputs: JsonReport['inputs'], userOptions: Partial<Options>): Promise<void>;
|
|
3
3
|
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/report/generate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/report/generate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGvD,wBAAsB,wBAAwB,CAC7C,MAAM,EAAE,MAAM,EAAE,EAChB,MAAM,EAAE,UAAU,CAAE,QAAQ,CAAE,EAC9B,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,GAC3B,OAAO,CAAC,IAAI,CAAC,CAgBf"}
|
package/dist/report.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/sourcemap/map.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { type DecodedSourceMap, type EncodedSourceMap } from '@ampproject/remapping';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function mapSourceMap(map: EncodedSourceMap, dirPath: string, inputs: Record<string, ReportInput
|
|
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,
|
|
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/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { Options } from './types';
|
|
2
|
+
export declare const esmRegex: RegExp;
|
|
3
|
+
export declare const cjsRegex: RegExp;
|
|
4
|
+
export declare const jsRegexp: RegExp;
|
|
2
5
|
export declare function normalizeOptions(options?: Partial<Options>): Options;
|
|
3
|
-
export declare function normalizePath(
|
|
6
|
+
export declare function normalizePath(pathToNormalize: string): string;
|
|
4
7
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,eAAO,MAAM,QAAQ,EAAE,MAAsB,CAAC;AAC9C,eAAO,MAAM,QAAQ,EAAE,MAAsB,CAAC;AAC9C,eAAO,MAAM,QAAQ,EAAE,MAA4B,CAAC;AAEpD,wBAAgB,gBAAgB,CAAE,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GASJ,OAAO,CAC9D;AAED,wBAAgB,aAAa,CAAE,eAAe,EAAE,MAAM,GAAI,MAAM,CAS/D"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sonda",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Universal visualizer and analyzer for JavaScript and CSS bundles. Works with Vite, Rollup, webpack, and esbuild",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Universal visualizer and analyzer for JavaScript and CSS bundles. Works with Vite, Rollup, webpack, Rspack, and esbuild",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bundle analyzer",
|
|
7
7
|
"bundle visualizer",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"vite",
|
|
12
12
|
"rollup",
|
|
13
13
|
"webpack",
|
|
14
|
+
"rspack",
|
|
14
15
|
"esbuild"
|
|
15
16
|
],
|
|
16
17
|
"license": "MIT",
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
],
|
|
35
36
|
"dependencies": {
|
|
36
37
|
"@ampproject/remapping": "^2.3.0",
|
|
38
|
+
"@jridgewell/sourcemap-codec": "^1.5.0",
|
|
37
39
|
"open": "^10.1.0"
|
|
38
40
|
}
|
|
39
41
|
}
|