このコミットが含まれているのは:
2026-10-12 12:45:00 +09:00
コミット e117e20346
9個のファイルの変更、142行の追加、36行の削除
+7 -2
ファイルの表示
@@ -33,11 +33,16 @@ export const createHelpFixture = () => {
const raw = Object.fromEntries (editionRows.map (([id, language, edition, title, body]) => [
`../../help/${id}/editions/${language}/${edition}.mdx`,
vi.fn (async () => `# ${title}\n\n${body}`)]))
const modules = Object.fromEntries (editionRows.map (([id, language, edition, title, body]) => [
const moduleLoads = Object.fromEntries (editionRows.map (([id, language, edition, title, body]) => [
`../../help/${id}/editions/${language}/${edition}.mdx`,
vi.fn (async (): Promise<{ default: () => ReactElement }> => ({
default: () => createElement ('div', null,
createElement ('h1', null, title), createElement ('p', null, body)) }))]))
// Dynamic imports reuse a module namespace even when called more than once.
const modules = Object.fromEntries (Object.entries (moduleLoads).map (([path, load]) => {
const cache: { promise?: ReturnType<typeof load> } = { }
return [path, vi.fn (() => cache.promise ??= load ())]
}))
const glob = (pattern: string, options?: { query?: string }) => {
if (pattern.endsWith ('article.yml'))
return articles
@@ -53,7 +58,7 @@ export const createHelpFixture = () => {
}
new Function ('require', 'exports', 'helpMeta', compiled) (
requireFixture, api, { glob })
return { api, articles, raw, modules }
return { api, articles, raw, modules, moduleLoads }
}