+6
-0
| # Changelog | ||
| ## 0.9.0 | ||
| ### Minor Changes | ||
| - 87d59f9: Add `include` and `exclude` options | ||
| ## 0.8.2 | ||
@@ -4,0 +10,0 @@ |
+57
-23
@@ -14,2 +14,4 @@ import { DecodedSourceMap } from "@ampproject/remapping"; | ||
| get enabled(): boolean; | ||
| get include(): AssetFilter; | ||
| get exclude(): AssetFilter; | ||
| get format(): Format; | ||
@@ -37,4 +39,29 @@ get filename(): string; | ||
| /** | ||
| * Specifies the output format of the report. | ||
| * Specifies a list of RegExp patterns used to match output assets to include in the report. | ||
| * By default, all assets are included. | ||
| * | ||
| * Patterns are matched against the relative asset paths as displayed in the report. For example, | ||
| * to include only JavaScript files, use `[ /\.js$/ ]`. | ||
| * | ||
| * @default null | ||
| */ | ||
| include?: AssetFilter; | ||
| /** | ||
| * Specifies a list of RegExp patterns used to match output assets to exclude from the report. | ||
| * By default, no assets are excluded, except for those with `.map` and `.d.ts` extensions, which | ||
| * are always excluded regardless of this setting. | ||
| * | ||
| * This option takes precedence over `include`. | ||
| * | ||
| * Patterns are matched against the relative asset paths as shown in the report. For example, to exclude all CSS files, use `[ /\.css$/ ]`. | ||
| * | ||
| * @default null | ||
| */ | ||
| exclude?: AssetFilter; | ||
| /** | ||
| * Specifies the output format of the report. Supported formats include: | ||
| * | ||
| * - `'html'` - An HTML file with a treemap visualization. | ||
| * - `'json'` - A JSON file. | ||
| * | ||
| * @default 'html' | ||
@@ -45,4 +72,4 @@ */ | ||
| * Specifies the filename of the generated report. If this value is an absolute path, | ||
| * it will override the `outputDir` option. | ||
| * | ||
| * it overrides the `outputDir` option. | ||
| * | ||
| * The default value includes placeholders like `[index]` and `[env]`, which are replaced | ||
@@ -64,4 +91,7 @@ * during report generation. | ||
| /** | ||
| * Specifies the name of the directory where the report will be saved. | ||
| * Specifies the directory where the report will be saved. This can be a relative or absolute path. By default, | ||
| * the report is saved in a `.sonda` directory relative to the current working directory. | ||
| * | ||
| * The directory is created if it does not exist. | ||
| * | ||
| * @default '.sonda' | ||
@@ -79,10 +109,9 @@ */ | ||
| /** | ||
| * Specifies whether to read the source maps of imported modules. | ||
| * Specifies whether to read source maps of imported modules. | ||
| * | ||
| * By default, external dependencies bundled into a single file appear as a single | ||
| * asset in the report. When this option is enabled, the report includes the source | ||
| * files of imported modules, if source maps are available. | ||
| * By default, external dependencies bundled into a single file appear as a single asset. When this option | ||
| * is enabled, the report includes the source files of imported modules, if their source maps are available. | ||
| * | ||
| * Enabling this option may increase the time needed to generate the report and reduce | ||
| * the accuracy of estimated GZIP and Brotli sizes for individual files. | ||
| * Enabling this option may increase report generation time and reduce the accuracy of estimated GZIP | ||
| * and Brotli sizes. | ||
| * | ||
@@ -93,8 +122,9 @@ * @default false | ||
| /** | ||
| * Specifies whether to include source maps of the assets in the report to visualize | ||
| * which parts of the code contribute to the final asset size. | ||
| * Specifies whether to include source maps of generated assets in the report to visualize which parts of | ||
| * the code contribute to the final asset size. | ||
| * | ||
| * โ ๏ธ This option significantly increases the size of the report and embeds the | ||
| * **source code** of the assets. If you are working with proprietary code, ensure | ||
| * you share the report responsibly. โ ๏ธ | ||
| * โ ๏ธ | ||
| * This option significantly increases the report size and embeds the **source code** of the assets. | ||
| * If you are working with proprietary code, ensure you share the report responsibly. | ||
| * โ ๏ธ | ||
| * | ||
@@ -105,8 +135,8 @@ * @default false | ||
| /** | ||
| * Specifies whether to calculate the sizes of assets after compression with GZIP. | ||
| * Specifies whether to calculate asset sizes after compression with GZIP. | ||
| * | ||
| * The report includes estimated compressed sizes for each file within an asset. | ||
| * However, these estimates are approximate and should be used as a general reference. | ||
| * The report also includes estimated compressed sizes for each file within an asset. These estimates are | ||
| * approximate and intended for general reference. | ||
| * | ||
| * Enabling this option may increase the time required to generate the report. | ||
| * Enabling this option may increase report generation time. | ||
| * | ||
@@ -117,8 +147,8 @@ * @default false | ||
| /** | ||
| * Specifies whether to calculate the sizes of assets after compression with Brotli. | ||
| * Specifies whether to calculate asset sizes after compression with Brotli. | ||
| * | ||
| * The report includes estimated compressed sizes for each file within an asset. | ||
| * However, these estimates are approximate and should be used as a general reference. | ||
| * The report also includes estimated compressed sizes for each file within an asset. These estimates are | ||
| * approximate and intended for general reference. | ||
| * | ||
| * Enabling this option may increase the time required to generate the report. | ||
| * Enabling this option may increase report generation time. | ||
| * | ||
@@ -149,2 +179,6 @@ * @default false | ||
| } | ||
| /** | ||
| * Filter for including or excluding assets based on their paths. | ||
| */ | ||
| type AssetFilter = Array<RegExp> | null; | ||
| type Format = "html" | "json"; | ||
@@ -151,0 +185,0 @@ type Integration = "angular" | "astro" | "esbuild" | "next" | "nuxt" | "rolldown" | "rollup" | "rspack" | "sveltekit" | "vite" | "webpack" | "unknown"; |
+14
-3
@@ -20,2 +20,4 @@ import { styleText } from "util"; | ||
| enabled: true, | ||
| include: null, | ||
| exclude: null, | ||
| format: "html", | ||
@@ -39,2 +41,8 @@ filename: "sonda_[index]", | ||
| } | ||
| get include() { | ||
| return this.#options.include; | ||
| } | ||
| get exclude() { | ||
| return this.#options.exclude; | ||
| } | ||
| get format() { | ||
@@ -169,3 +177,3 @@ return this.#options.format; | ||
| //#region package.json | ||
| var version = "0.8.2"; | ||
| var version = "0.9.0"; | ||
@@ -209,3 +217,3 @@ //#endregion | ||
| const { dir, base } = parse(path); | ||
| const regex = new RegExp("^" + base.replace("[index]", "(\\d+)") + "$"); | ||
| const regex = /* @__PURE__ */ new RegExp("^" + base.replace("[index]", "(\\d+)") + "$"); | ||
| const versions = (await getAllFiles(dir)).map((path$1) => basename(path$1).match(regex)).filter((match) => match !== null).map((match) => parseInt(match[1], 10)); | ||
@@ -614,2 +622,5 @@ const maxVersion = Math.max(...versions, -1); | ||
| if (hasIgnoredExtension(name)) return; | ||
| const normalizedName = normalizePath(name); | ||
| if (this.config.exclude?.some((pattern) => pattern.test(normalizedName))) return; | ||
| if (this.config.include && !this.config.include.some((pattern) => pattern.test(normalizedName))) return; | ||
| this.assets[name] = entrypoints; | ||
@@ -792,3 +803,3 @@ } | ||
| */ | ||
| const sourceMapFilenameRegex = new RegExp(`(?:webpack://)?(?:${namespace})?([^?]*)`); | ||
| const sourceMapFilenameRegex = /* @__PURE__ */ new RegExp(`(?:webpack://)?(?:${namespace})?([^?]*)`); | ||
| compiler.hooks.afterEmit.tapPromise("SondaWebpackPlugin", async (compilation) => { | ||
@@ -795,0 +806,0 @@ for (const mod of compilation.modules) { |
+2
-2
| { | ||
| "name": "sonda", | ||
| "version": "0.8.2", | ||
| "description": "Universal visualizer and analyzer for JavaScript and CSS bundles. Works with most popular bundlers and frameworks.", | ||
| "version": "0.9.0", | ||
| "description": "Universal bundle analyzer and visualizer that works with most popular bundlers and frameworks.", | ||
| "keywords": [ | ||
@@ -6,0 +6,0 @@ "bundle", |
+1
-1
| # Sonda | ||
| Sonda is a universal visualizer and analyzer for JavaScript and CSS bundles. It generates an interactive HTML report that is more accurate and detailed than some alternatives. The accuracy is achieved by analyzing source maps and showing the size of each module after tree-shaking and minification. | ||
| Sonda is a universal bundle analyzer and visualizer. It generates an interactive HTML report that is more accurate and detailed than some alternatives. The accuracy is achieved by analyzing source maps and showing the size of each module after tree-shaking and minification. | ||
@@ -5,0 +5,0 @@ Sonda works with the following tools: |
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
283414
0.59%1568
2.95%