buttercat1791 12 months ago
parent
commit
4292cf3b13
  1. 12
      src/routes/publication/+page.ts
  2. 3
      tsconfig.json
  3. 6
      vite.config.ts

12
src/routes/publication/+page.ts

@ -1,11 +1,11 @@
import { error } from '@sveltejs/kit'; import { error } from '@sveltejs/kit';
import { NDKRelay, NDKRelaySet, type NDKEvent } from '@nostr-dev-kit/ndk'; import type { NDKEvent } from '@nostr-dev-kit/ndk';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
import { get } from 'svelte/store'; import { getActiveRelays } from '$lib/ndk.ts';
import { getActiveRelays, inboxRelays, ndkInstance } from '$lib/ndk'; import { setContext } from 'svelte';
import { standardRelays } from '$lib/consts'; import { PublicationTree } from '$lib/data_structures/publication_tree.ts';
export const load: PageLoad = async ({ url, parent }) => { export const load: PageLoad = async ({ url, parent }: { url: URL; parent: () => Promise<any> }) => {
const id = url.searchParams.get('id'); const id = url.searchParams.get('id');
const dTag = url.searchParams.get('d'); const dTag = url.searchParams.get('d');
@ -41,6 +41,8 @@ export const load: PageLoad = async ({ url, parent }) => {
const publicationType = indexEvent?.getMatchingTags('type')[0]?.[1]; const publicationType = indexEvent?.getMatchingTags('type')[0]?.[1];
const fetchPromise = parser.fetch(indexEvent); const fetchPromise = parser.fetch(indexEvent);
setContext('publicationTree', new PublicationTree(indexEvent, ndk));
return { return {
waitable: fetchPromise, waitable: fetchPromise,
publicationType, publicationType,

3
tsconfig.json

@ -8,7 +8,8 @@
"resolveJsonModule": true, "resolveJsonModule": true,
"skipLibCheck": true, "skipLibCheck": true,
"sourceMap": true, "sourceMap": true,
"strict": true "strict": true,
"allowImportingTsExtensions": true
} }
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
// //

6
vite.config.ts

@ -3,6 +3,12 @@ import { defineConfig } from "vite";
export default defineConfig({ export default defineConfig({
plugins: [sveltekit()], plugins: [sveltekit()],
resolve: {
alias: {
$lib: './src/lib',
$components: './src/components'
}
},
test: { test: {
include: ['./tests/unit/**/*.unit-test.js'] include: ['./tests/unit/**/*.unit-test.js']
} }

Loading…
Cancel
Save