@akinon/next 1.93.0-snapshot-ZERO-3586-20250827130920 → 1.93.0-snapshot-ZERO-3586-20250827132644

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @akinon/next
2
2
 
3
- ## 1.93.0-snapshot-ZERO-3586-20250827130920
3
+ ## 1.93.0-snapshot-ZERO-3586-20250827132644
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -30,7 +30,7 @@
30
30
  - 64699d3ff: ZERO-2761: Fix invalid import for plugin module
31
31
  - 9f8cd3bc: ZERO-3449: AI Search Active Filters & Crop Style changes have been implemented
32
32
  - e974d8e8: ZERO-3406: Fix rc build
33
- - 89ce46f: ZERO-3493: return 404 status code for pz-not-found pages
33
+ - 89ce46fc: ZERO-3493: return 404 status code for pz-not-found pages
34
34
  - 8645d90: ZERO-3574:Refactor redirect tests: streamline mock setup, enhance locale handling, and improve URL path resolution logic
35
35
  - 7eb51ca9: ZERO-3424 :Update package versions
36
36
  - c806fad7: ZERO-3422: Add Flow Payment plugin to the defined plugins list
@@ -51,7 +51,7 @@
51
51
  - 0de55738: ZERO-3418: Update remotePatterns hostname to allow all subdomains
52
52
  - 7e56d6b6b: ZERO-2841: Update api tagTypes
53
53
  - dfaceffd: ZERO-3356: Add useLoyaltyAvailability hook and update checkout state management
54
- - 86642cf: ZERO-3531: Add saveSampleProducts endpoint and update URLs in checkout
54
+ - 86642cfa: ZERO-3531: Add saveSampleProducts endpoint and update URLs in checkout
55
55
  - d99a6a7d: ZERO-3457: Fixed the settings prop and made sure everything is customizable.
56
56
  - 9dc7298a: ZERO-3416: Refactor Accordion component to enhance props and improve styling flexibility
57
57
  - 33377cfd: ZERO-3267: Refactor import statement for ROUTES in error-page component
package/lib/cache.ts CHANGED
@@ -10,7 +10,12 @@ let isZstdInitialized = false;
10
10
 
11
11
  const initZstd = async () => {
12
12
  if (!isZstdInitialized) {
13
- await zstd.init();
13
+ try {
14
+ await zstd.init();
15
+ } catch (error) {
16
+ logger.error('Failed to initialize zstd compression', { error });
17
+ throw new Error('ZSTD initialization failed');
18
+ }
14
19
  isZstdInitialized = true;
15
20
  }
16
21
  };
@@ -283,7 +288,7 @@ export class Cache {
283
288
  await fetch(Cache.PROXY_URL, {
284
289
  method,
285
290
  headers: {
286
- authorization: process.env.CACHE_SECRET
291
+ authorization: process.env.CACHE_SECRET || ''
287
292
  },
288
293
  body
289
294
  })
@@ -384,30 +389,50 @@ export class Cache {
384
389
  });
385
390
  }
386
391
 
387
- await initZstd();
388
- const compressed = Buffer.from(
389
- zstd.compress(new Uint8Array(Buffer.from(serializedValue, 'utf8')), 3)
390
- );
392
+ try {
393
+ await initZstd();
394
+ const compressed = Buffer.from(
395
+ zstd.compress(new Uint8Array(Buffer.from(serializedValue, 'utf8')), 3)
396
+ );
391
397
 
392
- const compressedBase64 = compressed.toString('base64');
398
+ const compressedBase64 = compressed.toString('base64');
393
399
 
394
- if (expire) {
395
- await client.set(key, compressedBase64, { EX: expire });
396
- } else {
397
- await client.set(key, compressedBase64);
398
- }
400
+ if (expire) {
401
+ await client.set(key, compressedBase64, { EX: expire });
402
+ } else {
403
+ await client.set(key, compressedBase64);
404
+ }
399
405
 
400
- success = true;
401
- const compressionRatio = (
402
- (1 - compressed.length / serializedValue.length) *
403
- 100
404
- ).toFixed(2);
405
- logger.debug('Redis setCompressed success', {
406
- key,
407
- originalSize: serializedValue.length,
408
- compressedSize: compressed.length,
409
- compressionRatio: `${compressionRatio}%`
410
- });
406
+ success = true;
407
+ const compressionRatio = (
408
+ (1 - compressed.length / serializedValue.length) *
409
+ 100
410
+ ).toFixed(2);
411
+ logger.debug('Redis setCompressed success', {
412
+ key,
413
+ originalSize: serializedValue.length,
414
+ compressedSize: compressed.length,
415
+ compressionRatio: `${compressionRatio}%`
416
+ });
417
+ } catch (compressionError) {
418
+ // If compression fails, fallback to uncompressed storage
419
+ logger.warn('Compression failed, storing uncompressed', {
420
+ key,
421
+ error: compressionError
422
+ });
423
+
424
+ if (expire) {
425
+ await client.set(key, serializedValue, { EX: expire });
426
+ } else {
427
+ await client.set(key, serializedValue);
428
+ }
429
+
430
+ success = true;
431
+ logger.debug('Redis set success (uncompressed fallback)', {
432
+ key,
433
+ size: serializedValue.length
434
+ });
435
+ }
411
436
  } catch (error) {
412
437
  logger.error('Redis setCompressed error', { key, error });
413
438
  success = false;
@@ -439,10 +464,9 @@ export class Cache {
439
464
  if (compressed) {
440
465
  const compressedBuffer = Buffer.from(compressed, 'base64');
441
466
 
442
- await initZstd();
443
-
444
467
  let decompressed: Buffer;
445
468
  try {
469
+ await initZstd();
446
470
  decompressed = Buffer.from(
447
471
  zstd.decompress(new Uint8Array(compressedBuffer))
448
472
  );
@@ -453,29 +477,46 @@ export class Cache {
453
477
  );
454
478
 
455
479
  try {
456
- const { gunzip } = await import('zlib');
457
- const { promisify } = await import('util');
458
- const gunzipAsync = promisify(gunzip);
459
- decompressed = await gunzipAsync(compressedBuffer as any);
460
- logger.debug('Successfully decompressed with gzip fallback', {
461
- key
462
- });
463
- } catch (gzipError) {
464
- logger.debug('Gzip fallback also failed, trying raw JSON parse', {
465
- key
466
- });
480
+ // Try if it's actually uncompressed JSON (from fallback in setCompressed)
481
+ const rawString = compressed;
482
+ const parsedData = JSON.parse(rawString);
483
+ logger.debug(
484
+ 'Data was stored uncompressed (fallback), returning raw JSON',
485
+ {
486
+ key
487
+ }
488
+ );
489
+ return parsedData;
490
+ } catch (jsonError) {
467
491
  try {
468
- const rawString = compressedBuffer.toString('utf8');
469
- JSON.parse(rawString);
470
- return JSON.parse(rawString);
471
- } catch (jsonError) {
472
- logger.error('All decompression methods failed', {
473
- key,
474
- error,
475
- gzipError,
476
- jsonError
492
+ const { gunzip } = await import('zlib');
493
+ const { promisify } = await import('util');
494
+ const gunzipAsync = promisify(gunzip);
495
+ decompressed = await gunzipAsync(compressedBuffer as any);
496
+ logger.debug('Successfully decompressed with gzip fallback', {
497
+ key
477
498
  });
478
- throw error;
499
+ } catch (gzipError) {
500
+ logger.debug(
501
+ 'All fallback methods failed, trying base64 decoded JSON',
502
+ {
503
+ key
504
+ }
505
+ );
506
+ try {
507
+ const rawString = compressedBuffer.toString('utf8');
508
+ const parsedData = JSON.parse(rawString);
509
+ return parsedData;
510
+ } catch (finalError) {
511
+ logger.error('All decompression methods failed', {
512
+ key,
513
+ error,
514
+ jsonError,
515
+ gzipError,
516
+ finalError
517
+ });
518
+ return null;
519
+ }
479
520
  }
480
521
  }
481
522
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@akinon/next",
3
3
  "description": "Core package for Project Zero Next",
4
- "version": "1.93.0-snapshot-ZERO-3586-20250827130920",
4
+ "version": "1.93.0-snapshot-ZERO-3586-20250827132644",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -35,7 +35,7 @@
35
35
  "set-cookie-parser": "2.6.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@akinon/eslint-plugin-projectzero": "1.93.0-snapshot-ZERO-3586-20250827130920",
38
+ "@akinon/eslint-plugin-projectzero": "1.93.0-snapshot-ZERO-3586-20250827132644",
39
39
  "@babel/core": "7.26.10",
40
40
  "@babel/preset-env": "7.26.9",
41
41
  "@babel/preset-typescript": "7.27.0",
package/with-pz-config.js CHANGED
@@ -17,7 +17,7 @@ const defaultConfig = {
17
17
  {
18
18
  protocol: 'https',
19
19
  hostname: '**'
20
- },
20
+ }
21
21
  ]
22
22
  },
23
23
  modularizeImports: {
@@ -57,6 +57,18 @@ const defaultConfig = {
57
57
  }, {}),
58
58
  translations: false
59
59
  };
60
+
61
+
62
+ config.experiments = {
63
+ ...config.experiments,
64
+ asyncWebAssembly: true
65
+ };
66
+
67
+ config.module.rules.push({
68
+ test: /\.wasm$/,
69
+ type: 'webassembly/async'
70
+ });
71
+
60
72
  return config;
61
73
  },
62
74
  sentry: {