mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-28 17:50:28 +08:00
Upgrade all Javascript dependencies
Changes which were needed after the upgrade: - Replace vite-plugin-virtual (vite 8 incompatible) with vite's built-in `define` for the buildTimeConfig injection - tsconfig: drop deprecated `baseUrl` (TS 5+ resolves `paths` relative to tsconfig) - Vitest 4: import `defineConfig` from `vitest/config` so `test` is valid in vite configs - Zod 4: rename `.errors` to `.issues`, make `ZodSchema` a type-only import, drop the removed `SafeParseReturnType` - Tighten/loosen generic casts in localStore to match stricter zod 4 inference - ESLint 9 `no-useless-assignment`: remove redundant initializers and dead reassignments; disable the rule where Svelte's reactive blocks confuse the analyser - Svelte/eslint `prefer-svelte-reactivity`: disable for legacy Svelte usages of URL / Set - Misc naming-convention and prefer-const fixes
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
type Rect = { x: number; y: number; opacity: number };
|
||||
let rects: Rect[] = $state([]);
|
||||
|
||||
const heightWithPadding = viewBoxHeight + 16;
|
||||
const heightWithPadding = $derived.by(() => viewBoxHeight + 16);
|
||||
|
||||
let cellSize: number = $state(0);
|
||||
let rows: number = 0;
|
||||
|
||||
@@ -114,6 +114,7 @@
|
||||
|
||||
// If the anchor is an oid embed
|
||||
if (anchorHref && isCommit(anchorHref)) {
|
||||
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
||||
const url = new URL(rawPath);
|
||||
// deprecated with httpd 0.18.1
|
||||
// For older httpd versions we still pass the mime type.
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
import { onDestroy } from "svelte";
|
||||
|
||||
let observer: IntersectionObserver | undefined = undefined;
|
||||
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
||||
let filesVisibility = new Set<string>();
|
||||
|
||||
if ("IntersectionObserver" in window) {
|
||||
|
||||
+1
-1
@@ -828,7 +828,7 @@ function renderUserAvatar(key: string): string {
|
||||
const sectorIdx = Math.floor(a / ((2 * Math.PI) / petals));
|
||||
if (!sectorGate(a, petals, sectorMask)) continue;
|
||||
|
||||
let inside = false;
|
||||
let inside: boolean;
|
||||
if (shapeModel === "rose") inside = shapeRose(a, petals, tol);
|
||||
else if (shapeModel === "starburst")
|
||||
inside = shapeStarburst(a, petals, softness);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import buildTimeConfig from "virtual:config";
|
||||
import mergeWith from "lodash/mergeWith";
|
||||
import { isArray } from "lodash";
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { SafeParseReturnType } from "zod";
|
||||
import type { Writable } from "svelte/store";
|
||||
|
||||
import { writable, get } from "svelte/store";
|
||||
@@ -32,9 +31,7 @@ export default function storedWritable<
|
||||
> & { clear: () => void } {
|
||||
const stored = !disableLocalStorage ? localStorage.getItem(key) : null;
|
||||
|
||||
const parseFromJson = (
|
||||
content: string,
|
||||
): SafeParseReturnType<string, T["_output"]> => {
|
||||
const parseFromJson = (content: string) => {
|
||||
return z
|
||||
.string()
|
||||
.transform((_, ctx) => {
|
||||
@@ -57,17 +54,19 @@ export default function storedWritable<
|
||||
window?.addEventListener("storage", event => {
|
||||
if (event.key === key) {
|
||||
if (event.newValue === null) {
|
||||
w.set(initialValue);
|
||||
w.set(initialValue as S);
|
||||
return;
|
||||
}
|
||||
|
||||
const { success, data } = parseFromJson(event.newValue);
|
||||
w.set(success ? data : initialValue);
|
||||
w.set(success ? (data as S) : (initialValue as S));
|
||||
}
|
||||
});
|
||||
}
|
||||
const parsed = parseFromJson(stored || initialValue);
|
||||
const w = writable<S>(parsed?.success ? parsed.data : initialValue);
|
||||
const parsed = stored ? parseFromJson(stored) : undefined;
|
||||
const w = writable<S>(
|
||||
parsed?.success ? (parsed.data as S) : (initialValue as S),
|
||||
);
|
||||
|
||||
/**
|
||||
* Set writable value and inform subscribers. Updates the writeable's stored data in
|
||||
@@ -91,7 +90,7 @@ export default function storedWritable<
|
||||
* Delete any data saved for this StoredWritable in localstorage.
|
||||
*/
|
||||
function clear() {
|
||||
w.set(initialValue);
|
||||
w.set(initialValue as S);
|
||||
if (!disableLocalStorage) localStorage.removeItem(key);
|
||||
}
|
||||
|
||||
|
||||
@@ -179,7 +179,6 @@ export function lineNumbersGutter(tree: Root) {
|
||||
// Prepend text from a partial matched earlier text.
|
||||
if (startTextRemainder) {
|
||||
line.unshift({ type: "text", value: startTextRemainder });
|
||||
startTextRemainder = "";
|
||||
}
|
||||
|
||||
if (line.length > 0) {
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ export function parseNodeId(
|
||||
): { prefix: string; pubkey: string } | undefined {
|
||||
const match = /^(did:key:)?(z[a-zA-Z0-9]+)$/.exec(nid);
|
||||
if (match) {
|
||||
let hex: Uint8Array | undefined = undefined;
|
||||
let hex: Uint8Array;
|
||||
try {
|
||||
hex = bs58.decode(match[2].substring(1));
|
||||
} catch (error) {
|
||||
|
||||
@@ -13,33 +13,29 @@
|
||||
sheet.href === null || sheet.href.startsWith(window.location.origin),
|
||||
)
|
||||
.reduce<string[]>(
|
||||
(acc, sheet) =>
|
||||
(acc = [
|
||||
...acc,
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
...Array.from(sheet.cssRules).reduce(
|
||||
(def, rule) =>
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
(def =
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
rule.selectorText === ":root"
|
||||
? [
|
||||
...def,
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
...Array.from(rule.style).filter(name =>
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
name.startsWith(variableName),
|
||||
),
|
||||
]
|
||||
: def),
|
||||
[],
|
||||
),
|
||||
]),
|
||||
(acc, sheet) => [
|
||||
...acc,
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
...Array.from(sheet.cssRules).reduce(
|
||||
(def, rule) =>
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
rule.selectorText === ":root"
|
||||
? [
|
||||
...def,
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
...Array.from(rule.style).filter(name =>
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
name.startsWith(variableName),
|
||||
),
|
||||
]
|
||||
: def,
|
||||
[],
|
||||
),
|
||||
],
|
||||
[],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -146,12 +146,11 @@
|
||||
return patchReviews;
|
||||
}
|
||||
|
||||
let revisionId: string;
|
||||
$: if (view.name === "diff") {
|
||||
revisionId = patch.revisions[patch.revisions.length - 1].id;
|
||||
} else {
|
||||
revisionId = view.revision;
|
||||
}
|
||||
// eslint-disable-next-line no-useless-assignment
|
||||
$: revisionId =
|
||||
view.name === "diff"
|
||||
? patch.revisions[patch.revisions.length - 1].id
|
||||
: view.revision;
|
||||
|
||||
$: uniqueEmbeds = uniqBy(
|
||||
patch.revisions.flatMap(({ discussions }) =>
|
||||
|
||||
@@ -50,8 +50,7 @@
|
||||
$: fetchCommitCount(repo.rid, commit);
|
||||
|
||||
let selectedBranch: string | undefined;
|
||||
let commitButtonVariant: ComponentProps<CommitButton>["variant"] | undefined =
|
||||
undefined;
|
||||
let commitButtonVariant: ComponentProps<CommitButton>["variant"] | undefined;
|
||||
|
||||
// Revision may be a commit ID, a branch name or `undefined` which means the
|
||||
// default branch. We assign `selectedBranch` accordingly.
|
||||
@@ -65,8 +64,7 @@
|
||||
$: lastCommit = tree.lastCommit;
|
||||
$: onCanonical = Boolean(
|
||||
!peer &&
|
||||
selectedBranch ===
|
||||
repo.payloads["xyz.radicle.project"].data.defaultBranch,
|
||||
selectedBranch === repo.payloads["xyz.radicle.project"].data.defaultBranch,
|
||||
);
|
||||
$: if (onCanonical) {
|
||||
commitButtonVariant = "right";
|
||||
|
||||
@@ -174,6 +174,7 @@
|
||||
} else if (!selectedBranch) {
|
||||
selectedTab = "branches";
|
||||
}
|
||||
// eslint-disable-next-line no-useless-assignment
|
||||
lastSelectedBranch = selectedBranch;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user