web: the time-ago script's text is built with the app, so node and bun render the same page
Signed-off-by: dawn <90008@klbr.net>
8 unmodified lines91011121314151617107 unmodified linesExpand all12512612712812913013113213366 unmodified lines8 unmodified lines loopbackClientId, loopbackScope} from "./src/lib/oauth-client-metadata.ts";import { testids } from "./scripts/testids.ts";import { timeAgoTag } from "./src/lib/timeAgoScript.ts";import { readFile, writeFile } from "node:fs/promises";import path from "node:path";import { storybookTest } from "@storybook/addon-vitest/vitest-plugin";import { playwright } from "@vitest/browser-playwright";107 unmodified linesExpand all relative: false } }) ], define: { __TIME_AGO_TAG__: JSON.stringify(timeAgoTag) }, resolve: { alias: { "$icon/": "~icons/lucide/" }66 unmodified lines1234567818 unmodified linesdeclare global { // lib/timeAgoScript.ts's tag, built by vite.config.ts const __TIME_AGO_TAG__: string;
namespace App { interface PageData { // per-page og overrides; the repo layout merges these over its // repo-level defaults and renders the one <Meta>18 unmodified lines24 unmodified lines2526272829303124 unmodified lines watch.observe(document.documentElement, { childList: true, subtree: true }); document.addEventListener("DOMContentLoaded", () => watch.disconnect(), { once: true });}
// a function's text is whatever the runtime that stringifies it makes of it, and node and bun// differ, so vite.config.ts builds this once and every page carries the same bytesexport const timeAgoTag = `<script>(${rewriteTimes})(${agoFormat})</script>`;6 unmodified lines78910111112131489 unmodified lines10410510610710910810911011111242 unmodified lines6 unmodified lines import { AuthorizationError } from "@atcute/oauth-browser-client"; import { createAuth, resumeSignIn, AUTH_KEY } from "#lib/auth.svelte.ts"; import { forgetSignedIn, signedInTag } from "#lib/auth/accounts.ts"; import { callbackPath } from "#lib/oauth-client-metadata.ts"; import { timeAgoTag } from "#lib/timeAgoScript.ts"; import AccountCorner, { SHELL_ACCOUNT } from "#lib/components/shell/AccountCorner.svelte"; import AttestationBanner from "#lib/components/attestations/AttestationBanner.svelte"; import { lightbox, zoomMarkupImages } from "#lib/lightbox.svelte.ts"; import { setSsrBudget } from "#lib/ssr/render.ts";89 unmodified lines
<svelte:head> <title>Tangled</title> <!-- eslint-disable-next-line svelte/no-at-html-tags -- our own code, see lib/timeAgoScript.ts --> {@html timeAgoTag} {@html __TIME_AGO_TAG__} <!-- eslint-disable-next-line svelte/no-at-html-tags -- our own code, see lib/auth/accounts.ts --> {@html signedInTag}</svelte:head>
42 unmodified lines