Skip to content

Build your personal knowledge base with Trilium Notes

fix(deps): adapt to js-yaml v5 named-only exports

Elian Doran454bcb535239
diff --git a/apps/build-docs/src/build-docs.ts b/apps/build-docs/src/build-docs.ts
index 0396db115d..50e829843b 100644
--- a/apps/build-docs/src/build-docs.ts
+++ b/apps/build-docs/src/build-docs.ts
@@ -46,7 +46,7 @@ import { ZipArchive } from "archiver";
import { execSync } from "child_process";
import { createWriteStream, readFileSync } from "fs";
import * as fs from "fs/promises";
-import yaml from "js-yaml";
+import { load } from "js-yaml";
import { dirname, join, resolve } from "path";
import BuildContext from "./context.js";
@@ -110,7 +110,7 @@ async function loadConfig(configPath?: string): Promise<Config | null> {
for (const path of pathsToTry) {
try {
const configContent = await fs.readFile(path, "utf-8");
- const config = yaml.load(configContent) as Config;
+ const config = load(configContent) as Config;
// Resolve all paths relative to the config file's directory
const CONFIG_DIR = dirname(path);
diff --git a/apps/edit-docs/src/edit-docs.ts b/apps/edit-docs/src/edit-docs.ts
index c8c5860b35..2ab6203c96 100644
--- a/apps/edit-docs/src/edit-docs.ts
+++ b/apps/edit-docs/src/edit-docs.ts
@@ -4,7 +4,7 @@ import { cls } from "@triliumnext/core";
import { parseNoteMetaFile, serverTextNoteHandler, standaloneTextNoteHandler } from "./help_meta_generator.js";
import fs from "fs/promises";
-import yaml from "js-yaml";
+import { load } from "js-yaml";
import path from "path";
import packageJson from "../package.json" with { type: "json" };
@@ -98,7 +98,7 @@ async function loadConfig() {
}
const configContent = await fs.readFile(CONFIG_PATH, "utf-8");
- const config = yaml.load(configContent) as Config;
+ const config = load(configContent) as Config;
BASE_URL = config.baseUrl;
// Resolve all paths relative to the config file's directory (for flexibility with external configs)
diff --git a/apps/server/package.json b/apps/server/package.json
index 9f96bb0266..c52b6f97bb 100644
--- a/apps/server/package.json
+++ b/apps/server/package.json
@@ -57,7 +57,6 @@
"@types/express-session": "1.19.0",
"@types/html": "1.0.4",
"@types/ini": "4.1.1",
- "@types/js-yaml": "4.0.9",
"@types/multer": "2.1.0",
"@types/safe-compare": "1.1.2",
"@types/serve-favicon": "2.5.7",
diff --git a/apps/server/src/services/llm/providers/base_provider.ts b/apps/server/src/services/llm/providers/base_provider.ts
index e8e81922dc..ca9c72c401 100644
--- a/apps/server/src/services/llm/providers/base_provider.ts
+++ b/apps/server/src/services/llm/providers/base_provider.ts
@@ -6,7 +6,7 @@
import type { LlmMessage, LlmMessagePart } from "@triliumnext/commons";
import { decodeUtf8 } from "@triliumnext/core/src/services/utils/binary.js";
import { type FilePart, generateText, type ImagePart, type LanguageModel, type ModelMessage, stepCountIs, streamText, type SystemModelMessage, type TextPart, type ToolSet } from "ai";
-import yaml from "js-yaml";
+import { dump } from "js-yaml";
import { becca, getLog } from "@triliumnext/core";
import { getNoteMeta,SYSTEM_PROMPT_LIMITS } from "../tools/helpers.js";
@@ -33,7 +33,7 @@ function buildNoteHint(noteId: string, hasAttachments: boolean): string | null {
return null;
}
- const metadata = yaml.dump(getNoteMeta(note, SYSTEM_PROMPT_LIMITS), { lineWidth: -1 });
+ const metadata = dump(getNoteMeta(note, SYSTEM_PROMPT_LIMITS), { lineWidth: -1 });
const lines = [
"The user is currently viewing the following note.",
"Use this metadata (including contentPreview) to answer questions about the note without calling tools when possible.",
diff --git a/package.json b/package.json
index a8f8097be1..d7057923ac 100644
--- a/package.json
+++ b/package.json
@@ -58,7 +58,6 @@
"@playwright/test": "1.61.0",
"@triliumnext/server": "workspace:*",
"@types/express": "5.0.6",
- "@types/js-yaml": "4.0.9",
"@types/node": "24.13.2",
"@vitest/browser-webdriverio": "4.1.9",
"@vitest/coverage-v8": "4.1.9",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 18579bf089..f6b2b20406 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -106,9 +106,6 @@ importers:
'@types/express':
specifier: 5.0.6
version: 5.0.6
- '@types/js-yaml':
- specifier: 4.0.9
- version: 4.0.9
'@types/node':
specifier: 24.13.2
version: 24.13.2
@@ -672,9 +669,6 @@ importers:
'@types/ini':
specifier: 4.1.1
version: 4.1.1
- '@types/js-yaml':
- specifier: 4.0.9
- version: 4.0.9
'@types/multer':
specifier: 2.1.0
version: 2.1.0
@@ -5717,9 +5711,6 @@ packages:
resolution: {integrity: sha512-9a59A/tycXgYuPABcp6/3spSShn0NT2UOM4EfHvMumjYi4lJWTsK5SZWjhx3yRm9IHGCeWXdV2YfNsrWrft/CA==}
- '@types/[email protected]':
- resolution: {integrity: sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==}
-
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
@@ -18717,8 +18708,6 @@ snapshots:
'@types/[email protected]': {}
- '@types/[email protected]': {}
-
'@types/[email protected]': {}