@hkdigital/lib-sveltekit 0.1.71 → 0.1.73
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/classes/cache/IndexedDbCache.js +30 -27
- package/dist/util/design-system/tailwind.d.ts +4 -2
- package/dist/util/design-system/tailwind.js +1 -1
- package/dist/util/env/index.d.ts +1 -1
- package/dist/util/env/index.js +8 -4
- package/dist/util/http/caching.js +3 -1
- package/dist/util/http/http-request.js +2 -2
- package/package.json +1 -1
@@ -479,33 +479,36 @@ export default class IndexedDbCache {
|
|
479
479
|
const db = await this.dbPromise;
|
480
480
|
let removedCount = 0;
|
481
481
|
|
482
|
-
//
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
//
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
//
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
//
|
507
|
-
|
508
|
-
|
482
|
+
//
|
483
|
+
// DISABLE UNTIL FIXED!!!
|
484
|
+
//
|
485
|
+
// // Step 1: Remove expired entries first
|
486
|
+
// const expiredRemoved = await this._removeExpiredEntries(
|
487
|
+
// this.cleanupBatchSize / 2
|
488
|
+
// );
|
489
|
+
// removedCount += expiredRemoved;
|
490
|
+
|
491
|
+
// // If we have a lot of expired entries, focus on those first
|
492
|
+
// if (expiredRemoved >= this.cleanupBatchSize / 2) {
|
493
|
+
// this.cleanupState.inProgress = false;
|
494
|
+
// this.cleanupState.lastRun = now;
|
495
|
+
// this.cleanupState.totalRemoved += removedCount;
|
496
|
+
|
497
|
+
// // Schedule next cleanup step immediately
|
498
|
+
// this._scheduleCleanup();
|
499
|
+
// return;
|
500
|
+
// }
|
501
|
+
|
502
|
+
// // Step 2: Remove old entries if we're over size/age limits
|
503
|
+
// const remainingBatch = this.cleanupBatchSize - expiredRemoved;
|
504
|
+
// if (remainingBatch > 0) {
|
505
|
+
// const oldRemoved = await this._removeOldEntries(remainingBatch);
|
506
|
+
// removedCount += oldRemoved;
|
507
|
+
// }
|
508
|
+
|
509
|
+
// // Update cleanup state
|
510
|
+
// this.cleanupState.lastRun = now;
|
511
|
+
// this.cleanupState.totalRemoved += removedCount;
|
509
512
|
|
510
513
|
// If we removed entries in this batch, schedule another cleanup
|
511
514
|
if (removedCount > 0) {
|
@@ -65,7 +65,7 @@ export function generateViewportBasedSpacing(values: number[]): {
|
|
65
65
|
* (base, UI, or heading). Each style includes a scaled font size and
|
66
66
|
* line height.
|
67
67
|
*
|
68
|
-
* @param {{[key: string]: TextStyleSizes}}
|
68
|
+
* @param {{[key: string]: TextStyleSizes}} sizes
|
69
69
|
* Set of text sizes to generate styles for
|
70
70
|
*
|
71
71
|
* @param {'base' | 'ui' | 'heading'} category
|
@@ -94,7 +94,9 @@ export function generateViewportBasedSpacing(values: number[]): {
|
|
94
94
|
* // ['calc(24px * var(--scale-text-base))', { lineHeight: 1.4 }]
|
95
95
|
* // }
|
96
96
|
*/
|
97
|
-
export function generateTextStyles(sizes:
|
97
|
+
export function generateTextStyles(sizes: {
|
98
|
+
[key: string]: TextStyleSizes;
|
99
|
+
}, category: "base" | "ui" | "heading"): {
|
98
100
|
[key: string]: [string, {
|
99
101
|
lineHeight: number;
|
100
102
|
}];
|
@@ -105,7 +105,7 @@ export function generateViewportBasedSpacing(values) {
|
|
105
105
|
* (base, UI, or heading). Each style includes a scaled font size and
|
106
106
|
* line height.
|
107
107
|
*
|
108
|
-
* @param {{[key: string]: TextStyleSizes}}
|
108
|
+
* @param {{[key: string]: TextStyleSizes}} sizes
|
109
109
|
* Set of text sizes to generate styles for
|
110
110
|
*
|
111
111
|
* @param {'base' | 'ui' | 'heading'} category
|
package/dist/util/env/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const
|
1
|
+
export const isTestEnv: boolean;
|
package/dist/util/env/index.js
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
|
2
|
-
export const
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
export const isTestEnv = (
|
3
|
+
// For Vite environments
|
4
|
+
(typeof import.meta !== 'undefined' && import.meta.env?.MODE === 'test') ||
|
5
|
+
// For Node environments, safely check process
|
6
|
+
(typeof process !== 'undefined' && process?.env?.NODE_ENV === 'test') ||
|
7
|
+
// For Vitest specific check
|
8
|
+
(typeof process !== 'undefined' && process?.env?.VITEST !== undefined)
|
9
|
+
);
|
@@ -5,6 +5,8 @@ import {
|
|
5
5
|
|
6
6
|
import { browser } from '$app/environment';
|
7
7
|
|
8
|
+
import { isTestEnv } from '../env';
|
9
|
+
|
8
10
|
let defaultCacheStorage = null;
|
9
11
|
|
10
12
|
function getCacheStorage()
|
@@ -13,7 +15,7 @@ function getCacheStorage()
|
|
13
15
|
{
|
14
16
|
let type;
|
15
17
|
|
16
|
-
if( !browser ||
|
18
|
+
if( !browser || isTestEnv )
|
17
19
|
{
|
18
20
|
type = 'memory';
|
19
21
|
}
|
@@ -13,7 +13,7 @@ import { waitForAndCheckResponse } from './response.js';
|
|
13
13
|
|
14
14
|
import { getCachedResponse, storeResponseInCache } from './caching.js';
|
15
15
|
|
16
|
-
import {
|
16
|
+
import { isTestEnv } from '../env';
|
17
17
|
|
18
18
|
/**
|
19
19
|
* Default configuration for HTTP requests
|
@@ -181,7 +181,7 @@ export async function httpRequest(options) {
|
|
181
181
|
const cacheKeyParams = { url, ...headers };
|
182
182
|
const cachedResponse = await getCachedResponse(cacheKeyParams);
|
183
183
|
|
184
|
-
if( !
|
184
|
+
if( !isTestEnv )
|
185
185
|
{
|
186
186
|
if (cachedResponse) {
|
187
187
|
console.debug(`http:cache-hit [${url.pathname}]`);
|