sonda 0.10.2 → 0.11.1

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/dist/index.js CHANGED
@@ -171,7 +171,7 @@ function hasIgnoredExtension(name) {
171
171
 
172
172
  //#endregion
173
173
  //#region package.json
174
- var version = "0.10.2";
174
+ var version = "0.11.1";
175
175
 
176
176
  //#endregion
177
177
  //#region src/report/formatters/Formatter.ts
@@ -209,11 +209,11 @@ var Formatter = class {
209
209
  async replaceIndex(path) {
210
210
  if (!path.includes("[index]")) return path;
211
211
  const { dir, base } = parse(path);
212
- const regex = /* @__PURE__ */ new RegExp("^" + base.replace("[index]", "(\\d+)") + "$");
213
- const versions = (await getAllFiles(dir)).map((path$1) => basename(path$1).match(regex)).filter((match) => match !== null).map((match) => parseInt(match[1], 10));
212
+ const regex = new RegExp("^" + base.replace("[index]", "(\\d+)") + "$");
213
+ const versions = (await getAllFiles(dir)).map((path) => basename(path).match(regex)).filter((match) => match !== null).map((match) => parseInt(match[1], 10));
214
214
  const maxVersion = Math.max(...versions, -1);
215
- const version$1 = String(maxVersion + 1);
216
- return path.replace("[index]", version$1);
215
+ const version = String(maxVersion + 1);
216
+ return path.replace("[index]", version);
217
217
  }
218
218
  };
219
219
 
@@ -462,9 +462,9 @@ function addAnalyzableType(report, path, entrypoints, type) {
462
462
  target: normalizePath(entry),
463
463
  original: null
464
464
  }));
465
- for (const [source, sizes$1] of sourcesSizes) {
465
+ for (const [source, sizes] of sourcesSizes) {
466
466
  const name = normalizePath(source);
467
- const type$1 = getTypeByName(source);
467
+ const type = getTypeByName(source);
468
468
  const parent = parentMap[source] ? normalizePath(parentMap[source]) : null;
469
469
  const existingSource = report.resources.find((resource) => resource.name === name && resource.kind === "filesystem");
470
470
  if (!existingSource) {
@@ -476,7 +476,7 @@ function addAnalyzableType(report, path, entrypoints, type) {
476
476
  report.addResource({
477
477
  kind: "sourcemap",
478
478
  name,
479
- type: type$1,
479
+ type,
480
480
  format: "other",
481
481
  uncompressed,
482
482
  parent: parent || null
@@ -485,9 +485,9 @@ function addAnalyzableType(report, path, entrypoints, type) {
485
485
  report.addResource({
486
486
  kind: "chunk",
487
487
  name,
488
- type: type$1,
488
+ type,
489
489
  format: existingSource?.format || "other",
490
- ...sizes$1,
490
+ ...sizes,
491
491
  parent: assetName
492
492
  });
493
493
  if (parent) report.addConnection({
@@ -615,9 +615,9 @@ var Report = class {
615
615
  for (const [path, entrypoints] of Object.entries(this.assets)) updateOutput(this, path, entrypoints);
616
616
  this.dependencies = updateDependencies(this);
617
617
  const outputs = [];
618
- for (const format$1 of this.config.format) {
619
- const path = await new formatters[format$1](this.config).write(this.#getFormattedData());
620
- if (this.config.open === true || this.config.open === format$1) await open(path);
618
+ for (const format of this.config.format) {
619
+ const path = await new formatters[format](this.config).write(this.#getFormattedData());
620
+ if (this.config.open === true || this.config.open === format) await open(path);
621
621
  outputs.push(path);
622
622
  }
623
623
  return outputs;
@@ -701,10 +701,10 @@ function SondaRollupPlugin(userOptions = {}) {
701
701
  const report = new Report(options);
702
702
  return {
703
703
  name: "sonda/rollup",
704
- async resolveId(source, importer, options$1) {
704
+ async resolveId(source, importer, options) {
705
705
  if (!importer) return;
706
706
  const resolved = await this.resolve(source, importer, {
707
- ...options$1,
707
+ ...options,
708
708
  skipSelf: true
709
709
  });
710
710
  if (resolved) report.addConnection({
@@ -738,7 +738,7 @@ function SondaRollupPlugin(userOptions = {}) {
738
738
  function getModuleFormat(name, module) {
739
739
  if (getTypeByName(name) !== "script") return "other";
740
740
  const ext = extname(module.id);
741
- return module.meta.commonjs?.isCommonJS === true || ext === ".cjs" || ext === ".cts" ? "cjs" : "esm";
741
+ return !!module.meta.commonjs?.isCommonJS || module.inputFormat === "cjs" || ext === ".cjs" || ext === ".cts" ? "cjs" : "esm";
742
742
  }
743
743
 
744
744
  //#endregion
@@ -783,12 +783,12 @@ var SondaWebpackPlugin = class {
783
783
  * - (?:${ namespace })? - Non-capturing group that matches the optional namespace
784
784
  * - ([^?]*) - Matches the path, which is everything up to the first "?" (if present)
785
785
  */
786
- const sourceMapFilenameRegex = /* @__PURE__ */ new RegExp(`(?:webpack://)?(?:${namespace})?([^?]*)`);
786
+ const sourceMapFilenameRegex = new RegExp(`(?:webpack://)?(?:${namespace})?([^?]*)`);
787
787
  compiler.hooks.afterEmit.tapPromise("SondaWebpackPlugin", async (compilation) => {
788
788
  for (const mod of compilation.modules) {
789
789
  const name = mod.nameForCondition();
790
790
  if (!name) continue;
791
- const module = mod.modules?.find((module$1) => module$1.nameForCondition() === name) || mod;
791
+ const module = mod.modules?.find((module) => module.nameForCondition() === name) || mod;
792
792
  const normalizedName = normalizePath(name);
793
793
  report.addResource({
794
794
  kind: "filesystem",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sonda",
3
- "version": "0.10.2",
3
+ "version": "0.11.1",
4
4
  "description": "Universal bundle analyzer and visualizer that works with most popular bundlers and frameworks.",
5
5
  "keywords": [
6
6
  "analyzer",