Browse Source

fix build

main
Silberengel 4 weeks ago
parent
commit
adcffaf279
  1. 64
      package-lock.json
  2. 22
      src/lib/services/nostr/event-cache.ts
  3. 61
      vite.config.ts

64
package-lock.json generated

@ -475,7 +475,6 @@ @@ -475,7 +475,6 @@
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -492,7 +491,6 @@ @@ -492,7 +491,6 @@
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -509,7 +507,6 @@ @@ -509,7 +507,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -526,7 +523,6 @@ @@ -526,7 +523,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -543,7 +539,6 @@ @@ -543,7 +539,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -560,7 +555,6 @@ @@ -560,7 +555,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -577,7 +571,6 @@ @@ -577,7 +571,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -594,7 +587,6 @@ @@ -594,7 +587,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -611,7 +603,6 @@ @@ -611,7 +603,6 @@
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -628,7 +619,6 @@ @@ -628,7 +619,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -645,7 +635,6 @@ @@ -645,7 +635,6 @@
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -662,7 +651,6 @@ @@ -662,7 +651,6 @@
"cpu": [
"loong64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -679,7 +667,6 @@ @@ -679,7 +667,6 @@
"cpu": [
"mips64el"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -696,7 +683,6 @@ @@ -696,7 +683,6 @@
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -713,7 +699,6 @@ @@ -713,7 +699,6 @@
"cpu": [
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -730,7 +715,6 @@ @@ -730,7 +715,6 @@
"cpu": [
"s390x"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -747,7 +731,6 @@ @@ -747,7 +731,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -764,7 +747,6 @@ @@ -764,7 +747,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -781,7 +763,6 @@ @@ -781,7 +763,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -798,7 +779,6 @@ @@ -798,7 +779,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -815,7 +795,6 @@ @@ -815,7 +795,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -832,7 +811,6 @@ @@ -832,7 +811,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -849,7 +827,6 @@ @@ -849,7 +827,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -866,7 +843,6 @@ @@ -866,7 +843,6 @@
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -883,7 +859,6 @@ @@ -883,7 +859,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1403,7 +1378,6 @@ @@ -1403,7 +1378,6 @@
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1417,7 +1391,6 @@ @@ -1417,7 +1391,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1431,7 +1404,6 @@ @@ -1431,7 +1404,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1445,7 +1417,6 @@ @@ -1445,7 +1417,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1459,7 +1430,6 @@ @@ -1459,7 +1430,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1473,7 +1443,6 @@ @@ -1473,7 +1443,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1487,7 +1456,6 @@ @@ -1487,7 +1456,6 @@
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1501,7 +1469,6 @@ @@ -1501,7 +1469,6 @@
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1515,7 +1482,6 @@ @@ -1515,7 +1482,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1529,7 +1495,6 @@ @@ -1529,7 +1495,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1543,7 +1508,6 @@ @@ -1543,7 +1508,6 @@
"cpu": [
"loong64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1557,7 +1521,6 @@ @@ -1557,7 +1521,6 @@
"cpu": [
"loong64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1571,7 +1534,6 @@ @@ -1571,7 +1534,6 @@
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1585,7 +1547,6 @@ @@ -1585,7 +1547,6 @@
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1599,7 +1560,6 @@ @@ -1599,7 +1560,6 @@
"cpu": [
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1613,7 +1573,6 @@ @@ -1613,7 +1573,6 @@
"cpu": [
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1627,7 +1586,6 @@ @@ -1627,7 +1586,6 @@
"cpu": [
"s390x"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1641,7 +1599,6 @@ @@ -1641,7 +1599,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1655,7 +1612,6 @@ @@ -1655,7 +1612,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1669,7 +1625,6 @@ @@ -1669,7 +1625,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1683,7 +1638,6 @@ @@ -1683,7 +1638,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1697,7 +1651,6 @@ @@ -1697,7 +1651,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1711,7 +1664,6 @@ @@ -1711,7 +1664,6 @@
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1725,7 +1677,6 @@ @@ -1725,7 +1677,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1739,7 +1690,6 @@ @@ -1739,7 +1690,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -1934,7 +1884,7 @@ @@ -1934,7 +1884,7 @@
"version": "20.19.33",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.33.tgz",
"integrity": "sha512-Rs1bVAIdBs5gbTIKza/tgpMuG1k3U/UMJLWecIMxNdJFDMzcM5LOiLVRYh3PilWEYDIeUDv7bpiHPLPsbydGcw==",
"dev": true,
"devOptional": true,
"license": "MIT",
"dependencies": {
"undici-types": "~6.21.0"
@ -2691,7 +2641,6 @@ @@ -2691,7 +2641,6 @@
"version": "0.24.2",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.2.tgz",
"integrity": "sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"bin": {
@ -3115,7 +3064,6 @@ @@ -3115,7 +3064,6 @@
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"optional": true,
@ -3704,7 +3652,6 @@ @@ -3704,7 +3652,6 @@
"version": "3.3.11",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
"integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
"dev": true,
"funding": [
{
"type": "github",
@ -3897,7 +3844,6 @@ @@ -3897,7 +3844,6 @@
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
"dev": true,
"license": "ISC"
},
"node_modules/picomatch": {
@ -3990,7 +3936,6 @@ @@ -3990,7 +3936,6 @@
"version": "8.5.6",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",
"integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==",
"dev": true,
"funding": [
{
"type": "opencollective",
@ -4211,7 +4156,6 @@ @@ -4211,7 +4156,6 @@
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.57.1.tgz",
"integrity": "sha512-oQL6lgK3e2QZeQ7gcgIkS2YZPg5slw37hYufJ3edKlfQSGGm8ICoxswK15ntSzF/a8+h7ekRy7k7oWc3BQ7y8A==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/estree": "1.0.8"
@ -4474,7 +4418,6 @@ @@ -4474,7 +4418,6 @@
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
"dev": true,
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
@ -4764,7 +4707,7 @@ @@ -4764,7 +4707,7 @@
"version": "5.9.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"dev": true,
"devOptional": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
@ -4784,14 +4727,13 @@ @@ -4784,14 +4727,13 @@
"version": "6.21.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
"dev": true,
"devOptional": true,
"license": "MIT"
},
"node_modules/vite": {
"version": "5.4.21",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz",
"integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==",
"dev": true,
"license": "MIT",
"dependencies": {
"esbuild": "^0.21.3",

22
src/lib/services/nostr/event-cache.ts

@ -4,7 +4,6 @@ @@ -4,7 +4,6 @@
*/
import type { NostrEvent, NostrFilter } from '../../types/nostr.js';
import { createHash } from 'crypto';
import logger from '../logger.js';
interface CacheEntry {
@ -13,6 +12,22 @@ interface CacheEntry { @@ -13,6 +12,22 @@ interface CacheEntry {
ttl: number; // Time to live in milliseconds
}
/**
* Synchronous hash using a simple approach for cache keys
* Since we need synchronous hashing for cache keys, we'll use a simpler approach
* This is sufficient for cache key generation (doesn't need to be cryptographically secure)
*/
function simpleHash(str: string): string {
let hash = 0;
for (let i = 0; i < str.length; i++) {
const char = str.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash = hash & hash; // Convert to 32-bit integer
}
// Convert to positive hex string
return Math.abs(hash).toString(16).padStart(8, '0');
}
/**
* Generate cache key from filter
* Creates a deterministic key based on filter parameters
@ -35,7 +50,8 @@ function generateCacheKey(filter: NostrFilter): string { @@ -35,7 +50,8 @@ function generateCacheKey(filter: NostrFilter): string {
}, {} as Record<string, unknown>);
const filterStr = JSON.stringify(sortedFilter);
return createHash('sha256').update(filterStr).digest('hex');
// Use simple hash for synchronous cache key generation
return simpleHash(filterStr);
}
/**
@ -43,7 +59,7 @@ function generateCacheKey(filter: NostrFilter): string { @@ -43,7 +59,7 @@ function generateCacheKey(filter: NostrFilter): string {
*/
function generateMultiFilterCacheKey(filters: NostrFilter[]): string {
const keys = filters.map(f => generateCacheKey(f)).sort();
return createHash('sha256').update(keys.join('|')).digest('hex');
return simpleHash(keys.join('|'));
}
export class EventCache {

61
vite.config.ts

@ -1,6 +1,65 @@ @@ -1,6 +1,65 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
// Suppress noisy plugin messages about externalized modules
// These are expected for SSR builds and not actual problems
const originalConsoleError = console.error;
const originalConsoleWarn = console.warn;
const originalConsoleLog = console.log;
if (process.env.NODE_ENV === 'production' || process.argv.includes('build')) {
const shouldSuppress = (message: string): boolean => {
return (
message.includes('externalized for browser compatibility') ||
message.includes('[plugin:vite:resolve]') && message.includes('has been externalized')
);
};
console.error = (...args: any[]) => {
const message = args.join(' ');
if (shouldSuppress(message)) {
return;
}
originalConsoleError.apply(console, args);
};
console.warn = (...args: any[]) => {
const message = args.join(' ');
if (shouldSuppress(message)) {
return;
}
originalConsoleWarn.apply(console, args);
};
console.log = (...args: any[]) => {
const message = args.join(' ');
if (shouldSuppress(message)) {
return;
}
originalConsoleLog.apply(console, args);
};
}
export default defineConfig({
plugins: [sveltekit()]
plugins: [sveltekit()],
build: {
rollupOptions: {
onwarn(warning, warn) {
// Suppress warnings about externalized modules (expected for SSR builds)
if (
warning.code === 'MODULE_LEVEL_DIRECTIVE' ||
(typeof warning.message === 'string' &&
warning.message.includes('externalized for browser compatibility'))
) {
return;
}
// Show other warnings
warn(warning);
}
},
// Increase chunk size warning limit to reduce noise
chunkSizeWarningLimit: 2000
},
// Reduce log level to suppress INFO messages
logLevel: 'warn'
});

Loading…
Cancel
Save