diff --git a/packages/frontend-embed/vite.config.ts b/packages/frontend-embed/vite.config.ts index ff00a7d385..81e5d3a2c6 100644 --- a/packages/frontend-embed/vite.config.ts +++ b/packages/frontend-embed/vite.config.ts @@ -1,7 +1,7 @@ import path from 'path'; import pluginVue from '@vitejs/plugin-vue'; import { defineConfig, type UserConfig } from 'vite'; -import * as yaml from 'js-yaml'; +import { load as loadYaml } from 'js-yaml'; import { promises as fsp } from 'fs'; import locales from 'i18n'; @@ -11,7 +11,7 @@ import pluginJson5 from './lib/vite-plugin-json5.js'; import { pluginRemoveUnrefI18n } from '../frontend-builder/rollup-plugin-remove-unref-i18n'; import { Features } from 'lightningcss'; -const url = process.env.NODE_ENV === 'development' ? (yaml.load(await fsp.readFile('../../.config/default.yml', 'utf-8')) as any).url : null; +const url = process.env.NODE_ENV === 'development' ? (loadYaml(await fsp.readFile('../../.config/default.yml', 'utf-8')) as any).url : null; const host = url ? (new URL(url)).hostname : undefined; const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.json', '.json5', '.svg', '.sass', '.scss', '.css', '.vue']; diff --git a/packages/frontend/vite.config.ts b/packages/frontend/vite.config.ts index 8fd30d1849..3574766f7f 100644 --- a/packages/frontend/vite.config.ts +++ b/packages/frontend/vite.config.ts @@ -6,7 +6,7 @@ import { replacePlugin } from 'rolldown/plugins'; import { visualizer } from 'rollup-plugin-visualizer'; import type { PluginOption, UserConfig } from 'vite'; import { defineConfig } from 'vite'; -import * as yaml from 'js-yaml'; +import { load as loadYaml } from 'js-yaml'; import { promises as fsp } from 'fs'; import locales from 'i18n'; @@ -20,7 +20,7 @@ import pluginWatchLocales from './lib/vite-plugin-watch-locales.js'; import { pluginRemoveUnrefI18n } from '../frontend-builder/rollup-plugin-remove-unref-i18n.js'; import { Features } from 'lightningcss'; -const url = process.env.NODE_ENV === 'development' ? (yaml.load(await fsp.readFile('../../.config/default.yml', 'utf-8')) as any).url : null; +const url = process.env.NODE_ENV === 'development' ? (loadYaml(await fsp.readFile('../../.config/default.yml', 'utf-8')) as any).url : null; const host = url ? (new URL(url)).hostname : undefined; const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.json', '.json5', '.svg', '.sass', '.scss', '.css', '.vue']; diff --git a/packages/i18n/scripts/generateLocaleInterface.ts b/packages/i18n/scripts/generateLocaleInterface.ts index 1c0f5c6a79..d5706781d3 100644 --- a/packages/i18n/scripts/generateLocaleInterface.ts +++ b/packages/i18n/scripts/generateLocaleInterface.ts @@ -6,7 +6,7 @@ import * as fs from 'node:fs'; import { fileURLToPath } from 'node:url'; import { dirname, resolve } from 'node:path'; -import * as yaml from 'js-yaml'; +import { load as loadYaml } from 'js-yaml'; import ts from 'typescript'; const __filename = fileURLToPath(import.meta.url); @@ -62,7 +62,7 @@ function createMembers(record: LocaleRecord): ts.TypeElement[] { } export async function generateLocaleInterface(localesDir: string): Promise { - const locale = yaml.load(fs.readFileSync(`${localesDir}/ja-JP.yml`, 'utf-8').toString()) as LocaleRecord; + const locale = loadYaml(fs.readFileSync(`${localesDir}/ja-JP.yml`, 'utf-8').toString()) as LocaleRecord; const members = createMembers(locale); const elements: ts.Statement[] = [ diff --git a/packages/i18n/src/index.ts b/packages/i18n/src/index.ts index 21d215159f..f61905e48f 100644 --- a/packages/i18n/src/index.ts +++ b/packages/i18n/src/index.ts @@ -8,7 +8,7 @@ */ import * as fs from 'node:fs'; -import * as yaml from 'js-yaml'; +import { load as loadYaml } from 'js-yaml'; import { languages, primaries } from './const.js'; import type { Locale } from './autogen/locale.js'; import type { ILocale, ParameterizedString } from './types.js'; @@ -62,7 +62,7 @@ function build(): Record { // https://github.com/misskey-dev/misskey/pull/14057#issuecomment-2192833785 const metaUrl = import.meta.url; const locales = languages.reduce((a, lang) => { - a[lang] = (yaml.load(clean(fs.readFileSync(new URL(`./locales/${lang}.yml`, metaUrl), 'utf-8'))) ?? {}) as ILocale; + a[lang] = (loadYaml(clean(fs.readFileSync(new URL(`./locales/${lang}.yml`, metaUrl), 'utf-8'))) ?? {}) as ILocale; return a; }, {} as Locales); diff --git a/scripts/build-assets.mjs b/scripts/build-assets.mjs index 1086d5a25a..56dee88406 100644 --- a/scripts/build-assets.mjs +++ b/scripts/build-assets.mjs @@ -6,7 +6,7 @@ import * as fs from 'node:fs/promises'; import * as path from 'node:path'; import { fileURLToPath } from 'node:url'; -import * as yaml from 'js-yaml'; +import { load as loadYaml } from 'js-yaml'; import { buildTarball } from './tarball.mjs'; const configDir = fileURLToPath(new URL('../.config', import.meta.url)); @@ -17,7 +17,7 @@ const configPath = process.env.MISSKEY_CONFIG_YML : path.resolve(configDir, 'default.yml'); async function loadConfig() { - return fs.readFile(configPath, 'utf-8').then(data => yaml.load(data)).catch(() => null); + return fs.readFile(configPath, 'utf-8').then(data => loadYaml(data)).catch(() => null); } async function copyFrontendFonts() {