fix: use #lib instead of $lib

This commit is contained in:
2026-10-10 21:29:02 -04:00
parent f2559eaad0
commit 8d060204c8
42 changed files with 119 additions and 119 deletions
@@ -1,10 +1,10 @@
<script lang="ts">
import QRCode from 'qrcode';
import { getRefreshToken, getToken, setTokens } from '$lib/utils/auth';
import { parseTotpEnabled } from '$lib/utils/totp';
import { getRefreshToken, getToken, setTokens } from '#lib/utils/auth';
import { parseTotpEnabled } from '#lib/utils/totp';
import { tick } from 'svelte';
import { extractError } from '$lib/utils/misc';
import type { ModalItem, ModalMode } from '$lib/types/modal';
import { extractError } from '#lib/utils/misc';
import type { ModalItem, ModalMode } from '#lib/types/modal';
interface Props {
show?: boolean;
@@ -1,6 +1,6 @@
<script lang="ts">
import Modal from '$lib/components/Modal.svelte';
import { cancelModal, confirmModal, modal } from '$lib/stores/modal';
import Modal from '#lib/components/Modal.svelte';
import { cancelModal, confirmModal, modal } from '#lib/stores/modal';
let state = $derived($modal);
</script>
@@ -1,9 +1,9 @@
<script lang="ts">
import { user } from '$lib/stores/user';
import { user } from '#lib/stores/user';
import { resolve } from '$app/paths';
import { page } from '$app/state';
import { clearTokens, hasRole } from '$lib/utils/auth';
import logo from '$lib/assets/favicon.svg';
import { clearTokens, hasRole } from '#lib/utils/auth';
import logo from '#lib/assets/favicon.svg';
import type { PageData } from '../../routes/$types';
import { slide } from 'svelte/transition';
import { Menu, X } from '@lucide/svelte';
@@ -1,5 +1,5 @@
<script lang="ts">
import { tooltip, dateToRelativeString, formatNumber, formatBytes } from '$lib/utils/misc';
import { tooltip, dateToRelativeString, formatNumber, formatBytes } from '#lib/utils/misc';
import { resolve } from '$app/paths';
import {
Eye,
@@ -15,8 +15,8 @@
HatGlasses,
ThumbsUp
} from '@lucide/svelte';
import { syntaxes } from '$lib/consts';
import type { Paste } from '$lib/types/paste';
import { syntaxes } from '#lib/consts';
import type { Paste } from '#lib/types/paste';
interface Props {
paste: Paste;
@@ -1,14 +1,14 @@
<script lang="ts">
import type { CommentReaction, CommentTreeNode } from '$lib/types/comment';
import { dateToRelativeString, tooltip } from '$lib/utils/misc';
import { parseCommentMarkdown } from '$lib/utils/markdown';
import { escapeHtml } from '$lib/utils/html';
import { user } from '$lib/stores/user';
import PasteCommentItem from '$lib/components/PasteCommentItem.svelte';
import type { CommentReaction, CommentTreeNode } from '#lib/types/comment';
import { dateToRelativeString, tooltip } from '#lib/utils/misc';
import { parseCommentMarkdown } from '#lib/utils/markdown';
import { escapeHtml } from '#lib/utils/html';
import { user } from '#lib/stores/user';
import PasteCommentItem from '#lib/components/PasteCommentItem.svelte';
import { ThumbsUp, ThumbsDown, Trash2, Shredder, Reply, Quote } from '@lucide/svelte';
import { resolve } from '$app/paths';
import RichTextEditor from './RichTextEditor.svelte';
import { hasRole, roles } from '$lib/utils/auth';
import { hasRole, roles } from '#lib/utils/auth';
interface Props {
node: CommentTreeNode;
@@ -1,17 +1,17 @@
<script lang="ts">
import { onMount } from 'svelte';
import { getToken } from '$lib/utils/auth';
import { user } from '$lib/stores/user';
import { getToken } from '#lib/utils/auth';
import { user } from '#lib/stores/user';
import type {
CommentReaction,
CommentReactionResult,
PasteComment,
CommentTreeNode
} from '$lib/types/comment';
import PasteCommentItem from '$lib/components/PasteCommentItem.svelte';
} from '#lib/types/comment';
import PasteCommentItem from '#lib/components/PasteCommentItem.svelte';
import { SvelteMap } from 'svelte/reactivity';
import RichTextEditor from './RichTextEditor.svelte';
import { openModal } from '$lib/stores/modal';
import { openModal } from '#lib/stores/modal';
import { RefreshCw } from '@lucide/svelte';
interface Props {
@@ -1,6 +1,6 @@
<script lang="ts">
import { Bold, Italic, CodeXml, Quote, Send, Eye, Pencil } from '@lucide/svelte';
import { parseCommentMarkdown } from '$lib/utils/markdown';
import { parseCommentMarkdown } from '#lib/utils/markdown';
interface Props {
class?: string;
+1 -1
View File
@@ -1 +1 @@
// place files you want to import through the `$lib` alias in this folder.
// place files you want to import through the `#lib` alias in this folder.
+1 -1
View File
@@ -1,4 +1,4 @@
import { apiUrl } from '$lib/server/api';
import { apiUrl } from '#lib/server/api';
const methodsWithoutBody = new Set(['GET', 'HEAD']);
+1 -1
View File
@@ -1,5 +1,5 @@
import { writable } from 'svelte/store';
import type { ModalOpenOptions, ModalState } from '$lib/types/modal';
import type { ModalOpenOptions, ModalState } from '#lib/types/modal';
const initialState: ModalState = {
show: false,
+1 -1
View File
@@ -1,6 +1,6 @@
import { writable } from 'svelte/store';
import { browser } from '$app/environment';
import type { AuthUser } from '$lib/types/user';
import type { AuthUser } from '#lib/types/user';
let initial: AuthUser | null = null;
+2 -2
View File
@@ -1,7 +1,7 @@
import { browser } from '$app/environment';
import type { Cookies } from '@sveltejs/kit';
import { user } from '$lib/stores/user';
import type { JWTUser } from '$lib/types/user';
import { user } from '#lib/stores/user';
import type { JWTUser } from '#lib/types/user';
export const roles = {
User: 1,
+1 -1
View File
@@ -1,7 +1,7 @@
import { marked } from 'marked';
import createDOMPurify from 'dompurify';
import type { WindowLike } from 'dompurify';
import { trustedDomains } from '$lib/consts';
import { trustedDomains } from '#lib/consts';
import { escapeHtml } from './html';
export const externalMediaWarningStorageKey = 'sharpbin:ignore-external-media-warning';
+1 -1
View File
@@ -1,4 +1,4 @@
import { syntaxes } from '$lib/consts';
import { syntaxes } from '#lib/consts';
/**
* @param bytes Bytes to format.
+7 -7
View File
@@ -1,13 +1,13 @@
<script lang="ts">
import { onMount } from 'svelte';
import './layout.css';
import favicon from '$lib/assets/favicon.svg';
import Navbar from '$lib/components/Navbar.svelte';
import Footer from '$lib/components/Footer.svelte';
import ModalHost from '$lib/components/ModalHost.svelte';
import { user } from '$lib/stores/user';
import { startTokenRefreshInterval, getToken, refreshTokenIfNeeded } from '$lib/utils/auth';
import { parseTotpEnabled } from '$lib/utils/totp';
import favicon from '#lib/assets/favicon.svg';
import Navbar from '#lib/components/Navbar.svelte';
import Footer from '#lib/components/Footer.svelte';
import ModalHost from '#lib/components/ModalHost.svelte';
import { user } from '#lib/stores/user';
import { startTokenRefreshInterval, getToken, refreshTokenIfNeeded } from '#lib/utils/auth';
import { parseTotpEnabled } from '#lib/utils/totp';
import { page } from '$app/state';
import type { LayoutData } from './$types';
+7 -7
View File
@@ -1,20 +1,20 @@
<script lang="ts">
import type { PageData } from './$types';
import { syntaxes, expiresOptions } from '$lib/consts';
import { user } from '$lib/stores/user';
import { getToken } from '$lib/utils/auth';
import { syntaxes, expiresOptions } from '#lib/consts';
import { user } from '#lib/stores/user';
import { getToken } from '#lib/utils/auth';
import { onMount } from 'svelte';
import { fly, fade } from 'svelte/transition';
import { encryptAES, estimateEncryptedSize } from '$lib/utils/encryption';
import { encryptAES, estimateEncryptedSize } from '#lib/utils/encryption';
import {
formatBytes,
formatNumber,
isBinaryData,
tooltip,
syntaxFromExtension
} from '$lib/utils/misc';
import { parseMarkdown } from '$lib/utils/markdown';
import Dropdown from '$lib/components/Dropdown.svelte';
} from '#lib/utils/misc';
import { parseMarkdown } from '#lib/utils/markdown';
import Dropdown from '#lib/components/Dropdown.svelte';
import { SvelteURLSearchParams } from 'svelte/reactivity';
import { FileUp, X, Eye, EyeClosed, Dices } from '@lucide/svelte';
@@ -1,21 +1,21 @@
import { syntaxes } from '$lib/consts';
import { apiUrl } from '$lib/server/api';
import { syntaxes } from '#lib/consts';
import { apiUrl } from '#lib/server/api';
import {
getCachedOgImage,
getCacheControlHeader,
getCacheTtlSeconds,
scheduleOgImageCachePurge,
storeCachedOgImage
} from '$lib/server/og/cache';
import OgPasteEmbed from '$lib/server/og/PasteEmbed.svelte';
import type { PasteEmbedProps } from '$lib/server/og/pasteEmbed';
import type { Paste } from '$lib/types/paste';
} from '#lib/server/og/cache';
import OgPasteEmbed from '#lib/server/og/PasteEmbed.svelte';
import type { PasteEmbedProps } from '#lib/server/og/pasteEmbed';
import type { Paste } from '#lib/types/paste';
import {
dateToRelativeString,
extractDateFromUUIDv7,
formatBytes,
formatNumber
} from '$lib/utils/misc';
} from '#lib/utils/misc';
import { Resvg } from '@resvg/resvg-js';
import { readFile } from 'node:fs/promises';
import { createRequire } from 'node:module';
@@ -1,8 +1,8 @@
import type { PageServerLoad } from './$types';
import type { Paste } from '$lib/types/paste';
import type { PasteComment } from '$lib/types/comment';
import { getServerToken } from '$lib/utils/auth';
import { apiUrl, viewInternalApiKey } from '$lib/server/api';
import type { Paste } from '#lib/types/paste';
import type { PasteComment } from '#lib/types/comment';
import { getServerToken } from '#lib/utils/auth';
import { apiUrl, viewInternalApiKey } from '#lib/server/api';
import { error } from '@sveltejs/kit';
export const load: PageServerLoad = async ({ params, fetch, url, cookies, parent, request }) => {
+12 -12
View File
@@ -36,24 +36,24 @@
dateToRelativeString,
tooltip,
isBinaryData
} from '$lib/utils/misc';
} from '#lib/utils/misc';
import {
getIgnoreExternalMediaWarning,
parseMarkdown,
setIgnoreExternalMediaWarning
} from '$lib/utils/markdown';
import { syntaxes, expiresOptions } from '$lib/consts';
} from '#lib/utils/markdown';
import { syntaxes, expiresOptions } from '#lib/consts';
import { resolve } from '$app/paths';
import { decryptAES, encryptAES } from '$lib/utils/encryption';
import { escapeHtml } from '$lib/utils/html';
import { decryptAES, encryptAES } from '#lib/utils/encryption';
import { escapeHtml } from '#lib/utils/html';
import { fade } from 'svelte/transition';
import { getToken, hasRole } from '$lib/utils/auth';
import { user } from '$lib/stores/user';
import Dropdown from '$lib/components/Dropdown.svelte';
import PasteComments from '$lib/components/PasteComments.svelte';
import { openModal } from '$lib/stores/modal';
import type { Paste, PasteReaction } from '$lib/types/paste';
import HighlightWorker from '$lib/workers/highlight.worker?worker';
import { getToken, hasRole } from '#lib/utils/auth';
import { user } from '#lib/stores/user';
import Dropdown from '#lib/components/Dropdown.svelte';
import PasteComments from '#lib/components/PasteComments.svelte';
import { openModal } from '#lib/stores/modal';
import type { Paste, PasteReaction } from '#lib/types/paste';
import HighlightWorker from '#lib/workers/highlight.worker?worker';
interface Props {
data: PageData;
}
@@ -1,4 +1,4 @@
import { proxyBackendRequest } from '$lib/server/proxy';
import { proxyBackendRequest } from '#lib/server/proxy';
import type { RequestHandler } from './$types';
const handle: RequestHandler = ({ params, request, url }) => {
@@ -1,6 +1,6 @@
<script lang="ts">
import { resolve } from '$app/paths';
import { extractError } from '$lib/utils/misc';
import { extractError } from '#lib/utils/misc';
import { onMount } from 'svelte';
import type { PageData } from './$types';
@@ -1,4 +1,4 @@
import { apiUrl } from '$lib/server/api';
import { apiUrl } from '#lib/server/api';
import { json } from '@sveltejs/kit';
export const GET = async () => {
@@ -1,7 +1,7 @@
<script lang="ts">
import { resolve } from '$app/paths';
import { setTokens, startTokenRefreshInterval } from '$lib/utils/auth';
import { extractError } from '$lib/utils/misc';
import { setTokens, startTokenRefreshInterval } from '#lib/utils/auth';
import { extractError } from '#lib/utils/misc';
import { onMount } from 'svelte';
import type { PageData } from './$types';
@@ -1,4 +1,4 @@
import { proxyBackendRequest } from '$lib/server/proxy';
import { proxyBackendRequest } from '#lib/server/proxy';
import type { RequestHandler } from './$types';
export const GET: RequestHandler = ({ request, url }) => {
@@ -1,4 +1,4 @@
import { proxyBackendRequest } from '$lib/server/proxy';
import { proxyBackendRequest } from '#lib/server/proxy';
import type { RequestHandler } from './$types';
export const GET: RequestHandler = ({ params, request, url }) => {
@@ -1,5 +1,5 @@
import type { RequestHandler } from '@sveltejs/kit';
import { apiUrl } from '$lib/server/api';
import { apiUrl } from '#lib/server/api';
export const GET: RequestHandler = async ({ params, request }) => {
const { id } = params;
@@ -1,6 +1,6 @@
import type { PageServerLoad } from './$types';
import type { Paste } from '$lib/types/paste';
import { extractError } from '$lib/utils/misc';
import type { Paste } from '#lib/types/paste';
import { extractError } from '#lib/utils/misc';
import { error } from '@sveltejs/kit';
export const load: PageServerLoad = async ({ fetch, request }) => {
@@ -1,7 +1,7 @@
<script lang="ts">
import type { PageData } from './$types';
import { onMount } from 'svelte';
import Paste from '$lib/components/Paste.svelte';
import Paste from '#lib/components/Paste.svelte';
interface Props {
data: PageData;
@@ -1,7 +1,7 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { setTokens, startTokenRefreshInterval } from '$lib/utils/auth';
import { extractError } from '$lib/utils/misc';
import { setTokens, startTokenRefreshInterval } from '#lib/utils/auth';
import { extractError } from '#lib/utils/misc';
import { Check, X, Eye, EyeClosed } from '@lucide/svelte';
import { slide, fade } from 'svelte/transition';
import { resolve } from '$app/paths';
@@ -1,8 +1,8 @@
import type { PageServerLoad } from './$types';
import { error } from '@sveltejs/kit';
import { apiUrl } from '$lib/server/api';
import { getServerToken, clearServerTokens, roles, getUserFromToken } from '$lib/utils/auth';
import type { Report } from '$lib/types/report';
import { apiUrl } from '#lib/server/api';
import { getServerToken, clearServerTokens, roles, getUserFromToken } from '#lib/utils/auth';
import type { Report } from '#lib/types/report';
export const load: PageServerLoad = async ({ fetch, cookies, params, url, request }) => {
const token = getServerToken(cookies);
@@ -1,9 +1,9 @@
<script lang="ts">
import type { PageData } from './$types';
import { resolve } from '$app/paths';
import { reportStatusLabels, reportTargetLabels, reportTypeLabels } from '$lib/types/report';
import { tooltip } from '$lib/utils/misc';
import { getToken } from '$lib/utils/auth';
import { reportStatusLabels, reportTargetLabels, reportTypeLabels } from '#lib/types/report';
import { tooltip } from '#lib/utils/misc';
import { getToken } from '#lib/utils/auth';
interface Props {
data: PageData;
@@ -1,15 +1,15 @@
import type { PageServerLoad } from './$types';
import { error } from '@sveltejs/kit';
import { apiUrl } from '$lib/server/api';
import { apiUrl } from '#lib/server/api';
import {
getServerToken,
getUserFromToken,
clearServerTokens,
hasRole,
roles
} from '$lib/utils/auth';
import type { ReportListResponse } from '$lib/types/report';
import { extractError } from '$lib/utils/misc';
} from '#lib/utils/auth';
import type { ReportListResponse } from '#lib/types/report';
import { extractError } from '#lib/utils/misc';
function normalizeTarget(value: string | null): 'all' | 'pastes' | 'users' {
if (value === 'pastes' || value === 'users') return value;
@@ -5,8 +5,8 @@
import type { PageData } from './$types';
import { resolve } from '$app/paths';
import { goto } from '$app/navigation';
import { reportStatusLabels, reportTargetLabels, reportTypeLabels } from '$lib/types/report';
import { tooltip } from '$lib/utils/misc';
import { reportStatusLabels, reportTargetLabels, reportTypeLabels } from '#lib/types/report';
import { tooltip } from '#lib/utils/misc';
import { SvelteURLSearchParams } from 'svelte/reactivity';
interface Props {
@@ -1,5 +1,5 @@
import { apiUrl } from '$lib/server/api';
import { extractError } from '$lib/utils/misc';
import { apiUrl } from '#lib/server/api';
import { extractError } from '#lib/utils/misc';
import { error } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';
@@ -1,6 +1,6 @@
<script lang="ts">
import { resolve } from '$app/paths';
import { extractError } from '$lib/utils/misc';
import { extractError } from '#lib/utils/misc';
import { Check, X } from '@lucide/svelte';
import { slide, fade } from 'svelte/transition';
import type { PageData } from './$types';
@@ -1,7 +1,7 @@
import type { PageServerLoad } from './$types';
import { apiUrl } from '$lib/server/api';
import { apiUrl } from '#lib/server/api';
import { error, isHttpError } from '@sveltejs/kit';
import { extractError } from '$lib/utils/misc';
import { extractError } from '#lib/utils/misc';
export const load: PageServerLoad = async ({ fetch }) => {
try {
@@ -1,6 +1,6 @@
<script lang="ts">
import type { PageData } from './$types';
import { formatBytes, formatNumber, tooltip } from '$lib/utils/misc';
import { formatBytes, formatNumber, tooltip } from '#lib/utils/misc';
import { FileText, Users, Database, TrendingUp } from '@lucide/svelte';
interface Props {
@@ -1,11 +1,11 @@
import type { PageServerLoad } from './$types';
import { error } from '@sveltejs/kit';
import { apiUrl } from '$lib/server/api';
import { getServerToken } from '$lib/utils/auth';
import type { User } from '$lib/types/user';
import type { Paste } from '$lib/types/paste';
import type { Pagination } from '$lib/types/pagination';
import type { Report, ReportListResponse } from '$lib/types/report';
import { apiUrl } from '#lib/server/api';
import { getServerToken } from '#lib/utils/auth';
import type { User } from '#lib/types/user';
import type { Paste } from '#lib/types/paste';
import type { Pagination } from '#lib/types/pagination';
import type { Report, ReportListResponse } from '#lib/types/report';
function decodeJwtRoles(token?: string | null): number {
try {
@@ -6,7 +6,7 @@
import { goto, afterNavigate } from '$app/navigation';
import { page } from '$app/state';
import type { PageData } from './$types';
import type { Pagination } from '$lib/types/pagination';
import type { Pagination } from '#lib/types/pagination';
import {
User,
CalendarDays,
@@ -30,13 +30,13 @@
tooltip,
dateToRelativeString,
extractError
} from '$lib/utils/misc';
import { clearTokens, getToken, hasRole, roles } from '$lib/utils/auth';
import { openModal } from '$lib/stores/modal';
import { user } from '$lib/stores/user';
} from '#lib/utils/misc';
import { clearTokens, getToken, hasRole, roles } from '#lib/utils/auth';
import { openModal } from '#lib/stores/modal';
import { user } from '#lib/stores/user';
import { onMount } from 'svelte';
import Paste from '$lib/components/Paste.svelte';
import { reportStatusLabels, reportTargetLabels, reportTypeLabels } from '$lib/types/report';
import Paste from '#lib/components/Paste.svelte';
import { reportStatusLabels, reportTargetLabels, reportTypeLabels } from '#lib/types/report';
import { fade } from 'svelte/transition';
interface Props {
@@ -1,7 +1,7 @@
import type { RequestEvent } from '@sveltejs/kit';
import { error, redirect } from '@sveltejs/kit';
import { apiUrl } from '$lib/server/api';
import { getServerToken } from '$lib/utils/auth';
import { apiUrl } from '#lib/server/api';
import { getServerToken } from '#lib/utils/auth';
export const load = async ({ params, fetch, cookies }: RequestEvent) => {
const token = getServerToken(cookies);
@@ -1,5 +1,5 @@
import { apiUrl } from '$lib/server/api';
import { extractError } from '$lib/utils/misc';
import { apiUrl } from '#lib/server/api';
import { extractError } from '#lib/utils/misc';
import { error } from '@sveltejs/kit';
export const load = async ({ url, request }) => {
+1 -1
View File
@@ -15,7 +15,7 @@
"moduleResolution": "bundler"
}
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
// except #lib which is handled by https://svelte.dev/docs/kit/configuration#files
//
// To make changes to top-level options such as include and exclude, we recommend extending
// the generated config; see https://svelte.dev/docs/kit/configuration#typescript