@svelte-vitals/core 0.36.0 → 0.36.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.
Files changed (2) hide show
  1. package/dist/index.js +24 -29
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5470,20 +5470,15 @@ var architectureReservedNamePlacement = {
5470
5470
  const emptyNames = /* @__PURE__ */ new Map();
5471
5471
  for (const map of Object.keys(globalMaps)) {
5472
5472
  for (const [name, value] of Object.entries(globalMaps[map])) {
5473
- const globs2 = globsOf(value);
5474
- if (globs2.length === 0) {
5473
+ const globs = globsOf(value);
5474
+ if (globs.length === 0) {
5475
5475
  emptyNames.set(`${map}.${name}`, "names no position at all");
5476
5476
  continue;
5477
5477
  }
5478
- for (const glob of globs2) globalAlternatives.set(label(map, name, glob), { map, glob });
5478
+ for (const glob of globs) globalAlternatives.set(label(map, name, glob), { map, glob });
5479
5479
  }
5480
5480
  }
5481
5481
  const usedAlternatives = /* @__PURE__ */ new Set();
5482
- const excludedDirs = [];
5483
- const nonUnitParents = {
5484
- capitalisedUnitPlacements: [],
5485
- anyCaseUnitPlacements: []
5486
- };
5487
5482
  const allDirs = [...dirs].sort();
5488
5483
  for (const dir of allDirs) {
5489
5484
  const o = resolveRuleOptions(ID7, OPTIONS6, ctx.config, { route: dir, file: dir }, compiledOverrides);
@@ -5506,17 +5501,13 @@ var architectureReservedNamePlacement = {
5506
5501
  const parent = parentOf(dir);
5507
5502
  if (parent === void 0) continue;
5508
5503
  if (isExcluded(dir, ancestorDirs2(dir), excluded)) {
5509
- if (isExcluded(parent, ancestorDirs2(parent), excluded)) excludedDirs.push(parent);
5510
5504
  continue;
5511
5505
  }
5512
5506
  const record = (map, value, qualifies) => {
5513
5507
  if (value === void 0) return false;
5514
5508
  const { matched } = matchKeys(parent, compile(globsOf(value), true));
5515
5509
  if (matched.length === 0) return false;
5516
- if (!qualifies) {
5517
- if (map !== "placements") nonUnitParents[map].push(parent);
5518
- return false;
5519
- }
5510
+ if (!qualifies) return false;
5520
5511
  for (const glob of matched) usedAlternatives.add(label(map, name, glob));
5521
5512
  return true;
5522
5513
  };
@@ -5544,23 +5535,27 @@ var architectureReservedNamePlacement = {
5544
5535
  const notes = new Map(emptyNames);
5545
5536
  const unusedLabels = [...globalAlternatives.keys()].filter((k) => !usedAlternatives.has(k));
5546
5537
  const globOf = (key) => globalAlternatives.get(key)?.glob;
5547
- for (const map of ["capitalisedUnitPlacements", "anyCaseUnitPlacements"]) {
5548
- const inMap = unusedLabels.filter((k) => globalAlternatives.get(k)?.map === map);
5549
- const hit = keysMatchingAny(inMap.map(globOf), nonUnitParents[map], compile);
5550
- for (const k of inMap) {
5551
- if (hit.has(globOf(k))) notes.set(k, "matched directories but never a unit");
5552
- }
5553
- }
5554
5538
  const stillUnused = unusedLabels.filter((k) => !notes.has(k));
5555
- const globs = [...new Set(stillUnused.map(globOf))];
5556
- const reasons = classifyUnusedKeys(globs, excludedDirs, compile);
5557
- const reachable = keysMatchingAny(globs, allDirs, compile);
5558
- for (const k of stillUnused) {
5559
- const glob = globOf(k);
5560
- if (reasons.get(glob) === "only-excluded") {
5561
- notes.set(k, "matched only excluded directories");
5562
- } else if (!reachable.has(glob)) {
5563
- notes.set(k, "matched no directory");
5539
+ if (stillUnused.length > 0) {
5540
+ const globalExcluded = compile(listOption(globalOptions, "exclude"));
5541
+ const liveDirs = allDirs.filter((d) => !isExcluded(d, ancestorDirs2(d), globalExcluded));
5542
+ const liveUnits = {
5543
+ capitalisedUnitPlacements: liveDirs.filter((d) => isUnitDir(d, filesIn)),
5544
+ anyCaseUnitPlacements: liveDirs.filter((d) => isAnyCaseUnitDir(d, filesIn))
5545
+ };
5546
+ const globs = [...new Set(stillUnused.map(globOf))];
5547
+ const reachesAny = keysMatchingAny(globs, allDirs, compile);
5548
+ const reachesLive = keysMatchingAny(globs, liveDirs, compile);
5549
+ for (const k of stillUnused) {
5550
+ const glob = globOf(k);
5551
+ if (!reachesAny.has(glob)) notes.set(k, "matched no directory");
5552
+ else if (!reachesLive.has(glob)) notes.set(k, "matched only excluded directories");
5553
+ }
5554
+ for (const map of ["capitalisedUnitPlacements", "anyCaseUnitPlacements"]) {
5555
+ const inMap = stillUnused.filter((k) => !notes.has(k) && globalAlternatives.get(k)?.map === map);
5556
+ const inMapGlobs = [...new Set(inMap.map(globOf))];
5557
+ const reachesUnit = keysMatchingAny(inMapGlobs, liveUnits[map], compile);
5558
+ for (const k of inMap) if (!reachesUnit.has(globOf(k))) notes.set(k, "reaches no unit");
5564
5559
  }
5565
5560
  }
5566
5561
  const reported = [...notes.keys()].sort();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svelte-vitals/core",
3
- "version": "0.36.0",
3
+ "version": "0.36.1",
4
4
  "description": "Shared, runtime-agnostic core for svelte-vitals (types, rule engine, scorer, reporter).",
5
5
  "type": "module",
6
6
  "license": "MIT",