vite-plugin-smart-prefetch 0.3.6 → 0.3.7

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.cjs CHANGED
@@ -163,6 +163,7 @@ ${"\u2550".repeat(60)}`);
163
163
  let filteredCount = 0;
164
164
  let emptyPathCount = 0;
165
165
  let lowCountCount = 0;
166
+ let selfTransitionCount = 0;
166
167
  const rawData = rows.map((row) => ({
167
168
  previous_page_path: row.previous_page_path,
168
169
  page_path: row.page_path,
@@ -186,7 +187,7 @@ ${"\u2550".repeat(60)}`);
186
187
  if (this.debug && index < 5) {
187
188
  console.log(` Normalized: "${normalizedPrevious}" \u2192 "${normalizedCurrent}"`);
188
189
  }
189
- if (normalizedCurrent && transitionCount >= minSessions) {
190
+ if (normalizedCurrent && transitionCount >= minSessions && normalizedPrevious !== normalizedCurrent) {
190
191
  navigationData.push({
191
192
  from: normalizedPrevious,
192
193
  to: normalizedCurrent,
@@ -208,6 +209,11 @@ ${"\u2550".repeat(60)}`);
208
209
  if (this.debug && index < 5) {
209
210
  console.log(` \u274C FILTERED: transition count ${transitionCount} < minSessions ${minSessions}`);
210
211
  }
212
+ } else if (normalizedPrevious === normalizedCurrent) {
213
+ selfTransitionCount++;
214
+ if (this.debug && index < 5) {
215
+ console.log(` \u274C FILTERED: self-to-self transition (user stayed on same page)`);
216
+ }
211
217
  }
212
218
  }
213
219
  });
@@ -218,6 +224,7 @@ ${"\u2550".repeat(60)}`);
218
224
  console.log(` \u274C Filtered out: ${filteredCount}`);
219
225
  console.log(` \u2022 Empty paths: ${emptyPathCount}`);
220
226
  console.log(` \u2022 Low transition count: ${lowCountCount}`);
227
+ console.log(` \u2022 Self-to-self transitions: ${selfTransitionCount}`);
221
228
  this.saveDataForInspection(rawData, navigationData);
222
229
  console.log(`
223
230
  ${"\u2550".repeat(60)}`);
@@ -465,6 +472,7 @@ ${"\u2550".repeat(60)}`);
465
472
  const navigationData = [];
466
473
  let processedCount = 0;
467
474
  let filteredCount = 0;
475
+ let selfTransitionCount = 0;
468
476
  const segmentCounts = /* @__PURE__ */ new Map();
469
477
  console.log(`
470
478
  ${"\u2500".repeat(56)}`);
@@ -485,7 +493,7 @@ ${"\u2550".repeat(60)}`);
485
493
  if (this.debug && index < 3) {
486
494
  console.log(` Normalized: "${normalizedPrevious}" \u2192 "${normalizedCurrent}" | segment: "${segment}"`);
487
495
  }
488
- if (normalizedCurrent && transitionCount >= 1) {
496
+ if (normalizedCurrent && transitionCount >= 1 && normalizedPrevious !== normalizedCurrent) {
489
497
  navigationData.push({
490
498
  from: normalizedPrevious,
491
499
  to: normalizedCurrent,
@@ -499,6 +507,9 @@ ${"\u2550".repeat(60)}`);
499
507
  }
500
508
  } else {
501
509
  filteredCount++;
510
+ if (normalizedPrevious === normalizedCurrent) {
511
+ selfTransitionCount++;
512
+ }
502
513
  if (this.debug && index < 3) {
503
514
  console.log(` \u274C FILTERED`);
504
515
  }
@@ -509,6 +520,7 @@ ${"\u2550".repeat(60)}`);
509
520
  console.log(` Processing Summary:`);
510
521
  console.log(` \u2705 Accepted: ${processedCount}`);
511
522
  console.log(` \u274C Filtered out: ${filteredCount}`);
523
+ console.log(` \u2022 Self-to-self transitions: ${selfTransitionCount}`);
512
524
  console.log(`
513
525
  ${"\u2550".repeat(60)}`);
514
526
  console.log(`\u{1F4CA} STAGE 4: FINAL RESULTS (SEGMENTED)`);