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.js CHANGED
@@ -126,6 +126,7 @@ ${"\u2550".repeat(60)}`);
126
126
  let filteredCount = 0;
127
127
  let emptyPathCount = 0;
128
128
  let lowCountCount = 0;
129
+ let selfTransitionCount = 0;
129
130
  const rawData = rows.map((row) => ({
130
131
  previous_page_path: row.previous_page_path,
131
132
  page_path: row.page_path,
@@ -149,7 +150,7 @@ ${"\u2550".repeat(60)}`);
149
150
  if (this.debug && index < 5) {
150
151
  console.log(` Normalized: "${normalizedPrevious}" \u2192 "${normalizedCurrent}"`);
151
152
  }
152
- if (normalizedCurrent && transitionCount >= minSessions) {
153
+ if (normalizedCurrent && transitionCount >= minSessions && normalizedPrevious !== normalizedCurrent) {
153
154
  navigationData.push({
154
155
  from: normalizedPrevious,
155
156
  to: normalizedCurrent,
@@ -171,6 +172,11 @@ ${"\u2550".repeat(60)}`);
171
172
  if (this.debug && index < 5) {
172
173
  console.log(` \u274C FILTERED: transition count ${transitionCount} < minSessions ${minSessions}`);
173
174
  }
175
+ } else if (normalizedPrevious === normalizedCurrent) {
176
+ selfTransitionCount++;
177
+ if (this.debug && index < 5) {
178
+ console.log(` \u274C FILTERED: self-to-self transition (user stayed on same page)`);
179
+ }
174
180
  }
175
181
  }
176
182
  });
@@ -181,6 +187,7 @@ ${"\u2550".repeat(60)}`);
181
187
  console.log(` \u274C Filtered out: ${filteredCount}`);
182
188
  console.log(` \u2022 Empty paths: ${emptyPathCount}`);
183
189
  console.log(` \u2022 Low transition count: ${lowCountCount}`);
190
+ console.log(` \u2022 Self-to-self transitions: ${selfTransitionCount}`);
184
191
  this.saveDataForInspection(rawData, navigationData);
185
192
  console.log(`
186
193
  ${"\u2550".repeat(60)}`);
@@ -428,6 +435,7 @@ ${"\u2550".repeat(60)}`);
428
435
  const navigationData = [];
429
436
  let processedCount = 0;
430
437
  let filteredCount = 0;
438
+ let selfTransitionCount = 0;
431
439
  const segmentCounts = /* @__PURE__ */ new Map();
432
440
  console.log(`
433
441
  ${"\u2500".repeat(56)}`);
@@ -448,7 +456,7 @@ ${"\u2550".repeat(60)}`);
448
456
  if (this.debug && index < 3) {
449
457
  console.log(` Normalized: "${normalizedPrevious}" \u2192 "${normalizedCurrent}" | segment: "${segment}"`);
450
458
  }
451
- if (normalizedCurrent && transitionCount >= 1) {
459
+ if (normalizedCurrent && transitionCount >= 1 && normalizedPrevious !== normalizedCurrent) {
452
460
  navigationData.push({
453
461
  from: normalizedPrevious,
454
462
  to: normalizedCurrent,
@@ -462,6 +470,9 @@ ${"\u2550".repeat(60)}`);
462
470
  }
463
471
  } else {
464
472
  filteredCount++;
473
+ if (normalizedPrevious === normalizedCurrent) {
474
+ selfTransitionCount++;
475
+ }
465
476
  if (this.debug && index < 3) {
466
477
  console.log(` \u274C FILTERED`);
467
478
  }
@@ -472,6 +483,7 @@ ${"\u2550".repeat(60)}`);
472
483
  console.log(` Processing Summary:`);
473
484
  console.log(` \u2705 Accepted: ${processedCount}`);
474
485
  console.log(` \u274C Filtered out: ${filteredCount}`);
486
+ console.log(` \u2022 Self-to-self transitions: ${selfTransitionCount}`);
475
487
  console.log(`
476
488
  ${"\u2550".repeat(60)}`);
477
489
  console.log(`\u{1F4CA} STAGE 4: FINAL RESULTS (SEGMENTED)`);