sonda 0.1.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/LICENSE +21 -0
- package/README.md +123 -0
- package/dist/bundlers/esbuild.d.ts +4 -0
- package/dist/bundlers/esbuild.d.ts.map +1 -0
- package/dist/bundlers/rollup.d.ts +4 -0
- package/dist/bundlers/rollup.d.ts.map +1 -0
- package/dist/bundlers/webpack.d.ts +9 -0
- package/dist/bundlers/webpack.d.ts.map +1 -0
- package/dist/index.cjs +355 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.html +2 -0
- package/dist/index.js +349 -0
- package/dist/index.js.map +1 -0
- package/dist/report/generate.d.ts +3 -0
- package/dist/report/generate.d.ts.map +1 -0
- package/dist/report.d.ts +4 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/sourcemap/bytes.d.ts +5 -0
- package/dist/sourcemap/bytes.d.ts.map +1 -0
- package/dist/sourcemap/load.d.ts +3 -0
- package/dist/sourcemap/load.d.ts.map +1 -0
- package/dist/sourcemap/map.d.ts +4 -0
- package/dist/sourcemap/map.d.ts.map +1 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +37 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Filip Sobol
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Sonda
|
|
2
|
+
|
|
3
|
+
Sonda is a universal visualizer and analyzer for JavaScript and CSS bundles. It analyzes the source maps and shows the size of each module after tree-shaking and minification to get the most accurate report.
|
|
4
|
+
|
|
5
|
+
Sonda works with the following bundlers:
|
|
6
|
+
|
|
7
|
+
* Vite
|
|
8
|
+
* Rollup
|
|
9
|
+
* esbuild
|
|
10
|
+
* Webpack
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
Start by installing the package:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install sonda --save-dev
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Then register the bundler-specific plugin and enable the source maps. **Remember to use Sonda in development mode only**.
|
|
21
|
+
|
|
22
|
+
### Vite
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
// vite.config.js
|
|
26
|
+
|
|
27
|
+
import { defineConfig } from 'vite';
|
|
28
|
+
import { SondaRollupPlugin } from 'sonda';
|
|
29
|
+
|
|
30
|
+
export default defineConfig( {
|
|
31
|
+
plugins: [
|
|
32
|
+
SondaRollupPlugin(),
|
|
33
|
+
],
|
|
34
|
+
build: {
|
|
35
|
+
sourcemap: true
|
|
36
|
+
}
|
|
37
|
+
} );
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Rollup
|
|
41
|
+
|
|
42
|
+
```javascript
|
|
43
|
+
// rollup.config.js
|
|
44
|
+
|
|
45
|
+
import { defineConfig } from 'rollup';
|
|
46
|
+
import { SondaRollupPlugin } from 'sonda';
|
|
47
|
+
|
|
48
|
+
export default defineConfig( {
|
|
49
|
+
output: {
|
|
50
|
+
// Other options are skipped for brevity
|
|
51
|
+
sourcemap: true,
|
|
52
|
+
},
|
|
53
|
+
plugins: [
|
|
54
|
+
SondaRollupPlugin(),
|
|
55
|
+
]
|
|
56
|
+
} );
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Some Rollup plugins may not support source maps by default. Check their documentation to enable them. Examples for `@rollup/plugin-commonjs` and `rollup-plugin-styles` are shown below.
|
|
60
|
+
|
|
61
|
+
```javascript
|
|
62
|
+
commonjs( {
|
|
63
|
+
sourceMap: true,
|
|
64
|
+
} ),
|
|
65
|
+
styles( {
|
|
66
|
+
mode: 'extract',
|
|
67
|
+
sourceMap: true,
|
|
68
|
+
} )
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### esbuild
|
|
72
|
+
|
|
73
|
+
```javascript
|
|
74
|
+
import { build } from 'esbuild';
|
|
75
|
+
import { SondaEsbuildPlugin } from 'sonda';
|
|
76
|
+
|
|
77
|
+
build( {
|
|
78
|
+
sourcemap: true,
|
|
79
|
+
plugins: [
|
|
80
|
+
SondaEsbuildPlugin()
|
|
81
|
+
]
|
|
82
|
+
} );
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Unlike for other bundlers, the esbuild plugin relies not only on source maps but also on the metafile. The plugin should automatically enable the metafile option for you, but if you get the error, be sure to enable it manually (`metafile: true`).
|
|
86
|
+
|
|
87
|
+
### Webpack
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
// webpack.config.js
|
|
91
|
+
|
|
92
|
+
const { SondaWebpackPlugin } = require( 'sonda' );
|
|
93
|
+
|
|
94
|
+
module.exports = {
|
|
95
|
+
devtool: 'source-map',
|
|
96
|
+
plugins: [
|
|
97
|
+
new SondaWebpackPlugin(),
|
|
98
|
+
],
|
|
99
|
+
};
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Internally, Sonda changes the default webpack configuration to output relative paths in the source maps instead of using the `webpack://` protocol (`devtoolModuleFilenameTemplate: '[absolute-resource-path]'`).
|
|
103
|
+
|
|
104
|
+
## Options
|
|
105
|
+
|
|
106
|
+
Each plugin accepts an optional configuration object. The following options are available.
|
|
107
|
+
|
|
108
|
+
### `format`
|
|
109
|
+
|
|
110
|
+
* **Type:** `string`
|
|
111
|
+
* **Default:** `'html'`
|
|
112
|
+
|
|
113
|
+
The format of the output. The following formats are supported:
|
|
114
|
+
|
|
115
|
+
* `'html'` - HTML file with treemap
|
|
116
|
+
* `'json'` - JSON file
|
|
117
|
+
|
|
118
|
+
### `open`
|
|
119
|
+
|
|
120
|
+
* **Type:** `boolean`
|
|
121
|
+
* **Default:** `true`
|
|
122
|
+
|
|
123
|
+
Whether to open the report in the default program for given file extension (`.html` or `.json` depending on the `format` option) after the build.
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup.d.ts","sourceRoot":"","sources":["../../src/bundlers/rollup.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAA4B,MAAM,aAAa,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,EAAqD,MAAM,QAAQ,CAAC;AAKxF,wBAAgB,iBAAiB,CAAE,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAI,MAAM,CA6BtE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Options, JsonReport } from '../types';
|
|
2
|
+
import { type Compiler } from 'webpack';
|
|
3
|
+
export declare class SondaWebpackPlugin {
|
|
4
|
+
options: Partial<Options>;
|
|
5
|
+
inputs: JsonReport['inputs'];
|
|
6
|
+
constructor(options?: Partial<Options>);
|
|
7
|
+
apply(compiler: Compiler): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=webpack.d.ts.map
|
|
@@ -0,0 +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;CA6CjC"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var path = require('path');
|
|
4
|
+
var child_process = require('child_process');
|
|
5
|
+
var fs = require('fs');
|
|
6
|
+
var url = require('url');
|
|
7
|
+
var remapping = require('@ampproject/remapping');
|
|
8
|
+
var zlib = require('zlib');
|
|
9
|
+
|
|
10
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
11
|
+
const cwd = /* #__ PURE__ */ process.cwd();
|
|
12
|
+
function normalizeOptions(options) {
|
|
13
|
+
const defaultOptions = {
|
|
14
|
+
open: true,
|
|
15
|
+
format: 'html'
|
|
16
|
+
};
|
|
17
|
+
return Object.assign({}, defaultOptions, options);
|
|
18
|
+
}
|
|
19
|
+
function normalizePath(path$1) {
|
|
20
|
+
// Unicode escape sequences used by Rollup and Vite to identify virtual modules
|
|
21
|
+
const normalized = path$1.replace(/^\0/, '');
|
|
22
|
+
// Transform absolute paths to relative paths
|
|
23
|
+
const relativized = path.relative(cwd, normalized);
|
|
24
|
+
// Ensure paths are POSIX-compliant - https://stackoverflow.com/a/63251716/4617687
|
|
25
|
+
return relativized.replaceAll(path.sep, path.posix.sep);
|
|
26
|
+
}
|
|
27
|
+
function getOpenCommand() {
|
|
28
|
+
switch(process.platform){
|
|
29
|
+
case 'darwin':
|
|
30
|
+
return 'open';
|
|
31
|
+
case 'win32':
|
|
32
|
+
return 'start';
|
|
33
|
+
default:
|
|
34
|
+
return 'xdg-open';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function open(path) {
|
|
38
|
+
child_process.exec(getOpenCommand() + ' ' + path);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Strip any JSON XSSI avoidance prefix from the string (as documented in the source maps specification),
|
|
43
|
+
* and parses the string as JSON.
|
|
44
|
+
*
|
|
45
|
+
* https://github.com/mozilla/source-map/blob/3cb92cc3b73bfab27c146bae4ef2bc09dbb4e5ed/lib/util.js#L162-L164
|
|
46
|
+
*/ function parseSourceMapInput(str) {
|
|
47
|
+
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ""));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
sourceMappingURL=data:application/json;charset=utf-8;base64,data
|
|
51
|
+
sourceMappingURL=data:application/json;base64,data
|
|
52
|
+
sourceMappingURL=data:application/json;uri,data
|
|
53
|
+
sourceMappingURL=map-file-comment.css.map
|
|
54
|
+
*/ const sourceMappingRegExp = /[@#]\s*sourceMappingURL=(\S+)\b/g;
|
|
55
|
+
function loadCodeAndMap(codePath) {
|
|
56
|
+
if (!fs.existsSync(codePath)) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const code = fs.readFileSync(codePath, 'utf-8');
|
|
60
|
+
const extractedComment = code.includes('sourceMappingURL') && Array.from(code.matchAll(sourceMappingRegExp)).at(-1);
|
|
61
|
+
if (!extractedComment || !extractedComment.length) {
|
|
62
|
+
return {
|
|
63
|
+
code
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const maybeMap = loadMap(codePath, extractedComment[1]);
|
|
67
|
+
if (!maybeMap) {
|
|
68
|
+
return {
|
|
69
|
+
code
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const { map, mapPath } = maybeMap;
|
|
73
|
+
map.sources = normalizeSourcesPaths(map, mapPath);
|
|
74
|
+
delete map.sourceRoot;
|
|
75
|
+
return {
|
|
76
|
+
code,
|
|
77
|
+
map
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function loadMap(codePath, sourceMappingURL) {
|
|
81
|
+
if (sourceMappingURL.startsWith('data:')) {
|
|
82
|
+
const map = parseDataUrl(sourceMappingURL);
|
|
83
|
+
return {
|
|
84
|
+
map: parseSourceMapInput(map),
|
|
85
|
+
mapPath: codePath
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
const mapPath = path.join(codePath, '..', sourceMappingURL);
|
|
89
|
+
if (!fs.existsSync(mapPath)) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
map: parseSourceMapInput(fs.readFileSync(mapPath, 'utf-8')),
|
|
94
|
+
mapPath
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function parseDataUrl(url) {
|
|
98
|
+
const [prefix, payload] = url.split(',');
|
|
99
|
+
const encoding = prefix.split(';').at(-1);
|
|
100
|
+
switch(encoding){
|
|
101
|
+
case 'base64':
|
|
102
|
+
return Buffer.from(payload, 'base64').toString();
|
|
103
|
+
case 'uri':
|
|
104
|
+
return decodeURIComponent(payload);
|
|
105
|
+
default:
|
|
106
|
+
throw new Error('Unsupported source map encoding: ' + encoding);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function normalizeSourcesPaths(map, mapPath) {
|
|
110
|
+
const mapDir = path.dirname(mapPath);
|
|
111
|
+
return map.sources.map((source)=>{
|
|
112
|
+
if (!source) {
|
|
113
|
+
return source;
|
|
114
|
+
}
|
|
115
|
+
return path.isAbsolute(source) ? source : path.resolve(mapDir, map.sourceRoot ?? '.', source);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function mapSourceMap(map, dirPath, inputs) {
|
|
120
|
+
const alreadyRemapped = new Set();
|
|
121
|
+
const remapped = remapping(map, (file, ctx)=>{
|
|
122
|
+
var _ctx;
|
|
123
|
+
if (alreadyRemapped.has(file)) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
alreadyRemapped.add(file);
|
|
127
|
+
const codeMap = loadCodeAndMap(path.resolve(dirPath, file));
|
|
128
|
+
if (!codeMap) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const parentPath = normalizePath(file);
|
|
132
|
+
const { format } = inputs[parentPath];
|
|
133
|
+
codeMap.map?.sources.filter((source)=>source !== null).forEach((source, index)=>{
|
|
134
|
+
const normalizedPath = normalizePath(source);
|
|
135
|
+
if (parentPath === normalizedPath) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
inputs[normalizedPath] = {
|
|
139
|
+
bytes: Buffer.byteLength(codeMap.map.sourcesContent?.[index] ?? ''),
|
|
140
|
+
format,
|
|
141
|
+
imports: [],
|
|
142
|
+
belongsTo: parentPath
|
|
143
|
+
};
|
|
144
|
+
});
|
|
145
|
+
(_ctx = ctx).content ?? (_ctx.content = codeMap.code);
|
|
146
|
+
return codeMap.map;
|
|
147
|
+
}, {
|
|
148
|
+
decodedMappings: true
|
|
149
|
+
});
|
|
150
|
+
return remapped;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function getBytesPerSource(code, map) {
|
|
154
|
+
const contributions = new Array(map.sources.length).fill('');
|
|
155
|
+
// Split the source code by lines
|
|
156
|
+
const codeLines = code.split(RegExp("(?<=\\r?\\n)"));
|
|
157
|
+
for(let lineIndex = 0; lineIndex < map.mappings.length; lineIndex++){
|
|
158
|
+
const line = map.mappings[lineIndex];
|
|
159
|
+
const lineCode = codeLines[lineIndex];
|
|
160
|
+
for(let mappingIndex = 0; mappingIndex < line.length; mappingIndex++){
|
|
161
|
+
// 0: generatedColumn
|
|
162
|
+
// 1: fileIndex
|
|
163
|
+
// 2: originalLine
|
|
164
|
+
// 3: originalColumn
|
|
165
|
+
// 4: nameIndex
|
|
166
|
+
const [startColumn, fileIndex] = line[mappingIndex];
|
|
167
|
+
const endColumn = line[mappingIndex + 1]?.[0] ?? lineCode.length;
|
|
168
|
+
contributions[fileIndex] += lineCode.slice(startColumn, endColumn);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return new Map(contributions.map((code, index)=>[
|
|
172
|
+
map.sources[index],
|
|
173
|
+
getSizes(code)
|
|
174
|
+
]));
|
|
175
|
+
}
|
|
176
|
+
function getSizes(code) {
|
|
177
|
+
return {
|
|
178
|
+
uncompressed: Buffer.byteLength(code),
|
|
179
|
+
gzip: zlib.gzipSync(code).length,
|
|
180
|
+
brotli: zlib.brotliCompressSync(code).length
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function generateJsonReport(assets, inputs) {
|
|
185
|
+
const outputsEntries = assets.filter((asset)=>!asset.endsWith('.map')).map((asset)=>processAsset(asset, inputs)).filter((output)=>!!output);
|
|
186
|
+
return {
|
|
187
|
+
inputs,
|
|
188
|
+
outputs: Object.fromEntries(outputsEntries)
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function generateHtmlReport(assets, inputs) {
|
|
192
|
+
const json = generateJsonReport(assets, inputs);
|
|
193
|
+
const __dirname = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
|
|
194
|
+
const template = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf-8');
|
|
195
|
+
return template.replace('__REPORT_DATA__', JSON.stringify(json));
|
|
196
|
+
}
|
|
197
|
+
function processAsset(asset, inputs) {
|
|
198
|
+
const maybeCodeMap = loadCodeAndMap(asset);
|
|
199
|
+
if (!hasCodeAndMap(maybeCodeMap)) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const { code, map } = maybeCodeMap;
|
|
203
|
+
const mapped = mapSourceMap(map, path.dirname(asset), inputs);
|
|
204
|
+
mapped.sources = mapped.sources.map((source)=>normalizePath(source));
|
|
205
|
+
const bytes = getBytesPerSource(code, mapped);
|
|
206
|
+
return [
|
|
207
|
+
normalizePath(asset),
|
|
208
|
+
{
|
|
209
|
+
...getSizes(code),
|
|
210
|
+
inputs: mapped.sources.reduce((acc, source)=>{
|
|
211
|
+
if (source) {
|
|
212
|
+
acc[normalizePath(source)] = bytes.get(source) ?? {
|
|
213
|
+
uncompressed: 0,
|
|
214
|
+
gzip: 0,
|
|
215
|
+
brotli: 0
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
return acc;
|
|
219
|
+
}, {})
|
|
220
|
+
}
|
|
221
|
+
];
|
|
222
|
+
}
|
|
223
|
+
function hasCodeAndMap(result) {
|
|
224
|
+
return Boolean(result && result.code && result.map);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function generateReportFromAssets(assets, inputs, options) {
|
|
228
|
+
const handler = options.format === 'html' ? saveHtml : saveJson;
|
|
229
|
+
const path = handler(assets, inputs);
|
|
230
|
+
options.open && path && open(path);
|
|
231
|
+
}
|
|
232
|
+
function saveHtml(assets, inputs) {
|
|
233
|
+
const report = generateHtmlReport(assets, inputs);
|
|
234
|
+
const path$1 = path.join(process.cwd(), 'sonda-report.html');
|
|
235
|
+
fs.writeFileSync(path$1, report);
|
|
236
|
+
return path$1;
|
|
237
|
+
}
|
|
238
|
+
function saveJson(assets, inputs) {
|
|
239
|
+
const report = generateJsonReport(assets, inputs);
|
|
240
|
+
const path$1 = path.join(process.cwd(), 'sonda-report.json');
|
|
241
|
+
fs.writeFileSync(path$1, JSON.stringify(report, null, 2));
|
|
242
|
+
return path$1;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function SondaEsbuildPlugin(options) {
|
|
246
|
+
return {
|
|
247
|
+
name: 'sonda',
|
|
248
|
+
setup (build) {
|
|
249
|
+
build.initialOptions.metafile = true;
|
|
250
|
+
build.onEnd((result)=>{
|
|
251
|
+
if (!result.metafile) {
|
|
252
|
+
return console.error('Metafile is required for SondaEsbuildPlugin to work.');
|
|
253
|
+
}
|
|
254
|
+
const inputs = Object.entries(result.metafile.inputs).reduce((acc, [path, data])=>{
|
|
255
|
+
acc[path] = {
|
|
256
|
+
bytes: data.bytes,
|
|
257
|
+
format: data.format ?? 'unknown',
|
|
258
|
+
imports: data.imports.map((data)=>data.path),
|
|
259
|
+
belongsTo: null
|
|
260
|
+
};
|
|
261
|
+
return acc;
|
|
262
|
+
}, {});
|
|
263
|
+
generateReportFromAssets(Object.keys(result.metafile.outputs), inputs, normalizeOptions(options));
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const esmRegex = /* #__ PURE__ */ /\.m[tj]sx?$/;
|
|
270
|
+
const cjsRegex = /* #__ PURE__ */ /\.c[tj]sx?$/;
|
|
271
|
+
function SondaRollupPlugin(options) {
|
|
272
|
+
let inputs = {};
|
|
273
|
+
return {
|
|
274
|
+
name: 'sonda',
|
|
275
|
+
writeBundle ({ dir, file }, bundle) {
|
|
276
|
+
const outputDir = path.resolve(process.cwd(), dir ?? path.dirname(file));
|
|
277
|
+
const assets = Object.keys(bundle).map((name)=>path.join(outputDir, name));
|
|
278
|
+
return generateReportFromAssets(assets, inputs, normalizeOptions(options));
|
|
279
|
+
},
|
|
280
|
+
moduleParsed (module) {
|
|
281
|
+
inputs[normalizePath(module.id)] = {
|
|
282
|
+
bytes: module.code ? Buffer.byteLength(module.code) : 0,
|
|
283
|
+
format: getFormat$1(module.id, module.meta.commonjs?.isCommonJS),
|
|
284
|
+
imports: module.importedIds.map((id)=>normalizePath(id)),
|
|
285
|
+
belongsTo: null
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function getFormat$1(moduleId, isCommonJS) {
|
|
291
|
+
if (isCommonJS === true || cjsRegex.test(moduleId)) {
|
|
292
|
+
return 'cjs';
|
|
293
|
+
}
|
|
294
|
+
if (isCommonJS === false || esmRegex.test(moduleId)) {
|
|
295
|
+
return 'esm';
|
|
296
|
+
}
|
|
297
|
+
return 'unknown';
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
const jsRegexp = /\.[c|m]?[t|j]s[x]?$/;
|
|
301
|
+
class SondaWebpackPlugin {
|
|
302
|
+
apply(compiler) {
|
|
303
|
+
compiler.options.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';
|
|
304
|
+
compiler.hooks.compilation.tap('SondaWebpackPlugin', (compilation)=>{
|
|
305
|
+
compilation.hooks.optimizeModules.tap('SondaWebpackPlugin', (modules)=>{
|
|
306
|
+
Array.from(modules).forEach((module)=>{
|
|
307
|
+
if (!isNormalModule(module)) {
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
const imports = module.dependencies.reduce((acc, dependency)=>{
|
|
311
|
+
const module = compilation.moduleGraph.getModule(dependency);
|
|
312
|
+
if (isNormalModule(module)) {
|
|
313
|
+
acc.push(normalizePath(module.resource));
|
|
314
|
+
}
|
|
315
|
+
return acc;
|
|
316
|
+
}, []);
|
|
317
|
+
this.inputs[normalizePath(module.resource)] = {
|
|
318
|
+
bytes: module.size(),
|
|
319
|
+
format: getFormat(module),
|
|
320
|
+
imports,
|
|
321
|
+
belongsTo: null
|
|
322
|
+
};
|
|
323
|
+
});
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
compiler.hooks.emit.tapAsync('SondaWebpackPlugin', (compilation, callback)=>{
|
|
327
|
+
const outputPath = compiler.options.output.path || compiler.outputPath || process.cwd();
|
|
328
|
+
const assets = Object.keys(compilation.assets).map((name)=>path.join(outputPath, name));
|
|
329
|
+
generateReportFromAssets(assets, this.inputs, normalizeOptions(this.options));
|
|
330
|
+
callback();
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
constructor(options){
|
|
334
|
+
this.options = options || {};
|
|
335
|
+
this.inputs = {};
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
function getFormat(module) {
|
|
339
|
+
if (!jsRegexp.test(module.resource)) {
|
|
340
|
+
return 'unknown';
|
|
341
|
+
}
|
|
342
|
+
if (module.type === 'javascript/esm' || module.buildMeta?.exportsType === 'namespace') {
|
|
343
|
+
return 'esm';
|
|
344
|
+
}
|
|
345
|
+
return 'cjs';
|
|
346
|
+
}
|
|
347
|
+
function isNormalModule(module) {
|
|
348
|
+
return module !== null && 'resource' in module;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
exports.SondaEsbuildPlugin = SondaEsbuildPlugin;
|
|
352
|
+
exports.SondaRollupPlugin = SondaRollupPlugin;
|
|
353
|
+
exports.SondaWebpackPlugin = SondaWebpackPlugin;
|
|
354
|
+
exports.loadCodeAndMap = loadCodeAndMap;
|
|
355
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/utils.ts","../src/sourcemap/load.ts","../src/sourcemap/map.ts","../src/sourcemap/bytes.ts","../src/report.ts","../src/report/generate.ts","../src/bundlers/esbuild.ts","../src/bundlers/rollup.ts","../src/bundlers/webpack.ts"],"sourcesContent":["import { relative, posix, sep } from 'path';\nimport { exec } from 'child_process';\nimport type { Options } from './types';\n\nconst cwd = /* #__ PURE__ */ process.cwd();\n\nexport function normalizeOptions( options?: Partial<Options> ) {\n\tconst defaultOptions: Options = {\n\t\topen: true,\n\t\tformat: 'html',\n\t};\n\n\treturn Object.assign( {}, defaultOptions, options ) as Options;\n}\n\nexport function normalizePath( path: string ): string {\n\t// Unicode escape sequences used by Rollup and Vite to identify virtual modules\n\tconst normalized = path.replace( /^\\0/, '' )\n\n\t// Transform absolute paths to relative paths\n\tconst relativized = relative( cwd, normalized );\n\n\t// Ensure paths are POSIX-compliant - https://stackoverflow.com/a/63251716/4617687\n\treturn relativized.replaceAll( sep, posix.sep );\n}\n\nfunction getOpenCommand() {\n\tswitch ( process.platform ) {\n\t\tcase 'darwin': return 'open';\n\t\tcase 'win32': return 'start';\n\t\tdefault: return 'xdg-open';\n\t}\n}\n\nexport function open( path: string ): void {\n\texec( getOpenCommand() + ' ' + path )\n}\n","import { existsSync, readFileSync } from 'fs';\nimport { dirname, join, resolve, isAbsolute } from 'path';\nimport type { MaybeCodeMap } from '../types.js';\nimport type { EncodedSourceMap } from '@ampproject/remapping';\n\n/**\n * Strip any JSON XSSI avoidance prefix from the string (as documented in the source maps specification),\n * and parses the string as JSON.\n *\n * https://github.com/mozilla/source-map/blob/3cb92cc3b73bfab27c146bae4ef2bc09dbb4e5ed/lib/util.js#L162-L164\n */\nfunction parseSourceMapInput( str: string ): EncodedSourceMap {\n\treturn JSON.parse( str.replace( /^\\)]}'[^\\n]*\\n/, \"\" ) );\n}\n\n/**\n\tsourceMappingURL=data:application/json;charset=utf-8;base64,data\n \tsourceMappingURL=data:application/json;base64,data\n\tsourceMappingURL=data:application/json;uri,data\n\tsourceMappingURL=map-file-comment.css.map\n*/\nconst sourceMappingRegExp = /[@#]\\s*sourceMappingURL=(\\S+)\\b/g;\n\nexport function loadCodeAndMap( codePath: string ): MaybeCodeMap {\n\tif ( !existsSync( codePath ) ) {\n\t\treturn null;\n\t}\n\n\tconst code = readFileSync( codePath, 'utf-8' );\n\n\tconst extractedComment = code.includes( 'sourceMappingURL' ) && Array.from( code.matchAll( sourceMappingRegExp ) ).at( -1 );\n\n\tif ( !extractedComment || !extractedComment.length ) {\n\t\treturn { code };\n\t}\n\n\tconst maybeMap = loadMap( codePath, extractedComment[ 1 ] );\n\n\tif ( !maybeMap ) {\n\t\treturn { code };\n\t}\n\n\tconst { map, mapPath } = maybeMap;\n\n\tmap.sources = normalizeSourcesPaths( map, mapPath );\n\tdelete map.sourceRoot;\n\n\treturn {\n\t\tcode,\n\t\tmap\n\t};\n}\n\nfunction loadMap( codePath: string, sourceMappingURL: string ): { map: EncodedSourceMap; mapPath: string } | null {\n\tif ( sourceMappingURL.startsWith( 'data:' ) ) {\n\t\tconst map = parseDataUrl( sourceMappingURL );\n\n\t\treturn {\n\t\t\tmap: parseSourceMapInput( map ),\n\t\t\tmapPath: codePath\n\t\t};\n\t}\n\n\tconst mapPath = join( codePath, '..', sourceMappingURL );\n\n\tif ( !existsSync( mapPath ) ) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\tmap: parseSourceMapInput( readFileSync( mapPath, 'utf-8' ) ),\n\t\tmapPath\n\t};\n}\n\nfunction parseDataUrl( url: string ): string {\n\tconst [ prefix, payload ] = url.split( ',' );\n\tconst encoding = prefix.split( ';' ).at( -1 );\n\n\tswitch ( encoding ) {\n\t\tcase 'base64':\n\t\t\treturn Buffer.from( payload, 'base64' ).toString();\n\t\tcase 'uri':\n\t\t\treturn decodeURIComponent( payload );\n\t\tdefault:\n\t\t\tthrow new Error( 'Unsupported source map encoding: ' + encoding );\n\t}\n}\n\nfunction normalizeSourcesPaths( map: EncodedSourceMap, mapPath: string ): EncodedSourceMap[ 'sources' ] {\n\tconst mapDir = dirname( mapPath );\n\n\treturn map.sources.map( source => {\n\t\tif ( !source ) {\n\t\t\treturn source;\n\t\t}\n\n\t\treturn isAbsolute( source )\n\t\t\t? source\n\t\t\t: resolve( mapDir, map.sourceRoot ?? '.', source );\n\t} );\n}\n","import { default as remapping, type DecodedSourceMap, type EncodedSourceMap } from '@ampproject/remapping';\nimport { loadCodeAndMap } from './load';\nimport { resolve } from 'path';\nimport type { ReportInput } from '../types';\nimport { normalizePath } from '../utils';\n\nexport function mapSourceMap(\n\tmap: EncodedSourceMap,\n\tdirPath: string,\n\tinputs: Record<string, ReportInput>\n): DecodedSourceMap {\n\tconst alreadyRemapped = new Set<string>();\n\tconst remapped = remapping( map, ( file, ctx ) => {\n\t\tif ( alreadyRemapped.has( file ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\talreadyRemapped.add( file );\n\n\t\tconst codeMap = loadCodeAndMap( resolve( dirPath, file ) );\n\n\t\tif ( !codeMap ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst parentPath = normalizePath( file );\n\t\tconst { format } = inputs[ parentPath ];\n\n\t\tcodeMap.map?.sources\n\t\t\t.filter( source => source !== null )\n\t\t\t.forEach( ( source, index ) => {\n\t\t\t\tconst normalizedPath = normalizePath( source );\n\n\t\t\t\tif ( parentPath === normalizedPath ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tinputs[ normalizedPath ] = {\n\t\t\t\t\tbytes: Buffer.byteLength( codeMap.map!.sourcesContent?.[ index ] ?? '' ),\n\t\t\t\t\tformat,\n\t\t\t\t\timports: [],\n\t\t\t\t\tbelongsTo: parentPath\n\t\t\t\t};\n\t\t\t} );\n\n\t\tctx.content ??= codeMap.code;\n\n\t\treturn codeMap.map;\n\t}, { decodedMappings: true } );\n\n\treturn remapped as DecodedSourceMap;\n}\n","import { gzipSync, brotliCompressSync } from 'zlib';\nimport type { DecodedSourceMap } from '@ampproject/remapping';\nimport type { Sizes } from '../types';\n\nexport function getBytesPerSource( code: string, map: DecodedSourceMap ): Map<string, Sizes> {\n\tconst contributions = new Array( map.sources.length ).fill( '' );\n\n\t// Split the source code by lines\n\tconst codeLines = code.split( /(?<=\\r?\\n)/ );\n\n\tfor ( let lineIndex = 0; lineIndex < map.mappings.length; lineIndex++ ) {\n\t\tconst line = map.mappings[ lineIndex ];\n\t\tconst lineCode = codeLines[ lineIndex ];\n\n\t\tfor ( let mappingIndex = 0; mappingIndex < line.length; mappingIndex++ ) {\n\t\t\t// 0: generatedColumn\n\t\t\t// 1: fileIndex\n\t\t\t// 2: originalLine\n\t\t\t// 3: originalColumn\n\t\t\t// 4: nameIndex\n\n\t\t\tconst [ startColumn, fileIndex ] = line[ mappingIndex ];\n\t\t\tconst endColumn = line[ mappingIndex + 1 ]?.[ 0 ] ?? lineCode.length;\n\n\t\t\tcontributions[ fileIndex! ] += lineCode.slice( startColumn, endColumn );\n\t\t}\n\t}\n\n\treturn new Map<string, Sizes>( \n\t\tcontributions.map( ( code, index ) => [ map.sources[ index ]!, getSizes( code ) ] )\n\t);\n}\n\nexport function getSizes( code: string ): Sizes {\n\treturn {\n\t\tuncompressed: Buffer.byteLength( code ),\n\t\tgzip: gzipSync( code ).length,\n\t\tbrotli: brotliCompressSync( code ).length\n\t};\n}\n","import { dirname, resolve } from 'path';\nimport { fileURLToPath } from 'url';\nimport { readFileSync } from 'fs';\nimport { mapSourceMap } from './sourcemap/map.js';\nimport { getBytesPerSource, getSizes } from './sourcemap/bytes.js';\nimport { loadCodeAndMap } from './sourcemap/load.js';\nimport type {\n JsonReport,\n MaybeCodeMap,\n ReportInput,\n ReportOutput,\n CodeMap,\n ReportOutputInput\n} from './types.js';\nimport { normalizePath } from './utils.js';\n\nexport function generateJsonReport(\n assets: Array<string>,\n inputs: Record<string, ReportInput>\n): JsonReport {\n const outputsEntries = assets\n .filter( asset => !asset.endsWith( '.map' ) )\n .map( asset => processAsset( asset, inputs ) )\n .filter( output => !!output );\n\n return {\n inputs,\n outputs: Object.fromEntries( outputsEntries )\n };\n}\n\nexport function generateHtmlReport(\n assets: Array<string>,\n inputs: Record<string, ReportInput>\n): string {\n const json = generateJsonReport( assets, inputs );\n const __dirname = dirname( fileURLToPath( import.meta.url ) );\n const template = readFileSync( resolve( __dirname, './index.html' ), 'utf-8' );\n\n return template.replace( '__REPORT_DATA__', JSON.stringify( json ) );\n}\n\nfunction processAsset( asset: string, inputs: Record<string, ReportInput> ): [ string, ReportOutput ] | void {\n const maybeCodeMap = loadCodeAndMap( asset );\n\n if ( !hasCodeAndMap( maybeCodeMap ) ) {\n return;\n }\n\n const { code, map } = maybeCodeMap;\n const mapped = mapSourceMap( map, dirname( asset ), inputs );\n\n mapped.sources = mapped.sources.map( source => normalizePath( source! ) );\n\n const bytes = getBytesPerSource( code, mapped );\n\n return [ normalizePath( asset ), {\n ...getSizes( code ),\n inputs: mapped.sources.reduce( ( acc, source ) => {\n if ( source ) {\n acc[ normalizePath( source ) ] = bytes.get( source ) ?? {\n uncompressed: 0,\n gzip: 0,\n brotli: 0\n };\n }\n\n return acc;\n }, {} as Record<string, ReportOutputInput> )\n } ];\n}\n\nfunction hasCodeAndMap( result: MaybeCodeMap ): result is Required<CodeMap> {\n return Boolean( result && result.code && result.map );\n}\n","import { join } from 'path';\nimport { writeFileSync } from 'fs';\nimport { open } from '../utils.js';\nimport { generateHtmlReport, generateJsonReport } from '../report.js';\nimport type { Options, JsonReport } from '../types.js';\n\nexport function generateReportFromAssets(\n\tassets: string[],\n\tinputs: JsonReport[ 'inputs' ],\n\toptions: Options\n): void {\n\tconst handler = options.format === 'html'\n\t\t? saveHtml\n\t\t: saveJson;\n\n\tconst path = handler( assets, inputs );\n\n\toptions.open && path && open( path );\n}\n\nfunction saveHtml(\n\tassets: string[],\n\tinputs: JsonReport[ 'inputs' ]\n): string | null {\n\tconst report = generateHtmlReport( assets, inputs );\n\tconst path = join( process.cwd(), 'sonda-report.html' );\n\n\twriteFileSync( path, report );\n\n\treturn path;\n}\n\nfunction saveJson(\n\tassets: string[],\n\tinputs: JsonReport[ 'inputs' ]\n): string | null {\n\tconst report = generateJsonReport( assets, inputs );\n\tconst path = join( process.cwd(), 'sonda-report.json' );\n\n\twriteFileSync( path, JSON.stringify( report, null, 2 ) );\n\n\treturn path;\n}\n","import { normalizeOptions } from '../utils';\nimport { generateReportFromAssets } from '../report/generate';\nimport type { Plugin } from 'esbuild';\nimport type { Options, JsonReport } from '../types';\n\nexport function SondaEsbuildPlugin( options?: Partial<Options> ): Plugin {\n\treturn {\n\t\tname: 'sonda',\n\t\tsetup( build ) {\n\t\t\tbuild.initialOptions.metafile = true;\n\n\t\t\tbuild.onEnd( result => {\n\t\t\t\tif ( !result.metafile ) {\n\t\t\t\t\treturn console.error( 'Metafile is required for SondaEsbuildPlugin to work.' );\n\t\t\t\t}\n\n\t\t\t\tconst inputs = Object\n\t\t\t\t\t.entries( result.metafile.inputs )\n\t\t\t\t\t.reduce( ( acc, [ path, data ] ) => {\n\t\t\t\t\t\t\n\t\t\t\t\t\tacc[ path ] = {\n\t\t\t\t\t\t\tbytes: data.bytes,\n\t\t\t\t\t\t\tformat: data.format ?? 'unknown',\n\t\t\t\t\t\t\timports: data.imports.map( data => data.path ),\n\t\t\t\t\t\t\tbelongsTo: null,\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t}, {} as JsonReport[ 'inputs' ] );\n\n\t\t\t\tgenerateReportFromAssets(\n\t\t\t\t\tObject.keys( result.metafile.outputs ),\n\t\t\t\t\tinputs,\n\t\t\t\t\tnormalizeOptions( options )\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\t};\n}\n","import { join, resolve, dirname } from 'path';\nimport { normalizeOptions, normalizePath } from '../utils.js';\nimport { generateReportFromAssets } from '../report/generate.js';\nimport type { Options, ModuleFormat, JsonReport } from '../types.js';\nimport type { Plugin, ModuleInfo, NormalizedOutputOptions, OutputBundle } from 'rollup';\n\nconst esmRegex = /* #__ PURE__ */ /\\.m[tj]sx?$/;\nconst cjsRegex = /* #__ PURE__ */ /\\.c[tj]sx?$/;\n\nexport function SondaRollupPlugin( options?: Partial<Options> ): Plugin {\n\tlet inputs: JsonReport[ 'inputs' ] = {};\n\n\treturn {\n\t\tname: 'sonda',\n\n\t\twriteBundle(\n\t\t\t{ dir, file }: NormalizedOutputOptions,\n\t\t\tbundle: OutputBundle\n\t\t) {\n\t\t\tconst outputDir = resolve( process.cwd(), dir ?? dirname( file! ) );\n\t\t\tconst assets = Object.keys( bundle ).map( name => join( outputDir, name ) );\n\n\t\t\treturn generateReportFromAssets(\n\t\t\t\tassets,\n\t\t\t\tinputs,\n\t\t\t\tnormalizeOptions( options )\n\t\t\t);\n\t\t},\n\n\t\tmoduleParsed( module: ModuleInfo ) {\n\t\t\tinputs[ normalizePath( module.id ) ] = {\n\t\t\t\tbytes: module.code ? Buffer.byteLength( module.code ) : 0,\n\t\t\t\tformat: getFormat( module.id, module.meta.commonjs?.isCommonJS ),\n\t\t\t\timports: module.importedIds.map( id => normalizePath( id ) ),\n\t\t\t\tbelongsTo: null,\n\t\t\t};\n\t\t}\n\t};\n}\n\nfunction getFormat( moduleId: string, isCommonJS: boolean | undefined ): ModuleFormat {\n\tif ( isCommonJS === true || cjsRegex.test( moduleId ) ) {\n\t\treturn 'cjs';\n\t}\n\n\tif ( isCommonJS === false || esmRegex.test( moduleId ) ) {\n\t\treturn 'esm';\n\t}\n\n\treturn'unknown';\n}\n","import { join } from 'path';\nimport { normalizeOptions, normalizePath } from '../utils';\nimport { generateReportFromAssets } from '../report/generate';\nimport type { Options, ModuleFormat, JsonReport } from '../types';\nimport { NormalModule, type Compiler, type Module } from 'webpack';\n\nconst jsRegexp = /* #__PURE__ */ /\\.[c|m]?[t|j]s[x]?$/;\n\nexport class SondaWebpackPlugin {\n\toptions: Partial<Options>;\n\tinputs: JsonReport[ 'inputs' ];\n\n\tconstructor ( options?: Partial<Options> ) {\n\t\tthis.options = options || {};\n\t\tthis.inputs = {};\n\t}\n\n\tapply( compiler: Compiler ): void {\n\t\tcompiler.options.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';\n\n\t\tcompiler.hooks.compilation.tap( 'SondaWebpackPlugin', ( compilation ) => {\n\t\t\tcompilation.hooks.optimizeModules.tap( 'SondaWebpackPlugin', ( modules ) => {\n\t\t\t\tArray\n\t\t\t\t\t.from( modules )\n\t\t\t\t\t.forEach( module => {\n\t\t\t\t\t\tif ( !isNormalModule( module ) ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst imports = module.dependencies.reduce( ( acc, dependency ) => {\n\t\t\t\t\t\t\tconst module = compilation.moduleGraph.getModule( dependency );\n\n\t\t\t\t\t\t\tif ( isNormalModule( module ) ) {\n\t\t\t\t\t\t\t\tacc.push( normalizePath( module.resource ) );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t}, [] as Array<string> );\n\n\t\t\t\t\t\tthis.inputs[ normalizePath( module.resource ) ] = {\n\t\t\t\t\t\t\tbytes: module.size(),\n\t\t\t\t\t\t\tformat: getFormat( module ),\n\t\t\t\t\t\t\timports,\n\t\t\t\t\t\t\tbelongsTo: null,\n\t\t\t\t\t\t};\n\t\t\t\t\t} );\n\t\t\t} );\n\t\t} );\n\n\t\tcompiler.hooks.emit.tapAsync( 'SondaWebpackPlugin', ( compilation, callback ) => {\n\t\t\tconst outputPath = compiler.options.output.path || compiler.outputPath || process.cwd();\n\t\t\tconst assets = Object.keys( compilation.assets ).map( name => join( outputPath, name ) );\n\n\t\t\tgenerateReportFromAssets(\n\t\t\t\tassets,\n\t\t\t\tthis.inputs,\n\t\t\t\tnormalizeOptions( this.options )\n\t\t\t);\n\n\t\t\tcallback();\n\t\t} );\n\t}\n}\n\nfunction getFormat( module: NormalModule ): ModuleFormat {\n\tif ( !jsRegexp.test( module.resource ) ) {\n\t\treturn 'unknown';\n\t}\n\n\tif ( module.type === 'javascript/esm' || module.buildMeta?.exportsType === 'namespace' ) {\n\t\treturn 'esm';\n\t}\n\n\treturn 'cjs';\n}\n\nfunction isNormalModule( module: Module | NormalModule | null ): module is NormalModule {\n\treturn module !== null && 'resource' in module;\n}\n"],"names":["cwd","process","normalizeOptions","options","defaultOptions","open","format","Object","assign","normalizePath","path","normalized","replace","relativized","relative","replaceAll","sep","posix","getOpenCommand","platform","exec","parseSourceMapInput","str","JSON","parse","sourceMappingRegExp","loadCodeAndMap","codePath","existsSync","code","readFileSync","extractedComment","includes","Array","from","matchAll","at","length","maybeMap","loadMap","map","mapPath","sources","normalizeSourcesPaths","sourceRoot","sourceMappingURL","startsWith","parseDataUrl","join","url","prefix","payload","split","encoding","Buffer","toString","decodeURIComponent","Error","mapDir","dirname","source","isAbsolute","resolve","mapSourceMap","dirPath","inputs","alreadyRemapped","Set","remapped","remapping","file","ctx","has","add","codeMap","parentPath","filter","forEach","index","normalizedPath","bytes","byteLength","sourcesContent","imports","belongsTo","content","decodedMappings","getBytesPerSource","contributions","fill","codeLines","lineIndex","mappings","line","lineCode","mappingIndex","startColumn","fileIndex","endColumn","slice","Map","getSizes","uncompressed","gzip","gzipSync","brotli","brotliCompressSync","generateJsonReport","assets","outputsEntries","asset","endsWith","processAsset","output","outputs","fromEntries","generateHtmlReport","json","__dirname","fileURLToPath","template","stringify","maybeCodeMap","hasCodeAndMap","mapped","reduce","acc","get","result","Boolean","generateReportFromAssets","handler","saveHtml","saveJson","report","writeFileSync","SondaEsbuildPlugin","name","setup","build","initialOptions","metafile","onEnd","console","error","entries","data","keys","esmRegex","cjsRegex","SondaRollupPlugin","writeBundle","dir","bundle","outputDir","moduleParsed","module","id","getFormat","meta","commonjs","isCommonJS","importedIds","moduleId","test","jsRegexp","SondaWebpackPlugin","apply","compiler","devtoolModuleFilenameTemplate","hooks","compilation","tap","optimizeModules","modules","isNormalModule","dependencies","dependency","moduleGraph","getModule","push","resource","size","emit","tapAsync","callback","outputPath","constructor","type","buildMeta","exportsType"],"mappings":";;;;;;;;;;AAIA,MAAMA,GAAM,oBAAiBC,OAAAA,CAAQD,GAAG,EA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,CAAA;AAG/BsL,YAAAA,QAAAA,EAAAA,CAAAA;AACD,SAAA,CAAA,CAAA;AACD,KAAA;AAjDAE,IAAAA,WAAAA,CAAcxL,OAA0B,CAAG;AAC1C,QAAA,IAAI,CAACA,OAAO,GAAGA,OAAAA,IAAW,EAAC,CAAA;QAC3B,IAAI,CAAC8D,MAAM,GAAG,EAAC,CAAA;AAChB,KAAA;AA+CD,CAAA;AAEA,SAAS6F,UAAWF,MAAoB,EAAA;AACvC,IAAA,IAAK,CAACS,QAASD,CAAAA,IAAI,CAAER,MAAAA,CAAOyB,QAAQ,CAAK,EAAA;QACxC,OAAO,SAAA,CAAA;AACR,KAAA;IAEA,IAAKzB,MAAAA,CAAOgC,IAAI,KAAK,gBAAA,IAAoBhC,OAAOiC,SAAS,EAAEC,gBAAgB,WAAc,EAAA;QACxF,OAAO,KAAA,CAAA;AACR,KAAA;IAEA,OAAO,KAAA,CAAA;AACR,CAAA;AAEA,SAASf,eAAgBnB,MAAoC,EAAA;IAC5D,OAAOA,MAAAA,KAAW,QAAQ,UAAcA,IAAAA,MAAAA,CAAAA;AACzC;;;;;;;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { SondaEsbuildPlugin } from './bundlers/esbuild.js';
|
|
2
|
+
export { SondaRollupPlugin } from './bundlers/rollup.js';
|
|
3
|
+
export { SondaWebpackPlugin } from './bundlers/webpack.js';
|
|
4
|
+
export { loadCodeAndMap } from './sourcemap/load.js';
|
|
5
|
+
export type { Options, JsonReport, ReportInput, ReportOutput, ReportOutputInput } from './types.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,YAAY,EACX,OAAO,EACP,UAAU,EACV,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,MAAM,YAAY,CAAC"}
|